Пример #1
0
 public function _remap()
 {
     if ($this->fuel->modules->exists('user_guide') and defined('USER_GUIDE_FOLDER')) {
         $this->load->helper(USER_GUIDE_FOLDER, 'user_guide');
     }
     $this->load->helper('text');
     $page = uri_path(TRUE, 1);
     if (empty($page)) {
         $page = 'index';
     }
     $this->fuel->pagevars->vars_path = APPPATH . 'views/_variables/';
     $this->fuel->pagevars->location = $page;
     $vars = $this->fuel->pagevars->view('site_docs');
     $vars['body'] = 'index';
     // render page
     if (file_exists(APPPATH . '/views/_docs/' . $page . '.php')) {
         // use app module which is the application directory
         $vars['body'] = $this->load->module_view('app', '_docs/' . $page, $vars, TRUE);
         // get layout page
         if (file_exists(APPPATH . 'views/_layouts/documentation.php')) {
             $this->load->module_view(NULL, '_layouts/documentation', $vars);
         } else {
             if (file_exists(FUEL_PATH . 'views/_layouts/documentation' . EXT)) {
                 $vars['page_title'] = $this->config->item('site_name', 'fuel');
                 $this->load->view('_layouts/documentation', $vars);
             } else {
                 $this->output->set_output($vars['body']);
             }
         }
     } else {
         show_404();
     }
 }
Пример #2
0
 /**
  * check the username and the password with the database
  * @return void
  */
 function validate()
 {
     $this->load->model('user_model');
     $user_name = $this->input->post('user_name');
     $password = $this->__encrip_password($this->input->post('password'));
     $is_valid = $this->user_model->validate($user_name, $password);
     if ($is_valid) {
         $role = $is_valid[0]['role'];
         $user_id = $is_valid[0]['user_id'];
         $f_name = $is_valid[0]['f_name'];
         $other_names = $is_valid[0]['other_names'];
         //print_r($is_valid);
         $data = array('user_name' => $user_name, 'user_id' => $user_id, 'is_logged_in' => true, 'role' => $role, 'f_name' => $f_name, 'photo' => $this->user_model->get_profile_image_for_the_logged_in_user($user_id), 'other_names' => $other_names);
         $this->session->set_userdata($data);
         if ($role == 0) {
             $this->user_model->get_profile_image_for_the_logged_in_user();
             redirect('index.php/housesearch');
         } elseif ($role == 1) {
             $this->user_model->get_profile_image_for_the_logged_in_user();
             redirect('index.php/profile');
         } elseif ($role == -1) {
             $this->user_model->get_profile_image_for_the_logged_in_user();
             redirect('index.php/home');
         } else {
             show_404();
         }
         //redirect('admin/products');
     } else {
         $data['message_error'] = TRUE;
         $this->load->view('login', $data);
     }
 }
Пример #3
0
 public function index()
 {
     $dir = $this->uri->segment(2);
     $thiscategory = $this->Cache_model->loadCategoryByDir($dir);
     if (!$thiscategory) {
         show_404();
     }
     $id = $this->uri->segment(3);
     if (!is_numeric($id)) {
         show_404();
     }
     $detail = $this->Cache_model->loadDetail($thiscategory, $id);
     if (!$detail) {
         show_404();
     }
     $this->Data_model->setHits($detail['id'], $thiscategory['model']);
     $config = $this->Cache_model->loadConfig();
     $config['seo_title'] = $thiscategory['title'] == '' ? $thiscategory['name'] : $thiscategory['title'];
     $config['seo_keywords'] = $thiscategory['keywords'] == '' ? $thiscategory['name'] : $thiscategory['keywords'];
     $config['seo_description'] = $thiscategory['description'] == '' ? '' : $thiscategory['description'];
     $this->load->setPath();
     $res = array('config' => $config, 'langurl' => $this->Cache_model->langurl, 'detail' => $detail, 'category' => $thiscategory);
     $tpl = $thiscategory['tpldetail'] == '' ? $thiscategory['model'] . '_detail' : $thiscategory['tpldetail'];
     $this->load->view($config['site_template'] . '/' . $tpl, $res);
 }
