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


PHP sfRequest::isMethod方法代码示例

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


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

示例1: executeLink

 /**
  * Executes link action
  *
  * @param sfRequest $request A request object
  */
 public function executeLink($request)
 {
     $this->redirectUnless(opConfig::get('enable_friend_link'), '@error');
     $this->redirectIf($this->relation->isAccessBlocked(), '@error');
     if ($this->relation->isFriend()) {
         $this->getUser()->setFlash('error', 'This member already belongs to %my_friend%.');
         $this->getUser()->setFlash('error_params', array('%my_friend%' => Doctrine::getTable('SnsTerm')->get('my_friend')->pluralize()));
         $this->redirect('member/profile?id=' . $this->id);
     }
     if ($this->relation->isFriendPreFrom()) {
         $this->getUser()->setFlash('error', '%Friend% request is already sent.');
         $this->redirect('member/profile?id=' . $this->id);
     }
     $this->form = new FriendLinkForm();
     if ($request->isMethod(sfWebRequest::POST)) {
         $this->form->bind($request->getParameter('friend_link'));
         if ($this->form->isValid()) {
             $this->getUser()->setFlash('notice', 'You have requested %friend% link.');
             $this->redirectToHomeIfIdIsNotValid();
             $this->relation->setFriendPre();
             $this->dispatcher->notify(new sfEvent($this, 'op_action.post_execute_' . $this->moduleName . '_' . $this->actionName, array('moduleName' => $this->moduleName, 'actionName' => $this->actionName, 'actionInstance' => $this, 'result' => sfView::SUCCESS)));
             $this->redirect('member/profile?id=' . $this->id);
         }
     }
     $this->member = Doctrine::getTable('Member')->find($this->id);
     return sfView::INPUT;
 }
开发者ID:Kazuhiro-Murota,项目名称:OpenPNE3,代码行数:32,代码来源:sfOpenPNEFriendAction.class.php

示例2: executeFeedback

 /**
  * Executes feedback action
  *
  */
 public function executeFeedback(sfRequest $request)
 {
     $section = $request->getParameter('section', false);
     $this->form = new aFeedbackForm($section);
     $this->feedbackSubmittedBy = false;
     $this->failed = false;
     sfContext::getInstance()->getConfiguration()->loadHelpers(array('Tag', 'Url'));
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameter('feedback'), $request->getFiles('feedback'));
         // $this->form->bind(array_merge($request->getParameter('feedback'), array('captcha' => $request->getParameter('captcha'))), $request->getFiles('feedback'));
         if ($this->form->isValid()) {
             $feedback = $this->form->getValues();
             $feedback['browser'] = $_SERVER['HTTP_USER_AGENT'];
             try {
                 aZendSearch::registerZend();
                 $mail = new Zend_Mail();
                 $mail->setBodyText($this->getPartial('feedbackEmailText', array('feedback' => $feedback)))->setFrom($feedback['email'], $feedback['name'])->addTo(sfConfig::get('app_aFeedback_email_auto'))->setSubject($this->form->getValue('subject', 'New aBugReport submission'));
                 if ($screenshot = $this->form->getValue('screenshot')) {
                     $mail->createAttachment(file_get_contents($screenshot->getTempName()), $screenshot->getType());
                 }
                 $mail->send();
                 // A new form for a new submission
                 $this->form = new aFeedbackForm();
             } catch (Exception $e) {
                 $this->logMessage('Request email failed: ' . $e->getMessage(), 'err');
                 $this->failed = true;
                 return 'Success';
             }
             $this->getUser()->setFlash('reportSubmittedBy', $feedback['name']);
             $this->redirect($feedback['section']);
         }
     }
 }
开发者ID:hashir,项目名称:UoA,代码行数:37,代码来源:BaseaFeedbackActions.class.php

