当前位置: 首页>>代码示例>>PHP>>正文


PHP throw_404函数代码示例

本文整理汇总了PHP中throw_404函数的典型用法代码示例。如果您正苦于以下问题:PHP throw_404函数的具体用法?PHP throw_404怎么用?PHP throw_404使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了throw_404函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: bind

 function bind()
 {
     //get the leaflet
     $search = factory::create("search");
     $result = $search->search("leaflet", array(array("leaflet_id", "=", $this->leaflet_id), array('live', '=', 1)), 'AND', array(array("party", "inner")));
     $leaflet = null;
     if (count($result) != 1) {
         throw_404();
     } else {
         $leaflet = $result[0];
     }
     //get images
     $leaflet_images = $search->search("leaflet_image", array(array("leaflet_id", "=", $this->leaflet_id)), 'AND', null, array(array("sequence", "ASC")));
     //get categories
     $leaflet_categories = $search->search("category", array(array("leaflet_category.leaflet_id", "=", $this->leaflet_id)), 'AND', array(array("leaflet_category", 'inner')));
     //get tags
     $leaflet_tags = $search->search("tag", array(array("leaflet_tag.leaflet_id", "=", $this->leaflet_id)), 'AND', array(array("leaflet_tag", 'inner')));
     //get parties attacked
     $leaflet_parties_attacked = $search->search("party", array(array("leaflet_party_attack.leaflet_id", "=", $this->leaflet_id)), 'AND', array(array("leaflet_party_attack", 'inner')));
     //get constituencies
     $leaflet_constituencies = $search->search("constituency", array(array("leaflet_constituency.leaflet_id", "=", $this->leaflet_id)), 'AND', array(array("leaflet_constituency", 'inner')));
     //js
     $this->onloadscript = "showMap('" . MAP_PROVIDER . "', " . number_format($leaflet->lng, 2) . ", " . number_format($leaflet->lat, 2) . ");";
     //assign
     $this->page_title = $leaflet->title . " (an election leaflet published by " . $leaflet->party_name . ")";
     $this->has_map = true;
     $this->assign("leaflet", $leaflet);
     $this->assign("leaflet_images", $leaflet_images);
     $this->assign("leaflet_categories", $leaflet_categories);
     $this->assign("leaflet_tags", $leaflet_tags);
     $this->assign("constituency", $leaflet_constituencies[0]);
     $this->assign("leaflet_parties_attacked", $leaflet_parties_attacked);
 }
开发者ID:henare,项目名称:electionleaflets,代码行数:33,代码来源:leaflet.php

示例2: index

 public function index($slug)
 {
     $product = \CI::Products()->slug($slug);
     //echo '<pre>'; print_r($product);exit;
     if (!$product) {
         throw_404();
     } else {
         $product->images = json_decode($product->images, true);
         if ($product->images) {
             $product->images = array_values($product->images);
         } else {
             $product->images = [];
         }
         // get documents
         $data['documents'] = \CI::Products()->get_documents($product->id);
         //echo \CI::db()->last_query(); print_r($data['documents']);exit;
         //echo $product->manufacturers;exit;
         // get parameter of product
         $data['get_parameters_of_product'] = \CI::Products()->get_parameters_of_product($product->id, $product->primary_category, $product->manufacturers);
         //echo '<pre>'; print_r($data['documents']);exit;
         //set product options
         $data['options'] = \CI::ProductOptions()->getProductOptions($product->id);
         $data['posted_options'] = \CI::session()->flashdata('option_values');
         //get related items
         $data['related'] = $product->related_products;
         //create view variable
         $data['page_title'] = $product->name;
         $data['meta'] = $product->meta;
         $data['seo_title'] = !empty($product->seo_title) ? $product->seo_title : $product->name;
         $data['product'] = $product;
         //load the view
         $this->view('product', $data);
     }
 }
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:34,代码来源:Product.php

