Example #1
0
 protected final function __construct()
 {
     // Turn error reporting off as it is displayed in debugger mode only!
     ini_set('display_errors', false);
     // Show ALL errors & notices
     error_reporting(E_ALL ^ E_NOTICE);
     ini_set('ignore_repeated_errors', true);
     ini_set('ignore_repeated_source', true);
     // Enable HTML Error messages
     ini_set('html_errors', true);
     ini_set('docref_root', 'http://docs.php.net/manual/en/');
     ini_set('docref_ext', '.php');
     // Define the Error & Exception handlers
     set_error_handler(array(&$this, 'errorLogger'), ini_get('error_reporting'));
     set_exception_handler(array(&$this, 'exceptionHandler'));
     // Enable debugger
     if (isset($GLOBALS['config']) && is_object($GLOBALS['config'])) {
         $this->_enabled = (bool) $GLOBALS['config']->get('config', 'debug');
         $ip_string = $GLOBALS['config']->get('config', 'debug_ip_addresses');
         if (!empty($ip_string)) {
             if (strstr($ip_string, ',')) {
                 $ip_addresses = explode(',', $ip_string);
                 if (!in_array(get_ip_address(), $ip_addresses)) {
                     $this->_enabled = false;
                 }
             } else {
                 if ($ip_string !== get_ip_address()) {
                     $this->_enabled = false;
                 }
             }
         }
     }
     //If its time to clear the cache
     if (isset($_GET['debug-cache-clear'])) {
         $GLOBALS['cache']->clear();
         $GLOBALS['cache']->tidy();
         httpredir(currentPage(array('debug-cache-clear')));
     }
     //Check for xdebug
     if (extension_loaded('xdebug') && function_exists('xdebug_is_enabled')) {
         $this->_xdebug = xdebug_is_enabled();
     }
     $this->_debug_timer = $this->_getTime();
     // Check register_globals
     if (ini_get('register_globals')) {
         trigger_error('register_globals are enabled. It is highly recommended that you disable this in your PHP configuration, as it is a large security hole, and may wreak havoc.', E_USER_WARNING);
     }
     Sanitize::cleanGlobals();
 }