"; $TBMAIL_WWW = "Testbed WWW <$TBMAILADDR_WWW>"; $TBMAIL_APPROVAL = "Testbed Approval <$TBMAILADDR_APPROVAL>"; $TBMAIL_LOGS = "Testbed Logs <$TBMAILADDR_LOGS>"; $TBMAIL_AUDIT = "Testbed Audit <$TBMAILADDR_AUDIT>"; # # This just spits out an email address in a page, so it does not need # to be configured per development tree. It could be though ... # $TBMAILADDR = " Testbed Operations ($TBMAILADDR_OPS)"; # So subscripts always know ... putenv("HTTP_SCRIPT=1"); # # Database constants and the like. # include("dbdefs.php3"); # # Wrap up the mail function so we can prepend a tag to the subject # line that indicates what testbed. Useful when multiple testbed # email to the same list. # # function TBMAIL($to, $subject, $message, $headers = 0) { global $THISHOMEBASE; global $SCRIPT_NAME; $subject = strtoupper($THISHOMEBASE) . ": $subject"; $tag = "X-NetBed: " . basename($SCRIPT_NAME); if ($headers) { $headers = "$headers\n" . $tag; } else { $headers = $tag; } return mail($to, $subject, $message, $headers); } # # Internal errors should be reported back to the user simply. The actual # error information should be emailed to the list for action. The script # should then terminate if required to do so. # function TBERROR ($message, $death, $xmp = 0) { global $TBMAIL_WWW, $TBMAIL_OPS, $TBMAILADDR; TBMAIL($TBMAIL_OPS, "WEB ERROR REPORT", "\n". "$message\n\n". "Thanks,\n". "Testbed WWW\n", "From: $TBMAIL_OPS\n". "Errors-To: $TBMAIL_WWW"); if ($death) { if ($xmp) $message = "
Could not continue. Please contact $TBMAILADDR\n";
PAGEERROR($msg);
}
return 0;
}
#
# General user errors should print something warm and fuzzy
#
function USERERROR($message, $death) {
global $TBMAILADDR;
$msg = "
$message
Please contact $TBMAILADDR if you feel this message is an error.
\n";
if ($death) {
PAGEERROR($msg);
}
else
echo "$msg\n";
}
#
# A form error.
#
function FORMERROR($field) {
USERERROR("Missing field; ".
"Please go back and fill out the \"$field\" field!", 1);
}
#
# SUEXEC stuff.
#
# Save this stuff so we can generate better error messages and such.
#
$suexec_cmdandargs = "";
$suexec_retval = 0;
$suexec_output;
#
# Actions for suexec.
#
define("SUEXEC_ACTION_CONTINUE", 0);
define("SUEXEC_ACTION_DIE", 1);
define("SUEXEC_ACTION_USERERROR", 2);
define("SUEXEC_ACTION_IGNORE", 3);
#
# An suexec error.
#
function SUEXECERROR($action)
{
global $suexec_cmdandargs, $suexec_retval, $suexec_output;
$foo = "Shell Program Error. Exit status: $suexec_retval\n";
$foo .= " '$suexec_cmdandargs'\n";
if (count($suexec_output)) {
$foo .= "\n";
for ($i = 0; $i < count($suexec_output); $i++) {
$foo .= "$suexec_output[$i]\n";
}
}
switch ($action) {
case SUEXEC_ACTION_CONTINUE:
TBERROR($foo, 1, 0);
break;
case SUEXEC_ACTION_DIE:
TBERROR($foo, 1, 1);
break;
case SUEXEC_ACTION_USERERROR:
USERERROR("