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


PHP sfWebRequest::getUri方法代码示例

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


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

示例1: executeSignin

 /**
  * Signin action for the admin. Will redirect to the dashboard if authenticated
  */
 public function executeSignin(sfWebRequest $request)
 {
     $user = $this->getUser();
     // if it is true, then we has been forwarded to signin.
     // Save it to redirect user back after successful signin.
     if ($this->getController()->getActionStack()->getFirstEntry()->getModuleName() !== $this->getModuleName() && $this->getController()->getActionStack()->getFirstEntry()->getActionName() !== $this->getActionName()) {
         $user->setAttribute('signin.redirectTo', $request->getUri());
     }
     if ($user->isAuthenticated()) {
         $redirectTo = $user->getAttribute('signin.redirectTo', '@sympal_dashboard');
         $user->getAttributeHolder()->remove('signin.redirectTo');
         return $this->redirect($redirectTo);
     }
     $this->getResponse()->setTitle('Sympal Admin / Signin');
     $class = sfConfig::get('app_sf_guard_plugin_signin_form', 'sfGuardFormSignin');
     $this->form = new $class();
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameter('signin'));
         if ($this->form->isValid()) {
             $values = $this->form->getValues();
             $this->getUser()->signin($values['user'], array_key_exists('remember', $values) ? $values['remember'] : false);
             $redirectTo = $user->getAttribute('signin.redirectTo', '@sympal_dashboard');
             $user->getAttributeHolder()->remove('signin.redirectTo');
             return $this->redirect($redirectTo);
         }
     }
 }
开发者ID:sympal,项目名称:sympal,代码行数:30,代码来源:Basesympal_adminActions.class.php

示例2: executeFormComment

 public function executeFormComment(sfWebRequest $request)
 {
     $this->form = new CommentForm();
     $this->form->setDefault('record_model', $this->object->getTable()->getComponentName());
     $this->form->setDefault('record_id', $this->object->get('id'));
     if ($request->isMethod('post')) {
         //preparing temporary array with sent values
         $formValues = $request->getParameter($this->form->getName());
         if (vjComment::isCaptchaEnabled() && !vjComment::isUserBoundAndAuthenticated()) {
             $captcha = array('recaptcha_challenge_field' => $request->getParameter('recaptcha_challenge_field'), 'recaptcha_response_field' => $request->getParameter('recaptcha_response_field'));
             //Adding captcha
             $formValues = array_merge($formValues, array('captcha' => $captcha));
         }
         if (vjComment::isUserBoundAndAuthenticated()) {
             //adding user id
             $formValues = array_merge($formValues, array('user_id' => $this->getUser()->getGuardUser()->getId()));
         }
         $this->form->bind($formValues);
         if ($this->form->isValid()) {
             $this->form->save();
             $url = $request->getUri() . "#" . $this->getUser()->getAttribute("nextComment");
             $this->getUser()->offsetUnset("nextComment");
             sfContext::getInstance()->getController()->redirect($url, 0, 302);
         }
     }
 }
开发者ID:eldister,项目名称:dosye,代码行数:26,代码来源:BaseCommentComponents.class.php

示例3: executeIndex

 public function executeIndex(sfWebRequest $request)
 {
     #security
     if (!$this->getUser()->hasCredential(array('Administrator', 'Staff', 'Member'), false)) {
         $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getUri());
         $this->redirect('dashboard/index');
     }
     $this->email_lists = EmailListPeer::doSelect(new Criteria());
     $this->role_widget = new sfWidgetFormPropelChoiceMany(array('model' => 'Role', 'method' => 'getTitle'));
 }
开发者ID:yasirgit,项目名称:afids,代码行数:10,代码来源:actions.class.php

示例4: executePaymentslist

