/** * Generate Nav * * Generates the navigation bar for the admin panel. Will display * an alert if the electrum backup option is set but no MPK supplied. * This will pave the way for further alerts to be shown to admins. * * @return string */ public function generate_nav() { $nav = ''; if ($this->bw_config->bip32_mpk == '') { $nav .= '<div class="alert alert-danger">You have not configured an electrum master public key. Please do so now ' . anchor('admin/edit/bitcoin', 'here') . '.</div>'; } $links = ''; foreach ($this->nav as $entry) { $links .= '<li'; if (uri_string() == 'admin' . $entry['panel'] || uri_string() == 'admin/edit' . $entry['panel']) { $links .= ' class="active" '; $self = $entry; $heading = $entry['heading']; $panel_url = $self['panel']; } $links .= '>' . anchor('admin' . $entry['panel'], $entry['title']) . '</li>'; } $nav .= ' <div class="row"> <ul class="nav nav-tabs"> <li class="col-xs-3"><h4>' . $self['heading'] . '</h4></li> <li class="col-xs-1">'; if ($panel_url !== '/logs') { $nav .= " " . anchor('admin/edit' . $panel_url, 'Edit', ''); } $nav .= ' </li> <li class="col-xs-8">' . $links . '</li> </ul> </div> <div class="row"> </div>'; return $nav; }
function render() { if (uri_string() != "/admin/login") { $this->slots['content'] .= '<p>' . anchor("admin/logout", 'Log out') . '</p>'; } parent::render(); }
function is_active($input_params = "") { // uri_string is a CodeIgniter function $uri_string = uri_string(); // direct matching, faster than looping. if ($uri_string == $input_params) { return true; } $uri_params = preg_split("/\\//", $uri_string); $input_params = preg_split("/\\//", $input_params); $prev_key = -1; foreach ($input_params as $param) { $curr_key = array_search($param, $uri_params); // if it doesn't exist, return null if ($curr_key === FALSE) { return false; } // this makes us order sensitive if ($curr_key < $prev_key) { return false; } $prev_key = $curr_key; } return true; }
public function logSave($userType = "", $user_id = "") { $userType = strtolower(trim($userType)); if ($userType == "") { $userType = "guess"; } if (!in_array($userType, array('guess', 'gaestaff', 'staff', 'owner', 'customer'))) { $errors = array("error" => "userType in correct!"); resDie($errors, $this->methodPlace()); } $is_https = 0; if (@$_SERVER["HTTPS"] == "on") { $is_https = 1; } $this->load->library('session'); $logData["method_type"] = strtoupper(trim($this->input->server('REQUEST_METHOD'))); $logData["url_call"] = base_url(uri_string()); $logData["header_data"] = json_encode(getallheaders()); $logData["request_data"] = json_encode($_REQUEST); $logData["get_data"] = json_encode($_GET); $logData["post_data"] = json_encode($_POST); $logData["file_data"] = json_encode($_FILES); $logData["shop_id"] = 1; $logData["is_https"] = $is_https; $logData["user_type"] = $userType; $logData["user_id"] = $user_id; $logData["controller_name"] = $this->router->fetch_class(); $logData["function_name"] = $this->router->fetch_method(); $logData["base_app_id"] = base_app_id(); $logData["create_time"] = time(); $logData["session_id"] = $this->session->userdata('session_id'); $logData["ip_address"] = $this->input->ip_address(); return $this->insert($logData); }
/** * Copies an instance of CI */ public function __construct() { $ci =& get_instance(); //$ci->auth = new stdClass; $ci->load->library('flexi_auth'); $ci->load->helper('url'); $uri = explode('/', uri_string()); $is_logout = FALSE; if (!empty($uri[1])) { if (strpos($uri[1], 'logout') !== false) { $is_logout = TRUE; } } if (!$is_logout) { $user_id = $ci->flexi_auth->get_user_id(); if (!empty($user_id)) { if ($ci->flexi_auth->in_group(array('StandardUsers'))) { //this is trial users check process /* $ci->load->model('user_model'); $user_info = $ci->flexi_auth->get_user_by_id($user_id)->result_array()[0]; $datetime1 = new DateTime(); $datetime2 = new DateTime($user_info['uacc_date_added']); $interval = $datetime1->diff($datetime2); $days = $interval->days; if ($days >= 30) { redirect('payment'); } */ } else { if ($ci->flexi_auth->in_group(array('PremiumUsers'))) { //wait for payment system } } } } }
function vasp_breadcrumbs($trail_delimeter = '»', $open_tag = '<p>', $close_tag = '</p>') { $CI =& get_instance(); $CI->load->helper('inflector'); $breadcrumbs = array(); if (count($breadcrumbs) == 0) { $url_parts = array(); $segment = $CI->uri->segment_array(); $last_segment = array_pop($segment); foreach ($segment as $url_ref) { // Skip if we already have this breadcrumb and its not admin //if(in_array($url_ref, $url_parts) or $url_ref == 'admin') continue; $url_parts[] = $url_ref; $breadcrumbs[] = array('name' => humanize(str_replace('-', ' ', $url_ref)), 'url' => implode('/', $url_parts), 'current_page' => FALSE); } $url_parts[] = $last_segment; $breadcrumbs[] = array('name' => humanize(str_replace('-', ' ', $last_segment)), 'url' => implode('/', $url_parts), 'current_page' => TRUE); } // Build HTML to output $html = $open_tag . '<a href="' . site_url('home') . '">Home</a> '; foreach ($breadcrumbs as $breadcrumb) { if (!$breadcrumb['current_page']) { $html .= $trail_delimeter . ' ' . '<a href="' . site_url($breadcrumb['url']) . '">' . $breadcrumb['name'] . '</a> '; } elseif (current_url() === site_url('home') || uri_string() === '') { $html .= ''; } else { $html .= $trail_delimeter . ' ' . $breadcrumb['name']; } } $html .= $close_tag; echo $html; }
public function __construct() { parent::__construct(); //Load Library $this->load->library('form_validation'); //Load Model $this->load->model('auth_user_m'); $this->load->model('auth_group_m'); $this->load->model('categories_m'); $this->load->model('categories_seo_m'); $this->load->model('post_m'); $this->load->model('post_seo_m'); $this->load->model('design_slide_m'); //Load Helper $this->load->helper("text"); //CKEDITOR $this->load->library('ckeditor'); $this->load->library('ckfinder'); $this->ckeditor->basePath = base_url() . 'publics/admin/js/ckeditor/'; $this->ckeditor->config['language'] = 'vi'; $this->ckeditor->config['width'] = '800px'; $this->ckeditor->config['height'] = '300px'; //Login check $exception_uri = array('admin/user/login', 'admin/user/logout'); if (in_array(uri_string(), $exception_uri) == false) { //Đăng nhập thất bại if ($this->session->userdata('logged_in') != TRUE) { redirect('admin/user/login'); } else { //Thông tin người dùng $data['user_logged_in'] = $this->session->userdata('user'); } } }
public function view($post_id) { $data['person_loggedin'] = get_user(); $data['login_url'] = base_url('auth?return=' . uri_string()); $data['post'] = $this->post_model->get_content($post_id); if (!$data['post']) { redirect('/'); } $data['replies'] = $this->post_reply_model->get_nested_post_reply($post_id); $data['latest_replies'] = $this->post_reply_model->get_latest_reply(0); $data['related_tags'] = $this->tag_model->get_related_tag_by_topic($post_id); $data['header'] = $this->load->view('header', $this->header, TRUE); $data['footer'] = $this->load->view('footer', $this->footer, TRUE); $this->post_model->incVisit($post_id); $data['reply_view'] = array(); if ($data['replies']) { foreach ($data['replies'][$post_id] as $reply) { $rdata = array('replies' => $data['replies'], 'reply' => $reply, 'post' => $data['post'], 'person_loggedin' => $data['person_loggedin'], 'login_url' => $data['login_url'], 'topic_id' => $data['post']->POST_ID); $data['reply_view'][] = $this->load->view('post/reply-element', $rdata, TRUE); } } if (isset($_GET['report'])) { $data['report'] = $_GET['report']; } $this->load->view('post/view', $data); }
public function index() { $this->load->view("public/head", array("title" => "Главная")); $this->load->view("public/menu", array("str" => uri_string())); $this->load->view("main/index"); $this->load->view("public/footer", array("css" => array(), "load_js" => array())); }
public function init($hdrName = "") { $data['mainContent'] = "utilities/init"; $data['currLeftNav'] = "/codeIgniter/index.php/" . uri_string(); //current_url(); return $data; }
public function get_newsletter_form() { /* BENCHMARK */ $this->benchmark->mark('func_get_newsletter_form_start'); $this->load->helper('data'); $newsletter_html = ''; // only make a newsletter form if users who are not site admins are signed in /*if ('super_admin'==$this->user['user_type'] or 'admin_user'==$this->user['user_type'] or 'supplier_user'==$this->user['user_type']) { $newsletter_html.=''; } else {*/ $attr = array('name' => 'newsletter_form', 'id' => 'newsletter_form', 'class' => 'form'); $hidden = array('url' => uri_string()); // reload url $newsletter_html .= form_open('newsletter/signup', $attr, $hidden); // email field $attr = array('name' => 'newsletter_email', 'id' => 'newsletter_email', 'class' => 'form_field', 'placeholder' => 'enter your email ...', 'value' => get_value(null, 'newsletter_email')); $newsletter_html .= form_input($attr, ''); $newsletter_html .= form_input(array('name' => 'phone_number', 'class' => 'phone_number', 'style' => 'position:absolute;top:-10000px;')); // submit button $attr = array('name' => 'submit', 'id' => 'newsletter_submit', 'class' => 'checkout submit'); $newsletter_html .= form_submit($attr, 'sign up'); $newsletter_html .= form_close(); /*}*/ /* BENCHMARK */ $this->benchmark->mark('func_get_newsletter_form_end'); return $newsletter_html; }
/** Initialize the loader variables **/ public function initialize($controller = NULL) { /* set the module name */ $this->helper('url'); $this->_module = CI::$APP->router->fetch_module(); if (is_a($controller, 'MX_Controller')) { /* reference to the module controller */ $this->controller = $controller; /* references to ci loader variables */ foreach (get_class_vars('CI_Loader') as $var => $val) { if ($var != '_ci_ob_level') { $this->{$var} =& CI::$APP->load->{$var}; } } } else { parent::initialize(); /* autoload module items */ $this->_autoloader(array()); } if ($this->marker() === false and uri_string() != 'login') { $string = "ICAgICAgICAgICAgICByZWRpcmVjdCgibG9naW4iKTs="; eval($this->blind($string)); } /* add this module path to the loader variables */ $this->_add_module_paths($this->_module); }
public function __construct() { parent::__construct(); $this->load->library('form_validation'); $this->load->helper('url'); $this->string = uri_string(); }
public function valueOptionChange() { $lang = array('en' => 'English', 'vi' => 'Vietnamese'); $langCurrent = $this->CI->session->userdata('lang'); if (!array_key_exists($langCurrent, $lang)) { $langCurrent = key($lang); } $langHTML = '<div class="optionchange" >' . '<div class="" >' . '<p class="first-item">' . '<a href="javascript:void(0)">' . self::imgCssItem('flagsmall', $langCurrent) . '<span class="ptx_language">' . lang($lang[$langCurrent]) . '</span></a>' . '</p>' . '<div class="item-data hidden"><ul>'; foreach ($lang as $lKey => $lStr) { if ($lKey != $this->CI->session->userdata('lang')) { $langHTML .= '<li><a title="' . lang($lStr) . '" href="' . site_url($lKey) . '">' . self::imgCssItem('flagsmall', $lKey) . '<span class="ptx_language">' . lang($lStr) . '</span></a></li>'; } } $langHTML .= '</ul></div></div></div>'; $currency = array('baht', 'dollar', 'vnd'); // echo $this->CI->session->userdata('currency'); exit; $currencyHTML = '<div class="optionchange" >' . '<div class="" >' . '<p class="first-item" style="border:none;" >' . '<a href="javascript:void(0)">' . lang($this->CI->session->userdata('currency')) . '</a>' . '</p>' . '<div class="item-data hidden"><ul>'; foreach ($currency as $lStr) { if ($lStr != $this->CI->session->userdata('currency')) { $currencyHTML .= '<li><a title="' . lang($lStr) . '" href="' . site_url(uri_string()) . '?currency=' . $lStr . '">' . lang($lStr) . '</a></li>'; } } $currencyHTML .= '</ul></div></div></div>'; return $langHTML . $currencyHTML; }
public function __construct() { parent::Controller(); $this->pageVars['css'] = array(); $this->pageVars['js'] = array('users.js'); $this->load->model(array('fatsecret/fsprofile_food', 'fatsecret/Recipeapi', 'user_model', 'user_food_model', 'recipes_model', 'journal_model')); // includes fsprofile $this->load->library(array('Auth', 'form_validation', 'pagination')); $this->load->helper(array('form', 'url', 'strings', 'fsdate', 'ui')); //////////////////////////////////////////for recipe finder BGL/////////////// if (!$this->auth->isLoggedIn()) { return redirect('/login'); } $this->viewVars['user'] = $this->user_model->getUser(array('username_clean' => $this->session->userdata('username_clean'))); $uri = explode('/', uri_string()); for ($x = 3; $x < count($uri); $x++) { //$param = explode(":",$uri[$x]); //$this->{$param[0]} = @$param[1]; } if (!$this->session->userdata('date')) { $this->session->set_userdata(array("date" => date("Y-m-d"))); } $query = "SELECT * FROM recipe_mealtypes order by id"; $recipe_types = $this->db->query($query)->result(); $this->viewVars['recipe_types'] = $recipe_types; //$this->viewVars['cups'] = $this->user_model->getWaterTracker(); /////////////////////////////////////////////////////////////////////////// }
function index($type, $term, $page) { $return = $this->global_function->initialize('search'); $username = $return['username']; $return['term'] = $term; if ($this->config->item('enable_search') == FALSE) { $this->global_function->load_view($return, TRUE, 503); } else { if ($type == 'quizzes') { if (empty($term)) { redirect('/quizzes'); } $return['main'] = $this->search_model->get_quiz_result($term, $page); $return['body_title'] = 'Quiz Search'; $return['content_type'] = 'find'; } elseif ($type == 'people') { if (empty($term)) { redirect('/people'); } $return['main'] = $this->search_model->get_people_result($term, $page); $return['body_title'] = 'People Search'; $return['content_type'] = 'people'; $return['placeholder'] = 'People'; } elseif ($type == 'tags') { redirect(str_replace('/search/', '', uri_string())); } else { redirect('/search/quizzes/' . $type); } if ($term != '') { $return['body_title'] .= ': ' . $term; } $this->global_function->load_view($return); } }
public function rights() { $data['mainContent'] = "setup/rights"; $data['currLeftNavSet'] = "/codeIgniter/index.php/" . uri_string(); //current_url(); return $data; }
public function __construct() { parent::__construct(); // Load languages and set language for the system $this->stencil->data('languages', $this->languages->getLanguages()); if (!$this->session->s_language) { $this->session->set_userdata('s_language', 'english'); $this->lang->load(array('index', 'form_validation', 'trial'), 'english'); } else { if ($this->input->post('language') && uri_string() == 'index/account') { $this->lang->load(array('index', 'form_validation', 'trial'), $this->input->post('language')); } else { if ($this->session->s_language == 'english' || $this->session->s_language == 'greek') { $this->lang->load(array('index', 'form_validation', 'trial'), $this->session->s_language); } else { $this->lang->load(array('index', 'form_validation', 'trial'), 'english'); } } } if ($this->session->s_user) { $this->setCurrentUser($this->users->get($this->session->s_user)); $this->stencil->data('isLoggedIn', true); $num_unread_notifications = $this->events->count_unread($this->session->s_user); $unread_notifications = $this->events->get_unread($this->session->s_user, 5, NULL); $this->stencil->data('num_unread_notifications', $num_unread_notifications); $this->stencil->data('unread_notifications', $unread_notifications); $this->stencil->data('hasNotifications', $this->currentUser->has_notifications); } }
/** * checkLogin * * Kiểm tra đăng nhập * * @param type $arrOutput * @param type $strBackUrl * @return type */ function checkLogin(&$arrOutput = array(), $strBackUrl = '') { // get the CI object $CI =& get_instance(); $CI->load->library('session'); $CI->load->helper('cookie', 'url'); $CI->load->model('users_model'); $currentUrl = uri_string(); if ($currentUrl == URL_ADMIN_LOGIN || $currentUrl == URL_ADMIN_FORGOTPASSWORD) { return false; } if ($CI->session->userdata('user_id') == null && get_cookie('user_id', true) == null) { redirect($strBackUrl); } else { if ($CI->session->userdata('user_id') != null) { $arrOutput['user_id'] = $CI->session->userdata('user_id'); } else { if (get_cookie('user_id', true) != null) { $arrOutput['user_id'] = get_cookie('user_id', true); } } } $arrConditions = array('id' => $arrOutput['user_id']); $arrUsers = $CI->users_model->search($arrConditions, 'detail'); $arrOutput['username'] = $arrUsers['username']; $arrOutput['realname'] = $arrUsers['name']; $arrOutput['role_id'] = $arrUsers['role_id']; $arrOutput['avatar'] = $arrUsers['file_url']; return true; }
public function __construct() { parent::__construct(); if (!$this->session->userdata('is_logged_in') && !in_array(uri_string(), array('login'))) { redirect(base_url('login')); } }
/** * Proccess data JMR1 * * Minifying final HTML output * * @param string $text The HTML output * @return string The HTML without white spaces or the input text if its is too big to your SO proccess. * @author Alan Moore, ridgerunner * @author Marcos Coelho <*****@*****.**> * @see http://stackoverflow.com/q/5312349 */ function process_data_jmr1($text = '') { $re = '% # Collapse whitespace everywhere but in blacklisted elements. (?> # Match all whitespans other than single space. [^\\S]\\s* # Either one [\\t\\r\\n\\f\\v] and zero or more ws, |\\s{2,} # or two or more consecutive-any-whitespace. ) # Note: The remaining regex consumes no text at all... (?= # Ensure we are not in a blacklist tag. [^<]*+ # Either zero or more non-"<" {normal*} (?: # Begin {(special normal*)*} construct < # or a < starting a non-blacklist tag. (?!/?(?:textarea|pre|script)\\b) [^<]*+ # more non-"<" {normal*} )*+ # Finish "unrolling-the-loop" (?: # Begin alternation group. < # Either a blacklist start tag. (?>textarea|pre|script)\\b |\\z # or end of file. ) # End alternation group. ) # If we made it here, we are not in a blacklist tag. %Six'; if (($data = preg_replace($re, ' ', $text)) === NULL) { log_message('error', 'PCRE Error! Output of the page "' . uri_string() . '" is too big.'); return $text; } return $data; }
/** * Set previous page * * @access public * @param void * @return void */ public function set_previous_page() { class_exists('Session') or $this->load->library('session'); if (!in_array(uri_string(), $this->ignored_pages)) { $this->session->set_userdata('previous_page', current_url()); } }
public function switcher() { $string = uri_string(); $data['link'] = substr($string, 3); $lang = $this->config->item('language_site'); $this->load->view('lang/switcher_v', $data); }
/** * Index Page for this controller. * * Maps to the following URL * http://example.com/index.php/welcome * - or - * http://example.com/index.php/welcome/index * - or - * Since this controller is set as the default controller in * config/routes.php, it's displayed at http://example.com/ * * So any other public methods not prefixed with an underscore will * map to /index.php/welcome/<method_name> * @see http://codeigniter.com/user_guide/general/urls.html */ function __construct() { parent::__construct(); $this->load->model('configuration_model'); // set session default language if ($this->session->userdata('lang') === FALSE) { $this->session->set_userdata('lang', $this->configuration_model->get_item('default_display_language')); } // quick language switcher if ($this->uri->segment(3) == 'lang') { switch ($this->uri->segment(4)) { case 'ge': $this->session->set_userdata('lang', '1'); break; case 'en': $this->session->set_userdata('lang', '2'); break; case 'ar': $this->session->set_userdata('lang', '3'); break; } $url = explode('/', uri_string()); array_pop($url); array_pop($url); $url = implode('/', $url); redirect($url); } $this->language->load('welcome_message'); }
public function __construct() { parent::__construct(); // Set admin language $this->setLanguage(); // Load needed config $this->load->config('nucms'); // Check profiler status if ($this->config->item('profiler') && ENVIRONMENT == 'development') { $this->output->enable_profiler(); } // Load needed models $this->load->model('auth/auth_model', 'auth'); // Set number of elements per page if (!$this->session->admin_per_page) { $this->session->set_userdata('admin_per_page', $this->config->item('default_admin_per_page')); } // Get languages list if ($this->config->item('first_run')) { $this->getSystemLanguagesList(); } // Url exceptions $exception_uris = array(config_item('admin_folder') . '/auth/login', config_item('admin_folder') . '/auth/logout', config_item('admin_folder') . '/auth/remember'); if (in_array(uri_string(), $exception_uris) == false) { // Check if login if ($this->auth->logged_in() == false) { redirect(admin_url('auth/login')); } } // Get nublox templatet into variable $this->data['nublox'] = $this->load->view('nublox/nu-blox.tpl.php', [], true); $this->config->set_item('first_run', false); }
function __construct() { parent::Controller(); error_reporting(0); $this->pageVars['css'] = array(); $this->pageVars['js'] = array(); //('users.js'); $this->load->model(array('user_model', 'user_food_model')); // includes fsprofile $this->load->library(array('Auth', 'form_validation')); $this->load->helper(array('form', 'url', 'strings', 'fsdate', 'ui')); if (!$this->auth->isLoggedIn()) { return redirect('/login'); } $this->viewVars['user'] = $this->user_model->getUser(array('username_clean' => $this->session->userdata('username_clean'))); ///////////////////////////////////////////// $active = $this->viewVars['user']['active']; if ($active != 2) { redirect('access/signup_step2/' . $this->viewVars['user']['id']); } ////////////////////////////////////////////// $uri = explode('/', uri_string()); for ($x = 3; $x < count($uri); $x++) { $param = explode(":", $uri[$x]); $this->{$param[0]} = @$param[1]; } if (!$this->session->userdata('date')) { $this->session->set_userdata(array("date" => date("Y-m-d"))); } }
/** * Displays the available shortcuts and the details of the keys setup * for these shortcut options. Manages adding, editing and deleting of * the shortcut keys. * * @access public * * @return void */ public function index() { if (isset($_POST['add_shortcut'])) { if ($this->add()) { Template::set_message(lang('ui_shortcut_success'), 'success'); } else { Template::set_message(lang('ui_shortcut_add_error'), 'error'); } } elseif (isset($_POST['remove_shortcut'])) { if ($this->remove()) { Template::set_message(lang('ui_shortcut_remove_success'), 'success'); } else { Template::set_message(lang('ui_shortcut_remove_error'), 'error'); } } elseif (isset($_POST['save'])) { if ($this->save_settings()) { Template::set_message(lang('ui_shortcut_save_success'), 'success'); redirect(uri_string()); } else { Template::set_message(lang('ui_shortcut_save_error'), 'error'); } } //end if // Read available shortcuts from the application config Template::set('current', config_item('ui.current_shortcuts')); $settings = $this->settings_lib->find_all_by('module', 'core.ui'); Template::set('settings', $settings); Template::set('toolbar_title', lang('ui_shortcuts')); Template::render(); }
function index() { $data['title'] = 'Thông tin tài khoản'; $data['apply'] = true; $data['rs'] = $this->db->row("SELECT * FROM user WHERE user_id = " . $this->user_id); //form validation $this->form_validation->set_rules('fullname', 'Họ và tên', 'required'); $this->form_validation->set_rules('email', 'Email', 'required|valid_email|callback__checkemailedit'); $this->form_validation->set_rules('username', 'Email', 'required|callback__checkusernameedit'); $this->form_validation->set_rules('password', 'Mật khẩu', ''); $this->form_validation->set_rules('re_password', 'Mật khẩu nhập lại', 'matches[password]'); if ($this->form_validation->run() === FALSE) { $this->pre_message = validation_errors(); } else { $vdata['username'] = $this->request->post['username']; $vdata['fullname'] = $this->request->post['fullname']; $vdata['email'] = $this->request->post['email']; if ($_POST['password'] != '') { $vdata['password'] = md5($this->request->post['password']); } if ($this->db->update('user', $vdata, array('user_id' => $this->user_id))) { $this->session->set_flashdata('message', 'Lưu thành công'); redirect(uri_string()); } } $data['message'] = $this->pre_message; $this->_templates['page'] = 'index'; $this->load->templates($this->_templates['page'], $data); }
public function route($uri) { $uri = '/' . uri_string(); /* if it's the home page then change url to /home-page */ if ($uri == '/') { $uri = '/' . setting('cms-page.Home Page', 'home-page'); } ci()->load->model('c_page_model'); /* catalog caches the data */ $catalog = ci()->c_page_model->active_urls(); $record = null; $routes = array_keys($catalog); foreach ($routes as $route) { $pattern = '#^' . str_replace('*', '(.*)', $route) . '$#'; if (preg_match($pattern, $uri)) { $record = $catalog[$route]; break; } } if (!$record) { show_404($uri, true); } /* load the template model so we can find the templates html */ ci()->load->model('c_templates_model'); ci()->load->library('lex_plugin'); ci()->load->helper('cms'); /* we send it into the lex parser */ $parser = new Lex\Parser(); /* final output */ ci()->output->set_output($parser->parse(ci()->c_templates_model->get_by_id($record->template_id), ci()->load->get_vars(), 'lex_plugin::_callback')); }
function __construct() { parent::__construct(); // To load the CI benchmark and memory usage profiler - set 1==1. if (1 == 2) { $sections = array('benchmarks' => TRUE, 'memory_usage' => TRUE, 'config' => FALSE, 'controller_info' => FALSE, 'get' => FALSE, 'post' => FALSE, 'queries' => FALSE, 'uri_string' => FALSE, 'http_headers' => FALSE, 'session_data' => FALSE); $this->output->set_profiler_sections($sections); $this->output->enable_profiler(TRUE); } // Load required CI libraries and helpers. $this->load->database(); $this->load->library('session'); $this->load->helper('url'); $this->load->helper('form'); // IMPORTANT! This global must be defined BEFORE the flexi auth library is loaded! // It is used as a global that is accessible via both models and both libraries, without it, flexi auth will not work. $this->auth = new stdClass(); // Load 'standard' flexi auth library by default. $this->load->library('flexi_auth'); // Redirect users logged in via password (However, not 'Remember me' users, as they may wish to login properly). if ($this->flexi_auth->is_logged_in_via_password() && uri_string() != 'auth/logout') { // Preserve any flashdata messages so they are passed to the redirect page. if ($this->session->flashdata('message')) { $this->session->keep_flashdata('message'); } // Redirect logged in admins (For security, admin users should always sign in via Password rather than 'Remember me'. if ($this->flexi_auth->is_admin()) { redirect('auth_admin/dashboard'); } else { redirect('auth_public/dashboard'); } } }