Changeset 20815


Ignore:
Timestamp:
Feb 18, 2013, 8:41:40 PM (7 years ago)
Author:
mistic100
Message:

completely rewrite the indentation of ws.php, no technical changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ws.php

    r20814 r20815  
    3333}
    3434
    35 /**
    36  * event handler that registers standard methods with the web service
    37  */
    38 function ws_addDefaultMethods( $arr )
    39 {
    40   include_once(PHPWG_ROOT_PATH.'include/ws_functions.inc.php');
    41   global $conf, $user;
    42   $service = &$arr[0];
    43   $service->addMethod('pwg.getVersion', 'ws_getVersion', null,
    44       'retrieves the PWG version');
    45          
    46   $service->addMethod('pwg.getInfos', 'ws_getInfos', null,
    47       'retrieves general informations');
    48 
    49   $service->addMethod('pwg.caddie.add', 'ws_caddie_add',
    50       array(
    51         'image_id'=> array( 'flags'=>WS_PARAM_FORCE_ARRAY ),
    52       ),
    53       'adds the elements to the caddie');
    54 
    55   $service->addMethod('pwg.categories.getImages', 'ws_categories_getImages',
    56       array(
    57         'cat_id'=>array('default'=>0, 'flags'=>WS_PARAM_FORCE_ARRAY),
    58         'recursive'=>array('default'=>false),
    59         'per_page' => array('default'=>100, 'maxValue'=>$conf['ws_max_images_per_page']),
    60         'page' => array('default'=>0),
    61         'order' => array('default'=>null),
    62         'f_min_rate' => array( 'default'=> null ),
    63         'f_max_rate' => array( 'default'=> null ),
    64         'f_min_hit' => array( 'default'=> null ),
    65         'f_max_hit' => array( 'default'=> null ),
    66         'f_min_date_available' => array( 'default'=> null ),
    67         'f_max_date_available' => array( 'default'=> null ),
    68         'f_min_date_created' => array( 'default'=> null ),
    69         'f_max_date_created' => array( 'default'=> null ),
    70         'f_min_ratio' => array( 'default'=> null ),
    71         'f_max_ratio' => array( 'default'=> null ),
    72         'f_max_level' => array( 'default'=> null ),
    73       ),
    74       'Returns elements for the corresponding categories.
    75 <br><b>cat_id</b> can be empty if <b>recursive</b> is true. Can be sent as an array.
    76 <br><b>order</b> comma separated fields for sorting (file,id, rating_score,...)'
    77     );
    78 
    79   $service->addMethod('pwg.categories.getList', 'ws_categories_getList',
    80       array(
    81         'cat_id' => array('default'=>0),
    82         'recursive' => array('default'=>false),
    83         'public' => array('default'=>false),
    84         'tree_output' => array('default'=>false),
    85         'fullname' => array('default'=>false),
    86       ),
    87       'retrieves a list of categories (tree_output option only compatible with json/php output format' );
    88 
    89   $service->addMethod('pwg.getMissingDerivatives', 'ws_getMissingDerivatives',
    90       array(
    91         'types' => array( 'default'=>array(), 'flags'=>WS_PARAM_FORCE_ARRAY),
    92         'ids' => array( 'default'=>array(), 'flags'=>WS_PARAM_FORCE_ARRAY),
    93         'max_urls' => array( 'default' => 200 ),
    94         'prev_page' => array( 'default'=> null),
    95         'f_min_rate' => array( 'default'=> null ),
    96         'f_max_rate' => array( 'default'=> null ),
    97         'f_min_hit' => array( 'default'=> null ),
    98         'f_max_hit' => array( 'default'=> null ),
    99         'f_min_date_available' => array( 'default'=> null ),
    100         'f_max_date_available' => array( 'default'=> null ),
    101         'f_min_date_created' => array( 'default'=> null ),
    102         'f_max_date_created' => array( 'default'=> null ),
    103         'f_min_ratio' => array( 'default'=> null ),
    104         'f_max_ratio' => array( 'default'=> null ),
    105         'f_max_level' => array( 'default'=> null ),
    106       ),
    107       'retrieves a list of derivatives to build' );
    108 
    109   $service->addMethod('pwg.images.addComment', 'ws_images_addComment',
    110       array(
    111         'image_id' => array(),
    112         'author' => array( 'default' => is_a_guest()? 'guest':$user['username']),
    113         'content' => array(),
    114         'key' => array(),
    115       ),
    116       'add a comment to an image' );
    117 
    118   $service->addMethod('pwg.images.getInfo', 'ws_images_getInfo',
    119       array(
    120         'image_id' => array(),
    121         'comments_page' => array('default'=>0 ),
    122         'comments_per_page' => array(
    123               'default' => $conf['nb_comment_page'],
    124               'maxValue' => 2*$conf['nb_comment_page'],
    125             ),
    126       ),
    127       'retrieves information about the given photo' );
    128 
    129   $service->addMethod('pwg.images.rate', 'ws_images_rate',
    130       array(
    131         'image_id' => array(),
    132         'rate' =>     array(),
    133       ),
    134       'rate the image' );
    135 
    136   $service->addMethod('pwg.images.search', 'ws_images_search',
    137       array(
    138         'query'=>array(),
    139         'per_page' => array('default'=>100, 'maxValue'=>$conf['ws_max_images_per_page']),
    140         'page' => array('default'=>0),
    141         'order' => array('default'=>null),
    142         'f_min_rate' => array( 'default'=> null ),
    143         'f_max_rate' => array( 'default'=> null ),
    144         'f_min_hit' => array( 'default'=> null ),
    145         'f_max_hit' => array( 'default'=> null ),
    146         'f_min_date_available' => array( 'default'=> null ),
    147         'f_max_date_available' => array( 'default'=> null ),
    148         'f_min_date_created' => array( 'default'=> null ),
    149         'f_max_date_created' => array( 'default'=> null ),
    150         'f_min_ratio' => array( 'default'=> null ),
    151         'f_max_ratio' => array( 'default'=> null ),
    152         'f_max_level' => array( 'default'=> null ),
    153       ),
    154       'Returns elements for the corresponding query search.'
    155     );
    156 
    157   $service->addMethod(
    158     'pwg.images.setPrivacyLevel',
    159     'ws_images_setPrivacyLevel',
    160     array(
    161       'image_id' => array('flags'=>WS_PARAM_FORCE_ARRAY),
    162       'level' => array('maxValue'=>$conf['available_permission_levels']),
    163       ),
    164     'sets the privacy levels for the images (POST method only)'
    165     );
    166 
    167   $service->addMethod(
    168     'pwg.images.setRank',
    169     'ws_images_setRank',
    170     array(
    171       'image_id' => array(),
    172       'category_id' => array(),
    173       'rank' => array(),
    174       ),
    175     'sets the rank of a photo for a given album (POST method only, for admins)'
    176     );
    177 
    178 
    179   $service->addMethod('pwg.rates.delete', 'ws_rates_delete',
    180     array(
    181       'user_id' => array(),
    182       'anonymous_id' => array( 'default'=>'' ),
    183       ),
    184     'deletes all rates for a user (POST method only, admins only)'
    185     );
    186    
    187   $service->addMethod('pwg.session.getStatus', 'ws_session_getStatus', null, '' );
    188   $service->addMethod('pwg.session.login', 'ws_session_login',
    189     array('username', 'password'),
    190     'POST method only' );
    191   $service->addMethod('pwg.session.logout', 'ws_session_logout', null, '');
    192 
    193   $service->addMethod('pwg.tags.getList', 'ws_tags_getList',
    194     array('sort_by_counter' => array('default' =>false) ),
    195     'retrieves a list of available tags');
    196   $service->addMethod('pwg.tags.getImages', 'ws_tags_getImages',
    197       array(
    198         'tag_id'=>array('default'=>null, 'flags'=>WS_PARAM_FORCE_ARRAY ),
    199         'tag_url_name'=>array('default'=>null, 'flags'=>WS_PARAM_FORCE_ARRAY ),
    200         'tag_name'=>array('default'=>null, 'flags'=>WS_PARAM_FORCE_ARRAY ),
    201         'tag_mode_and'=>array('default'=>false),
    202         'per_page' => array('default'=>100, 'maxValue'=>$conf['ws_max_images_per_page']),
    203         'page' => array('default'=>0),
    204         'order' => array('default'=>null),
    205         'f_min_rate' => array( 'default'=> null ),
    206         'f_max_rate' => array( 'default'=> null ),
    207         'f_min_hit' => array( 'default'=> null ),
    208         'f_max_hit' => array( 'default'=> null ),
    209         'f_min_date_available' => array( 'default'=> null ),
    210         'f_max_date_available' => array( 'default'=> null ),
    211         'f_min_date_created' => array( 'default'=> null ),
    212         'f_max_date_created' => array( 'default'=> null ),
    213         'f_min_ratio' => array( 'default'=> null ),
    214         'f_max_ratio' => array( 'default'=> null ),
    215         'f_max_level' => array( 'default'=> null ),
    216       ),
    217       'Returns elements for the corresponding tags. Note that tag_id, tag_url_name, tag_name an be arrays. Fill at least one of them. '
    218     );
    219 
    220   $service->addMethod(
    221     'pwg.images.addChunk',
    222     'ws_images_add_chunk',
    223     array(
    224       'data' => array(),
    225       'original_sum' => array(),
    226       'type' => array(),
    227       'position' => array(),
    228       ),
    229     'POST method only. For admin only.'
    230     );
    231 
    232   $service->addMethod(
    233     'pwg.images.addFile',
    234     'ws_images_addFile',
    235     array(
    236       'image_id' => array(),
    237       'type' => array(),
    238       'sum' => array(),
    239       ),
    240     'Add or update a file for an existing photo. pwg.images.addChunk must have been called  before (maybe several times)'
    241     );
    242 
    243 
    244   $service->addMethod(
    245     'pwg.images.add',
    246     'ws_images_add',
    247     array(
    248       'file_sum' => array(),
    249       'thumbnail_sum' => array('default' => null),
    250       'high_sum' => array('default' => null),
    251       'original_sum' => array(),
    252       'original_filename' => array('default' => null),
    253       'name' => array('default' => null),
    254       'author' => array('default' => null),
    255       'date_creation' => array('default' => null),
    256       'comment' => array('default' => null),
    257       'categories' => array('default' => null),
    258       'tag_ids' => array('default' => null),
    259       'level' => array(
    260         'default' => 0,
    261         'maxValue' => $conf['available_permission_levels']
    262         ),
    263       'check_uniqueness' => array('default' => true),
    264       'image_id' => array('default' => null),
    265       ),
    266     'POST method only.
    267 <br><b>categories</b> is a string list "category_id[,rank];category_id[,rank]" The rank is optional and is equivalent to "auto" if not given.'
    268     );
    269 
    270   $service->addMethod(
    271     'pwg.images.addSimple',
    272     'ws_images_addSimple',
    273     array(
    274       'category' => array('default' => null),
    275       'name' => array('default' => null),
    276       'author' => array('default' => null),
    277       'comment' => array('default' => null),
    278       'level' => array(
    279         'default' => 0,
    280         'maxValue' => $conf['available_permission_levels']
    281         ),
    282       'tags' => array('default' => null, 'flags' => WS_PARAM_ACCEPT_ARRAY),
    283       'image_id' => array('default' => null),
    284       ),
    285     'POST method only.<br>Use the <b>image</b> field for uploading file.<br>Set the form encoding to "form-data"<br><b>category</b> is the numeric identifier of the destination category.<br>You can update an existing photo if you define an existing image_id.'
    286     );
    287 
    288   $service->addMethod(
    289     'pwg.images.delete',
    290     'ws_images_delete',
    291     array(
    292       'image_id'=>array('default'=>0),
    293       'pwg_token' => array(),
    294       ),
    295     'Delete photos. You can give several image_ids, comma separated'
    296     );
    297 
    298   $service->addMethod(
    299     'pwg.categories.getAdminList',
    300     'ws_categories_getAdminList',
    301     array(),
    302     'administration method only'
    303     );
    304 
    305   $service->addMethod(
    306     'pwg.categories.add',
    307     'ws_categories_add',
    308     array(
    309       'name' => array(),
    310       'parent' => array('default' => null),
    311       'comment' => array('default' => null),
    312       'visible' => array('default' => null),
    313       'status' => array('default' => null),
    314       'commentable' => array('default' => 'true'),
    315       ),
    316     'administration method only'
    317     );
    318 
    319   $service->addMethod(
    320     'pwg.categories.delete',
    321     'ws_categories_delete',
    322     array(
    323       'category_id'=>array('default'=>0),
    324       'pwg_token' => array(),
    325       'photo_deletion_mode' => array('default' => 'delete_orphans'),
    326       ),
    327     'Delete categories. You can give several category_ids, comma separated.
    328 <br><b>photo_deletion_mode</b> 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)'
    329     );
    330 
    331   $service->addMethod(
    332     'pwg.categories.move',
    333     'ws_categories_move',
    334     array(
    335       'category_id'=>array('default'=>0),
    336       'parent'=>array('default'=>0),
    337       'pwg_token' => array(),
    338       ),
    339     'Move categories. You can give several category_ids, comma separated. Set parent as 0 to move to gallery root. Only virtual categories can be moved.'
    340     );
    341 
    342   $service->addMethod(
    343     'pwg.categories.setRepresentative',
    344     'ws_categories_setRepresentative',
    345     array(
    346       'category_id'=>array('default'=>0),
    347       'image_id'=>array('default'=>0),
    348       ),
    349     'Set the representative photo for an album. The photo doesn\'t have to belong to the album. POST method only. Administration method only.'
    350     );
    351 
    352   $service->addMethod(
    353     'pwg.tags.getAdminList',
    354     'ws_tags_getAdminList',
    355     array(),
    356     'administration method only'
    357     );
    358 
    359   $service->addMethod(
    360     'pwg.tags.add',
    361     'ws_tags_add',
    362     array(
    363       'name' => array(),
    364       ),
    365     'administration method only'
    366     );
    367 
    368   $service->addMethod(
    369     'pwg.images.exist',
    370     'ws_images_exist',
    371     array(
    372       'md5sum_list'=> array('default' => null),
    373       'filename_list' => array('default' => null),
    374       ),
    375     'check existence of a photo list'
    376     );
    377 
    378   $service->addMethod(
    379     'pwg.images.checkFiles',
    380     'ws_images_checkFiles',
    381     array(
    382       'image_id' => array(),
    383       'thumbnail_sum' => array('default' => null),
    384       'file_sum' => array('default' => null),
    385       'high_sum' => array('default' => null),
    386       ),
    387     'check if you have updated version of your files for a given photo, for each requested file type, the answer can be "missing", "equals" or "differs"'
    388     );
    389 
    390   $service->addMethod(
    391     'pwg.images.checkUpload',
    392     'ws_images_checkUpload',
    393     null,
    394     'check if Piwigo is ready for upload'
    395     );
    396 
    397   $service->addMethod(
    398     'pwg.images.setInfo',
    399     'ws_images_setInfo',
    400     array(
    401       'image_id' => array(),
    402 
    403       'file' => array('default' => null),
    404       'name' => array('default' => null),
    405       'author' => array('default' => null),
    406       'date_creation' => array('default' => null),
    407       'comment' => array('default' => null),
    408       'categories' => array('default' => null),
    409       'tag_ids' => array('default' => null),
    410       'level' => array(
    411         'default' => null,
    412         'maxValue' => $conf['available_permission_levels']
    413         ),
    414       'single_value_mode' => array('default' => 'fill_if_empty'),
    415       'multiple_value_mode' => array('default' => 'append'),
    416       ),
    417     'POST method only. Admin only
    418 <br><b>categories</b> is a string list "category_id[,rank];category_id[,rank]" The rank is optional and is equivalent to "auto" if not given.
    419 <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" (overwrite any existing value) and applies to single values properties like name/author/date_creation/comment
    420 <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'
    421     );
    422 
    423   $service->addMethod(
    424     'pwg.categories.setInfo',
    425     'ws_categories_setInfo',
    426     array(
    427       'category_id' => array(),
    428 
    429       'name' => array('default' => null),
    430       'comment' => array('default' => null),
    431       ),
    432     'POST method only.'
    433     );
    434  
    435   $service->addMethod(
    436     'pwg.plugins.getList',
    437     'ws_plugins_getList',
    438     array(),
    439     'get the list of plugin with id, name, version, state and description
    440 <br>administration status required'
    441     );
    442 
    443   $service->addMethod(
    444     'pwg.plugins.performAction',
    445     'ws_plugins_performAction',
    446     array(
    447       'action' => array(),
    448       'plugin' => array(),
    449       'pwg_token' => array(),
    450       ),
    451     'install/activate/deactivate/uninstall/delete a plugin
    452 <br>administration status required'
    453     );
    454 
    455   $service->addMethod(
    456     'pwg.themes.performAction',
    457     'ws_themes_performAction',
    458     array(
    459       'action' => array(),
    460       'theme' => array(),
    461       'pwg_token' => array(),
    462       ),
    463     'activate/deactivate/delete/set_default a theme<br>administration status required'
    464     );
    465 
    466   $service->addMethod(
    467     'pwg.extensions.update',
    468     'ws_extensions_update',
    469     array(
    470       'type' => array(),
    471       'id' => array(),
    472       'revision'=> array(),
    473       'pwg_token' => array(),
    474     ),
    475     'Update an extension. Webmaster only.
    476 <br>Parameter type must be "plugins", "languages" or "themes".'
    477   );
    478 
    479   $service->addMethod(
    480     'pwg.extensions.ignoreUpdate',
    481     'ws_extensions_ignoreupdate',
    482     array(
    483       'type' => array('default'=>null),
    484       'id' => array('default'=>null),
    485       'reset' => array('default'=>null),
    486       'pwg_token' => array(),
    487     ),
    488     'Ignore an extension if it need update.
    489 <br>Parameter type must be "plugins", "languages" or "themes".
    490 <br>If reset parameter is true, all ignored extensions will be reinitilized.'
    491   );
    492 
    493   $service->addMethod(
    494     'pwg.extensions.checkUpdates',
    495     'ws_extensions_checkupdates',
    496     array(),
    497     'Check if piwigo or extensions are up to date.'
    498   );
    499 }
    500 
    50135add_event_handler('ws_add_methods', 'ws_addDefaultMethods');
    502 
    50336
    50437add_event_handler('ws_invoke_allowed', 'ws_isInvokeAllowed', EVENT_HANDLER_PRIORITY_NEUTRAL, 3);
     
    56093$service->run();
    56194
     95
     96/**
     97 * event handler that registers standard methods with the web service
     98 */
     99function 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 
     106  $service->addMethod('pwg.getVersion', 'ws_getVersion',
     107      null,
     108      'retrieves the PWG version'
     109    );
     110         
     111  $service->addMethod('pwg.getInfos', 'ws_getInfos',
     112      null,
     113      'retrieves general informations'
     114    );
     115
     116  $service->addMethod('pwg.caddie.add', 'ws_caddie_add',
     117      array(
     118        'image_id'=> array('flags'=>WS_PARAM_FORCE_ARRAY),
     119        ),
     120      'adds the elements to the caddie'
     121    );
     122
     123  $service->addMethod('pwg.categories.getImages', 'ws_categories_getImages',
     124      array(
     125        'cat_id' =>     array('default'=>0,
     126                              'flags'=>WS_PARAM_FORCE_ARRAY),
     127        'recursive' =>  array('default'=>false ),
     128        'per_page' =>   array('default'=>100,
     129                              'maxValue'=>$conf['ws_max_images_per_page']),
     130        'page' =>       array('default'=>0),
     131        'order' =>      array('default'=>null),
     132        'f_min_rate' => array('default'=>null),
     133        'f_max_rate' => array('default'=>null),
     134        'f_min_hit' =>  array('default'=>null),
     135        'f_max_hit' =>  array('default'=>null),
     136        'f_min_date_available' => array('default'=>null),
     137        'f_max_date_available' => array('default'=>null),
     138        'f_min_date_created' =>   array('default'=>null),
     139        'f_max_date_created' =>   array('default'=>null),
     140        'f_min_ratio' => array('default'=>null),
     141        'f_max_ratio' => array('default'=>null),
     142        'f_max_level' => array('default'=>null),
     143        ),
     144      'Returns elements for the corresponding categories.
     145<br><b>cat_id</b> can be empty if <b>recursive</b> is true. Can be sent as an array.
     146<br><b>order</b> comma separated fields for sorting (file,id, rating_score,...)'
     147    );
     148
     149  $service->addMethod('pwg.categories.getList', 'ws_categories_getList',
     150      array(
     151        'cat_id' =>       array('default'=>0),
     152        'recursive' =>    array('default'=>false),
     153        'public' =>       array('default'=>false),
     154        'tree_output' =>  array('default'=>false),
     155        'fullname' =>     array('default'=>false),
     156        ),
     157      'retrieves a list of categories (tree_output option only compatible with json/php output format'
     158    );
     159
     160  $service->addMethod('pwg.getMissingDerivatives', 'ws_getMissingDerivatives',
     161      array(
     162        'types' =>      array('default'=>array(),
     163                              'flags'=>WS_PARAM_FORCE_ARRAY),
     164        'ids' =>        array('default'=>array(),
     165                              'flags'=>WS_PARAM_FORCE_ARRAY),
     166        'max_urls' =>   array('default'=>200),
     167        'prev_page' =>  array('default'=>null),
     168        'f_min_rate' => array('default'=>null),
     169        'f_max_rate' => array('default'=>null),
     170        'f_min_hit' =>  array('default'=>null),
     171        'f_max_hit' =>  array('default'=>null),
     172        'f_min_date_available' => array('default'=>null),
     173        'f_max_date_available' => array('default'=>null),
     174        'f_min_date_created' =>   array('default'=>null),
     175        'f_max_date_created' =>   array('default'=>null),
     176        'f_min_ratio' => array('default'=>null),
     177        'f_max_ratio' => array('default'=>null),
     178        'f_max_level' => array('default'=>null),
     179        ),
     180      'retrieves a list of derivatives to build'
     181    );
     182
     183  $service->addMethod('pwg.images.addComment', 'ws_images_addComment',
     184      array(
     185        'image_id' => array(),
     186        'author' =>   array('default'=>is_a_guest()?'guest':$user['username']),
     187        'content' =>  array(),
     188        'key' =>      array(),
     189        ),
     190      'add a comment to an image'
     191    );
     192
     193  $service->addMethod('pwg.images.getInfo', 'ws_images_getInfo',
     194      array(
     195        'image_id' =>           array(),
     196        'comments_page' =>      array('default'=>0 ),
     197        'comments_per_page' =>  array('default' =>  $conf['nb_comment_page'],
     198                                      'maxValue' => 2*$conf['nb_comment_page']),
     199        ),
     200      'retrieves information about the given photo'
     201    );
     202
     203  $service->addMethod('pwg.images.rate', 'ws_images_rate',
     204      array('image_id', 'rate'),
     205      'rate the image'
     206    );
     207
     208  $service->addMethod('pwg.images.search', 'ws_images_search',
     209      array(
     210        'query' =>      array(),
     211        'per_page' =>   array('default'=>100,
     212                              'maxValue'=>$conf['ws_max_images_per_page']),
     213        'page' =>       array('default'=>0),
     214        'order' =>      array('default'=>null),
     215        'f_min_rate' => array('default'=>null),
     216        'f_max_rate' => array('default'=>null),
     217        'f_min_hit' =>  array('default'=>null),
     218        'f_max_hit' =>  array('default'=>null),
     219        'f_min_date_available' => array('default'=>null),
     220        'f_max_date_available' => array('default'=>null),
     221        'f_min_date_created' =>   array('default'=>null),
     222        'f_max_date_created' =>   array('default'=>null),
     223        'f_min_ratio' => array('default'=>null),
     224        'f_max_ratio' => array('default'=>null),
     225        'f_max_level' => array('default'=>null),
     226        ),
     227      'Returns elements for the corresponding query search.'
     228    );
     229
     230  $service->addMethod('pwg.images.setPrivacyLevel', 'ws_images_setPrivacyLevel',
     231      array(
     232        'image_id' => array('flags'=>WS_PARAM_FORCE_ARRAY),
     233        'level' =>    array('maxValue'=>$conf['available_permission_levels']),
     234        ),
     235      'sets the privacy levels for the images (POST method only)'
     236    );
     237
     238  $service->addMethod('pwg.images.setRank', 'ws_images_setRank',
     239      array('image_id', 'category_id', 'rank'),
     240      'sets the rank of a photo for a given album (POST method only, for admins)'
     241    );
     242
     243  $service->addMethod('pwg.rates.delete', 'ws_rates_delete',
     244      array(
     245        'user_id' =>      array(),
     246        'anonymous_id' => array('default'=>null),
     247        ),
     248      'deletes all rates for a user (POST method only, admins only)'
     249    );
     250
     251  $service->addMethod('pwg.session.getStatus', 'ws_session_getStatus', null, '');
     252
     253  $service->addMethod('pwg.session.login', 'ws_session_login',
     254      array('username', 'password'),
     255      'POST method only'
     256    );
     257
     258  $service->addMethod('pwg.session.logout', 'ws_session_logout', null, '');
     259
     260  $service->addMethod('pwg.tags.getList', 'ws_tags_getList',
     261      array(
     262        'sort_by_counter' => array('default' =>false),
     263        ),
     264      'retrieves a list of available tags'
     265    );
     266
     267  $service->addMethod('pwg.tags.getImages', 'ws_tags_getImages',
     268      array(
     269        'tag_id' =>       array('default'=>null,
     270                                'flags'=>WS_PARAM_FORCE_ARRAY),
     271        'tag_url_name' => array('default'=>null,
     272                                'flags'=>WS_PARAM_FORCE_ARRAY),
     273        'tag_name' =>     array('default'=>null,
     274                                'flags'=>WS_PARAM_FORCE_ARRAY),
     275        'tag_mode_and' => array('default'=>false),
     276        'per_page' =>     array('default'=>100,
     277                                'maxValue'=>$conf['ws_max_images_per_page']),
     278        'page' =>         array('default'=>0),
     279        'order' =>        array('default'=>null),
     280        'f_min_rate' =>   array('default'=>null),
     281        'f_max_rate' =>   array('default'=>null),
     282        'f_min_hit' =>    array('default'=>null),
     283        'f_max_hit' =>    array('default'=>null),
     284        'f_min_date_available' => array('default'=>null),
     285        'f_max_date_available' => array('default'=>null),
     286        'f_min_date_created' =>   array('default'=>null),
     287        'f_max_date_created' =>   array('default'=>null),
     288        'f_min_ratio' => array('default'=>null),
     289        'f_max_ratio' => array('default'=>null),
     290        'f_max_level' => array('default'=>null),
     291        ),
     292      'Returns elements for the corresponding tags. Note that tag_id, tag_url_name, tag_name an be arrays. Fill at least one of them. '
     293    );
     294
     295  $service->addMethod('pwg.images.addChunk', 'ws_images_add_chunk',
     296      array('data', 'original_sum', 'type', 'position'),
     297      'POST method only. For admin only.'
     298    );
     299
     300  $service->addMethod('pwg.images.addFile', 'ws_images_addFile',
     301      array('image_id', 'type', 'sum'),
     302      'Add or update a file for an existing photo. pwg.images.addChunk must have been called  before (maybe several times)'
     303    );
     304
     305
     306  $service->addMethod('pwg.images.add', 'ws_images_add',
     307      array(
     308        'file_sum' =>           array(),
     309        'thumbnail_sum' =>      array('default'=>null),
     310        'high_sum' =>           array('default'=>null),
     311        'original_sum' =>       array(),
     312        'original_filename' =>  array('default'=>null),
     313        'name' =>               array('default'=>null),
     314        'author' =>             array('default'=>null),
     315        'date_creation' =>      array('default'=>null),
     316        'comment' =>            array('default'=>null),
     317        'categories' =>         array('default'=>null),
     318        'tag_ids' =>            array('default'=>null),
     319        'level' =>              array('default'=>0,
     320                                      'maxValue'=>$conf['available_permission_levels']),
     321        'check_uniqueness' =>   array('default'=>true),
     322        'image_id' =>           array('default'=>null),
     323        ),
     324      'POST method only.
     325<br><b>categories</b> is a string list "category_id[,rank];category_id[,rank]"
     326The rank is optional and is equivalent to "auto" if not given.'
     327    );
     328
     329  $service->addMethod('pwg.images.addSimple', 'ws_images_addSimple',
     330      array(
     331        'category' => array('default'=>null),
     332        'name' =>     array('default'=>null),
     333        'author' =>   array('default'=>null),
     334        'comment' =>  array('default'=>null),
     335        'level' =>    array('default'=>0,
     336                            'maxValue'=>$conf['available_permission_levels']),
     337        'tags' =>     array('default'=>null,
     338                            'flags'=>WS_PARAM_ACCEPT_ARRAY),
     339        'image_id' => array('default'=>null),
     340        ),
     341      'POST method only.<br>Use the <b>image</b> field for uploading file.
     342<br>Set the form encoding to "form-data"<br><b>category</b> is the numeric identifier of the destination category.
     343<br>You can update an existing photo if you define an existing image_id.'
     344    );
     345
     346  $service->addMethod('pwg.images.delete', 'ws_images_delete',
     347      array(
     348        'image_id' =>   array('default'=>0),
     349        'pwg_token' =>  array(),
     350        ),
     351      'Delete photos. You can give several image_ids, comma separated'
     352    );
     353
     354  $service->addMethod('pwg.categories.getAdminList', 'ws_categories_getAdminList',
     355      null,
     356      'administration method only'
     357    );
     358
     359  $service->addMethod('pwg.categories.add', 'ws_categories_add',
     360      array(
     361        'name' =>         array(),
     362        'parent' =>       array('default'=>null),
     363        'comment' =>      array('default'=>null),
     364        'visible' =>      array('default'=>null),
     365        'status' =>       array('default'=>null),
     366        'commentable' =>  array('default'=>'true'),
     367        ),
     368      'administration method only'
     369    );
     370
     371  $service->addMethod('pwg.categories.delete', 'ws_categories_delete',
     372      array(
     373        'category_id'=>           array('default'=>0),
     374        'pwg_token' =>            array(),
     375        'photo_deletion_mode' =>  array('default'=>'delete_orphans'),
     376        ),
     377      'Delete categories. You can give several category_ids, comma separated.
     378<br><b>photo_deletion_mode</b> can be "no_delete" (may create orphan photos), "delete_orphans"
     379(default mode, only deletes photos linked to no other album) or "force_delete" (delete all photos, even those linked to other albums)'
     380    );
     381
     382  $service->addMethod('pwg.categories.move', 'ws_categories_move',
     383      array(
     384        'category_id' =>  array('default'=>0),
     385        'parent' =>       array('default'=>0),
     386        'pwg_token' =>    array(),
     387        ),
     388      'Move categories. You can give several category_ids, comma separated. Set parent as 0 to move to gallery root. Only virtual categories can be moved.'
     389    );
     390
     391  $service->addMethod('pwg.categories.setRepresentative', 'ws_categories_setRepresentative',
     392      array(
     393        'category_id' =>  array('default'=>0),
     394        'image_id' =>     array('default'=>0),
     395        ),
     396      'Set the representative photo for an album. The photo doesn\'t have to belong to the album. POST method only. Administration method only.'
     397    );
     398
     399  $service->addMethod('pwg.tags.getAdminList', 'ws_tags_getAdminList',
     400      null,
     401      'administration method only'
     402    );
     403
     404  $service->addMethod('pwg.tags.add', 'ws_tags_add',
     405      array('name'),
     406      'administration method only'
     407    );
     408
     409  $service->addMethod('pwg.images.exist', 'ws_images_exist',
     410      array(
     411        'md5sum_list' =>    array('default'=>null),
     412        'filename_list' =>  array('default'=>null),
     413        ),
     414      'check existence of a photo list'
     415    );
     416
     417  $service->addMethod('pwg.images.checkFiles', 'ws_images_checkFiles',
     418      array(
     419        'image_id' =>       array(),
     420        'thumbnail_sum' =>  array('default'=>null),
     421        'file_sum' =>       array('default'=>null),
     422        'high_sum' =>       array('default'=>null),
     423        ),
     424      'check if you have updated version of your files for a given photo, for each requested file type, the answer can be "missing", "equals" or "differs"'
     425    );
     426
     427  $service->addMethod('pwg.images.checkUpload', 'ws_images_checkUpload',
     428      null,
     429      'check if Piwigo is ready for upload'
     430    );
     431
     432  $service->addMethod('pwg.images.setInfo', 'ws_images_setInfo',
     433      array(
     434        'image_id' =>       array(),
     435        'file' =>           array('default'=>null),
     436        'name' =>           array('default'=>null),
     437        'author' =>         array('default'=>null),
     438        'date_creation' =>  array('default'=>null),
     439        'comment' =>        array('default'=>null),
     440        'categories' =>     array('default'=>null),
     441        'tag_ids' =>        array('default'=>null),
     442        'level' =>          array('default'=>null,
     443                                  'maxValue'=>$conf['available_permission_levels']),
     444        'single_value_mode' =>    array('default'=>'fill_if_empty'),
     445        'multiple_value_mode' =>  array('default'=>'append'),
     446        ),
     447      'POST method only. Admin only
     448<br><b>categories</b> is a string list "category_id[,rank];category_id[,rank]" The rank is optional and is equivalent to "auto" if not given.
     449<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"
     450(overwrite any existing value) and applies to single values properties like name/author/date_creation/comment
     451<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'
     452    );
     453
     454  $service->addMethod('pwg.categories.setInfo', 'ws_categories_setInfo',
     455      array(
     456        'category_id' =>  array(),
     457        'name' =>         array('default'=>null),
     458        'comment' =>      array('default'=>null),
     459        ),
     460      'POST method only.'
     461    );
     462 
     463  $service->addMethod('pwg.plugins.getList', 'ws_plugins_getList',
     464      null,
     465      'Admin only
     466<br>get the list of plugin with id, name, version, state and description'
     467    );
     468
     469  $service->addMethod('pwg.plugins.performAction', 'ws_plugins_performAction',
     470      array('action', 'plugin', 'pwg_token'),
     471      'Admin only
     472<br>install/activate/deactivate/uninstall/delete a plugin'
     473    );
     474
     475  $service->addMethod('pwg.themes.performAction', 'ws_themes_performAction',
     476      array('action', 'theme', 'pwg_token'),
     477      'activate/deactivate/delete/set_default a theme<br>administration status required'
     478    );
     479
     480  $service->addMethod('pwg.extensions.update', 'ws_extensions_update',
     481      array('type', 'id', 'revision', 'pwg_token'),
     482      'Update an extension. Webmaster only.
     483<br>Parameter type must be "plugins", "languages" or "themes".'
     484  );
     485
     486  $service->addMethod('pwg.extensions.ignoreUpdate', 'ws_extensions_ignoreupdate',
     487      array(
     488        'type' =>       array('default'=>null),
     489        'id' =>         array('default'=>null),
     490        'reset' =>      array('default'=>null),
     491        'pwg_token' =>  array(),
     492      ),
     493      'Ignore an extension if it need update.
     494<br>Parameter type must be "plugins", "languages" or "themes".
     495<br>If reset parameter is true, all ignored extensions will be reinitilized.'
     496  );
     497
     498  $service->addMethod('pwg.extensions.checkUpdates', 'ws_extensions_checkupdates',
     499      null,
     500      'Check if piwigo or extensions are up to date.'
     501  );
     502}
     503
    562504?>
Note: See TracChangeset for help on using the changeset viewer.