本文整理汇总了PHP中not_found函数的典型用法代码示例。如果您正苦于以下问题:PHP not_found函数的具体用法?PHP not_found怎么用?PHP not_found使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了not_found函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: start
public static function start($path_info)
{
$path_info = "/" . ltrim($path_info, "/");
$failed = true;
$args;
switch (Request::method()) {
case "GET":
$map = self::$map_get;
break;
case "POST":
$map = self::$map_post;
break;
default:
$map = $map_other_methods;
}
foreach ($map as $re => $fn) {
if (preg_match("/" . str_replace("/", "\\/", $re) . "/", $path_info, $args)) {
array_shift($args);
$args = array_map(function ($arg) {
return urldecode($arg);
}, $args);
try {
call_user_func_array($fn, $args);
$failed = false;
break;
} catch (NextRoute $e) {
}
}
}
if ($failed) {
not_found();
}
}
开发者ID:necota,项目名称:pachira,代码行数:33,代码来源:pachira.php
示例2: getContent
public function getContent()
{
global $sql;
// Strona zabezpieczona wykonuje dwa niepotrzebne zapytania, mimo, że tekst sie nie wyświetla, należy po pierwszym zapytaniu wykonać fetch_assoc
$page = $sql->query('
SELECT * FROM ' . DB_PREFIX . 'subpages
WHERE id = ' . $this->id)->fetch();
// Page does not exist
if (!$page) {
return not_found('Page you have been loking for does not exists.');
} else {
if ($page['permit'] == 0) {
return no_access();
} else {
if (!LOGGED && $page['type'] == 2) {
return no_access(array('Wybrana treść jest dostępna tylko dla zalogowanych osób.', t('REGISTER')));
} else {
Kio::addTitle($page['title']);
Kio::addBreadcrumb($page['title'], $page['id'] . '/' . clean_url($page['title']));
// $this->subcodename = $page['number'];
Kio::addHead($page['head']);
if ($page['description']) {
Kio::setDescription($page['description']);
}
if ($page['keywords']) {
Kio::setKeywords($page['keywords']);
}
return eval('?>' . $page['content']);
}
}
}
}
开发者ID:rafalenden,项目名称:KioCMS,代码行数:32,代码来源:subpage.module.php
示例3: equipe
function equipe($slug)
{
global $twig, $base, $titre;
$personne = R::findOne("personnes", "slug = ?", [$slug]);
if (!$personne) {
return not_found();
}
return $twig->render("equipe.html", compact("base", "titre", "personne"));
}
开发者ID:HE-Arc,项目名称:php-intro-framework,代码行数:9,代码来源:index.php
示例4: get_fb
function get_fb($code)
{
if (!$code) {
not_found();
}
$url = "https://graph.facebook.com/oauth/access_token?" . 'client_id=' . FACEBOOK_APP_ID . '&redirect_uri=http://' . $_SERVER['HTTP_HOST'] . '/api/fb' . '&client_secret=' . FACEBOOK_APP_KEY . '&code=' . urlencode($code);
// var_dump($_SERVER)
// print $url;
$ret = http_get($url);
if (isset($ret['error']) || !isset($ret['access_token'])) {
server_error($ret['error']['message']);
}
$at = $ret['access_token'];
$sig = _gen_sig($at);
$url = "https://graph.facebook.com/me?access_token=" . $at;
$dat = http_get($url);
if (!isset($dat['id'])) {
return server_error('invalid record');
}
$user_id = email_exists($dat['email']);
if (!is_file(get_stylesheet_directory() . '/sdk/cache/' . $dat['id'] . '.jpg')) {
file_put_contents(get_stylesheet_directory() . '/sdk/cache/' . $dat['id'] . '.jpg', file_get_contents(get_bloginfo('template_directory') . '/sdk/timthumb.php?src=http://graph.facebook.com/' . $dat['id'] . '/picture?type=large&w=75&h=75'));
}
if ($user_id) {
// Existing user.
$user_data = get_userdata($user_id);
$user_login = $user_data->user_login;
// @TODO do a check against user meta to make sure its the same user
} else {
// New user.
if (!isset($dat['username'])) {
$dat['username'] = $dat['first_name'] . '_' . $dat['last_name'];
}
$userdata = array('user_login' => $dat['username'], 'user_email' => $dat['email'], 'first_name' => $dat['first_name'], 'last_name' => $dat['last_name'], 'user_url' => $dat['link'], 'user_pass' => wp_generate_password());
$user_id = wp_insert_user($userdata);
if (is_wp_error($user)) {
return server_error('Something went wrong with creating your user.');
}
// switch off the wordpress bar, which is on by default
update_user_meta($user_id, 'show_admin_bar_front', false);
if (is_file(get_stylesheet_directory() . '/sdk/cache/' . $dat['id'] . '.jpg')) {
update_user_meta($user_id, 'hg_profile_url', get_stylesheet_directory_uri() . '/sdk/cache/' . $dat['id'] . '.jpg');
}
}
// log the user in..
wp_set_auth_cookie($user_id, true);
// store login details
update_user_meta($user_id, 'hg_facebook', true);
update_user_meta($user_id, 'hg_facebook_id', $dat['id']);
update_user_meta($user_id, 'hg_facebook_acess_token', $at);
update_user_meta($user_id, 'hg_facebook_sig', $sig);
$json_user_info = json_encode(array('username' => $dat['username'], 'email' => $dat['email'], 'access_token' => $at, 'sig' => $sig));
require_once 'templates/oauth_popup_close.php';
}
开发者ID:nathanwaters,项目名称:HackagongWP,代码行数:54,代码来源:api.php
示例5: run
public function run($uri, $script)
{
$request = $this->getURI($uri, $script);
$path = $request;
if (strpos($request, "?") !== false) {
$path = substr($request, 0, strpos($request, "?"));
}
@(list($class, $action, $params) = explode("/", trim($path, "/"), 3));
if (isset($params)) {
$params = explode("/", $params);
} else {
$params = array();
}
//echo "class:$class action:$action\n";
if (!preg_match("#^[0-9a-z]*\$#", $class) || !preg_match("#^[0-9a-z]*\$#", $action)) {
not_found();
}
if (empty($class)) {
$class = $this->default_class;
}
if (empty($action)) {
$action = $this->default_action;
}
// I'm naming controller and actions like Zend do ;)
$classfile = strtolower($class) . "Controller";
$actionmethod = strtolower($action) . "Action";
// Adds here requires for class hierarchy ...
require_once LIBS . "/AController.php";
$controller_file = MODULES . '/' . strtolower($class) . '/controller.php';
// Now we have class and action and they look nice. Let's instanciate them if possible
if (!file_exists($controller_file)) {
not_found();
}
// We prepare the view array for the rendering of data:
$view = array();
//$view["me"]=$me;
$view["class"] = $class;
$view["action"] = $action;
define("VIEW_DIR", ROOT . "/view");
// We define the view here because the controller class may need it in its constructor ;)
require_once $controller_file;
${$classfile} = new $classfile();
if (!method_exists(${$classfile}, $actionmethod)) {
error("Method not found");
not_found();
}
// We launch the requested action.
// in "<class>Controller" class, we launch "<action>Action" method :
${$classfile}->{$actionmethod}($params);
// This action will either do a redirect(); to point to another page,
// or do a render($viewname) to render a view
}
开发者ID:ninetian,项目名称:omk-server,代码行数:52,代码来源:SimpleRouter.php
示例6: getContent
public function getContent()
{
global $sql;
// $kio->disableRegion('left');
if (u1 || LOGGED) {
// TODO: Zamiast zapytania dla własnego konta dać User::toArray()
$profile = $sql->query('
SELECT u.*
FROM ' . DB_PREFIX . 'users u
WHERE u.id = ' . (ctype_digit(u1) ? u1 : UID))->fetch();
}
if ($profile) {
Kio::addTitle(t('Users'));
Kio::addBreadcrumb(t('Users'), 'users');
Kio::addTitle($profile['nickname']);
Kio::addBreadcrumb($profile['nickname'], 'profile/' . u1 . '/' . clean_url($profile['nickname']));
Kio::setDescription(t('%nickname's profile', array('%nickname' => $profile['nickname'])) . ($profile['title'] ? ' - ' . $profile['title'] : ''));
Kio::addTabs(array(t('Edit profile') => 'edit_profile/' . u1));
if ($profile['birthdate']) {
$profile['bd'] = $profile['birthdate'] ? explode('-', $profile['birthdate']) : '';
// DD Month YYYY (Remaining days to next birthday)
$profile['birthdate'] = $profile['bd'][2] . ' ' . Kio::$months[$profile['bd'][1]] . ' ' . $profile['bd'][0] . ' (' . day_diff(mktime(0, 0, 0, $profile['bd'][1], $profile['bd'][2] + 1, date('y')), t('%d days remaining')) . ')';
$profile['age'] = get_age($profile['bd'][2], $profile['bd'][1], $profile['bd'][0]);
if (Plugin::exists('zodiac')) {
require_once ROOT . 'plugins/zodiac/zodiac.plugin.php';
$profile['zodiac'] = Zodiac::get($profile['bd'][2], $profile['bd'][1]);
}
}
if ($profile['http_agent'] && Plugin::exists('user_agent')) {
require_once ROOT . 'plugins/user_agent/user_agent.plugin.php';
$profile['os'] = User_Agent::getOS($profile['http_agent']);
$profile['browser'] = User_Agent::getBrowser($profile['http_agent']);
}
$group = Kio::getGroup($profile['group_id']);
$profile['group'] = $group['name'] ? $group['inline'] ? sprintf($group['inline'], $group['name']) : $group['name'] : '';
if ($profile['gender']) {
$profile['gender'] = $profile['gender'] == 1 ? t('Male') : t('Female');
}
try {
// TODO: Zrobić modyfikator dla funkcji o wielu parametrach (teraz jest tylko jeden możliwy)
$tpl = new PHPTAL('modules/profile/profile.tpl.html');
$tpl->profile = $profile;
return $tpl->execute();
} catch (Exception $e) {
return template_error($e);
}
} else {
return not_found(t('Selected user doesn't exists.'), array(t('This person was deleted from database.'), t('Entered URL is invalid.')));
}
}
开发者ID:rafalenden,项目名称:KioCMS,代码行数:50,代码来源:profile.module.php
示例7: check_page_path
function check_page_path($path, $prismic, $app)
{
$page_uid = check_page_path1($path, $prismic);
if ($page_uid == null) {
$redirect_url = redirect_path($path, $prismic);
if ($redirect_url != null) {
$app->response->redirect($redirect_url);
}
if ($redirect_url == null) {
not_found($app);
}
}
return $page_uid;
}
开发者ID:arnaudlewis,项目名称:php-websitestarter-virtuoso,代码行数:14,代码来源:http.php
示例8: post_get
function post_get($arr)
{
global $news;
if (in_array('id', array_flip($arr))) {
//у $_POST в данном случае всегда будет параметр 'id'
if (is_numeric($arr['id']) && $arr['id'] <= count($news) && $arr['id'] > 0) {
news_specific($arr['id'] - 1);
} else {
news_all();
}
} elseif ($arr) {
not_found();
} else {
news_all();
}
}
开发者ID:Anatoliy-Bezhenaru,项目名称:xaver.loc,代码行数:16,代码来源:lesson+5+homework.php
示例9: render
public function render($viewname, $variables = array())
{
try {
$viewpath = $this->getFilePath($viewname);
// We extract $variables so that the view can use it to render any data.
extract($variables, EXTR_SKIP);
// Extract the variables to a local namespace
//ob_start(); // Start output buffering
include $viewpath;
// Include the template file
//return ob_get_clean(); // End buffering and return its contents
} catch (Exception $e) {
error($e->getMessage());
not_found();
}
}
开发者ID:ninetian,项目名称:omk-server,代码行数:16,代码来源:AController.php
示例10: get_comic_by_permalink
public function get_comic_by_permalink($PID = 0)
{
global $scdb;
$PID_query = '';
if (is_numeric($PID) && $PID > 0 && ($PID = (int) $PID)) {
$PID_query = " AND `PID` = '{$PID}'";
$this->has_PID = true;
$this->is_index = false;
}
$row = $scdb->get_row("SELECT * FROM `{$scdb->comics}` WHERE `time` <= '" . NOW . "' " . $PID_query . " LIMIT 1", ARRAY_A);
if ($scdb->num_rows === 0) {
return not_found();
}
$this->set_vars($row);
$scdb->query("UPDATE `{$scdb->comics}` SET `views` = `views` + 1 WHERE `PID` = '{$this->PID}' LIMIT 1");
$this->got_comic = true;
}
开发者ID:jclay06,项目名称:scms,代码行数:17,代码来源:comic.class.php
示例11: dispatch
function dispatch()
{
global $routes;
if (!empty($raw_route) and preg_match('/^[\\p{L}\\/\\d]++$/uD', $_SERVER["PATH_INFO"]) == 0) {
die("Invalid URL");
}
$url_pieces = explode("/", $_SERVER["PATH_INFO"]);
$action = $url_pieces[1];
$params = array();
if (count($url_pieces) > 2) {
$params = array_slice($url_pieces, 2);
}
if (empty($action)) {
not_found();
}
if (!in_array($action, array_keys($routes))) {
not_found();
}
include_once "external_utils.php";
$action_function = $routes[$action];
$action_function($params);
}
开发者ID:asimansubera,项目名称:mychembl_webapp,代码行数:22,代码来源:dispatcher.php
示例12: remove_filename_unsafe_chars
$downloadDir = $_GET['download'];
if ($downloadDir == '/') {
$format = '.dir';
$real_filename = remove_filename_unsafe_chars($langDoc . ' ' . $public_code);
} else {
$q = Database::get()->querySingle("SELECT filename, format, visible, extra_path, public FROM document\n WHERE {$group_sql} AND\n path = ?s", $downloadDir);
if (!$q) {
not_found($downloadDir);
}
$real_filename = $q->filename;
$format = $q->format;
$visible = $q->visible;
$extra_path = $q->extra_path;
$public = $q->public;
if (!(resource_access($visible, $public) or isset($status) and $status == USER_TEACHER)) {
not_found($downloadDir);
}
}
// Allow unlimited time for creating the archive
set_time_limit(0);
if ($format == '.dir') {
$real_filename = $real_filename . '.zip';
$dload_filename = $webDir . '/courses/temp/' . safe_filename('zip');
zip_documents_directory($dload_filename, $downloadDir, $can_upload);
$delete = true;
} elseif ($extra_path) {
if ($real_path = common_doc_path($extra_path, true)) {
// Common document
if (!$common_doc_visible) {
forbidden($downloadDir);
}
开发者ID:kostastzo,项目名称:openeclass,代码行数:31,代码来源:index.php
示例13: count
// Redirect to the right URL if the link has a "semantic" uri
if (!empty($link->uri) && !empty($globals['base_story_url'])) {
header ('HTTP/1.1 301 Moved Permanently');
if (!empty($url_args[1])) $extra_url = '/' . urlencode($url_args[1]);
header('Location: ' . $link->get_permalink(). $extra_url);
die;
}
} else {
do_error(_('argumentos no reconocidos'), 404);
}
}
if ($link->is_discarded()) {
// Dont allow indexing of discarded links
if ($globals['bot']) not_found();
} else {
//Only shows ads in non discarded images
$globals['ads'] = true;
}
// Check for a page number which has to come to the end, i.e. ?id=xxx/P or /story/uri/P
$last_arg = count($url_args)-1;
if ($last_arg > 0) {
// Dirty trick to redirect to a comment' page
if (preg_match('/^000/', $url_args[$last_arg])) {
header ('HTTP/1.1 301 Moved Permanently');
if ($url_args[$last_arg] > 0) {
header('Location: ' . $link->get_permalink().get_comment_page_suffix($globals['comments_page_size'], (int) $url_args[$last_arg], $link->comments).'#c-'.(int) $url_args[$last_arg]);
} else {
开发者ID:rasomu,项目名称:chuza,代码行数:31,代码来源:story.php
示例14: indexAction
public function indexAction()
{
not_found();
}
开发者ID:ninetian,项目名称:omk-server,代码行数:4,代码来源:controller.php
示例15: configure
return "Hello, {$name}";
}
}
configure(function () {
$test = 'test';
set(array('views' => dirname(__FILE__) . '/templates'));
});
after(function () {
echo " AFTER!";
});
get("/", function () {
render('form', array('locals' => array('test' => 'test')));
});
template("form", function ($locals) {
echo '<form method="post">
<input type="submit" value="submit" />
</form>';
});
post("/", function () {
echo "post";
});
get("/hello/:name", function ($params) {
pass('/hello/' . $params['name'] . '/test');
});
get("/hello/:name/test", function ($params) {
echo hello($params['name']);
halt(404, 'Go away', array('Content-Type' => 'text/plain'));
});
not_found(function () {
echo "This file wasn't found, yo!";
});
开发者ID:khuliyar,项目名称:Frank.php,代码行数:31,代码来源:index.php
示例16: enableAction
/** Receive a URL to enable a user account */
function enableAction()
{
global $view, $params;
if (!isset($params[0])) {
not_found();
}
$id = intval($params[0]);
$user = mqone("SELECT * FROM user WHERE id={$id};");
if (!$user) {
not_found();
}
mq("UPDATE user SET enabled=1 WHERE id={$id};");
$view["message"] = "The user has been enabled successfully";
$this->indexAction();
}
开发者ID:ludovictant,项目名称:piphone,代码行数:16,代码来源:userController.php
示例17: not_found
$doc = $prismic->get_document($id);
if (!$doc) {
not_found($app);
return;
}
$permalink = $prismic->linkResolver->resolveDocument($doc);
if ($app->request()->getPath() != $permalink) {
// The user came from a URL with an older slug
$app->response->redirect($permalink);
return;
}
$skin = $prismic->get_skin();
// Do we have a template for this type?
$file_path = views_dir() . '/' . $doc->getType() . '.php';
$template = file_exists($file_path) ? $doc->getType() : 'document';
render($app, $template, array('single_post' => $doc, 'skin' => $skin));
});
// Page
// Since pages can have parent pages, the URL can contains several portions
$app->get('/:path+', function ($path) use($app, $prismic) {
$page_uid = check_page_path($path, $prismic, $app);
$skin = $prismic->get_skin();
if ($page_uid) {
$page = $prismic->by_uid('page', $page_uid);
if (!$page) {
not_found($app, $skin);
return;
}
render($app, 'page', array('single_post' => $page, 'skin' => $skin));
}
});
开发者ID:arnaudlewis,项目名称:php-websitestarter-virtuoso,代码行数:31,代码来源:app.php
示例18: meAction
public function meAction($params)
{
global $db;
check_user_identity();
$uid = $GLOBALS['me']['uid'];
$user = $db->qone('SELECT uid, email, enabled, admin, url ' . 'FROM users WHERE uid = :uid', array('uid' => $GLOBALS['me']['uid']));
if ($user == false) {
not_found();
}
if ($params[0] == 'edit') {
$errors = array();
if (!empty($_POST)) {
$errors = self::verifyForm($_POST, 'meedit');
if (empty($errors)) {
$db->q('UPDATE users SET email=? WHERE uid=?', array($_POST['email'], $user->uid));
$old_user = $user;
$user = $db->qone('SELECT uid, email, enabled, admin FROM users WHERE uid = ?', array($user->uid));
$args = array('old_user' => $old_user, 'new_user' => $user);
Hooks::call('users_edit', $args);
if (!empty($_POST['pass'])) {
$db->q('UPDATE users SET pass=? WHERE uid=?', array(crypt($_POST['pass'], Users::getSalt()), $user->uid));
$args = array('uid' => $user->uid, 'email' => $user->email, 'pass' => $_POST['pass']);
Hooks::call('users_edit_pass', $args);
}
// Message + redirection
header('Location: ' . BASE_URL . 'users/me?msg=' . _("User account changed..."));
exit;
}
}
/*
* Valeurs pour pré-remplir le formulaire
*
* Deux cas possibles...
* 1/ On vient d'arriver sur la page ( empty($_POST) ):
* on pré-rempli le formulaire avec les données de l'utilisateur
*
* 2/ On à validé le formulaire, mais il y a une erreur:
* on pré-rempli le formulaire avec les données de la saisie.
*/
if (empty($_POST)) {
$form_data = get_object_vars($user);
// get_object_vars : stdClass -> array
} else {
$form_data = $_POST;
}
$this->render('form', array('op' => 'meedit', 'data' => $form_data, 'errors' => $errors));
} else {
$this->render('me', array('user' => $user, 'contacts' => $contacts));
}
}
开发者ID:ninetian,项目名称:omk-server,代码行数:50,代码来源:controller.php
示例19: PHPTAL
}
$image['thumbs'][] = $row;
}
if ($image['author_id']) {
$image['author'] = User::format($image['author_id'], $image['nickname'], $image['group_id']);
}
// TODO: http://www.pixastic.com/lib/
$image['src'] = 'modules/gallery/images/' . $image['id'] . '.' . $image['file_extension'];
//list($image['width'], $image['height']) = getimagesize(ROOT.$image['src']);
$image['prev'] = $y[$image['current'] - 2];
$image['next'] = $y[$image['current']];
$sql->putCacheContent('gallery_image_' . u2, $image);
}
if ($image['description']) {
$kio->description = $image['name'] . ' - ' . $image['description'];
}
// http://localhost/~kiocms/?images/gallery/15/5-5-0-0-0-0-0-0-0-0-0/biba.jpg
try {
$tpl = new PHPTAL('modules/gallery/image.html');
$tpl->cfg = $cfg;
$tpl->image = $image;
$tpl->thumbs = $image['thumbs'];
$tpl->comments = '';
$tpl->comments = $plug->comments($image['id'], 'gallery_images', $image['comments'], 'gallery/image/' . $image['id'] . '/' . clean_url($image['name']));
echo $tpl->execute();
} catch (Exception $e) {
echo template_error($e);
}
} else {
echo not_found(sprintf('Zdjęcie o numerze <strong>%s</strong> nie istnieje', u2), array('Zdjęcie zostało usunięte z bazy danych', 'Wprowadzony adres jest nieprawidłowy'));
}
开发者ID:rafalenden,项目名称:KioCMS,代码行数:31,代码来源:image.php
示例20: send_file_by_url_file_path
/**
*
* @global type $basedir
* @param type $file_path
* @param type $initial_path
*/
function send_file_by_url_file_path($file_path, $initial_path = '') {
global $basedir;
$path_components = explode('/', str_replace('//', chr(1), $file_path));
$file_info = public_path_to_disk_path($path_components, $initial_path);
if (!send_file_to_client($basedir . $file_info->path, $file_info->filename, null, false)) {
not_found($file_path);
}
exit;
}
开发者ID:nikosv,项目名称:openeclass,代码行数:17,代码来源:show.php
注:本文中的not_found函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论