Example #1
0
 public function authorized($url)
 {
     if (Auth::getInstance()->user() == false) {
         if (strlen($url) > 0) {
             Redirect::getInstance()->to($url)->go();
         }
         throw new \Exception("Accessing method forbidden", 402);
     }
 }
Example #2
0
 public function error($_url = '')
 {
     if (empty($_url)) {
         $this->_tpl->assign('message', $this->_message);
         $this->_tpl->assign('prev', Tool::getPrevPage());
         $this->_tpl->display(SMARTY_ADMIN . 'public/error.tpl');
         exit;
     } else {
         Redirect::getInstance()->succ($_url);
     }
 }
Example #3
0
 public static function setAction()
 {
     $_a = self::getA();
     if (Validate::inArray($_a, array('manage', 'nav', 'level'))) {
         if (!isset($_SESSION['admin'])) {
             Redirect::getInstance()->succ('?a=admin&m=login');
         }
     }
     if (!file_exists(ROOT_PATH . '/controller/' . $_a . 'Action.class.php')) {
         $_a = 'index';
     }
     eval('self::$_obj = new ' . ucfirst($_a) . 'Action();');
     return self::$_obj;
 }
Example #4
0
 public static function setAction()
 {
     $temp = self::getA();
     if (Validate::inArray($temp, array('Manage', 'Nav', 'Level', 'Goods', 'Order'))) {
         if (!isset($_SESSION['admin'])) {
             Redirect::getInstance()->success('', '?a=admin&m=runLogin');
         }
     }
     if (!file_exists(ROOT_PATH . '/controller/' . $temp . 'Action.class.php')) {
         $temp = 'Index';
     }
     eval('self::$obj=new ' . $temp . 'Action();');
     return self::$obj;
 }
Example #5
0
 public function showError($url = '', $type = 0)
 {
     if (empty($url)) {
         $this->tpl->assign('message', $this->message);
         $this->tpl->assign('prev_url', PREV_URL);
         if ($type == 0) {
             $this->tpl->display(ADMIN_STYLE . 'public/error.tpl');
         } else {
             $this->tpl->display(ADMIN_STYLE . 'public/error_index.tpl');
         }
         exit;
     } else {
         Redirect::getInstance()->success('', './');
     }
 }
Example #6
0
 public function __construct()
 {
     $this->tpl = TPL::getInstance();
     $this->model = Factory::setModel();
     $this->redirect = Redirect::getInstance($this->tpl);
 }
Example #7
0
 protected function __construct()
 {
     $this->_model = Factory::setModel();
     $this->_tpl = TPL::getInstance();
     $this->_redirect = Redirect::getInstance($this->_tpl);
 }