示例3: bind

 function bind()
 {
     $this->onloadscript = "setupRate();";
     //get name
     $name = session_read("analysis_name");
     $tmp = split(' ', $name);
     $name = $tmp[0];
     //get user count
     $user_count = tableclass_rate_value::user_count(session_read("analysis_email"), false);
     //get the leaflet
     $search = factory::create("search");
     $result = $search->search("leaflet", array(array("live", "=", 1), array("date_uploaded", ">", STAT_ZERO_DATE)), 'AND', null, array(array('RAND()', 'DESC')), 1);
     $leaflet = null;
     if (count($result) != 1) {
         throw_404();
     } else {
         $leaflet = $result[0];
     }
     //get images
     $leaflet_images = $search->search("leaflet_image", array(array("leaflet_id", "=", $leaflet->leaflet_id)), 'AND', null, array(array("sequence", "ASC")));
     //get rate types
     $rate_types = $search->search("rate_type", array(array("1", "=", "1")));
     //assign
     $this->page_title = "Rate '" . $leaflet->title . "'";
     $this->assign("leaflet", $leaflet);
     $this->assign("leaflet_images", $leaflet_images);
     $this->assign("hide_header", true);
     $this->assign("leaflet_id", $leaflet->leaflet_id);
     $this->assign("rate_types", $rate_types);
     $this->assign("name", $name);
     $this->assign("user_count", $user_count);
 }
开发者ID:schlos,项目名称:electionleaflets,代码行数:32,代码来源:rate.php

示例4: bind

 function bind()
 {
     //add a cache header
     //TODO: make this generic and add to config file
     $expires = 60 * 60 * 5;
     header("Pragma: public");
     header("Cache-Control: maxage=" . $expires);
     header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT');
     //output
     $this->reset_smarty(TEMPLATE_DIR . "/api/" . $this->output . ".tpl");
     $result = $this->get_data();
     // Add JSONP callback. Not sure if urlencode needed - better safe than sorry??
     $this->assign('callback', urlencode($this->all_arguments['callback']));
     if ($this->method == 'constituency' || $this->method == 'party' || $this->method == 'latest') {
         if ($this->success) {
             $this->assign("leaflets", $result);
             $this->assign("method", $this->method);
             $this->assign("has_leaflets", count($result) > 0);
         } else {
             throw_404();
         }
     } else {
         $this->assign("result", $result);
     }
 }
开发者ID:schlos,项目名称:electionleaflets,代码行数:25,代码来源:call.php

示例5: index

 public function index($slug)
 {
     $product = \CI::Products()->slug($slug);
     if (!$product) {
         throw_404();
     } else {
         $product->images = json_decode($product->images, true);
         if ($product->images) {
             $product->images = array_values($product->images);
         } else {
             $product->images = [];
         }
         //set product options
         $data['options'] = \CI::ProductOptions()->getProductOptions($product->id);
         $data['posted_options'] = \CI::session()->flashdata('option_values');
         //get related items
         $data['related'] = $product->related_products;
         //create view variable
         $data['page_title'] = $product->name;
         $data['meta'] = $product->meta;
         $data['seo_title'] = !empty($product->seo_title) ? $product->seo_title : $product->name;
         $data['product'] = $product;
         //load the view
         $this->view('product', $data);
     }
 }
开发者ID:thijmenvenus,项目名称:GoCart3,代码行数:26,代码来源:Product.php

示例6: index

 public function index($slug, $sort = 'id', $dir = "ASC", $page = 0)
 {
     \CI::lang()->load('categories');
     //define the URL for pagination
     $pagination_base_url = site_url('category/' . $slug . '/' . $sort . '/' . $dir);
     //how many products do we want to display per page?
     //this is configurable from the admin settings page.
     $per_page = config_item('products_per_page');
     //grab the categories
     $categories = \CI::Categories()->get($slug, $sort, $dir, $page, $per_page);
     //no category? show 404
     if (!$categories) {
         throw_404();
         return;
     }
     $categories['sort'] = $sort;
     $categories['dir'] = $dir;
     $categories['slug'] = $slug;
     $categories['page'] = $page;
     //load up the pagination library
     \CI::load()->library('pagination');
     $config['base_url'] = $pagination_base_url;
     $config['uri_segment'] = 5;
     $config['per_page'] = $per_page;
     $config['num_links'] = 3;
     $config['total_rows'] = $categories['total_products'];
     \CI::pagination()->initialize($config);
     //load the view
     $this->view('categories/category', $categories);
 }
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:30,代码来源:Category.php

示例7: index

 public function index($slug = false, $show_title = true)
 {
     $page = false;
     //this means there's a slug, lets see what's going on.
     foreach ($this->pages['all'] as $p) {
         if ($p->slug == $slug) {
             $page = $p;
             continue;
         }
     }
     if (!$page) {
         throw_404();
     } else {
         //create view variable
         $data['page_title'] = false;
         if ($show_title) {
             $data['page_title'] = $page->title;
         }
         $data['meta'] = $page->meta;
         $data['seo_title'] = !empty($page->seo_title) ? $page->seo_title : $page->title;
         $data['page'] = $page;
         $data['is_home'] = false;
         //load the view
         $this->view('page', $data);
     }
 }
