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


PHP Kohana::show_404方法代码示例

本文整理汇总了PHP中Kohana::show_404方法的典型用法代码示例。如果您正苦于以下问题:PHP Kohana::show_404方法的具体用法?PHP Kohana::show_404怎么用?PHP Kohana::show_404使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kohana的用法示例。


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

示例1: day

 public function day($display_year, $display_user, $display_month, $display_day)
 {
     // Display all images for the specified day.
     // Figure out the total number of photos to display.
     if ($display_user == "-1") {
         $day_count = ORM::factory("item")->viewable()->where("type !=", "album")->where("captured >=", mktime(0, 0, 0, $display_month, $display_day, $display_year))->where("captured <", mktime(0, 0, 0, $display_month, $display_day + 1, $display_year))->find_all()->count();
     } else {
         $day_count = ORM::factory("item")->viewable()->where("owner_id", $display_user)->where("type !=", "album")->where("captured >=", mktime(0, 0, 0, $display_month, $display_day, $display_year))->where("captured <", mktime(0, 0, 0, $display_month, $display_day + 1, $display_year))->find_all()->count();
     }
     // Figure out paging stuff.
     $page_size = module::get_var("gallery", "page_size", 9);
     $page = $this->input->get("page", "1");
     $offset = ($page - 1) * $page_size;
     $max_pages = ceil($day_count / $page_size);
     // Make sure that the page references a valid offset
     if ($page < 1 || $day_count && $page > ceil($day_count / $page_size)) {
         Kohana::show_404();
     }
     // Set up the page.
     $template = new Theme_View("page.html", "other", "CalendarDayView");
     $template->page_title = t("Gallery :: Calendar");
     $template->set_global("page_size", $page_size);
     // Figure out which photos go on this page.
     if ($display_user == "-1") {
         $template->set_global("children", ORM::factory("item")->viewable()->where("type !=", "album")->where("captured >=", mktime(0, 0, 0, $display_month, $display_day, $display_year))->where("captured <", mktime(0, 0, 0, $display_month, $display_day + 1, $display_year))->orderby("captured", "ASC")->find_all($page_size, $offset));
     } else {
         $template->set_global("children", ORM::factory("item")->viewable()->where("owner_id", $display_user)->where("type !=", "album")->where("captured >=", mktime(0, 0, 0, $display_month, $display_day, $display_year))->where("captured <", mktime(0, 0, 0, $display_month, $display_day + 1, $display_year))->orderby("captured", "ASC")->find_all($page_size, $offset));
     }
     // Finish setting up and then display the page.
     $template->set_global("children_count", $day_count);
     $template->content = new View("dynamic.html");
     $template->content->title = t("Photos From ") . date("d F Y", mktime(0, 0, 0, $display_month, $display_day, $display_year));
     print $template;
 }
开发者ID:regi01,项目名称:gallery3-contrib,代码行数:34,代码来源:calendarview.php

