summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpfspot.class.php18
-rw-r--r--phpfspot.js36
-rw-r--r--rpc.php11
3 files changed, 37 insertions, 28 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php
index 9a74a9a..0954040 100644
--- a/phpfspot.class.php
+++ b/phpfspot.class.php
@@ -1460,19 +1460,19 @@ class PHPFSPOT {
*/
public function startSearch($searchfor_tag, $from = 0, $to = 0)
{
- if(isset($_GET['from']) && $fspot->isValidDate($_GET['from'])) {
- $from = $_GET['from'];
+ if(isset($_POST['from']) && $this->isValidDate($_POST['from'])) {
+ $from = $_POST['from'];
}
- if(isset($_GET['to']) && $fspot->isValidDate($_GET['to'])) {
- $to = $_GET['to'];
+ if(isset($_POST['to']) && $this->isValidDate($_POST['to'])) {
+ $to = $_POST['to'];
}
- if(isset($_GET['for_tag']) && is_string($_GET['for_tag'])) {
- $searchfor_tag = $_GET['for_tag'];
+ if(isset($_POST['for_tag']) && is_string($_POST['for_tag'])) {
+ $searchfor_tag = $_POST['for_tag'];
}
- if(isset($_GET['for_name']) && is_string($_GET['for_name'])) {
- $searchfor_name = $_GET['for_name'];
+ if(isset($_POST['for_name']) && is_string($_POST['for_name'])) {
+ $searchfor_name = $_POST['for_name'];
}
$this->get_tags();
@@ -1499,6 +1499,8 @@ class PHPFSPOT {
}
}
+ return "ok";
+
} // startSearch()
/**
diff --git a/phpfspot.js b/phpfspot.js
index d11f524..c90d80e 100644
--- a/phpfspot.js
+++ b/phpfspot.js
@@ -92,9 +92,6 @@ function setCheckedValue(condition, value) {
function startSearch()
{
- var searchfor_tag = document.getElementsByName('searchfor_tag')[0].value;
- var searchfor_name = document.getElementsByName('searchfor_name')[0].value;
-
from_year = document.getElementById('fromyear').value;
from_month = document.getElementById('frommonth').value;
from_day = document.getElementById('fromday').value;
@@ -104,27 +101,32 @@ function startSearch()
to_day = document.getElementById('today').value;
to = to_year +"-"+ to_month +"-"+ to_day;
- var request = 'rpc.php?action=search';
+ // Create object with values of the form
+ var objTemp = new Object();
+ objTemp['action'] = 'search';
- if(searchfor_tag != "") {
- request = request + '&for_tag=' + searchfor_tag;
+ if(document.getElementsByName('searchfor_tag')[0].value != "") {
+ objTemp['for_tag'] = document.getElementsByName('searchfor_tag')[0].value;
}
-
- if(searchfor_name != "") {
- request = request + '&for_name=' + searchfor_name;
+ if(document.getElementsByName('searchfor_name')[0].value != "") {
+ objTemp['for_name'] = document.getElementsByName('searchfor_name')[0].value;
}
-
if(document.getElementsByName('consider_date')[0].checked == true) {
- request = request + '&from='+ from +'&to='+ to;
+ objTemp['from'] = from;
+ objTemp['to'] = to;
}
- HTML_AJAX.grab(encodeURI(request));
+ var retr = HTML_AJAX.post('rpc.php', objTemp);
+ if(retr == "ok") {
+ refreshAvailableTags();
+ refreshSelectedTags();
+ showPhotoIndex();
+ }
+ else {
+ window.alert(retr);
+ }
- refreshAvailableTags();
- refreshSelectedTags();
- showPhotoIndex();
-
-}
+} // startSearch()
function datesearch()
{
diff --git a/rpc.php b/rpc.php
index 1f8698e..b2d258c 100644
--- a/rpc.php
+++ b/rpc.php
@@ -43,10 +43,15 @@ class PHPFSPOT_RPC {
/* if no action is specified, no need to further process this
* function here.
*/
- if(!isset($_GET['action']))
+ if(!isset($_GET['action']) && !isset($_POST['action']))
return;
- switch($_GET['action']) {
+ if(isset($_GET['action']))
+ $action = $_GET['action'];
+ if(isset($_POST['action']))
+ $action = $_POST['action'];
+
+ switch($action) {
case 'showphoto':
if(isset($_GET['id']) && is_numeric($_GET['id'])) {
$fspot->showPhoto($_GET['id']);
@@ -102,7 +107,7 @@ class PHPFSPOT_RPC {
break;
case 'search':
- $fspot->startSearch($_GET['for']);
+ print $fspot->startSearch($_GET['for']);
break;
case 'update_sort_order':