Esempio n. 1
0
 /**
  * modify comment
  */
 public function modify()
 {
     if ($this->isPost()) {
         $uid = $this->user['uid'];
         if (empty($uid)) {
             Message::showError('please login');
         }
         $comment_id = trim($_POST['id']);
         if (!is_numeric($comment_id)) {
             Message::showError('comment id necessay');
         }
         $content = trim($_POST['content']);
         if (empty($content)) {
             Message::showError('content is empty');
         }
         if (!is_numeric($_POST['star'])) {
             Message::showError('star is not number');
         }
         $star = trim($_POST['star']);
         $commentModel = new CommentModel();
         $result = $commentModel->modify($uid, $comment_id, $star, $content);
         if (!empty($result)) {
             Message::showSucc('modify comment success');
         } else {
             Message::showError('modify comment failed');
         }
     }
     $this->display('comment.html');
 }