Пример #1
0
 public static function ErrorHandler($errno, $errstr = '', $errfile = '', $errline = '', $errcontext = '')
 {
     if (!error_reporting()) {
         return;
     }
     //Error suppressed with @ operator
     $errorType = array(E_ERROR => 'ERROR', E_WARNING => 'WARNING', E_PARSE => 'PARSING ERROR', E_NOTICE => 'NOTICE', E_CORE_ERROR => 'CORE ERROR', E_CORE_WARNING => 'CORE WARNING', E_COMPILE_ERROR => 'COMPILE ERROR', E_COMPILE_WARNING => 'COMPILE WARNING', E_USER_ERROR => 'USER ERROR', E_USER_WARNING => 'USER WARNING', E_USER_NOTICE => 'USER NOTICE', E_STRICT => 'STRICT NOTICE', E_RECOVERABLE_ERROR => 'RECOVERABLE ERROR');
     if (count($errcontext)) {
         $errcontext = count($errcontext) . ' entries';
     }
     if (array_key_exists($errno, $errorType)) {
         $err = $errorType[$errno];
     } else {
         $err = 'CAUGHT EXCEPTION';
     }
     $message = "{$err}[{$errno}]: {$errstr} in file [{$errfile}] at line [{$errline}] context [{$errcontext}]";
     echo $message . "<hr>";
     if (rad_dbpdo::connected()) {
         rad_dblogger::logerr($message);
     } else {
         rad_dblogger::logerr2txt($message);
     }
 }
Пример #2
0
 /**
  * Main function to init the loader
  * @access public
  */
 public static function init()
 {
     self::$alias = rad_input::request('alias');
     if (!self::$alias) {
         self::$alias = rad_config::getParam('defaultAlias');
         self::$template = rad_config::getParam('defaultTemplate');
     }
     self::$_alias = self::getAliasByName(self::$alias);
     if (is_null(self::$_alias)) {
         throw new rad_exception('Aliases not found! Even the default aliases and alias for the 404 error! Insert those aliases into database please and try again!');
     }
     if (strlen(self::$_alias->input_class)) {
         rad_input::reparseGetWithPlug(self::$_alias->input_class);
     }
     self::parseIncludes(self::$_alias->includes);
     self::$_langContainer = new rad_lang_container();
     self::parseController();
     if (!rad_breadcrumbs::initandmake(self::$_alias)) {
         rad_dblogger::logerr('Can\'t create and init breadcrumbs! file: ' . __FILE__ . ' and line: ' . __LINE__);
     }
 }
Пример #3
0
function div($int, $del)
{
    if ($del == 0) {
        rad_dblogger::logerr('Division by zero found in params! file: ' . __FILE__ . ' line: ' . __LINE__);
        return 0;
    }
    $res = $int / $del;
    return $res >= 0 ? floor($res) : ceil($res);
}