本文整理汇总了PHP中Http::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::redirect方法的具体用法?PHP Http::redirect怎么用?PHP Http::redirect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Http
的用法示例。
在下文中一共展示了Http::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _defaultPage
private function _defaultPage($slug)
{
switch ($slug) {
case 'home':
case 'contact':
//init security (crsf and captcha)
$security = Security::getSecurity(Security::TYPE_FORM);
$crsf = $security->getProtection('form1', Form::PROTECTION_CSRF);
$crsf->create();
$captcha = $security->getProtection('form1', Form::PROTECTION_CAPTCHA);
$this->tpl->setVar('captchaImageUrl', $captcha->get('image', true), false, true)->setVar('captchaAudioUrl', $captcha->get('audio', true), false, true)->setVar('captchaRefreshUrl', $captcha->getRefreshUrl(), false, true);
$this->tpl->setVar('token', $crsf->get(), false, true);
//define vars and overwrite template
if ($slug == 'contact') {
$this->tpl->setFile('controllers' . DS . 'Pages' . DS . 'contact.tpl.php');
} elseif ($slug == 'register') {
if (Member::isConnected()) {
Http::redirect($this->router->getUrl('index'));
}
$this->tpl->setFile('controllers' . DS . 'Pages' . DS . 'register.tpl.php');
} else {
$this->tpl->setVar('news', $this->_readAll('new'), false, true);
$this->tpl->setFile('controllers' . DS . 'Pages' . DS . 'index.tpl.php');
}
//set in session
$crsf->set();
break;
case 'news':
$this->tpl->setVar('news', $this->_readAll('new'), false, true);
$this->tpl->setFile('controllers' . DS . 'Pages' . DS . 'news.tpl.php');
default:
break;
}
}
示例2: logout
function logout()
{
$_SESSION = array();
session_destroy();
Http::unautorize();
Http::redirect("/");
}
示例3: new_story
function new_story()
{
$title = StoryTime::titleGenerator();
$uri = StoryTime::URIGenerator();
$story = array('uri' => $uri, 'title' => $title, 'body' => '', 'started_at' => $this->db->now());
$id = $this->db->insert('story', $story);
if (!$id) {
echo $this->db->getLastError();
} else {
Http::redirect('/Main/story/' . $uri);
}
}
示例4: _redirect
private static function _redirect($values)
{
if (isset($values['url']) == false) {
return false;
}
$url = Basic::handle($values['url']);
if (isset($values['ms'])) {
$ms = Basic::handle($values['ms']);
return Http::redirect($url, $ms);
}
return Http::redirect($url);
}
示例5: update
public function update()
{
$group = Http::post("group");
$group_id = Http::post("group_id");
$permissions = Http::post("permission");
$permission_model = DB::loadModel("users/permissions");
$group_model = DB::loadModel("users/groups");
$group_model->updateGroup($group_id, $group);
$pids = array();
foreach ($permissions as $id => $val) {
$pids[] = $id;
}
$permission_model->setPermissions($group_id, $pids);
Http::redirect("/user_groups");
}
示例6: update
public function update()
{
$user = Http::post("user");
$user_id = Http::post("user_id");
$user["is_admin"] = $user["is_admin"] == "on" ? 1 : 0;
$groups = Http::post("groups");
$groups_ids = array();
foreach ($groups as $id => $group) {
$groups_ids[] = $id;
}
$user_model = DB::loadModel("users/user");
$user_groups_model = DB::loadModel("users/groups");
$user_model->update($user_id, $user);
$user_groups_model->setGroups($user_id, $groups_ids);
Http::redirect("/users");
}
示例7: index
function index()
{
$user = $this->registry->get("user");
if (!$user->has_permission("client/maps/search")) {
Http::redirect('/');
exit;
}
$this->registerModule("client/common/client_menu", "left_side");
$this->registerModule("map/map", "center_side");
//$this->registerModule("client/maps/search/maps_search_filter", "right_side");
// $regions_model = DB::loadModel("maps/regions");
// $regions = $regions_model->getAll();
$smarty = $this->registry->get("smarty");
$smarty->assign("regions", $regions);
$smarty->assign("page", "maps_search");
$smarty->assign("title", "Адміністративний пошук");
$this->display();
}
示例8: save
function save()
{
$database = Http::post("database");
$database_external = Http::post("database_external");
$auth = Http::post("auth");
$ad_server = Http::post("ad_server");
if (!is_null($database) && !is_null($database_external) && !is_null($auth) && !is_null($ad_server)) {
$config = new Config();
$config->set("/settings/database/host", $database["host"]);
$config->set("/settings/database/name", $database["name"]);
$config->set("/settings/database/user", $database["user"]);
$config->set("/settings/database/pass", $database["pass"]);
$config->set("/settings/database_external/host", $database_external["host"]);
$config->set("/settings/database_external/name", $database_external["name"]);
$config->set("/settings/database_external/user", $database_external["user"]);
$config->set("/settings/database_external/pass", $database_external["pass"]);
$config->set("/settings/auth/mode", $auth["mode"]);
$config->set("/settings/ad_server/address", $ad_server["address"]);
$config->set("/settings/ad_server/account_sufix", $ad_server["account_sufix"]);
$config->set("/settings/ad_server/base_dn", $ad_server["base_dn"]);
}
Http::redirect("/system");
}
示例9:
<?php
require 'libraries/start.php';
// install
if (!is_file('install.log')) {
Http::redirect('install.php');
} else {
Http::redirect('xhtml.php');
}
示例10: do_create
public function do_create($name)
{
if ($this->login()) {
$class = $this->get_class($name);
$tools = new CrudTools($name);
if ($this->isPost()) {
try {
$class->set_model($this->vars());
$class->save();
C($class)->commit();
Http::redirect($tools->link_find());
} catch (Exception $e) {
}
} else {
$this->cp($class);
}
$this->vars("model", $class);
$this->vars("f", $tools);
$this->template(Rhaco::module_path("templates/update.html"));
}
return $this;
}
示例11: route
public function route($app, $action)
{
if (!empty(Core::$user->id)) {
foreach (['edit', 'conf'] as $v) {
if (isset($_REQUEST[$v]) && Core::$user->has($v)) {
$_SESSION['pe_' . substr($v, 0, 1)] = !empty($_REQUEST[$v]);
Http::redirect();
}
}
}
if (Core::$core->app == 'login') {
if (Core::$user->id) {
Http::redirect('/');
}
$A = 'admin';
if (Core::isTry() && !empty($_REQUEST['id'])) {
if ($_REQUEST['id'] == $A && !empty(Core::$core->masterpasswd) && password_verify($_POST['pass'], Core::$core->masterpasswd)) {
$_SESSION['pe_u']->id = -1;
$_SESSION['pe_u']->name = $A;
} else {
Core::event("login", [$_REQUEST['id'], $_POST['pass']]);
}
if (!empty($_SESSION['pe_u']->id)) {
Core::log('A', 'Login ' . $_SESSION['pe_u']->name, 'users');
Http::redirect();
} else {
Core::error(L('Bad username or password'), 'id');
}
}
} elseif (Core::$core->app == 'logout') {
$i = Core::$user->id;
if ($i) {
Core::log('A', 'Logout ' . Core::$user->name, 'users');
if ($i != -1) {
Core::event("logout");
}
}
session_destroy();
Http::redirect('/');
}
}
示例12: require_once
$_REQUEST['id'] = $thisclient->getTicketId();
require_once(INCLUDE_DIR.'class.ticket.php');
require_once(INCLUDE_DIR.'class.json.php');
$ticket=null;
if($_REQUEST['id']) {
if (!($ticket = Ticket::lookup($_REQUEST['id']))) {
$errors['err']=__('Unknown or invalid ticket ID.');
} elseif(!$ticket->checkUserAccess($thisclient)) {
$errors['err']=__('Unknown or invalid ticket ID.'); //Using generic message on purpose!
$ticket=null;
}
}
if (!$ticket && $thisclient->isGuest())
Http::redirect('view.php');
$tform = TicketForm::objects()->one();
$messageField = $tform->getField('message');
$attachments = $messageField->getWidget()->getAttachments();
//Process post...depends on $ticket object above.
if($_POST && is_object($ticket) && $ticket->getId()):
$errors=array();
switch(strtolower($_POST['a'])){
case 'edit':
if(!$ticket->checkUserAccess($thisclient) //double check perm again!
|| $thisclient->getId() != $ticket->getUserId())
$errors['err']=__('Access Denied. Possibly invalid ticket ID');
elseif (!$cfg || !$cfg->allowClientUpdates())
$errors['err']=__('Access Denied. Client updates are currently disabled');
示例13: Copyright
Jared Hancock <jared@osticket.com>
Copyright (c) 2006-2013 osTicket
http://www.osticket.com
Released under the GNU General Public License WITHOUT ANY WARRANTY.
See LICENSE.TXT for details.
vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/
require_once 'staff.inc.php';
//Basic url validation + token check.
# PHP < 5.4.7 will not handle a URL like //host.tld/path correctly
if (!($url=trim($_GET['url'])))
Http::response(422, __('Invalid URL'));
$check = (strpos($url, '//') === 0) ? 'http:' . $url : $url;
if (!Validator::is_url($check) || !$ost->validateLinkToken($_GET['auth']))
Http::response(403, __('URL link not authorized'));
elseif (strpos($_SERVER['HTTP_ACCEPT'], 'text/html') === false)
Http::redirect($url);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta http-equiv="refresh" content="0;URL=<?php echo $url; ?>"/>
</head>
<body/>
</html>
示例14: afterForInsert
function afterForInsert($insert_id)
{
Http::redirect('index.php?c=maintain&a=list');
}
示例15: handler
/**
* URLのパターンからTemplateを切り替える
* @param array $urlconf
*/
public function handler(array $urlconf = array())
{
$params = array();
foreach ($urlconf as $pattern => $conf) {
if (is_int($pattern)) {
$pattern = $conf;
$conf = null;
}
if (preg_match("/" . str_replace(array("\\/", "/", "__SLASH__"), array("__SLASH__", "\\/", "\\/"), $pattern) . "/", $this->args(), $params)) {
if ($conf !== null) {
if (is_array($conf)) {
if (isset($conf["class"])) {
$this->class = $conf["class"];
}
if (isset($conf["method"])) {
$this->method = $conf["method"];
}
if (isset($conf["template"])) {
$this->template = $conf["template"];
}
if (isset($conf["name"])) {
$this->name = $conf["name"];
}
} else {
$this->dict($conf);
}
}
self::$match_pattern = empty($this->name) ? $params[0] : $this->name;
if (!empty($this->class)) {
if (false !== strrpos($this->class, ".") || !class_exists($this->class)) {
$this->class = Rhaco::import($this->class);
}
if (empty($this->method) && !empty($pattern)) {
$method_patterns = array();
$patterns = explode("/", $pattern);
if ($patterns[0] == "^") {
array_shift($patterns);
}
foreach ($patterns as $p) {
if (!preg_match("/[\\w_]/", $p)) {
break;
}
$method_patterns[] = $p;
}
if (!empty($method_patterns)) {
$this->method = implode("_", $method_patterns);
}
}
}
if (empty($this->method) && !empty($this->template)) {
$obj = new self();
$obj->copy_module($this, true);
$obj->template($this->template);
} else {
$method = empty($this->method) ? "index" : $this->method;
if (!method_exists($this->class, $method)) {
throw new Exception("Not found " . $this->class . "::" . $method);
}
array_shift($params);
try {
$class = $this->class;
$action = new $class();
$action->copy_module($this, true);
if ($action instanceof self) {
$action->handled();
}
$obj = call_user_func_array(array($action, $method), $params);
} catch (Exception $e) {
Log::debug($e);
$on_error = Rhaco::def("core.Flow@on_error");
if ($on_error === null) {
throw $e;
}
if (isset($on_error[0])) {
Http::status_header((int) $on_error[0]);
}
if (isset($on_error[2])) {
Http::redirect($on_error[2]);
}
if (isset($on_error[1])) {
$template = new Template();
$template->output($on_error[1]);
}
exit;
}
}
if ($obj instanceof self) {
$obj = $obj->templ();
}
if (!$obj instanceof Template) {
throw new Exception("Forbidden " . $this->args());
}
$obj->path($this->path());
$obj->url($this->url());
$this->templ = $obj;
if (!$this->isTemplate()) {
//.........这里部分代码省略.........