コード例 #1
0
 private function toggleAdministrator($administrator)
 {
     $user = UserPeer::getUserFromNickname($this->getRequestParameter('nickname'));
     $this->forward404Unless($user);
     $user->setIsAdministrator($administrator);
     $user->save();
     $this->redirect($this->getRequest()->getReferer());
 }
コード例 #2
0
 public function executeShowSubscriber()
 {
     if ($this->hasRequestParameter('nickname')) {
         $this->subscriber = UserPeer::getUserFromNickname($this->getRequestParameter('nickname'));
     } else {
         $this->subscriber = $this->getUser()->getSubscriber();
     }
     $this->forward404Unless($this->subscriber);
     //    $this->setShowVars();
 }
コード例 #3
0
ファイル: actions.class.php プロジェクト: emacsattic/symfony
 public function executeAdd()
 {
     if ($this->getRequest()->getMethod() == sfRequest::POST) {
         if (!$this->getRequestParameter('body')) {
             return sfView::NONE;
         }
         $question = QuestionPeer::retrieveByPk($this->getRequestParameter('question_id'));
         $this->forward404Unless($question);
         // user or anonymous coward
         $user = $this->getUser()->isAuthenticated() ? $this->getUser()->getSubscriber() : UserPeer::getUserFromNickname('anonymous');
         // create answer
         $this->answer = new Answer();
         $this->answer->setQuestion($question);
         $this->answer->setBody($this->getRequestParameter('body'));
         $this->answer->setUser($user);
         $this->answer->save();
         return sfView::SUCCESS;
     }
     $this->forward404();
 }