From d6211432ec2144b877e16c36c1f8ea202bb8daae Mon Sep 17 00:00:00 2001 From: mistic100 Date: Thu, 24 Oct 2013 10:01:35 +0000 Subject: two new options for API methods : 'admin_only' and 'post_only' git-svn-id: http://piwigo.org/svn/trunk@25115 68402e56-0260-453c-a942-63ccdbb3a9ee --- ws.php | 120 ++++++++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 90 insertions(+), 30 deletions(-) (limited to 'ws.php') diff --git a/ws.php b/ws.php index 318ddd16a..e04c19f44 100644 --- a/ws.php +++ b/ws.php @@ -135,7 +135,9 @@ function ws_addDefaultMethods( $arr ) 'pwg.getInfos', 'ws_getInfos', null, - 'Admin only. Returns general informations.' + 'Admin only. Returns general informations.', + null, + array('admin_only'=>true) ); $service->addMethod( @@ -145,7 +147,9 @@ function ws_addDefaultMethods( $arr ) 'image_id'=> array('flags'=>WS_PARAM_FORCE_ARRAY, 'type'=>WS_TYPE_ID), ), - 'Admin only. Adds elements to the caddie. Returns the number of elements added.' + 'Admin only. Adds elements to the caddie. Returns the number of elements added.', + null, + array('admin_only'=>true) ); $service->addMethod( @@ -204,7 +208,9 @@ function ws_addDefaultMethods( $arr ) 'prev_page' => array('default'=>null, 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), ), $f_params), - 'Admin only. Returns a list of derivatives to build.' + 'Admin only. Returns a list of derivatives to build.', + null, + array('admin_only'=>true) ); $service->addMethod( @@ -216,7 +222,9 @@ function ws_addDefaultMethods( $arr ) 'content' => array(), 'key' => array(), ), - 'POST only. Adds a comment to an image.' + 'POST only. Adds a comment to an image.', + null, + array('post_only'=>true) ); $service->addMethod( @@ -268,7 +276,9 @@ function ws_addDefaultMethods( $arr ) 'level' => array('maxValue'=>max($conf['available_permission_levels']), 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), ), - 'Admin & POST only. Sets the privacy levels for the images.' + 'Admin & POST only. Sets the privacy levels for the images.', + null, + array('admin_only'=>true, 'post_only'=>true) ); $service->addMethod( @@ -279,7 +289,9 @@ function ws_addDefaultMethods( $arr ) 'category_id' => array('type'=>WS_TYPE_ID), 'rank' => array('type'=>WS_TYPE_INT|WS_TYPE_POSITIVE|WS_TYPE_NOTNULL) ), - 'Admin & POST only. Sets the rank of a photo for a given album.' + 'Admin & POST only. Sets the rank of a photo for a given album.', + null, + array('admin_only'=>true, 'post_only'=>true) ); $service->addMethod( @@ -289,7 +301,9 @@ function ws_addDefaultMethods( $arr ) 'user_id' => array('type'=>WS_TYPE_ID), 'anonymous_id' => array('default'=>null), ), - 'Admin & POST only. Deletes all rates for a user.' + 'Admin & POST only. Deletes all rates for a user.', + null, + array('admin_only'=>true, 'post_only'=>true) ); $service->addMethod( @@ -303,7 +317,9 @@ function ws_addDefaultMethods( $arr ) 'pwg.session.login', 'ws_session_login', array('username', 'password'), - 'POST only. Tries to login the user.' + 'POST only. Tries to login the user.', + null, + array('post_only'=>true) ); $service->addMethod( @@ -357,7 +373,9 @@ function ws_addDefaultMethods( $arr ) 'info'=>'Must be "file", for backward compatiblity "high" and "thumb" are allowed.'), 'position' => array() ), - 'Admin & POST only. Add a chunk of a file.' + 'Admin & POST only. Add a chunk of a file.', + null, + array('admin_only'=>true, 'post_only'=>true) ); $service->addMethod( @@ -370,7 +388,9 @@ function ws_addDefaultMethods( $arr ) 'sum' => array(), ), 'Admin only. Add or update a file for an existing photo. -
pwg.images.addChunk must have been called before (maybe several times).' +
pwg.images.addChunk must have been called before (maybe several times).', + null, + array('admin_only'=>true) ); @@ -401,7 +421,9 @@ function ws_addDefaultMethods( $arr ) ), 'Admin only. Add an image.
pwg.images.addChunk must have been called before (maybe several times). -
Don\'t use "thumbnail_sum" and "high_sum", these parameters are here for backward compatibility.' +
Don\'t use "thumbnail_sum" and "high_sum", these parameters are here for backward compatibility.', + null, + array('admin_only'=>true) ); $service->addMethod( @@ -425,7 +447,9 @@ function ws_addDefaultMethods( $arr ) 'Admin & POST only. Add an image.
Use the $_FILES[image] field for uploading file.
Set the form encoding to "form-data". -
You can update an existing photo if you define an existing image_id.' +
You can update an existing photo if you define an existing image_id.', + null, + array('admin_only'=>true, 'post_only'=>true) ); $service->addMethod( @@ -435,14 +459,18 @@ function ws_addDefaultMethods( $arr ) 'image_id' => array('flags'=>WS_PARAM_ACCEPT_ARRAY), 'pwg_token' => array(), ), - 'Admin & POST only. Deletes image(s).' + 'Admin & POST only. Deletes image(s).', + null, + array('admin_only'=>true, 'post_only'=>true) ); $service->addMethod( 'pwg.categories.getAdminList', 'ws_categories_getAdminList', null, - 'Admin only.' + 'Admin only.', + null, + array('admin_only'=>true) ); $service->addMethod( @@ -473,7 +501,9 @@ function ws_addDefaultMethods( $arr ) ), 'Admin & POST only. Deletes album(s).
photo_deletion_mode can be "no_delete" (may create orphan photos), "delete_orphans" -(default mode, only deletes photos linked to no other album) or "force_delete" (delete all photos, even those linked to other albums)' +(default mode, only deletes photos linked to no other album) or "force_delete" (delete all photos, even those linked to other albums)', + null, + array('admin_only'=>true, 'post_only'=>true) ); $service->addMethod( @@ -485,7 +515,9 @@ function ws_addDefaultMethods( $arr ) 'pwg_token' => array(), ), 'Admin & POST only. Move album(s). -
Set parent as 0 to move to gallery root. Only virtual categories can be moved.' +
Set parent as 0 to move to gallery root. Only virtual categories can be moved.', + null, + array('admin_only'=>true, 'post_only'=>true) ); $service->addMethod( @@ -495,21 +527,27 @@ function ws_addDefaultMethods( $arr ) 'category_id' => array('type'=>WS_TYPE_ID), 'image_id' => array('type'=>WS_TYPE_ID), ), - 'Admin & POST only. Sets the representative photo for an album. The photo doesn\'t have to belong to the album.' + 'Admin & POST only. Sets the representative photo for an album. The photo doesn\'t have to belong to the album.', + null, + array('admin_only'=>true, 'post_only'=>true) ); $service->addMethod( 'pwg.tags.getAdminList', 'ws_tags_getAdminList', null, - 'Admin only. ' + 'Admin only.', + null, + array('admin_only'=>true) ); $service->addMethod( // TODO: create multiple tags 'pwg.tags.add', 'ws_tags_add', array('name'), - 'Admin only. Adds a new tag.' + 'Admin only. Adds a new tag.', + null, + array('admin_only'=>true) ); $service->addMethod( @@ -520,7 +558,9 @@ function ws_addDefaultMethods( $arr ) 'filename_list' => array('default'=>null), ), 'Admin only. Checks existence of images. -
Give md5sum_list if $conf[uniqueness_mode]==md5sum. Give filename_list if $conf[uniqueness_mode]==filename.' +
Give md5sum_list if $conf[uniqueness_mode]==md5sum. Give filename_list if $conf[uniqueness_mode]==filename.', + null, + array('admin_only'=>true) ); $service->addMethod( @@ -533,14 +573,18 @@ function ws_addDefaultMethods( $arr ) 'high_sum' => array('default'=>null), ), 'Admin only. Checks if you have updated version of your files for a given photo, the answer can be "missing", "equals" or "differs". -
Don\'t use "thumbnail_sum" and "high_sum", these parameters are here for backward compatibility.' +
Don\'t use "thumbnail_sum" and "high_sum", these parameters are here for backward compatibility.', + null, + array('admin_only'=>true) ); $service->addMethod( 'pwg.images.checkUpload', 'ws_images_checkUpload', null, - 'Admin only. Checks if Piwigo is ready for upload.' + 'Admin only. Checks if Piwigo is ready for upload.', + null, + array('admin_only'=>true) ); $service->addMethod( @@ -566,7 +610,9 @@ function ws_addDefaultMethods( $arr ) 'Admin & POST only. Changes properties of an image.
single_value_mode can be "fill_if_empty" (only use the input value if the corresponding values is currently empty) or "replace" (overwrite any existing value) and applies to single values properties like name/author/date_creation/comment. -
multiple_value_mode can be "append" (no change on existing values, add the new values) or "replace" and applies to multiple values properties like tag_ids/categories.' +
multiple_value_mode can be "append" (no change on existing values, add the new values) or "replace" and applies to multiple values properties like tag_ids/categories.', + null, + array('admin_only'=>true, 'post_only'=>true) ); $service->addMethod( @@ -577,14 +623,18 @@ function ws_addDefaultMethods( $arr ) 'name' => array('default'=>null), 'comment' => array('default'=>null), ), - 'Admin & POST only. Changes properties of an album.' + 'Admin & POST only. Changes properties of an album.', + null, + array('admin_only'=>true, 'post_only'=>true) ); $service->addMethod( 'pwg.plugins.getList', 'ws_plugins_getList', null, - 'Admin only. Gets the list of plugins with id, name, version, state and description.' + 'Admin only. Gets the list of plugins with id, name, version, state and description.', + null, + array('admin_only'=>true) ); $service->addMethod( @@ -595,7 +645,9 @@ function ws_addDefaultMethods( $arr ) 'plugin' => array(), 'pwg_token' => array(), ), - 'Admin only.' + 'Admin only.', + null, + array('admin_only'=>true) ); $service->addMethod( @@ -606,7 +658,9 @@ function ws_addDefaultMethods( $arr ) 'theme' => array(), 'pwg_token' => array(), ), - 'Admin only.' + 'Admin only.', + null, + array('admin_only'=>true) ); $service->addMethod( @@ -618,7 +672,9 @@ function ws_addDefaultMethods( $arr ) 'revision' => array(), 'pwg_token' => array(), ), - 'Webmaster only.' + 'Webmaster only.', + null, + array('admin_only'=>true) ); $service->addMethod( @@ -633,14 +689,18 @@ function ws_addDefaultMethods( $arr ) 'info'=>'If true, all ignored extensions will be reinitilized.'), 'pwg_token' => array(), ), - 'Webmaster only. Ignores an extension if it needs update.' + 'Webmaster only. Ignores an extension if it needs update.', + null, + array('admin_only'=>true) ); $service->addMethod( 'pwg.extensions.checkUpdates', 'ws_extensions_checkupdates', null, - 'Admin only. Checks if piwigo or extensions are up to date.' + 'Admin only. Checks if piwigo or extensions are up to date.', + null, + array('admin_only'=>true) ); } -- cgit v1.2.3