Exemple #1
0
 /**
  * @throws Exception
  */
 public function __construct()
 {
     parent::__construct();
     //		if (PHP_SAPI == 'cli') {
     //			throw new Exception('You can`t create session in console');
     //		}
     $this->request = Core_Request::getInstance();
     // Start session
     $session_id = $this->request->{self::NAME};
     if ($session_id) {
         session_id($session_id);
     }
     if ($this->request->getCookie(self::NAME_PERSISTENT)) {
         session_set_cookie_params(self::PERSISTENT_TIME, $this->request->getHomeDir());
     } else {
         session_set_cookie_params(0, $this->request->getHomeDir());
     }
     session_name(self::NAME);
     // Try session start many times
     for ($i = 1; $i <= 5; $i++) {
         if (session_start()) {
             break;
         }
         usleep(100000);
     }
 }
Exemple #2
0
 /**
  * @throws Exception
  */
 public function __construct()
 {
     parent::__construct();
     // Register autoloader
     spl_autoload_register(array($this, 'autoloader'));
     // Get object aliases
     require_once LIB_PATH . 'aliases.php';
     // Set application properties
     $this->request = Core_Request::getInstance();
     // Load bootstrap
     $bootstrap_class = $this->request->getRoute('module') . '_BootstrapHelper';
     $bootstrap_class = strtoupper(substr($bootstrap_class, 0, 1)) . substr($bootstrap_class, 1);
     if (class_exists($bootstrap_class)) {
         new $bootstrap_class();
     }
     // Error logging
     $this->setErrorLogging();
     // Init view
     $view = Core_View::getInstance();
     $view->setLayoutFile('$layout/layout.phtml');
     // Dispatch
     $this->dispatch();
     // Show layout
     $view->displayLayout();
 }
Exemple #3
0
 /**
  * @throws Exception
  */
 public function __construct()
 {
     parent::__construct();
     if (!empty($_GET[self::ROUTER_NAME])) {
         self::$server_router = trim($_GET[self::ROUTER_NAME], '/');
         unset($_GET[self::ROUTER_NAME]);
     } elseif (!empty($_SERVER['argv'])) {
         $tmp_parts = array();
         for ($i = 2; $i < count($_SERVER['argv']); $i++) {
             $tmp_parts[] = $_SERVER['argv'][$i];
         }
         self::$server_router = implode('/', $tmp_parts);
     }
     $this->setRoutes($this->getDefaultScheme());
 }
Exemple #4
0
 /**
  * @return self
  */
 public static function refreshInstance()
 {
     self::$_objInstance = new self();
     return self::$_objInstance;
 }
Exemple #5
0
 /**
  * @throws Exception
  */
 public function __construct()
 {
     parent::__construct();
     $this->request = Core_Request::getInstance();
 }