示例2: index

 /**
  * show map
  *
  * @param string $id 
  * @return void
  * @author Andy Bennett
  */
 public function index($id = 1)
 {
     $db = new Database();
     $m = ORM::factory('imagemap', $id);
     if (!$m->loaded) {
         Kohana::show_404('Imagemap ' . $id, 'common/error_404');
         return;
     }
     Assets::instance()->add_javascript('/cache/js/photonotes');
     Assets::instance()->add_css('/cache/css/photonotes');
     Assets::instance()->add_css('/cache/css/photonotes_client');
     $pages_array = strstr(APPPATH, 'backend_') === FALSE ? array() : imagemap_helper::get_pages();
     $pages = json_encode($pages_array);
     // Build the Image object
     $image = array();
     $image['img'] = $m->upload->id . $m->upload->file_ext;
     $image['alt'] = $m->title;
     // Load the view as an object
     $view = new View('imagemap');
     // Add variable data to the view
     $view->image = $image;
     $view->notes = $m->imagenotes;
     $view->admin = true;
     //APPENV == 'backend';  		// Are the image maps editable?
     $view->id = $id;
     // Needed for reporting changes back to the backend via ajax
     $view->pages = $pages;
     // Send the array of pages through to the view
     // Render the View
     $view->render(TRUE);
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:38,代码来源:Imagemap.php

示例3: tags

 public function tags($id)
 {
     $tag = ORM::factory("tag", $id);
     if (!$tag->loaded) {
         return Kohana::show_404();
     }
     $page = $this->input->get("page", 1);
     if ($page < 1) {
         url::redirect("media_rss/tags/{$tag->id}");
     }
     $children = $tag->items(self::$page_size, ($page - 1) * self::$page_size, "photo");
     $max_pages = ceil($tag->count / self::$page_size);
     if ($page > $max_pages) {
         url::redirect("media_rss/tags/{$tag->id}?page={$max_pages}");
     }
     $view = new View("feed.mrss");
     $view->title = $tag->name;
     $view->link = url::abs_site("tags/{$tag->id}");
     $view->description = t("Photos related to %tag_name", array("tag_name" => $tag->name));
     $view->feed_link = url::abs_site("media_rss/tags/{$tag->id}");
     $view->children = $children;
     if ($page > 1) {
         $previous_page = $page - 1;
         $view->previous_page_link = url::site("media_rss/tags/{$tag->id}?page={$previous_page}");
     }
     if ($page < $max_pages) {
         $next_page = $page + 1;
         $view->next_page_link = url::site("media_rss/tags/{$tag->id}?page={$next_page}");
     }
     // @todo do we want to add an upload date to the items table?
     $view->pub_date = date("D, d M Y H:i:s T");
     rest::http_content_type(rest::RSS);
     print $view;
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:34,代码来源:media_rss.php

示例4: error_404

function error_404()
{
    if (Kohana::$instance == NULL) {
        Kohana::$instance = new Errors_Controller();
    }
    Kohana::show_404(null, 'common/error_404');
}
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:7,代码来源:errors.php

示例5: show

 public function show($movie)
 {
     if (!is_object($movie)) {
         // show() must be public because we route to it in url::parse_url(), so make
         // sure that we're actually receiving an object
         Kohana::show_404();
     }
     access::required("view", $movie);
     $where = array(array("type", "!=", "album"));
     $position = $movie->parent()->get_position($movie, $where);
     if ($position > 1) {
         list($previous_item, $ignore, $next_item) = $movie->parent()->children(3, $position - 2, $where);
     } else {
         $previous_item = null;
         list($next_item) = $movie->parent()->viewable()->children(1, $position, $where);
     }
     $template = new Theme_View("page.html", "item", "movie");
     $template->set_global("item", $movie);
     $template->set_global("children", array());
     $template->set_global("children_count", 0);
     $template->set_global("parents", $movie->parents());
     $template->set_global("next_item", $next_item);
     $template->set_global("previous_item", $previous_item);
     $template->set_global("sibling_count", $movie->parent()->viewable()->children_count($where));
     $template->set_global("position", $position);
     $template->content = new View("movie.html");
     $movie->view_count++;
     $movie->save();
     print $template;
 }
开发者ID:viosca,项目名称:gallery3,代码行数:30,代码来源:movies.php

示例6: feed

 public function feed($module_id, $feed_id, $id = null)
 {
     $page = $this->input->get("page", 1);
     if ($page < 1) {
         url::redirect(url::merge(array("page" => 1)));
     }
     // Configurable page size between 1 and 100, default 20
     $page_size = max(1, min(100, $this->input->get("page_size", self::$page_size)));
     // Run the appropriate feed callback
     if (module::is_active($module_id)) {
         $class_name = "{$module_id}_rss";
         if (method_exists($class_name, "feed")) {
             $feed = call_user_func(array($class_name, "feed"), $feed_id, ($page - 1) * $page_size, $page_size, $id);
         }
     }
     if (empty($feed)) {
         Kohana::show_404();
     }
     if ($feed->max_pages && $page > $feed->max_pages) {
         url::redirect(url::merge(array("page" => $feed->max_pages)));
     }
     $view = new View(empty($feed->view) ? "feed.mrss" : $feed->view);
     unset($feed->view);
     $view->feed = $feed;
     $view->pub_date = date("D, d M Y H:i:s T");
     $feed->uri = url::abs_site(Router::$current_uri);
     if ($page > 1) {
         $feed->previous_page_uri = url::abs_site(url::merge(array("page" => $page - 1)));
     }
     if ($page < $feed->max_pages) {
         $feed->next_page_uri = url::abs_site(url::merge(array("page" => $page + 1)));
     }
     rest::http_content_type(rest::RSS);
     print $view;
 }
开发者ID:Okat,项目名称:gallery3,代码行数:35,代码来源:rss.php

示例7: _show

 /**
  *  @see REST_Controller::_show($resource)
  */
 public function _show($album)
 {
     access::required("view", $album);
     $page_size = module::get_var("core", "page_size", 9);
     $show = $this->input->get("show");
     if ($show) {
         $index = $album->get_position($show);
         $page = ceil($index / $page_size);
         if ($page == 1) {
             url::redirect("albums/{$album->id}");
         } else {
             url::redirect("albums/{$album->id}?page={$page}");
         }
     }
     $page = $this->input->get("page", "1");
     $children_count = $album->viewable()->children_count();
     $offset = ($page - 1) * $page_size;
     // Make sure that the page references a valid offset
     if ($page < 1 || $page > max(ceil($children_count / $page_size), 1)) {
         Kohana::show_404();
     }
     $template = new Theme_View("page.html", "album");
     $template->set_global("page_size", $page_size);
     $template->set_global("item", $album);
     $template->set_global("children", $album->viewable()->children($page_size, $offset));
     $template->set_global("children_count", $children_count);
     $template->set_global("parents", $album->parents());
     $template->content = new View("album.html");
     $album->view_count++;
     $album->save();
     print $template;
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:35,代码来源:albums.php

示例8: error_404

function error_404()
{
    if (Kohana::$instance == NULL) {
        Kohana::$instance = new Errors_Controller();
    }
    Kohana::log('error', 'Error 404 (steam.core.hooks): ' . URI::instance()->string());
    Kohana::show_404(null, 'common/error_404');
}
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:8,代码来源:errors.php

示例9: feed

 static function feed($feed_id, $offset, $limit, $id)
 {
     if ($feed_id == "tag") {
         $tag = ORM::factory("tag", $id);
         if (!$tag->loaded) {
             Kohana::show_404();
         }
         $feed->children = $tag->items($limit, $offset, "photo");
         $feed->max_pages = ceil($tag->count / $limit);
         $feed->title = $tag->name;
         $feed->description = t("Photos related to %tag_name", array("tag_name" => $tag->name));
         return $feed;
     }
 }
开发者ID:scarygary,项目名称:gallery3,代码行数:14,代码来源:tag_rss.php

示例10: tags

 static function tags($offset, $limit, $id)
 {
     $tag = ORM::factory("tag", $id);
     if (!$tag->loaded) {
         return Kohana::show_404();
     }
     $feed = new stdClass();
     $feed->data["children"] = $tag->items($limit, $offset, "photo");
     $feed->max_pages = ceil($tag->count / $limit);
     $feed->data["title"] = $tag->name;
     $feed->data["link"] = url::abs_site("tags/{$tag->id}");
     $feed->data["description"] = t("Photos related to %tag_name", array("tag_name" => $tag->name));
     return $feed;
 }
开发者ID:kstyrvoll,项目名称:gallery3,代码行数:14,代码来源:tag_rss.php

示例11: print_proxy

 public function print_proxy($type, $id)
 {
     // If its a request for the full size then make sure we are coming from an
     // authorized address
     if ($type == "full") {
         $remote_addr = ip2long($this->input->server("REMOTE_ADDR"));
         if ($remote_addr === false) {
             Kohana::show_404();
         }
         $config = Kohana::config("addthis");
         $authorized = false;
         foreach ($config["ranges"] as $ip_range) {
             $low = ip2long($ip_range["low"]);
             $high = ip2long($ip_range["high"]);
             $authorized = $low !== false && $high !== false && $low <= $remote_addr && $remote_addr <= $high;
             if ($authorized) {
                 break;
             }
         }
         if (!$authorized) {
             Kohana::show_404();
         }
     }
     $proxy = ORM::factory("addthis_proxy", array("uuid" => $id));
     if (!$proxy->loaded || !$proxy->item->loaded) {
         Kohana::show_404();
     }
     $file = $type == "full" ? $proxy->item->file_path() : $proxy->item->thumb_path();
     if (!file_exists($file)) {
         kohana::show_404();
     }
     // We don't need to save the session for this request
     Session::abort_save();
     if (!TEST_MODE) {
         // Dump out the image
         header("Content-Type: {$proxy->item}->mime_type");
         Kohana::close_buffers(false);
         $fd = fopen($file, "rb");
         fpassthru($fd);
         fclose($fd);
         // If the request was for the image and not the thumb, then delete the proxy.
         if ($type == "full") {
             $proxy->delete();
         }
     }
     $this->_clean_expired();
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:47,代码来源:addthis.php

示例12: index

 function index()
 {
     if (PHP_SAPI != 'cli') {
         Kohana::show_404();
     }
     try {
         $this->_reset();
         // empty and reinstall the standard modules
         $this->_dump_database();
         // Dump the database
         $this->_dump_var();
         // Dump the var directory
     } catch (Exception $e) {
         print $e->getTraceAsString();
         return;
     }
     print "Successfully wrote install.sql and init_var.php\n";
 }
开发者ID:krgeek,项目名称:gallery3,代码行数:18,代码来源:package.php

示例13: index

 public function index()
 {
     //Only accessible through CLI
     if (PHP_SAPI !== 'cli') {
         Kohana::show_404();
     }
     //Clear the output buffer in preperation for any user prompts
     ob_end_flush();
     //Default configuration settings
     $config = array('data_fixtures_path' => MODPATH . 'doctrine' . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR, 'models_path' => MODPATH . 'doctrine' . DIRECTORY_SEPARATOR . 'models' . DIRECTORY_SEPARATOR, 'migrations_path' => MODPATH . 'doctrine' . DIRECTORY_SEPARATOR . 'migrations' . DIRECTORY_SEPARATOR, 'sql_path' => MODPATH . 'doctrine' . DIRECTORY_SEPARATOR . 'schema' . DIRECTORY_SEPARATOR, 'yaml_schema_path' => MODPATH . 'doctrine' . DIRECTORY_SEPARATOR . 'schema' . DIRECTORY_SEPARATOR, 'generateTableClasses' => true);
     $cli = new Doctrine_Cli($config);
     //remove our routing path
     $args = $_SERVER['argv'];
     $call = array_shift($args);
     $route = array_shift($args);
     array_unshift($args, $call);
     $cli->run($args);
 }
开发者ID:ninjapenguin,项目名称:kohana-Doctrine-module,代码行数:18,代码来源:doctrine.php

示例14: _show

 public function _show($tag)
 {
     $page_size = module::get_var("core", "page_size", 9);
     $page = $this->input->get("page", "1");
     $children_count = $tag->items_count();
     $offset = ($page - 1) * $page_size;
     // Make sure that the page references a valid offset
     if ($page < 1 || $page > ceil($children_count / $page_size)) {
         Kohana::show_404();
     }
     $template = new Theme_View("page.html", "tag");
     $template->set_global('page_size', $page_size);
     $template->set_global('tag', $tag);
     $template->set_global('children', $tag->items($page_size, $offset));
     $template->set_global('children_count', $children_count);
     $template->content = new View("tag.html");
     print $template;
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:18,代码来源:tags.php

示例15: _show

 public function _show($tag)
 {
     $page_size = module::get_var("gallery", "page_size", 9);
     $page = $this->input->get("page", "1");
     $children_count = $tag->items_count();
     $offset = ($page - 1) * $page_size;
     // Make sure that the page references a valid offset
     if ($page < 1 || $children_count && $page > ceil($children_count / $page_size)) {
         Kohana::show_404();
     }
     $template = new Theme_View("page.html", "tag");
     $template->set_global("page_size", $page_size);
     $template->set_global("page_title", t("Browse Tag::%name", array("name" => $tag->name)));
     $template->set_global("tag", $tag);
     $template->set_global("children", $tag->items($page_size, $offset));
     $template->set_global("children_count", $children_count);
     $template->content = new View("dynamic.html");
     print $template;
 }
开发者ID:krgeek,项目名称:gallery3,代码行数:19,代码来源:tags.php


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