Exemple #1
0
 /**
  * get instance; forwards to login page if the user is not logged in
  *
  * @access public
  * @return object
  **/
 public static function getInstance($section_name = 'Start', $section_permission = 'start', $auto_header = true, $auto_auth = true)
 {
     if (!self::$instance) {
         self::$instance = new self();
         if (!CAT_Registry::defined('CAT_INITIALIZED')) {
             include CAT_PATH . '/framework/initialize.php';
         }
         $user = CAT_Users::getInstance();
         if ($user->is_authenticated() == false && !defined('CAT_INSTALL_PROCESS')) {
             header('Location: ' . CAT_ADMIN_URL . '/login/index.php');
             exit(0);
         } elseif (!defined('CAT_INSTALL_PROCESS')) {
             $user->checkPermission($section_name, $section_permission, true);
         }
         self::$instance->section_name = $section_name;
         global $parser;
         self::initPaths();
         $parser->setGlobals('TEMPLATE_MENU', CAT_Helper_Template::get_template_menus());
         // Auto header code
         if ($auto_header == true) {
             self::$instance->print_header();
         }
     }
     return self::$instance;
 }