开发者ID:vandona,项目名称:v3,代码行数:26,代码来源:Page.php

示例8: downloadFile

 public function downloadFile($filename)
 {
     if ($this->verifyContent($filename)) {
         \CI::load()->helper('download');
         force_download($filename, file_get_contents('uploads/digital_products/' . $filename));
     } else {
         throw_404();
     }
 }
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:9,代码来源:Digitalproducts.php

示例9: bind

 function bind()
 {
     $leaflets = $this->get_data();
     if ($this->success) {
         $this->reset_smarty(TEMPLATE_DIR . "/api/" . $this->output . ".tpl");
         $this->assign("leaflets", $leaflets);
     } else {
         throw_404();
     }
 }
开发者ID:GetUp,项目名称:Election-Leaflet-Project-Australia,代码行数:10,代码来源:call.php

示例10: orderComplete

 public function orderComplete($orderNumber)
 {
     $order = \CI::Orders()->getOrder($orderNumber);
     $orderCustomer = \CI::Customers()->get_customer($order->customer_id);
     if ($orderCustomer->is_guest || $orderCustomer->id == $this->customer->id) {
         $this->view('orderComplete', ['order' => $order]);
     } else {
         if (!\CI::Login()->isLoggedIn(false, false)) {
             redirect('login');
         } else {
             throw_404();
         }
     }
 }
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:14,代码来源:Checkout.php

示例11: bind

 function bind()
 {
     //get the leaflet
     $search = factory::create("search");
     $result = $search->search("leaflet", array(array("leaflet_id", "=", $this->viewstate['leaflet_id'])));
     $leaflet = null;
     if (count($result) != 1) {
         throw_404();
     } else {
         $leaflet = $result[0];
     }
     $this->assign("leaflet", $leaflet);
     $this->assign("message_sent", $this->viewstate['message_sent']);
 }
开发者ID:GetUp,项目名称:Election-Leaflet-Project-Australia,代码行数:14,代码来源:report.php

示例12: load

 function load()
 {
     $upload_key = get_http_var('q');
     if (!isset($upload_key) || $upload_key == null) {
         throw_404();
     } else {
         $search = factory::create('search');
         $image_que_items = $search->search("image_que", array(array("upload_key", "=", $upload_key)), "AND", null, array(array("uploaded_date", "ASC")));
         if (count($image_que_items) > 0) {
             redirect(WWW_SERVER . '/addinfo.php?key=' . urlencode($upload_key));
         } else {
             throw_404();
         }
     }
 }
开发者ID:schlos,项目名称:electionleaflets,代码行数:15,代码来源:confirm.php

示例13: setup

 function setup()
 {
     $party_id = get_http_var('p');
     if (isset($party_id) && $party_id != '') {
         $search = factory::create('search');
         $results = $search->search_cached('party', array(array('url_id', '=', $party_id)));
         if (count($results) != 1) {
             throw_404();
         }
         if ($results[0]->major != 1) {
             throw_404();
         }
         $this->party = $results[0];
     }
 }
开发者ID:schlos,项目名称:electionleaflets,代码行数:15,代码来源:stats.php

示例14: setup

 function setup()
 {
     $this->confirm_id = get_http_var('q');
     if (!isset($this->confirm_id)) {
         throw_404();
     } else {
         //make sure ID exists
         $search = factory::create('search');
         $results = $search->search("email_alert", array(array("confirm_id", "=", $this->confirm_id), array("activated", '=', 0)));
         if (count($results) != 1) {
             throw_404();
         } else {
             $this->email_alert = $results[0];
         }
     }
 }
开发者ID:schlos,项目名称:electionleaflets,代码行数:16,代码来源:confirm.php

示例15: load

 function load()
 {
     $election_id = get_http_var('id');
     if (!isset($election_id)) {
         throw_404();
     } else {
         $this->election_id = $election_id;
         $search = factory::create('search');
         $result = $search->search("election", array(array("election_id", "=", $this->election_id)));
         $election_details = null;
         if (count($result) != 1) {
             throw_404();
         } else {
             $this->election_details = $result[0];
         }
     }
 }
开发者ID:schlos,项目名称:electionleaflets,代码行数:17,代码来源:edit_election.php


注:本文中的throw_404函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。