function my404($data) { $shorturl = $data[0]; include_once dirname(__FILE__) . '/../../404.php'; show404($shorturl); exit; }
function OnActionView() { global $user, $data, $db, $u_pid, $u_pid, $u_aid; if ($u_pid > -1) { $data['post'] = $db->GetPost($u_pid); if (is_null($data['post'])) { show404(); } $data['articles'] = $db->GetArticlesSummary($u_pid); if (is_null($data['articles'])) { show404(); } //施工中 if ($u_aid == -1) { //未设置第几篇则默认为第一篇 $u_aid = $data['articles'][0]->aid; } $data['current_article'] = $db->GetArticleDetail($u_pid, $u_aid); if (is_null($data['current_article'])) { show404(); } ShowTemplatePage("article"); } else { $data['posts'] = $db->GetPosts(); ShowTemplatePage("index"); } }
public function route($uri) { //remove the leading slash $uri = preg_replace("/^\\//", "", $uri); //Overwrite base case to index if (trim($uri) === "") { $uri = "index"; } //split the arguments on forward slash $uri = explode("/", $uri); //the first argument is the controller method $method = array_shift($uri); //instantiate the controller $controller = new Controller(); //create a callable array with the controller and the string containing the method which was requested. $callable = array($controller, $method); if (is_callable($callable)) { try { //try calling the method, passing any extra parameters as variables to the method. call_user_func_array($callable, $uri); } catch (Exception $e) { //We'll show a 404 because the URL didn't have enough arguments. if ($e->getCode() === GROFF_ERROR_ARGUMENTS) { show404(); throw $e; } else { throw $e; } } } else { show404(); } }
public function _execute($func) { if (!isset($this->{$func}) || !is_callable($this->{$func})) { show404(); } else { $this->{$func}(); } }
<?php /*! * Traq Lite * Copyright (c) 2009-2016 Jack P. * https://github.com/nirix/traq-lite * * Licensed under the BSD 3-Clause license. */ use Traq\Models\User; $query = db()->prepare('SELECT * FROM ' . PREFIX . 'users WHERE id = ? LIMIT 1'); $query->bindValue(1, Request::$properties['id']); $query->execute(); $user = $query->fetch(); if (!$user) { return show404(); } $user = new User($user); if (Request::$method == 'POST') { $user->set(['name' => Request::$post['name'], 'username' => Request::$post['username'], 'email' => Request::$post['email'], 'group_id' => Request::$post['group_id']]); if ($user->validate()) { db()->beginTransaction(); $query = db()->prepare("\n UPDATE " . PREFIX . "users\n SET name = :name,\n username = :username,\n email = :email,\n group_id = :group_id\n WHERE id = :id\n LIMIT 1\n "); $query->bindValue(':id', $user['id'], PDO::PARAM_INT); $query->bindValue(':name', $user['name'], PDO::PARAM_STR); $query->bindValue(':username', $user['username'], PDO::PARAM_STR); $query->bindValue(':email', $user['email'], PDO::PARAM_STR); $query->bindValue(':group_id', $user['group_id'], PDO::PARAM_INT); $query->execute(); db()->commit(); return redirect('/admin/users');
public function not_found() { show404(); }
$url = 'https://graph.facebook.com/' . $fbid . '/photos'; } else { include '../pages/404.php'; die; } } elseif ($type == 'folder') { /* Local Folder Example filename : ../../img/yaay/ 1. This needs knowledge of server.*/ if (isset($_REQUEST['folder_name'])) { $folder_name = $_REQUEST['folder_name']; } else { show404(); } if (!is_dir($folder_name)) { show404(); } } ?> <?php if (isset($iframe) && $iframe) { include '../base/menu.php'; ?> <div class="container-fluid white centered" style="margin-bottom:2%"> <div class="row"> <div class="col-xs-12"> <h1 class="text-center title"><?php echo $title; ?> </h1>
<html> <head> <title>Verify Account</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <?php include 'functions.php'; /*check exists*/ if (!isset($_GET['email']) || !login_demo($_GET['email'])) { $msg = 'Không tìm thấy trang này, liên hệ: 01663.930.250<br/>'; $msg .= 'Nhấn vào đây để tạo tài khoản demo.<a href="demo.php">Create Account</a>'; show404($msg); } //verify if (isset($_POST['submit'])) { $update = array('phone' => $_POST['phone'], 'fullname' => $_POST['fullname']); $r = verify_account($_POST['email'], $_POST['activation_code'], $update); if ($r) { $logs[] = 'Tài khoản của bạn đã được xác thực thành công ! Nhấn vào đây để đăng nhập: <a href="demo.php">Đăng nhập</a>'; } else { $logs[] = 'Sai code, tài khoản của bạn chưa được xác thực. Nhấn <a href="demo.php">vào đây</a> để gửi lại code.'; } } //show logs show_logs(); ?> <!-- activation form --> <h2>Activation Code</h2> <form method="post"> <input type="hidden" name="email" value="<?php
$not_found = true; if (isset($PLUGINS[$PAGEDATA->type])) { $p = $PLUGINS[$PAGEDATA->type]; if (isset($p['frontend']['page_type']) && function_exists($p['frontend']['page_type'])) { $c .= $p['frontend']['page_type']($PAGEDATA); $not_found = false; } } if ($not_found) { $c .= '<em>No plugin found to handle page type <strong>' . htmlspecialchars($PAGEDATA->type) . '</strong>. Is the plugin installed and enabled?</em>'; } // } } if ($c == '' && !$id) { // delete this if it's never called by March 2011 $c = show404(str_replace('/', ' ', $_SERVER['REQUEST_URI'])); } } } if (isset($PLUGINS['comments'])) { $c .= plugin_trigger('page-content-created'); } $pagecontent = $c . '<span class="end-of-page-content"></span>'; // } // { load page template if (isset($_REQUEST['__t']) && !preg_match('/[\\.\\/]/', $_REQUEST['__t'])) { $PAGEDATA->template = $_REQUEST['__t']; } if (file_exists(THEME_DIR . '/' . THEME . '/h/' . $PAGEDATA->template . '.html')) { $template = THEME_DIR . '/' . THEME . '/h/' . $PAGEDATA->template . '.html'; } else {
function fetchImage($id, $type = 'Character', $size = 128, $ext = "jpg") { include_once 'kbconfig.php'; require_once 'common/includes/globals.php'; require_once "common/includes/class.cachehandler.php"; $url = 'http://' . IMG_SERVER . "/" . $type . "/" . $id . "_" . $size . "." . $ext; if (function_exists('curl_init')) { // in case of a dead eve server we only want to wait 2 seconds @ini_set('default_socket_timeout', 2); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2); // CURLOPT_FOLLOWLOCATION doesn't work if safe mode or open_basedir is set // For pilots we should try from oldportraits.eveonline.com if the main server doesn't have them. //if($type != 'Character') curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); //curl_setopt($ch, CURLOPT_HEADER, true); $file = curl_exec($ch); //list($header, $file) = explode("\n\n", $file, 2); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($http_code != 200) { if ($type == 'Character') { $url = "http://oldportraits.eveonline.com/Character/" . $id . "_" . $size . "." . $ext; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $file = curl_exec($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($http_code != 200) { $file = file_get_contents("img/1_{$size}.jpg"); } } else { if ($type == 'Alliance') { $file = file_get_contents("img/alliances/default.png"); } else { if ($type == 'Corporation') { $file = file_get_contents("img/corps/default.png"); } else { show404(); } } } } curl_close($ch); } else { require_once 'common/includes/class.httprequest.php'; // in case of a dead eve server we only want to wait 2 seconds @ini_set('default_socket_timeout', 2); // try alternative access via fsockopen // happens if allow_url_fopen wrapper is false $http = new http_request($url); $file = $http->get_content(); $http_code = $http->get_http_code(); if ($http_code != 200) { if ($type == 'Character') { $url = "http://oldportraits.eveonline.com/Character/" . $id . "_" . $size . "." . $ext; $http = new http_request($url); $file = $http->get_content(); $http_code = $http->get_http_code(); if ($http_code != 200) { $file = file_get_contents("img/1_{$size}.jpg"); } } else { if ($type == 'Alliance') { $file = file_get_contents("img/alliances/default.png"); } else { if ($type == 'Corporation') { $file = file_get_contents("img/corps/default.png"); } else { show404(); } } } } } if ($img = @imagecreatefromstring($file)) { CacheHandler::put($id . '_' . $size . '.' . $ext, $file, 'img'); } return $img; }
<?php $autoloader = (require __DIR__ . '/vendor/autoload.php'); define('START_TIME', microtime(true)); define('START_MEM', memory_get_usage()); try { (new Traq\Kernel())->run(); } catch (Unf\NoRouteFoundException $e) { echo show404(); }