当前位置: 首页>>代码示例>>PHP>>正文


PHP Header::redirect方法代码示例

本文整理汇总了PHP中Header::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Header::redirect方法的具体用法?PHP Header::redirect怎么用?PHP Header::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Header的用法示例。


在下文中一共展示了Header::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: before

 public function before()
 {
     $userAccess = new UserAccess();
     if (!$userAccess->isSupport()) {
         if ($this->request->isAjax()) {
             die('{ "ok" : false, "msg" : "Access denied" }');
         } else {
             Header::redirect(URL::baseUrl() . '/login');
         }
     }
     try {
         $pkSupportUserAccess = array('id_support_user' => $_SESSION['support_user']['id_user']);
         $supportUserAccess = $this->orm->support_user_access[$pkSupportUserAccess];
         if (!$supportUserAccess['maintain_user']) {
             $view = View::instance();
             $view->message = 'Access denied';
             $view->render('error');
             die;
         }
     } catch (Exception $e) {
         $view = View::instance();
         $view->message = 'Error occurred';
         $view->render('error');
         die;
     }
 }
开发者ID:sandroalvesperes,项目名称:chat,代码行数:26,代码来源:Users.php

示例2: get_index

 public function get_index()
 {
     $view = View::instance();
     try {
         if (isset($_SESSION['client_user'])) {
             $chat = $this->orm->chat[$_SESSION['client_user']['id_chat']];
             if ($chat['closed']) {
                 unset($_SESSION['client_user']);
             } elseif ($chat['id_support_user']) {
                 Header::redirect(URL::baseUrl() . '/conversation');
             } else {
                 Header::redirect(URL::baseUrl() . '/client/wait');
             }
         }
         $param = $this->orm->param();
         $param->select('value');
         $param->where('name', 'STATUS');
         $supportStatus = $param->fetch();
         $supportUser = $this->orm->support_user();
         $supportUser->where('active', 1);
         $supportUser->and('online', 1);
         $supportOnlineCount = $supportUser->count('id_support_user');
         if ($supportStatus['value'] == 1 && $supportOnlineCount > 0) {
             $view->render('form-client');
         } else {
             $view->render('offline');
         }
     } catch (Exception $e) {
         $view->render('offline');
     }
 }
开发者ID:sandroalvesperes,项目名称:chat,代码行数:31,代码来源:Start.php

示例3: before

 public function before()
 {
     $userAccess = new UserAccess();
     if (!$userAccess->isSupport()) {
         if ($this->request->isAjax()) {
             die('{ "ok" : false, "msg" : "Access denied" }');
         } else {
             Header::redirect(URL::baseUrl() . '/login');
         }
     }
 }
开发者ID:sandroalvesperes,项目名称:chat,代码行数:11,代码来源:Support.php

示例4: setUp

	public function setUp()
	{
		parent::setUp();
		I18n::setLanguage('');
		Session::destroy();
		if ($s = UserSession::get())
		{
			$s->delete();
		}
		Session::$site = 'http://www.test.info/';
		Session::$referrer = 'http://www.test.info/some/part/of/the/site';
		unlink(COORG_TEST_CONFIG);
		copy(COORG_TEST_CONFIG_CLEAN, COORG_TEST_CONFIG);
		$config = new Config(COORG_TEST_CONFIG);
		$config->set('site/title', 'The Site');
		$config->set('defaultLanguage', '');
		CoOrg::init($config, 'app', 'plugins');
		CoOrgSmarty::clearAll();
		Header::$redirect = '__none__';
	}
开发者ID:nathansamson,项目名称:CoOrg,代码行数:20,代码来源:coorg.test.class.php

示例5: get_signOut

 public function get_signOut()
 {
     try {
         $idUser = @$_SESSION['support_user']['id_user'];
         if ($idUser) {
             $this->orm->support_user[$idUser]->update(array('online' => 0, 'typing' => 0, 'last_activity' => new NotORM_Literal('NOW()')));
         }
         if (isset($_SESSION['support_user']) && count($_SESSION) == 1) {
             unset($_SESSION['support_user']);
             session_unset();
             session_destroy();
         } else {
             unset($_SESSION['support_user']);
         }
         Header::redirect(URL::baseUrl() . '/login');
     } catch (Exception $e) {
         $view = View::instance();
         $view->render('error');
     }
 }
开发者ID:sandroalvesperes,项目名称:chat,代码行数:20,代码来源:Login.php