public function executePaymentslist(sfWebRequest $request)
{

    $enrolmentTable = Doctrine_Core::getTable('dsClassStudent');

    $this->enrolments_pay_pending = $enrolmentTable->getByPayment(0);

    $this->getUser()->setFlash('redirect', $request->getUri() ) ;


}
开发者ID:romankallweit,项目名称:swingmachine,代码行数:11,代码来源:actions.class.php

示例5: executeAsk_confirmation

 /**
  * Requests are forwarded here when using the ->askConfirmation()
  * method on the actions class
  */
 public function executeAsk_confirmation(sfWebRequest $request)
 {
     if ($this->isAjax()) {
         $this->setLayout(false);
     } else {
         $this->loadAdminTheme();
     }
     $this->url = $request->getUri();
     $this->title = $request->getAttribute('title');
     $this->message = $request->getAttribute('message');
     $this->isAjax = $request->getAttribute('is_ajax');
 }
开发者ID:sympal,项目名称:sympal,代码行数:16,代码来源:Basesympal_defaultActions.class.php

示例6: executeAccessToken

 public function executeAccessToken(sfWebRequest $request)
 {
     $req = OAuthRequest::from_request(NULL, $request->getUri());
     // To get variable in header
     if ($req->get_parameter('oauth_version') == '1.0') {
         $oauthServer = new sfoauthserver(new sfOAuthDataStore());
         $req = OAuthRequest::from_request(NULL, $request->getUri());
         $q = Doctrine::getTable('sfOauthServerRequestToken')->findOneByToken($req->get_parameter('oauth_token'));
         $this->token = $oauthServer->fetch_access_token($req);
         if ($q->getUserId() == NULL && $q->getScope()) {
             throw new OAuthException('Token unauthorized');
         }
         return $this->setTemplate('token');
     } else {
         $q = Doctrine::getTable('sfOauthServerRequestToken')->findOneByToken($request->getParameter('code'));
         $oauthServer2 = new sfOauth2Server();
         $oauthServer2->setUserId($q->getUserId());
         $oauthServer2->grantAccessToken($q->getScope());
         return sfView::NONE;
     }
 }
开发者ID:vmorant,项目名称:ttupf,代码行数:21,代码来源:actions.class.php

示例7: executeExplore

 public function executeExplore(sfWebRequest $request)
 {
     $comparator = new Comparator($request->getUri());
     $this->simple = $comparator->analyze_link('simple')->results();
     $ids = $comparator->getOnlyTrueFeatures();
     $this->true = $ids;
     $this->url = $request->getUri();
     $this->goods = Doctrine_Core::getTable('Feature')->GetByIds($ids);
     if (isset($data['secondary']['false'])) {
         $this->bads = Doctrine_Core::getTable('Feature')->GetByIds($data['secondary']['false']);
     }
     /* First view only */
     $this->apps = Doctrine_Core::getTable('Apartment')->createQuery('a')->limit(2)->execute();
 }
开发者ID:alifst11,项目名称:symfonybooking,代码行数:14,代码来源:actions.class.php

示例8: executeDelete

 public function executeDelete(sfWebRequest $request)
 {
     if (!$this->getUser()->hasCredential(array('Administrator'), false)) {
         $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getUri());
         $this->redirect('dashboard/index');
     }
     $request->checkCSRFProtection();
     try {
         $this->forward404Unless($vocation_class = VocationClassPeer::retrieveByPk($request->getParameter('id')), sprintf('Object vocation_class does not exist (%s).', $request->getParameter('id')));
         $vocation_class->delete();
     } catch (Exception $e) {
         $this->getUser()->setFlash('warning', "There are related persons to this vocation. Please remove them first.");
     }
     $this->redirect('vocation/index');
 }
开发者ID:yasirgit,项目名称:afids,代码行数:15,代码来源:actions.class.php

