refine search

git-svn-id: file:///home/shish/svn/shimmie2/trunk@49 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2007-05-01 13:30:05 +00:00
parent ad37982680
commit ff0fcee777
2 changed files with 32 additions and 4 deletions

View file

@ -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 *
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

View file

@ -286,7 +286,9 @@ class TagList extends Extension {
return "";
}
else {
return "<a href='".make_link("index/")."' title='Remove'>r</a>";
$tags = array_remove($tags, $tag);
$tags = array_remove($tags, "-$tag");
return "<a href='".make_link("index", "search=".html_escape(join('+', $tags)))."' title='Remove'>R</a>";
}
}
@ -295,7 +297,9 @@ class TagList extends Extension {
return "";
}
else {
return "<a href='".make_link("index/")."' title='Add'>a</a>";
$tags = array_remove($tags, "-$tag");
$tags = array_add($tags, $tag);
return "<a href='".make_link("index", "search=".html_escape(join('+', $tags)))."' title='Add'>A</a>";
}
}
@ -304,7 +308,9 @@ class TagList extends Extension {
return "";
}
else {
return "<a href='".make_link("index/")."' title='Subtract'>s</a>";
$tags = array_remove($tags, $tag);
$tags = array_add($tags, "-$tag");
return "<a href='".make_link("index", "search=".html_escape(join('+', $tags)))."' title='Subtract'>S</a>";
}
}
// }}}