2007-01-06 11:13:08 +00:00
< ? php
// +-----------------------------------------------------------------------+
2019-06-04 17:13:51 +02:00
// | This file is part of Piwigo. |
2007-01-06 11:13:08 +00:00
// | |
2019-06-04 17:13:51 +02:00
// | For copyright and license information, please view the COPYING.txt |
// | file that was distributed with this source code. |
2007-01-06 11:13:08 +00:00
// +-----------------------------------------------------------------------+
define ( 'PHPWG_ROOT_PATH' , './' );
2014-08-23 10:40:42 +00:00
define ( 'IN_WS' , true );
2007-01-06 11:13:08 +00:00
include_once ( PHPWG_ROOT_PATH . 'include/common.inc.php' );
2008-05-02 21:56:21 +00:00
check_status ( ACCESS_FREE );
2007-01-06 11:13:08 +00:00
2007-02-06 01:02:06 +00:00
if ( ! $conf [ 'allow_web_services' ] )
{
page_forbidden ( 'Web services are disabled' );
}
2021-10-07 14:53:27 +02:00
include_once ( PHPWG_ROOT_PATH . 'include/ws_init.inc.php' );
2013-02-18 19:41:40 +00:00
$service -> run ();
2007-01-29 20:38:08 +00:00
/**
* event handler that registers standard methods with the web service
*/
2007-01-06 11:13:08 +00:00
function ws_addDefaultMethods ( $arr )
{
2007-02-22 01:12:32 +00:00
global $conf , $user ;
2007-01-06 11:13:08 +00:00
$service = & $arr [ 0 ];
2013-02-18 19:41:40 +00:00
include_once ( PHPWG_ROOT_PATH . 'include/ws_functions.inc.php' );
2013-11-01 11:03:10 +00:00
$ws_functions_root = PHPWG_ROOT_PATH . 'include/ws_functions/' ;
2013-02-18 19:41:40 +00:00
2013-10-22 12:58:58 +00:00
$f_params = array (
'f_min_rate' => array ( 'default' => null ,
'type' => WS_TYPE_FLOAT ),
'f_max_rate' => array ( 'default' => null ,
'type' => WS_TYPE_FLOAT ),
'f_min_hit' => array ( 'default' => null ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'f_max_hit' => array ( 'default' => null ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'f_min_ratio' => array ( 'default' => null ,
'type' => WS_TYPE_FLOAT | WS_TYPE_POSITIVE ),
'f_max_ratio' => array ( 'default' => null ,
'type' => WS_TYPE_FLOAT | WS_TYPE_POSITIVE ),
'f_max_level' => array ( 'default' => null ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'f_min_date_available' => array ( 'default' => null ),
'f_max_date_available' => array ( 'default' => null ),
'f_min_date_created' => array ( 'default' => null ),
'f_max_date_created' => array ( 'default' => null ),
);
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.getVersion' ,
'ws_getVersion' ,
2013-02-18 19:41:40 +00:00
null ,
2013-11-01 11:03:10 +00:00
'Returns the Piwigo version.' ,
$ws_functions_root . 'pwg.php'
2013-02-18 19:41:40 +00:00
);
2011-04-03 12:36:32 +00:00
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.getInfos' ,
'ws_getInfos' ,
2013-02-18 19:41:40 +00:00
null ,
2013-11-08 12:16:14 +00:00
'Returns general informations.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true )
2013-02-18 19:41:40 +00:00
);
2007-01-06 11:13:08 +00:00
2021-06-24 17:12:09 +02:00
$service -> addMethod (
'pwg.getCacheSize' ,
'ws_getCacheSize' ,
null ,
'Returns general informations.' ,
$ws_functions_root . 'pwg.php' ,
array ( 'admin_only' => true )
);
2021-04-09 09:34:01 +02:00
$service -> addMethod (
'pwg.activity.getList' ,
'ws_getActivityList' ,
2022-01-05 10:39:16 +01:00
array (
'page' => array ( 'default' => null ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
2022-01-12 14:57:45 +01:00
'uid' => array ( 'default' => NULL ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
2022-01-05 10:39:16 +01:00
),
2021-04-09 09:34:01 +02:00
'Returns general informations.' ,
$ws_functions_root . 'pwg.php' ,
array ( 'admin_only' => true )
);
$service -> addMethod (
'pwg.activity.downloadLog' ,
'ws_activity_downloadLog' ,
null ,
'Returns general informations.' ,
$ws_functions_root . 'pwg.php' ,
array ( 'admin_only' => true )
);
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.caddie.add' ,
'ws_caddie_add' ,
2008-07-12 00:30:27 +00:00
array (
2013-10-22 12:58:58 +00:00
'image_id' => array ( 'flags' => WS_PARAM_FORCE_ARRAY ,
'type' => WS_TYPE_ID ),
2013-02-18 19:41:40 +00:00
),
2013-11-08 12:16:14 +00:00
'Adds elements to the caddie. Returns the number of elements added.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true )
2013-02-18 19:41:40 +00:00
);
2008-07-12 00:30:27 +00:00
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.categories.getImages' ,
'ws_categories_getImages' ,
2013-10-22 12:58:58 +00:00
array_merge ( array (
2019-01-22 10:26:52 +01:00
'cat_id' => array ( 'default' => null ,
2013-10-22 12:58:58 +00:00
'flags' => WS_PARAM_FORCE_ARRAY ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'recursive' => array ( 'default' => false ,
'type' => WS_TYPE_BOOL ),
'per_page' => array ( 'default' => 100 ,
'maxValue' => $conf [ 'ws_max_images_per_page' ],
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'page' => array ( 'default' => 0 ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'order' => array ( 'default' => null ,
'info' => 'id, file, name, hit, rating_score, date_creation, date_available, random' ),
), $f_params ),
2007-01-06 11:13:08 +00:00
' Returns elements for the corresponding categories .
2013-10-22 12:58:58 +00:00
< br >< b > cat_id </ b > can be empty if < b > recursive </ b > is true .
2013-11-01 11:03:10 +00:00
< br >< b > order </ b > comma separated fields for sorting ' ,
$ws_functions_root . 'pwg.categories.php'
2007-01-06 11:13:08 +00:00
);
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.categories.getList' ,
'ws_categories_getList' ,
2007-01-06 11:13:08 +00:00
array (
2013-10-22 12:58:58 +00:00
'cat_id' => array ( 'default' => null ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ,
'info' => 'Parent category. "0" or empty for root.' ),
'recursive' => array ( 'default' => false ,
'type' => WS_TYPE_BOOL ),
'public' => array ( 'default' => false ,
'type' => WS_TYPE_BOOL ),
'tree_output' => array ( 'default' => false ,
'type' => WS_TYPE_BOOL ),
'fullname' => array ( 'default' => false ,
'type' => WS_TYPE_BOOL ),
2016-02-03 10:21:36 +01:00
'thumbnail_size' => array (
2016-02-04 10:14:44 +01:00
'default' => IMG_THUMB ,
2016-12-06 19:28:22 +01:00
'info' => implode ( ',' , array_keys ( ImageStdParams :: get_defined_type_map ()))
2016-02-03 10:21:36 +01:00
),
2023-06-27 14:41:28 +02:00
'search' => array ( 'default' => null ),
2024-03-08 15:55:43 +01:00
'limit' => array (
'default' => null ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ,
'info' => 'Parameter not compatible with recursive=true' ),
2013-02-18 19:41:40 +00:00
),
2013-11-01 11:03:10 +00:00
'Returns a list of categories.' ,
$ws_functions_root . 'pwg.categories.php'
2013-02-18 19:41:40 +00:00
);
2007-01-06 11:13:08 +00:00
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.getMissingDerivatives' ,
'ws_getMissingDerivatives' ,
2013-10-22 12:58:58 +00:00
array_merge ( array (
'types' => array ( 'default' => null ,
'flags' => WS_PARAM_FORCE_ARRAY ,
'info' => 'square, thumb, 2small, xsmall, small, medium, large, xlarge, xxlarge' ),
'ids' => array ( 'default' => null ,
'flags' => WS_PARAM_FORCE_ARRAY ,
'type' => WS_TYPE_ID ),
'max_urls' => array ( 'default' => 200 ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'prev_page' => array ( 'default' => null ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
), $f_params ),
2013-11-08 12:16:14 +00:00
'Returns a list of derivatives to build.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true )
2013-02-18 19:41:40 +00:00
);
2012-01-08 19:25:52 +00:00
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.images.addComment' ,
'ws_images_addComment' ,
2007-02-22 01:12:32 +00:00
array (
2013-10-22 12:58:58 +00:00
'image_id' => array ( 'type' => WS_TYPE_ID ),
2013-02-18 19:41:40 +00:00
'author' => array ( 'default' => is_a_guest () ? 'guest' : $user [ 'username' ]),
'content' => array (),
'key' => array (),
),
2013-11-08 12:16:14 +00:00
'Adds a comment to an image.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.images.php' ,
2013-10-24 10:01:35 +00:00
array ( 'post_only' => true )
2013-02-18 19:41:40 +00:00
);
2007-02-22 01:12:32 +00:00
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.images.getInfo' ,
'ws_images_getInfo' ,
2007-02-22 01:12:32 +00:00
array (
2013-10-22 12:58:58 +00:00
'image_id' => array ( 'type' => WS_TYPE_ID ),
'comments_page' => array ( 'default' => 0 ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'comments_per_page' => array ( 'default' => $conf [ 'nb_comment_page' ],
'maxValue' => 2 * $conf [ 'nb_comment_page' ],
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
2013-02-18 19:41:40 +00:00
),
2013-11-01 11:03:10 +00:00
'Returns information about an image.' ,
$ws_functions_root . 'pwg.images.php'
2013-02-18 19:41:40 +00:00
);
2007-01-06 11:13:08 +00:00
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.images.rate' ,
'ws_images_rate' ,
2013-10-22 12:58:58 +00:00
array (
'image_id' => array ( 'type' => WS_TYPE_ID ),
'rate' => array ( 'type' => WS_TYPE_FLOAT ),
),
2013-11-01 11:03:10 +00:00
'Rates an image.' ,
$ws_functions_root . 'pwg.images.php'
2013-02-18 19:41:40 +00:00
);
2008-07-15 01:29:23 +00:00
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.images.search' ,
'ws_images_search' ,
2013-10-22 12:58:58 +00:00
array_merge ( array (
'query' => array (),
'per_page' => array ( 'default' => 100 ,
'maxValue' => $conf [ 'ws_max_images_per_page' ],
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'page' => array ( 'default' => 0 ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'order' => array ( 'default' => null ,
'info' => 'id, file, name, hit, rating_score, date_creation, date_available, random' ),
), $f_params ),
2013-11-01 11:03:10 +00:00
'Returns elements for the corresponding query search.' ,
$ws_functions_root . 'pwg.images.php'
2007-02-19 16:25:47 +00:00
);
2008-09-11 01:20:25 +00:00
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.images.setPrivacyLevel' ,
'ws_images_setPrivacyLevel' ,
2013-02-18 19:41:40 +00:00
array (
2013-10-22 12:58:58 +00:00
'image_id' => array ( 'flags' => WS_PARAM_FORCE_ARRAY ,
'type' => WS_TYPE_ID ),
'level' => array ( 'maxValue' => max ( $conf [ 'available_permission_levels' ]),
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
2013-02-18 19:41:40 +00:00
),
2013-11-08 12:16:14 +00:00
'Sets the privacy levels for the images.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.images.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true , 'post_only' => true )
2008-07-30 21:53:00 +00:00
);
2007-02-19 16:25:47 +00:00
2022-05-31 12:05:27 +02:00
$service -> addMethod (
'pwg.images.formats.searchImage' ,
'ws_images_formats_searchImage' ,
array (
'category_id' => array ( 'type' => WS_TYPE_ID , 'default' => null ),
'filename_list' => array (),
),
'Search for image ids matching the provided filenames. <b>filename_list</b> must be a JSON encoded associative array of unique_id:filename.<br><br>The method returns a list of unique_id:image_id.' ,
$ws_functions_root . 'pwg.images.php' ,
array ( 'admin_only' => true , 'post_only' => true )
);
2022-07-29 15:56:53 +02:00
$service -> addMethod (
'pwg.images.formats.delete' ,
'ws_images_formats_delete' ,
array (
'format_id' => array ( 'type' => WS_TYPE_ID , 'default' => null , 'flags' => WS_PARAM_ACCEPT_ARRAY ),
'pwg_token' => array (),
),
'Remove a format' ,
$ws_functions_root . 'pwg.images.php' ,
array ( 'admin_only' => true , 'post_only' => true )
);
2022-05-31 12:05:27 +02:00
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.images.setRank' ,
'ws_images_setRank' ,
2013-10-22 12:58:58 +00:00
array (
2016-01-28 16:03:39 +01:00
'image_id' => array ( 'type' => WS_TYPE_ID , 'flags' => WS_PARAM_FORCE_ARRAY ),
2013-10-22 12:58:58 +00:00
'category_id' => array ( 'type' => WS_TYPE_ID ),
2016-01-28 16:03:39 +01:00
'rank' => array ( 'type' => WS_TYPE_INT | WS_TYPE_POSITIVE | WS_TYPE_NOTNULL , 'default' => null )
2013-10-22 12:58:58 +00:00
),
2016-01-28 16:03:39 +01:00
' Sets the rank of a photo for a given album .
< br >< br > If you provide a list for image_id :
< ul >
< li > rank becomes useless , only the order of the image_id list matters </ li >
< li > you are supposed to provide the list of all image_ids belonging to the album .
</ ul > ' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.images.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true , 'post_only' => true )
2023-10-11 16:58:14 +02:00
);
$service -> addMethod (
'pwg.images.setCategory' ,
'ws_images_setCategory' ,
array (
'image_id' => array ( 'flags' => WS_PARAM_FORCE_ARRAY , 'type' => WS_TYPE_ID ),
'category_id' => array ( 'type' => WS_TYPE_ID ),
'action' => array ( 'default' => 'associate' , 'info' => 'associate/dissociate/move' ),
'pwg_token' => array (),
),
'Manage associations of images with an album. <b>action</b> can be:<ul><li><i>associate</i> : add photos to this album</li><li><i>dissociate</i> : remove photos from this album</li><li><i>move</i> : dissociate photos from any other album and adds photos to this album</li></ul>' ,
$ws_functions_root . 'pwg.images.php' ,
array ( 'admin_only' => true , 'post_only' => true )
2011-06-14 13:54:05 +00:00
);
2011-11-14 20:10:37 +00:00
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.rates.delete' ,
'ws_rates_delete' ,
2013-02-18 19:41:40 +00:00
array (
2013-10-22 12:58:58 +00:00
'user_id' => array ( 'type' => WS_TYPE_ID ),
2013-02-18 19:41:40 +00:00
'anonymous_id' => array ( 'default' => null ),
2014-01-17 22:19:44 +00:00
'image_id' => array ( 'flags' => WS_PARAM_OPTIONAL , 'type' => WS_TYPE_ID ),
2013-02-18 19:41:40 +00:00
),
2013-11-08 12:16:14 +00:00
'Deletes all rates for a user.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true , 'post_only' => true )
2011-11-14 20:10:37 +00:00
);
2013-02-18 19:41:40 +00:00
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.session.getStatus' ,
'ws_session_getStatus' ,
null ,
2013-11-01 11:03:10 +00:00
'Gets information about the current session. Also provides a token useable with admin methods.' ,
$ws_functions_root . 'pwg.php'
2013-02-18 20:02:55 +00:00
);
2013-02-18 19:41:40 +00:00
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.session.login' ,
'ws_session_login' ,
2019-08-26 15:55:09 +02:00
array (
'username' => array (),
'password' => array ( 'default' => null ),
),
2013-11-08 12:16:14 +00:00
'Tries to login the user.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.php' ,
2013-10-24 10:01:35 +00:00
array ( 'post_only' => true )
2013-02-18 19:41:40 +00:00
);
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.session.logout' ,
'ws_session_logout' ,
null ,
2013-11-01 11:03:10 +00:00
'Ends the current session.' ,
$ws_functions_root . 'pwg.php'
2013-02-18 20:02:55 +00:00
);
2007-01-06 11:13:08 +00:00
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.tags.getList' ,
'ws_tags_getList' ,
2013-02-18 19:41:40 +00:00
array (
2013-10-22 12:58:58 +00:00
'sort_by_counter' => array ( 'default' => false ,
'type' => WS_TYPE_BOOL ),
2013-02-18 19:41:40 +00:00
),
2013-11-01 11:03:10 +00:00
'Retrieves a list of available tags.' ,
$ws_functions_root . 'pwg.tags.php'
2013-02-18 19:41:40 +00:00
);
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.tags.getImages' ,
'ws_tags_getImages' ,
2013-10-22 12:58:58 +00:00
array_merge ( array (
2013-02-18 19:41:40 +00:00
'tag_id' => array ( 'default' => null ,
2013-10-22 12:58:58 +00:00
'flags' => WS_PARAM_FORCE_ARRAY ,
'type' => WS_TYPE_ID ),
2013-02-18 19:41:40 +00:00
'tag_url_name' => array ( 'default' => null ,
'flags' => WS_PARAM_FORCE_ARRAY ),
'tag_name' => array ( 'default' => null ,
'flags' => WS_PARAM_FORCE_ARRAY ),
2013-10-22 12:58:58 +00:00
'tag_mode_and' => array ( 'default' => false ,
'type' => WS_TYPE_BOOL ),
2013-02-18 19:41:40 +00:00
'per_page' => array ( 'default' => 100 ,
2013-10-22 12:58:58 +00:00
'maxValue' => $conf [ 'ws_max_images_per_page' ],
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'page' => array ( 'default' => 0 ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'order' => array ( 'default' => null ,
'info' => 'id, file, name, hit, rating_score, date_creation, date_available, random' ),
), $f_params ),
2013-11-01 11:03:10 +00:00
'Returns elements for the corresponding tags. Fill at least tag_id, tag_url_name or tag_name.' ,
$ws_functions_root . 'pwg.tags.php'
2007-01-06 11:13:08 +00:00
);
2008-07-30 21:53:00 +00:00
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.images.addChunk' ,
'ws_images_add_chunk' ,
2013-10-22 12:58:58 +00:00
array (
'data' => array (),
'original_sum' => array (),
'type' => array ( 'default' => 'file' ,
'info' => 'Must be "file", for backward compatiblity "high" and "thumb" are allowed.' ),
'position' => array ()
),
2013-11-08 12:16:14 +00:00
'Add a chunk of a file.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.images.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true , 'post_only' => true )
2009-03-12 23:14:50 +00:00
);
2009-11-22 23:59:14 +00:00
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.images.addFile' ,
'ws_images_addFile' ,
2013-10-22 12:58:58 +00:00
array (
'image_id' => array ( 'type' => WS_TYPE_ID ),
'type' => array ( 'default' => 'file' ,
'info' => 'Must be "file", for backward compatiblity "high" and "thumb" are allowed.' ),
'sum' => array (),
),
2013-11-08 12:16:14 +00:00
' Add or update a file for an existing photo .
2013-10-24 10:01:35 +00:00
< br > pwg . images . addChunk must have been called before ( maybe several times ) . ' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.images.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true )
2013-02-18 19:41:40 +00:00
);
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.images.add' ,
'ws_images_add' ,
2013-02-18 19:41:40 +00:00
array (
'thumbnail_sum' => array ( 'default' => null ),
'high_sum' => array ( 'default' => null ),
'original_sum' => array (),
2013-10-22 12:58:58 +00:00
'original_filename' => array ( 'default' => null ,
'Provide it if "check_uniqueness" is true and $conf["uniqueness_mode"] is "filename".' ),
2013-02-18 19:41:40 +00:00
'name' => array ( 'default' => null ),
'author' => array ( 'default' => null ),
'date_creation' => array ( 'default' => null ),
'comment' => array ( 'default' => null ),
2013-10-22 12:58:58 +00:00
'categories' => array ( 'default' => null ,
'info' => 'String list "category_id[,rank];category_id[,rank]".<br>The rank is optional and is equivalent to "auto" if not given.' ),
'tag_ids' => array ( 'default' => null ,
'info' => 'Comma separated ids' ),
2013-02-18 19:41:40 +00:00
'level' => array ( 'default' => 0 ,
2013-10-22 12:58:58 +00:00
'maxValue' => max ( $conf [ 'available_permission_levels' ]),
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'check_uniqueness' => array ( 'default' => true ,
'type' => WS_TYPE_BOOL ),
'image_id' => array ( 'default' => null ,
'type' => WS_TYPE_ID ),
2008-09-22 21:47:03 +00:00
),
2013-11-08 12:16:14 +00:00
' Add an image .
2013-10-22 12:58:58 +00:00
< br > pwg . images . addChunk must have been called before ( maybe several times ) .
2013-10-24 10:01:35 +00:00
< br > Don\ 't use "thumbnail_sum" and "high_sum", these parameters are here for backward compatibility.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.images.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true )
2013-02-18 19:41:40 +00:00
);
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.images.addSimple' ,
'ws_images_addSimple' ,
2013-02-18 19:41:40 +00:00
array (
2013-10-22 12:58:58 +00:00
'category' => array ( 'default' => null ,
'flags' => WS_PARAM_FORCE_ARRAY ,
'type' => WS_TYPE_ID ),
2013-02-18 19:41:40 +00:00
'name' => array ( 'default' => null ),
'author' => array ( 'default' => null ),
'comment' => array ( 'default' => null ),
'level' => array ( 'default' => 0 ,
2013-10-22 12:58:58 +00:00
'maxValue' => max ( $conf [ 'available_permission_levels' ]),
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
2013-02-18 19:41:40 +00:00
'tags' => array ( 'default' => null ,
'flags' => WS_PARAM_ACCEPT_ARRAY ),
2013-10-22 12:58:58 +00:00
'image_id' => array ( 'default' => null ,
'type' => WS_TYPE_ID ),
2010-12-23 10:22:51 +00:00
),
2013-11-08 12:16:14 +00:00
' Add an image .
2013-10-22 12:58:58 +00:00
< br > Use the < b > $_FILES [ image ] </ b > field for uploading file .
< br > Set the form encoding to " form-data " .
2013-10-24 10:01:35 +00:00
< br > You can update an existing photo if you define an existing image_id . ' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.images.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true , 'post_only' => true )
2010-12-23 10:22:51 +00:00
);
2010-12-23 20:51:33 +00:00
2014-05-27 14:11:23 +00:00
$service -> addMethod (
'pwg.images.upload' ,
'ws_images_upload' ,
array (
'name' => array ( 'default' => null ),
'category' => array (
'default' => null ,
'flags' => WS_PARAM_FORCE_ARRAY ,
'type' => WS_TYPE_ID
),
'level' => array (
'default' => 0 ,
'maxValue' => max ( $conf [ 'available_permission_levels' ]),
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE
),
2022-05-31 12:05:27 +02:00
'format_of' => array (
'default' => null ,
'type' => WS_TYPE_ID ,
'info' => 'id of the extended image (name/category/level are not used if format_of is provided)' ,
),
2014-05-27 14:11:23 +00:00
'pwg_token' => array (),
),
' Add an image .
< br > Use the < b > $_FILES [ image ] </ b > field for uploading file .
< br > Set the form encoding to " form-data " . ' ,
$ws_functions_root . 'pwg.images.php' ,
array ( 'admin_only' => true , 'post_only' => true )
);
2020-11-19 18:12:28 +01:00
$service -> addMethod (
'pwg.images.uploadAsync' ,
'ws_images_uploadAsync' ,
array (
'username' => array (),
'password' => array ( 'default' => null ),
'chunk' => array ( 'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'chunk_sum' => array (),
'chunks' => array ( 'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'original_sum' => array (),
'category' => array ( 'default' => null , 'flags' => WS_PARAM_FORCE_ARRAY , 'type' => WS_TYPE_ID ),
'filename' => array (),
'name' => array ( 'default' => null ),
'author' => array ( 'default' => null ),
'comment' => array ( 'default' => null ),
'date_creation' => array ( 'default' => null ),
'level' => array ( 'default' => 0 , 'maxValue' => max ( $conf [ 'available_permission_levels' ]), 'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'tag_ids' => array ( 'default' => null , 'info' => 'Comma separated ids' ),
'image_id' => array ( 'default' => null , 'type' => WS_TYPE_ID ),
),
' Upload photo by chunks in a random order .
< br > Use the < b > $_FILES [ file ] </ b > field for uploading file .
< br > Start with chunk 0 ( zero ) .
< br > Set the form encoding to " form-data " .
< br > You can update an existing photo if you define an existing image_id .
< br > Requires < b > admin </ b > credentials . ' ,
$ws_functions_root . 'pwg.images.php' ,
2021-10-07 14:53:27 +02:00
array ( 'admin_only' => true , 'post_only' => true )
2020-11-19 18:12:28 +01:00
);
2014-05-27 14:11:23 +00:00
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.images.delete' ,
'ws_images_delete' ,
2013-02-18 19:41:40 +00:00
array (
2013-10-22 12:58:58 +00:00
'image_id' => array ( 'flags' => WS_PARAM_ACCEPT_ARRAY ),
2013-02-18 19:41:40 +00:00
'pwg_token' => array (),
),
2013-11-08 12:16:14 +00:00
'Deletes image(s).' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.images.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true , 'post_only' => true )
2008-09-24 20:25:39 +00:00
);
2008-09-24 21:30:33 +00:00
2019-01-27 17:16:13 +01:00
$service -> addMethod (
'pwg.images.setMd5sum' ,
'ws_images_setMd5sum' ,
array (
2020-02-07 15:10:05 +01:00
'block_size' => array ( 'default' => $conf [ 'checksum_compute_blocksize' ], 'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
2019-01-27 17:16:13 +01:00
'pwg_token' => array (),
),
'Set md5sum column, by blocks. Returns how many md5sums were added and how many are remaining.' ,
$ws_functions_root . 'pwg.images.php' ,
array ( 'admin_only' => true , 'post_only' => true )
);
$service -> addMethod (
'pwg.images.syncMetadata' ,
'ws_images_syncMetadata' ,
array (
2024-07-09 15:42:21 +02:00
'image_id' => array ( 'flags' => WS_PARAM_ACCEPT_ARRAY , 'info' => 'Comma separated ids or array of id' ),
2019-01-27 17:16:13 +01:00
'pwg_token' => array (),
),
'Sync metadatas, by blocks. Returns how many images were synchronized' ,
$ws_functions_root . 'pwg.images.php' ,
array ( 'admin_only' => true , 'post_only' => true )
);
2019-01-22 10:26:52 +01:00
2017-01-24 15:09:52 +01:00
$service -> addMethod (
'pwg.images.deleteOrphans' ,
'ws_images_deleteOrphans' ,
array (
'block_size' => array ( 'default' => 1000 , 'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'pwg_token' => array (),
),
'Deletes orphans, by blocks. Returns how many orphans were deleted and how many are remaining.' ,
$ws_functions_root . 'pwg.images.php' ,
array ( 'admin_only' => true , 'post_only' => true )
);
2021-07-28 16:52:44 +02:00
$service -> addMethod (
2021-08-04 12:35:45 +02:00
'pwg.categories.calculateOrphans' ,
'ws_categories_calculateOrphans' ,
2021-07-28 16:52:44 +02:00
array (
'category_id' => array ( 'type' => WS_TYPE_ID ,
'flags' => WS_PARAM_FORCE_ARRAY ),
),
'Return the number of orphan photos if an album is deleted.' ,
2021-08-04 12:35:45 +02:00
$ws_functions_root . 'pwg.categories.php' ,
2021-07-28 16:52:44 +02:00
array ( 'admin_only' => true )
);
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.categories.getAdminList' ,
'ws_categories_getAdminList' ,
2022-03-08 16:56:31 +01:00
array (
2024-07-31 11:36:43 +02:00
'cat_id' => array ( 'default' => null ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ,
'info' => 'Parent category. "0" or empty for root.' ),
2022-03-08 16:56:31 +01:00
'search' => array ( 'default' => null ),
2024-07-31 11:36:43 +02:00
'recursive' => array (
'default' => true ,
'type' => WS_TYPE_BOOL ),
2022-03-08 16:56:31 +01:00
'additional_output' => array ( 'default' => null ,
'info' => 'Comma saparated list (see method description)' ),
),
' Get albums list as displayed on admin page . < br >
< b > additional_output </ b > controls which data are returned , possible values are :< br >
null , full_name_with_admin_links < br > ' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.categories.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true )
2010-12-23 20:51:33 +00:00
);
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.categories.add' ,
'ws_categories_add' ,
2013-02-18 19:41:40 +00:00
array (
'name' => array (),
2013-10-22 12:58:58 +00:00
'parent' => array ( 'default' => null ,
2013-10-31 17:27:37 +00:00
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
2013-02-18 19:41:40 +00:00
'comment' => array ( 'default' => null ),
2013-10-22 12:58:58 +00:00
'visible' => array ( 'default' => true ,
'type' => WS_TYPE_BOOL ),
'status' => array ( 'default' => null ,
'info' => 'public, private' ),
'commentable' => array ( 'default' => true ,
'type' => WS_TYPE_BOOL ),
2022-08-18 11:34:37 +02:00
'position' => array ( 'default' => null , 'info' => 'first, last' ),
2023-11-23 19:45:54 +01:00
'pwg_token' => array ( 'flags' => WS_PARAM_OPTIONAL ),
2013-02-18 19:41:40 +00:00
),
2023-11-23 19:45:54 +01:00
'Adds an album.<br><br><b>pwg_token</b> required if you want to use HTML in name/comment.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.categories.php' ,
array ( 'admin_only' => true )
2010-12-23 22:41:28 +00:00
);
2011-07-14 21:44:14 +00:00
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.categories.delete' ,
'ws_categories_delete' ,
2013-02-18 19:41:40 +00:00
array (
2013-10-22 12:58:58 +00:00
'category_id' => array ( 'flags' => WS_PARAM_ACCEPT_ARRAY ),
2013-02-18 19:41:40 +00:00
'photo_deletion_mode' => array ( 'default' => 'delete_orphans' ),
2013-10-22 12:58:58 +00:00
'pwg_token' => array (),
2013-02-18 19:41:40 +00:00
),
2013-11-08 12:16:14 +00:00
' Deletes album ( s ) .
2013-02-18 19:41:40 +00:00
< br >< b > photo_deletion_mode </ b > can be " no_delete " ( may create orphan photos ), " delete_orphans "
2013-10-24 10:01:35 +00:00
( default mode , only deletes photos linked to no other album ) or " force_delete " ( delete all photos , even those linked to other albums ) ' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.categories.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true , 'post_only' => true )
2011-07-14 21:44:14 +00:00
);
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.categories.move' ,
'ws_categories_move' ,
2013-02-18 19:41:40 +00:00
array (
2013-10-22 12:58:58 +00:00
'category_id' => array ( 'flags' => WS_PARAM_ACCEPT_ARRAY ),
'parent' => array ( 'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
2013-02-18 19:41:40 +00:00
'pwg_token' => array (),
),
2013-11-08 12:16:14 +00:00
' Move album ( s ) .
2013-10-24 10:01:35 +00:00
< br > Set parent as 0 to move to gallery root . Only virtual categories can be moved . ' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.categories.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true , 'post_only' => true )
2008-09-24 21:30:33 +00:00
);
2008-10-01 21:08:51 +00:00
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.categories.setRepresentative' ,
'ws_categories_setRepresentative' ,
2013-02-18 19:41:40 +00:00
array (
2013-10-22 12:58:58 +00:00
'category_id' => array ( 'type' => WS_TYPE_ID ),
'image_id' => array ( 'type' => WS_TYPE_ID ),
2013-02-18 19:41:40 +00:00
),
2013-11-08 12:16:14 +00:00
'Sets the representative photo for an album. The photo doesn\'t have to belong to the album.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.categories.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true , 'post_only' => true )
2008-10-01 21:08:51 +00:00
);
2015-12-01 12:08:10 +01:00
$service -> addMethod (
'pwg.categories.deleteRepresentative' ,
'ws_categories_deleteRepresentative' ,
array (
'category_id' => array ( 'type' => WS_TYPE_ID ),
),
'Deletes the album thumbnail. Only possible if $conf[\'allow_random_representative\']' ,
$ws_functions_root . 'pwg.categories.php' ,
array ( 'admin_only' => true , 'post_only' => true )
);
$service -> addMethod (
'pwg.categories.refreshRepresentative' ,
'ws_categories_refreshRepresentative' ,
array (
'category_id' => array ( 'type' => WS_TYPE_ID ),
),
'Find a new album thumbnail.' ,
$ws_functions_root . 'pwg.categories.php' ,
array ( 'admin_only' => true , 'post_only' => true )
);
2008-10-07 22:01:14 +00:00
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.tags.getAdminList' ,
'ws_tags_getAdminList' ,
2013-02-18 19:41:40 +00:00
null ,
2013-10-24 10:01:35 +00:00
'<b>Admin only.</b>' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.tags.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true )
2008-10-07 22:01:14 +00:00
);
2008-12-03 22:55:17 +00:00
2013-10-22 12:58:58 +00:00
$service -> addMethod ( // TODO: create multiple tags
2013-02-18 20:02:55 +00:00
'pwg.tags.add' ,
'ws_tags_add' ,
2020-06-16 16:44:14 +02:00
array (
2020-06-18 11:16:14 +02:00
'name' => array ()
2020-06-16 16:44:14 +02:00
),
2013-11-08 12:16:14 +00:00
'Adds a new tag.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.tags.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true )
2013-02-18 19:41:40 +00:00
);
2020-06-16 16:44:14 +02:00
$service -> addMethod (
'pwg.tags.delete' ,
'ws_tags_delete' ,
array (
'tag_id' => array ( 'type' => WS_TYPE_ID ,
'flags' => WS_PARAM_FORCE_ARRAY ),
'pwg_token' => array (),
),
'Delete tag(s) by ID.' ,
$ws_functions_root . 'pwg.tags.php' ,
array ( 'admin_only' => true )
);
$service -> addMethod (
'pwg.tags.rename' ,
'ws_tags_rename' ,
array (
'tag_id' => array ( 'type' => WS_TYPE_ID ),
'new_name' => array (),
'pwg_token' => array (),
),
'Rename tag' ,
$ws_functions_root . 'pwg.tags.php' ,
array ( 'admin_only' => true )
);
$service -> addMethod (
'pwg.tags.duplicate' ,
'ws_tags_duplicate' ,
array (
'tag_id' => array ( 'type' => WS_TYPE_ID ),
'copy_name' => array (),
'pwg_token' => array (),
),
'Create a copy of a tag' ,
$ws_functions_root . 'pwg.tags.php' ,
array ( 'admin_only' => true , 'post_only' => true )
);
$service -> addMethod (
'pwg.tags.merge' ,
'ws_tags_merge' ,
array (
'destination_tag_id' => array ( 'type' => WS_TYPE_ID ,
'info' => 'Is not necessarily part of groups to merge' ),
'merge_tag_id' => array ( 'flags' => WS_PARAM_FORCE_ARRAY ,
'type' => WS_TYPE_ID ),
'pwg_token' => array (),
),
'Merge tags in one other group' ,
$ws_functions_root . 'pwg.tags.php' ,
array ( 'admin_only' => true , 'post_only' => true )
);
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.images.exist' ,
'ws_images_exist' ,
2013-02-18 19:41:40 +00:00
array (
'md5sum_list' => array ( 'default' => null ),
'filename_list' => array ( 'default' => null ),
2008-12-03 22:55:17 +00:00
),
2013-11-08 12:16:14 +00:00
' Checks existence of images .
2013-10-24 10:01:35 +00:00
< br > Give < b > md5sum_list </ b > if $conf [ uniqueness_mode ] == md5sum . Give < b > filename_list </ b > if $conf [ uniqueness_mode ] == filename . ' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.images.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true )
2013-02-18 19:41:40 +00:00
);
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.images.checkFiles' ,
'ws_images_checkFiles' ,
2013-02-18 19:41:40 +00:00
array (
2013-10-22 12:58:58 +00:00
'image_id' => array ( 'type' => WS_TYPE_ID ),
2013-02-18 19:41:40 +00:00
'file_sum' => array ( 'default' => null ),
2013-10-22 12:58:58 +00:00
'thumbnail_sum' => array ( 'default' => null ),
2013-02-18 19:41:40 +00:00
'high_sum' => array ( 'default' => null ),
),
2013-11-08 12:16:14 +00:00
' Checks if you have updated version of your files for a given photo , the answer can be " missing " , " equals " or " differs " .
2013-10-24 10:01:35 +00:00
< br > Don\ 't use "thumbnail_sum" and "high_sum", these parameters are here for backward compatibility.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.images.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true )
2013-02-18 19:41:40 +00:00
);
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.images.checkUpload' ,
'ws_images_checkUpload' ,
2013-02-18 19:41:40 +00:00
null ,
2013-11-08 12:16:14 +00:00
'Checks if Piwigo is ready for upload.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.images.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true )
2013-02-18 19:41:40 +00:00
);
2021-06-11 16:35:29 +02:00
$service -> addMethod (
'pwg.images.emptyLounge' ,
'ws_images_emptyLounge' ,
null ,
'Empty lounge, where images may be waiting before taking off.' ,
$ws_functions_root . 'pwg.images.php' ,
array ( 'admin_only' => true )
);
2021-09-15 13:47:41 +02:00
$service -> addMethod (
'pwg.images.uploadCompleted' ,
'ws_images_uploadCompleted' ,
array (
'image_id' => array ( 'default' => null , 'flags' => WS_PARAM_ACCEPT_ARRAY ),
'pwg_token' => array (),
2024-01-31 13:19:53 +01:00
'category_id' => array ( 'type' => WS_TYPE_ID ),
2021-09-15 13:47:41 +02:00
),
2024-10-10 17:12:47 -05:00
'Notify Piwigo you have finished uploading a set of photos. It will empty the lounge, if any.' ,
2021-09-15 13:47:41 +02:00
$ws_functions_root . 'pwg.images.php' ,
array ( 'admin_only' => true )
);
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.images.setInfo' ,
'ws_images_setInfo' ,
2013-02-18 19:41:40 +00:00
array (
2013-10-22 12:58:58 +00:00
'image_id' => array ( 'type' => WS_TYPE_ID ),
2013-02-18 19:41:40 +00:00
'file' => array ( 'default' => null ),
'name' => array ( 'default' => null ),
'author' => array ( 'default' => null ),
'date_creation' => array ( 'default' => null ),
'comment' => array ( 'default' => null ),
2013-10-22 12:58:58 +00:00
'categories' => array ( 'default' => null ,
'info' => 'String list "category_id[,rank];category_id[,rank]".<br>The rank is optional and is equivalent to "auto" if not given.' ),
'tag_ids' => array ( 'default' => null ,
'info' => 'Comma separated ids' ),
2013-02-18 19:41:40 +00:00
'level' => array ( 'default' => null ,
2013-10-22 12:58:58 +00:00
'maxValue' => max ( $conf [ 'available_permission_levels' ]),
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
2013-02-18 19:41:40 +00:00
'single_value_mode' => array ( 'default' => 'fill_if_empty' ),
'multiple_value_mode' => array ( 'default' => 'append' ),
2023-11-23 19:45:54 +01:00
'pwg_token' => array ( 'flags' => WS_PARAM_OPTIONAL ),
2013-02-18 19:41:40 +00:00
),
2013-11-08 12:16:14 +00:00
' Changes properties of an image .
2013-02-18 19:41:40 +00:00
< 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 "
2013-10-22 12:58:58 +00:00
( overwrite any existing value ) and applies to single values properties like name / author / date_creation / comment .
2023-11-23 19:45:54 +01:00
< 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 .
< br >< b > pwg_token </ b > required if you want to use HTML in name / comment / author . ' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.images.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true , 'post_only' => true )
2008-12-03 22:55:17 +00:00
);
2009-12-18 21:12:41 +00:00
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.categories.setInfo' ,
'ws_categories_setInfo' ,
2013-02-18 19:41:40 +00:00
array (
2013-10-22 12:58:58 +00:00
'category_id' => array ( 'type' => WS_TYPE_ID ),
2023-01-02 16:18:34 +01:00
'name' => array ( 'default' => null ,
'flags' => WS_PARAM_OPTIONAL ,),
'comment' => array ( 'default' => null ,
'flags' => WS_PARAM_OPTIONAL ,),
2016-02-23 15:58:31 +01:00
'status' => array ( 'default' => null ,
2023-01-02 16:18:34 +01:00
'flags' => WS_PARAM_OPTIONAL ,
2016-02-23 15:58:31 +01:00
'info' => 'public, private' ),
2023-01-04 18:06:10 +01:00
'visible' => array ( 'default' => null ,
'flags' => WS_PARAM_OPTIONAL ),
2023-01-09 14:49:07 +01:00
'commentable' => array ( 'default' => null ,
2023-01-02 16:18:34 +01:00
'flags' => WS_PARAM_OPTIONAL ,
'info' => 'Boolean, effective if configuration variable activate_comments is set to true' ),
2023-01-09 14:49:07 +01:00
'apply_commentable_to_subalbums' => array ( 'default' => null ,
2023-01-02 16:18:34 +01:00
'flags' => WS_PARAM_OPTIONAL ,
'info' => 'If true, set commentable to all sub album' ),
2023-11-23 19:45:54 +01:00
'pwg_token' => array ( 'flags' => WS_PARAM_OPTIONAL ),
2013-02-18 19:41:40 +00:00
),
2023-11-23 19:45:54 +01:00
'Changes properties of an album.<br><br><b>pwg_token</b> required if you want to use HTML in name/comment.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.categories.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true , 'post_only' => true )
2009-06-24 23:01:35 +00:00
);
2019-02-13 15:00:22 +01:00
$service -> addMethod (
'pwg.categories.setRank' ,
'ws_categories_setRank' ,
array (
'category_id' => array ( 'type' => WS_TYPE_ID ,
'flags' => WS_PARAM_FORCE_ARRAY ),
'rank' => array ( 'type' => WS_TYPE_INT | WS_TYPE_POSITIVE | WS_TYPE_NOTNULL ,
'flags' => WS_PARAM_OPTIONAL ),
),
' Changes the rank of an album
< br >< br > If you provide a list for category_id :
< ul >
< li > rank becomes useless , only the order of the image_id list matters </ li >
< li > you are supposed to provide the list of all categories_ids belonging to the album .
</ ul >. ' ,
$ws_functions_root . 'pwg.categories.php' ,
array ( 'admin_only' => true , 'post_only' => true )
);
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.plugins.getList' ,
'ws_plugins_getList' ,
2013-02-18 19:41:40 +00:00
null ,
2013-11-08 12:16:14 +00:00
'Gets the list of plugins with id, name, version, state and description.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.extensions.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true )
2010-12-23 23:12:03 +00:00
);
2010-12-26 22:52:35 +00:00
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.plugins.performAction' ,
'ws_plugins_performAction' ,
2013-10-22 12:58:58 +00:00
array (
'action' => array ( 'info' => 'install, activate, deactivate, uninstall, delete' ),
'plugin' => array (),
'pwg_token' => array (),
),
2013-11-08 12:16:14 +00:00
null ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.extensions.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true )
2013-02-18 19:41:40 +00:00
);
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.themes.performAction' ,
'ws_themes_performAction' ,
2013-10-22 12:58:58 +00:00
array (
'action' => array ( 'info' => 'activate, deactivate, delete, set_default' ),
'theme' => array (),
'pwg_token' => array (),
),
2013-11-08 12:16:14 +00:00
null ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.extensions.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true )
2013-02-18 19:41:40 +00:00
);
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.extensions.update' ,
'ws_extensions_update' ,
2013-10-22 12:58:58 +00:00
array (
'type' => array ( 'info' => 'plugins, languages, themes' ),
'id' => array (),
'revision' => array (),
'pwg_token' => array (),
),
2013-10-24 10:01:35 +00:00
'<b>Webmaster only.</b>' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.extensions.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true )
2013-10-24 13:38:12 +00:00
);
2011-04-20 14:52:52 +00:00
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.extensions.ignoreUpdate' ,
'ws_extensions_ignoreupdate' ,
2013-02-18 19:41:40 +00:00
array (
2013-10-22 12:58:58 +00:00
'type' => array ( 'default' => null ,
'info' => 'plugins, languages, themes' ),
2013-02-18 19:41:40 +00:00
'id' => array ( 'default' => null ),
2013-10-22 12:58:58 +00:00
'reset' => array ( 'default' => false ,
'type' => WS_TYPE_BOOL ,
'info' => 'If true, all ignored extensions will be reinitilized.' ),
2013-02-18 19:41:40 +00:00
'pwg_token' => array (),
),
2013-10-24 10:01:35 +00:00
'<b>Webmaster only.</b> Ignores an extension if it needs update.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.extensions.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true )
2013-10-24 13:38:12 +00:00
);
2011-04-21 15:12:38 +00:00
2013-02-18 20:02:55 +00:00
$service -> addMethod (
'pwg.extensions.checkUpdates' ,
'ws_extensions_checkupdates' ,
2013-02-18 19:41:40 +00:00
null ,
2013-11-08 12:16:14 +00:00
'Checks if piwigo or extensions are up to date.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.extensions.php' ,
2013-10-24 10:01:35 +00:00
array ( 'admin_only' => true )
2013-10-24 13:38:12 +00:00
);
$service -> addMethod (
'pwg.groups.getList' ,
'ws_groups_getList' ,
array (
2013-10-24 16:21:24 +00:00
'group_id' => array ( 'flags' => WS_PARAM_OPTIONAL | WS_PARAM_FORCE_ARRAY ,
2013-10-24 13:38:12 +00:00
'type' => WS_TYPE_ID ),
2013-10-24 16:21:24 +00:00
'name' => array ( 'flags' => WS_PARAM_OPTIONAL ,
2013-10-24 13:38:12 +00:00
'info' => 'Use "%" as wildcard.' ),
'per_page' => array ( 'default' => 100 ,
'maxValue' => $conf [ 'ws_max_users_per_page' ],
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'page' => array ( 'default' => 0 ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'order' => array ( 'default' => 'name' ,
'info' => 'id, name, nb_users, is_default' ),
),
2013-11-08 12:16:14 +00:00
'Retrieves a list of all groups. The list can be filtered.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.groups.php' ,
2013-10-24 13:38:12 +00:00
array ( 'admin_only' => true )
);
$service -> addMethod (
'pwg.groups.add' ,
'ws_groups_add' ,
array (
'name' => array (),
'is_default' => array ( 'default' => false ,
'type' => WS_TYPE_BOOL ),
),
2013-11-08 12:16:14 +00:00
'Creates a group and returns the new group record.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.groups.php' ,
2013-10-24 13:38:12 +00:00
array ( 'admin_only' => true , 'post_only' => true )
);
$service -> addMethod (
'pwg.groups.delete' ,
'ws_groups_delete' ,
array (
'group_id' => array ( 'flags' => WS_PARAM_FORCE_ARRAY ,
'type' => WS_TYPE_ID ),
2013-11-01 11:03:10 +00:00
'pwg_token' => array (),
2013-10-24 13:38:12 +00:00
),
2013-11-08 12:16:14 +00:00
'Deletes a or more groups. Users and photos are not deleted.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.groups.php' ,
2013-10-24 13:38:12 +00:00
array ( 'admin_only' => true , 'post_only' => true )
);
$service -> addMethod (
'pwg.groups.setInfo' ,
'ws_groups_setInfo' ,
array (
'group_id' => array ( 'type' => WS_TYPE_ID ),
2013-10-24 16:21:24 +00:00
'name' => array ( 'flags' => WS_PARAM_OPTIONAL ),
'is_default' => array ( 'flags' => WS_PARAM_OPTIONAL ,
2013-10-24 13:38:12 +00:00
'type' => WS_TYPE_BOOL ),
2014-03-17 22:20:28 +00:00
'pwg_token' => array (),
2013-10-24 13:38:12 +00:00
),
2013-11-08 12:16:14 +00:00
'Updates a group. Leave a field blank to keep the current value.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.groups.php' ,
2013-10-24 13:38:12 +00:00
array ( 'admin_only' => true , 'post_only' => true )
);
$service -> addMethod (
'pwg.groups.addUser' ,
'ws_groups_addUser' ,
array (
'group_id' => array ( 'type' => WS_TYPE_ID ),
'user_id' => array ( 'flags' => WS_PARAM_FORCE_ARRAY ,
'type' => WS_TYPE_ID ),
2014-03-17 22:20:28 +00:00
'pwg_token' => array (),
2013-10-24 13:38:12 +00:00
),
2013-11-08 12:16:14 +00:00
'Adds one or more users to a group.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.groups.php' ,
2013-11-07 21:02:52 +00:00
array ( 'admin_only' => true , 'post_only' => true )
2013-10-24 13:38:12 +00:00
);
$service -> addMethod (
'pwg.groups.deleteUser' ,
'ws_groups_deleteUser' ,
array (
'group_id' => array ( 'type' => WS_TYPE_ID ),
'user_id' => array ( 'flags' => WS_PARAM_FORCE_ARRAY ,
'type' => WS_TYPE_ID ),
2014-03-17 22:20:28 +00:00
'pwg_token' => array (),
2013-10-24 13:38:12 +00:00
),
2013-11-08 12:16:14 +00:00
'Removes one or more users from a group.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.groups.php' ,
2013-10-24 13:38:12 +00:00
array ( 'admin_only' => true , 'post_only' => true )
);
2020-05-13 16:57:52 +02:00
$service -> addMethod (
'pwg.groups.merge' ,
'ws_groups_merge' ,
array (
'destination_group_id' => array ( 'type' => WS_TYPE_ID ,
2020-05-15 12:37:01 +02:00
'info' => 'Is not necessarily part of groups to merge' ),
2020-05-13 16:57:52 +02:00
'merge_group_id' => array ( 'flags' => WS_PARAM_FORCE_ARRAY ,
'type' => WS_TYPE_ID ),
'pwg_token' => array (),
),
'Merge groups in one other group' ,
$ws_functions_root . 'pwg.groups.php' ,
array ( 'admin_only' => true , 'post_only' => true )
);
2020-05-15 12:37:01 +02:00
$service -> addMethod (
'pwg.groups.duplicate' ,
'ws_groups_duplicate' ,
array (
'group_id' => array ( 'type' => WS_TYPE_ID ),
'copy_name' => array (),
'pwg_token' => array (),
),
'Create a copy of a group' ,
$ws_functions_root . 'pwg.groups.php' ,
array ( 'admin_only' => true , 'post_only' => true )
);
2013-10-24 13:38:12 +00:00
$service -> addMethod (
'pwg.users.getList' ,
'ws_users_getList' ,
array (
2013-10-24 16:21:24 +00:00
'user_id' => array ( 'flags' => WS_PARAM_OPTIONAL | WS_PARAM_FORCE_ARRAY ,
2013-10-24 13:38:12 +00:00
'type' => WS_TYPE_ID ),
2013-10-24 16:21:24 +00:00
'username' => array ( 'flags' => WS_PARAM_OPTIONAL ,
2013-10-24 13:38:12 +00:00
'info' => 'Use "%" as wildcard.' ),
2013-10-24 16:21:24 +00:00
'status' => array ( 'flags' => WS_PARAM_OPTIONAL | WS_PARAM_FORCE_ARRAY ,
2013-10-24 13:38:12 +00:00
'info' => 'guest,generic,normal,admin,webmaster' ),
'min_level' => array ( 'default' => 0 ,
'maxValue' => max ( $conf [ 'available_permission_levels' ]),
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
2013-10-24 16:21:24 +00:00
'group_id' => array ( 'flags' => WS_PARAM_OPTIONAL | WS_PARAM_FORCE_ARRAY ,
2013-10-24 13:38:12 +00:00
'type' => WS_TYPE_ID ),
'per_page' => array ( 'default' => 100 ,
'maxValue' => $conf [ 'ws_max_users_per_page' ],
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'page' => array ( 'default' => 0 ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'order' => array ( 'default' => 'id' ,
'info' => 'id, username, level, email' ),
2023-05-29 12:25:03 +02:00
'exclude' => array ( 'flags' => WS_PARAM_OPTIONAL | WS_PARAM_FORCE_ARRAY ,
2023-11-10 14:40:08 +01:00
'type' => WS_TYPE_ID ,
'info' => 'Expects a user_id as value.' ),
2013-10-28 17:53:36 +00:00
'display' => array ( 'default' => 'basics' ,
2013-11-13 11:08:22 +00:00
'info' => 'Comma saparated list (see method description)' ),
2023-11-10 14:40:08 +01:00
'filter' => array ( 'flags' => WS_PARAM_OPTIONAL ,
'info' => 'Filter by username, email, group' ),
'min_register' => array ( 'flags' => WS_PARAM_OPTIONAL ,
'info' => 'See method description' ),
'max_register' => array ( 'flags' => WS_PARAM_OPTIONAL ,
'info' => 'See method description' ),
2013-10-24 13:38:12 +00:00
),
2013-11-13 11:08:22 +00:00
' Retrieves a list of all the users .< br >
< br >
< b > display </ b > controls which data are returned , possible values are :< br >
all , basics , none , < br >
username , email , status , level , groups , < br >
language , theme , nb_image_page , recent_period , expand , show_nb_comments , show_nb_hits , < br >
enabled_high , registration_date , registration_date_string , registration_date_since , last_visit , last_visit_string , last_visit_since < br >
2023-11-10 14:40:08 +01:00
< b > basics </ b > stands for " username,email,status,level,groups " < br >
< b > min_register </ b > and < b > max_register </ b > filter users by their registration date expecting format " YYYY " or " YYYY-mm " or " YYYY-mm-dd " . ' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.users.php' ,
2013-10-24 13:38:12 +00:00
array ( 'admin_only' => true )
);
$service -> addMethod (
'pwg.users.add' ,
'ws_users_add' ,
array (
'username' => array (),
2024-06-28 18:49:34 +02:00
'auto_password' => array (
'default' => false ,
'flags' => WS_TYPE_BOOL ,
'info' => 'if true ignores password and confirm password'
),
2013-10-24 13:38:12 +00:00
'password' => array ( 'default' => null ),
2013-10-30 12:54:46 +00:00
'password_confirm' => array ( 'flags' => WS_PARAM_OPTIONAL ),
2013-10-24 13:38:12 +00:00
'email' => array ( 'default' => null ),
2013-10-30 12:54:46 +00:00
'send_password_by_mail' => array ( 'default' => false , 'type' => WS_TYPE_BOOL ),
2014-03-17 22:20:28 +00:00
'pwg_token' => array (),
2013-10-24 13:38:12 +00:00
),
2013-11-08 12:16:14 +00:00
'Registers a new user.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.users.php' ,
2013-10-24 13:38:12 +00:00
array ( 'admin_only' => true , 'post_only' => true )
);
$service -> addMethod (
'pwg.users.delete' ,
'ws_users_delete' ,
array (
'user_id' => array ( 'flags' => WS_PARAM_FORCE_ARRAY ,
'type' => WS_TYPE_ID ),
2013-11-01 11:03:10 +00:00
'pwg_token' => array (),
2013-10-24 13:38:12 +00:00
),
2013-11-08 12:16:14 +00:00
'Deletes on or more users. Photos owned by this user are not deleted.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.users.php' ,
2013-10-24 13:38:12 +00:00
array ( 'admin_only' => true , 'post_only' => true )
);
2017-07-20 19:06:26 +02:00
$service -> addMethod (
'pwg.users.getAuthKey' ,
'ws_users_getAuthKey' ,
array (
'user_id' => array ( 'type' => WS_TYPE_ID ),
'pwg_token' => array (),
),
'Get a new authentication key for a user. Only works for normal/generic users (not admins)' ,
$ws_functions_root . 'pwg.users.php' ,
array ( 'admin_only' => true , 'post_only' => true )
);
2013-10-24 13:38:12 +00:00
$service -> addMethod (
'pwg.users.setInfo' ,
'ws_users_setInfo' ,
array (
2013-10-28 17:20:34 +00:00
'user_id' => array ( 'flags' => WS_PARAM_FORCE_ARRAY ,
'type' => WS_TYPE_ID ),
'username' => array ( 'flags' => WS_PARAM_OPTIONAL ),
'password' => array ( 'flags' => WS_PARAM_OPTIONAL ),
'email' => array ( 'flags' => WS_PARAM_OPTIONAL ),
'status' => array ( 'flags' => WS_PARAM_OPTIONAL ,
2013-10-28 17:53:36 +00:00
'info' => 'guest,generic,normal,admin,webmaster' ),
2013-10-28 17:20:34 +00:00
'level' => array ( 'flags' => WS_PARAM_OPTIONAL ,
'maxValue' => max ( $conf [ 'available_permission_levels' ]),
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'language' => array ( 'flags' => WS_PARAM_OPTIONAL ),
'theme' => array ( 'flags' => WS_PARAM_OPTIONAL ),
2013-11-13 12:58:21 +00:00
'group_id' => array ( 'flags' => WS_PARAM_OPTIONAL | WS_PARAM_FORCE_ARRAY , 'type' => WS_TYPE_INT ),
2013-10-28 17:20:34 +00:00
// bellow are parameters removed in a future version
'nb_image_page' => array ( 'flags' => WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE | WS_TYPE_NOTNULL ),
'recent_period' => array ( 'flags' => WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'expand' => array ( 'flags' => WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_BOOL ),
'show_nb_comments' => array ( 'flags' => WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_BOOL ),
'show_nb_hits' => array ( 'flags' => WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_BOOL ),
'enabled_high' => array ( 'flags' => WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_BOOL ),
2014-03-17 22:20:28 +00:00
'pwg_token' => array (),
2013-10-28 17:20:34 +00:00
),
2013-11-08 12:16:14 +00:00
' Updates a user . Leave a field blank to keep the current value .
2013-11-13 12:58:21 +00:00
< br > " username " , " password " and " email " are ignored if " user_id " is an array .
< br > set " group_id " to - 1 if you want to dissociate users from all groups ' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.users.php' ,
2013-10-24 13:38:12 +00:00
array ( 'admin_only' => true , 'post_only' => true )
);
2025-05-05 20:24:05 +02:00
$service -> addMethod (
'pwg.users.setMyInfo' ,
'ws_users_setMyInfo' ,
array (
'email' => array ( 'flags' => WS_PARAM_OPTIONAL ),
'nb_image_page' => array ( 'flags' => WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE | WS_TYPE_NOTNULL ),
'theme' => array ( 'flags' => WS_PARAM_OPTIONAL ),
'language' => array ( 'flags' => WS_PARAM_OPTIONAL ),
'recent_period' => array ( 'flags' => WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ),
'expand' => array ( 'flags' => WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_BOOL ),
'show_nb_comments' => array ( 'flags' => WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_BOOL ),
'show_nb_hits' => array ( 'flags' => WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_BOOL ),
'password' => array ( 'flags' => WS_PARAM_OPTIONAL ),
'new_password' => array ( 'flags' => WS_PARAM_OPTIONAL ),
'conf_new_password' => array ( 'flags' => WS_PARAM_OPTIONAL ),
'pwg_token' => array (),
),
'' ,
$ws_functions_root . 'pwg.users.php' ,
array ( 'admin_only' => false , 'post_only' => true )
);
2013-10-30 20:29:48 +00:00
$service -> addMethod (
'pwg.permissions.getList' ,
'ws_permissions_getList' ,
array (
'cat_id' => array ( 'flags' => WS_PARAM_FORCE_ARRAY | WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_ID ),
'group_id' => array ( 'flags' => WS_PARAM_FORCE_ARRAY | WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_ID ),
'user_id' => array ( 'flags' => WS_PARAM_FORCE_ARRAY | WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_ID ),
),
2013-11-08 12:16:14 +00:00
' Returns permissions : user ids and group ids having access to each album ; this list can be filtered .
2013-10-30 20:32:20 +00:00
< br > Provide only one parameter ! ' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.permissions.php' ,
2013-10-30 20:29:48 +00:00
array ( 'admin_only' => true )
);
$service -> addMethod (
'pwg.permissions.add' ,
'ws_permissions_add' ,
array (
'cat_id' => array ( 'flags' => WS_PARAM_FORCE_ARRAY ,
'type' => WS_TYPE_ID ),
'group_id' => array ( 'flags' => WS_PARAM_FORCE_ARRAY | WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_ID ),
'user_id' => array ( 'flags' => WS_PARAM_FORCE_ARRAY | WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_ID ),
'recursive' => array ( 'default' => false ,
'type' => WS_TYPE_BOOL ),
2014-03-17 22:20:28 +00:00
'pwg_token' => array (),
2013-10-30 20:29:48 +00:00
),
2013-11-08 12:16:14 +00:00
'Adds permissions to an album.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.permissions.php' ,
2013-11-07 21:02:52 +00:00
array ( 'admin_only' => true , 'post_only' => true )
2013-10-30 20:29:48 +00:00
);
$service -> addMethod (
'pwg.permissions.remove' ,
'ws_permissions_remove' ,
array (
'cat_id' => array ( 'flags' => WS_PARAM_FORCE_ARRAY ,
'type' => WS_TYPE_ID ),
'group_id' => array ( 'flags' => WS_PARAM_FORCE_ARRAY | WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_ID ),
'user_id' => array ( 'flags' => WS_PARAM_FORCE_ARRAY | WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_ID ),
2014-03-17 22:20:28 +00:00
'pwg_token' => array (),
2013-10-30 20:29:48 +00:00
),
2013-11-08 12:16:14 +00:00
'Removes permissions from an album.' ,
2013-11-01 11:03:10 +00:00
$ws_functions_root . 'pwg.permissions.php' ,
2013-10-30 20:29:48 +00:00
array ( 'admin_only' => true , 'post_only' => true )
);
2019-07-15 10:04:52 -04:00
2022-03-31 18:16:23 +02:00
$service -> addMethod (
'pwg.users.preferences.set' ,
'ws_users_preferences_set' ,
array (
'param' => array (),
'value' => array ( 'flags' => WS_PARAM_OPTIONAL ),
'is_json' => array ( 'default' => false , 'type' => WS_TYPE_BOOL ),
),
'Set a user preferences parameter. JSON encode the value (and set is_json to true) if you need a complex data structure.' ,
$ws_functions_root . 'pwg.users.php'
);
2019-07-15 10:58:23 -04:00
$service -> addMethod (
2019-07-17 15:48:06 +02:00
'pwg.users.favorites.add' ,
'ws_users_favorites_add' ,
2019-07-15 10:58:23 -04:00
array (
'image_id' => array ( 'type' => WS_TYPE_ID )
2019-07-17 15:48:06 +02:00
),
2019-07-15 10:58:23 -04:00
'Adds the indicated image to the current user\'s favorite images.' ,
$ws_functions_root . 'pwg.users.php'
);
$service -> addMethod (
2019-07-17 15:48:06 +02:00
'pwg.users.favorites.remove' ,
'ws_users_favorites_remove' ,
2019-07-15 10:58:23 -04:00
array (
'image_id' => array ( 'type' => WS_TYPE_ID )
2019-07-17 15:48:06 +02:00
),
2019-07-15 10:58:23 -04:00
'Removes the indicated image from the current user\'s favorite images.' ,
$ws_functions_root . 'pwg.users.php'
);
2019-07-15 10:04:52 -04:00
$service -> addMethod (
2019-07-17 15:48:06 +02:00
'pwg.users.favorites.getList' ,
'ws_users_favorites_getList' ,
2019-07-15 10:04:52 -04:00
array (
'per_page' => array (
2019-07-17 15:48:06 +02:00
'default' => 100 ,
'maxValue' => $conf [ 'ws_max_images_per_page' ],
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE
),
2019-07-15 10:04:52 -04:00
'page' => array (
2019-07-17 15:48:06 +02:00
'default' => 0 ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE
),
2019-07-15 10:04:52 -04:00
'order' => array (
2019-07-17 15:48:06 +02:00
'default' => null ,
'info' => 'id, file, name, hit, rating_score, date_creation, date_available, random'
)
),
'Returns the favorite images of the current user.' ,
2019-07-15 10:04:52 -04:00
$ws_functions_root . 'pwg.users.php'
);
2021-08-20 15:11:48 +02:00
2022-08-26 16:58:11 +02:00
$service -> addMethod (
'pwg.history.log' ,
'ws_history_log' ,
array (
'image_id' => array ( 'type' => WS_TYPE_ID ),
'cat_id' => array ( 'type' => WS_TYPE_ID , 'default' => null ),
'section' => array ( 'default' => null ),
'tags_string' => array ( 'default' => null ),
2023-08-03 10:52:20 +02:00
'is_download' => array ( 'default' => false , 'type' => WS_TYPE_BOOL ),
2022-08-26 16:58:11 +02:00
),
'Log visit in history' ,
$ws_functions_root . 'pwg.php'
);
2021-08-20 15:11:48 +02:00
$service -> addMethod (
'pwg.history.search' ,
'ws_history_search' ,
2022-10-04 16:57:38 +02:00
array (
'start' => array (
'default' => null
),
'end' => array (
'default' => null
),
'types' => array (
'flags' => WS_PARAM_FORCE_ARRAY ,
'default' => array (
'none' ,
'picture' ,
'high' ,
'other' ,
)
),
'user_id' => array (
'default' => - 1 ,
),
'image_id' => array (
'default' => null ,
'type' => WS_TYPE_ID ,
),
'filename' => array (
'default' => null
),
'ip' => array (
'default' => null
),
'display_thumbnail' => array (
'default' => 'display_thumbnail_classic'
),
'pageNumber' => array (
'default' => null ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ,
),
),
' Gives an history of who has visited the galery and the actions done in it . Receives parameter .
< br > < strong > Types </ strong > can be : \ ' none\ ' , \ ' picture\ ' , \ ' high\ ' , \ ' other\ '
< br > < strong > Date format </ strong > is yyyy - mm - dd
< br > < strong > display_thumbnail </ strong > can be : \ 'no_display_thumbnail\', \'display_thumbnail_classic\', \'display_thumbnail_hoverbox\'' ,
2021-08-20 15:11:48 +02:00
$ws_functions_root . 'pwg.php'
);
2023-06-21 16:11:08 +02:00
$service -> addMethod (
2023-09-27 16:30:05 +02:00
'pwg.images.filteredSearch.create' ,
'ws_images_filteredSearch_create' ,
2023-06-21 16:11:08 +02:00
array (
2023-09-27 16:30:05 +02:00
'search_id' => array (
'flags' => WS_PARAM_OPTIONAL ,
'info' => 'prior search_id (or search_key), if any' ,
),
2023-06-21 16:11:08 +02:00
'allwords' => array (
'flags' => WS_PARAM_OPTIONAL ,
'info' => 'query to search by words' ,
),
'allwords_mode' => array (
'flags' => WS_PARAM_OPTIONAL ,
'info' => 'AND (by default) | OR' ,
),
'allwords_fields' => array (
'flags' => WS_PARAM_OPTIONAL | WS_PARAM_FORCE_ARRAY ,
2023-10-18 18:19:30 +02:00
'info' => 'values among [name, comment, tags, file, author, cat-title, cat-desc]' ,
2023-06-21 16:11:08 +02:00
),
'tags' => array (
'flags' => WS_PARAM_OPTIONAL | WS_PARAM_FORCE_ARRAY ,
'type' => WS_TYPE_ID ,
),
'tags_mode' => array (
'flags' => WS_PARAM_OPTIONAL ,
'info' => 'AND (by default) | OR' ,
),
'categories' => array (
'flags' => WS_PARAM_OPTIONAL | WS_PARAM_FORCE_ARRAY ,
'type' => WS_TYPE_ID ,
),
'categories_withsubs' => array (
'flags' => WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_BOOL ,
'info' => 'false, by default' ,
),
'authors' => array (
'flags' => WS_PARAM_OPTIONAL | WS_PARAM_FORCE_ARRAY ,
),
'added_by' => array (
'flags' => WS_PARAM_OPTIONAL | WS_PARAM_FORCE_ARRAY ,
'type' => WS_TYPE_ID ,
),
2023-07-10 15:17:46 +02:00
'filetypes' => array (
'flags' => WS_PARAM_OPTIONAL | WS_PARAM_FORCE_ARRAY ,
),
2024-09-04 11:30:44 +02:00
'date_posted_preset' => array (
2023-07-24 16:49:53 +02:00
'flags' => WS_PARAM_OPTIONAL ,
2024-09-04 11:30:44 +02:00
'info' => 'files posted within 24 hours, 7 days, 30 days, 3 months, 6 months or custom. Value among 24h|7d|30d|3m|6m|custom.' ,
),
'date_posted_custom' => array (
'flags' => WS_PARAM_OPTIONAL | WS_PARAM_FORCE_ARRAY ,
'info' => 'Must be provided if date_posted_preset is custom. List of yYYYY or mYYYY-MM or dYYYY-MM-DD.' ,
2023-07-24 16:49:53 +02:00
),
2024-09-17 16:50:38 +02:00
'date_created_preset' => array (
'flags' => WS_PARAM_OPTIONAL ,
2024-09-20 14:21:28 +02:00
'info' => 'files created within 7 days, 30 days, 3 months, 6 months, 12 months or custom. Value among 7d|30d|3m|6m|12m|custom.' ,
2024-09-17 16:50:38 +02:00
),
'date_created_custom' => array (
'flags' => WS_PARAM_OPTIONAL | WS_PARAM_FORCE_ARRAY ,
'info' => 'Must be provided if date_created_preset is custom. List of yYYYY or mYYYY-MM or dYYYY-MM-DD.' ,
),
2024-07-25 16:11:07 +02:00
'ratios' => array (
'flags' => WS_PARAM_OPTIONAL | WS_PARAM_FORCE_ARRAY ,
),
'ratings' => array (
'flags' => WS_PARAM_OPTIONAL | WS_PARAM_FORCE_ARRAY ,
),
'filesize_min' => array (
'flags' => WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ,
),
'filesize_max' => array (
'flags' => WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ,
),
'height_min' => array (
'flags' => WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ,
),
'height_max' => array (
'flags' => WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ,
),
'width_min' => array (
'flags' => WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ,
),
'width_max' => array (
'flags' => WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ,
),
2023-06-21 16:11:08 +02:00
),
'' ,
$ws_functions_root . 'pwg.images.php'
);
2024-05-31 18:03:53 +02:00
$service -> addMethod (
2024-11-20 17:09:26 +01:00
'pwg.users.generatePasswordLink' ,
'ws_users_generate_password_link' ,
2024-05-31 18:03:53 +02:00
array (
'user_id' => array (
'type' => WS_TYPE_ID
),
'pwg_token' => array (),
'send_by_mail' => array (
'flags' => WS_PARAM_OPTIONAL ,
'type' => WS_TYPE_BOOL ,
'default' => false ,
),
),
' Return the reset password link < br />
( Only webmaster can perform this action for another webmaster ) ' ,
$ws_functions_root . 'pwg.users.php' ,
2024-11-20 17:09:26 +01:00
array ( 'admin_only' => true , 'post_only' => true )
2024-05-31 18:03:53 +02:00
);
$service -> addMethod (
'pwg.users.setMainUser' ,
'ws_set_main_user' ,
array (
'user_id' => array (
'type' => WS_TYPE_ID
),
'pwg_token' => array (),
),
' Update the main user ( owner ) < br />
- To be the main user , the user must have the status " webmaster " .< br />
- Only a webmaster can perform this action ' ,
$ws_functions_root . 'pwg.users.php' ,
array ( 'admin_only' => true , 'post_only' => true )
);
2025-06-09 20:35:57 +02:00
$service -> addMethod (
'pwg.users.api_key.create' ,
'ws_create_api_key' ,
array (
'key_name' => array (),
'duration' => array (
'type' => WS_TYPE_INT | WS_TYPE_POSITIVE ,
'info' => 'Number of days' ,
),
'pwg_token' => array (),
),
'Create a new api key for the user in the current session' ,
$ws_functions_root . 'pwg.users.php' ,
array ( 'admin_only' => false , 'post_only' => true )
);
$service -> addMethod (
'pwg.users.api_key.revoke' ,
'ws_revoke_api_key' ,
array (
'pkid' => array (),
'pwg_token' => array (),
),
'Revoke a api key for the user in the current session' ,
$ws_functions_root . 'pwg.users.php' ,
array ( 'admin_only' => false , 'post_only' => true )
);
$service -> addMethod (
'pwg.users.api_key.edit' ,
'ws_edit_api_key' ,
array (
'key_name' => array (),
'pkid' => array (),
'pwg_token' => array (),
),
'Edit a api key for the user in the current session' ,
$ws_functions_root . 'pwg.users.php' ,
array ( 'admin_only' => false , 'post_only' => true )
);
$service -> addMethod (
'pwg.users.api_key.get' ,
'ws_get_api_key' ,
array (
'pwg_token' => array (),
),
'Get all api key for the user in the current session' ,
$ws_functions_root . 'pwg.users.php' ,
array ( 'admin_only' => false , 'post_only' => true )
);
2007-01-06 11:13:08 +00:00
}
2016-12-26 23:24:29 +01:00
?>