예제 #1
0
 public static function toString($json_array, $status = self::JSONRESULT_OK, $start_time = NULL)
 {
     if ($start_time == NULL) {
         $start_time = \SYSTEM\time::getStartTime();
     }
     $json = array();
     $json['querytime'] = round(microtime(true) - $start_time, 5);
     $json['status'] = $status;
     $json['result'] = $json_array;
     if (\SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DEFAULT_RESULT) == \SYSTEM\CONFIG\config_ids::SYS_CONFIG_DEFAULT_RESULT_MSGPACK) {
         //send Header
         \SYSTEM\HEADER::JSON();
         if ($json = msgpack_pack($json)) {
             return $json;
         }
         throw new \SYSTEM\LOG\ERROR('MSGPack could not be encoded');
     } else {
         //send Header
         \SYSTEM\HEADER::JSON();
         if ($json = json_encode($json)) {
             return $json;
         }
         throw new \SYSTEM\LOG\ERROR('JSON could not be encoded');
     }
 }
 public static function CALL(\Exception $E, $thrown)
 {
     try {
         if (\property_exists(get_class($E), 'logged') && $E->logged) {
             return false;
         }
         //alrdy logged(this prevents proper thrown value for every system exception)
         $result = \SYSTEM\SQL\SYS_LOG_INSERT::QI(array(get_class($E), $E->getMessage(), $E->getCode(), $E->getFile(), $E->getLine(), $E->getTraceAsString(), getenv('REMOTE_ADDR'), round(microtime(true) - \SYSTEM\time::getStartTime(), 5), $_SERVER["SERVER_NAME"], $_SERVER["SERVER_PORT"], $_SERVER['REQUEST_URI'], serialize($_POST), array_key_exists('HTTP_REFERER', $_SERVER) ? $_SERVER['HTTP_REFERER'] : null, array_key_exists('HTTP_USER_AGENT', $_SERVER) ? $_SERVER['HTTP_USER_AGENT'] : null, ($user = \SYSTEM\SECURITY\Security::getUser()) ? $user->id : null, $thrown ? 1 : 0));
         if (\property_exists(get_class($E), 'logged')) {
             $E->logged = true;
         }
         //we just did log
     } catch (\Exception $E) {
         //Dump the Error
         echo \SYSTEM\LOG\JsonResult::toString((array) $E);
         return false;
     }
     //Error -> Ignore
     return false;
     //We just log and do not handle the error!
 }
예제 #3
0
 public static function exception(\Exception $E, $thrown, $type = \SYSTEM\SQL\system_todo::FIELD_TYPE_EXCEPTION)
 {
     try {
         if (\property_exists(get_class($E), 'todo_logged') && $E->todo_logged) {
             return false;
         }
         //alrdy logged(this prevents proper thrown value for every system exception)
         \SYSTEM\SQL\SYS_SAIMOD_TODO_EXCEPTION_INSERT::Q1(array(get_class($E), $E->getMessage(), $E->getCode(), $E->getFile(), $E->getLine(), $E->getTraceAsString(), getenv('REMOTE_ADDR'), round(microtime(true) - \SYSTEM\time::getStartTime(), 5), date('Y-m-d H:i:s', microtime(true)), $_SERVER["SERVER_NAME"], $_SERVER["SERVER_PORT"], $_SERVER['REQUEST_URI'], serialize($_POST), array_key_exists('HTTP_REFERER', $_SERVER) ? $_SERVER['HTTP_REFERER'] : null, array_key_exists('HTTP_USER_AGENT', $_SERVER) ? $_SERVER['HTTP_USER_AGENT'] : null, ($user = \SYSTEM\SECURITY\Security::getUser()) ? $user->id : null, $thrown ? 1 : 0, $E->getMessage(), $type));
         if (\property_exists(get_class($E), 'logged')) {
             $E->todo_logged = true;
         }
         //we just did log
     } catch (\Exception $E) {
         return false;
     }
     //Error -> Ignore
     return false;
     //We just log and do not handle the error!
 }