示例#1
0
 public function startup()
 {
     require_once 'classloader.php';
     smartClassMapper::getInstance();
     spl_autoload_register(array('smartClassMapper', 'autoloadClass'));
     sectionsOb::getInstance()->handleRequests();
     $this->s = sectionsOb::getInstance()->section;
     browser::getInstance();
     require_once T_CLASS_DIR . '/Mobile_Detect.php';
     $this->detect = new Mobile_Detect();
     $this->deviceType = $this->detect->isMobile() ? $this->detect->isTablet() ? 'tablet' : 'phone' : 'computer';
     $this->scriptVersion = $this->detect->getScriptVersion();
     if (T_USE_DB) {
         tdb::getInstance();
     }
     if ($this->s['section_name'] == 'login' || $this->s['section_name'] == 'logout') {
         $this->login = new loginOb();
         $this->login->checkLogin();
     } elseif ($this->s['section_name'] == 'cron') {
         $this->cron = new cron();
     } elseif ($this->s['section_name'] == 'cms') {
         if ($_SESSION['user']['access'] == '2') {
             $this->cms = new cms();
             $this->cms->showCms();
         } else {
             header('Location: ' . T_HOME_URL . 'login');
         }
     } elseif ($this->s['section_name'] == 'ajax') {
         $this->ajax = new ajax();
         $this->ajax->deviceType = $this->deviceType;
         $this->ajax->processRequest();
     } else {
         if (!DISABLE_FRONT_END) {
             $this->site = new site();
             $this->site->navCase = 'upper';
             $this->site->detect = $this->detect;
             $this->site->deviceType = $this->deviceType;
             $this->site->scriptVersion = $this->scriptVersion;
             $this->site->showSite();
         }
     }
 }
 public static function getInstance()
 {
     return is_object(self::$instance) ? self::$instance : (self::$instance = new self::$instance());
 }