summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpfspot.class.php10
-rw-r--r--phpfspot.js6
-rw-r--r--rpc.php4
-rw-r--r--templates/tags.tpl2
4 files changed, 15 insertions, 7 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php
index 6800da2..0a59d96 100644
--- a/phpfspot.class.php
+++ b/phpfspot.class.php
@@ -679,11 +679,17 @@ class PHPFSPOT {
} // setTagCondition()
- public function startSearch($searchfor)
+ public function startTagSearch($searchfor)
{
$_SESSION['searchfor'] = $searchfor;
+ $_SESSION['selected_tags'] = Array();
- } // startSearch()
+ foreach($this->avail_tags as $tag) {
+ if(preg_match('/'. $searchfor .'/i', $this->tags[$tag]))
+ array_push($_SESSION['selected_tags'], $tag);
+ }
+
+ } // startTagSearch()
private function rotateImage($img, $degrees)
{
diff --git a/phpfspot.js b/phpfspot.js
index fcc5766..92c08b7 100644
--- a/phpfspot.js
+++ b/phpfspot.js
@@ -95,9 +95,11 @@ function setCheckedValue(condition, value) {
}
}
-function startSearch(searchfor)
+function startTagSearch(searchfor)
{
- HTML_AJAX.grab(encodeURI('rpc.php?action=search&for=' + searchfor));
+ HTML_AJAX.grab(encodeURI('rpc.php?action=tag_search&for=' + searchfor));
+ refreshAvailableTags();
+ refreshSelectedTags();
showPhotoIndex();
}
diff --git a/rpc.php b/rpc.php
index 6775647..b5d5d35 100644
--- a/rpc.php
+++ b/rpc.php
@@ -94,9 +94,9 @@ class PHPFSPOT_RPC {
$fspot->showCredits();
break;
- case 'search':
+ case 'tag_search':
- $fspot->startSearch($_GET['for']);
+ $fspot->startTagSearch($_GET['for']);
break;
}
diff --git a/templates/tags.tpl b/templates/tags.tpl
index 20d5c9b..3efcc31 100644
--- a/templates/tags.tpl
+++ b/templates/tags.tpl
@@ -6,7 +6,7 @@
</tr>
<tr>
<td class="searchfor">
- <form action="" onsubmit="startSearch(document.getElementsByName('searchfor')[0].value); return false;">
+ <form action="" onsubmit="startTagSearch(document.getElementsByName('searchfor')[0].value); return false;">
<input type="text" name="searchfor" value="{$searchfor}" size="15" />
<input type="image" src="resources/doit.png" alt="Tag-Search" />
</form>