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


PHP sfWebRequest::getReferer方法代码示例

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


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

示例1: executeLogin

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeLogin(sfWebRequest $request)
 {
     $this->redirectIf($this->getUser()->isAuthenticated(), '@homepage');
     $this->form = new LoginForm();
     if ($request->hasParameter('l_err') && $request->getParameter('l_err', '0') == '1') {
         $error = new sfValidatorError(new savedValidator(), 'Bad login or password');
         $this->form->getErrorSchema()->addError($error);
     }
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameter('login'));
         if ($this->form->isValid()) {
             $this->getUser()->setAuthenticated(true);
             sfContext::getInstance()->getLogger()->debug('LOGIN: ' . $this->form->getValue('username') . ' ' . $this->form->user->getId());
             $this->getUser()->setAttribute('db_user_id', $this->form->user->getId());
             $this->getUser()->setAttribute('db_user_type', $this->form->user->getDbUserType());
             if (in_array($this->form->user->getSelectedLang(), array('en', 'fr', 'nl'))) {
                 $this->getUser()->setCulture($this->form->user->getSelectedLang());
             }
             $this->getUser()->setHelpIcon(Doctrine::getTable("Preferences")->getPreference($this->form->user->getId(), 'help_message_activated', true));
             if ($request->getReferer()) {
                 $this->redirect($request->getReferer());
             } else {
                 $this->redirect('@homepage');
             }
         } else {
             sfContext::getInstance()->getLogger()->notice('Bad username or password');
         }
     }
 }
开发者ID:naturalsciences,项目名称:Darwin,代码行数:34,代码来源:actions.class.php

示例2: executeSelect

 public function executeSelect(sfWebRequest $request)
 {
     $scm_id = $request->getParameter('scm_id');
     $this->forward404Unless($scm_id);
     $this->getUser()->setSelectedScmId($scm_id);
     // redirect back to the referrer or if not set; the homepage
     $this->redirect($request->getReferer() ? $request->getReferer() : '@homepage');
 }
开发者ID:skoop,项目名称:phpCodeControl,代码行数:8,代码来源:actions.class.php

示例3: executeSwitch

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeSwitch(sfWebRequest $request)
 {
     $this->getUser()->setCulture($request->getParameter('langage'));
     if ($request->isMethod('POST') && $request->getReferer()) {
         $this->redirect($request->getReferer());
     } else {
         $this->redirect('@homepage');
     }
 }
开发者ID:cpf,项目名称:eBot-CSGO-Web,代码行数:14,代码来源:actions.class.php

示例4: 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

示例5: executeLogin

 public function executeLogin(sfWebRequest $request)
 {
     global $CFG, $SESSION;
     if ($CFG->current_app->isMoodle()) {
         // Check to see if the logged out user has a cookie showing what institution they are from
         $institution = $CFG->current_app->getInstitutionFromCookie();
         $url = $CFG->current_app->getInstitutionJumpUrl($SESSION->wantsurl, $institution);
         if (!$url) {
             $url = $CFG->current_app->getInstitutionJumpUrl($SESSION->wantsurl);
         }
         // If a unauthenicated user clicks on a course instance link from the course category page
         // in Moodle, we can assume that they are probably a new user on the system. Therefore,
         // we set up a registration type gcr_wants_url record to bring them back to the course
         // after registration is complete.
         if (strpos($request->getReferer(), $CFG->current_app->getAppUrl() . '/course/category.php') === 0 && strpos($SESSION->wantsurl, $CFG->current_app->getAppUrl() . '/course/view.php') === 0) {
             if (!$institution) {
                 $institution = $CFG->current_app->getInstitution();
             }
             $wants_url = GcrWantsUrlTable::createWantsUrl('simple', $institution, $url);
             $this->redirect($institution->getUrl() . '/eschool/registration?url=' . $wants_url);
         } else {
             $this->redirect($url);
         }
     } else {
         $this->redirect($CFG->current_app->getAppUrl());
     }
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:27,代码来源:actions.class.php

示例6: executeSave

 /**
  * Saves new or update role. Echoes error/success message
  */
 public function executeSave(sfWebRequest $request)
 {
     if (!$this->getUser()->hasCredential(array('Administrator'), false)) {
         $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer());
         $this->redirect('dashboard/index');
     }
     $id = $request->getParameter('id');
     if ($id) {
         $role = RolePeer::retrieveByPK($id);
         if (!$role instanceof Role) {
             return $this->renderText('<span style="color:red;">Role not found or is removed!</span>');
         }
         $form = new RoleForm($role);
     } else {
         $form = new RoleForm();
     }
     unset($form['_csrf_token']);
     $form->bind($request->getPostParameters());
     if ($form->isValid()) {
         $form->save();
         return $this->renderText('Role has been successfully saved!');
     } else {
         # FIXME display other field errors
         echo 'e1';
         # has error
         echo '<span style="color:red;">' . $form['title']->getError()->getMessage() . '</span>';
     }
     return sfView::NONE;
 }
