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']); } } }
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(); }
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(); } }
/** * 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; } }
$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 -->';
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(); } }
/** * 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); if (!isset($matches[1])) { bad_request('search identifier is missing'); } $page['search'] = $matches[1]; $next_token++; } elseif ('list' == @$tokens[$next_token]) { $page['section'] = 'list'; $next_token++; $page['list'] = array(); // No pictures if (empty($tokens[$next_token])) { // Add dummy element list $page['list'][] = -1; } else { if (!preg_match('/^\\d+(,\\d+)*$/', $tokens[$next_token])) { bad_request('wrong format on list GET parameter'); } foreach (explode(',', $tokens[$next_token]) as $image_id) { $page['list'][] = $image_id; } } $next_token++; } return $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; case 'MINIMODULES_CUSTOM': $path = isset($details[3]) ? $details[3] : zone_black_magic_filterer($details[1] . ($details[1] == '' ? '' : '/') . 'pages/minimodules_custom/' . $codename . '.php', true); $ret = load_minimodule_page($path); $REQUEST_PAGE_NEST_LEVEL--; return $ret; case 'MINIMODULES': $path = isset($details[3]) ? $details[3] : zone_black_magic_filterer($details[1] . ($details[1] == '' ? '' : '/') . 'pages/minimodules/' . $codename . '.php', true); $ret = load_minimodule_page($path); $REQUEST_PAGE_NEST_LEVEL--; return $ret; case 'REDIRECT': $redirect = $details[1]; if ($required) { global $REDIRECTED_TO; $REDIRECTED_TO = $redirect; } if (strpos($redirect['r_to_page'], ':') !== false) { $bits = page_link_decode($redirect['r_to_zone'] . ':' . $redirect['r_to_page']); } else { $bits = array($redirect['r_to_zone'], array('page' => $redirect['r_to_page'])); } // Transparent redirection? if ($redirect['r_is_transparent'] == 1) { if ($being_included && !has_page_access(get_member(), $redirect['r_to_page'], $redirect['r_to_zone'], true)) { access_denied('PAGE_ACCESS'); } foreach ($bits[1] as $key => $val) { if ($key != 'page') { $_GET[$key] = get_magic_quotes_gpc() ? addslashes($val) : $val; } } if ($redirect['r_to_page'] != $codename || $redirect['r_to_zone'] != $zone) { $ret = request_page($redirect['r_to_page'], $required, $redirect['r_to_zone'], NULL, $being_included, $redirect['r_is_transparent'] == 1); $REQUEST_PAGE_NEST_LEVEL--; return $ret; } } else { $title = get_page_title('REDIRECTING'); $url = build_url($bits[1], $redirect['r_to_zone'], NULL, true); header('HTTP/1.1 301 Moved Permanently'); $ret = redirect_screen($title, $url, do_lang_tempcode('REDIRECTED_LINK'), true); $REQUEST_PAGE_NEST_LEVEL--; return $ret; } } $REQUEST_PAGE_NEST_LEVEL--; return new ocp_tempcode(); // should never get here }
/** * 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; }
// | 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']);
private function _displayPage($slug) { if (!($this->page = Page::findBySlug($slug, $this->page))) { page_not_found(); } }
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(); } }
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')); }
/** * 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'); }
function se_framework_exception_handler($e) { if (!DEBUG) { page_not_found(); } // display Profiler include SYSPATH . '/core/Profiler' . EXT; Profiler::displayTrace($e); Profiler::display(); }
// | initialization | // +-----------------------------------------------------------------------+ check_input_parameter('feed', $_GET, false, '/^[0-9a-z]{50}$/i'); $feed_id = isset($_GET['feed']) ? $_GET['feed'] : ''; $image_only = isset($_GET['image_only']); // echo '<pre>'.generate_key(50).'</pre>'; if (!empty($feed_id)) { $query = ' SELECT user_id, last_check FROM ' . USER_FEED_TABLE . ' WHERE id = \'' . $feed_id . '\' ;'; $feed_row = pwg_db_fetch_assoc(pwg_query($query)); if (empty($feed_row)) { page_not_found(l10n('Unknown feed identifier')); } if ($feed_row['user_id'] != $user['id']) { // new user $user = build_user($feed_row['user_id'], true); } } else { $image_only = true; if (!is_a_guest()) { // auto session was created - so switch to guest $user = build_user($conf['guest_id'], true); } } // Check the status now after the user has been loaded check_status(ACCESS_GUEST); list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
function main() { // get the uri string from the query $uri = $_SERVER['QUERY_STRING']; // 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 PAGE entry. if (USE_MOD_REWRITE && array_key_exists('PAGE', $_GET)) { $uri = $_GET['PAGE']; unset($_GET['PAGE']); } else { if (USE_MOD_REWRITE) { // We're using mod_rewrite but don't have a PAGE entry, assume site root. $uri = ''; } } // 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, '/')); Observer::notify('page_requested', $uri); // this is where 80% of the things is done $page = find_page_by_uri($uri); // if we fund it, display it! if (is_object($page)) { // 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 . ADMIN_DIR . (USE_MOD_REWRITE ? '/' : '/?/') . 'login'); } } Observer::notify('page_found', $page); $page->_executeLayout(); } else { page_not_found(); } }
/** * Vis en node */ public static function parse_node() { if (!self::$node_id) { page_not_found(); } // deaktivert? if (self::$node_info['node_enabled'] == 0 || self::$node_info['parent_enabled'] == 0) { if (!access::has("crewet", null, null, "login")) { page_not_found(); } // gi tilgang if (self::$node_info['node_enabled'] > 0) { ess::$b->page->add_message("En av foreldrene til denne siden er deaktivert og derfor er også denne siden deaktivert. Du kan vise den fordi du er logget inn."); } else { ess::$b->page->add_message("Denne siden er egentlig deaktivert. Du kan vise den fordi du er logget inn."); } } $filter = " AND ni_enabled > 0"; if (isset($_GET['show_disabled_units']) && access::has("crewet")) { // hvor mange enheter er deaktivert? $result = \Kofradia\DB::get()->query("SELECT COUNT(ni_id) FROM nodes_items WHERE ni_node_id = " . self::$node_id . " AND ni_enabled = 0 AND ni_deleted = 0"); $ant = $result->fetchColumn(0); if ($ant == 0) { ess::$b->page->add_message("Det finnes ingen deaktiverte enheter på denne siden."); } else { ess::$b->page->add_message("Viser <b>{$ant}</b> deaktivert" . ($ant == 1 ? '' : 'e') . " enheter."); } $filter = ""; } // tittel if (!self::$node_params->get("hide_title")) { echo ' <h1>' . htmlspecialchars(self::$node_info['node_title']) . '</h1>'; } // vis enhetene $result = \Kofradia\DB::get()->query("SELECT ni_id, ni_type, nir_content, nir_params, nir_time FROM nodes_items LEFT JOIN nodes_items_rev ON nir_id = ni_nir_id WHERE ni_node_id = " . self::$node_id . $filter . " AND ni_deleted = 0 ORDER BY ni_priority"); while ($row = $result->fetch()) { echo nodes::content_build($row); } if (!self::$node_params->get("hide_time_change")) { echo ' <p align="right" style="color:#AAAAAA;font-size:10px"> Sist endret ' . ess::$b->date->get(self::$node_info['node_change'])->format() . ' </p>'; } // linker if (access::has("crewet")) { $url = $_SERVER['REQUEST_URI']; if (($pos = mb_strpos($url, "?")) !== false) { $url = mb_substr($url, 0, $pos); } echo ' <p style="color:#AAA;text-align:right;font-size:10px">[<a href="' . ess::$s['relative_path'] . '/node/a?node_id=' . self::$node_id . '">rediger side</a>]' . (isset($_GET['show_disabled_units']) ? ' [<a href="' . game::address($url, $_GET, array("show_disabled_units")) . '">skjul deaktiverte enheter</a>]' : ' [<a href="' . game::address($url, $_GET, array(), array("show_disabled_units" => true)) . '">vis deaktiverte enheter</a>]') . '</p>'; } }
private function _displayPage($slug) { if (!($this->page = Page::findBySlugAndParentId($slug, $this->page->id()))) { page_not_found(); } }
$query .= 'file LIKE \'' . str_replace(array('_', '%'), array('/_', '/%'), $page['image_file']) . '.%\' ESCAPE \'/\' LIMIT 1'; } if (!($row = pwg_db_fetch_assoc(pwg_query($query)))) { // element does not exist page_not_found('The requested image does not exist', duplicate_index_url()); } if ($row['level'] > $user['level']) { access_denied(); } $page['image_id'] = $row['id']; $page['image_file'] = $row['file']; if (!isset($page['rank_of'][$page['image_id']])) { // the image can still be non accessible (filter/cat perm) and/or not in the set global $filter; if (!empty($filter['visible_images']) and !in_array($page['image_id'], explode(',', $filter['visible_images']))) { page_not_found('The requested image is filtered', duplicate_index_url()); } if ('categories' == $page['section'] and !isset($page['category'])) { // flat view - all items access_denied(); } else { // try to see if we can access it differently $query = ' SELECT id FROM ' . IMAGES_TABLE . ' INNER JOIN ' . IMAGE_CATEGORY_TABLE . ' ON id=image_id WHERE id=' . $page['image_id'] . get_sql_condition_FandF(array('forbidden_categories' => 'category_id'), " AND") . ' LIMIT 1'; if (pwg_db_num_rows(pwg_query($query)) == 0) { access_denied(); } else { if ('best_rated' == $page['section']) {
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | // | General Public License for more details. | // | | // | You should have received a copy of the GNU General Public License | // | along with this program; if not, write to the Free Software | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | // | USA. | // +-----------------------------------------------------------------------+ // +-----------------------------------------------------------------------+ // | initialization | // +-----------------------------------------------------------------------+ define('PHPWG_ROOT_PATH', './'); include_once PHPWG_ROOT_PATH . 'include/common.inc.php'; include_once PHPWG_ROOT_PATH . 'include/functions_comment.inc.php'; if (!$conf['activate_comments']) { page_not_found(null); } // +-----------------------------------------------------------------------+ // | Check Access and exit when user status is not ok | // +-----------------------------------------------------------------------+ check_status(ACCESS_GUEST); $url_self = PHPWG_ROOT_PATH . 'comments.php' . get_query_string_diff(array('delete', 'edit', 'validate', 'pwg_token')); $sort_order = array('DESC' => l10n('descending'), 'ASC' => l10n('ascending')); // sort_by : database fields proposed for sorting comments list $sort_by = array('date' => l10n('comment date'), 'image_id' => l10n('photo')); // items_number : list of number of items to display per page $items_number = array(5, 10, 20, 50, 'all'); // if the default value is not in the expected values, we add it in the $items_number array if (!in_array($conf['comments_page_nb_comments'], $items_number)) { $items_number_new = array(); $is_inserted = false;
private function _displayPage($slug) { if (!($this->page = find_page_by_slug($slug, $this->page))) { page_not_found(); } }
require_once DOCUMENT_ROOT . DIRECTORY_SEPARATOR . 'web' . DIRECTORY_SEPARATOR . 'module' . DIRECTORY_SEPARATOR . 'article.module.inc'; require_once DOCUMENT_ROOT . DIRECTORY_SEPARATOR . 'web' . DIRECTORY_SEPARATOR . 'controller' . DIRECTORY_SEPARATOR . 'article.controller.inc'; // article_category_view(); } if ($arg[0] == 'plant') { require_once DOCUMENT_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'plant.inc'; require_once DOCUMENT_ROOT . DIRECTORY_SEPARATOR . 'web' . DIRECTORY_SEPARATOR . 'module' . DIRECTORY_SEPARATOR . 'plant.module.inc'; require_once DOCUMENT_ROOT . DIRECTORY_SEPARATOR . 'web' . DIRECTORY_SEPARATOR . 'controller' . DIRECTORY_SEPARATOR . 'plant.controller.inc'; plant_view(); } if ($arg[0] == 'plant_category') { require_once DOCUMENT_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'plant.inc'; require_once DOCUMENT_ROOT . DIRECTORY_SEPARATOR . 'web' . DIRECTORY_SEPARATOR . 'module' . DIRECTORY_SEPARATOR . 'plant.module.inc'; require_once DOCUMENT_ROOT . DIRECTORY_SEPARATOR . 'web' . DIRECTORY_SEPARATOR . 'controller' . DIRECTORY_SEPARATOR . 'plant.controller.inc'; plant_category_view(); } if ($arg[0] == 'gallery') { require_once DOCUMENT_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'gallery.inc'; require_once DOCUMENT_ROOT . DIRECTORY_SEPARATOR . 'web' . DIRECTORY_SEPARATOR . 'module' . DIRECTORY_SEPARATOR . 'gallery.module.inc'; require_once DOCUMENT_ROOT . DIRECTORY_SEPARATOR . 'web' . DIRECTORY_SEPARATOR . 'controller' . DIRECTORY_SEPARATOR . 'gallery.controller.inc'; gallery_view(); } if ($arg[0] == 'gallery_category') { require_once DOCUMENT_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'gallery.inc'; require_once DOCUMENT_ROOT . DIRECTORY_SEPARATOR . 'web' . DIRECTORY_SEPARATOR . 'module' . DIRECTORY_SEPARATOR . 'gallery.module.inc'; require_once DOCUMENT_ROOT . DIRECTORY_SEPARATOR . 'web' . DIRECTORY_SEPARATOR . 'controller' . DIRECTORY_SEPARATOR . 'gallery.controller.inc'; gallery_category_view(); } if ($arg[0] == 'pagenotfound') { page_not_found(); }