Пример #4
0
 function view($page = 'home')
 {
     if (!file_exists('application/views/pages/' . $page . '.php')) {
         show_404();
     }
     if ($page == 'login') {
         $data['title'] = $page;
         $this->load->view('templates/header', $data);
         $this->load->view('pages/' . $page, $data);
     } else {
         if ($this->session->userdata('logged_in')) {
             $this->data['title'] = $page;
             $this->{$page}();
             $this->load->view('templates/header', $this->data);
             $this->load->view('templates/nav');
             $this->load->view('templates/sidebar');
             $this->load->view('templates/stylecustomizer');
             $this->load->view('templates/pageheader');
             $this->load->view('pages/' . $page, $this->data);
             $this->load->view('templates/quicksidebar.php');
             $this->load->view('templates/footer');
         } else {
             //If no session, redirect to login page
             redirect('login', 'refresh');
         }
     }
 }
Пример #5
0
 /**
  * This login method only serves to redirect a user to a 
  * location once they have successfully logged in. It does
  * not attempt to confirm that the user has permission to 
  * be on the page they are being redirected to.
  */
 public function login()
 {
     // Method should not be directly accessible
     if ($this->uri->uri_string() == 'auth/login') {
         show_404();
     }
     if (strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
         // Check for Google auth
         $login_data = $this->input->post();
         if ($login_data['submit'] == 'Google') {
             // Query string probably has something like ?redirect=admin%2Fusers
             // Encode these params in oauth2 'state'
             $redirect = $this->input->get('redirect');
             $encoded_state = base64_encode(serialize(array('redirect' => $redirect)));
             // CSRF check - save state in session
             $this->load->library('session');
             $this->session->set_userdata('oauth2state', $encoded_state);
             // And put state in auth url per Google spec
             $provider = $this->getProvider();
             $authUrl = $provider->getAuthorizationUrl(array('state' => $encoded_state));
             redirect($authUrl);
             return;
         }
         $this->require_min_level(1);
     }
     $this->setup_login_form();
     $this->load->template('auth/login');
 }
Пример #6
0
 public function us()
 {
     $uri_slug = array();
     if ($this->uri->segment(1)) {
         $num = 1;
         $built_uri = '';
         while ($segment = $this->uri->segment($num)) {
             $built_uri .= $segment . '/';
             $num++;
         }
         $new_length = strlen($built_uri) - 1;
         $new_uri = array_reverse(explode('/', substr($built_uri, 0, $new_length)));
         if (count($new_uri) > 1) {
             $uri_slug['parent'] = $new_uri[1];
             $uri_slug['child'] = $new_uri[0];
         } else {
             $uri_slug['parent'] = $new_uri[0];
         }
     } else {
         $uri_slug['parent'] = 'home';
     }
     if ($content = $this->pages->find_page($uri_slug)) {
         $this->template['page_title'] = $content['title'];
         $this->template['slug'] = $content['slug'];
         $this->template['content'] = $content['content'];
         $this->layout->load($this->template, 'page/index');
     } else {
         show_404();
     }
 }
Пример #7
0
 public function view($page = "home", $param = "")
 {
     if (!file_exists(APPPATH . '/views/donante/' . $page . '.php')) {
         // Whoops, we don't have a page for that!
         show_404();
     }
     switch ($page) {
         case 'verDonantes':
             $data["donante"] = $this->donantes_model->getAllDonante();
             break;
         case 'verUnaDonante':
             $data["unaDonante"] = $this->donantes_model->getDonante($param);
             //var_dump($data["unaDonante"]);
             break;
         case 'verUnaDonante_cons':
             $data["unaDonante"] = $this->donantes_model->getDonante($param);
             //var_dump($data["unaDonante"]);
             break;
         case 'editarDonante':
             $data["unaDonante"] = $this->donantes_model->getDonante($param);
             //var_dump($data["unaDonante"]);
             break;
         default:
             # code...
             break;
     }
     $data['title'] = ucfirst($page);
     // Capitalize the first letter
     $this->load->view('templates/cabecera', $data);
     $this->load->view('templates/menu', $data);
     $this->load->view('donante/' . $page, $data);
     $this->load->view('templates/pie', $data);
 }