示例3: executeConfigUID

 /**
  * Executes configUID action
  *
  * @param sfRequest $request A request object
  */
 public function executeConfigUID($request)
 {
     $option = array('member' => $this->getUser()->getMember());
     $this->passwordForm = new sfOpenPNEPasswordForm(array(), $option);
     $mobileUid = Doctrine::getTable('MemberConfig')->retrieveByNameAndMemberId('mobile_uid', $this->getUser()->getMemberId());
     $this->isSetMobileUid = !is_null($mobileUid);
     $this->isDeletableUid = (int) opConfig::get('retrieve_uid') < 2 && $this->isSetMobileUid;
     if ($request->isMethod('post')) {
         $this->passwordForm->bind($request->getParameter('password'));
         if ($this->passwordForm->isValid()) {
             if ($request->hasParameter('update')) {
                 $memberConfig = Doctrine::getTable('MemberConfig')->retrieveByNameAndMemberId('mobile_uid', $this->getUser()->getMemberId());
                 if (!$memberConfig) {
                     $memberConfig = new MemberConfig();
                     $memberConfig->setMember($this->getUser()->getMember());
                     $memberConfig->setName('mobile_uid');
                 }
                 $memberConfig->setValue($request->getMobileUID());
                 $memberConfig->save();
                 $this->getUser()->setFlash('notice', 'Your mobile UID was set successfully.');
                 $this->redirect('member/configUID');
             } elseif ($request->hasParameter('delete') && $this->isDeletableUid) {
                 $mobileUid->delete();
                 $this->getUser()->setFlash('notice', 'Your mobile UID was deleted successfully.');
                 $this->redirect('member/configUID');
             }
         }
     }
     return sfView::SUCCESS;
 }
开发者ID:Kazuhiro-Murota,项目名称:OpenPNE3,代码行数:35,代码来源:actions.class.php

示例4: executeLogin

 /**
  * Executes login action
  *
  *
  * @param sfRequest $request A request object
  */
 public function executeLogin($request)
 {
     $this->form = new LoginForm();
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameter('login'));
         if ($this->form->isValid()) {
             $this->redirect('@homepage');
         }
     }
 }
开发者ID:psskhal,项目名称:symfony-sample,代码行数:16,代码来源:actions.class.php

示例5: executeApply

 public function executeApply(sfRequest $request)
 {
     //If user is logged in, we're forwarding him to settings page from apply
     $this->forwardIf($this->getUser()->isAuthenticated(), 'sfApply', 'settings');
     // we're getting default or customized applyForm for the task
     if (!($this->form = $this->newForm('applyForm')) instanceof sfGuardUserProfileForm) {
         // if the form isn't instance of sfApplyApplyForm, we don't accept it
         throw new InvalidArgumentException('The custom apply form should be instance of sfApplyApplyForm');
     }
     //Code below is used when user is sending his application!
     if ($request->isMethod('post')) {
         //gathering form request in one array
         $formValues = $request->getParameter($this->form->getName());
         if (sfConfig::get('app_recaptcha_enabled')) {
             $captcha = array('recaptcha_challenge_field' => $request->getParameter('recaptcha_challenge_field'), 'recaptcha_response_field' => $request->getParameter('recaptcha_response_field'));
             //Adding captcha to form array
             $formValues = array_merge($formValues, array('captcha' => $captcha));
         }
         //binding request form parameters with form
         $this->form->bind($formValues, $request->getFiles($this->form->getName()));
         if ($this->form->isValid()) {
             $guid = "n" . self::createGuid();
             $this->form->getObject()->setValidate($guid);
             $date = new DateTime();
             $this->form->getObject()->setValidateAt($date->format('Y-m-d H:i:s'));
             $this->form->save();
             $confirmation = sfConfig::get('app_sfForkedApply_confirmation');
             if ($confirmation['apply']) {
                 try {
                     //Extracting object and sending creating verification mail
                     $profile = $this->form->getObject();
                     $this->sendVerificationMail($profile);
                     return 'After';
                 } catch (Exception $e) {
                     //Cleaning after possible exception thrown in ::sendVerificationMail() method
                     $profile = $this->form->getObject();
                     $user = $profile->getUser();
                     $profile->delete();
                     $user->delete();
                     //We rethrow exception for the dev environment. This catch
                     //catches other than mailer exception, i18n as well. So developer
                     //now knows what he's up to.
                     if (sfContext::getInstance()->getConfiguration()->getEnvironment() === 'dev') {
                         throw $e;
                     }
                     return 'MailerError';
                 }
             } else {
                 $this->activateUser($this->form->getObject()->getUser());
                 $this->getUser()->setFlash('notice', "<h3>Поздравляем с успешной регистрацией!</h3>\n\n                <p>Теперь Вы можете пользоваться всеми возможностями сервиса:</p>\n                <ul>\n                    <li>Добавлять новые места</li>\n                    <li>Добавлять отчеты</li>\n                    <li>Добавлять события</li>\n                    <li>Открывать обсуждения</li>\n                    <li>Голосовать комментировать и все подряд</li>\n                    <li>Заводить друзей</li>\n                    <li>И многое другое...</li>\n                </ul>");
                 return $this->redirect('@homepage');
             }
         }
     }
 }
