Exemple #1
0
 public static function handle(Exception $e)
 {
     switch (get_class($e)) {
         case 'HTTP_Exception_404':
             $response = new Response();
             $response->status(404);
             $view = new View('errors/error404');
             Controller_Abstract::add_static();
             if (Kohana::$environment == Kohana::DEVELOPMENT) {
                 $view->message = $e->getMessage();
             }
             echo $response->body($view)->send_headers()->body();
             return TRUE;
             break;
         case 'HTTP_Exception_410':
             $response = new Response();
             $response->status(410);
             $view = new View('errors/error410');
             Controller_Abstract::add_static();
             echo $response->body($view)->send_headers()->body();
             return TRUE;
             break;
         default:
             header('C-Data: ' . uniqid() . str_replace('=', '', base64_encode($e->getMessage())));
             return Kohana_Exception::handler($e);
             break;
     }
 }
Exemple #2
0
 /**
  * Checks if we have an XML request.
  * @throws Exception_Exido
  */
 public function __construct()
 {
     if (Exido::$is_xml == false) {
         throw new Exception_Exido('We accept only XML requests');
     }
     parent::__construct();
 }
Exemple #3
0
 protected function _before_execute()
 {
     parent::_before_execute();
     $this->_user = Account::find('user_id = ?', $this->_user_id)->getOne();
     if (!in_array($this->_user->user_mail, Q::ini('appini/managers'))) {
         return $this->msg('请先登陆', url('default::default/signin'));
     }
 }
Exemple #4
0
 protected function _before_execute()
 {
     parent::_before_execute();
     $this->_user = Account::find('user_id = ?', $this->_user_id)->getOne();
     if (!$this->_user->id()) {
         return $this->msg('请先登陆', url('default::default/signin'));
     }
 }
 public function get()
 {
     $this->_requireLogin();
     $session = new Model_Session();
     $tagModel = new Model_Tag();
     $tagModel->setUserId($session->getUserId());
     $tags = ORM::for_table('insightengine_tags')->where_equal('user_id', $session->getUserId())->where_null('send_count_30_days')->order_by_desc('send_count_30_days')->find_many();
     $parameters = array_merge(parent::_getTwigParameters(), array('tags_menu_selected' => true, 'tags' => $tags, 'tag_model' => $tagModel));
     echo $this->_getTwig()->render('manage/import_tags.html.twig', $parameters);
 }
Exemple #6
0
 /**
  * Constructor. Check if the user is logged in.
  */
 public function __construct()
 {
     parent::__construct();
     // Configure the main menu
     $this->view->header_menu = array();
     if ($this->_components != null and !empty($this->_components)) {
         // Generate backend menu
         foreach ($this->_components as $key => $d) {
             if ($d['is_enabled'] and $d['has_backend'] and $d['is_visible_in_backend_menu']) {
                 $this->view->header_menu[$key] = __($d['ui_name']);
             }
         }
     }
     // Logged user name
     $this->view->user_logged_as = $this->_system_user['user_name'];
 }
 /**
  * @override
  */
 public function before()
 {
     //        if ( ! Auth::forge()->isLoggedIn() && Request::active()->action !== 'login' && Request::active()->action !== 'flogin') {
     //            \Fuel\Core\Response::redirect('/login');
     //        }
     if (Session::get('client_no')) {
         $user = DB::select('*')->from('v_client')->where('no', '=', Session::get('client_no'))->execute()->current();
         Session::set('point', $user['point']);
         Session::set('use_capacity', $user['disk_volume']);
     }
     // 親クラスのbeforeより先にViewの初期化を実行する
     if (!empty($this->template) and is_string($this->template)) {
         $this->template = \View::forge($this->template, array('page_title' => $this->page_title));
     }
     parent::before();
     $controller = Request::active()->controller;
     $action = Request::active()->action;
 }
Exemple #8
0
 protected function _before_execute()
 {
     parent::_before_execute();
     //$this->_pathway->addStep('管理',url('admin::default/index'));
 }
Exemple #9
0
 /**
  * Disable the execution of "After" controller method.
  * Can be executed in "Before" or main controller methods.
  * @return void
  */
 protected function preventAfter()
 {
     self::$preventAfterController = true;
 }
Exemple #10
0
 public function get()
 {
     $this->_requireLogin();
     $parameters = array_merge(parent::_getTwigParameters(), array('account_menu_selected' => true));
     echo $this->_getTwig()->render('manage/account.html.twig', $parameters);
 }
 protected function _before_execute()
 {
     parent::_before_execute();
     $this->_pathway->addStep('首页');
 }