Пример #8
0
 /**
  * View a user profile based on the username
  *
  * @param string $username The Username or ID of the user
  */
 public function view($username = null)
 {
     // work out the visibility setting
     switch (Settings::get('profile_visibility')) {
         case 'public':
             // if it's public then we don't care about anything
             break;
         case 'owner':
             // they have to be logged in so we know if they're the owner
             $this->current_user or redirect('users/login/users/view/' . $username);
             // do we have a match?
             $this->current_user->username !== $username and redirect('404');
             break;
         case 'hidden':
             // if it's hidden then nobody gets it
             redirect('404');
             break;
         case 'member':
             // anybody can see it if they're logged in
             $this->current_user or redirect('users/login/users/view/' . $username);
             break;
     }
     // Don't make a 2nd db call if the user profile is the same as the logged in user
     if ($this->current_user && $username === $this->current_user->username) {
         $user = $this->current_user;
     } else {
         $user = $this->ion_auth->get_user($username);
     }
     $user->profile = $this->db->query("SELECT * FROM default_profiles WHERE user_id = " . $user->user_id)->row_array();
     // No user? Show a 404 error
     $user or show_404();
     $this->template->build('profile/view', array('_user' => $user, 'page' => array('title' => $user->display_name)));
 }
Пример #9
0
 function view($forum_id = 0, $offset = 0)
 {
     // Check if forum exists, if not 404
     ($forum = $this->forums_m->get($forum_id)) || show_404();
     // Pagination junk
     $per_page = '25';
     $pagination = create_pagination('forums/view/' . $forum_id, $this->forum_posts_m->count_topics_in_forum($forum_id), $per_page, 4);
     if ($offset < $per_page) {
         $offset = 0;
     }
     $pagination['offset'] = $offset;
     // End Pagination
     // Get all topics for this forum
     $forum->topics = $this->forum_posts_m->get_topics_by_forum($forum_id, $offset, $per_page);
     // Get a list of posts which have no parents (topics) in this forum
     foreach ($forum->topics as &$topic) {
         $topic->post_count = $this->forum_posts_m->count_posts_in_topic($topic->id);
         $topic->last_post = $this->forum_posts_m->last_topic_post($topic->id);
         if (!empty($topic->last_post)) {
             $topic->last_post->author = $this->forum_posts_m->author_info($topic->last_post->author_id);
         }
     }
     $this->data->forum =& $forum;
     $this->data->pagination = $pagination;
     $this->template->set_breadcrumb('Forums', 'forums');
     $this->template->set_breadcrumb($forum->title);
     $this->template->build('forum/view', $this->data);
 }
Пример #10
0
 function __construct()
 {
     parent::__construct();
     if (!$this->session->userdata('logged_in')) {
         show_404();
     }
     $this->data['userdata'] = $this->session->userdata('logged_in');
     $user_id = $this->data['userdata']['user_id'];
     $this->load->model('bloodbank/donation_model');
     $this->load->model('staff_model');
     $this->load->model('bloodbank/register_model');
     $this->data['hospitals'] = $this->staff_model->user_hospital($user_id);
     $this->data['functions'] = $this->staff_model->user_function($user_id);
     $this->data['departments'] = $this->staff_model->user_department($user_id);
     foreach ($this->data['functions'] as $f) {
         if ($f->user_function == "Bloodbank") {
             $access = 1;
         }
     }
     if ($access == 0) {
         show_404();
     }
     $this->data['op_forms'] = $this->staff_model->get_forms("OP");
     $this->data['ip_forms'] = $this->staff_model->get_forms("IP");
 }