示例9: executeLogin

 /**
  * Renders a form that makes it possible for the user to login
  * @param sfWebRequest $request
  */
 public function executeLogin(sfWebRequest $request)
 {
     //set the referrer used when loggin in.
     $this->getUser()->setReferer($this->getContext()->getActionStack()->getSize() > 1 ? $request->getUri() : $request->getReferer());
     $this->form = new sfAuthSigninForm();
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameter('sf_auth_signin'));
         if ($this->form->isValid()) {
             $this->getUser()->setFlash('success', $this->getContext()->getI18N()->__('Welcome back :)'));
             $referer = $this->getUser()->getReferer($request->getReferer());
             $this->redirectUnless(empty($referer), $referer);
             $this->redirect('@homepage');
         }
     }
 }
开发者ID:eljam,项目名称:sfAuthPlugin,代码行数:19,代码来源:BasesfAuthUserActions.class.php

示例10: executeError404

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeError404(sfWebRequest $request)
 {
     // URI
     $this->uri = $request->getUri();
     // URL
     $this->url = @current(explode('?', $this->uri));
     /*
     // main site
     $this->mainSite = Doctrine::getTable('Site')->findOneBySlug('cmais');
     
     // editorials
     $this->editorials = Doctrine_Query::create()
       ->select('s.*')
       ->from('Section s')
       ->where('s.site_id = ?', $this->mainSite->id)
       ->andWhere('s.is_active = ?', 1)
       ->andWhere('s.is_editorial = ?', 1)
       ->orderBy('s.display_order')
       ->execute();
       
     // channels
     $this->channels = array();
     $this->live = array();
     $this->coming = array();    
     $this->important = array();
     $cs = Doctrine_Query::create()
       ->select('c.*')
       ->from('Channel c')
       ->where('c.is_active = ?', 1)
       ->orderBy('c.title')
       ->execute();
       
     foreach($cs as $c){
       $this->channels[$c->slug] = $c;
       $this->live[$c->slug] = $c->retriveLiveProgram();
       $this->important[$c->slug] = $c->retriveImportantPrograms(1);
       $this->coming[$c->slug] = $c->retriveLivePrograms(3,$this->live[$c->slug][0]->getId());
     }
     */
     if ($request->getHost() == "culturafm.cmais.com.br") {
         $this->getResponse()->setTitle('cmais+ O portal de conteúdo da Cultura - Página não encontrada!', false);
         $this->setTemplate('sites/culturafm/error404', 'default');
     } else {
         $this->getResponse()->setTitle('cmais+ O portal de conteúdo da Cultura - Puxa, puxa que puxa! Não conseguimos encontrar a página...', false);
     }
 }
开发者ID:GustavoAdolfo,项目名称:cmais-frontend-2,代码行数:51,代码来源:actions.class.php

示例11: executeLogin

 /**
  * Shows login form
  *
  * @param sfRequest $request A request object
  */
 public function executeLogin(sfWebRequest $request)
 {
     $form = new sfForm();
     $this->csrf_tag = $form['_csrf_token'];
     if ($request->hasParameter('referer')) {
         $this->referer = $request->getParameter('referer');
     } else {
         $this->referer = $request->getUri();
     }
     if ($this->getUser()->isAuthenticated()) {
         if ($this->referer == "http://69.50.211.150/secure/login") {
             $this->redirect('/dashboard/index');
         } else {
             $this->redirect($this->referer);
             //
         }
     }
 }
开发者ID:yasirgit,项目名称:afids,代码行数:23,代码来源:actions.class.php

