aboutsummaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2009-06-16 01:39:32 +0000
committerCash Costello <cash.costello@gmail.com>2009-06-16 01:39:32 +0000
commitb4b85ecc55a6787726627150a2ee93fd960ff2c6 (patch)
tree35e8e30305355b72c011c26597eec75759cc4b17 /actions
parentde4945a1bb1b627a530048c7dece50805d06f1ee (diff)
downloadelgg-b4b85ecc55a6787726627150a2ee93fd960ff2c6.tar.gz
elgg-b4b85ecc55a6787726627150a2ee93fd960ff2c6.tar.bz2
added delete phototags capability
Diffstat (limited to 'actions')
-rw-r--r--actions/deletetag.php51
1 files changed, 51 insertions, 0 deletions
diff --git a/actions/deletetag.php b/actions/deletetag.php
new file mode 100644
index 000000000..cd76b0a1d
--- /dev/null
+++ b/actions/deletetag.php
@@ -0,0 +1,51 @@
+<?php
+ /**
+ * Tidypics Delete Photo Tag
+ *
+ */
+
+ gatekeeper();
+ action_gatekeeper();
+
+ //$user_id = get_input('user_id');
+ $image_guid = get_input('image_guid');
+ $tags = get_input('tags');
+
+
+ if ($image_guid == 0) {
+ register_error(elgg_echo("tidypics:phototagging:error"));
+ forward($_SERVER['HTTP_REFERER']);
+ }
+
+ $image = get_entity($image_guid);
+ if (!$image)
+ {
+ register_error(elgg_echo("tidypics:phototagging:error"));
+ forward($_SERVER['HTTP_REFERER']);
+ }
+
+ foreach ($tags as $id => $value) {
+ // delete normal tag if it exists
+ if (is_array($image->tags)) {
+ $index = array_search($value[0], $image->tags);
+ if ($index !== false) {
+ $tagarray = $image->tags;
+ unset($tagarray[$index]);
+ $image->clearMetadata('tags');
+ $image->tags = $tagarray;
+ }
+ } else {
+ if ($value[0] === $image->tags) {
+ $image->clearMetadata('tags');
+ }
+ }
+
+ // delete the photo tag annotation
+ delete_annotation($id);
+ }
+
+ system_message(elgg_echo("tidypics:deletetag:success"));
+
+ forward($_SERVER['HTTP_REFERER']);
+
+?>