Beispiel #1
0
 public function before()
 {
     parent::before();
     //Visits
     $visited = \Cookie::get('visited', false);
     if (!$visited) {
         \Dashboard::log_visitor();
         \Cookie::set("visited", true, time() + 86400);
     }
     // Cart
     \Config::load('cart', true);
     $cartManager = new \Cart\Manager(\Config::get('cart'));
     \CartManager::init($cartManager);
     \CartManager::context('Cart');
     // Set Visitors group default
     \Product\Model_Attribute::set_user_group(3);
     \Theme::instance()->active('frontend');
     \Theme::instance()->set_template($this->template);
     // Set a global variable so views can use it
     $seo = array('meta_title' => '', 'meta_description' => '', 'meta_keywords' => '', 'canonical_links' => '', 'meta_robots_index' => 1, 'meta_robots_follow' => 1);
     \View::set_global('seo', $seo, false);
     \View::set_global('theme', \Theme::instance(), false);
     \View::set_global('logged', $this->check_logged(), false);
     \View::set_global('guest', $this->check_guest(), false);
     \View::set_global('logged_type', $this->check_logged_type(), false);
 }
 public function before()
 {
     parent::before();
     if (!$this->login_user) {
         throw new \SystemException(\Model_Error::ER00701);
     }
 }
Beispiel #3
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 (!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();
 }
Beispiel #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();
     // 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::info(__('user.login.not-logged'));
         \Response::redirect(\Router::get('login'));
     }
     // Set global
     $this->dataGlobal['title'] = \Config::get('application.seo.backend.title');
 }
 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'])));
     }
 }
Beispiel #8
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();
     // Override a package class
     \Autoloader::add_classes(array('Hybrid\\Pagination' => APPPATH . 'core/pagination.php'));
     // Cart
     \Config::load('cart', true);
     $cartManager = new \Cart\Manager(\Config::get('cart'));
     \CartManager::init($cartManager);
     \CartManager::context('Cart');
     // Set Visitors group default
     \Product\Model_Attribute::set_user_group(3);
     \Theme::instance()->active('frontend');
     \Theme::instance()->set_template($this->template);
     // Set a global variable so views can use it
     \View::set_global('theme', \Theme::instance(), false);
     \View::set_global('logged', $this->check_logged(), false);
     \View::set_global('guest', $this->check_guest(), false);
     \View::set_global('logged_type', $this->check_logged_type(), false);
     \View::set_global('my_categories', $this->my_categories(), false);
     // Pagination
     \Config::load('pagination', true);
 }
 public function before()
 {
     parent::before();
 }
Beispiel #11
0
 public function before()
 {
     parent::before();
     // Set global
     $this->dataGlobal['title'] = \Config::get('application.seo.frontend.title');
 }
 public function before()
 {
     parent::before();
     Asset::css('info.css', array(), 'add_css');
 }