示例12: execute

 /**
  * Renders the login dialog, 
  * calls the login action if Shibboleth data is present
  * or POST data is sent as a fall back,
  * redirects the user after successful authentication
  *
  * @param sfWebRequest $request The current web request.
  *
  * @return void
  */
 public function execute($request)
 {
     $this->form = new sfForm();
     $this->form->getValidatorSchema()->setOption('allow_extra_fields', true);
     // Redirect to @homepage if the user is already authenticated
     if ($this->context->user->isAuthenticated()) {
         $this->redirect('@homepage');
     }
     // Redirect to the current URI in case we're forwarded to the login page
     $this->form->setDefault('next', $request->getUri());
     if ('user' == $request->module && 'login' == $request->action) {
         // Redirect to our referer otherwise
         $this->form->setDefault('next', $request->getReferer());
     }
     $apache_params = $request->getPathInfoArray();
     $this->form->setValidator('next', new sfValidatorString());
     $this->form->setWidget('next', new sfWidgetFormInputHidden());
     $this->form->setValidator('email', new sfValidatorEmail(array('required' => true), array('required' => $this->context->i18n->__('You must enter your email address'), 'invalid' => $this->context->i18n->__('This isn\'t a valid email address'))));
     $this->form->setWidget('email', new sfWidgetFormInput());
     $this->form->setValidator('password', new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('You must enter your password'))));
     $this->form->setWidget('password', new sfWidgetFormInputPassword());
     if (strlen($apache_params['Shib-Session-Index']) >= 8) {
         if ($this->context->user->authenticate($apache_params['mail'], '', $request)) {
             if (null !== ($next = $this->form->getValue('next'))) {
                 $this->redirect($next);
             }
             $this->redirect('@homepage');
         }
     }
     if ($request->isMethod('post')) {
         $this->form->bind($request->getPostParameters());
         if ($this->form->isValid()) {
             if ($this->context->user->authenticate($this->form->getValue('email'), $this->form->getValue('password'))) {
                 if (null !== ($next = $this->form->getValue('next'))) {
                     $this->redirect($next);
                 }
                 $this->redirect('@homepage');
             }
             $this->form->getErrorSchema()->addError(new sfValidatorError(new sfValidatorPass(), 'Sorry, unrecognized email or password'));
         }
     }
 }
开发者ID:Surfrdan,项目名称:sfDariahShibUserPlugin,代码行数:52,代码来源:loginAction.class.php

示例13: executeSignin

 /**
  * Sign In functionality controller
  */
 public function executeSignin(sfWebRequest $request)
 {
     if ($request->isMethod('post')) {
         if ($request->hasParameter('signin')) {
             $signin = $request->getParameter('signin');
             $sUsername = $signin['username'];
             $sPassword = $signin['password'];
             $bRemember = isset($signin['remember']);
             $user = afStudioUser::getInstance()->retrieve($sUsername);
             if ($user) {
                 if ($user['password'] === sha1($signin['password'])) {
                     afStudioUser::getInstance()->set($sUsername, $sPassword, $bRemember);
                     $signinUrl = $this->getRequest()->getReferer();
                     $signinUrl = $signinUrl != null ? $signinUrl : url_for('@homepage');
                     $result = array('success' => true, 'redirect' => $signinUrl, 'load' => 'page');
                     afsNotificationPeer::log('Successful login', 'afStudioAuth');
                 } else {
                     $result = array('success' => false, 'message' => 'The username and/or password is invalid. Please try again.');
                     afsNotificationPeer::log('Failed to get authenticated in the system!', 'afStudioAuth');
                 }
             } else {
                 $result = array('success' => false, 'message' => 'The username and/or password is invalid. Please try again.', 'redirect' => '/afsAuthorize/index', 'load' => 'page');
                 afsNotificationPeer::log('Failed to get authenticated in the system!', 'afStudioAuth');
             }
         } else {
             $result = array('success' => false, 'message' => 'You were logged out ! You\'ll be redirected to the login page!', 'redirect' => '/afsAuthorize/index', 'load' => 'page');
             afsNotificationPeer::log('Successful logout', 'afStudioAuth');
         }
     } else {
         // if we have been forwarded, then the referer is the current URL
         // if not, this is the referer of the current request
         $user->setReferer($this->getContext()->getActionStack()->getSize() > 1 ? $request->getUri() : $request->getReferer());
         $module = sfConfig::get('sf_login_module');
         if ($this->getModuleName() != $module) {
             $result = array('success' => false, 'message' => 'You were logged out ! You\'ll be redirected to the login page!', 'redirect' => '/afsAuthorize/index', 'load' => 'page');
             afsNotificationPeer::log('Successful logout', 'afStudioAuth');
         }
     }
     return $this->renderJson($result);
 }