开发者ID:yasirgit,项目名称:afids,代码行数:32,代码来源:actions.class.php

示例7: executeSwitch

 public function executeSwitch(sfWebRequest $request)
 {
     $referer = $request->getReferer();
     if ($request->hasParameter("lang")) {
         $lang = $request->getParameter('lang');
     } else {
         $lang = $request->getPreferredCulture(array('en', 'hu'));
     }
     if ($lang != 'en' && $lang != 'hu') {
         $lang = $request->getPreferredCulture(array('en', 'hu'));
     }
     $this->getUser()->setCulture($lang);
     $pos = strpos($referer, '/hu/');
     if ($pos === false) {
         $pos = strpos($referer, '/en/');
         if ($pos === false) {
             $whereto = false;
         } else {
             $eleje = substr($referer, 0, $pos);
             $whereto = substr($referer, $pos + 4);
         }
     } else {
         $eleje = substr($referer, 0, $pos);
         $whereto = substr($referer, $pos + 4);
     }
     if (!$whereto) {
         $this->redirect('localized_homepage');
     } else {
         $this->redirect($eleje . "/" . $lang . "/" . $whereto);
     }
 }
开发者ID:br00k,项目名称:yavom,代码行数:31,代码来源:actions.class.php

示例8: executeDelete

 public function executeDelete(sfWebRequest $request)
 {
     $vars = Doctrine::getTable('TransUnit')->createQuery()->from('TransUnit tu')->where('tu.source = ?', $this->getRoute()->getObject()->getSource())->andWhere('tu.variable_id IS NULL')->execute();
     $this->getUser()->setFlash('notice', 'Translation deleted.');
     $vars->delete();
     $this->redirect($request->getReferer());
 }
开发者ID:vcgato29,项目名称:poff,代码行数:7,代码来源:actions.class.php

示例9: executeAdd

 public function executeAdd(sfWebRequest $r)
 {
     if ($r->isMethod('post')) {
         // Loading form
         $f = new PmMessagesForm();
         // Binding fields
         $f->bind($r->getParameter($f->getName()));
         // If form is valid
         if ($f->isValid()) {
             // We can save it.
             $m = $f->save();
             // Update topic with last message
             Doctrine_Query::create()->update("PmTopics")->set("updated_at", '"' . $m->getCreatedAt() . '"')->where('id = ?', $m->getPmid())->execute();
             // Set every people in this MP to unreaded
             Doctrine_Query::create()->update('PmParticipants')->set('readed', 0)->where('mpid = ?', $m->getPmid())->andWhere('mpmid != ?', $this->getUser()->getAttribute("id"))->execute();
             // Send notif
             $users = Doctrine::getTable('PmParticipants')->findByMpid($m->getPmid());
             $pmTopic = $m->PmTopics;
             foreach ($users as $user) {
                 Doctrine::getTable('Notifications')->setNotification("sent a new private message.", "email_add.png", '<strong>' . $pmTopic->getTitle() . '</strong>', '@pm?slug=' . $pmTopic->getSlug())->setOwner($user->getMpmid())->save();
             }
             // Redirect to topic
             $this->redirect($r->getReferer());
         }
     } else {
         $this->forward404();
     }
 }
开发者ID:thefkboss,项目名称:ZenTracker,代码行数:28,代码来源:actions.class.php

