Exemple #1
0
 function __initialize($title = "", $body_class = false)
 {
     global $CONFIG;
     // sometimes state-/UI-less sites (like APIs) trickout the AJAX detection by setting this.
     // as we need UI this must be reset here
     unset($GLOBALS['result_of_system_is_ajax_call']);
     header("Content-Type: text/html; charset=utf-8");
     // overwrite previously set header to ensure we deliver HTML
     unset($CONFIG["use_compiled_js"]);
     unset($CONFIG["use_compiled_css"]);
     if (current_event(true) != 'login' && (!isset($_SESSION['admin_handler_username']) || !isset($_SESSION['admin_handler_password']) || $_SESSION['admin_handler_username'] != $CONFIG['system']['admin']['username'] || $_SESSION['admin_handler_password'] != $CONFIG['system']['admin']['password'])) {
         log_debug(current_event(true));
         log_debug($_SESSION['admin_handler_username']);
         log_debug($_SESSION['admin_handler_password']);
         redirect('sysadmin', 'login');
     }
     parent::__initialize("SysAdmin - {$title}", 'sysadmin');
     $this->_translate = false;
     if (current_event(true) != 'login') {
         $nav = parent::content(new Control('div'));
         $nav->class = "navigation";
         foreach ($CONFIG['system']['admin']['actions'] as $label => $def) {
             if (!class_exists(fq_class_name($def[0]))) {
                 continue;
             }
             $nav->content(new Anchor(buildQuery($def[0], $def[1]), $label));
         }
         $nav->content(new Anchor(buildQuery('sysadmin', 'cache'), 'Cache'));
         $nav->content(new Anchor(buildQuery('sysadmin', 'phpinfo'), 'PHP info'));
         $nav->content(new Anchor(buildQuery('translationadmin', 'newstrings'), 'Translations'));
         $nav->content(new Anchor(buildQuery('sysadmin', 'testing'), 'Testing'));
         $nav->content(new Anchor(buildQuery('', ''), 'Back to app'));
         $nav->content(new Anchor(buildQuery('sysadmin', 'logout'), 'Logout', 'logout'));
         $this->_subnav = parent::content(new Control('div'));
     }
     $this->_contentdiv = parent::content(new Control('div'))->addClass('content');
     $copylink = new Anchor('http://www.scavix.com', '© 2012-' . date('Y') . ' Scavix® Software Ltd. & Co. KG');
     $copylink->target = '_blank';
     $footer = parent::content(new Control('div'))->addClass('footer');
     $footer->content("<br class='clearer'/>");
     $footer->content($copylink);
     if (current_event() == strtolower($CONFIG['system']['default_event']) && !system_method_exists($this, current_event())) {
         redirect('sysadmin', 'index');
     }
 }