public function before() { parent::before(); if (empty(Session::get(self::LOGIN))) { return Response::redirect('client/auth'); } }
public function before() { parent::before(); $this->session = Session::instance(); # Check user authentication $auth_result = true; $action_name = Request::instance()->action; if (array_key_exists($action_name, $this->auth)) { $auth_result = $this->_check_auth($action_name); } else { if (array_key_exists('*', $this->auth)) { $auth_result = $this->_check_auth('*'); } } if (!$auth_result) { if (Auth::instance()->logged_in()) { //! \todo Flash message. Request::instance()->redirect('user'); } else { Request::instance()->redirect('login'); } } // Try to pre-fetch the template. Doesn't have to succeed. try { $this->template->content = View::factory(Request::instance()->controller . '/' . Request::instance()->action); } catch (Kohana_View_Exception $e) { } $this->template->title = ucwords(Request::instance()->action); $this->template->left = null; $this->template->right = null; $this->template->footer = null; $this->template->no_back_button = true; $this->template->menu = array(); }
public function before() { parent::before(); $this->app = \Uri::segment(1); // guess app_name, if it is not provided if (is_null($this->app_name)) { $this->app_name = \Inflector::classify($this->app); } // guess model name from URI segment, if it is not provided if (is_null($this->model)) { $this->model = 'Model_' . $this->app_name; } // set app title $this->template->title = static::$title; // render menus $this->template->set('menu', Petro_Menu::render(static::$menu), false); // use uri segment to find ref_type from defined menu for later use $menu = Petro_Menu::find($this->app, static::$menu); // if page_title is not set, default to menu label if (!isset($this->template->page_title)) { $this->template->page_title = empty($menu['label']) ? \Inflector::pluralize($this->app_name) : $menu['label']; } $this->sidebars = new Petro_Sidebar(); is_null($this->must_login) and $this->must_login = \Config::get('petro.auth.enable', true); // if require login and not in the ignore login list, then check for login if ($this->must_login and !in_array(\Uri::string(), static::$ignore_login)) { if (!\Auth::instance()->check()) { $this->login_then_redirect(\Uri::string()); } } }
public function before() { // Open remote URLs in a new window html::$windowed_urls = TRUE; /** * Adding admin users $user = ORM::factory('user'); $user->email = '*****@*****.**'; $user->username = '******'; $user->password = '******'; $user->save(); // dont forget to add roles. 'login' role needs for successful login //$user->add('roles', ORM::factory('role', array('name' => 'admin'))); $user->add('roles', ORM::factory('role', array('name' => 'login'))); */ parent::before(); $this->template->scripts = array(); $this->template->styles = array(); $this->template->title = $this->template->content = ''; $auth = Auth::instance(); // set user $this->_user = $auth->get_user(); $this->_admin = $this->_checkAdmin(); $this->_supadmin = $this->_checkSupadmin(); //echo $this->_user; // handle ajax if ($this->request->is_ajax()) { // ajax like call detected, don't render whole template! $this->_ajax = TRUE; } else { // initiates the template dynamic content (header, nav, panel, footer, ...) $this->init(); } }
public function before() { if ($this->request->action === 'media') { // Do not template media files $this->auto_render = FALSE; } else { // Grab the necessary routes $this->media = Route::get('docs/media'); $this->api = Route::get('docs/api'); $this->guide = Route::get('docs/guide'); if (isset($_GET['lang'])) { $lang = $_GET['lang']; // Load the accepted language list $translations = array_keys(Kohana::message('userguide', 'translations')); if (in_array($lang, $translations)) { // Set the language cookie Cookie::set('userguide_language', $lang, Date::YEAR); } // Reload the page $this->request->redirect($this->request->uri); } // Set the translation language I18n::$lang = Cookie::get('userguide_language', Kohana::config('userguide')->lang); // Use customized Markdown parser define('MARKDOWN_PARSER_CLASS', 'Kodoc_Markdown'); // Load Markdown support require Kohana::find_file('vendor', 'markdown/markdown'); // Set the base URL for links and images Kodoc_Markdown::$base_url = URL::site($this->guide->uri()) . '/'; Kodoc_Markdown::$image_url = URL::site($this->media->uri()) . '/'; } parent::before(); }
public function before() { if ($this->tt == 0) { return 0; } return parent::before(); }
public function before() { parent::before(); if (Request::current()->is_initial()) { $this->request->action(404); } }
public function before() { // if(!CMS_User::instance()->is_authenticated()){ // $this->request->redirect(CMS_Infrastructure_Routes_Manager::login()); // } parent::before(); $this->template->cms_url_prefix = URL_PREFIX; $this->template->topmenu = View::factory('cms/navigation/top'); $this->template->leftmenu = View::factory('cms/navigation/left'); $this->set_caption('Модуль управления сайтом'); $this->set_content('', 'main_content'); $this->template->styles = array(); $this->add_style('cms/css/bootstrap.min.css'); $this->add_style('cms/font-awesome/css/font-awesome.css'); $this->add_style('cms/css/sb-admin-2.css'); $this->add_style('cms/css/style.css'); $this->template->scripts = array(); $this->add_script('cms/js/jquery-1.10.2.js'); $this->add_script('cms/js/bootstrap.min.js'); $this->add_script('cms/js/plugins/metisMenu/jquery.metisMenu.js'); $this->add_script('cms/js/plugins/cms/jquery.inputeditor.js'); $this->add_script('cms/js/plugins/cms/jquery.inputeditor2.js'); $this->add_script('cms/js/plugins/cms/jquery.controlselect.js'); $this->add_script('cms/js/plugins/cms/jquery.colorselect.js'); $this->add_script('cms/js/sb-admin.js'); $this->add_script('cms/js/script.js'); }
public function before() { // Run anything that need ot run before this. parent::before(); if ($this->auto_render) { // Initialize empty values $this->template->title = 'SiRPEC'; $this->template->meta_keywords = ''; $this->template->meta_description = ''; $this->template->meta_copywrite = ''; $this->template->header = ''; $this->template->content = ''; $this->template->menu = ''; $this->template->footer = 'copyright AEVivienda'; $this->template->adminmenu = ''; $this->template->styles = array(); $this->template->scripts = array(); $this->template->menutop = ''; $this->template->titulo = ''; $this->template->descripcion = ''; $this->template->menutop = ''; $this->template->username = ''; $this->template->submenu = View::factory('user/menu'); $this->template->controller = 'index'; $this->template->theme = '#modx-topbar{border-bottom: 2px solid #249cf5;} #bos-main-blocks h2 a,h2.titulo v,.colorcito {color:#249cf5;}#menu-left ul li a:hover,#menu-left ul li:hover {color:#fff; background: #249cf5; font-weight: bold; } html #modx-topnav ul.modx-subnav li a:hover {background-color:#249cf5;} input#searchsubmit:hover {background-color:#249cf5;} #icon-logo{background:#249cf5 url(/media/images/icon_user.png) scroll left no-repeat; }.button2{border: 1px solid#249cf5;background-color:#249cf5;}.button2:hover, .button2:focus {background:#249cf5;}.jOrgChart .node { background-color:#249cf5;}.widget .title {background: none repeat scroll 0 0 #249cf5;} legend {border: 1px solid #249cf5;}fieldset { border: 2px solid#249cf5;}.proveido {color:#249cf5;}'; } }
/** * Construct controller */ public function before() { parent::before(); if (!Visitor::instance()->logged_in('admin')) { throw new Permission_Exception(new Model_Role()); } }
/** * @return void */ public function before() { parent::before(); // Start a session Session::instance(); // Load Auth instance $this->auth = Auth::instance(); // Get the currently logged in user or set up a new one. // Note that get_user will also do an auto_login check. if (($this->user = $this->auth->get_user()) === FALSE) { $this->user = ORM::factory('user'); } if ($this->auto_render) { // Initialize default values $this->template->title = 'KohanaJobs v2'; $this->template->content = ''; $this->template->bind_global('user', $this->user); } }
/** * Loads test suite */ public function before() { parent::before(); if( ! Kohana_Tests::enabled()) { // Pretend this is a normal 404 error... $this->status = 404; throw new Kohana_Request_Exception('Unable to find a route to match the URI: :uri', array(':uri' => $this->request->uri)); } // Prevent the whitelist from being autoloaded, but allow the blacklist // to be laoded Kohana_Tests::configure_enviroment(FALSE); $this->config = Kohana::$config->load('phpunit'); // This just stops some very very long lines $route = Route::get('unittest'); $this->report_uri = $route->uri(array('controller' => 'phpunit', 'action' => 'report')); $this->run_uri = $route->uri(array('controller' => 'phpunit', 'action' => 'run')); // Switch used to disable cc settings $this->xdebug_loaded = extension_loaded('xdebug'); $this->template->set_global('xdebug_enabled', $this->xdebug_loaded); }
public function before() { parent::before(); View::set_global('base', URL::base(TRUE, FALSE)); $this->__JS__ = 'public/static/template/admin/'; $this->__CSS__ = 'public/static/template/admin/'; }
public function before() { parent::before(); if (!isset($this->_config)) { $this->_config = Config::load('opauth', 'opauth'); } }
public function before() { parent::before(); $auth = \Auth::instance('SimpleAuth'); if (\Input::get('logout')) { $auth->logout(); \Response::redirect(\Uri::base(false) . 'admin/login'); } $uri = explode('/', \Uri::string()); if ($auth->check()) { if (count($uri) < 3 && (empty($uri[1]) || $uri[1] == 'login')) { \Response::redirect(\Uri::base(false) . 'admin/list'); } // Load admin Config for List View and default to first tab $this->data['tabs'] = $this->template->tabs = \Config::get('admin.tabs'); $this->data['table'] = $this->param('item', ''); // get item from URI if (!$this->data['table']) { list($this->data['table']) = array_slice(array_keys($this->data['tabs']), 0, 1); } $this->template->table = $this->data['table']; } elseif (count($uri) > 1 && $uri[1] != 'login') { \Response::redirect(\Uri::base(false) . 'admin/login'); } if ($this->auto_render === true) { // set up defaults $this->template->body = ''; } return true; }
public function before() { parent::before(); if (Request::current()->is_initial()) { $this->auto_render = FALSE; } }
/** * The before() method is called before your controller action. * In our template controller we override this method so that we can * set up default values. These variables are then available to our * controllers if they need to be modified. */ public function before() { //Run any before if needed parent::before(); //Open session $this->session = Session::instance(); //Check user auth and role $action_name = Request::instance()->action; if (is_array($this->secure_actions) && array_key_exists($action_name, $this->secure_actions) && Auth::instance()->logged_in($this->secure_actions[$action_name]) === FALSE) { if (Auth::instance()->logged_in()) { Request::instance()->redirect('admin/site/noaccess'); } else { Request::instance()->redirect('admin/site/signin'); } } if ($this->auto_render) { // Initialize empty values $this->template->title = ''; $this->template->meta_keywords = ''; $this->template->meta_description = ''; $this->template->meta_copywrite = ''; $this->template->header = ''; $this->template->content = ''; $this->template->footer = ''; $this->template->styles = array(); $this->template->scripts = array(); $this->template->section_title = ' '; } }
public function before() { parent::before(); $this->session = Session::instance(); $this->config = Kohana::$config->load('app'); View::bind_global('app_config', $this->config); }
public function before() { parent::before(); $this->template->title = ''; $this->template->menu = array(); $this->template->menu_b = array(); }
public function before() { parent::before(); I18n::lang('ru'); Cookie::$salt = 'eqw67dakbs'; Session::$default = 'cookie'; //$this->cache = Cache::instance('file'); $this->session = Session::instance(); $this->auth = Auth::instance(); $this->user = $this->auth->get_user(); // $captcha = Captcha::instance(); // Подключаем стили и скрипты $this->template->styles = array(); $this->template->scripts = array(); //Вывод в шаблон $this->template->title = null; $this->template->site_name = null; $this->template->description = null; $this->template->page_title = null; //Подключаем главный шаблон $this->template->main = null; $this->template->userarea = null; $this->template->top_menu = View::factory('v_top_menu'); $this->template->manufactures = null; $this->template->left_categories = null; $this->template->slider_banner = null; $this->template->block_left = array(); $this->template->block_center = array(); $this->template->block_right = array(); $this->template->block_footer = null; }
public function before() { parent::before(); !Auth::check() and Response::redirect('/auth/login'); $this->current_user = Model_User::find_by_username(Auth::get_screen_name()); $this->template->set_global('current_user', $this->current_user); }
public function before() { $this->template = 'admin/template'; parent::before(); $this->template->is_login = false; if ($this->request->action !== 'login') { $this->administrator = \Session::get('admin.administrator'); if (!$this->administrator) { \Response::redirect('admin/index/login'); } $this->template->is_login = isset($this->administrator); } $should_be_secure = in_array($this->request->action, $this->_secure_actions); $is_secure = isset($_SERVER['HTTPS']); $use_ssl = \Config::get('ssl_connection.use'); if (!$this->_ssl_host) { $this->_ssl_host = \Config::get('ssl_connection.default_host'); if (!$this->_ssl_host) { $this->_ssl_host = $_SERVER['HTTP_HOST']; } } if ($should_be_secure && !$is_secure && $use_ssl) { $this->redirectToProtocol('https'); } elseif (!$should_be_secure && $is_secure) { $this->redirectToProtocol('http'); } }
public function before() { parent::before(); // This must be included // start session if not started if (!isset($_SESSION)) { session_start(); } // cache $this->cache = Cache::instance(); // include helpers include_once APPPATH . '/classes/helpers/email.php'; include_once APPPATH . '/classes/helpers/flash.php'; include_once APPPATH . '/classes/helpers/cli.php'; include_once APPPATH . '/classes/library/task_queue.php'; // set default layout props $this->template->title = 'Social Mention'; $this->template->content = ''; //$this->db = Database::instance(); //$this->session = Session::instance(); // load user auth class include_once APPPATH . '/classes/library/authorize.php'; $this->auth = new Authorize(); // user details $this->user_id = $this->auth->get_user(); $this->_user_id = $this->auth->get_user(); $this->_user = false; if ($this->user_id) { $this->_user = $this->auth->get_user_details(); } // if ($this->user_id) { $this->set_projects(); } }
public function before() { parent::before(); if (!Auth::check()) { Response::redirect('login'); } }
/** * Initialize properties before running the controller methods (actions), * so they are available to our action. */ public function before() { // Run anything that need ot run before this. parent::before(); if (!Auth::instance()->logged_in()) { if ($this->request->controller != 'auth') { // If we want to force people to log in, // we can uncomment this line // TODO -- send some message saying (you must login!) //$this->request->redirect('index.php/auth/login'); } } if ($this->auto_render) { // Initialize empty values $this->template->title = 'Ptododactyl Rulez!'; $this->template->meta_keywords = ''; $this->template->meta_description = ''; $this->template->meta_copywrite = ''; $this->template->header = View::factory('includes/header'); $this->template->content = ''; $this->template->footer = View::factory('includes/footer'); $this->template->styles = array(); $this->template->scripts = array(); } }
public function before() { parent::before(); //許可するアクション $action = array('login', 'index'); //アクティブなアクション $active = Request::active()->action; //ログインしていなくて、許可アクション以外は if (!Auth::check() and !in_array($active, $action)) { //ログインページへ移動 Response::redirect('pt/login'); } // public function before(){ // parent::before(); // var_dump(Auth::check()); // if(!Auth::check()){ // Response::redirect('pt/login'); // } // // if(!Auth::check()){ // Response::redirect('pt/index'); // } // $action = array('pt','login','pt/index/HTML5','pt/index/PHP','pt/index'); // // $active = Request::active()->action; // var_dump($action); exit; // var_dump($active); exit; // if(!Auth::check() and !in_array($active,$action)){ // Response::redirect('pt/index'); // exit; // }else{ // Response::redirect('pt'); // }; }
public function before() { parent::before(); $this->template->title = 'Swiftriver'; $this->template->theme = Theming::get_theme(); $this->template->header = new View('defaults/header'); $this->template->content = ''; $this->template->rightbar = new View('defaults/rightbar'); $this->template->footer = new View('defaults/footer'); $loggedinstatus = RiverId::is_logged_in(); if (!$loggedinstatus["IsLoggedIn"]) { $this->template->admin = new View("adminbar/user"); } else { if ($loggedinstatus["Role"] == "sweeper") { $this->template->admin = new View("adminbar/sweeper"); } else { if ($loggedinstatus["Role"] == "editor") { $this->template->admin = new View("adminbar/editor"); } else { if ($loggedinstatus["Role"] == "admin") { $this->template->admin = new View("adminbar/admin"); } } } } }
/** * before create */ public function before() { parent::before(); $this->template->content = ''; $this->template->styles = array('main'); $this->template->scripts = ''; }
/** * Before - Check for login */ public function before() { if ($this->request->action != 'login' and !Auth::check()) { Reponse::redirect('admin/login'); } return parent::before(); }
public function before() { if (!Auth::instance()->logged_in() && $this->request->action() != 'get_login' && $this->request->action() != 'post_login') { $this->redirect('login'); } parent::before(); }