开发者ID:limitium,项目名称:uberlov,代码行数:55,代码来源:actions.class.php

示例6: executeIndex

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex($request)
 {
     $this->form = new reCaptchaForm();
     if ($request->isMethod('post')) {
         $requestData = array('challenge' => $this->getRequestParameter('recaptcha_challenge_field'), 'response' => $this->getRequestParameter('recaptcha_response_field'));
         $this->form->bind($requestData);
         if ($this->form->isValid()) {
             // captcha is valid
         }
     }
 }
开发者ID:broschb,项目名称:cyclebrain,代码行数:16,代码来源:actions.class.php

示例7: execute

 /**
  * 
  * @param sfRequest $request
  */
 public function execute($request)
 {
     $this->setForm(new BeaconRegistrationForm());
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameter($this->form->getName()));
         if ($this->form->isValid()) {
             $result = $this->form->save();
             $this->getUser()->setFlash($result['messageType'], $result['message']);
         }
     }
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:15,代码来源:beaconRegistrationAction.class.php

示例8: execute

 /**
  * Executes deleteLeaveType action
  *
  * @param sfRequest $request A request object
  */
 public function execute($request)
 {
     if ($request->isMethod('post')) {
         if (count($request->getParameter('chkSelectRow')) == 0) {
             $this->getUser()->setFlash('notice', __(TopLevelMessages::SELECT_RECORDS));
         } else {
             $leaveTypeService = $this->getLeaveTypeService();
             $leaveTypeIds = $request->getParameter('chkSelectRow');
             $leaveTypeService->deleteLeaveType($leaveTypeIds);
             $this->getUser()->setFlash('success', __(TopLevelMessages::DELETE_SUCCESS));
         }
         $this->redirect('leave/leaveTypeList');
     }
 }
开发者ID:abdocmd,项目名称:orangehrm-3.0.1,代码行数:19,代码来源:deleteLeaveTypeAction.class.php

示例9: execute

 /**
  * Executes this action
  *
  * @param sfRequest $request A request object
  */
 public function execute($request)
 {
     $this->getUser()->setAuthenticated(false);
     $this->form = new opAdminLoginForm();
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameter('admin_user'));
         if ($this->form->isValid()) {
             $this->getUser()->login($this->form->getValue('adminUser')->getId());
             $this->redirect('default/top');
         }
         return sfView::ERROR;
     }
     return sfView::SUCCESS;
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:19,代码来源:loginAction.class.php

