/** * This will set the DI Container before the controller loads */ public function before() { parent::before(); //init di containers $di = new Library\Di(); $this->setDi($di->getDi()); }
public function before() { parent::before(); // Load Exchange package \Package::load('Skills'); $this->skills = \Skills\Skills::forge(); }
/** * Run this before every call * * @return void * @access public */ public function before() { // Profile the loader \Profiler::mark('Start of loader\'s before() function'); \Profiler::mark_memory($this, 'Start of loader\'s before() function'); // Set the environment parent::before(); // Load the config for Segment so we can process analytics data. \Config::load('segment', true); // Load the config file for event names. Having events names in one place keeps things synchronized. \Config::load('analyticsstrings', true); // Engine configuration \Config::load('engine', true); // Load the package configuration file. \Config::load('tiers', true); // Soccket connection configuration \Config::load('socket', true); /** * Ensure that all user language strings are appropriately translated. * * @link https://github.com/fuel/core/issues/1860#issuecomment-92022320 */ if (is_string(\Input::post('language', false))) { \Environment::set_language(\Input::post('language', 'en')); } // Load the error strings. \Lang::load('errors', true); }
public function before() { parent::before(); // if (!\Input::is_ajax()) // { // throw new HttpNotFoundException; // } }
public function before() { parent::before(); //\Session::delete(self::ORDER); if (empty(\Session::get(self::ORDER))) { \Session::set(self::ORDER, array('cart' => array())); } }
public function before() { parent::before(); Config::load('base'); foreach (Input::post() as $k => $v) { Log::info($k . ':' . $v); } }
public function before() { parent::before(); if (!Model_User::is_logged()) { $this->response($this->_error('login error'), 200); } else { $this->_user = Model_User::get_login_user(); } }
public function before() { // Make sure we call the parent package before function parent::before(); // Load the config file for this package \Config::load(static::$_configFile, true); // Now set the view directory for this package static::$_viewPath = \Config::get(static::$_configFile . '.view_directory'); }
public function before() { parent::before(); // Assign current_user to the instance so controllers can use it $this->user = Warden::check() ? Warden::current_user() : null; if (!$this->user) { $this->response(array('status' => 0, 'error' => 'Not Authorized'), 401); } }
public function before() { parent::before(); if (Auth::check()) { $user_id = Auth::get_user_id()[1]; $this->user = Model_User::find($user_id); if ($this->user->group_id == 100) { $this->auth_status = true; } } }
/** * router * * requests are not made to methods directly The request will be for an "object". * this simply maps the object and method to the correct Controller method. * * this router will call action methods for normal requests, * and REST methods for RESTful calls * * @param string * @param array */ public function router($resource, array $arguments) { // if this is an ajax call if (\Input::is_ajax()) { // have the Controller_Rest router deal with it return parent::router($resource, $arguments); } // check if the action method exists if (method_exists($this, 'action_' . $resource)) { // if so, call the action return call_user_func_array(array($this, 'action_' . $resource), $arguments); } // if not, we got ourselfs a genuine 404! throw new \HttpNotFoundException(); }
public function before() { parent::before(); if (Auth::check()) { $user_id = Auth::get_user_id()[1]; $this->user = Model_User::find($user_id); if ($this->user->group_id == 1) { $this->auth_status = true; if ($this->user->timezone != "") { $timezone = Config::get("timezone.timezone"); if (isset($timezone[$this->user->timezone])) { date_default_timezone_set($timezone[$this->user->timezone]); } } } } }
/** * This method gets called after the action is called */ public function after($response) { if ($response instanceof \View) { $response->set('user_id', self::$_logined_user_id); $response->set('logined', self::$_logined); if (isset(static::$_current_page)) { $response->set('current_page', static::$_current_page); } foreach (self::$_config as $k => $v) { $response->set($k, $v); } foreach (\Config::load('original_image', true) as $k => $v) { $response->set($k, $v); } } $response = parent::after($response); return $response; }
public function before() { parent::before(); // 利用者を識別する if (isset($_SESSION['user'])) { $this->user = $_SESSION['user']; } else { header('HTTP/1.1 401 Authorization Required'); exit; } $this->model_todo = new Model_Todo($this->user); if (!isset($_SESSION['sort_setting'])) { $_SESSION['sort_setting'] = $this->model_todo->make_initial_setting('sort_setting'); } if (!isset($_SESSION['search_keyword'])) { $_SESSION['search_keyword'] = $this->model_todo->make_initial_setting('search_keyword'); } }
public function before() { parent::before(); // 利用者を識別する if (isset($_SESSION['user'])) { $this->user = $_SESSION['user']; } else { var_dump('利用可能なユーザーでアクセスしてください。'); exit; } $this->model_todo = new Model_Todo($this->user); if (!isset($_SESSION['sort_setting'])) { $_SESSION['sort_setting'] = $this->model_todo->make_initial_setting('sort_setting'); } if (!isset($_SESSION['search_keyword'])) { $_SESSION['search_keyword'] = $this->model_todo->make_initial_setting('search_keyword'); } }
/** * After controller method has run output the template * * @param Response $response */ public function after($response) { // return the template if no response is present and this isn't a RESTful call if (!$this->is_restful()) { // do we have a response passed? if (empty($response)) { // maybe one in the rest body? $response = $this->response->body; if (empty($response)) { // fall back to the defined template $response = $this->template; } } if (!$response instanceof Response) { $response = \Response::forge($response); } } return parent::after($response); }
public function init() { parent::init(); // Check valid app key $this->checkAppKey(); }
/** * Init and check session key. */ public function init() { parent::init(); // Check valid session $this->checkSessionKey(); }
public function before() { # まず最初に親のbefore()を呼ばないといけないfuelのルール。エラーになる。 parent::before(); $this->format = self::DEFAULT_RESPONSE_FORMAT; }
/** * After controller method has run output the template * * @param Response $response */ public function after($response) { // return the template if no response is present and this isn't a RESTful call if (!$this->is_restful()) { // do we have a response passed? if ($response === null) { // maybe one in the rest body? $response = $this->response->body; if ($response === null) { // fall back to the defined template $response = $this->template; } } elseif (is_array($response)) { $response = \Format::forge()->to_json($response, true); } // and make sure we have a valid Response object if (!$response instanceof Response) { $response = \Response::forge($response, $this->response_status); } } return parent::after($response); }
public function response($data = array(), $http_status = null) { $data = array_merge($this->response_format, $data); return parent::response($data, $http_status); }
public function before() { parent::before(); libxml_use_internal_errors(true); }
public function before() { parent::before(); }
public function __construct(\Request $request) { parent::__construct($request); $this->config = \Config::load('api', true); }