开发者ID:cbsistem,项目名称:appflower_studio,代码行数:43,代码来源:actions.class.php

示例14: executeSend

 public function executeSend(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod('post'));
     if ($this->getUser()->getApiUserId()) {
         sfConfig::set('app_recaptcha_active', false);
     }
     $this->form = new FeedbackForm();
     if ($this->getUser()->getApiUserId()) {
         unset($this->form['name']);
         unset($this->form['email']);
     }
     $requestData = $request->getParameter($this->form->getName());
     if (sfConfig::get('app_recaptcha_active', false)) {
         $requestData['challenge'] = $this->getRequestParameter('recaptcha_challenge_field');
         $requestData['response'] = $this->getRequestParameter('recaptcha_response_field');
     }
     $this->form->bind($requestData);
     if ($this->form->isValid()) {
         if ($this->getUser()->getApiUserId()) {
             $user_data = Api::getInstance()->get('user/' . $this->getUser()->getApiUserId(), true);
             $user = ApiDoctrine::createQuickObject($user_data['body']);
         } else {
             $user = null;
         }
         $values = $this->form->getValues();
         $name = $this->getUser()->getApiUserId() ? $user->getPreferredName() ? $user->getPreferredName() : $user->getFullName() : $this->form->getValue('name');
         $email = $this->getUser()->getApiUserId() ? $user->getEmailAddress() : $this->form->getValue('email');
         $signinUrl = $this->getUser()->getReferer($request->getReferer());
         $message = $name . ' ' . $email . "\n" . $values['message'] . "\nReferer:" . $signinUrl;
         $to = ProjectConfiguration::getApplicationFeedbackAddress();
         $subjects = sfConfig::get('app_feedback_subjects', array());
         $subject = ProjectConfiguration::getApplicationName() . ': ' . (array_key_exists($values['subject'], $subjects) ? $subjects[$values['subject']] : $values['subject']);
         $from_address = $this->getUser()->getApiUserId() ? "{$name} <{$email}>" : ProjectConfiguration::getApplicationEmailAddress();
         AppMail::sendMail($to, $from_address, $subject, $message);
         $this->getUser()->setFlash('notice', 'Your message has been sent to ' . ProjectConfiguration::getApplicationName() . '.');
         return $this->redirect('' != $signinUrl ? $signinUrl : '@homepage');
     }
     $this->getUser()->setReferer($this->getContext()->getActionStack()->getSize() > 1 ? $request->getUri() : $request->getReferer());
     $this->setTemplate('feedback');
 }
开发者ID:nocoolnametom,项目名称:OpenMicNight,代码行数:40,代码来源:actions.class.php

示例15: processEdit

 /**
  *
  * @param sfWebRequest $request
  * @param ProfileForm $form
  */
 protected function processEdit(sfWebRequest $request, ProfileForm $form)
 {
     $form->bind($request->getParameter('profile'));
     if ($form->isValid()) {
         $values = $form->getValues();
         $user = $this->getUser()->getGuardUser();
         if ($user->checkPassword($values['current_password'])) {
             // Set new password into sfGuardUser table
             if (!empty($values['new_password']) && $values['new_password'] == $values['confirm_new_password']) {
                 $user->setPassword($values['new_password']);
             }
             $user->setFirstName($values['first_name']);
             $user->setLastName($values['last_name']);
             $user->setEmailAddress($values['email']);
             $user->save();
             // Set referer
             $this->getUser()->setReferer($request->getUri());
             // Redirect to referer
             $this->redirect($this->getUser()->getReferer());
         }
     }
 }
开发者ID:alex1818,项目名称:TestReportCenter,代码行数:27,代码来源:actions.class.php


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