change text of where the welcome template can be found
[phpfspot.git] / rpc.php
diff --git a/rpc.php b/rpc.php
index bdb7004ad6de1d6a03ec68c1760077517aa8e67d..6c94e8f72653a0e6715bd09fe0ee04519c66576e 100644 (file)
--- 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();