示例10: executeForwardTo

 /**
  * Fonction de redirection au changement de profils dans le menu latéral gauche.
  * @param sfWebRequest $request
  * @return type 
  */
 public function executeForwardTo(sfWebRequest $request)
 {
     //récupération et parsing de l'URL référente.
     $referer = $request->getReferer();
     $url = parse_url($referer);
     $path = trim($url['path'], '/');
     if (!sfConfig::get('sf_no_script_name') && ($pos = strpos($path, '/'))) {
         $path = substr($path, $pos + 1);
     }
     //récupération et setting des paramètres du profils
     $params = sfContext::getInstance()->getRouting()->findRoute('/' . $path);
     $params['parameters']['profile_id'] = $request->getParameter('profile_id');
     $params['parameters']['profile_ref'] = $request->getParameter('profile_ref');
     $params['parameters']['profile_name'] = Doctrine_Core::getTable('EiProfil')->findOneByProfileRefAndProfileId($request->getParameter('profile_ref'), $request->getParameter('profile_id'))->getName();
     $URLParams = array('project_id' => $request->getParameter('project_id'), 'project_ref' => $request->getParameter('project_ref'), 'profile_id' => $params['parameters']['profile_id'], 'profile_ref' => $params['parameters']['profile_ref'], 'profile_name' => $params['parameters']['profile_name'], 'ei_scenario_id' => $request->getParameter('ei_scenario_id'), 'action' => $params['parameters']['action']);
     // Ajout des paramètres obligatoires manquants.
     $paramsOmis = array_diff_key($params['parameters'], $URLParams, array("module" => "", "sf_culture" => ""));
     foreach ($paramsOmis as $ind => $p) {
         $URLParams[$ind] = $p;
     }
     //Avant la redirection , on change les données du profil en session utilisateur
     $this->getUser()->setAttribute("current_profile_name", $params['parameters']['profile_name']);
     $this->getUser()->setAttribute("current_profile_id", $params['parameters']['profile_id']);
     $this->getUser()->setAttribute("current_profile_ref", $params['parameters']['profile_ref']);
     return $this->redirect($params['name'], $params['parameters']);
 }
开发者ID:lendji4000,项目名称:compose,代码行数:31,代码来源:actions.class.php

示例11: executeShowby

 public function executeShowby(sfWebRequest $request)
 {
     if (in_array($this->getRequestParameter('val'), categoryPageActions::$showByAr)) {
         $this->getUser()->setAttribute('showby', $this->getRequestParameter('val'));
     }
     // remove "page=" parameter to prevent last page error when increasing "showby"
     $link = preg_replace('/(&?)page=(\\d+)/', '', $request->getReferer());
     $this->redirect($link);
 }
开发者ID:vcgato29,项目名称:poff,代码行数:9,代码来源:actions.class.php

示例12: executeCreate

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeCreate(sfWebRequest $request)
 {
     $form = new NoteForm();
     if ($form->bindAndSave($request->getParameter('note'))) {
         $this->redirectFromCreate($form);
     } else {
         $this->redirect($request->getReferer());
     }
 }
开发者ID:jackbravo,项目名称:amaranto,代码行数:14,代码来源:actions.class.php

示例13: executeFilter

 public function executeFilter(sfWebRequest $request)
 {
     $this->filters = $this->configuration->getFilterForm();
     $this->filters->bind($request->getParameter($this->filters->getName()));
     if ($this->filters->isValid()) {
         $this->configuration->setFilters($this->filters->getValues());
     }
     $this->redirect($request->getReferer());
 }
开发者ID:vcgato29,项目名称:poff,代码行数:9,代码来源:actions.class.php

示例14: executeCardLogin

 public function executeCardLogin(sfWebRequest $request)
 {
     if ($this->getUser()->isAuthenticated()) {
         $this->redirect('home/index');
         $request->setAttribute('referer', $request->getReferer());
     }
     $this->form = new CardLoginForm();
     $this->cardLoginError = $this->getUser()->hasFlash('cardLoginError');
 }
开发者ID:jfesquet,项目名称:tempos,代码行数:9,代码来源:actions.class.php

示例15: executeSwitch

 public function executeSwitch(sfWebRequest $request)
 {
     $user = $this->getUser();
     $available_cultures = $user->getAvailableCultures();
     if (!array_key_exists($request->getParameter('lang'), $available_cultures)) {
         $this->forward($this->getModuleName(), 'oops');
     }
     $user->setCulture($request->getParameter('lang'));
     $this->redirect($request->getReferer());
 }
开发者ID:saadtazi,项目名称:Continue-this-Story,代码行数:10,代码来源:actions.class.php


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