(merged from branches/roa. use "svn log -c <changeset> -g <module-svn-path>" for detailed commit message)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@60229 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-08-09 06:21:41 +00:00
parent 0a8f2a67f6
commit e033d105f6

View File

@ -148,17 +148,10 @@ class Debug {
/** /**
* Load an error handler * Load an error handler
*
* @todo why does this delegate to loadFatalErrorHandler?
*/ */
static function loadErrorHandlers() { static function loadErrorHandlers() {
Debug::loadFatalErrorHandler(); Debug::loadFatalErrorHandler();
}
/**
* @todo can this be moved into loadErrorHandlers?
*/
static function loadFatalErrorHandler() {
//set_error_handler('errorHandler', (E_ALL ^ E_NOTICE) ^ E_USER_NOTICE); //set_error_handler('errorHandler', (E_ALL ^ E_NOTICE) ^ E_USER_NOTICE);
set_error_handler('errorHandler', E_ALL); set_error_handler('errorHandler', E_ALL);
set_exception_handler('exceptionHandler'); set_exception_handler('exceptionHandler');
@ -457,4 +450,35 @@ function errorHandler($errno, $errstr, $errfile, $errline, $errcontext) {
} }
} }
/**
* Interface for rendering a debug info report.
*
*/
class DebugReporter {
function writeHeader() {
echo '<!DOCTYPE html><html><head><title>'. $_SERVER['REQUEST_METHOD'] . ' ' .$_SERVER['REQUEST_URI'] .'</title>';
echo '<style type="text/css">';
echo 'body { background-color:#eee; margin:0; padding:0; font-family:Helvetica,Arial,sans-serif; }';
echo '.info { border-bottom:1px dotted #333; background-color:#ccdef3; margin:0; padding:6px 12px; }';
echo '.info h1 { margin:0; padding:0; color:#333; letter-spacing:-2px; }';
echo '.header { margin:0; border-bottom:6px solid #ccdef3; height:23px; background-color:#666673; padding:4px 0 2px 6px; background-image:url('.Director::absoluteBaseURL().'cms/images/mainmenu/top-bg.gif); }';
echo '.trace { padding:6px 12px; }';
echo '.trace li { font-size:14px; margin:6px 0; }';
echo 'pre { margin-left:18px; }';
echo 'pre span { color:#999;}';
echo 'pre .error { color:#f00; }';
echo '.pass { padding:2px 20px 2px 40px; color:#006600; background:#E2F9E3 url('.Director::absoluteBaseURL() .'cms/images/alert-good.gif) no-repeat scroll 7px 50%; border:1px solid #8DD38D; }';
echo '.fail { padding:2px 20px 2px 40px; color:#C80700; background:#FFE9E9 url('.Director::absoluteBaseURL() .'cms/images/alert-bad.gif) no-repeat scroll 7px 50%; }';
echo '</style></head>';
echo '<body>';
echo '<div class="header"><img src="'. Director::absoluteBaseURL() .'cms/images/mainmenu/logo.gif" width="26" height="23"></div>';
}
function writeFooter() {
echo "</body></html>";
}
}
?> ?>