diff --git a/core/util.inc.php b/core/util.inc.php
index 5d317895..ed059e1a 100644
--- a/core/util.inc.php
+++ b/core/util.inc.php
@@ -162,7 +162,7 @@ function get_memory_limit() {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
-* Input sanitising *
+* Misc *
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
function get_thumbnail_size($orig_width, $orig_height) {
@@ -197,6 +197,28 @@ function CountExecs($db, $sql, $inputarray) {
}
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
+* Things which should be in the core API *
+\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+function array_remove($array, $to_remove) {
+ $array = array_unique($array);
+ $a2 = array();
+ foreach($array as $existing) {
+ if($existing != $to_remove) {
+ $a2[] = $existing;
+ }
+ }
+ return $a2;
+}
+
+function array_add($array, $element) {
+ $array[] = $element;
+ $array = array_unique($array);
+ return $array;
+}
+
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
* Event API *
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
diff --git a/ext/tag_list.ext.php b/ext/tag_list.ext.php
index 4bc7213e..5a17656e 100644
--- a/ext/tag_list.ext.php
+++ b/ext/tag_list.ext.php
@@ -286,7 +286,9 @@ class TagList extends Extension {
return "";
}
else {
- return "r";
+ $tags = array_remove($tags, $tag);
+ $tags = array_remove($tags, "-$tag");
+ return "R";
}
}
@@ -295,7 +297,9 @@ class TagList extends Extension {
return "";
}
else {
- return "a";
+ $tags = array_remove($tags, "-$tag");
+ $tags = array_add($tags, $tag);
+ return "A";
}
}
@@ -304,7 +308,9 @@ class TagList extends Extension {
return "";
}
else {
- return "s";
+ $tags = array_remove($tags, $tag);
+ $tags = array_add($tags, "-$tag");
+ return "S";
}
}
// }}}