function finalOutput($error, $from) { // For use by Email and database.log // Turn the error message into just plane text with LF at end of each line where a BR was. // and remove the "ERROR" header and any blank lines. $err = html_entity_decode(preg_replace("/<.*?>/", '', $error)); $err = preg_replace("/^\\s*\$/", '', $err); // Callback to get the user ID if the callback exists $userId = ''; if (function_exists('ErrorGetId')) { $userId = "User: "******"agent: " . $_SERVER['HTTP_USER_AGENT'] . "\n"; } // Email error information to webmaster // During debug set the Error class's $noEmailErrs to ture if (ErrorClass::getNoEmailErrs() !== true) { $S = $GLOBALS["S"]; if (!$S || empty($S->EMAILADDRESS)) { $S->EMAILADDRESS = $S->EMAILRETURN = $S->EMAILFROM = "*****@*****.**"; } mail($S->EMAILADDRESS, $from, "{$err}{$userId}", "From: " . $S->EMAILFROM, "-f " . $S->EMAILRETURN); } // Log the raw error info. date_default_timezone_set('America/Los_Angeles'); error_log("ErrorClass, finalOutput: {$from}\n{$err}{$userId}"); if (ErrorClass::getDevelopment() !== true) { // Minimal error message $error = <<<EOF <p>The webmaster has been notified of this error and it should be fixed shortly. Please try again in a couple of hours.</p> EOF; $err = " The webmaster has been notified of this error and it should be fixed shortly." . " Please try again in a couple of hours."; } if (ErrorClass::getNohtml() === true) { $error = "{$from}: {$err}"; } else { $error = <<<EOF <div style="text-align: center; background-color: white; border: 1px solid black; width: 85%; margin: auto auto; padding: 10px;"> <h1 style="color: red">{$from}</h1> {$error} </div> EOF; } if (ErrorClass::getNoOutput() !== true) { echo $error; } }