Ejemplo n.º 1
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;
 }
Ejemplo n.º 2
0
 public function html()
 {
     //register docu here, we require path so system must be started
     \SYSTEM\DOCU\docu::register(array('id' => 'system', 'inpath' => new \SYSTEM\PSYSTEM(), 'outpath' => new \SYSTEM\PSYSTEM('docu/system/'), 'inpath_md' => new \SYSTEM\PSYSTEM('docu/system/structure.xml'), 'outpath_md' => new \SYSTEM\PSYSTEM('docu/system_wiki/'), 'cachepath' => new \SYSTEM\PSYSTEM('docu/system/cache/'), 'ignore' => array('lib/animate/*', 'lib/bootstrap/*', 'lib/bootstrap_growl/*', 'lib/git/*', 'lib/jqbootstrapvalidation/*', 'lib/jquery/*', 'lib/lettering/*', 'lib/markdown/*', 'lib/minify/*', 'lib/phpdocumentor/*', 'lib/scssphp/*', 'lib/tablesorter/*', 'lib/texttilate/*', 'lib/tinymce/*'), 'sourcecode' => true, 'parseprivate' => false, 'title' => 'SYSTEM - PHP Framework'));
     \SYSTEM\SECURITY\Security::isLoggedIn();
     // refresh session
     //Direct JSON Input
     $pg = json_decode(file_get_contents("php://input"), true);
     if (!$pg) {
         $pg = array_merge($_POST, $_GET);
     }
     if (isset($pg[self::SAI_MOD_POSTFIELD])) {
         $classname = \str_replace('.', '\\', $pg[self::SAI_MOD_POSTFIELD]);
         $pg[self::SAI_MOD_POSTFIELD] = \str_replace('.', '_', $pg[self::SAI_MOD_POSTFIELD]);
         $mods = \SYSTEM\SAI\sai::getAllModules();
         if ($classname && \array_search($classname, $mods) !== false && (\call_user_func(array($classname, 'right_public')) || \call_user_func(array($classname, 'right_right')))) {
             return \SYSTEM\API\api::run('\\SYSTEM\\API\\verify', $classname, $pg, 42, true, false);
         } else {
             return '<meta http-equiv="refresh" content="0; url=./sai.php">You are no longer logged in. Page reload in 5sec...';
         }
     } else {
         return \SYSTEM\API\api::run('\\SYSTEM\\API\\verify', '\\SYSTEM\\SAI\\SaiModule', $pg, 42, false, true);
     }
 }
Ejemplo n.º 3
0
 public static function call_account_action_isloggedin()
 {
     return \SYSTEM\SECURITY\Security::isLoggedIn();
 }
Ejemplo n.º 4
0
 public static function get($group, $state, $returnasjson = true)
 {
     //seperate state from vars
     $state_vars = \explode(';', $state);
     //parse substates
     $state_all = \explode('(', $state_vars[0]);
     $state_name = $state_all[0];
     $substate = substr($state_vars[0], strlen($state_name));
     $substate = self::parse_substate($substate);
     //vars
     $vars = array();
     for ($i = 1; $i < count($state_vars); $i++) {
         $var = \explode('.', $state_vars[$i]);
         $vars[$var[0]] = $var[1];
     }
     $result = array();
     $res = \SYSTEM\SQL\SYS_PAGE_GROUP::QQ(array($group, $state_name));
     while ($row = $res->next()) {
         if (!self::is_loaded($row, $substate, $state_name, $row['parent_id'])) {
             continue;
         }
         if ($row['login'] == 1 && !\SYSTEM\SECURITY\Security::isLoggedIn() || $row['login'] == 2 && \SYSTEM\SECURITY\Security::isLoggedIn()) {
             continue;
         }
         $row['url'] = \SYSTEM\PAGE\replace::replace($row['url'], $vars);
         $row['url'] = \SYSTEM\PAGE\replace::clean($row['url']);
         //clean url of empty variables
         //$row['url'] = preg_replace('/&.*?=(&|$)/', '&', $row['url']);
         $row['url'] = preg_replace('/[^=&]+=(&|$)/', '&', $row['url']);
         $row['url'] = preg_replace('/&&$/', '', $row['url']);
         $row['css'] = $row['js'] = array();
         if (\class_exists($row['php_class']) && \method_exists($row['php_class'], 'css') && \is_callable($row['php_class'] . '::css')) {
             $row['css'] = array_merge($row['css'], \call_user_func($row['php_class'] . '::css'));
         }
         $row['css'] = count($row['css']) > 0 ? array(\SYSTEM\CACHE\cache_css::url($row['css'])) : array();
         if (\class_exists($row['php_class']) && \method_exists($row['php_class'], 'scss') && \is_callable($row['php_class'] . '::scss')) {
             $scss = \call_user_func($row['php_class'] . '::scss');
             foreach ($scss as $s) {
                 $row['css'][] = \SYSTEM\CACHE\cache_scss::url($s);
             }
         }
         if (\class_exists($row['php_class']) && \method_exists($row['php_class'], 'js') && \is_callable($row['php_class'] . '::js')) {
             $row['js'] = array_merge($row['js'], \call_user_func($row['php_class'] . '::js'));
         }
         $row['js'] = count($row['js']) > 0 ? array(\SYSTEM\CACHE\cache_js::url($row['js'])) : array();
         unset($row['php_class']);
         $skip = false;
         for ($i = 0; $i < count($result); $i++) {
             if ($result[$i]['div'] == $row['div']) {
                 $skip = true;
                 if ($row['type'] == 1) {
                     $result[$i] = $row;
                 }
                 break;
             }
         }
         if (!$skip) {
             $result[] = $row;
         }
     }
     return $returnasjson ? \SYSTEM\LOG\JsonResult::toString($result) : $result;
 }
Ejemplo n.º 5
0
 public static function html_li_menu()
 {
     return '<li class="sai_divider_left"><a id="menu_login" data-toggle="tooltip" data-placement="bottom" title="${sai_menu_login}" href="#!login">' . (\SYSTEM\SECURITY\Security::isLoggedIn() ? '<span class="glyphicon glyphicon-log-out" aria-hidden="true"></span>' : '<span class="glyphicon glyphicon-log-in" aria-hidden="true"></span>') . '</a></li>';
 }