示例10: execute

 /**
  * Executes deleteLeaveType action
  *
  * @param sfRequest $request A request object
  */
 public function execute($request)
 {
     $this->leaveTypePermissions = $this->getDataGroupPermissions('leave_types');
     if ($request->isMethod('post')) {
         if (count($request->getParameter('chkSelectRow')) == 0) {
             $this->getUser()->setFlash('notice', __(TopLevelMessages::SELECT_RECORDS));
         } else {
             if ($this->leaveTypePermissions->canDelete()) {
                 $form = new DefaultListForm(array(), array(), true);
                 $form->bind($request->getParameter($form->getName()));
                 if ($form->isValid()) {
                     $leaveTypeService = $this->getLeaveTypeService();
                     $leaveTypeIds = $request->getParameter('chkSelectRow');
                     $leaveTypeService->deleteLeaveType($leaveTypeIds);
                     $this->getUser()->setFlash('success', __(TopLevelMessages::DELETE_SUCCESS));
                 }
             }
         }
         $this->redirect('leave/leaveTypeList');
     }
 }
开发者ID:CamilleCrespeau,项目名称:orangehrm,代码行数:26,代码来源:deleteLeaveTypeAction.class.php

示例11: executeLogin

 /**
  * Авторизация пользователя
  */
 public function executeLogin(sfRequest $request)
 {
     $this->setLayout("layout");
     $user = $this->getUser();
     if ($user->isAuthenticated()) {
         return $this->redirect('@homepage');
     }
     // Запрос на авторизацию
     if ($request->isMethod('post')) {
         $this->form = new myAuthForm();
         $params = $request->getPostParameters();
         $this->form->bind($params['auth']);
         if ($this->form->isValid()) {
             $values = $this->form->getValues();
             $remember = array_key_exists('remember', $values) ? $values['remember'] : false;
             $user->signIn($this->form->getUser(), $remember);
             return $this->redirect('@homepage');
         }
         // Форвард из других контроллеров
     } else {
         $this->form = new myAuthForm();
     }
     return sfView::SUCCESS;
 }
开发者ID:EasyFinance,项目名称:myAuthPlugin,代码行数:27,代码来源:BasemyAuthActions.class.php

示例12: executeLogin

 /**
  * Авторизация пользователя / сообщение о неавторизованности
  */
 public function executeLogin(sfRequest $request)
 {
     $this->setLayout("layout");
     $user = $this->getUser();
     if (!$user->isAuthenticated()) {
         if ($request->isMethod('post')) {
             $form = new myAuthForm();
             $form->bind($request->getPostParameters());
             if ($form->isValid()) {
                 $userRecord = $form->getUser();
             } else {
                 return $this->raiseError($form->getErrorSchema());
             }
         } else {
             return $this->raiseError('Authentification required');
         }
         $user->signIn($userRecord);
     }
     if (!$this->checkSubscription()) {
         $user->signOut();
         return $this->raiseError('Payment required', 402);
     }
     return sfView::SUCCESS;
 }
开发者ID:ru-easyfinance,项目名称:EasyFinance,代码行数:27,代码来源:actions.class.php

示例13: executeDropMember

 /**
  * Executes dropMember action
  *
  * @param sfRequest $request A request object
  */
 public function executeDropMember($request)
 {
     $this->redirectUnless($this->isAdmin || $this->isSubAdmin, '@error');
     $member = Doctrine::getTable('Member')->find($request->getParameter('member_id'));
     $this->forward404Unless($member);
     $isCommunityMember = Doctrine::getTable('CommunityMember')->isMember($member->getId(), $this->id);
     $this->redirectUnless($isCommunityMember, '@error');
     $isAdmin = Doctrine::getTable('CommunityMember')->isAdmin($member->getId(), $this->id);
     $isSubAdmin = Doctrine::getTable('CommunityMember')->isSubAdmin($member->getId(), $this->id);
     $this->redirectIf($isAdmin || $isSubAdmin, '@error');
     if ($request->isMethod(sfWebRequest::POST)) {
         $request->checkCSRFProtection();
         Doctrine::getTable('CommunityMember')->quit($member->getId(), $this->id);
         $this->redirect('@community_memberManage?id=' . $this->id);
     }
     $this->member = $member;
     $this->community = Doctrine::getTable('Community')->find($this->id);
     return sfView::INPUT;
 }
