本文整理汇总了PHP中send_redirect函数的典型用法代码示例。如果您正苦于以下问题:PHP send_redirect函数的具体用法?PHP send_redirect怎么用?PHP send_redirect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了send_redirect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addApproval
function addApproval()
{
global $USERINFO;
global $ID;
global $INFO;
if (!$INFO['exists']) {
msg($this->getLang('cannot approve a non-existing revision'), -1);
return;
}
$approvalRevision = $this->helper->getRevision();
$approvals = $this->helper->getApprovals();
if (!isset($approvals[$approvalRevision])) {
$approvals[$approvalRevision] = array();
}
$approvals[$approvalRevision][$INFO['client']] = array($INFO['client'], $_SERVER['REMOTE_USER'], $USERINFO['mail'], time());
$success = p_set_metadata($ID, array('approval' => $approvals), true, true);
if ($success) {
msg($this->getLang('version approved'), 1);
$data = array();
$data['rev'] = $approvalRevision;
$data['id'] = $ID;
$data['approver'] = $_SERVER['REMOTE_USER'];
$data['approver_info'] = $USERINFO;
if ($this->getConf('send_mail_on_approve') && $this->helper->isRevisionApproved($approvalRevision)) {
/** @var action_plugin_publish_mail $mail */
$mail = plugin_load('action', 'publish_mail');
$mail->send_approve_mail();
}
trigger_event('PLUGIN_PUBLISH_APPROVE', $data);
} else {
msg($this->getLang('cannot approve error'), -1);
}
send_redirect(wl($ID, array('rev' => $this->helper->getRevision()), true, '&'));
}
示例2: handle_act_preprocess
/**
* Handles input from the newform and redirects to the edit mode
*
* @author Andreas Gohr <gohr@cosmocode.de>
* @author Gina Haeussge <osd@foosel.net>
*/
function handle_act_preprocess(&$event, $param)
{
global $TEXT;
global $ID;
if ($event->data != 'btngnew') {
return true;
}
$tools =& plugin_load('helper', 'blogtng_tools');
if (!$tools->getParam('new/title')) {
msg($this->getLang('err_notitle'), -1);
$event->data = 'show';
return true;
}
$event->preventDefault();
$new = $tools->mkpostid($tools->getParam('new/format'), $tools->getParam('new/title'));
if ($ID != $new) {
send_redirect(wl($new, array('do' => 'btngnew', 'btng[post][blog]' => $tools->getParam('post/blog'), 'btng[new][format]' => $tools->getParam('new/format'), 'btng[new][title]' => $tools->getParam('new/title')), true, '&'));
return false;
//never reached
} else {
$TEXT = $this->_prepare_template($new, $tools->getParam('new/title'));
$event->data = 'preview';
return false;
}
}
示例3: handle_start
/**
* handle event
*/
function handle_start(&$event, $param)
{
global $ID;
global $ACT;
if ($ACT != 'show') {
return;
}
$redirects = confToHash($this->getsavedir() . '/shorturl.conf');
if ($redirects[$ID]) {
if (preg_match('/^https?:\\/\\//', $redirects[$ID])) {
send_redirect($redirects[$ID]);
} else {
if ($this->getConf('showmsg')) {
msg(sprintf($this->getLang('redirected'), hsc($ID)));
}
send_redirect(wl($redirects[$ID], '', true));
}
exit;
} else {
if ($_GET['generateShortURL'] != "" && auth_quickaclcheck($ID) >= AUTH_READ) {
$shorturl =& plugin_load('helper', 'shorturl');
if ($shorturl) {
$shortID = $shorturl->autoGenerateShortUrl($ID);
}
}
}
}
示例4: handle_start
function handle_start(&$event, $param)
{
global $ID;
global $ACT;
global $INFO;
if ($ACT != 'show') {
return;
}
if (!$INFO['exists']) {
return;
}
# don't try to read an article that doesn't exist
$all = rtrim(rawWiki($ID));
$inner = substr($all, 2, -2);
if ($all == '[[' . $inner . ']]' and strpos($inner, '[[') === false and strpos($inner, ']]') === false) {
if (!strpos($inner, '://') === false) {
$url = $inner;
# link is URL already
} else {
msg(sprintf('From: <a href="' . wl($ID, 'do=edit') . '">' . hsc($ID) . '</a>'));
$url = html_wikilink($inner, $name = null, $search = '');
$url = substr($url, strpos($url, '"') + 1);
$url = substr($url, 0, strpos($url, '"'));
}
idx_addPage($ID);
# ensure fulltext search indexing of referrer article - to put it on the backlink page of target article
send_redirect($url);
}
}
示例5: getID
/**
* Fetch the an ID from request
*
* Uses either standard $_REQUEST variable or extracts it from
* the full request URI when userewrite is set to 2
*
* For $param='id' $conf['start'] is returned if no id was found.
* If the second parameter is true (default) the ID is cleaned.
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function getID($param = 'id', $clean = true)
{
global $INPUT;
global $conf;
$id = $INPUT->str($param);
//construct page id from request URI
if (empty($id) && $conf['userewrite'] == 2) {
$request = $_SERVER['REQUEST_URI'];
$script = '';
//get the script URL
if ($conf['basedir']) {
$relpath = '';
if ($param != 'id') {
$relpath = 'lib/exe/';
}
$script = $conf['basedir'] . $relpath . utf8_basename($_SERVER['SCRIPT_FILENAME']);
} elseif ($_SERVER['PATH_INFO']) {
$request = $_SERVER['PATH_INFO'];
} elseif ($_SERVER['SCRIPT_NAME']) {
$script = $_SERVER['SCRIPT_NAME'];
} elseif ($_SERVER['DOCUMENT_ROOT'] && $_SERVER['SCRIPT_FILENAME']) {
$script = preg_replace('/^' . preg_quote($_SERVER['DOCUMENT_ROOT'], '/') . '/', '', $_SERVER['SCRIPT_FILENAME']);
$script = '/' . $script;
}
//clean script and request (fixes a windows problem)
$script = preg_replace('/\\/\\/+/', '/', $script);
$request = preg_replace('/\\/\\/+/', '/', $request);
//remove script URL and Querystring to gain the id
if (preg_match('/^' . preg_quote($script, '/') . '(.*)/', $request, $match)) {
$id = preg_replace('/\\?.*/', '', $match[1]);
}
$id = urldecode($id);
//strip leading slashes
$id = preg_replace('!^/+!', '', $id);
}
// Namespace autolinking from URL
if (substr($id, -1) == ':' || $conf['useslash'] && substr($id, -1) == '/') {
if (page_exists($id . $conf['start'])) {
// start page inside namespace
$id = $id . $conf['start'];
} elseif (page_exists($id . noNS(cleanID($id)))) {
// page named like the NS inside the NS
$id = $id . noNS(cleanID($id));
} elseif (page_exists($id)) {
// page like namespace exists
$id = substr($id, 0, -1);
} else {
// fall back to default
$id = $id . $conf['start'];
}
send_redirect(wl($id, '', true));
}
if ($clean) {
$id = cleanID($id);
}
if (empty($id) && $param == 'id') {
$id = $conf['start'];
}
return $id;
}
示例6: handle
public function handle()
{
global $ID;
if (isset($_GET['delete'])) {
$log = $this->loadHelper('log404');
$log->deleteRecord($_GET['delete']);
msg("Records for " . $_GET['delete'] . " have been removed from the 404 log.");
send_redirect(wl($ID, array('do' => 'admin', 'page' => $this->getPluginName()), true, '&'));
}
}
示例7: login
public function login()
{
$login_hint = '';
if (!empty($_SESSION[DOKU_COOKIE]['auth']['info']['mail'])) {
$usermail = $_SESSION[DOKU_COOKIE]['auth']['info']['mail'];
$login_hint = "&login_hint={$usermail}";
}
$url = $this->oAuth->getAuthorizationUri() . $login_hint;
send_redirect($url);
}
示例8: handle
/**
* Should carry out any processing required by the plugin.
*/
public function handle()
{
global $INPUT;
global $ID;
global $config_cascade;
$config_file_path = end($config_cascade['main']['local']);
// form submit
$table = Schema::cleanTableName($INPUT->str('table'));
if ($table && $INPUT->bool('save') && checkSecurityToken()) {
$builder = new SchemaBuilder($table, $INPUT->arr('schema'));
if (!$builder->build()) {
msg('something went wrong while saving', -1);
}
touch($config_file_path);
}
// export
if ($table && $INPUT->bool('export')) {
$builder = new Schema($table);
header('Content-Type: application/json');
header("Content-Disposition: attachment; filename={$table}.struct.json");
echo $builder->toJSON();
exit;
}
// import
if ($table && $INPUT->bool('import')) {
if (isset($_FILES['schemafile']['tmp_name'])) {
$json = io_readFile($_FILES['schemafile']['tmp_name'], false);
if (!$json) {
msg('Something went wrong with the upload', -1);
} else {
$builder = new SchemaImporter($table, $json, $INPUT->bool('lookup'));
if (!$builder->build()) {
msg('something went wrong while saving', -1);
}
touch($config_file_path);
}
}
}
// delete
if ($table && $INPUT->bool('delete')) {
if ($table != $INPUT->str('confirm')) {
msg($this->getLang('del_fail'), -1);
} else {
try {
$schema = new Schema($table);
$schema->delete();
msg($this->getLang('del_ok'), 1);
touch($config_file_path);
send_redirect(wl($ID, array('do' => 'admin', 'page' => 'struct_schemas'), true, '&'));
} catch (StructException $e) {
msg(hsc($e->getMessage()), -1);
}
}
}
}
示例9: login
/**
* Redirects to the service for requesting access
*
* This is the first step of oAuth authentication
*
* This implementation tries to abstract away differences between oAuth1 and oAuth2,
* but might need to be overwritten for specific services
*/
public function login()
{
if (is_a($this->oAuth, 'OAuth\\OAuth2\\Service\\AbstractService')) {
/* oAuth2 handling */
$url = $this->oAuth->getAuthorizationUri();
} else {
/* oAuth1 handling */
// extra request needed for oauth1 to request a request token :-)
$token = $this->oAuth->requestRequestToken();
$url = $this->oAuth->getAuthorizationUri(array('oauth_token' => $token->getRequestToken()));
}
send_redirect($url);
}
示例10: getAccessForm
public function getAccessForm()
{
session_init();
$objSecurity = new Security();
$objSecurity->setCompany(request_var("company"));
$objSecurity->setOffice(request_var("office"));
$objSecurity->setUserId(request_var("uid"));
$objSecurity->setForm(request_var("forma"));
$page = $objSecurity->getAccessForm();
//set_session_var(VAR_MAINPAGE, "../view/{$page}.php");
set_session_var(VAR_MAINPAGE, "../controller/laboratory/controlOrder.php");
send_redirect("../view/main/master.php");
}
示例11: handle_obs_action
/**
* @param Doku_Event $event event object by reference
* @param mixed $param [the parameters passed as fifth argument to register_hook() when this
* handler was registered]
* @return void
*/
public function handle_obs_action(Doku_Event &$event, $param)
{
if ($event->data !== 'show') {
return;
}
global $INFO;
$parts = explode(':', $INFO['id']);
if (count($parts) == 2 && $parts[1] == 'obs') {
if (!empty($INFO['filepath']) && !is_file($INFO['filepath'])) {
// if you are here, obs has not yet been configured in this namespace, so redirect to the setup page
send_redirect(DOKU_URL . 'obs-setup');
}
}
}
示例12: configureUser
public function configureUser()
{
$_response = User::login(request_var('cmbCompany'), request_var('userId'));
if (is_array($_response) && count($_response)) {
session_init();
$objUser = new User();
$objUser->setId($_response["ParticipanteId"]);
$objUser->setIdentification($_response["Identificacion"]);
$objUser->setFirstName($_response["Nombre"]);
$objUser->setLastName($_response["Apellido"]);
$objUser->setFullName($_response["Nombre"] . " " . $_response["Apellido"]);
$objUser->setUsername($_response["UsuarioId"]);
$objUser->setCompany(request_var('cmbCompany'));
$objUser->setOffice(request_var("cmbOffice"));
set_session_var(VAR_USER, $objUser);
send_redirect("../view/main/master.php");
}
}
示例13: handle
/**
* handle user request
*/
function handle()
{
global $ID, $INPUT;
if (!$this->_restore_session()) {
return $this->_close_session();
}
if ($INPUT->int('save') != 1) {
return $this->_close_session();
}
if (!checkSecurityToken()) {
return $this->_close_session();
}
if (is_null($this->_config)) {
$this->_config = new configuration($this->_file);
}
// don't go any further if the configuration is locked
if ($this->_config->_locked) {
return $this->_close_session();
}
$this->_input = $INPUT->arr('config');
while (list($key) = each($this->_config->setting)) {
$input = isset($this->_input[$key]) ? $this->_input[$key] : null;
if ($this->_config->setting[$key]->update($input)) {
$this->_changed = true;
}
if ($this->_config->setting[$key]->error()) {
$this->_error = true;
}
}
if ($this->_changed && !$this->_error) {
$this->_config->save_settings($this->getPluginName());
// save state & force a page reload to get the new settings to take effect
$_SESSION['PLUGIN_CONFIG'] = array('state' => 'updated', 'time' => time());
$this->_close_session();
send_redirect(wl($ID, array('do' => 'admin', 'page' => 'config'), true, '&'));
exit;
} elseif (!$this->_error) {
$this->_config->touch_settings();
// just touch to refresh cache
}
$this->_close_session();
}
示例14: handle_start
/**
* handle event
*/
function handle_start(&$event, $param)
{
global $ID;
global $ACT;
if ($ACT != 'show') {
return;
}
$redirects = confToHash(dirname(__FILE__) . '/redirect.conf');
if ($redirects[$ID]) {
if (preg_match('/^https?:\\/\\//', $redirects[$ID])) {
send_redirect($redirects[$ID]);
} else {
if ($this->getConf('showmsg')) {
msg(sprintf($this->getLang('redirected'), hsc($ID)));
}
$link = explode('#', $redirects[$ID], 2);
send_redirect(wl($link[0], '', true) . '#' . rawurlencode($link[1]));
}
exit;
}
}
示例15: forcessllogin
function forcessllogin(&$event, $param)
{
global $ACT;
$acts = explode(',', $this->getConf('actions'));
if (!is_array($acts)) {
$acts = array();
}
if (!in_array($ACT, $acts)) {
return;
}
if (is_ssl()) {
return;
}
if ($event->name == 'ACTION_ACT_PREPROCESS' && !$this->getConf('splashpage')) {
send_redirect('https://' . $this->host() . DOKU_BASE . DOKU_SCRIPT . '?' . $_SERVER['QUERY_STRING']);
exit;
}
if ($event->name == 'TPL_ACT_RENDER') {
echo $this->locale_xhtml('splashpage');
$this->_render($ACT);
$event->preventDefault();
}
}