示例#1
0
 /**
  * @param   none
  * @throws  none
  * @returns	void
  */
 public function before()
 {
     $result = array();
     // users need to be logged in to access this controller
     if (!\Sentry::check()) {
         $result = array('message' => 'You need to be logged in to access that page.', 'url' => '/admin/login');
         // Don't show this message if url is just 'admin'
         if (\Uri::string() == 'admin/admin/index') {
             unset($result['message']);
         }
         \Session::set('redirect_to', \Uri::admin('current'));
     } else {
         if (!\Sentry::user()->is_admin()) {
             $result = array('message' => 'Access denied. You need to be a member of staff to access that page.', 'url' => '/admin/login');
             \Session::set('redirect_to', \Uri::admin('current'));
         }
     }
     if (!empty($result)) {
         if (\Input::is_ajax()) {
             \Messages::error('You need to be logged in to complete this action.');
             echo \Messages::display('left', false);
             exit;
         } else {
             if (isset($result['message'])) {
                 \Messages::warning($result['message']);
             }
             \Response::redirect($result['url']);
         }
     }
     parent::before();
 }
 public function before()
 {
     parent::before();
     if (!$this->login_user) {
         throw new \SystemException(\Model_Error::ER00701);
     }
 }
 public function before()
 {
     parent::before();
     if (!Auth::check()) {
         return $this->responseJson('nologin', true);
     }
     $this->fleamarket = Model_Fleamarket::find(Input::param('fleamarket_id'));
     if (!$this->fleamarket) {
         return $this->responseJson('nodata', true);
     }
     $this->input = array('user_id' => Auth::get_user_id(), 'fleamarket_id' => Input::param('fleamarket_id'));
     $this->favorite = Model_Favorite::query()->where($this->input)->get_one();
 }
示例#4
0
 /**
  * After controller method has run, render the theme template
  *
  * @param  Response  $response
  */
 public function after($response)
 {
     if (!\Input::is_ajax()) {
         // If nothing was returned set the theme instance as the response
         if (empty($response)) {
             $response = \Response::forge(\Theme::instance());
         }
         if (!$response instanceof Response) {
             $response = \Response::forge($response);
         }
         return $response;
     }
     return parent::after($response);
 }
示例#5
0
 public function before()
 {
     parent::before();
     // Get action, module and controller name
     $this->actionName = \Request::active()->action;
     $this->moduleName = \Request::active()->module;
     $this->controllerName = strtolower(str_replace('Controller_', '', \Request::active()->controller));
     $this->controllerName = str_replace($this->moduleName . '\\', '', $this->controllerName);
     // Check Auth Access
     if (!\Auth::check()) {
         \Messages::warning(__('user.login.not-logged'));
         //            \Response::redirect('user/service/index/login');
     }
     $this->template->title = "RN | Admin";
 }
 public function before()
 {
     parent::before();
     $this->fieldset = $this->getFieldset();
     if (!$this->fieldset) {
         throw new \SystemException(\Model_Error::ER00501);
     }
     $input = $this->fieldset->input();
     $fleamarket = \Model_Fleamarket::find($input['fleamarket_id']);
     if (!$fleamarket) {
         throw new \SystemException(\Model_Error::ER00501);
     }
     $this->fleamarket = $fleamarket;
     if ($input['fleamarket_entry_style_id']) {
         $this->fleamarket_entry_style = \Model_Fleamarket_Entry_Style::find('first', array('where' => array('fleamarket_entry_style_id' => $input['fleamarket_entry_style_id'], 'fleamarket_id' => $input['fleamarket_id'])));
     }
 }
示例#7
0
 public function before()
 {
     parent::before();
     // Get action, module and controller name
     $this->actionName = \Request::active()->action;
     $this->moduleName = \Request::active()->module;
     $this->controllerName = strtolower(str_replace('Controller_', '', \Request::active()->controller));
     $this->controllerName = str_replace($this->moduleName . '\\', '', $this->controllerName);
     // Check Auth Access
     if (!\Auth::check()) {
         \Messages::warning(__('user.login.not-logged'));
         \Response::redirect('user/service/index/login');
     }
     $this->_user = Model_User::find($this->_userId);
     // Set Navigation
     $this->template->title = "RN | Wall Street Journal";
     // Set global
     $this->dataGlobal['title'] = \Config::get('application.seo.backend.title');
 }
 public function before()
 {
     parent::before();
 }
示例#9
0
 public function setMedia()
 {
     parent::setMedia();
     $this->theme->asset->css('bootstrap.css', array(), 'css_core', false);
 }
 public function before()
 {
     parent::before();
     Asset::css('info.css', array(), 'add_css');
 }