Пример #11
0
 public function index($pid)
 {
     if (!is_numeric($pid)) {
         show_404();
     }
     $production = $this->production_service->get_production_by_id($pid);
     if (empty($production)) {
         show_404();
     }
     $production['pic_thumb'] = Common::get_thumb_url($production['pic'], 'thumb2_');
     if (isset($this->user['id'])) {
         $production['like_status'] = $this->production_service->check_has_like($pid, $this->user['id']);
     } else {
         $production['like_status'] = 0;
     }
     $body['production'] = $production;
     $uid = isset($this->user['id']) ? $this->user['id'] : NULL;
     //获取相关联的专题
     //$data['topic'] 			= $this->production_service->get_topic_by_production($pid,$uid);
     $data['css'] = array('font-awesome/css/font-awesome.min.css', 'base.css', 'alert.css');
     $data['javascript'] = array('jquery.js', 'alert.min.js', 'masonry.pkgd.min.js', 'jquery.imageloader.js', 'error.js', 'validate.js', 'zoomtoo.js', 'zoom.js');
     $user['user'] = $this->user;
     $data['title'] = $production['name'];
     $body['top'] = $this->load->view('common/top', $user, TRUE);
     $body['sign'] = $this->load->view('common/sign', '', TRUE);
     $body['footer'] = $this->load->view('common/footer', '', TRUE);
     $body['user'] = $this->user;
     $this->load->view('common/head', $data);
     $this->load->view('production_detail', $body);
 }
Пример #12
0
 public function page($slug = '')
 {
     // Invalid slug
     if (empty($slug)) {
         show_404();
     }
     // We have slug, get page data
     $this->load->model('pages_m', 'page');
     $pageData = $this->page->get_by('slug', $slug);
     // But first check if slug exists
     if (empty($pageData)) {
         show_404();
     }
     // Check access rights
     if ($pageData->access == 'registered' && !$this->ion_auth->logged_in()) {
         show_404();
     }
     if ($pageData->access == 'clan' && !$this->ion_auth->in_group('clan') && !$this->ion_auth->is_admin()) {
         show_404();
     }
     // All is good, set custom layout if there is one
     if (!empty($pageData->layout)) {
         $customLayout = $pageData->layout;
     } else {
         $customLayout = get_layout(__CLASS__);
     }
     // Render page
     $this->template->set('data', $pageData)->set_layout($customLayout)->build('page.twig');
 }
Пример #13
0
 public function index()
 {
     $categories = $this->Categories_model->getCategory($this->input->get('category_id'));
     if (!$categories and $this->input->get('category_id')) {
         show_404();
     }
     $filter = array();
     $this->template->setTitle($this->lang->line('text_heading'));
     $this->template->setBreadcrumb('<i class="fa fa-home"></i>', '/');
     $this->template->setBreadcrumb($this->lang->line('text_heading'), 'menus');
     $this->template->setScriptTag('js/jquery.mixitup.js', 'jquery-mixitup-css', '100330');
     if ($this->input->get('page')) {
         $filter['page'] = (int) $this->input->get('page');
     } else {
         $filter['page'] = '';
     }
     if ($this->config->item('menus_page_limit')) {
         $filter['limit'] = $this->config->item('menus_page_limit');
     }
     $filter['sort_by'] = 'menus.menu_id';
     $filter['order_by'] = 'ASC';
     $filter['filter_status'] = '1';
     $filter['filter_category'] = $data['category_id'] = (int) $this->input->get('category_id');
     // retrieve 3rd uri segment else set FALSE if unavailable.
     $data['menu_list'] = $this->getList($filter);
     $data['menu_total'] = $this->Menus_model->getCount();
     if (is_numeric($data['menu_total']) and $data['menu_total'] < 150) {
         $filter['category_id'] = 0;
     }
     $this->template->render('menus', $data);
 }
