本文整理汇总了PHP中Zend_Controller_Response_Http::setRedirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Response_Http::setRedirect方法的具体用法?PHP Zend_Controller_Response_Http::setRedirect怎么用?PHP Zend_Controller_Response_Http::setRedirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Response_Http
的用法示例。
在下文中一共展示了Zend_Controller_Response_Http::setRedirect方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: directAction
public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
{
if ($request->getFiltered('INVNUM', $request->getFiltered('INVOICE')) == '') {
$response->setRedirect($this->getRootUrl() . '/thanks');
} else {
parent::directAction($request, $response, $invokeArgs);
}
}
示例2: thanksAction
public function thanksAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
{
$log = $this->logRequest($request, 'POSTBACK [thanks]');
if ($this->invoice = $this->getDi()->invoiceTable->findFirstByPublicId($request->getFiltered('referer'))) {
$log->setInvoice($this->invoice)->update();
$response->setRedirect($this->getReturnUrl());
return;
}
throw new Am_Exception_InputError("Invoice not found");
}
示例3: renderRedirect
/**
* Renders a redirect. Most renderers will actually redirect, but some may not.
*
* @param integer Type of redirect. See {@link XenForo_ControllerResponse_Redirect}
* @param string Target to redirect to
* @param mixed Redirect message (unused by some redirect methods)
* @param array Extra redirect parameters (unused by HTML)
*
* @return string Empty string (nothing to display)
*/
public function renderRedirect($redirectType, $redirectTarget, $redirectMessage = null, array $redirectParams = array())
{
switch ($redirectType) {
case XenForo_ControllerResponse_Redirect::RESOURCE_CREATED:
case XenForo_ControllerResponse_Redirect::RESOURCE_UPDATED:
case XenForo_ControllerResponse_Redirect::SUCCESS:
$this->_response->setRedirect($redirectTarget, 303);
break;
case XenForo_ControllerResponse_Redirect::RESOURCE_CANONICAL:
$this->_response->setRedirect($redirectTarget, 307);
break;
case XenForo_ControllerResponse_Redirect::RESOURCE_CANONICAL_PERMANENT:
$this->_response->setRedirect($redirectTarget, 301);
break;
default:
throw new XenForo_Exception('Unknown redirect type');
}
$this->_needsContainer = false;
return '';
}
示例4: directAction
public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
{
if ($request->getActionName() == 'thanks') {
if ($this->getConfig('debugLog')) {
Am_Di::getInstance()->errorLogTable->log('NetBilling Form [response-thanks]:' . json_encode($request->getParams()));
}
$this->invoice = $this->getDi()->invoiceTable->findFirstByPublicId($request->getFiltered('Ecom_ConsumerOrderID'));
$url = $request->get('Ecom_Ezic_Response_StatusCode') == 0 || $request->get('Ecom_Ezic_Response_StatusCode') == 'F' ? $this->getCancelUrl() : $this->getReturnUrl();
$response->setRedirect($url);
} else {
parent::directAction($request, $response, $invokeArgs);
}
}
示例5: redirect
/**
* Performs a HTTP redirection to specified URL with additional data.
* It may generate redirected request using GET or POST HTTP method.
* The function never returns.
*
* @param string $url URL to redirect to
* @param array $params additional variable/value pairs to send
* @param Zend_Controller_Response_Abstract $response
* @param string $method redirection method ('GET' or 'POST')
*/
public static function redirect($url, $params = null, Zend_Controller_Response_Abstract $response = null, $method = 'GET')
{
$url = Zend_OpenId::absoluteUrl($url);
$body = "";
if (null === $response) {
#require_once "Zend/Controller/Response/Http.php";
$response = new Zend_Controller_Response_Http();
}
if ($method == 'POST') {
$body = "<html><body onLoad=\"document.forms[0].submit();\">\n";
$body .= "<form method=\"POST\" action=\"{$url}\">\n";
if (is_array($params) && count($params) > 0) {
foreach ($params as $key => $value) {
$body .= '<input type="hidden" name="' . $key . '" value="' . $value . "\">\n";
}
}
$body .= "<input type=\"submit\" value=\"Continue OpenID transaction\">\n";
$body .= "</form></body></html>\n";
} else {
if (is_array($params) && count($params) > 0) {
if (strpos($url, '?') === false) {
$url .= '?' . self::paramsToQuery($params);
} else {
$url .= '&' . self::paramsToQuery($params);
}
}
}
if (!empty($body)) {
$response->setBody($body);
} else {
if (!$response->canSendHeaders()) {
$response->setBody("<script language=\"JavaScript\"" . " type=\"text/javascript\">window.location='{$url}';" . "</script>");
} else {
$response->setRedirect($url);
}
}
$response->sendResponse();
if (self::$exitOnRedirect) {
exit;
}
}
示例6: setRedirect
/**
* Additionally check for session messages in several domains case
*
* @param string $url
* @param int $code
* @return Mage_Core_Controller_Response_Http
*/
public function setRedirect($url, $code = 302)
{
/**
* Use single transport object instance
*/
if (self::$_transportObject === null) {
self::$_transportObject = new Varien_Object();
}
self::$_transportObject->setUrl($url);
self::$_transportObject->setCode($code);
Mage::dispatchEvent('controller_response_redirect', array('response' => $this, 'transport' => self::$_transportObject));
return parent::setRedirect(self::$_transportObject->getUrl(), self::$_transportObject->getCode());
}
示例7: action
public function action(array $query, $path, $url, Am_Request $request, Zend_Controller_Response_Http $response)
{
switch ($query['action']) {
case 'delete-file':
$upload = $this->getDi()->uploadTable->load($query['path']);
$usage = $this->getDi()->uploadTable->findUsage($upload);
if (!empty($usage)) {
$response->setBody($this->renderWarning($usage, $url));
} else {
$upload->delete();
$response->setRedirect($url);
}
break;
default:
throw new Am_Exception_InputError('unknown action!');
}
}
示例8: doCancelAction
/**
* Process "cancel recurring" request
* @param Am_Request $request
* @param Zend_Controller_Response_Http $response
* @param array $invokeArgs
*/
public function doCancelAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
{
$id = $request->getFiltered('id');
$invoice = $this->getDi()->invoiceTable->findBySecureId($id, 'STOP' . $this->getId());
if (!$invoice) {
throw new Am_Exception_InputError("No invoice found [{$id}]");
}
if ($invoice->user_id != $this->getDi()->auth->getUserId()) {
throw new Am_Exception_InternalError("User tried to access foreign invoice: [{$id}]");
}
if (method_exists($this, 'cancelInvoice')) {
$this->cancelInvoice($invoice);
}
$invoice->setCancelled();
$response->setRedirect(ROOT_SURL . '/member/payment-history');
}
示例9: directAction
public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
{
$log = $this->logRequest($request);
switch ($request->getActionName()) {
case 'ipn':
// first and rebill payments or subscription cancelled
if ($this->getConfig('debugLog')) {
Am_Di::getInstance()->errorLogTable->log('Payforit. Request[ipn]: ' . json_encode($request->getParams()));
}
if ($request->getInt('stop')) {
if (!in_array($request->getClientIp(), Am_Paysystem_Payforit::$serverIPs)) {
throw new Am_Exception_Paysystem_TransactionInvalid("Bad server IP [{$request->getClientIp()}]");
}
$invoice = Am_Di::getInstance()->invoiceTable->findFirstByPublicId($request->getFiltered('key'));
$invoice->setCancelled(true);
return;
}
if ($request->getFiltered('status') == 'EXPIRED') {
return header("HTTP/1.0 200 OK");
}
$transaction = new Am_Paysystem_Transaction_Payforit($this, $request, $response, $invokeArgs);
try {
$transaction->process();
} catch (Exception $e) {
$this->getDi()->errorLogTable->logException($e);
return header("HTTP/1.0 400 Bad request");
}
$this->invoice = $transaction->getInvoice();
$log->setInvoice($this->invoice)->update();
$response->setRedirect($this->getReturnUrl());
break;
default:
if ($this->getConfig('debugLog')) {
Am_Di::getInstance()->errorLogTable->log('Payforit. Request[default]: ' . json_encode($request->getParams()));
}
return parent::directAction($request, $response, $invokeArgs);
break;
}
}
示例10: thanksAction
public function thanksAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
{
$log = $this->logRequest($request);
$transaction = new Am_Paysystem_Transaction_Twocheckout_Thanks($this, $request, $response, $invokeArgs);
$transaction->setInvoiceLog($log);
try {
$transaction->process();
} catch (Am_Exception_Paysystem_TransactionAlreadyHandled $e) {
// Ignore. Just show receipt.
} catch (Exception $e) {
throw $e;
$this->getDi()->errorLogTable->logException($e);
throw Am_Exception_InputError(___("Error happened during transaction handling. Please contact website administrator"));
}
$log->setInvoice($transaction->getInvoice())->update();
$this->invoice = $transaction->getInvoice();
$response->setRedirect($this->getReturnUrl());
}
示例11: _initCheckAuth
/**
* Execute _initConstants.
*/
protected function _initCheckAuth()
{
//Zend_Controller_Request_Abstract
$this->bootstrap('FrontController');
$this->_front = $this->getResource('FrontController');
$oRouter = $this->_front->getRouter();
$oRequest = new Zend_Controller_Request_Http();
$oRouter->route($oRequest);
$ssModuleName = $oRequest->getModuleName();
$ssControllerName = $oRequest->getControllerName();
$ssActionName = $oRequest->getActionName();
$oAuth = Zend_Auth::getInstance();
if (!$oAuth->hasIdentity()) {
if ($ssControllerName != 'login') {
$oResponse = new Zend_Controller_Response_Http();
$oResponse->setRedirect('/login/index');
$this->_front->setResponse($oResponse);
}
}
}
示例12: cancelPaymentAction
public function cancelPaymentAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
{
$id = $request->getFiltered('id');
if (!$id && isset($_GET['id'])) {
$id = filterId($_GET['id']);
}
$invoice = $this->getDi()->invoiceTable->findFirstByPublicId($id);
if (!$invoice) {
throw new Am_Exception_InputError("No invoice found [{$id}]");
}
if ($invoice->user_id != $this->getDi()->auth->getUserId()) {
throw new Am_Exception_InternalError("User tried to access foreign invoice: [{$id}]");
}
$this->invoice = $invoice;
// find invoice and redirect to default "cancel" page
$response->setRedirect($this->getCancelUrl());
}
示例13: action
public function action(array $query, $path, $url, Am_Request $request, Zend_Controller_Response_Http $response)
{
switch ($query['action']) {
case 'refresh':
$this->getDi()->cacheFunction->clean();
$response->setRedirect($url);
break;
default:
throw new Am_Exception_InputError('unknown action!');
}
}