public static function sai_mod__SYSTEM_SAI_saimod_sys_login_action_userinfo()
 {
     $user = \SYSTEM\SECURITY\Security::getUser();
     if (!$user) {
         return;
     }
     return json_encode(array('username' => $user->username, 'email' => $user->email, 'joindate' => $user->creationDate, 'locale' => $user->locale, 'last_active' => $user->lastLoginDate));
 }
Exemple #2
0
 public static function set($lang)
 {
     if (!self::isLang($lang)) {
         return false;
     }
     \SYSTEM\SECURITY\Security::save(self::SESSION_KEY, $lang);
     if (\SYSTEM\SECURITY\Security::isLoggedIn()) {
         $user = \SYSTEM\SECURITY\Security::getUser();
         $user->locale = $lang;
         \SYSTEM\SQL\SYS_LOCALE_SET_LOCALE::Q1(array($lang, $user->id));
     }
     return true;
 }
 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!
 }
Exemple #4
0
 public static function save($id, $new_id, $lang, $tags, $text)
 {
     if ($new_id == self::NEW_ENTRY) {
         return false;
     }
     //Insert
     if (!\SYSTEM\SQL\SYS_TEXT_SAVE::QI(array($id, $lang, $text, \SYSTEM\SECURITY\Security::getUser()->id, \SYSTEM\SECURITY\Security::getUser()->id))) {
         return false;
     }
     //delete all tags
     \SYSTEM\SQL\SYS_TEXT_DELETE_TAGS::QI(array($id));
     //Insert tags
     foreach ($tags as $tag) {
         if ($tag) {
             \SYSTEM\SQL\SYS_TEXT_SAVE_TAG::QI(array($id, $tag));
         }
     }
     //Rename
     \SYSTEM\SQL\SYS_TEXT_RENAME::QI(array($new_id, $id));
     \SYSTEM\SQL\SYS_TEXT_RENAME_TAGS::QI(array($new_id, $id));
     return true;
 }
 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!
 }