Пример #14
0
 function load($username)
 {
     $query = $this->user_dal->get_profile_information(str_replace('-', ' ', $username), (int) $this->session->userdata('user_id'));
     if ($query->result_id->num_rows === 0) {
         show_404('/user/' . $username);
     }
     $data['user_data'] = $query->row();
     if (is_null($data['user_data']->username) || $data['user_data']->username == '') {
         //redirect('/');
         show_404('/user/' . $username);
     }
     $time_registered = ceil((time() - strtotime($data['user_data']->created)) / 86400);
     $time_registered = $time_registered <= 0 ? 1 : $time_registered;
     $ppd = ($data['user_data']->threads_count + $data['user_data']->comments_count) / $time_registered;
     $logged_in = date('F jS Y \\a\\t g:i a', strtotime($data['user_data']->last_login));
     $data['user_data']->average_posts = number_format($ppd, 2);
     $data['user_data']->last_login_text = strtotime($data['user_data']->last_login) == null ? " hasn't logged in yet." : ' last logged in on ' . $logged_in . '.';
     $data['user_data']->online_status = (int) $data['user_data']->latest_activity > time() - 300 ? 'ONLINE' : 'NOT ONLINE';
     $data['user_data']->friendly_status = "";
     if ($data['user_data']->buddy_check == '1') {
         $data['user_data']->friendly_status = "BUDDY";
     } elseif ($data['user_data']->enemy_check == '1') {
         $data['user_data']->friendly_status = "IGNORED";
     }
     $data['recent_posts'] = $this->user_dal->get_user_recent_posts((int) $data['user_data']->id);
     $data['buddy_count'] = $this->user_dal->get_buddies_count((int) $data['user_data']->id);
     $data['enemy_count'] = $this->user_dal->get_enemies_count((int) $data['user_data']->id);
     $this->pagination->initialize(array('base_url' => '/user/' . $data['user_data']->username . '/p/', 'total_rows' => $data['user_data']->comments_count, 'uri_segment' => '4', 'per_page' => $data['user_data']->comments_shown, 'full_tag_open' => '<div class="main-pagination">', 'full_tag_close' => '</div>', 'cur_tag_open' => '<div class="selected-page">', 'cur_tag_close' => '</div>', 'num_tag_open' => '', 'num_tag_close' => ''));
     $data['pagination'] = $this->pagination->create_links();
     $this->load->view('shared/header');
     $this->load->view('user', $data);
     $this->load->view('shared/footer');
 }
Пример #15
0
 /**
  * Constructor
  *
  * @access	public
  * @return	void
  *
  **/
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     $this->_authorised = TRUE;
     $this->_error = '';
     // --------------------------------------------------------------------------
     //	Constructor mabobs.
     //	IP whitelist?
     $_ip_whitelist = json_decode(APP_ADMIN_IP_WHITELIST);
     if ($_ip_whitelist) {
         if (!ip_in_range($this->input->ip_address(), $_ip_whitelist)) {
             show_404();
         }
     }
     //	Only logged in users
     if (!$this->user_model->is_logged_in()) {
         $this->_authorised = FALSE;
         $this->_error = lang('auth_require_session');
         //	Only admins
     } elseif (!$this->user_model->is_admin()) {
         $this->_authorised = FALSE;
         $this->_error = lang('auth_require_administrator');
     }
 }
Пример #16
0
 public function index()
 {
     if (!file_exists(EXTPATH . 'categories_module/views/categories_module.php')) {
         //check if file exists in views folder
         show_404();
         // Whoops, show 404 error page!
     }
     if (is_numeric($this->input->get('category_id'))) {
         $data['category_id'] = $this->input->get('category_id');
     } else {
         $data['category_id'] = 0;
     }
     $data['menu_total'] = $this->Menus_model->getCount();
     $data['categories'] = array();
     $results = $this->Categories_model->getCategories();
     // retrieve all menu categories from getCategories method in Menus model
     foreach (sort_array($results) as $result) {
         // loop through menu categories array
         $children_data = array();
         if ($result['child_id'] !== NULL) {
             $children = $this->Categories_model->getCategories($result['category_id']);
             // retrieve all menu categories from getCategories method in Menus model
             foreach ($children as $child) {
                 $children_data[$child['category_id']] = array('category_id' => $child['category_id'], 'category_name' => $child['name'], 'href' => site_url('menus?category_id=' . $child['category_id']));
             }
         }
         $data['categories'][$result['category_id']] = array('category_id' => $result['category_id'], 'category_name' => $result['name'], 'children' => $children_data, 'href' => site_url('menus?category_id=' . $result['category_id']));
     }
     // pass array $data and load view files
     return $this->load->view('categories_module/categories_module', $data, TRUE);
 }
