예제 #1
-1
파일: base.php 프로젝트: sfp12/darwin
 public function before()
 {
     $this->_response = Noah::instance('Response');
     $this->_request = Noah::instance('Request');
     $this->_profiler = Noah::instance('Profiler');
     $this->_app = Noah::instance('App');
     $this->_validation = Noah::instance('Validation');
     if ($this->_app->controller != 'login') {
         if (!isset($_SESSION['userInfo'])) {
             $this->_response->redirect('http://' . $_SERVER['HTTP_HOST'] . '/login');
         }
     }
     require_once Noah::getVendorPath() . 'smarty/Smarty.class.php';
     $this->smarty = new Smarty();
     foreach ($this->_app->config('smarty') as $key => $val) {
         $key = 'set' . ucfirst($key);
         $this->smarty->{$key}($val);
     }
     $this->smarty->assign("currentC", $this->_app->controller);
     $this->smarty->assign("action", $this->_app->action);
     if (isset($_SESSION['userinfo'])) {
         $this->smarty->assign("adminUser", $_SESSION['userinfo']);
     }
 }