本文整理汇总了PHP中page_not_found函数的典型用法代码示例。如果您正苦于以下问题:PHP page_not_found函数的具体用法?PHP page_not_found怎么用?PHP page_not_found使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了page_not_found函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(&$page, $params)
{
/* Execute this behaviour only if page equals the current page. */
if (url_match($page->getUri())) {
if ($child = $page->children(array('limit' => 1))) {
header('Location: ' . $child->url());
die;
}
} else {
// find called page
foreach ($params as $slug) {
$page = Page::findBySlug($slug, $page);
}
// if found
if ($page instanceof Page) {
// check for behavior
if ($page->behavior_id != '') {
// add a instance of the behavior with the name of the behavior
$page->{$page->behavior_id} = Behavior::load($page->behavior_id, $page, $params);
}
} else {
// not found
page_not_found($_SERVER['REQUEST_URI']);
}
}
}
示例2: main
public static function main()
{
// sett opp path enheter
$path = isset($_SERVER['REDIR_URL']) ? $_SERVER['REDIR_URL'] : "";
if (mb_substr($path, 0, 1) == "/") {
$path = mb_substr($path, 1);
}
$path = explode("/", $path);
$node_id = null;
if (!isset($path[1])) {
// hovedsiden
if (nodes::$default_node) {
$node_id = nodes::$default_node;
}
} else {
// sjekk node og om den er gyldig
array_shift($path);
$node_id = $path[0];
if (preg_match("/(^0|[^0-9])/u", $node_id)) {
// admin?
if ($node_id == "a") {
page_node_admin::main();
return;
} elseif ($node_id == "sitemap") {
self::sitemap();
return;
} elseif ($node_id == "all") {
self::all_nodes();
return;
} elseif ($node_id == "search") {
self::search();
return;
}
page_not_found();
}
// hoved noden?
if ($node_id == nodes::$default_node) {
redirect::handle("node", redirect::REDIRECT_ROOT);
}
}
// har vi ikke node?
if (!$node_id) {
page_node::load_page();
#page_not_found();
}
// hent info
nodes::load_node($node_id);
// vis node
nodes::parse_node();
page_node::load_page();
}
示例3: __construct
public function __construct(&$page, $params)
{
$this->page =& $page;
$this->params = $params;
switch (count($params)) {
case 0:
break;
case 1:
$this->pagesByTag($params);
break;
default:
page_not_found();
}
}
示例4: process
/**
* Process the current request
*/
public function process()
{
$this->loadController();
if ($this->controller) {
$ret = $this->processController();
if ($ret instanceof \Kofradia\Response) {
$ret->output();
} else {
echo $ret;
\ess::$b->page->load();
}
} else {
page_not_found();
die;
}
}
示例5: list
$t_app_start = 0;
}
// Call the controller.
list($controller, $args) = dispatcher_choose($url);
if ($controller !== NULL) {
include $path_app . '/' . $controller;
$t_app_start = microtime(TRUE);
$controller_output = controller($args);
if ($controller_output !== FALSE) {
print $controller_output;
} else {
print page_not_found($url);
}
} else {
$t_app_start = microtime(TRUE);
print page_not_found($url);
}
// Debugging for development mode.
if ($devel && $json === FALSE) {
$t_end = microtime(TRUE);
$t_app = (int) (round($t_app_start - $t_start, 4) * 10000);
$t_tpl = isset($t_tpl) && $t_tpl !== NULL ? (int) (round($t_tpl_start - $t_start, 4) * 10000) : 0;
$t_all = (int) (round($t_end - $t_start, 4) * 10000);
$t_qry = (int) (round($t_query, 4) * 10000);
$t_mem = (int) (round($t_mem, 4) * 10000);
print "\n<!-- {$site_name} (";
print isset($db) ? 'db ' . $db->count . "q = {$t_qry}s ; " : '';
// Database: Number of queries and time used.
print "mc {$mem_h}h+{$mem_m}m = {$t_mem}s ; ";
// memcached: Hits, misses and time used.
print 'loves caching @ ' . date('Y/m/d H:i:s') . 'GMT -->';
示例6: main
function main()
{
// get the uri string from the query
$uri = $_SERVER['QUERY_STRING'];
// Make sure special characters are decoded (support non-western glyphs like japanese)
$uri = urldecode($uri);
// START processing $_GET variables
// If we're NOT using mod_rewrite, we check for GET variables we need to integrate
if (!USE_MOD_REWRITE && strpos($uri, '?') !== false) {
$_GET = array();
// empty $_GET array since we're going to rebuild it
list($uri, $get_var) = explode('?', $uri);
$exploded_get = explode('&', $get_var);
if (count($exploded_get)) {
foreach ($exploded_get as $get) {
list($key, $value) = explode('=', $get);
$_GET[$key] = $value;
}
}
} else {
if (!USE_MOD_REWRITE && (strpos($uri, '&') !== false || strpos($uri, '=') !== false)) {
$uri = '/';
}
}
// If we're using mod_rewrite, we should have a WOLFPAGE entry.
if (USE_MOD_REWRITE && array_key_exists('WOLFPAGE', $_GET)) {
$uri = $_GET['WOLFPAGE'];
unset($_GET['WOLFPAGE']);
} else {
if (USE_MOD_REWRITE) {
// We're using mod_rewrite but don't have a WOLFPAGE entry, assume site root.
$uri = '/';
}
}
// Needed to allow for ajax calls to backend
if (array_key_exists('WOLFAJAX', $_GET)) {
$uri = '/' . ADMIN_DIR . $_GET['WOLFAJAX'];
unset($_GET['WOLFAJAX']);
}
// END processing $_GET variables
// remove suffix page if founded
if (URL_SUFFIX !== '' and URL_SUFFIX !== '/') {
$uri = preg_replace('#^(.*)(' . URL_SUFFIX . ')$#i', "\$1", $uri);
}
define('CURRENT_URI', trim($uri, '/'));
if ($uri != null && $uri[0] != '/') {
$uri = '/' . $uri;
}
// Check if there's a custom route defined for this URI,
// otherwise continue and assume page was requested.
if (Dispatcher::hasRoute($uri)) {
Observer::notify('dispatch_route_found', $uri);
Dispatcher::dispatch($uri);
exit;
}
foreach (Observer::getObserverList('page_requested') as $callback) {
$uri = call_user_func_array($callback, array(&$uri));
}
// this is where 80% of the things is done
$page = Page::findByUri($uri, true);
// if we found it, display it!
if (is_object($page)) {
// If a page is in preview status, only display to logged in users
if (Page::STATUS_PREVIEW == $page->status_id) {
AuthUser::load();
if (!AuthUser::isLoggedIn() || !AuthUser::hasPermission('page_view')) {
page_not_found();
}
}
// If page needs login, redirect to login
if ($page->getLoginNeeded() == Page::LOGIN_REQUIRED) {
AuthUser::load();
if (!AuthUser::isLoggedIn()) {
Flash::set('redirect', $page->url());
redirect(URL_PUBLIC . (USE_MOD_REWRITE ? '' : '?/') . ADMIN_DIR . '/login');
}
}
Observer::notify('page_found', $page);
$page->_executeLayout();
} else {
page_not_found();
}
}
示例7: parse_section_url
/**
* the reverse of make_section_in_url
* returns the 'section' (categories/tags/...) and the data associated with it
*
* Depending on section, other parameters are returned (category/tags/list/...)
*
* @param array of url tokens to parse
* @param int the index in the array of url tokens; in/out
* @return array
*/
function parse_section_url($tokens, &$next_token)
{
$page = array();
if (strncmp(@$tokens[$next_token], 'categor', 7) == 0) {
$page['section'] = 'categories';
$next_token++;
if (isset($tokens[$next_token])) {
if (preg_match('/^(\\d+)(?:-(.+))?$/', $tokens[$next_token], $matches)) {
if (isset($matches[2])) {
$page['hit_by']['cat_url_name'] = $matches[2];
}
$page['category'] = $matches[1];
$next_token++;
} else {
// try a permalink
$maybe_permalinks = array();
$current_token = $next_token;
while (isset($tokens[$current_token]) and strpos($tokens[$current_token], 'created-') !== 0 and strpos($tokens[$current_token], 'posted-') !== 0 and strpos($tokens[$next_token], 'start-') !== 0 and strpos($tokens[$next_token], 'startcat-') !== 0 and $tokens[$current_token] != 'flat') {
if (empty($maybe_permalinks)) {
$maybe_permalinks[] = $tokens[$current_token];
} else {
$maybe_permalinks[] = $maybe_permalinks[count($maybe_permalinks) - 1] . '/' . $tokens[$current_token];
}
$current_token++;
}
if (count($maybe_permalinks)) {
$cat_id = get_cat_id_from_permalinks($maybe_permalinks, $perma_index);
if (isset($cat_id)) {
$next_token += $perma_index + 1;
$page['category'] = $cat_id;
$page['hit_by']['cat_permalink'] = $maybe_permalinks[$perma_index];
} else {
page_not_found(l10n('Permalink for album not found'));
}
}
}
}
if (isset($page['category'])) {
$result = get_cat_info($page['category']);
if (empty($result)) {
page_not_found(l10n('Requested album does not exist'));
}
$page['category'] = $result;
}
} elseif ('tags' == @$tokens[$next_token]) {
global $conf;
$page['section'] = 'tags';
$page['tags'] = array();
$next_token++;
$i = $next_token;
$requested_tag_ids = array();
$requested_tag_url_names = array();
while (isset($tokens[$i])) {
if (strpos($tokens[$i], 'created-') === 0 or strpos($tokens[$i], 'posted-') === 0 or strpos($tokens[$i], 'start-') === 0) {
break;
}
if ($conf['tag_url_style'] != 'tag' and preg_match('/^(\\d+)(?:-(.*)|)$/', $tokens[$i], $matches)) {
$requested_tag_ids[] = $matches[1];
} else {
$requested_tag_url_names[] = $tokens[$i];
}
$i++;
}
$next_token = $i;
if (empty($requested_tag_ids) && empty($requested_tag_url_names)) {
bad_request('at least one tag required');
}
$page['tags'] = find_tags($requested_tag_ids, $requested_tag_url_names);
if (empty($page['tags'])) {
page_not_found(l10n('Requested tag does not exist'), get_root_url() . 'tags.php');
}
} elseif ('favorites' == @$tokens[$next_token]) {
$page['section'] = 'favorites';
$next_token++;
} elseif ('most_visited' == @$tokens[$next_token]) {
$page['section'] = 'most_visited';
$next_token++;
} elseif ('best_rated' == @$tokens[$next_token]) {
$page['section'] = 'best_rated';
$next_token++;
} elseif ('recent_pics' == @$tokens[$next_token]) {
$page['section'] = 'recent_pics';
$next_token++;
} elseif ('recent_cats' == @$tokens[$next_token]) {
$page['section'] = 'recent_cats';
$next_token++;
} elseif ('search' == @$tokens[$next_token]) {
$page['section'] = 'search';
$next_token++;
preg_match('/(\\d+)/', @$tokens[$next_token], $matches);
//.........这里部分代码省略.........
示例8: request_page
/**
* Take the specified parameters, and try to find the corresponding page, then execute a function to load the page (load_html_page/load_comcode_page).
*
* @param ID_TEXT The codename of the page to load
* @param boolean Whether it is required for this page to exist (shows an error if it doesn't) -- otherwise, it will just return NULL
* @param ?ID_TEXT The zone the page is being loaded in (NULL: as shown by access URL)
* @param ?ID_TEXT The type of page - for if you know it (NULL: don't know it)
* @param boolean Whether the page is being included from another
* @param boolean Whether to not check for redirects (normally you would)
* @return ?tempcode The page (NULL: no page)
*/
function request_page($codename, $required, $zone = NULL, $page_type = NULL, $being_included = false, $no_redirect_check = false)
{
global $SITE_INFO;
if ($zone === NULL) {
$zone = get_zone_name();
}
global $REQUEST_PAGE_NEST_LEVEL;
$REQUEST_PAGE_NEST_LEVEL++;
if ($REQUEST_PAGE_NEST_LEVEL > 20) {
$REQUEST_PAGE_NEST_LEVEL = 0;
attach_message(do_lang_tempcode('STOPPED_RECURSIVE_RESOURCE_INCLUDE', $codename), 'warn');
return new ocp_tempcode();
}
$details = persistant_cache_get(array('PAGE_INFO', $codename, $required, $zone));
if ($details === NULL || $details === false) {
$details = _request_page($codename, $zone, $page_type, NULL, $no_redirect_check);
persistant_cache_set(array('PAGE_INFO', $codename, $required, $zone), $details);
}
//if (rand(0,10)==1) @exit('!'.$zone.':'.$codename.'!'.$REQUEST_PAGE_NEST_LEVEL.chr(10));
// Run hooks, if any exist
$hooks = find_all_hooks('systems', 'upon_page_load');
foreach (array_keys($hooks) as $hook) {
require_code('hooks/systems/upon_page_load/' . filter_naughty($hook));
$ob = object_factory('upon_page_load' . filter_naughty($hook), true);
if ($ob === NULL) {
continue;
}
$ob->run($codename, $required, $zone, $page_type, $being_included, $details);
}
if ($details === false) {
if ($required) {
require_code('site2');
$ret = page_not_found($codename, $zone);
$REQUEST_PAGE_NEST_LEVEL--;
return $ret;
}
$REQUEST_PAGE_NEST_LEVEL--;
return new ocp_tempcode();
}
switch ($details[0]) {
case 'MODULES_CUSTOM':
$path = isset($details[3]) ? $details[3] : zone_black_magic_filterer($details[1] . ($details[1] == '' ? '' : '/') . 'pages/modules_custom/' . $details[2] . '.php', true);
$ret = load_module_page($path, $details[2]);
$REQUEST_PAGE_NEST_LEVEL--;
return $ret;
case 'MODULES':
$path = isset($details[3]) ? $details[3] : zone_black_magic_filterer($details[1] . ($details[1] == '' ? '' : '/') . 'pages/modules/' . $details[2] . '.php', true);
$ret = load_module_page($path, $details[2]);
$REQUEST_PAGE_NEST_LEVEL--;
return $ret;
case 'COMCODE_CUSTOM':
$path = isset($details[4]) ? $details[4] : zone_black_magic_filterer($details[1] . ($details[1] == '' ? '' : '/') . 'pages/comcode_custom/' . $details[3] . '/' . $details[2] . '.txt', true);
if (isset($SITE_INFO['no_disk_sanity_checks']) && $SITE_INFO['no_disk_sanity_checks'] == '1' && get_custom_file_base() == get_file_base() || is_file(get_custom_file_base() . '/' . $path)) {
$ret = load_comcode_page($path, $details[1], $details[2], get_custom_file_base(), $being_included);
$REQUEST_PAGE_NEST_LEVEL--;
return $ret;
}
// else roll on, as probably been deleted since persistent cache was filled
// else roll on, as probably been deleted since persistent cache was filled
case 'COMCODE_CUSTOM_PURE':
$path = isset($details[4]) ? $details[4] : zone_black_magic_filterer($details[1] . ($details[1] == '' ? '' : '/') . 'pages/comcode_custom/' . $details[3] . '/' . $details[2] . '.txt', true);
if (isset($SITE_INFO['no_disk_sanity_checks']) && $SITE_INFO['no_disk_sanity_checks'] == '1' || is_file(get_file_base() . '/' . $path)) {
$ret = load_comcode_page($path, $details[1], $details[2], get_file_base(), $being_included);
$REQUEST_PAGE_NEST_LEVEL--;
return $ret;
}
// else roll on, as probably been deleted since persistent cache was filled
// else roll on, as probably been deleted since persistent cache was filled
case 'COMCODE':
$path = isset($details[4]) ? $details[4] : zone_black_magic_filterer($details[1] . ($details[1] == '' ? '' : '/') . 'pages/comcode/' . $details[3] . '/' . $details[2] . '.txt', true);
if (isset($SITE_INFO['no_disk_sanity_checks']) && $SITE_INFO['no_disk_sanity_checks'] == '1' || is_file(get_file_base() . '/' . $path)) {
$ret = load_comcode_page($path, $details[1], $details[2], NULL, $being_included);
$REQUEST_PAGE_NEST_LEVEL--;
return $ret;
}
// else roll on, as probably been deleted since persistent cache was filled
// else roll on, as probably been deleted since persistent cache was filled
case 'HTML_CUSTOM':
require_code('site_html_pages');
$path = isset($details[4]) ? $details[4] : zone_black_magic_filterer($details[1] . ($details[1] == '' ? '' : '/') . 'pages/html_custom/' . $details[3] . '/' . $details[2] . '.htm', true);
$ret = make_string_tempcode(load_html_page($path));
$REQUEST_PAGE_NEST_LEVEL--;
return $ret;
case 'HTML':
require_code('site_html_pages');
$path = isset($details[4]) ? $details[4] : zone_black_magic_filterer($details[1] . ($details[1] == '' ? '' : '/') . 'pages/html/' . $details[3] . '/' . $details[2] . '.htm', true);
$ret = make_string_tempcode(load_html_page($path));
$REQUEST_PAGE_NEST_LEVEL--;
return $ret;
//.........这里部分代码省略.........
示例9: map_draw
/**
* Generer kart
*/
protected function map_draw()
{
// hent inn ff
$this->ff = ff::get_ff(null, ff::LOAD_SILENT);
if (!$this->ff) {
page_not_found();
}
// har ingen bydel?
if (!$this->ff->data['br_id']) {
die("Har ingen bydel.");
}
$map = new bydeler_map();
$map->mini_map($this->ff->data['br_id']);
$map->push();
die;
}
示例10: define
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
//--------------------------------------------------------------------- include
define('PHPWG_ROOT_PATH', './');
include_once PHPWG_ROOT_PATH . 'include/common.inc.php';
include PHPWG_ROOT_PATH . 'include/section_init.inc.php';
// Check Access and exit when user status is not ok
check_status(ACCESS_GUEST);
// access authorization check
if (isset($page['category'])) {
check_restrictions($page['category']['id']);
}
if ($page['start'] > 0 && $page['start'] >= count($page['items'])) {
page_not_found('', duplicate_index_url(array('start' => 0)));
}
trigger_notify('loc_begin_index');
//---------------------------------------------- change of image display order
if (isset($_GET['image_order'])) {
if ((int) $_GET['image_order'] > 0) {
pwg_set_session_var('image_order', (int) $_GET['image_order']);
} else {
pwg_unset_session_var('image_order');
}
redirect(duplicate_index_url(array(), array('start')));
}
if (isset($_GET['display'])) {
$page['meta_robots']['noindex'] = 1;
if (array_key_exists($_GET['display'], ImageStdParams::get_defined_type_map())) {
pwg_set_session_var('index_deriv', $_GET['display']);
示例11: _displayPage
private function _displayPage($slug)
{
if (!($this->page = Page::findBySlug($slug, $this->page))) {
page_not_found();
}
}
示例12: main
function main()
{
/* Get the uri string from the query. */
$uri = $_SERVER['QUERY_STRING'];
/* Real integration of GET. */
if (strpos($uri, '?') !== false) {
list($uri, $get_var) = explode('?', $uri);
$exploded_get = explode('&', $get_var);
if (count($exploded_get)) {
foreach ($exploded_get as $get) {
list($key, $value) = explode('=', $get);
$_GET[$key] = $value;
}
}
}
/* Remove suffix page if found. */
if (URL_SUFFIX !== '' and URL_SUFFIX !== '/') {
$uri = preg_replace('#^(.*)(' . URL_SUFFIX . ')$#i', "\$1", $uri);
}
define('CURRENT_URI', trim($uri, '/'));
/* This is where 80% of the things are done. */
$page = Page::findByUri($uri);
/* If we found it, display it! */
if (is_object($page)) {
Observer::notify('page_found', $page);
$page->show();
} else {
page_not_found();
}
}
示例13: save
public function save()
{
if (!$this->_isInternal()) {
page_not_found();
}
$imgPath = array_key_exists('img-path', $_POST) ? $_POST['img-path'] : '';
if ($imgPath === '/' or $imgPath === '\\') {
$imgPath = '';
}
$settings = array('path' => $imgPath);
if (Plugin::setAllSettings($settings, 'image')) {
Flash::set('success', 'Image - ' . __('plugin settings saved.'));
} else {
Flash::set('error', 'Image - ' . __('plugin settings not saved!'));
}
redirect(get_url('plugin/image/settings'));
}
示例14: framework_exception_handler
/**
* Provides a nice print out of the stack trace when an exception is thrown.
*
* @param Exception $e Exception object.
*/
function framework_exception_handler($e)
{
if (!DEBUG) {
page_not_found();
}
echo '<style>h1,h2,h3,p,td {font-family:Verdana; font-weight:lighter;}</style>';
echo '<p>Uncaught ' . get_class($e) . '</p>';
echo '<h1>' . $e->getMessage() . '</h1>';
$traces = $e->getTrace();
if (count($traces) > 1) {
echo '<p><b>Trace in execution order:</b></p>' . '<pre style="font-family:Verdana; line-height: 20px">';
$level = 0;
foreach (array_reverse($traces) as $trace) {
++$level;
if (isset($trace['class'])) {
echo $trace['class'] . '→';
}
$args = array();
if (!empty($trace['args'])) {
foreach ($trace['args'] as $arg) {
if (is_null($arg)) {
$args[] = 'null';
} else {
if (is_array($arg)) {
$args[] = 'array[' . sizeof($arg) . ']';
} else {
if (is_object($arg)) {
$args[] = get_class($arg) . ' Object';
} else {
if (is_bool($arg)) {
$args[] = $arg ? 'true' : 'false';
} else {
if (is_int($arg)) {
$args[] = $arg;
} else {
$arg = htmlspecialchars(substr($arg, 0, 64));
if (strlen($arg) >= 64) {
$arg .= '...';
}
$args[] = "'" . $arg . "'";
}
}
}
}
}
}
}
echo '<b>' . $trace['function'] . '</b>(' . implode(', ', $args) . ') ';
echo 'on line <code>' . (isset($trace['line']) ? $trace['line'] : 'unknown') . '</code> ';
echo 'in <code>' . (isset($trace['file']) ? $trace['file'] : 'unknown') . "</code>\n";
echo str_repeat(" ", $level);
}
echo '</pre>';
}
echo "<p>Exception was thrown on line <code>" . $e->getLine() . "</code> in <code>" . $e->getFile() . "</code></p>";
$dispatcher_status = Dispatcher::getStatus();
$dispatcher_status['request method'] = get_request_method();
debug_table($dispatcher_status, 'Dispatcher status');
if (!empty($_GET)) {
debug_table($_GET, 'GET');
}
if (!empty($_POST)) {
debug_table($_POST, 'POST');
}
if (!empty($_COOKIE)) {
debug_table($_COOKIE, 'COOKIE');
}
debug_table($_SERVER, 'SERVER');
}
示例15: se_framework_exception_handler
function se_framework_exception_handler($e)
{
if (!DEBUG) {
page_not_found();
}
// display Profiler
include SYSPATH . '/core/Profiler' . EXT;
Profiler::displayTrace($e);
Profiler::display();
}