Source for file configINC.php
Documentation is available at configINC.php
* configINC.php stores site-wide configuration settings & functions
* Stores data like support email address, SUPPORTEMAIL
* and functions like my_error_handler() which
* over-rides the default error handler of PHP.
* @author Bill Newman <williamnewman@gmail.com>
* @version 1.0 2008/05/01
* @link http://www.newmanix.com/itc280/
* @license http://opensource.org/licenses/osl-3.0.php Open Software License ("OSL") v. 3.0
define('SUPPORTEMAIL', 'horsey01@example.com');
* If true, will over-ride page specific MyDebug, and make private all errors
* @global boolean $HideAllErrors
//END CONFIG AREA ----------------------------------------------------------
* Replace default PHP error handler with ours
//END SETTINGS AREA --------------------------------------------------------
* Overrides PHP's default error handler
* Inherits error info from default handler and allows us to display
* custom error messages if these global booleans are both true:
* The first comes from this file, the second must be in the calling page
* @global boolean $HideAllErrors makes private all errors
* @global boolean $HidePageErrors makes private errors for this instance only
* @param string $e_number error number provided by PHP error handler
* @param string $e_message error message provided by PHP error handler
* @param string $e_file file name provided by PHP error handler
* @param string $e_line line number of error provided by PHP error handler
* @param array $e_vars variables present at time of error
* @todo error logging, or emailing admin not implemented
// Build the error message.
$errorMsg =
"Error in file: <b>'$e_file'</b> on line: <font color=\"blue\"><b>$e_line</b></font> ";
$errorMsg .=
"Error message: <font color=\"red\"><b>$e_message</b></font>\n";
// Append $e_vars to the $message.
$errorMsg .=
"<br />variables: <font color=\"green\"><b>" .
print_r ($e_vars, 1) .
"</b></font><br />\n";
if ($HideAllErrors ||
$HidePageErrors)
//error_log($errorMsg, 1, SUPPORTEMAIL); // Send email, or post to log here. Not implemented!
//instructions and apology for user
}else{ // Troubleshooting. Show error
print
'<div class="error">' .
$errorMsg .
'</div><br />';
* Create an error code out of the file name and line number of our error
* Will make upper case, strip out the vowels and create an
* error of the file name (minus extension & vowels) + "x" + line number of error
* The above would be the example for this file, plus an error at line 41
* This allows a user to report an error that identifies it, without compromising site security
* @param string $myfile file name provided by PHP error handler
* @param string $myline line number of error provided by PHP error handler
$mySlash =
strrpos($myfile,"/"); //find position of last slash in path
$myfile =
substr($myfile,$mySlash +
1); //strip off all but file name
$myfile =
substr($myfile, 0, strripos($myfile, '.'));//remove extension
$myfile =
strtoupper($myfile); //change to upper case
$vowels =
array("A", "E", "I", "O", "U", "Y"); //array of vowels to remove
$myfile =
str_replace($vowels, "", $myfile); //remove vowels
return $myfile .
"x" .
$myline; //CNFGNCx50
* Print a customized public error message
* Will use a custom error code created by calling
* createErrorCode() function, and display to user
* The above would be the example for this file, plus an error at line 41
* This allows a user to report an error that identifies it, without compromising site security
* @param string $myfile file name provided by PHP error handler
* @param string $myline line number of error provided by PHP error handler
$ErrorCode =
createErrorCode($myfile,$myline); //Create error code out of file name & line number
print
'<h2 align="center">Our page has encountered an error!</h2>';
print
'<table align="center" width="50%" style="border:#F00 1px solid;"><tr><td align="center">';
print
'Please try again, or email support at <b>' .
SUPPORTEMAIL .
'</b>,<br /> and let us know you are receiving ';
print
'the following Error Code: <b>' .
$ErrorCode .
'</b><br />';
print
'This will help us identify the problem, and fix it as quickly as possible.<br />';
print
'Thank you for your assistance and understanding!<br />';
print
'Sincerely,<br />Support Staff<br />';
print
'<a href="index.php">Exit</a></td></tr></table>';
Documentation generated on Sat, 03 May 2008 19:47:45 -0700 by phpDocumentor 1.4.1