Пример #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
 /**
  * Remove one or more entries
  *
  * @return  void
  */
 public function removeTask()
 {
     // Check for request forgeries
     Request::checkToken();
     // Incoming
     $wish = Request::getInt('wish', 0);
     $ids = Request::getVar('id', array());
     $ids = !is_array($ids) ? array($ids) : $ids;
     // Do we have any IDs?
     if (count($ids) > 0) {
         $tbl = new Comment($this->database);
         // Loop through each ID
         foreach ($ids as $id) {
             $id = intval($id);
             if (!$tbl->delete($id)) {
                 throw new Exception($tbl->getError(), 500);
             }
         }
     }
     // Redirect
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&wish=' . $wish, false), Lang::txt('COM_WISHLIST_ITEMS_REMOVED', count($ids)));
 }