當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。