Пример #1
0
 public function before()
 {
     parent::before();
     if (!defined('IS_SSL')) {
         define('IS_SSL', Input::protocol() == 'https');
     }
     if (!defined('IS_ADMIN')) {
         define('IS_ADMIN', $this->check_is_admin_request());
     }
     if (!defined('IS_SP')) {
         define('IS_SP', \MyAgent\Agent::is_mobile_device());
     }
     if (!defined('IS_API')) {
         define('IS_API', Site_Util::check_is_api());
     }
     $this->set_default_data();
     $this->check_ssl_required_request_and_redirect();
     $this->check_remote_ip();
     $this->auth_instance = Auth::forge($this->auth_driver);
     if (!defined('IS_AUTH')) {
         define('IS_AUTH', $this->check_auth(false));
     }
     $this->check_auth_and_redirect();
     $this->set_current_user();
     $this->check_required_setting_and_redirect();
     self::setup_assets();
 }
Пример #2
0
 public function before()
 {
     parent::before();
     if (!Input::is_ajax()) {
         $this->_init_assets();
     }
 }
Пример #3
0
 public function after($response)
 {
     $response = parent::after($response);
     // css jsのセット
     $this->template->set('css', $this->css, false);
     $this->template->set('js', $this->js, false);
     return $response;
 }
Пример #4
0
 public function before()
 {
     // Make sure we call the parent package before function
     parent::before();
     // Load the config file for this package
     \Subpackage\Subconfig::subload(static::$_configFile, true);
     // Now set the view directory for this package
     static::$_viewPath = \Subpackage\Subconfig::get(static::$_configFile . '.view_directory');
 }
Пример #5
0
 public function after($response)
 {
     !\Request::is_hmvc() and $this->theme->get_template()->set_global($this->dataGlobal);
     // If nothing was returned set the theme instance as the response
     if (empty($response)) {
         $response = \Response::forge($this->theme);
     }
     if (!$response instanceof \Response) {
         $response = \Response::forge($response);
     }
     return parent::after($response);
 }
Пример #6
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);
 }
Пример #7
0
 public function before()
 {
     parent::before();
     // Check Auth Access
     if (\Auth::check()) {
         /*
          *  Get the current user id and email address
          * */
         list(, $userId) = Auth::get_user_id();
         $this->user = Model_User::find($userId);
     }
     isset($this->title) ? $this->title : ($this->title = "Rodas Net");
     $this->template->title = $this->title;
     // Load translation
     \Lang::load('application');
     // If ajax or content_only, set a theme with an empty layout
     if (\Input::is_ajax()) {
         return parent::before();
     }
 }
Пример #8
0
 public function before()
 {
     $this->template = $this->newIntranet() ? "templates/layout" : "template";
     \Session::set("current_page", \Uri::string());
     $segments = implode(\Uri::segments());
     if (\Auth::check() || $segments == 'userlogin') {
         list($driver, $user_id) = \Auth::get_user_id();
         $this->current_user = \Model_User::find($user_id);
     } else {
         if ($segments != 'userlogin') {
             \Session::set("lastpage", implode("/", \Uri::segments()));
         }
         $this->current_user = null;
         \Response::redirect('user/login');
     }
     if ($segments != 'userlogin') {
         \View::set_global('group_name', \Auth_Group_SimpleGroup::instance()->get_name($this->current_user->group));
         \View::set_global('current_user', $this->current_user);
     }
     parent::before();
     // Remove when login implemented
 }
Пример #9
0
 public function before()
 {
     parent::before();
     \Session::set("current_page", \Uri::string());
     $segments = implode(\Uri::segments());
     if (Auth::check() || $segments == 'userlogin') {
         list($driver, $user_id) = Auth::get_user_id();
         $thisUser = \Model_User::find($user_id);
         if ($segments != 'userlogin') {
             \Log::write('Action', 'Visit to page ' . \Uri::string() . ' by ' . $thisUser->name, 'Del_Spam');
         }
         $this->current_user = Model_User::find($user_id);
     } else {
         if ($segments != 'userlogin') {
             Session::set("lastpage", implode("/", \Uri::segments()));
         }
         $this->current_user = null;
         Response::redirect('user/login');
     }
     if ($segments != 'userlogin') {
         View::set_global('group_name', Auth_Group_SimpleGroup::instance()->get_name($this->current_user->group));
         View::set_global('current_user', $this->current_user);
     }
 }
Пример #10
0
 public function before()
 {
     parent::before();
     // Load translation
     \Lang::load('blog');
 }
Пример #11
0
 public function before()
 {
     parent::before();
     //View::set_global('group_name', Auth_Group_SimpleGroup::instance()->get_name($this->current_user->group));
     //View::set_global('current_user', $this->current_user);
 }