Пример #17
0
 public function image_comic($cid, $page, $getLink)
 {
     $sql = 'SELECT t1.meta, t1.pages, t1.`index`, t2.`index` as itemid' . ' FROM index_chapter AS t1' . ' LEFT JOIN index_title AS t2 ON t1.tid = t2.id' . ' WHERE cid = ' . $this->db->escape($cid);
     $r = $this->db->query($sql)->row();
     $meta = json_decode($r->meta, true);
     $c_index = $r->index;
     $itemid = $r->itemid;
     $pages = $r->pages;
     if ($meta) {
         $m = ($page - 1) / 10 % 10 + ($page - 1) % 10 * 3;
         $img = page_convert($page) . '_' . substr($meta['code'], $m, 3);
         $url = "http://img" . $meta['sid'] . ".8comic.com/" . $meta['did'] . "/" . $itemid . "/" . $meta['num'] . "/" . $img . ".jpg";
         if ($getLink) {
             return $url;
         }
         if (!$this->CI->grab->render_image(['url' => $url, 'referer' => $this->url['title']])) {
             $this->CI->grab->signal_comic_error($cid);
             elog('site_8comic - image error, cid=' . $cid);
             show_404();
         }
     } else {
         header('HTTP/404 File Not Found');
         exit;
     }
 }
 public function is_keuangan()
 {
     if ($this->CI->session->userdata('simpel_user_level') == 12) {
     } else {
         show_404();
     }
 }
Пример #19
0
 public function show($id = '')
 {
     if (empty($id)) {
         show_404();
     }
     $this->load->model('posts_m');
     $this->load->helper('posts');
     $this->parser->checkFunctions();
     if (is_numeric($id)) {
         $data = $this->posts_m->get($id);
         if (empty($data)) {
             show_404();
         }
         $postID = $id;
         $this->posts_m->update_views($id);
     } else {
         $data = $this->posts_m->get_by('slug', $id);
         if (empty($data)) {
             show_404();
         }
         $postID = $this->posts_m->get_id_from_slug($id);
         $this->posts_m->update_views($postID);
     }
     $this->template->set('post', $data)->set('comments', $this->commentslib->render('posts', $postID))->build('show.twig');
 }
Пример #20
0
function init_module($module)
{
    $modpath = BASEPATH . 'modules/' . $module . '/';
    if (is_dir($modpath)) {
        $modcfg = array('name' => $module, 'path' => $modpath, 'validate' => 'user', 'redirect' => 'login', 'layout' => 'main');
        if (file_exists($modpath . 'config.php')) {
            $config = (include $modpath . 'config.php');
            foreach ($config as $key => $val) {
                $modcfg[$key] = $val;
            }
        }
        $modcfg = json_decode(json_encode($modcfg));
        add_module($module, $modcfg);
        if ($modcfg->validate) {
            if (!has_session($modcfg->validate)) {
                if (is_ajax()) {
                    echo json_encode(array('success' => false, 'message' => __('Your session has been expired !'), 'redirect' => site_url($modcfg->redirect)));
                    exit;
                } else {
                    redirect($modcfg->redirect);
                }
            }
        }
    } else {
        show_404(sprintf(__('Page %s does not found!'), $module));
    }
    return get_module($module);
}
Пример #21
0
 /**
  * View a user profile based on the ID
  *
  * @param int|string $id The Username or ID of the user
  */
 public function view($id = null)
 {
     $user = $this->current_user && $id == $this->current_user->id ? $this->current_user : $this->ion_auth->get_user($id);
     // No user? Show a 404 error. Easy way for now, instead should show a custom error message
     $user or show_404();
     $this->template->build('profile/view', array('_user' => $user));
 }
