aboutsummaryrefslogtreecommitdiff
path: root/mod/pages/actions/annotations/page/delete.php
diff options
context:
space:
mode:
authorJeff Tilson <jrtilson@gmail.com>2013-04-05 13:35:13 -0400
committerJeff Tilson <jrtilson@gmail.com>2013-04-05 13:35:13 -0400
commit5103c706857719615102eda7cfd823b0723a1476 (patch)
tree156f69ffa5914368ef4fc1a878503db867993fd4 /mod/pages/actions/annotations/page/delete.php
parent835c7fe5eb77343081b9bd33ec465f9ce8929570 (diff)
downloadelgg-5103c706857719615102eda7cfd823b0723a1476.tar.gz
elgg-5103c706857719615102eda7cfd823b0723a1476.tar.bz2
Allow pages revisions to be reverted or deleted
Diffstat (limited to 'mod/pages/actions/annotations/page/delete.php')
-rw-r--r--mod/pages/actions/annotations/page/delete.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/mod/pages/actions/annotations/page/delete.php b/mod/pages/actions/annotations/page/delete.php
new file mode 100644
index 000000000..792b7c0bc
--- /dev/null
+++ b/mod/pages/actions/annotations/page/delete.php
@@ -0,0 +1,25 @@
+<?php
+/**
+ * Remove a page (revision) annotation
+ *
+ * @package ElggPages
+ */
+
+// Ensure we're logged in
+if (!elgg_is_logged_in()) {
+ forward();
+}
+
+// Make sure we can get the annotations and entity in question
+$annotation_id = (int) get_input('annotation_id');
+$annotation = elgg_get_annotation_from_id($annotation_id);
+$entity = get_entity($annotation->entity_guid);
+
+if ($annotation && $entity->canEdit() && $annotation->canEdit()) {
+ $annotation->delete();
+ system_message(elgg_echo("pages:revision:delete:success"));
+} else {
+ register_error(elgg_echo("pages:revision:delete:failure"));
+}
+
+forward("pages/history/{$annotation->entity_guid}"); \ No newline at end of file