开发者ID:nise-nabe,项目名称:ppcon-sns,代码行数:24,代码来源:opCommunityAction.class.php

示例14: executeApply

 /**
  * Executes apply action
  *
  * @param sfRequest $request A request object
  */
 public function executeApply(sfRequest $request)
 {
     $this->form = $this->newForm('sfApplyApplyForm');
     if ($request->isMethod('post')) {
         $parameter = $request->getParameter('sfApplyApply');
         $this->form->bind($request->getParameter('sfApplyApply'));
         if ($this->form->isValid()) {
             $guid = "n" . self::createGuid();
             $this->form->setValidate($guid);
             $this->form->save();
             // Generate unique token based on random time
             list($usec, $sec) = explode(" ", microtime());
             $rand_num = substr(sha1((int) ($usec * 1000000 * ($sec / 1000000))), 0, 20);
             // Retrieve current user
             $user = $this->form->getObject();
             $now = date("Y-m-d H:i:s");
             // Create new entry into sfGuardUserProfile table
             $profileObject = new sfGuardUserProfile();
             $profileObject->setUserId($user->getId());
             $profileObject->setToken($rand_num);
             $profileObject->setSecurityLevel(sfConfig::get('app_security_level_new_user'));
             $userPermission = Doctrine_Core::getTable("sfGuardPermission")->findOneByName(sfConfig::get('app_permission_new_user'));
             if (empty($userPermission)) {
                 return;
             }
             // Create new entry into sfGuardUserPermission table
             $permissionObject = new sfGuardUserPermission();
             $permissionObject->setUserId($user->getId());
             $permissionObject->setPermissionId($userPermission->getId());
             $permissionObject->setCreatedAt($now);
             $permissionObject->setUpdatedAt($now);
             $userGroup = Doctrine_Core::getTable("sfGuardGroup")->findOneByName(sfConfig::get('app_project_group'));
             if (empty($userGroup)) {
                 return;
             }
             // Create new entry into sfGuardUserGroup table
             $groupObject = new sfGuardUserGroup();
             $groupObject->setUserId($user->getId());
             $groupObject->setGroupId($userGroup->getId());
             $groupObject->setCreatedAt($now);
             $groupObject->setUpdatedAt($now);
             try {
                 // Send mail
                 $this->sendVerificationMail($user);
                 // Save tables entries
                 $profileObject->save();
                 $permissionObject->save();
                 $groupObject->save();
                 return 'After';
             } catch (Exception $e) {
                 $groupObject->delete();
                 $permissionObject->delete();
                 $profileObject->delete();
                 $user->delete();
                 throw $e;
                 // You could re-throw $e here if you want to
                 // make it available for debugging purposes
                 return 'MailerError';
             }
         }
     }
 }
开发者ID:alex1818,项目名称:TestReportCenter,代码行数:67,代码来源:actions.class.php

示例15: executeConfigImage

 /**
  * Executes configImage action
  *
  * @param sfRequest $request A request object
  */
 public function executeConfigImage($request)
 {
     $options = array('member' => $this->getUser()->getMember());
     $this->form = new MemberImageForm(array(), $options);
     if ($request->isMethod(sfWebRequest::POST)) {
         try {
             if (!$this->form->bindAndSave($request->getParameter('member_image'), $request->getFiles('member_image'))) {
                 $errors = $this->form->getErrorSchema()->getErrors();
                 if (isset($errors['file'])) {
                     $error = $errors['file'];
                     $i18n = $this->getContext()->getI18N();
                     $this->getUser()->setFlash('error', $i18n->__($error->getMessageFormat(), $error->getArguments()));
                 }
             }
         } catch (opRuntimeException $e) {
             $this->getUser()->setFlash('error', $e->getMessage());
         }
         $this->redirect('@member_config_image');
     }
 }
开发者ID:shotaatago,项目名称:OpenPNE3,代码行数:25,代码来源:actions.class.php


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