delete.php 624 B

123456789101112131415161718192021
  1. <?php
  2. /**
  3. * Remove a page (revision) annotation
  4. *
  5. * @package ElggPages
  6. */
  7. // Make sure we can get the annotations and entity in question
  8. $annotation_id = (int) get_input('annotation_id');
  9. $annotation = elgg_get_annotation_from_id($annotation_id);
  10. if ($annotation) {
  11. $entity = get_entity($annotation->entity_guid);
  12. if (pages_is_page($entity) && $entity->canEdit() && $annotation->canEdit()) {
  13. $annotation->delete();
  14. system_message(elgg_echo("pages:revision:delete:success"));
  15. forward("pages/history/{$annotation->entity_guid}");
  16. }
  17. }
  18. register_error(elgg_echo("pages:revision:delete:failure"));
  19. forward(REFERER);