Add ability to e-mail all maintainers
This commit is contained in:
committed by
Chris Morgan
parent
ef64981a1b
commit
c547b5532d
@@ -16,24 +16,24 @@ 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']))
|
|
||||||
{
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
// 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))
|
|
||||||
{
|
// 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))
|
||||||
|
{
|
||||||
// no apps
|
// no apps
|
||||||
echo html_frame_start("","90%");
|
echo html_frame_start("","90%");
|
||||||
echo '<p><b>There are no application maintainers.</b></p>',"\n";
|
echo '<p><b>There are no application maintainers.</b></p>',"\n";
|
||||||
echo html_frame_end(" ");
|
echo html_frame_end(" ");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
echo '<div align="center"><a href="'.BASE.'contact.php?sRecipientGroup=maintainers">E-mail all maintainers</a></div>';
|
||||||
|
|
||||||
// show applist
|
// show applist
|
||||||
echo html_frame_start("","90%","",0);
|
echo html_frame_start("","90%","",0);
|
||||||
echo "<table width='100%' border=0 cellpadding=3 cellspacing=0>\n\n";
|
echo "<table width='100%' border=0 cellpadding=3 cellspacing=0>\n\n";
|
||||||
@@ -108,7 +108,6 @@ if (isset($aClean['sSub']))
|
|||||||
}
|
}
|
||||||
echo "</table>\n\n";
|
echo "</table>\n\n";
|
||||||
echo html_frame_end(" ");
|
echo html_frame_end(" ");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "</form>";
|
echo "</form>";
|
||||||
|
|||||||
56
contact.php
56
contact.php
@@ -17,12 +17,41 @@ 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)
|
||||||
|
{
|
||||||
|
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");
|
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,6 +124,8 @@ if(!$aClean['sSubmit'])
|
|||||||
|
|
||||||
} else if ($aClean['sSubject'] && $aClean['sMessage'])
|
} else if ($aClean['sSubject'] && $aClean['sMessage'])
|
||||||
{
|
{
|
||||||
|
if($oRecipient)
|
||||||
|
{
|
||||||
$sSubjectRe = $aClean['sSubject'];
|
$sSubjectRe = $aClean['sSubject'];
|
||||||
if(substr($sSubjectRe, 0, 4) != "Re: ")
|
if(substr($sSubjectRe, 0, 4) != "Re: ")
|
||||||
$sSubjectRe = "Re: $sSubjectRe";
|
$sSubjectRe = "Re: $sSubjectRe";
|
||||||
@@ -102,8 +137,13 @@ if(!$aClean['sSubmit'])
|
|||||||
$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