iUserId); $shError = ''; /* Restrict error to logged-in users */ if(!$oUser->isLoggedIn()) { login_form(); exit; } $oRecipient = null; $sRecipientText = ''; $iRecipientId = null; $sRecipientGroup = getInput('sRecipientGroup', $aClean); $sRecipients = ''; 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"); $sRecipientText = $oRecipient->sRealname; } /* Check for errors */ if((!$aClean['sMessage'] || !$aClean['sSubject']) && $aClean['sSubmit']) { $shError = "Please enter both a subject and a ". "message."; $aClean['sSubmit'] = ""; } /* Display the feedback form if nothing else is specified */ if(!$aClean['sSubmit']) { apidb_header("E-mail $sRecipientText"); echo ' '; echo html_frame_start("Composer",400,"",0); echo $shError; echo "
\n"; echo html_frame_end(" "); } else if ($aClean['sSubject'] && $aClean['sMessage']) { 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 DXGL 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']; } mail_appdb($sRecipients, '[PM] '.$aClean['sSubject'], $sMsg); util_redirect_and_exit(BASE."index.php"); } ?>