本文整理汇总了PHP中Am_Controller::redirectLocation方法的典型用法代码示例。如果您正苦于以下问题:PHP Am_Controller::redirectLocation方法的具体用法?PHP Am_Controller::redirectLocation怎么用?PHP Am_Controller::redirectLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Am_Controller
的用法示例。
在下文中一共展示了Am_Controller::redirectLocation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* This function is likely never returns
* but anyway handle result and exceptions
* @return Am_Paysystem_Result
*/
function process()
{
$err = $this->invoice->validate();
if ($err) {
throw new Am_Exception_InputError($err[0]);
}
$this->invoice->save();
$plugin = Am_Di::getInstance()->plugins_payment->loadGet($this->invoice->paysys_id);
$this->result = new Am_Paysystem_Result();
$plugin->processInvoice($this->invoice, $this->controller->getRequest(), $this->result);
if ($this->result->isSuccess() || $this->result->isFailure()) {
if ($transaction = $this->result->getTransaction()) {
$transaction->setInvoice($this->invoice);
$transaction->process();
}
}
if ($this->result->isSuccess()) {
$url = REL_ROOT_URL . "/thanks?id=" . $this->invoice->getSecureId('THANKS');
$this->callback($this->onSuccess);
$this->controller->redirectLocation($url, ___("Invoice processed"), ___("Invoice processed successfully"));
// no return Am_Exception_Redirect
} elseif ($this->result->isAction()) {
$this->callback($this->onAction);
$this->result->getAction()->process($this->controller);
// no return Am_Exception_Redirect
} else {
// ($result->isFailure()) {
$this->callback($this->onFailure);
}
return $this->result;
}
示例2: process
/**
* This function is likely never returns
* but anyway handle result and exceptions
* @return Am_Paysystem_Result
*/
function process()
{
Am_Di::getInstance()->hook->call(Am_Event::INVOICE_BEFORE_PAYMENT, array('invoice' => $this->invoice, 'controller' => $this->controller));
$plugin = Am_Di::getInstance()->plugins_payment->loadGet($this->invoice->paysys_id);
$this->result = new Am_Paysystem_Result();
$plugin->processInvoice($this->invoice, $this->controller->getRequest(), $this->result);
if ($this->result->isSuccess() || $this->result->isFailure()) {
if ($transaction = $this->result->getTransaction()) {
$transaction->setInvoice($this->invoice);
$transaction->process();
}
}
if ($this->result->isSuccess()) {
if (method_exists($this->controller, 'getForm')) {
$this->controller->getForm()->getSessionContainer()->destroy();
}
$url = REL_ROOT_URL . "/thanks?id=" . $this->invoice->getSecureId('THANKS');
$this->callback($this->onSuccess);
$this->controller->redirectLocation($url);
// no return
// Am_Exception_Redirect only for APPLICATION_ENV = 'testing'
} elseif ($this->result->isAction()) {
if (method_exists($this->controller, 'getForm')) {
$this->controller->getForm()->getSessionContainer()->destroy();
}
$this->callback($this->onAction);
$this->result->getAction()->process($this->controller);
// no return
// Am_Exception_Redirect only for APPLICATION_ENV = 'testing'
} else {
// ($result->isFailure()) {
$this->callback($this->onFailure);
}
return $this->result;
}
示例3: onLoadSignupForm
public function onLoadSignupForm(Am_Event $e)
{
$type = $this->getDi()->auth->getUserId() ? SavedForm::D_MEMBER : SavedForm::D_SIGNUP;
if (($r = $e->getReturn()) && $r->isDefault($type) && $this->getConfig('redirect_to_cart')) {
Am_Controller::redirectLocation(REL_ROOT_URL . '/cart');
}
}
示例4: infoTabEcheckAction
function infoTabEcheckAction()
{
require_once APPLICATION_PATH . '/default/controllers/AdminUsersController.php';
$this->setActiveMenu('users-browse');
$user_id = $this->_request->getInt('user_id');
if (!$user_id) {
throw Am_Exception_InputError("Empty [user_id] passsed");
}
$echeck = $this->getDi()->echeckRecordTable->findFirstByUserId($user_id);
$this->view->echeck = $echeck;
$this->view->addUrl = $this->getUrl(null, null, null, 'user_id', $this->getInt('user_id'), array('add' => 1));
if ($echeck || $this->_request->getInt('add') || $this->_request->get('_save_')) {
$form = $this->createEcheckAdminForm((bool) $echeck);
if ($form) {
if ($form->isSubmitted() && $form->validate()) {
if (!$echeck) {
$echeck = $this->getDi()->echeckRecordTable->createRecord();
}
$form->toEcheckRecord($echeck);
$echeck->user_id = $user_id;
$echeck->save();
Am_Controller::redirectLocation($this->_request->getRequestUri());
} elseif ($echeck) {
$arr = $echeck->toArray();
unset($arr['echeck_ban']);
$form->addDataSource(new HTML_QuickForm2_DataSource_Array($arr));
}
$this->view->form = $form;
$this->view->form->setAction($this->_request->getRequestUri());
}
}
$this->view->display('admin/echeck/info-tab.phtml');
// ????
}
示例5: folderAction
function folderAction()
{
$id = $this->_request->getInt('id');
if (!$id) {
throw new Am_Exception_InputError("Empty folder#");
}
$folder = $this->getDi()->folderTable->load($id);
if (empty($folder)) {
throw new Am_Exception_InputError("Folder not found");
}
// Check if login cookie exists. If not, user is not logged in and should be redirected to login page.
$pl = $this->getDi()->plugins_protect->loadGet('new-rewrite');
// User will be there only if file related to folder doesn't exists.
// So if main file exists, this means that user is logged in but don't have an access.
// If main file doesn't exists, redirect user to new-rewrite in order to recreate it.
// Main file will be created even if user is not active.
if (is_file($pl->getFilePath($pl->getEscapedCookie()))) {
$this->view->accessObjectTitle = ___("Folder %s (%s)", $folder->title, $folder->url);
$this->view->orderUrl = REL_ROOT_URL . '/signup';
$this->view->display('no-access.phtml');
} else {
$url = sprintf("%s/protect/new-rewrite?f=%d&url=%s", REL_ROOT_URL, $id, $this->_request->getParam('url', $folder->getUrl()));
Am_Controller::redirectLocation($url);
}
}
示例6: _initSetupForm
protected function _initSetupForm(Am_Form_Setup $form)
{
$url = 'https://auth.aweber.com/1.0/oauth/authorize_app/' . self::APP_ID;
$el = $form->addTextarea('auth', array('cols' => 80, 'rows' => 4))->setLabel("aWeber App Authorization Code\n" . "get it on <a target='_blank' href='{$url}'>aWeber Website</a>");
$el->addRule('regex', 'Invalid value', '/^[a-zA-Z0-9]+\\|[a-zA-Z0-9]+\\|[a-zA-Z0-9]+\\|[a-zA-Z0-9]+\\|[a-zA-Z0-9]+\\|\\s*$/');
if ($this->getConfig('auth') && !$this->getConfig('access.access_token')) {
if (!empty($_GET['oauth_token'])) {
$api = $this->getApi();
$api->user->tokenSecret = $_COOKIE['requestTokenSecret'];
$api->user->requestToken = $_GET['oauth_token'];
$api->user->verifier = $_GET['oauth_verifier'];
list($accessToken, $accessTokenSecret) = $api->getAccessToken();
$this->getDi()->config->saveValue('newsletter.aweber.access', array('access_token' => $accessToken, 'access_secret' => $accessTokenSecret));
Am_Controller::redirectLocation(REL_ROOT_URL . "/admin-setup/aweber");
return;
} else {
$api = $this->getApi();
$callbackUrl = Am_Controller::getFullUrl();
try {
list($requestToken, $requestTokenSecret) = $api->getRequestToken($callbackUrl);
Am_Controller::setCookie('requestTokenSecret', $requestTokenSecret);
$form->addStatic()->setLabel('Access Tokens')->setContent(sprintf('Access tokens are empty or expired, %sclick this link%s to update', '<a href="' . Am_Controller::escape($api->getAuthorizeUrl()) . '">', '</a>'));
} catch (Exception $e) {
$this->getDi()->errorLogTable->logException($e);
$form->addStatic()->setLabel('Access Tokens')->setContent('Plugin configuration error. Got an error from API: ' . $e->getMessage());
}
}
}
$fields = $this->getDi()->userTable->getFields(true);
unset($fields['email']);
unset($fields['name_f']);
unset($fields['name_l']);
$ff = $form->addMagicSelect('fields')->setLabel("Pass additional fields to AWeber\nfields must be configured in AWeber with exactly same titles\nelse API calls will fail and users will not be added\n\nBy default the plugin passes \"email\" and \"name\"\nfields to Aweber, so usually you do not need to select \nthat fields to send as additional fields.\n");
$ff->loadOptions(array_combine($fields, $fields));
}
示例7: process
public function process(Am_Controller $controller = null)
{
if ($controller === null) {
Am_Controller::redirectLocation($this->getUrl());
} else {
$controller->redirectLocation($this->getUrl());
}
}
示例8: directAction
public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
{
$user = $this->getDi()->user;
$id = $this->getDi()->app->reveal($request->getActionName());
//actualy it is notification_id
$notification = $this->getDi()->notificationTable->load($id);
$this->getDi()->notificationClickTable->log($user, $notification);
Am_Controller::redirectLocation($notification->url);
}
示例9: directAction
public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
{
if ('reject' == $request->getActionName()) {
$invoice = $this->getDi()->invoiceTable->findFirstByPublicId($request->get("orderDescription"));
$url = $this->getRootUrl() . "/cancel?id=" . $invoice->getSecureId('CANCEL');
return Am_Controller::redirectLocation($url);
} else {
return parent::directAction($request, $response, $invokeArgs);
}
}
示例10: directAction
public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
{
$actionName = $request->getActionName();
if ($actionName == 'fail') {
$invoice = $this->getDi()->invoiceTable->findFirstByPublicId($request->getParam('m_orderid'));
if (!$invoice) {
throw new Am_Exception_InputError();
}
return Am_Controller::redirectLocation($this->getRootUrl() . "/cancel?id=" . $invoice->getSecureId('CANCEL'));
} else {
return parent::directAction($request, $response, $invokeArgs);
}
}
示例11: indexAction
function indexAction()
{
if (!$this->getDi()->auth->getUserId()) {
$this->getDi()->auth->checkExternalLogin($this->getRequest());
}
if ($this->getDi()->auth->getUserId() && $this->getDi()->config->get('skip_index_page')) {
Am_Controller::redirectLocation($this->getUrl('member', 'index'));
}
try {
$p = $this->getDi()->pageTable->load($this->getDi()->config->get('index_page'));
echo $p->render($this->view, $this->getDi()->auth->getUserId() ? $this->getDi()->auth->getUser() : null);
} catch (Exception $e) {
$this->view->display("index.phtml");
}
}
示例12: directAction
public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
{
if ($request->getActionName() == 'ipn') {
$accessCode = $request->getFiltered('AccessCode');
$result = new Am_Paysystem_Result();
$transaction = new Am_Paysystem_Transaction_EwayRapid3($this, $accessCode);
$transaction->run($result);
if (!($invoice = $transaction->getInvoice())) {
throw new Am_Exception_InputError();
}
$this->_setInvoice($invoice);
if ($result->isSuccess()) {
Am_Controller::redirectLocation($this->getReturnUrl($invoice));
} else {
Am_Controller::redirectLocation($this->getCancelUrl($invoice));
}
} else {
parent::directAction($request, $response, $invokeArgs);
}
}
示例13: indexAction
public function indexAction()
{
$this->_request->setParam('page', 'cart');
$this->p = filterId($this->_request->getParam('page'));
$this->initSetupForms();
$this->form = $this->getForm($this->p, false);
$this->form->prepare();
if ($this->form->isSubmitted()) {
$this->form->setDataSources(array($this->_request));
if ($this->form->validate() && $this->form->saveConfig()) {
Am_Controller::redirectLocation($this->getUrl());
}
} else {
$this->form->setDataSources(array(new HTML_QuickForm2_DataSource_Array($this->getConfigValues()), new HTML_QuickForm2_DataSource_Array($this->form->getDefaults())));
}
$this->view->assign('p', $this->p);
$this->form->replaceDotInNames();
$this->view->assign('pageObj', $this->form);
$this->view->assign('form', $this->form);
$this->view->display('admin/cart/config.phtml');
}
示例14: directAction
public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
{
if ($url = $request->get('url')) {
$url = urldecode($url);
}
if ($request->get('host') && $request->get('ssl')) {
$url = (!strcasecmp($request->get('ssl'), 'on') ? 'https://' : 'http://') . $request->get('host') . $url;
$request->set('url', $url);
}
// if user is logged in and went here, something is definitely wrong
if ($this->getDi()->auth->getUserId()) {
$this->needRefresh($this->getDi()->auth->getUser());
if (!parse_url($url, PHP_URL_SCHEME)) {
$url = sprintf('%s://%s%s', $request->isSecure() ? 'https' : 'http', $request->getHttpHost(), $url);
}
Am_Controller::redirectLocation($url);
return;
}
//
require_once APPLICATION_PATH . '/default/controllers/LoginController.php';
$c = new LoginController($request, $response, $invokeArgs);
$c->setRedirectUrl(Am_Controller::escape($url));
$c->run();
}
示例15: process
public function process(Am_Controller $controller = null)
{
$controller->redirectLocation($this->getUrl());
}