2007-01-18 02:38:18 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
require_once("path.php");
|
|
|
|
|
require_once(BASE."/include/incl.php");
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Page containing a form for sending e-mail
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
$oUser = new User($_SESSION['current']->iUserId);
|
|
|
|
|
|
|
|
|
|
/* Restrict error to logged-in users */
|
|
|
|
|
if(!$oUser->isLoggedIn())
|
2007-11-05 19:27:17 +01:00
|
|
|
{
|
|
|
|
|
login_form();
|
|
|
|
|
exit;
|
|
|
|
|
}
|
2007-01-18 02:38:18 +00:00
|
|
|
|
2008-05-12 21:36:51 +02:00
|
|
|
$oRecipient = null;
|
|
|
|
|
$sRecipientText = '';
|
|
|
|
|
$iRecipientId = null;
|
|
|
|
|
$sRecipientGroup = getInput('sRecipientGroup', $aClean);
|
|
|
|
|
$sRecipients = '';
|
2007-01-18 02:38:18 +00:00
|
|
|
|
2008-05-12 21:36:51 +02:00
|
|
|
if($sRecipientGroup)
|
|
|
|
|
{
|
|
|
|
|
if(!$oUser->hasPriv('admin'))
|
|
|
|
|
util_show_error_page_and_exit("Only admins can do this");
|
|
|
|
|
|
|
|
|
|
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");
|
2007-01-18 02:38:18 +00:00
|
|
|
|
2008-05-12 21:36:51 +02:00
|
|
|
$sRecipientText = $oRecipient->sRealname;
|
|
|
|
|
}
|
2007-01-18 02:38:18 +00:00
|
|
|
|
|
|
|
|
/* Check for errors */
|
|
|
|
|
if((!$aClean['sMessage'] || !$aClean['sSubject']) && $aClean['sSubmit'])
|
|
|
|
|
{
|
|
|
|
|
$error = "<font color=\"red\">Please enter both a subject and a ".
|
|
|
|
|
"message.</font>";
|
|
|
|
|
$aClean['sSubmit'] = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Display the feedback form if nothing else is specified */
|
|
|
|
|
if(!$aClean['sSubmit'])
|
|
|
|
|
{
|
2008-05-12 21:36:51 +02:00
|
|
|
apidb_header("E-mail $sRecipientText");
|
|
|
|
|
echo ' ';
|
|
|
|
|
echo html_frame_start("Composer",400,"",0);
|
2007-01-18 02:38:18 +00:00
|
|
|
|
|
|
|
|
echo $error;
|
|
|
|
|
echo "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">";
|
2007-04-21 19:45:12 +00:00
|
|
|
|
|
|
|
|
/* User manager */
|
2008-05-12 21:36:51 +02:00
|
|
|
if($_SESSION['current']->hasPriv("admin") && $oRecipient)
|
2007-04-21 19:45:12 +00:00
|
|
|
{
|
|
|
|
|
echo "<p><a href=\"".BASE."preferences.php?iUserId=".
|
2008-02-23 12:06:24 +11:00
|
|
|
$oRecipient->iUserId."&sSearch=Administrator&iLimit".
|
|
|
|
|
"=100&sOrderBy=email\">User manager</a></p>";
|
2007-04-21 19:45:12 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-18 16:07:14 +02:00
|
|
|
if($oRecipient)
|
|
|
|
|
{
|
|
|
|
|
echo "<p><a href=\"".BASE."objectManager.php?sClass=maintainerView&iId=".
|
|
|
|
|
"{$oRecipient->iUserId}&sTitle=Maintained+Apps\">Maintained apps</a>";
|
|
|
|
|
}
|
|
|
|
|
|
2008-05-12 21:36:51 +02:00
|
|
|
echo "<p>E-mail $sRecipientText.</p>";
|
|
|
|
|
|
2007-07-23 19:56:43 +00:00
|
|
|
$oTable = new Table();
|
|
|
|
|
$oTable->SetWidth("100%");
|
|
|
|
|
$oTable->SetBorder(0);
|
|
|
|
|
$oTable->SetCellPadding(2);
|
|
|
|
|
$oTable->SetCellSpacing(2);
|
2008-05-12 21:36:51 +02:00
|
|
|
|
2007-07-23 19:56:43 +00:00
|
|
|
$oTableRow = new TableRow();
|
|
|
|
|
$oTableRow->SetClass("color4");
|
|
|
|
|
$oTableRow->AddTextCell("Subject");
|
2007-07-30 23:17:16 +00:00
|
|
|
$oTableCell = new TableCell("<input type=\"text\" name=\"sSubject\" size=\"71\"".
|
2008-02-23 12:06:24 +11:00
|
|
|
" value=\"".$aClean['sSubject']."\">");
|
2007-07-23 19:56:43 +00:00
|
|
|
$oTableRow->AddCell($oTableCell);
|
|
|
|
|
$oTable->AddRow($oTableRow);
|
|
|
|
|
|
|
|
|
|
$oTableRow = new TableRow();
|
|
|
|
|
$oTableRow->SetClass("color4");
|
|
|
|
|
$oTableCell = new TableCell("Message");
|
|
|
|
|
$oTableCell->SetValign("top");
|
|
|
|
|
$oTableRow->AddCell($oTableCell);
|
2007-07-30 23:17:16 +00:00
|
|
|
$oTableCell = new TableCell("<textarea name=\"sMessage\" rows=\"15\" cols=\"60\">"
|
|
|
|
|
.$aClean['sMessage']."</textarea>");
|
2007-07-23 19:56:43 +00:00
|
|
|
$oTableRow->AddCell($oTableCell);
|
|
|
|
|
$oTable->AddRow($oTableRow);
|
|
|
|
|
|
|
|
|
|
$oTableRow = new TableRow();
|
|
|
|
|
$oTableRow->AddTextCell("");
|
2008-02-23 12:06:24 +11:00
|
|
|
$oTableRow->AddTextCell("<input type=\"submit\" value=\"Submit\" name=\"sSubmit\">");
|
2007-07-23 19:56:43 +00:00
|
|
|
$oTable->AddRow($oTableRow);
|
|
|
|
|
|
|
|
|
|
// output the table
|
|
|
|
|
echo $oTable->GetString();
|
2007-01-18 02:38:18 +00:00
|
|
|
|
|
|
|
|
echo "<input type=\"hidden\" name=\"iRecipientId\" ".
|
2008-05-12 21:36:51 +02:00
|
|
|
"value=\"$iRecipientId\">";
|
|
|
|
|
|
|
|
|
|
echo "<input type=\"hidden\" name=\"sRecipientGroup\" ".
|
|
|
|
|
"value=\"$sRecipientGroup\">";
|
2007-01-18 02:38:18 +00:00
|
|
|
|
|
|
|
|
echo "</form>\n";
|
|
|
|
|
|
|
|
|
|
echo html_frame_end(" ");
|
|
|
|
|
|
|
|
|
|
} else if ($aClean['sSubject'] && $aClean['sMessage'])
|
|
|
|
|
{
|
2008-05-12 21:36:51 +02:00
|
|
|
if($oRecipient)
|
|
|
|
|
{
|
|
|
|
|
$sSubjectRe = $aClean['sSubject'];
|
|
|
|
|
if(substr($sSubjectRe, 0, 4) != "Re: ")
|
|
|
|
|
$sSubjectRe = "Re: $sSubjectRe";
|
|
|
|
|
|
|
|
|
|
$sSubjectRe = urlencode($sSubjectRe);
|
|
|
|
|
|
|
|
|
|
$sMsg = "The following message was sent to you from $oUser->sRealname ";
|
|
|
|
|
$sMsg .= "through the Wine AppDB contact form.\nTo Reply, visit ";
|
|
|
|
|
$sMsg .= APPDB_ROOT."contact.php?iRecipientId=$oUser->iUserId&sSubject=";
|
|
|
|
|
$sMsg .= $sSubjectRe."\n\n";
|
|
|
|
|
$sMsg .= $aClean['sMessage'];
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
$sMsg = "The following message was sent to you by the AppDB admins:\n\n";
|
|
|
|
|
$sMsg .= $aClean['sMessage'];
|
|
|
|
|
}
|
2007-01-18 02:38:18 +00:00
|
|
|
|
2008-07-06 19:21:52 +02:00
|
|
|
mail_appdb($sRecipients, '[PM] '.$aClean['sSubject'], $sMsg);
|
2007-01-18 02:38:18 +00:00
|
|
|
|
|
|
|
|
util_redirect_and_exit(BASE."index.php");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|