1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | Piwigo - a PHP based photo gallery | |
---|
4 | // +-----------------------------------------------------------------------+ |
---|
5 | // | Copyright(C) 2008-2013 Piwigo Team http://piwigo.org | |
---|
6 | // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | |
---|
7 | // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | |
---|
8 | // +-----------------------------------------------------------------------+ |
---|
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 | |
---|
12 | // | | |
---|
13 | // | This program is distributed in the hope that it will be useful, but | |
---|
14 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
15 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
16 | // | General Public License for more details. | |
---|
17 | // | | |
---|
18 | // | You should have received a copy of the GNU General Public License | |
---|
19 | // | along with this program; if not, write to the Free Software | |
---|
20 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
21 | // | USA. | |
---|
22 | // +-----------------------------------------------------------------------+ |
---|
23 | |
---|
24 | define ('PHPWG_ROOT_PATH', './'); |
---|
25 | |
---|
26 | include_once(PHPWG_ROOT_PATH.'include/common.inc.php'); |
---|
27 | check_status(ACCESS_FREE); |
---|
28 | |
---|
29 | if ( !$conf['allow_web_services'] ) |
---|
30 | { |
---|
31 | page_forbidden('Web services are disabled'); |
---|
32 | } |
---|
33 | |
---|
34 | include_once(PHPWG_ROOT_PATH.'include/ws_core.inc.php'); |
---|
35 | |
---|
36 | add_event_handler('ws_add_methods', 'ws_addDefaultMethods'); |
---|
37 | add_event_handler('ws_invoke_allowed', 'ws_isInvokeAllowed', EVENT_HANDLER_PRIORITY_NEUTRAL, 3); |
---|
38 | |
---|
39 | $requestFormat = 'rest'; |
---|
40 | $responseFormat = null; |
---|
41 | |
---|
42 | if ( isset($_GET['format']) ) |
---|
43 | { |
---|
44 | $responseFormat = $_GET['format']; |
---|
45 | } |
---|
46 | |
---|
47 | if ( !isset($responseFormat) and isset($requestFormat) ) |
---|
48 | { |
---|
49 | $responseFormat = $requestFormat; |
---|
50 | } |
---|
51 | |
---|
52 | $service = new PwgServer(); |
---|
53 | |
---|
54 | if (!is_null($requestFormat)) |
---|
55 | { |
---|
56 | $handler = null; |
---|
57 | switch ($requestFormat) |
---|
58 | { |
---|
59 | case 'rest': |
---|
60 | include_once(PHPWG_ROOT_PATH.'include/ws_protocols/rest_handler.php'); |
---|
61 | $handler = new PwgRestRequestHandler(); |
---|
62 | break; |
---|
63 | } |
---|
64 | $service->setHandler($requestFormat, $handler); |
---|
65 | } |
---|
66 | |
---|
67 | if (!is_null($responseFormat)) |
---|
68 | { |
---|
69 | $encoder = null; |
---|
70 | switch ($responseFormat) |
---|
71 | { |
---|
72 | case 'rest': |
---|
73 | include_once(PHPWG_ROOT_PATH.'include/ws_protocols/rest_encoder.php'); |
---|
74 | $encoder = new PwgRestEncoder(); |
---|
75 | break; |
---|
76 | case 'php': |
---|
77 | include_once(PHPWG_ROOT_PATH.'include/ws_protocols/php_encoder.php'); |
---|
78 | $encoder = new PwgSerialPhpEncoder(); |
---|
79 | break; |
---|
80 | case 'json': |
---|
81 | include_once(PHPWG_ROOT_PATH.'include/ws_protocols/json_encoder.php'); |
---|
82 | $encoder = new PwgJsonEncoder(); |
---|
83 | break; |
---|
84 | case 'xmlrpc': |
---|
85 | include_once(PHPWG_ROOT_PATH.'include/ws_protocols/xmlrpc_encoder.php'); |
---|
86 | $encoder = new PwgXmlRpcEncoder(); |
---|
87 | break; |
---|
88 | } |
---|
89 | $service->setEncoder($responseFormat, $encoder); |
---|
90 | } |
---|
91 | |
---|
92 | set_make_full_url(); |
---|
93 | $service->run(); |
---|
94 | |
---|
95 | |
---|
96 | /** |
---|
97 | * event handler that registers standard methods with the web service |
---|
98 | */ |
---|
99 | function ws_addDefaultMethods( $arr ) |
---|
100 | { |
---|
101 | global $conf, $user; |
---|
102 | $service = &$arr[0]; |
---|
103 | |
---|
104 | include_once(PHPWG_ROOT_PATH.'include/ws_functions.inc.php'); |
---|
105 | $ws_functions_root = PHPWG_ROOT_PATH.'include/ws_functions/'; |
---|
106 | |
---|
107 | $f_params = array( |
---|
108 | 'f_min_rate' => array('default'=>null, |
---|
109 | 'type'=>WS_TYPE_FLOAT), |
---|
110 | 'f_max_rate' => array('default'=>null, |
---|
111 | 'type'=>WS_TYPE_FLOAT), |
---|
112 | 'f_min_hit' => array('default'=>null, |
---|
113 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
114 | 'f_max_hit' => array('default'=>null, |
---|
115 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
116 | 'f_min_ratio' => array('default'=>null, |
---|
117 | 'type'=>WS_TYPE_FLOAT|WS_TYPE_POSITIVE), |
---|
118 | 'f_max_ratio' => array('default'=>null, |
---|
119 | 'type'=>WS_TYPE_FLOAT|WS_TYPE_POSITIVE), |
---|
120 | 'f_max_level' => array('default'=>null, |
---|
121 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
122 | 'f_min_date_available' => array('default'=>null), |
---|
123 | 'f_max_date_available' => array('default'=>null), |
---|
124 | 'f_min_date_created' => array('default'=>null), |
---|
125 | 'f_max_date_created' => array('default'=>null), |
---|
126 | ); |
---|
127 | |
---|
128 | $service->addMethod( |
---|
129 | 'pwg.getVersion', |
---|
130 | 'ws_getVersion', |
---|
131 | null, |
---|
132 | 'Returns the Piwigo version.', |
---|
133 | $ws_functions_root . 'pwg.php' |
---|
134 | ); |
---|
135 | |
---|
136 | $service->addMethod( |
---|
137 | 'pwg.getInfos', |
---|
138 | 'ws_getInfos', |
---|
139 | null, |
---|
140 | 'Returns general informations.', |
---|
141 | $ws_functions_root . 'pwg.php', |
---|
142 | array('admin_only'=>true) |
---|
143 | ); |
---|
144 | |
---|
145 | $service->addMethod( |
---|
146 | 'pwg.caddie.add', |
---|
147 | 'ws_caddie_add', |
---|
148 | array( |
---|
149 | 'image_id'=> array('flags'=>WS_PARAM_FORCE_ARRAY, |
---|
150 | 'type'=>WS_TYPE_ID), |
---|
151 | ), |
---|
152 | 'Adds elements to the caddie. Returns the number of elements added.', |
---|
153 | $ws_functions_root . 'pwg.php', |
---|
154 | array('admin_only'=>true) |
---|
155 | ); |
---|
156 | |
---|
157 | $service->addMethod( |
---|
158 | 'pwg.categories.getImages', |
---|
159 | 'ws_categories_getImages', |
---|
160 | array_merge(array( |
---|
161 | 'cat_id' => array('default'=>null, |
---|
162 | 'flags'=>WS_PARAM_FORCE_ARRAY, |
---|
163 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
164 | 'recursive' => array('default'=>false, |
---|
165 | 'type'=>WS_TYPE_BOOL), |
---|
166 | 'per_page' => array('default'=>100, |
---|
167 | 'maxValue'=>$conf['ws_max_images_per_page'], |
---|
168 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
169 | 'page' => array('default'=>0, |
---|
170 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
171 | 'order' => array('default'=>null, |
---|
172 | 'info'=>'id, file, name, hit, rating_score, date_creation, date_available, random'), |
---|
173 | ), $f_params), |
---|
174 | 'Returns elements for the corresponding categories. |
---|
175 | <br><b>cat_id</b> can be empty if <b>recursive</b> is true. |
---|
176 | <br><b>order</b> comma separated fields for sorting', |
---|
177 | $ws_functions_root . 'pwg.categories.php' |
---|
178 | ); |
---|
179 | |
---|
180 | $service->addMethod( |
---|
181 | 'pwg.categories.getList', |
---|
182 | 'ws_categories_getList', |
---|
183 | array( |
---|
184 | 'cat_id' => array('default'=>null, |
---|
185 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE, |
---|
186 | 'info'=>'Parent category. "0" or empty for root.'), |
---|
187 | 'recursive' => array('default'=>false, |
---|
188 | 'type'=>WS_TYPE_BOOL), |
---|
189 | 'public' => array('default'=>false, |
---|
190 | 'type'=>WS_TYPE_BOOL), |
---|
191 | 'tree_output' => array('default'=>false, |
---|
192 | 'type'=>WS_TYPE_BOOL), |
---|
193 | 'fullname' => array('default'=>false, |
---|
194 | 'type'=>WS_TYPE_BOOL), |
---|
195 | ), |
---|
196 | 'Returns a list of categories.', |
---|
197 | $ws_functions_root . 'pwg.categories.php' |
---|
198 | ); |
---|
199 | |
---|
200 | $service->addMethod( |
---|
201 | 'pwg.getMissingDerivatives', |
---|
202 | 'ws_getMissingDerivatives', |
---|
203 | array_merge(array( |
---|
204 | 'types' => array('default'=>null, |
---|
205 | 'flags'=>WS_PARAM_FORCE_ARRAY, |
---|
206 | 'info'=>'square, thumb, 2small, xsmall, small, medium, large, xlarge, xxlarge'), |
---|
207 | 'ids' => array('default'=>null, |
---|
208 | 'flags'=>WS_PARAM_FORCE_ARRAY, |
---|
209 | 'type'=>WS_TYPE_ID), |
---|
210 | 'max_urls' => array('default'=>200, |
---|
211 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
212 | 'prev_page' => array('default'=>null, |
---|
213 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
214 | ), $f_params), |
---|
215 | 'Returns a list of derivatives to build.', |
---|
216 | $ws_functions_root . 'pwg.php', |
---|
217 | array('admin_only'=>true) |
---|
218 | ); |
---|
219 | |
---|
220 | $service->addMethod( |
---|
221 | 'pwg.images.addComment', |
---|
222 | 'ws_images_addComment', |
---|
223 | array( |
---|
224 | 'image_id' => array('type'=>WS_TYPE_ID), |
---|
225 | 'author' => array('default'=>is_a_guest()?'guest':$user['username']), |
---|
226 | 'content' => array(), |
---|
227 | 'key' => array(), |
---|
228 | ), |
---|
229 | 'Adds a comment to an image.', |
---|
230 | $ws_functions_root . 'pwg.images.php', |
---|
231 | array('post_only'=>true) |
---|
232 | ); |
---|
233 | |
---|
234 | $service->addMethod( |
---|
235 | 'pwg.images.getInfo', |
---|
236 | 'ws_images_getInfo', |
---|
237 | array( |
---|
238 | 'image_id' => array('type'=>WS_TYPE_ID), |
---|
239 | 'comments_page' => array('default'=>0, |
---|
240 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
241 | 'comments_per_page' => array('default'=>$conf['nb_comment_page'], |
---|
242 | 'maxValue'=>2*$conf['nb_comment_page'], |
---|
243 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
244 | ), |
---|
245 | 'Returns information about an image.', |
---|
246 | $ws_functions_root . 'pwg.images.php' |
---|
247 | ); |
---|
248 | |
---|
249 | $service->addMethod( |
---|
250 | 'pwg.images.rate', |
---|
251 | 'ws_images_rate', |
---|
252 | array( |
---|
253 | 'image_id' => array('type'=>WS_TYPE_ID), |
---|
254 | 'rate' => array('type'=>WS_TYPE_FLOAT), |
---|
255 | ), |
---|
256 | 'Rates an image.', |
---|
257 | $ws_functions_root . 'pwg.images.php' |
---|
258 | ); |
---|
259 | |
---|
260 | $service->addMethod( |
---|
261 | 'pwg.images.search', |
---|
262 | 'ws_images_search', |
---|
263 | array_merge(array( |
---|
264 | 'query' => array(), |
---|
265 | 'per_page' => array('default'=>100, |
---|
266 | 'maxValue'=>$conf['ws_max_images_per_page'], |
---|
267 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
268 | 'page' => array('default'=>0, |
---|
269 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
270 | 'order' => array('default'=>null, |
---|
271 | 'info'=>'id, file, name, hit, rating_score, date_creation, date_available, random'), |
---|
272 | ), $f_params), |
---|
273 | 'Returns elements for the corresponding query search.', |
---|
274 | $ws_functions_root . 'pwg.images.php' |
---|
275 | ); |
---|
276 | |
---|
277 | $service->addMethod( |
---|
278 | 'pwg.images.setPrivacyLevel', |
---|
279 | 'ws_images_setPrivacyLevel', |
---|
280 | array( |
---|
281 | 'image_id' => array('flags'=>WS_PARAM_FORCE_ARRAY, |
---|
282 | 'type'=>WS_TYPE_ID), |
---|
283 | 'level' => array('maxValue'=>max($conf['available_permission_levels']), |
---|
284 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
285 | ), |
---|
286 | 'Sets the privacy levels for the images.', |
---|
287 | $ws_functions_root . 'pwg.images.php', |
---|
288 | array('admin_only'=>true, 'post_only'=>true) |
---|
289 | ); |
---|
290 | |
---|
291 | $service->addMethod( |
---|
292 | 'pwg.images.setRank', |
---|
293 | 'ws_images_setRank', |
---|
294 | array( |
---|
295 | 'image_id' => array('type'=>WS_TYPE_ID), |
---|
296 | 'category_id' => array('type'=>WS_TYPE_ID), |
---|
297 | 'rank' => array('type'=>WS_TYPE_INT|WS_TYPE_POSITIVE|WS_TYPE_NOTNULL) |
---|
298 | ), |
---|
299 | 'Sets the rank of a photo for a given album.', |
---|
300 | $ws_functions_root . 'pwg.images.php', |
---|
301 | array('admin_only'=>true, 'post_only'=>true) |
---|
302 | ); |
---|
303 | |
---|
304 | $service->addMethod( |
---|
305 | 'pwg.rates.delete', |
---|
306 | 'ws_rates_delete', |
---|
307 | array( |
---|
308 | 'user_id' => array('type'=>WS_TYPE_ID), |
---|
309 | 'anonymous_id' => array('default'=>null), |
---|
310 | ), |
---|
311 | 'Deletes all rates for a user.', |
---|
312 | $ws_functions_root . 'pwg.php', |
---|
313 | array('admin_only'=>true, 'post_only'=>true) |
---|
314 | ); |
---|
315 | |
---|
316 | $service->addMethod( |
---|
317 | 'pwg.session.getStatus', |
---|
318 | 'ws_session_getStatus', |
---|
319 | null, |
---|
320 | 'Gets information about the current session. Also provides a token useable with admin methods.', |
---|
321 | $ws_functions_root . 'pwg.php' |
---|
322 | ); |
---|
323 | |
---|
324 | $service->addMethod( |
---|
325 | 'pwg.session.login', |
---|
326 | 'ws_session_login', |
---|
327 | array('username', 'password'), |
---|
328 | 'Tries to login the user.', |
---|
329 | $ws_functions_root . 'pwg.php', |
---|
330 | array('post_only'=>true) |
---|
331 | ); |
---|
332 | |
---|
333 | $service->addMethod( |
---|
334 | 'pwg.session.logout', |
---|
335 | 'ws_session_logout', |
---|
336 | null, |
---|
337 | 'Ends the current session.', |
---|
338 | $ws_functions_root . 'pwg.php' |
---|
339 | ); |
---|
340 | |
---|
341 | $service->addMethod( |
---|
342 | 'pwg.tags.getList', |
---|
343 | 'ws_tags_getList', |
---|
344 | array( |
---|
345 | 'sort_by_counter' => array('default'=>false, |
---|
346 | 'type'=>WS_TYPE_BOOL), |
---|
347 | ), |
---|
348 | 'Retrieves a list of available tags.', |
---|
349 | $ws_functions_root . 'pwg.tags.php' |
---|
350 | ); |
---|
351 | |
---|
352 | $service->addMethod( |
---|
353 | 'pwg.tags.getImages', |
---|
354 | 'ws_tags_getImages', |
---|
355 | array_merge(array( |
---|
356 | 'tag_id' => array('default'=>null, |
---|
357 | 'flags'=>WS_PARAM_FORCE_ARRAY, |
---|
358 | 'type'=>WS_TYPE_ID), |
---|
359 | 'tag_url_name' => array('default'=>null, |
---|
360 | 'flags'=>WS_PARAM_FORCE_ARRAY), |
---|
361 | 'tag_name' => array('default'=>null, |
---|
362 | 'flags'=>WS_PARAM_FORCE_ARRAY), |
---|
363 | 'tag_mode_and' => array('default'=>false, |
---|
364 | 'type'=>WS_TYPE_BOOL), |
---|
365 | 'per_page' => array('default'=>100, |
---|
366 | 'maxValue'=>$conf['ws_max_images_per_page'], |
---|
367 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
368 | 'page' => array('default'=>0, |
---|
369 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
370 | 'order' => array('default'=>null, |
---|
371 | 'info'=>'id, file, name, hit, rating_score, date_creation, date_available, random'), |
---|
372 | ), $f_params), |
---|
373 | 'Returns elements for the corresponding tags. Fill at least tag_id, tag_url_name or tag_name.', |
---|
374 | $ws_functions_root . 'pwg.tags.php' |
---|
375 | ); |
---|
376 | |
---|
377 | $service->addMethod( |
---|
378 | 'pwg.images.addChunk', |
---|
379 | 'ws_images_add_chunk', |
---|
380 | array( |
---|
381 | 'data' => array(), |
---|
382 | 'original_sum' => array(), |
---|
383 | 'type' => array('default'=>'file', |
---|
384 | 'info'=>'Must be "file", for backward compatiblity "high" and "thumb" are allowed.'), |
---|
385 | 'position' => array() |
---|
386 | ), |
---|
387 | 'Add a chunk of a file.', |
---|
388 | $ws_functions_root . 'pwg.images.php', |
---|
389 | array('admin_only'=>true, 'post_only'=>true) |
---|
390 | ); |
---|
391 | |
---|
392 | $service->addMethod( |
---|
393 | 'pwg.images.addFile', |
---|
394 | 'ws_images_addFile', |
---|
395 | array( |
---|
396 | 'image_id' => array('type'=>WS_TYPE_ID), |
---|
397 | 'type' => array('default'=>'file', |
---|
398 | 'info'=>'Must be "file", for backward compatiblity "high" and "thumb" are allowed.'), |
---|
399 | 'sum' => array(), |
---|
400 | ), |
---|
401 | 'Add or update a file for an existing photo. |
---|
402 | <br>pwg.images.addChunk must have been called before (maybe several times).', |
---|
403 | $ws_functions_root . 'pwg.images.php', |
---|
404 | array('admin_only'=>true) |
---|
405 | ); |
---|
406 | |
---|
407 | |
---|
408 | $service->addMethod( |
---|
409 | 'pwg.images.add', |
---|
410 | 'ws_images_add', |
---|
411 | array( |
---|
412 | 'thumbnail_sum' => array('default'=>null), |
---|
413 | 'high_sum' => array('default'=>null), |
---|
414 | 'original_sum' => array(), |
---|
415 | 'original_filename' => array('default'=>null, |
---|
416 | 'Provide it if "check_uniqueness" is true and $conf["uniqueness_mode"] is "filename".'), |
---|
417 | 'name' => array('default'=>null), |
---|
418 | 'author' => array('default'=>null), |
---|
419 | 'date_creation' => array('default'=>null), |
---|
420 | 'comment' => array('default'=>null), |
---|
421 | 'categories' => array('default'=>null, |
---|
422 | 'info'=>'String list "category_id[,rank];category_id[,rank]".<br>The rank is optional and is equivalent to "auto" if not given.'), |
---|
423 | 'tag_ids' => array('default'=>null, |
---|
424 | 'info'=>'Comma separated ids'), |
---|
425 | 'level' => array('default'=>0, |
---|
426 | 'maxValue'=>max($conf['available_permission_levels']), |
---|
427 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
428 | 'check_uniqueness' => array('default'=>true, |
---|
429 | 'type'=>WS_TYPE_BOOL), |
---|
430 | 'image_id' => array('default'=>null, |
---|
431 | 'type'=>WS_TYPE_ID), |
---|
432 | ), |
---|
433 | 'Add an image. |
---|
434 | <br>pwg.images.addChunk must have been called before (maybe several times). |
---|
435 | <br>Don\'t use "thumbnail_sum" and "high_sum", these parameters are here for backward compatibility.', |
---|
436 | $ws_functions_root . 'pwg.images.php', |
---|
437 | array('admin_only'=>true) |
---|
438 | ); |
---|
439 | |
---|
440 | $service->addMethod( |
---|
441 | 'pwg.images.addSimple', |
---|
442 | 'ws_images_addSimple', |
---|
443 | array( |
---|
444 | 'category' => array('default'=>null, |
---|
445 | 'flags'=>WS_PARAM_FORCE_ARRAY, |
---|
446 | 'type'=>WS_TYPE_ID), |
---|
447 | 'name' => array('default'=>null), |
---|
448 | 'author' => array('default'=>null), |
---|
449 | 'comment' => array('default'=>null), |
---|
450 | 'level' => array('default'=>0, |
---|
451 | 'maxValue'=>max($conf['available_permission_levels']), |
---|
452 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
453 | 'tags' => array('default'=>null, |
---|
454 | 'flags'=>WS_PARAM_ACCEPT_ARRAY), |
---|
455 | 'image_id' => array('default'=>null, |
---|
456 | 'type'=>WS_TYPE_ID), |
---|
457 | ), |
---|
458 | 'Add an image. |
---|
459 | <br>Use the <b>$_FILES[image]</b> field for uploading file. |
---|
460 | <br>Set the form encoding to "form-data". |
---|
461 | <br>You can update an existing photo if you define an existing image_id.', |
---|
462 | $ws_functions_root . 'pwg.images.php', |
---|
463 | array('admin_only'=>true, 'post_only'=>true) |
---|
464 | ); |
---|
465 | |
---|
466 | $service->addMethod( |
---|
467 | 'pwg.images.delete', |
---|
468 | 'ws_images_delete', |
---|
469 | array( |
---|
470 | 'image_id' => array('flags'=>WS_PARAM_ACCEPT_ARRAY), |
---|
471 | 'pwg_token' => array(), |
---|
472 | ), |
---|
473 | 'Deletes image(s).', |
---|
474 | $ws_functions_root . 'pwg.images.php', |
---|
475 | array('admin_only'=>true, 'post_only'=>true) |
---|
476 | ); |
---|
477 | |
---|
478 | $service->addMethod( |
---|
479 | 'pwg.categories.getAdminList', |
---|
480 | 'ws_categories_getAdminList', |
---|
481 | null, |
---|
482 | 'Get albums list as displayed on admin page.', |
---|
483 | $ws_functions_root . 'pwg.categories.php', |
---|
484 | array('admin_only'=>true) |
---|
485 | ); |
---|
486 | |
---|
487 | $service->addMethod( |
---|
488 | 'pwg.categories.add', |
---|
489 | 'ws_categories_add', |
---|
490 | array( |
---|
491 | 'name' => array(), |
---|
492 | 'parent' => array('default'=>null, |
---|
493 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
494 | 'comment' => array('default'=>null), |
---|
495 | 'visible' => array('default'=>true, |
---|
496 | 'type'=>WS_TYPE_BOOL), |
---|
497 | 'status' => array('default'=>null, |
---|
498 | 'info'=>'public, private'), |
---|
499 | 'commentable' => array('default'=>true, |
---|
500 | 'type'=>WS_TYPE_BOOL), |
---|
501 | ), |
---|
502 | 'Adds an album.', |
---|
503 | $ws_functions_root . 'pwg.categories.php', |
---|
504 | array('admin_only'=>true) |
---|
505 | ); |
---|
506 | |
---|
507 | $service->addMethod( |
---|
508 | 'pwg.categories.delete', |
---|
509 | 'ws_categories_delete', |
---|
510 | array( |
---|
511 | 'category_id'=> array('flags'=>WS_PARAM_ACCEPT_ARRAY), |
---|
512 | 'photo_deletion_mode' => array('default'=>'delete_orphans'), |
---|
513 | 'pwg_token' => array(), |
---|
514 | ), |
---|
515 | 'Deletes album(s). |
---|
516 | <br><b>photo_deletion_mode</b> can be "no_delete" (may create orphan photos), "delete_orphans" |
---|
517 | (default mode, only deletes photos linked to no other album) or "force_delete" (delete all photos, even those linked to other albums)', |
---|
518 | $ws_functions_root . 'pwg.categories.php', |
---|
519 | array('admin_only'=>true, 'post_only'=>true) |
---|
520 | ); |
---|
521 | |
---|
522 | $service->addMethod( |
---|
523 | 'pwg.categories.move', |
---|
524 | 'ws_categories_move', |
---|
525 | array( |
---|
526 | 'category_id' => array('flags'=>WS_PARAM_ACCEPT_ARRAY), |
---|
527 | 'parent' => array('type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
528 | 'pwg_token' => array(), |
---|
529 | ), |
---|
530 | 'Move album(s). |
---|
531 | <br>Set parent as 0 to move to gallery root. Only virtual categories can be moved.', |
---|
532 | $ws_functions_root . 'pwg.categories.php', |
---|
533 | array('admin_only'=>true, 'post_only'=>true) |
---|
534 | ); |
---|
535 | |
---|
536 | $service->addMethod( |
---|
537 | 'pwg.categories.setRepresentative', |
---|
538 | 'ws_categories_setRepresentative', |
---|
539 | array( |
---|
540 | 'category_id' => array('type'=>WS_TYPE_ID), |
---|
541 | 'image_id' => array('type'=>WS_TYPE_ID), |
---|
542 | ), |
---|
543 | 'Sets the representative photo for an album. The photo doesn\'t have to belong to the album.', |
---|
544 | $ws_functions_root . 'pwg.categories.php', |
---|
545 | array('admin_only'=>true, 'post_only'=>true) |
---|
546 | ); |
---|
547 | |
---|
548 | $service->addMethod( |
---|
549 | 'pwg.tags.getAdminList', |
---|
550 | 'ws_tags_getAdminList', |
---|
551 | null, |
---|
552 | '<b>Admin only.</b>', |
---|
553 | $ws_functions_root . 'pwg.tags.php', |
---|
554 | array('admin_only'=>true) |
---|
555 | ); |
---|
556 | |
---|
557 | $service->addMethod( // TODO: create multiple tags |
---|
558 | 'pwg.tags.add', |
---|
559 | 'ws_tags_add', |
---|
560 | array('name'), |
---|
561 | 'Adds a new tag.', |
---|
562 | $ws_functions_root . 'pwg.tags.php', |
---|
563 | array('admin_only'=>true) |
---|
564 | ); |
---|
565 | |
---|
566 | $service->addMethod( |
---|
567 | 'pwg.images.exist', |
---|
568 | 'ws_images_exist', |
---|
569 | array( |
---|
570 | 'md5sum_list' => array('default'=>null), |
---|
571 | 'filename_list' => array('default'=>null), |
---|
572 | ), |
---|
573 | 'Checks existence of images. |
---|
574 | <br>Give <b>md5sum_list</b> if $conf[uniqueness_mode]==md5sum. Give <b>filename_list</b> if $conf[uniqueness_mode]==filename.', |
---|
575 | $ws_functions_root . 'pwg.images.php', |
---|
576 | array('admin_only'=>true) |
---|
577 | ); |
---|
578 | |
---|
579 | $service->addMethod( |
---|
580 | 'pwg.images.checkFiles', |
---|
581 | 'ws_images_checkFiles', |
---|
582 | array( |
---|
583 | 'image_id' => array('type'=>WS_TYPE_ID), |
---|
584 | 'file_sum' => array('default'=>null), |
---|
585 | 'thumbnail_sum' => array('default'=>null), |
---|
586 | 'high_sum' => array('default'=>null), |
---|
587 | ), |
---|
588 | 'Checks if you have updated version of your files for a given photo, the answer can be "missing", "equals" or "differs". |
---|
589 | <br>Don\'t use "thumbnail_sum" and "high_sum", these parameters are here for backward compatibility.', |
---|
590 | $ws_functions_root . 'pwg.images.php', |
---|
591 | array('admin_only'=>true) |
---|
592 | ); |
---|
593 | |
---|
594 | $service->addMethod( |
---|
595 | 'pwg.images.checkUpload', |
---|
596 | 'ws_images_checkUpload', |
---|
597 | null, |
---|
598 | 'Checks if Piwigo is ready for upload.', |
---|
599 | $ws_functions_root . 'pwg.images.php', |
---|
600 | array('admin_only'=>true) |
---|
601 | ); |
---|
602 | |
---|
603 | $service->addMethod( |
---|
604 | 'pwg.images.setInfo', |
---|
605 | 'ws_images_setInfo', |
---|
606 | array( |
---|
607 | 'image_id' => array('type'=>WS_TYPE_ID), |
---|
608 | 'file' => array('default'=>null), |
---|
609 | 'name' => array('default'=>null), |
---|
610 | 'author' => array('default'=>null), |
---|
611 | 'date_creation' => array('default'=>null), |
---|
612 | 'comment' => array('default'=>null), |
---|
613 | 'categories' => array('default'=>null, |
---|
614 | 'info'=>'String list "category_id[,rank];category_id[,rank]".<br>The rank is optional and is equivalent to "auto" if not given.'), |
---|
615 | 'tag_ids' => array('default'=>null, |
---|
616 | 'info'=>'Comma separated ids'), |
---|
617 | 'level' => array('default'=>null, |
---|
618 | 'maxValue'=>max($conf['available_permission_levels']), |
---|
619 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
620 | 'single_value_mode' => array('default'=>'fill_if_empty'), |
---|
621 | 'multiple_value_mode' => array('default'=>'append'), |
---|
622 | ), |
---|
623 | 'Changes properties of an image. |
---|
624 | <br><b>single_value_mode</b> can be "fill_if_empty" (only use the input value if the corresponding values is currently empty) or "replace" |
---|
625 | (overwrite any existing value) and applies to single values properties like name/author/date_creation/comment. |
---|
626 | <br><b>multiple_value_mode</b> can be "append" (no change on existing values, add the new values) or "replace" and applies to multiple values properties like tag_ids/categories.', |
---|
627 | $ws_functions_root . 'pwg.images.php', |
---|
628 | array('admin_only'=>true, 'post_only'=>true) |
---|
629 | ); |
---|
630 | |
---|
631 | $service->addMethod( |
---|
632 | 'pwg.categories.setInfo', |
---|
633 | 'ws_categories_setInfo', |
---|
634 | array( |
---|
635 | 'category_id' => array('type'=>WS_TYPE_ID), |
---|
636 | 'name' => array('default'=>null), |
---|
637 | 'comment' => array('default'=>null), |
---|
638 | ), |
---|
639 | 'Changes properties of an album.', |
---|
640 | $ws_functions_root . 'pwg.categories.php', |
---|
641 | array('admin_only'=>true, 'post_only'=>true) |
---|
642 | ); |
---|
643 | |
---|
644 | $service->addMethod( |
---|
645 | 'pwg.plugins.getList', |
---|
646 | 'ws_plugins_getList', |
---|
647 | null, |
---|
648 | 'Gets the list of plugins with id, name, version, state and description.', |
---|
649 | $ws_functions_root . 'pwg.extensions.php', |
---|
650 | array('admin_only'=>true) |
---|
651 | ); |
---|
652 | |
---|
653 | $service->addMethod( |
---|
654 | 'pwg.plugins.performAction', |
---|
655 | 'ws_plugins_performAction', |
---|
656 | array( |
---|
657 | 'action' => array('info'=>'install, activate, deactivate, uninstall, delete'), |
---|
658 | 'plugin' => array(), |
---|
659 | 'pwg_token' => array(), |
---|
660 | ), |
---|
661 | null, |
---|
662 | $ws_functions_root . 'pwg.extensions.php', |
---|
663 | array('admin_only'=>true) |
---|
664 | ); |
---|
665 | |
---|
666 | $service->addMethod( |
---|
667 | 'pwg.themes.performAction', |
---|
668 | 'ws_themes_performAction', |
---|
669 | array( |
---|
670 | 'action' => array('info'=>'activate, deactivate, delete, set_default'), |
---|
671 | 'theme' => array(), |
---|
672 | 'pwg_token' => array(), |
---|
673 | ), |
---|
674 | null, |
---|
675 | $ws_functions_root . 'pwg.extensions.php', |
---|
676 | array('admin_only'=>true) |
---|
677 | ); |
---|
678 | |
---|
679 | $service->addMethod( |
---|
680 | 'pwg.extensions.update', |
---|
681 | 'ws_extensions_update', |
---|
682 | array( |
---|
683 | 'type' => array('info'=>'plugins, languages, themes'), |
---|
684 | 'id' => array(), |
---|
685 | 'revision' => array(), |
---|
686 | 'pwg_token' => array(), |
---|
687 | ), |
---|
688 | '<b>Webmaster only.</b>', |
---|
689 | $ws_functions_root . 'pwg.extensions.php', |
---|
690 | array('admin_only'=>true) |
---|
691 | ); |
---|
692 | |
---|
693 | $service->addMethod( |
---|
694 | 'pwg.extensions.ignoreUpdate', |
---|
695 | 'ws_extensions_ignoreupdate', |
---|
696 | array( |
---|
697 | 'type' => array('default'=>null, |
---|
698 | 'info'=>'plugins, languages, themes'), |
---|
699 | 'id' => array('default'=>null), |
---|
700 | 'reset' => array('default'=>false, |
---|
701 | 'type'=>WS_TYPE_BOOL, |
---|
702 | 'info'=>'If true, all ignored extensions will be reinitilized.'), |
---|
703 | 'pwg_token' => array(), |
---|
704 | ), |
---|
705 | '<b>Webmaster only.</b> Ignores an extension if it needs update.', |
---|
706 | $ws_functions_root . 'pwg.extensions.php', |
---|
707 | array('admin_only'=>true) |
---|
708 | ); |
---|
709 | |
---|
710 | $service->addMethod( |
---|
711 | 'pwg.extensions.checkUpdates', |
---|
712 | 'ws_extensions_checkupdates', |
---|
713 | null, |
---|
714 | 'Checks if piwigo or extensions are up to date.', |
---|
715 | $ws_functions_root . 'pwg.extensions.php', |
---|
716 | array('admin_only'=>true) |
---|
717 | ); |
---|
718 | |
---|
719 | $service->addMethod( |
---|
720 | 'pwg.groups.getList', |
---|
721 | 'ws_groups_getList', |
---|
722 | array( |
---|
723 | 'group_id' => array('flags'=>WS_PARAM_OPTIONAL|WS_PARAM_FORCE_ARRAY, |
---|
724 | 'type'=>WS_TYPE_ID), |
---|
725 | 'name' => array('flags'=>WS_PARAM_OPTIONAL, |
---|
726 | 'info'=>'Use "%" as wildcard.'), |
---|
727 | 'per_page' => array('default'=>100, |
---|
728 | 'maxValue'=>$conf['ws_max_users_per_page'], |
---|
729 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
730 | 'page' => array('default'=>0, |
---|
731 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
732 | 'order' => array('default'=>'name', |
---|
733 | 'info'=>'id, name, nb_users, is_default'), |
---|
734 | ), |
---|
735 | 'Retrieves a list of all groups. The list can be filtered.', |
---|
736 | $ws_functions_root . 'pwg.groups.php', |
---|
737 | array('admin_only'=>true) |
---|
738 | ); |
---|
739 | |
---|
740 | $service->addMethod( |
---|
741 | 'pwg.groups.add', |
---|
742 | 'ws_groups_add', |
---|
743 | array( |
---|
744 | 'name' => array(), |
---|
745 | 'is_default' => array('default'=>false, |
---|
746 | 'type'=>WS_TYPE_BOOL), |
---|
747 | ), |
---|
748 | 'Creates a group and returns the new group record.', |
---|
749 | $ws_functions_root . 'pwg.groups.php', |
---|
750 | array('admin_only'=>true, 'post_only'=>true) |
---|
751 | ); |
---|
752 | |
---|
753 | $service->addMethod( |
---|
754 | 'pwg.groups.delete', |
---|
755 | 'ws_groups_delete', |
---|
756 | array( |
---|
757 | 'group_id' => array('flags'=>WS_PARAM_FORCE_ARRAY, |
---|
758 | 'type'=>WS_TYPE_ID), |
---|
759 | 'pwg_token' => array(), |
---|
760 | ), |
---|
761 | 'Deletes a or more groups. Users and photos are not deleted.', |
---|
762 | $ws_functions_root . 'pwg.groups.php', |
---|
763 | array('admin_only'=>true, 'post_only'=>true) |
---|
764 | ); |
---|
765 | |
---|
766 | $service->addMethod( |
---|
767 | 'pwg.groups.setInfo', |
---|
768 | 'ws_groups_setInfo', |
---|
769 | array( |
---|
770 | 'group_id' => array('type'=>WS_TYPE_ID), |
---|
771 | 'name' => array('flags'=>WS_PARAM_OPTIONAL), |
---|
772 | 'is_default' => array('flags'=>WS_PARAM_OPTIONAL, |
---|
773 | 'type'=>WS_TYPE_BOOL), |
---|
774 | ), |
---|
775 | 'Updates a group. Leave a field blank to keep the current value.', |
---|
776 | $ws_functions_root . 'pwg.groups.php', |
---|
777 | array('admin_only'=>true, 'post_only'=>true) |
---|
778 | ); |
---|
779 | |
---|
780 | $service->addMethod( |
---|
781 | 'pwg.groups.addUser', |
---|
782 | 'ws_groups_addUser', |
---|
783 | array( |
---|
784 | 'group_id' => array('type'=>WS_TYPE_ID), |
---|
785 | 'user_id' => array('flags'=>WS_PARAM_FORCE_ARRAY, |
---|
786 | 'type'=>WS_TYPE_ID), |
---|
787 | ), |
---|
788 | 'Adds one or more users to a group.', |
---|
789 | $ws_functions_root . 'pwg.groups.php', |
---|
790 | array('admin_only'=>true, 'post_only'=>true) |
---|
791 | ); |
---|
792 | |
---|
793 | $service->addMethod( |
---|
794 | 'pwg.groups.deleteUser', |
---|
795 | 'ws_groups_deleteUser', |
---|
796 | array( |
---|
797 | 'group_id' => array('type'=>WS_TYPE_ID), |
---|
798 | 'user_id' => array('flags'=>WS_PARAM_FORCE_ARRAY, |
---|
799 | 'type'=>WS_TYPE_ID), |
---|
800 | ), |
---|
801 | 'Removes one or more users from a group.', |
---|
802 | $ws_functions_root . 'pwg.groups.php', |
---|
803 | array('admin_only'=>true, 'post_only'=>true) |
---|
804 | ); |
---|
805 | |
---|
806 | $service->addMethod( |
---|
807 | 'pwg.users.getList', |
---|
808 | 'ws_users_getList', |
---|
809 | array( |
---|
810 | 'user_id' => array('flags'=>WS_PARAM_OPTIONAL|WS_PARAM_FORCE_ARRAY, |
---|
811 | 'type'=>WS_TYPE_ID), |
---|
812 | 'username' => array('flags'=>WS_PARAM_OPTIONAL, |
---|
813 | 'info'=>'Use "%" as wildcard.'), |
---|
814 | 'status' => array('flags'=>WS_PARAM_OPTIONAL|WS_PARAM_FORCE_ARRAY, |
---|
815 | 'info'=>'guest,generic,normal,admin,webmaster'), |
---|
816 | 'min_level' => array('default'=>0, |
---|
817 | 'maxValue'=>max($conf['available_permission_levels']), |
---|
818 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
819 | 'group_id' => array('flags'=>WS_PARAM_OPTIONAL|WS_PARAM_FORCE_ARRAY, |
---|
820 | 'type'=>WS_TYPE_ID), |
---|
821 | 'per_page' => array('default'=>100, |
---|
822 | 'maxValue'=>$conf['ws_max_users_per_page'], |
---|
823 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
824 | 'page' => array('default'=>0, |
---|
825 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
826 | 'order' => array('default'=>'id', |
---|
827 | 'info'=>'id, username, level, email'), |
---|
828 | 'display' => array('default'=>'basics', |
---|
829 | 'info'=>'Comma saparated list (see method description)'), |
---|
830 | ), |
---|
831 | 'Retrieves a list of all the users.<br> |
---|
832 | <br> |
---|
833 | <b>display</b> controls which data are returned, possible values are:<br> |
---|
834 | all, basics, none,<br> |
---|
835 | username, email, status, level, groups,<br> |
---|
836 | language, theme, nb_image_page, recent_period, expand, show_nb_comments, show_nb_hits,<br> |
---|
837 | enabled_high, registration_date, registration_date_string, registration_date_since, last_visit, last_visit_string, last_visit_since<br> |
---|
838 | <b>basics</b> stands for "username,email,status,level,groups"', |
---|
839 | $ws_functions_root . 'pwg.users.php', |
---|
840 | array('admin_only'=>true) |
---|
841 | ); |
---|
842 | |
---|
843 | $service->addMethod( |
---|
844 | 'pwg.users.add', |
---|
845 | 'ws_users_add', |
---|
846 | array( |
---|
847 | 'username' => array(), |
---|
848 | 'password' => array('default'=>null), |
---|
849 | 'password_confirm' => array('flags'=>WS_PARAM_OPTIONAL), |
---|
850 | 'email' => array('default'=>null), |
---|
851 | 'send_password_by_mail' => array('default'=>false, 'type'=>WS_TYPE_BOOL), |
---|
852 | ), |
---|
853 | 'Registers a new user.', |
---|
854 | $ws_functions_root . 'pwg.users.php', |
---|
855 | array('admin_only'=>true, 'post_only'=>true) |
---|
856 | ); |
---|
857 | |
---|
858 | $service->addMethod( |
---|
859 | 'pwg.users.delete', |
---|
860 | 'ws_users_delete', |
---|
861 | array( |
---|
862 | 'user_id' => array('flags'=>WS_PARAM_FORCE_ARRAY, |
---|
863 | 'type'=>WS_TYPE_ID), |
---|
864 | 'pwg_token' => array(), |
---|
865 | ), |
---|
866 | 'Deletes on or more users. Photos owned by this user are not deleted.', |
---|
867 | $ws_functions_root . 'pwg.users.php', |
---|
868 | array('admin_only'=>true, 'post_only'=>true) |
---|
869 | ); |
---|
870 | |
---|
871 | $service->addMethod( |
---|
872 | 'pwg.users.setInfo', |
---|
873 | 'ws_users_setInfo', |
---|
874 | array( |
---|
875 | 'user_id' => array('flags'=>WS_PARAM_FORCE_ARRAY, |
---|
876 | 'type'=>WS_TYPE_ID), |
---|
877 | 'username' => array('flags'=>WS_PARAM_OPTIONAL), |
---|
878 | 'password' => array('flags'=>WS_PARAM_OPTIONAL), |
---|
879 | 'email' => array('flags'=>WS_PARAM_OPTIONAL), |
---|
880 | 'status' => array('flags'=>WS_PARAM_OPTIONAL, |
---|
881 | 'info'=>'guest,generic,normal,admin,webmaster'), |
---|
882 | 'level'=> array('flags'=>WS_PARAM_OPTIONAL, |
---|
883 | 'maxValue'=>max($conf['available_permission_levels']), |
---|
884 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
885 | 'language' => array('flags'=>WS_PARAM_OPTIONAL), |
---|
886 | 'theme' => array('flags'=>WS_PARAM_OPTIONAL), |
---|
887 | 'group_id' => array('flags'=>WS_PARAM_OPTIONAL|WS_PARAM_FORCE_ARRAY, 'type'=>WS_TYPE_INT), |
---|
888 | // bellow are parameters removed in a future version |
---|
889 | 'nb_image_page' => array('flags'=>WS_PARAM_OPTIONAL, |
---|
890 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE|WS_TYPE_NOTNULL), |
---|
891 | 'recent_period' => array('flags'=>WS_PARAM_OPTIONAL, |
---|
892 | 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), |
---|
893 | 'expand' => array('flags'=>WS_PARAM_OPTIONAL, |
---|
894 | 'type'=>WS_TYPE_BOOL), |
---|
895 | 'show_nb_comments' => array('flags'=>WS_PARAM_OPTIONAL, |
---|
896 | 'type'=>WS_TYPE_BOOL), |
---|
897 | 'show_nb_hits' => array('flags'=>WS_PARAM_OPTIONAL, |
---|
898 | 'type'=>WS_TYPE_BOOL), |
---|
899 | 'enabled_high' => array('flags'=>WS_PARAM_OPTIONAL, |
---|
900 | 'type'=>WS_TYPE_BOOL), |
---|
901 | ), |
---|
902 | 'Updates a user. Leave a field blank to keep the current value. |
---|
903 | <br>"username", "password" and "email" are ignored if "user_id" is an array. |
---|
904 | <br>set "group_id" to -1 if you want to dissociate users from all groups', |
---|
905 | $ws_functions_root . 'pwg.users.php', |
---|
906 | array('admin_only'=>true, 'post_only'=>true) |
---|
907 | ); |
---|
908 | |
---|
909 | $service->addMethod( |
---|
910 | 'pwg.permissions.getList', |
---|
911 | 'ws_permissions_getList', |
---|
912 | array( |
---|
913 | 'cat_id' => array('flags'=>WS_PARAM_FORCE_ARRAY|WS_PARAM_OPTIONAL, |
---|
914 | 'type'=>WS_TYPE_ID), |
---|
915 | 'group_id' => array('flags'=>WS_PARAM_FORCE_ARRAY|WS_PARAM_OPTIONAL, |
---|
916 | 'type'=>WS_TYPE_ID), |
---|
917 | 'user_id' => array('flags'=>WS_PARAM_FORCE_ARRAY|WS_PARAM_OPTIONAL, |
---|
918 | 'type'=>WS_TYPE_ID), |
---|
919 | ), |
---|
920 | 'Returns permissions: user ids and group ids having access to each album ; this list can be filtered. |
---|
921 | <br>Provide only one parameter!', |
---|
922 | $ws_functions_root . 'pwg.permissions.php', |
---|
923 | array('admin_only'=>true) |
---|
924 | ); |
---|
925 | |
---|
926 | $service->addMethod( |
---|
927 | 'pwg.permissions.add', |
---|
928 | 'ws_permissions_add', |
---|
929 | array( |
---|
930 | 'cat_id' => array('flags'=>WS_PARAM_FORCE_ARRAY, |
---|
931 | 'type'=>WS_TYPE_ID), |
---|
932 | 'group_id' => array('flags'=>WS_PARAM_FORCE_ARRAY|WS_PARAM_OPTIONAL, |
---|
933 | 'type'=>WS_TYPE_ID), |
---|
934 | 'user_id' => array('flags'=>WS_PARAM_FORCE_ARRAY|WS_PARAM_OPTIONAL, |
---|
935 | 'type'=>WS_TYPE_ID), |
---|
936 | 'recursive' => array('default'=>false, |
---|
937 | 'type'=>WS_TYPE_BOOL), |
---|
938 | ), |
---|
939 | 'Adds permissions to an album.', |
---|
940 | $ws_functions_root . 'pwg.permissions.php', |
---|
941 | array('admin_only'=>true, 'post_only'=>true) |
---|
942 | ); |
---|
943 | |
---|
944 | $service->addMethod( |
---|
945 | 'pwg.permissions.remove', |
---|
946 | 'ws_permissions_remove', |
---|
947 | array( |
---|
948 | 'cat_id' => array('flags'=>WS_PARAM_FORCE_ARRAY, |
---|
949 | 'type'=>WS_TYPE_ID), |
---|
950 | 'group_id' => array('flags'=>WS_PARAM_FORCE_ARRAY|WS_PARAM_OPTIONAL, |
---|
951 | 'type'=>WS_TYPE_ID), |
---|
952 | 'user_id' => array('flags'=>WS_PARAM_FORCE_ARRAY|WS_PARAM_OPTIONAL, |
---|
953 | 'type'=>WS_TYPE_ID), |
---|
954 | ), |
---|
955 | 'Removes permissions from an album.', |
---|
956 | $ws_functions_root . 'pwg.permissions.php', |
---|
957 | array('admin_only'=>true, 'post_only'=>true) |
---|
958 | ); |
---|
959 | } |
---|
960 | |
---|
961 | ?> |
---|