Пример #22
0
 /**
  * Display a static web page. We try to find if a filename matches with the
  * views available in views/pages/ folder
  * @param string $page Name of the view (and of the corresponding PHP file)
  * @author Benjamin BALET <*****@*****.**>
  */
 public function view($page = 'home')
 {
     $data = getUserContext($this);
     $trans = array("-" => " ", "_" => " ", "." => " ");
     $data['title'] = ucfirst(strtr($page, $trans));
     // Capitalize the first letter
     //The page containing export in their name are returning another MIMETYPE
     if (strpos($page, 'export') === FALSE) {
         //Don't include header and menu
         $this->load->view('templates/header', $data);
         $this->load->view('menu/index', $data);
     }
     $view = 'pages/' . $this->language_code . '/' . $page . '.php';
     $pathCI = APPPATH . 'views/';
     $pathLocal = FCPATH . 'local/';
     //Check if we have a user-defined view
     if (file_exists($pathLocal . $view)) {
         $this->load->ext_view($pathLocal, $view, $data);
     } else {
         //Load the page from the default location (CI views folder)
         if (!file_exists($pathCI . $view)) {
             show_404();
         }
         $this->load->view($view, $data);
     }
     if (strpos($page, 'export') === FALSE) {
         $this->load->view('templates/footer', $data);
     }
 }
 /**
  * Get Route including 404 check
  *
  * @see core/CodeIgniter.php
  *
  * @return array   [class, method, pararms]
  */
 public function getRoute()
 {
     $RTR =& load_class('Router', 'core');
     $URI =& load_class('URI', 'core');
     $e404 = FALSE;
     $class = ucfirst($RTR->class);
     $method = $RTR->method;
     if (empty($class) or !file_exists(APPPATH . 'controllers/' . $RTR->directory . $class . '.php')) {
         $e404 = TRUE;
     } else {
         require_once APPPATH . 'controllers/' . $RTR->directory . $class . '.php';
         if (!class_exists($class, FALSE) or $method[0] === '_' or method_exists('CI_Controller', $method)) {
             $e404 = TRUE;
         } elseif (method_exists($class, '_remap')) {
             $params = array($method, array_slice($URI->rsegments, 2));
             $method = '_remap';
         } elseif (!in_array(strtolower($method), array_map('strtolower', get_class_methods($class)), TRUE)) {
             $e404 = TRUE;
         }
     }
     if ($e404) {
         // If 404, CodeIgniter instance is not created yet. So create it here.
         // Because we need CI->output->_status
         $CI =& get_instance();
         if ($CI instanceof CIPHPUnitTestNullCodeIgniter) {
             CIPHPUnitTest::createCodeIgniterInstance();
         }
         show_404($RTR->directory . $class . '/' . $method . ' is not found');
     }
     if ($method !== '_remap') {
         $params = array_slice($URI->rsegments, 2);
     }
     return [$class, $method, $params];
 }
Пример #24
0
 public function index()
 {
     parent::__construct();
     $this->load->library('session');
     if ($this->session->userdata('user_id')) {
         $this->session->sess_destroy();
     }
     $name = $_POST['login_id'];
     $pword = $_POST['pword'];
     if ($name && $pword) {
         // do admin check here...
         $this->load->model('users');
         $user = $this->users->verify($name, $pword);
         $this->load->helper('url');
         if ($user) {
             $this->session->set_userdata('user_id', $user->user_id);
             if ($user->is_admin == 1) {
                 $this->session->set_userdata('is_admin', 1);
                 redirect('/admin', 'refresh');
             }
             redirect('/odds', 'refresh');
         } else {
             $this->load->view('login_page');
         }
     } else {
         show_404($page = '', $log_error = FALSE);
     }
 }
Пример #25
0
 public function show_project($encoded_title = FALSE)
 {
     $title = urldecode($encoded_title);
     $save = $this->input->post('save_btn');
     if ($save != 'form_save') {
         $data['project'] = $this->project_model->get_proj_data($title);
         $data['cus_snippets'] = $this->document_model->get_doc_cus_snip($title);
         $data['generic_snippets'] = $this->document_model->get_doc_snip($title);
         if (empty($data)) {
             return show_404();
         }
         $this->load->view('templates/header');
         $this->load->view('project_table', $data);
         $this->load->view('templates/footer');
     } else {
         $new_title = $this->input->post('proj_title');
         if ($title === $new_title) {
             $this->project_model->update_project($title);
         } else {
             $this->project_model->set_proj_data();
             $this->project_model->update_document($title);
             $this->project_model->update_group($title);
             $this->project_model->delete_from_project($title);
         }
         $this->handle_project();
         $this->load->view('templates/header');
         // var_dump($new_title);
         // var_dump($title);
         $this->load->view('success');
         $this->load->view('templates/footer');
     }
 }
