Add ability to e-mail all maintainers
This commit is contained in:
committed by
Chris Morgan
parent
ef64981a1b
commit
c547b5532d
@@ -16,99 +16,98 @@ if(!$_SESSION['current']->hasPriv("admin"))
|
|||||||
apidb_header("Admin Maintainers");
|
apidb_header("Admin Maintainers");
|
||||||
echo '<form name="sQform" action="adminMaintainers.php" method="post" enctype="multipart/form-data">',"\n";
|
echo '<form name="sQform" action="adminMaintainers.php" method="post" enctype="multipart/form-data">',"\n";
|
||||||
|
|
||||||
if (isset($aClean['sSub']))
|
|
||||||
|
|
||||||
|
// get available maintainers
|
||||||
|
$sQuery = "SELECT * FROM appMaintainers, user_list where appMaintainers.userId = user_list.userid";
|
||||||
|
$sQuery.= " AND state='accepted' ORDER BY realname;";
|
||||||
|
$hResult = query_parameters($sQuery);
|
||||||
|
|
||||||
|
if(!$hResult || !query_num_rows($hResult))
|
||||||
{
|
{
|
||||||
} else
|
// no apps
|
||||||
|
echo html_frame_start("","90%");
|
||||||
|
echo '<p><b>There are no application maintainers.</b></p>',"\n";
|
||||||
|
echo html_frame_end(" ");
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// get available maintainers
|
echo '<div align="center"><a href="'.BASE.'contact.php?sRecipientGroup=maintainers">E-mail all maintainers</a></div>';
|
||||||
$sQuery = "SELECT * FROM appMaintainers, user_list where appMaintainers.userId = user_list.userid";
|
|
||||||
$sQuery.= " AND state='accepted' ORDER BY realname;";
|
|
||||||
$hResult = query_parameters($sQuery);
|
|
||||||
|
|
||||||
if(!$hResult || !query_num_rows($hResult))
|
// show applist
|
||||||
|
echo html_frame_start("","90%","",0);
|
||||||
|
echo "<table width='100%' border=0 cellpadding=3 cellspacing=0>\n\n";
|
||||||
|
|
||||||
|
echo "<tr class=color4>\n";
|
||||||
|
echo " <td><font color=white>Submission Date</font></td>\n";
|
||||||
|
echo " <td><font color=white>Maintainer</font></td>\n";
|
||||||
|
echo " <td><font color=white>Application</font></td>\n";
|
||||||
|
echo " <td><font color=white>Version</font></td>\n";
|
||||||
|
echo " <td align=\"center\">Action</td>\n";
|
||||||
|
echo "</tr>\n\n";
|
||||||
|
|
||||||
|
$c = 1;
|
||||||
|
$oldUserId = 0;
|
||||||
|
while($oRow = query_fetch_object($hResult))
|
||||||
{
|
{
|
||||||
// no apps
|
$oUser = new User($oRow->userId);
|
||||||
echo html_frame_start("","90%");
|
$oApp = new application($oRow->appId);
|
||||||
echo '<p><b>There are no application maintainers.</b></p>',"\n";
|
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
|
||||||
echo html_frame_end(" ");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// show applist
|
|
||||||
echo html_frame_start("","90%","",0);
|
|
||||||
echo "<table width='100%' border=0 cellpadding=3 cellspacing=0>\n\n";
|
|
||||||
|
|
||||||
echo "<tr class=color4>\n";
|
/* if this is a new user we should print a header that has the aggregate of the applications */
|
||||||
echo " <td><font color=white>Submission Date</font></td>\n";
|
/* the user super maintains and versions they maintain */
|
||||||
echo " <td><font color=white>Maintainer</font></td>\n";
|
if($oRow->userId != $oldUserId)
|
||||||
echo " <td><font color=white>Application</font></td>\n";
|
|
||||||
echo " <td><font color=white>Version</font></td>\n";
|
|
||||||
echo " <td align=\"center\">Action</td>\n";
|
|
||||||
echo "</tr>\n\n";
|
|
||||||
|
|
||||||
$c = 1;
|
|
||||||
$oldUserId = 0;
|
|
||||||
while($oRow = query_fetch_object($hResult))
|
|
||||||
{
|
{
|
||||||
$oUser = new User($oRow->userId);
|
$style = "border-top:thin solid;border-bottom:thin solid";
|
||||||
$oApp = new application($oRow->appId);
|
|
||||||
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
|
|
||||||
|
|
||||||
/* if this is a new user we should print a header that has the aggregate of the applications */
|
echo "<tr class=color4>\n";
|
||||||
/* the user super maintains and versions they maintain */
|
echo " <td style=\"$style;border-left:thin solid\">Maintainer summary</td>\n";
|
||||||
if($oRow->userId != $oldUserId)
|
if($oUser->sRealname == "")
|
||||||
{
|
echo " <td style=\"$style\"><a href=\"mailto:".$oUser->sEmail."\"> </a></td>\n";
|
||||||
$style = "border-top:thin solid;border-bottom:thin solid";
|
else
|
||||||
|
echo " <td style=\"$style\"><a href=\"mailto:".$oUser->sEmail."\">".$oUser->sRealname."</a></td>\n";
|
||||||
|
|
||||||
echo "<tr class=color4>\n";
|
$count = Maintainer::getMaintainerCountForUser($oUser, true);
|
||||||
echo " <td style=\"$style;border-left:thin solid\">Maintainer summary</td>\n";
|
if($count == 0)
|
||||||
if($oUser->sRealname == "")
|
echo " <td style=\"$style\"> </td>\n";
|
||||||
echo " <td style=\"$style\"><a href=\"mailto:".$oUser->sEmail."\"> </a></td>\n";
|
else if($count <= 1)
|
||||||
else
|
echo " <td style=\"$style\">".$count." app</td>\n";
|
||||||
echo " <td style=\"$style\"><a href=\"mailto:".$oUser->sEmail."\">".$oUser->sRealname."</a></td>\n";
|
else
|
||||||
|
echo " <td style=\"$style\">".$count." apps</td>\n";
|
||||||
$count = Maintainer::getMaintainerCountForUser($oUser, true);
|
|
||||||
if($count == 0)
|
|
||||||
echo " <td style=\"$style\"> </td>\n";
|
|
||||||
else if($count <= 1)
|
|
||||||
echo " <td style=\"$style\">".$count." app</td>\n";
|
|
||||||
else
|
|
||||||
echo " <td style=\"$style\">".$count." apps</td>\n";
|
|
||||||
|
|
||||||
|
|
||||||
$count = Maintainer::getMaintainerCountForUser($oUser, false);
|
$count = Maintainer::getMaintainerCountForUser($oUser, false);
|
||||||
if($count == 0)
|
if($count == 0)
|
||||||
echo " <td style=\"$style\"> </td>\n";
|
echo " <td style=\"$style\"> </td>\n";
|
||||||
else if($count <= 1)
|
else if($count <= 1)
|
||||||
echo " <td style=\"$style\">".$count." version</td>\n";
|
echo " <td style=\"$style\">".$count." version</td>\n";
|
||||||
else
|
else
|
||||||
echo " <td style=\"$style\">".$count." versions</td>\n";
|
echo " <td style=\"$style\">".$count." versions</td>\n";
|
||||||
|
|
||||||
echo " <td align=\"center\" style=\"$style;border-right:thin solid\"> </td>\n";
|
echo " <td align=\"center\" style=\"$style;border-right:thin solid\"> </td>\n";
|
||||||
echo "</tr>\n\n";
|
|
||||||
|
|
||||||
$oldUserId = $oRow->userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "<tr class=$bgcolor>\n";
|
|
||||||
echo " <td>".print_date(mysqldatetime_to_unixtimestamp($oRow->submitTime))." </td>\n";
|
|
||||||
echo " <td><a href=\"mailto:".$oUser->sEmail."\">".$oUser->sRealname."</a></td>\n";
|
|
||||||
echo " <td>".$oApp->objectMakeLink()."</td>\n";
|
|
||||||
if($oRow->superMaintainer)
|
|
||||||
{
|
|
||||||
echo " <td>*</td>\n";
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
$oVersion = new version($oRow->versionId);
|
|
||||||
echo " <td>".$oVersion->objectMakeLink()."</td>\n";
|
|
||||||
}
|
|
||||||
echo " <td align=\"center\">[<a href='".BASE."objectManager.php?sClass=maintainer&iId=$oRow->maintainerId&bIsQueue=false&sTitle=Admin%20Maintainers&sAction=delete&sReturnTo=".APPDB_ROOT."admin/adminMaintainers.php'>delete</a>]</td>\n";
|
|
||||||
echo "</tr>\n\n";
|
echo "</tr>\n\n";
|
||||||
$c++;
|
|
||||||
|
$oldUserId = $oRow->userId;
|
||||||
}
|
}
|
||||||
echo "</table>\n\n";
|
|
||||||
echo html_frame_end(" ");
|
echo "<tr class=$bgcolor>\n";
|
||||||
|
echo " <td>".print_date(mysqldatetime_to_unixtimestamp($oRow->submitTime))." </td>\n";
|
||||||
|
echo " <td><a href=\"mailto:".$oUser->sEmail."\">".$oUser->sRealname."</a></td>\n";
|
||||||
|
echo " <td>".$oApp->objectMakeLink()."</td>\n";
|
||||||
|
if($oRow->superMaintainer)
|
||||||
|
{
|
||||||
|
echo " <td>*</td>\n";
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
$oVersion = new version($oRow->versionId);
|
||||||
|
echo " <td>".$oVersion->objectMakeLink()."</td>\n";
|
||||||
|
}
|
||||||
|
echo " <td align=\"center\">[<a href='".BASE."objectManager.php?sClass=maintainer&iId=$oRow->maintainerId&bIsQueue=false&sTitle=Admin%20Maintainers&sAction=delete&sReturnTo=".APPDB_ROOT."admin/adminMaintainers.php'>delete</a>]</td>\n";
|
||||||
|
echo "</tr>\n\n";
|
||||||
|
$c++;
|
||||||
}
|
}
|
||||||
|
echo "</table>\n\n";
|
||||||
|
echo html_frame_end(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "</form>";
|
echo "</form>";
|
||||||
|
|||||||
76
contact.php
76
contact.php
@@ -17,11 +17,40 @@ if(!$oUser->isLoggedIn())
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$oRecipient = null;
|
||||||
|
$sRecipientText = '';
|
||||||
|
$iRecipientId = null;
|
||||||
|
$sRecipientGroup = getInput('sRecipientGroup', $aClean);
|
||||||
|
$sRecipients = '';
|
||||||
|
|
||||||
$oRecipient = new User($aClean['iRecipientId']);
|
if($sRecipientGroup)
|
||||||
|
{
|
||||||
|
if(!$oUser->hasPriv('admin'))
|
||||||
|
util_show_error_page_and_exit("Only admins can do this");
|
||||||
|
|
||||||
if(!User::exists($oRecipient->sEmail))
|
switch($sRecipientGroup)
|
||||||
util_show_error_page_and_exit("User not found");
|
{
|
||||||
|
case 'maintainers':
|
||||||
|
$sRecipientText = 'all maintainers';
|
||||||
|
$sRecipients = maintainer::getSubmitterEmails();
|
||||||
|
if($sRecipients === FALSE)
|
||||||
|
util_show_error_page_and_exit("Failed to get list of maintainers");
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
util_show_error_page_and_exit("Invalid recipient group");
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
$oRecipient = new User($aClean['iRecipientId']);
|
||||||
|
$iRecipientId = $oRecipient->iUserId;
|
||||||
|
$sRecipients = $oRecipient->sEmail;
|
||||||
|
|
||||||
|
if(!User::exists($oRecipient->sEmail))
|
||||||
|
util_show_error_page_and_exit("User not found");
|
||||||
|
|
||||||
|
$sRecipientText = $oRecipient->sRealname;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check for errors */
|
/* Check for errors */
|
||||||
if((!$aClean['sMessage'] || !$aClean['sSubject']) && $aClean['sSubmit'])
|
if((!$aClean['sMessage'] || !$aClean['sSubject']) && $aClean['sSubmit'])
|
||||||
@@ -34,21 +63,22 @@ if((!$aClean['sMessage'] || !$aClean['sSubject']) && $aClean['sSubmit'])
|
|||||||
/* Display the feedback form if nothing else is specified */
|
/* Display the feedback form if nothing else is specified */
|
||||||
if(!$aClean['sSubmit'])
|
if(!$aClean['sSubmit'])
|
||||||
{
|
{
|
||||||
apidb_header("E-mail $oRecipient->sRealname");
|
apidb_header("E-mail $sRecipientText");
|
||||||
echo html_frame_start("Send us your suggestions",400,"",0);
|
echo ' ';
|
||||||
|
echo html_frame_start("Composer",400,"",0);
|
||||||
|
|
||||||
echo $error;
|
echo $error;
|
||||||
echo "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">";
|
echo "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">";
|
||||||
|
|
||||||
/* User manager */
|
/* User manager */
|
||||||
if($_SESSION['current']->hasPriv("admin"))
|
if($_SESSION['current']->hasPriv("admin") && $oRecipient)
|
||||||
{
|
{
|
||||||
echo "<p><a href=\"".BASE."preferences.php?iUserId=".
|
echo "<p><a href=\"".BASE."preferences.php?iUserId=".
|
||||||
$oRecipient->iUserId."&sSearch=Administrator&iLimit".
|
$oRecipient->iUserId."&sSearch=Administrator&iLimit".
|
||||||
"=100&sOrderBy=email\">User manager</a></p>";
|
"=100&sOrderBy=email\">User manager</a></p>";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<p>E-mail $oRecipient->sRealname.</p>";
|
echo "<p>E-mail $sRecipientText.</p>";
|
||||||
|
|
||||||
$oTable = new Table();
|
$oTable = new Table();
|
||||||
$oTable->SetWidth("100%");
|
$oTable->SetWidth("100%");
|
||||||
@@ -83,7 +113,10 @@ if(!$aClean['sSubmit'])
|
|||||||
echo $oTable->GetString();
|
echo $oTable->GetString();
|
||||||
|
|
||||||
echo "<input type=\"hidden\" name=\"iRecipientId\" ".
|
echo "<input type=\"hidden\" name=\"iRecipientId\" ".
|
||||||
"value=\"$oRecipient->iUserId\">";
|
"value=\"$iRecipientId\">";
|
||||||
|
|
||||||
|
echo "<input type=\"hidden\" name=\"sRecipientGroup\" ".
|
||||||
|
"value=\"$sRecipientGroup\">";
|
||||||
|
|
||||||
echo "</form>\n";
|
echo "</form>\n";
|
||||||
|
|
||||||
@@ -91,19 +124,26 @@ if(!$aClean['sSubmit'])
|
|||||||
|
|
||||||
} else if ($aClean['sSubject'] && $aClean['sMessage'])
|
} else if ($aClean['sSubject'] && $aClean['sMessage'])
|
||||||
{
|
{
|
||||||
$sSubjectRe = $aClean['sSubject'];
|
if($oRecipient)
|
||||||
if(substr($sSubjectRe, 0, 4) != "Re: ")
|
{
|
||||||
$sSubjectRe = "Re: $sSubjectRe";
|
$sSubjectRe = $aClean['sSubject'];
|
||||||
|
if(substr($sSubjectRe, 0, 4) != "Re: ")
|
||||||
|
$sSubjectRe = "Re: $sSubjectRe";
|
||||||
|
|
||||||
$sSubjectRe = urlencode($sSubjectRe);
|
$sSubjectRe = urlencode($sSubjectRe);
|
||||||
|
|
||||||
$sMsg = "The following message was sent to you from $oUser->sRealname ";
|
$sMsg = "The following message was sent to you from $oUser->sRealname ";
|
||||||
$sMsg .= "through the Wine AppDB contact form.\nTo Reply, visit ";
|
$sMsg .= "through the Wine AppDB contact form.\nTo Reply, visit ";
|
||||||
$sMsg .= APPDB_ROOT."contact.php?iRecipientId=$oUser->iUserId&sSubject=";
|
$sMsg .= APPDB_ROOT."contact.php?iRecipientId=$oUser->iUserId&sSubject=";
|
||||||
$sMsg .= $sSubjectRe."\n\n";
|
$sMsg .= $sSubjectRe."\n\n";
|
||||||
$sMsg .= $aClean['sMessage'];
|
$sMsg .= $aClean['sMessage'];
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
$sMsg = "The following message was sent to you by the AppDB admins:\n\n";
|
||||||
|
$sMsg .= $aClean['sMessage'];
|
||||||
|
}
|
||||||
|
|
||||||
mail_appdb($oRecipient->sEmail, $aClean['sSubject'], $sMsg);
|
mail_appdb($sRecipients, $aClean['sSubject'], $sMsg);
|
||||||
|
|
||||||
util_redirect_and_exit(BASE."index.php");
|
util_redirect_and_exit(BASE."index.php");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -395,6 +395,25 @@ class maintainer
|
|||||||
return $hResult;
|
return $hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSubmitterEmails()
|
||||||
|
{
|
||||||
|
$sRecipients = '';
|
||||||
|
$sQuery = "SELECT DISTINCT(user_list.email) FROM appMaintainers, user_list WHERE
|
||||||
|
appMaintainers.userId = user_list.userId
|
||||||
|
AND
|
||||||
|
appMaintainers.state = 'accepted'";
|
||||||
|
$hResult = query_parameters($sQuery);
|
||||||
|
if(!$hResult)
|
||||||
|
return FALSE;
|
||||||
|
for($i = 0; $oRow = query_fetch_object($hResult); $i++)
|
||||||
|
{
|
||||||
|
if($i)
|
||||||
|
$sRecipients .= ' ';
|
||||||
|
$sRecipients = $oRow->email;
|
||||||
|
}
|
||||||
|
return $sRecipients;
|
||||||
|
}
|
||||||
|
|
||||||
function ObjectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = '', $bAscending = true)
|
function ObjectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = '', $bAscending = true)
|
||||||
{
|
{
|
||||||
/* Not implemented */
|
/* Not implemented */
|
||||||
|
|||||||
Reference in New Issue
Block a user