示例6: get_index

 public function get_index()
 {
     try {
         $idChat = @$this->request->get('id', FILTER_VALIDATE_INT);
         $userChat = new UserChat($this->orm, $idChat);
         if (!$userChat->isValid()) {
             if ($userChat->isSupport()) {
                 Header::redirect(URL::baseUrl() . '/login');
             } else {
                 Header::redirect(URL::baseUrl());
             }
         }
         $this->orm->{$userChat->table}[$userChat->idUser]->update(array('typing' => 0, 'last_activity' => new NotORM_Literal('NOW()')));
         $userChat->talkingTo()->sex = str_replace(array('M', 'F'), array('male', 'female'), $userChat->talkingTo()->sex);
         # Get the chat messages
         # ------------------------------------------------------------------
         $chatMessage = $this->orm->chat_message();
         $chatMessage->select('id_chat_message, created, message, sent_by');
         $chatMessage->where('id_chat', $userChat->idChat);
         $chatMessage->order('id_chat_message ASC');
         $messages = array();
         $format = new DateTimeFormat();
         $format->setSupHtmlSuffix(true);
         foreach ($chatMessage as $message) {
             $format->setValue($message['created']);
             $messages[] = array('who' => $userChat->type == $message['sent_by'] ? 'me' : 'you', 'id_chat_message' => $message['id_chat_message'], 'message' => nl2br(htmlspecialchars($message['message'])), 'datetime' => $format->format());
         }
         $view = View::instance();
         $view->idChat = $userChat->idChat;
         $view->messages = $messages;
         $view->talkingTo = $userChat->talkingTo();
         $view->render('conversation');
     } catch (Exception $e) {
         $view = View::instance();
         $view->render('error');
     }
 }
开发者ID:sandroalvesperes,项目名称:chat,代码行数:37,代码来源:Conversation.php

示例7: redirect

	public static function redirect($to)
	{
		$args = func_get_args();
		self::$redirect = CoOrg::createURL($args);
	}
开发者ID:nathansamson,项目名称:CoOrg,代码行数:5,代码来源:header.test.class.php

示例8: redirect

 /**
  * redirect
  * If headers is not sent add status header and redirects
  *
  * @param string $url
  * @param int    $status
  */
 public static function redirect($url = '/', $status = 302)
 {
     Header::redirect($url, $status);
 }
开发者ID:ngfw,项目名称:framework,代码行数:11,代码来源:Route.php

示例9: dirname

<?php

require dirname(__FILE__) . '/__init__.php';
Rhaco::import('generic.Flow');
Rhaco::import('network.http.Header');
$flow = new Flow();
if (!$flow->isVariable('id')) {
    Header::redirect(Rhaco::url());
}
$db = new DbUtil(Event::connection());
if ($flow->isPost() && $flow->isVariable('pass')) {
    $participant = $db->get(new Participant($flow->getVariable('id')));
    if (Variable::istype('Participant', $participant) && $participant->hash === $flow->getVariable('pass')) {
        $db->delete($participant);
        Header::redirect(Rhaco::url());
    }
}
$flow->setVariable('hatena', Rhaco::obj('HatenaSyntax', array('headlevel' => 4, 'id' => 'event_description')));
$flow->write('cancel.html');
开发者ID:riaf,项目名称:jp.rhaco-users.kaigi,代码行数:19,代码来源:cancel.php

示例10: __construct

 public function __construct($uri)
 {
     Header::redirect($uri);
     exit;
 }
开发者ID:jacobemerick,项目名称:web,代码行数:5,代码来源:Error301Controller.class.inc.php

示例11: upload

 function upload()
 {
     if ($this->isPost() && $this->isFile('stage')) {
         $file = $this->getFile('stage');
         $src = mb_convert_encoding(file_get_contents($file->tmp), 'utf-8', 'Shift_JIS,EUC-JP,UTF-8');
         if (SimpleTag::setof($tag, $src, 'body', true)) {
             foreach ($tag->getIn('applet') as $applet) {
                 if ($applet->getParameter('code') != 'MasaoConstruction') {
                     continue;
                 }
                 $gamedata = array();
                 foreach ($applet->getIn('param') as $param) {
                     $gamedata[$param->getParameter('name')] = array('name' => $param->getParameter('name'), 'value' => $param->getParameter('value'));
                 }
                 if (empty($gamedata)) {
                     break;
                 }
                 $stage = $this->dbUtil->insert($this->toObject(new Stage()));
                 if (!Variable::istype('Stage', $stage)) {
                     break;
                 }
                 $_images = array('title', 'ending', 'gameover', 'pattern', 'chizu');
                 foreach ($_images as $k) {
                     if (!isset($gamedata[sprintf("filename_%s", $k)])) {
                         continue;
                     }
                     $gamedata[sprintf("filename_%s", $k)] = array('name' => sprintf("filename_%s", $k), 'value' => 'images/' . $k . '.gif');
                     if ($this->isFile('img_' . $k)) {
                         $image = $this->getFile('img_' . $k);
                         $img_info = getimagesize($image->tmp);
                         if ($img_info[2] != IMAGETYPE_GIF) {
                             continue;
                         }
                         $filename = Rhaco::path(sprintf('images/%s_%d.gif', $k, $stage->id));
                         if (move_uploaded_file($image->tmp, $filename)) {
                             $gamedata[sprintf("filename_%s", $k)] = array('name' => sprintf("filename_%s", $k), 'value' => sprintf("images/%s_%d.gif", $k, $stage->getId()));
                         }
                     }
                 }
                 FileUtil::write(Rhaco::path(sprintf('stages/%d.apif', $stage->id)), serialize($gamedata));
                 Header::redirect(Rhaco::url());
                 Rhaco::end();
             }
         }
     }
     return $this->parser('upload.html');
 }
