Esempio n. 1
0
 public function destroy_revision()
 {
     if (!isset($_POST['revision_id'])) {
         error(__("Error"), __("No revision ID specified.", "progress"));
     }
     $revision = new Revision($_POST['revision_id']);
     if ($revision->no_results) {
         error(__("Error"), __("Invalid revision ID specified.", "progress"));
     }
     if (!$revision->deletable()) {
         show_403(__("Access Denied"), __("You do not have sufficient privileges to delete this revision.", "progress"));
     }
     if (empty($revision->changes)) {
         Revision::delete($revision->id);
     } else {
         $revision->update("");
     }
     # If changes were made, just clear the body instead of altering history.
     Flash::notice(__("Revision deleted.", "progress"), $revision->ticket->url());
 }
Esempio n. 2
0
 /**
  * Function: delete
  * Deletes the given ticket, including its revisions and attachment. Calls the "delete_ticket" trigger and passes the <Ticket> as an argument.
  *
  * Parameters:
  *     $id - The ticket to delete.
  */
 static function delete($id)
 {
     $ticket = new self($id);
     foreach ($ticket->revisions as $revision) {
         Revision::delete($revision->id);
     }
     parent::destroy(get_class(), $id);
     foreach ($ticket->attachments as $attachment) {
         unlink(uploaded($attachment->path, false));
     }
     if (module_enabled("cacher")) {
         Modules::$instances["cacher"]->regenerate();
     }
 }