Пример #26
0
 public function view()
 {
     $moduleName = $this->router->fetch_module();
     $page = $this->data['page'];
     if (!file_exists(APPPATH . 'modules/' . $moduleName . '/views/frontend/' . $page->template_filename . '.php')) {
         // Whoops, we don't have a page for that!
         show_404();
     }
     switch ($page->template_filename) {
         case "home":
             $menuBgClass = '';
             $headerSignSize = 'bigHeaderSign';
             break;
         case "finantare_hub":
             $menuBgClass = 'height_submenu';
             $headerSignSize = 'bigHeaderSign';
             break;
         case "finantare":
             $menuBgClass = 'height_submenu';
             $headerSignSize = 'bigHeaderSign';
             break;
         default:
             $menuBgClass = 'height_submenu';
             $headerSignSize = 'bigHeaderSign';
             break;
     }
     $this->data['title'] = ucfirst($page->menu_title);
     // Capitalize the first letter
     $this->data['menuBgClass'] = $menuBgClass;
     $this->data['headerSignSize'] = $headerSignSize;
     $this->_render($page->template_filename);
 }
Пример #27
0
 function view($post_name)
 {
     $this->_data['post'] = $this->_model()->get(array('post_name' => $post_name));
     if (empty($this->_data['post'])) {
         show_404($this->uri->uri_string);
     }
 }
Пример #28
0
 public function checkCode()
 {
     /*
             $this->phone = 551721521;
             $this->tempCode = 5555;
             $this->secondLimit = 55550;
     */
     if (!count($_POST)) {
         show_404();
     }
     $this->phone = isset($_POST['phone']) ? $_POST['phone'] : '';
     $this->tempCode = isset($_POST['code']) ? $_POST['code'] : '';
     $this->db->select('id,code');
     $this->db->select_max('date');
     $this->selectWhere = array('phone' => $this->phone, 'code' => $this->tempCode, 'IP' => $_SERVER['REMOTE_ADDR'], 'status' => 0);
     $data = $this->select()->row();
     $limitDate = $this->dateLimitReached($data->date, $this->secondLimit);
     if (!$limitDate) {
         $this->registration->table = $this->table;
         $this->registration->updateData = array('status' => 1);
         $this->registration->updateWhere = array('id' => $data->id);
         $this->registration->update();
         echo 0;
     } else {
         echo 1;
     }
 }
Пример #29
0
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     ee()->lang->loadfile('settings');
     ee()->lang->loadfile('myaccount');
     // check permissions everywhere except for this landing page controller,
     // which redirects in its index function
     if (ee()->uri->segments != array(1 => 'cp', 2 => 'members', 3 => 'profile')) {
         $this->permissionCheck();
     }
     $id = ee()->input->get('id');
     if (empty($id)) {
         $id = ee()->session->userdata['member_id'];
     }
     $qs = array('id' => $id);
     $this->query_string = $qs;
     $this->base_url = ee('CP/URL')->make('members/profile/settings');
     $this->base_url->setQueryStringVariable('id', $id);
     $this->member = ee()->api->get('Member')->filter('member_id', $id)->first();
     if (is_null($this->member)) {
         show_404();
     }
     ee()->lang->loadfile('members');
     ee()->lang->loadfile('myaccount');
     ee()->load->model('member_model');
     ee()->load->library('form_validation');
     $this->generateSidebar();
     ee()->cp->set_breadcrumb(ee('CP/URL')->make('members'), lang('members'));
     ee()->view->header = array('title' => sprintf(lang('profile_header'), $this->member->username));
 }
Пример #30
0
function auth()
{
    $CI =& get_instance();
    $auth_session = $CI->session->userdata('privileges');
    $permission = explode("|", $auth_session);
    if ($CI->uri->segment(2) == "") {
    } else {
        $module = $CI->uri->segment(1);
        $function = $CI->uri->segment(2) != "" ? $CI->uri->segment(2) : "index";
        foreach ($permission as $show) {
            $get_function = explode("_", $show);
            $module_list[] = $get_function[0];
            //echo $show."</br>";
        }
        if (!in_array($module . "_" . $function, $permission)) {
            if (!in_array($module, $module_list)) {
                show_404();
            } else {
                true;
            }
        } else {
            true;
        }
        //echo $module."_".$function."<br/><br/>";
    }
    /* foreach($permission as $show){
    				echo $show."</br>";
    			} */
}