3 /* *************************************************************************
5 * phpfspot, presents your F-Spot photo collection in Web browsers.
7 * Copyright (c) by Andreas Unterkircher
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 * *************************************************************************/
25 require_once "phpfspot.class.php";
29 public function __construct()
35 public function process_ajax_request()
37 require_once 'HTML/AJAX/Server.php';
39 $server = new HTML_AJAX_Server();
40 $server->handleRequest();
42 $fspot = new PHPFSPOT();
44 /* if no action is specified, no need to further process this
47 if(!isset($_GET['action']) && !isset($_POST['action']))
50 if(isset($_GET['action']))
51 $action = $_GET['action'];
52 if(isset($_POST['action']))
53 $action = $_POST['action'];
57 if(isset($_GET['id']) && is_numeric($_GET['id'])) {
58 $fspot->showPhoto($_GET['id']);
63 print $fspot->get_xml_tag_list();
66 case 'show_available_tags':
67 print $fspot->getAvailableTags();
70 case 'show_selected_tags':
71 print $fspot->getSelectedTags();
75 if(isset($_POST['id']) && is_numeric($_POST['id'])) {
76 print $fspot->addTag($_POST['id']);
81 if(isset($_POST['id']) && is_numeric($_POST['id'])) {
82 print $fspot->delTag($_POST['id']);
87 $fspot->resetTagSearch();
88 $fspot->resetNameSearch();
90 $fspot->resetDateSearch();
91 $fspot->resetPhotoView();
95 if(isset($_POST['mode']) && in_array($_POST['mode'], Array('or', 'and'))) {
96 print $fspot->setTagCondition($_POST['mode']);
100 case 'show_photo_index':
101 if(isset($_GET['begin_with']) && is_numeric($_GET['begin_with'])) {
102 $_SESSION['begin_with'] = $_GET['begin_with'];
105 unset($_SESSION['begin_with']);
107 if(isset($_GET['last_photo']) && is_numeric($_GET['last_photo']))
108 $_SESSION['last_photo'] = $_GET['last_photo'];
110 $fspot->showPhotoIndex();
114 $fspot->showCredits();
118 print $fspot->startSearch();
121 case 'update_sort_order':
122 if(isset($_POST['value']) && is_string($_POST['value'])) {
123 print $fspot->updateSortOrder($_POST['value']);
128 /* $_GET['mode'] will be validated by getExport() */
129 $fspot->getExport($_GET['mode']);
132 case 'get_photo_to_show':
133 $fspot->getCurrentPhoto();
136 case 'get_calendar_matrix':
137 if((is_numeric($_GET['year']) || !isset($_GET['year'])) &&
138 (is_numeric($_GET['month']) || !isset($_GET['month'])) &&
139 (is_numeric($_GET['day']) || !isset($_GET['day']))) {
140 $fspot->get_calendar_matrix($_GET['year'], $_GET['month'], $_GET['day']);
145 print $fspot->whatToDo();
148 case 'reset_slideshow':
149 print $fspot->resetSlideShow();
152 case 'get_next_slideshow_img':
153 print $fspot->getNextSlideShowImage();
156 case 'get_prev_slideshow_img':
157 print $fspot->getPrevSlideShowImage();
162 } // process_ajax_request();
164 } // class PHPFSPOT_RPC
166 $rpc = new PHPFSPOT_RPC();
167 $rpc->process_ajax_request();