X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=blobdiff_plain;f=rpc.php;h=6c94e8f72653a0e6715bd09fe0ee04519c66576e;hp=bdb7004ad6de1d6a03ec68c1760077517aa8e67d;hb=f89f1aeb2004bbccf3d08fdccc41b235f8e1beb0;hpb=7f6d907624ab03de8a4044ae0ddcdad3a132f13c diff --git a/rpc.php b/rpc.php index bdb7004..6c94e8f 100644 --- a/rpc.php +++ b/rpc.php @@ -31,7 +31,7 @@ class PHPFSPOT_RPC { } // __construct() - function process_ajax_request() + public function process_ajax_request() { require_once 'HTML/AJAX/Server.php'; @@ -40,6 +40,12 @@ class PHPFSPOT_RPC { $fspot = new PHPFSPOT(); + /* if no action is specified, no need to further process this + * function here. + */ + if(!isset($_GET['action'])) + return; + switch($_GET['action']) { case 'showphoto': if(isset($_GET['id']) && is_numeric($_GET['id'])) { @@ -48,11 +54,11 @@ class PHPFSPOT_RPC { break; case 'show_available_tags': - $fspot->getAvailableTags(); + print $fspot->getAvailableTags(); break; case 'show_selected_tags': - $fspot->getSelectedTags(); + print $fspot->getSelectedTags(); break; case 'addtag': @@ -95,13 +101,19 @@ class PHPFSPOT_RPC { break; case 'search': - $fspot->startSearch($_GET['for'], $_GET['sort_order'], $_GET['from'], $_GET['to']); + $fspot->startSearch($_GET['for'], $_GET['from'], $_GET['to']); if((isset($_GET['from']) && $fspot->isValidDate($_GET['from'])) && (isset($_GET['to']) && $fspot->isValidDate($_GET['to']))) { } else { - $fspot->startSearch($_GET['for'], $_GET['sort_order']); + $fspot->startSearch($_GET['for']); + } + break; + + case 'update_sort_order': + if(isset($_POST['value']) && is_string($_POST['value'])) { + print $fspot->updateSortOrder($_POST['value']); } break; @@ -142,7 +154,7 @@ class PHPFSPOT_RPC { } // process_ajax_request(); -} +} // class PHPFSPOT_RPC $rpc = new PHPFSPOT_RPC(); $rpc->process_ajax_request();