本文整理汇总了PHP中show_404函数的典型用法代码示例。如果您正苦于以下问题:PHP show_404函数的具体用法?PHP show_404怎么用?PHP show_404使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了show_404函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _remap
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: validate
/**
* 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: index
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: view
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: login
/**
* 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: us
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: view
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: view
/**
* 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: view
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: __construct
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: index
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: page
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: index
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: load
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: __construct
/**
* 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');
}
}