Пример #1
0
 /**
  * Save a comment
  *
  * @return  string
  */
 public function savecommentTask()
 {
     // Check for request forgeries
     Request::checkToken();
     // Ensure the user is logged in
     if (User::isGuest()) {
         return $this->loginTask();
     }
     // Incoming
     $comment = Request::getVar('comment', array(), 'post', 'none', 2);
     // Instantiate a new comment object and pass it the data
     $row = new Comment($this->database);
     if (!$row->bind($comment)) {
         $this->setError($row->getError());
         return $this->displayTask();
     }
     // Check content
     if (!$row->check()) {
         $this->setError($row->getError());
         return $this->displayTask();
     }
     // Store new content
     if (!$row->store()) {
         $this->setError($row->getError());
         return $this->displayTask();
     }
     $this->displayTask();
 }