开发者ID:riaf,项目名称:concert,代码行数:47,代码来源:ConcertView.php

示例12: redirectOnSuccess

	public function redirectOnSuccess($commentOn)
	{
		Header::redirect('blog/show', $commentOn->year,
		                              $commentOn->month,
		                              $commentOn->day,
		                              $commentOn->ID);
	}
开发者ID:nathansamson,项目名称:CoOrg,代码行数:7,代码来源:blog.comment.controller.php

示例13: validateSession

 /**
  * Validates the user session to allow or deny access
  *
  * @access private
  * @return void
  */
 private function validateSession()
 {
     if (!UserAccess::isClient()) {
         if ($this->request->isAjax()) {
             die('{ "ok" : false, "msg" : "Access denied" }');
         } else {
             Header::redirect(URL::baseUrl());
         }
     }
 }
开发者ID:sandroalvesperes,项目名称:chat,代码行数:16,代码来源:Client.php

示例14: redirectOnSuccess

	protected function redirectOnSuccess($from)
	{
		Header::redirect($from);
	}
开发者ID:nathansamson,项目名称:CoOrg,代码行数:4,代码来源:admin.comments.controller.php

示例15: handlePOST

 /**
  * Handles POST data while AJAX request.
  * It works like {Controller::handlePOST} and signaatures will be checked unless 
  * form is on the current page and <code>no_check</code> attribute is not specified.
  *
  * Typical use-case of this function is posting form with javascript with 
  * <code>$(form).serialize()</code> method or <code>ajaxSubmit</code> from
  * jquert.form plugin.
  *
  * Instead of redirects, like in <code>Controller::handlePOST()</code>
  * method, <code>exit()</code> calls will be used.
  *
  * Another difference is that no "save form values and show error boxes" sequence 
  * is used. If some checker of validator error are present, <code>exit()</code>
  * will terminate futher form processing.
  *
  * Additionally, unlike <code>Controller::handlePOST</code>, handler methods could specify 
  * <code>responce_string</code> to return status of form processing. It will be echo'ed at once.
  * 
  * @param null
  * @return null
  */
 protected function handlePOST()
 {
     $this->trigger("BeforeHandlePOST", $this);
     if ($this->post->isEmpty()) {
         Header::redirect(requestURI(true), Header::SEE_OTHER);
     }
     $formid = null;
     WidgetLoader::load("WForm");
     list($formid) = explode(":", $this->post->{WForm::signature_name});
     if (!empty($formid) && !in_array($formid, $this->no_check_forms)) {
         $this->trigger("BeforeCheckSignature", $this);
         if (!$this->checkSignature($this->post->{WForm::signature_name})) {
             exit("Error while checking POST data 1");
         }
         POSTErrors::flushErrors();
         $this->trigger("BeforeCheckByRules", array(&$this->post, $this->post->{WForm::signature_name}));
         POSTChecker::checkByRules($this->post->{WForm::signature_name}, $this->checker_rules, $this->checker_messages);
         POSTChecker::checkFiles($this->post->{WForm::signature_name}, $this->file_rules, $this->checker_messages);
         if (POSTErrors::hasErrors()) {
             //Header::redirect(requestURI(true), Header::SEE_OTHER);
             exit("Error while checking POST data 2");
         }
         $this->trigger("BeforeCallHandlers", array($this, &$formid));
         try {
             DataUpdaterPool::callCheckers($formid);
         } catch (CheckerException $e) {
             exit("Error " . $e->getMessage() . " in widget " . $e->getWidgetName);
         }
         DataUpdaterPool::callHandlers($formid);
         DataUpdaterPool::callFinalize($formid);
     } else {
         try {
             DataUpdaterPool::callCheckers($formid);
         } catch (CheckerException $e) {
             exit("Error " . $e->getMessage() . " in widget " . $e->getWidgetName);
         }
         DataUpdaterPool::callHandlers($formid);
         DataUpdaterPool::callFinalize($formid);
     }
     $this->trigger("AfterHandlePOST", $this);
     if (isset($this->response_string)) {
         $this->trigger("AfterHeadBodyTailResponce", array($this, &$this->response_string));
         echo $this->response_string;
     }
 }
开发者ID:point,项目名称:cassea,代码行数:67,代码来源:Controller.php


注:本文中的Header::redirect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。