Пример #1
0
 /**
  * Delete a comment
  *
  * @return  string
  */
 public function deletecommentTask()
 {
     // Ensure the user is logged in
     if (User::isGuest()) {
         return $this->loginTask();
     }
     // Incoming
     $id = Request::getInt('comment', 0);
     if (!$id) {
         return $this->displayTask();
     }
     // Initiate a whiteboard comment object
     $comment = new Comment($this->database);
     $comment->load($id);
     $comment->state = 2;
     // Delete the entry itself
     if (!$comment->store()) {
         $this->setError($comment->getError());
     }
     // Return the topics list
     return $this->displayTask();
 }
Пример #2
0
 /**
  * Set the anonymous state of an entry
  *
  * @return  void
  */
 public function anonTask()
 {
     // Check for request forgeries
     Request::checkToken(['get', 'post']);
     $state = $this->getTask() == 'anonymize' ? 1 : 0;
     // Incoming
     $wish = Request::getInt('wish', 0);
     $ids = Request::getVar('id', array());
     $ids = !is_array($ids) ? array($ids) : $ids;
     // Check for an ID
     if (count($ids) < 1) {
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . ($wish ? '&wish=' . $wish : ''), false));
         return;
     }
     // Update record(s)
     foreach ($ids as $id) {
         // Updating a category
         $row = new Comment($this->database);
         $row->load($id);
         $row->anonymous = $state;
         $row->store();
     }
     // Set the redirect
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . ($wish ? '&wish=' . $wish : ''), false));
 }