Esempio n. 1
0
 /**
  * Register a new user
  * @param array $post
  * @return false|int
  */
 public function register($post, $form = null)
 {
     if (null === $form) {
         $form = RFLib_Core::getForm('userRegister');
     }
     return $this->_save($form, $post, array('group_id' => 10, 'logo' => self::PROTRAIT));
 }
Esempio n. 2
0
 public function authenticateAction()
 {
     $loginErrorMsg = array('登录失败,请确认是否输入正确的邮箱地址和密码!');
     $request = $this->getRequest();
     if (!$request->isPost()) {
         return $this->_helper->redirector('login');
     }
     // Validate by form
     $postData = $request->getPost();
     $form = RFLib_Core::getForm('userLogin');
     if (!$form->isValid($postData)) {
         $this->view->errorMsg = $loginErrorMsg;
         return $this->render('login');
     }
     // validate by tabledb
     if (false === $this->_authService->authenticate($form->getValues())) {
         $this->view->errorMsg = $loginErrorMsg;
         return $this->render('login');
     }
     return $this->_redirect("index");
 }
Esempio n. 3
0
 public function replyAction()
 {
     $request = $this->getRequest();
     if ($request->isPost()) {
         $postData = $request->getPost();
         $form = RFLib_Core::getForm('questionReply');
         if ($form->isValid($postData)) {
             $answerModel = RFLib_Core::getModel('Answer');
             $postData['content'] = $postData['rp_content'];
             $postData['question_id'] = $answerModel->getQuestionIdById($postData['parent_id']);
             if ($answerModel->create($postData, $form)) {
                 $json = array('error' => 0, 'msg' => '', 'url' => $this->view->urlFor('question/postreply?id=' . $postData['parent_id']));
             } else {
                 $json = array('error' => 1, 'msg' => '保存数据失败!');
             }
         } else {
             $json = array('error' => 2, 'msg' => '评论内容不能为空');
         }
         echo Zend_Json::encode($json);
         exit;
     }
 }