2007-01-06 12:13:08 +01:00
< ? php
// +-----------------------------------------------------------------------+
2011-01-18 01:02:52 +01:00
// | Piwigo - a PHP based photo gallery |
2008-04-05 00:57:23 +02:00
// +-----------------------------------------------------------------------+
2012-01-17 23:48:36 +01:00
// | Copyright(C) 2008-2012 Piwigo Team http://piwigo.org |
2008-04-05 00:57:23 +02:00
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation |
2007-01-06 12:13:08 +01:00
// | |
// | This program is distributed in the hope that it will be useful, but |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
define ( 'PHPWG_ROOT_PATH' , './' );
include_once ( PHPWG_ROOT_PATH . 'include/common.inc.php' );
2008-05-02 23:56:21 +02:00
check_status ( ACCESS_FREE );
2007-01-06 12:13:08 +01:00
include_once ( PHPWG_ROOT_PATH . 'include/ws_core.inc.php' );
2007-02-06 02:02:06 +01:00
if ( ! $conf [ 'allow_web_services' ] )
{
page_forbidden ( 'Web services are disabled' );
}
2007-01-29 21:38:08 +01:00
/**
* event handler that registers standard methods with the web service
*/
2007-01-06 12:13:08 +01:00
function ws_addDefaultMethods ( $arr )
{
include_once ( PHPWG_ROOT_PATH . 'include/ws_functions.inc.php' );
2007-02-22 02:12:32 +01:00
global $conf , $user ;
2007-01-06 12:13:08 +01:00
$service = & $arr [ 0 ];
$service -> addMethod ( 'pwg.getVersion' , 'ws_getVersion' , null ,
'retrieves the PWG version' );
2011-04-03 14:36:32 +02:00
$service -> addMethod ( 'pwg.getInfos' , 'ws_getInfos' , null ,
'retrieves general informations' );
2007-01-06 12:13:08 +01:00
2008-07-15 03:29:23 +02:00
$service -> addMethod ( 'pwg.caddie.add' , 'ws_caddie_add' ,
2008-07-12 02:30:27 +02:00
array (
'image_id' => array ( 'flags' => WS_PARAM_FORCE_ARRAY ),
),
'adds the elements to the caddie' );
2007-01-06 12:13:08 +01:00
$service -> addMethod ( 'pwg.categories.getImages' , 'ws_categories_getImages' ,
array (
'cat_id' => array ( 'default' => 0 , 'flags' => WS_PARAM_FORCE_ARRAY ),
'recursive' => array ( 'default' => false ),
2007-02-06 02:02:06 +01:00
'per_page' => array ( 'default' => 100 , 'maxValue' => $conf [ 'ws_max_images_per_page' ]),
2007-01-06 12:13:08 +01:00
'page' => array ( 'default' => 0 ),
'order' => array ( 'default' => null ),
'f_min_rate' => array ( 'default' => null ),
'f_max_rate' => array ( 'default' => null ),
'f_min_hit' => array ( 'default' => null ),
'f_max_hit' => array ( 'default' => null ),
'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 ),
'f_min_ratio' => array ( 'default' => null ),
'f_max_ratio' => array ( 'default' => null ),
2012-01-08 20:25:52 +01:00
'f_max_level' => array ( 'default' => null ),
2007-01-06 12:13:08 +01:00
),
' Returns elements for the corresponding categories .
2009-03-09 20:41:45 +01:00
< br >< b > cat_id </ b > can be empty if < b > recursive </ b > is true . Can be sent as an array .
2011-08-02 21:20:50 +02:00
< br >< b > order </ b > comma separated fields for sorting ( file , id , rating_score , ... ) '
2007-01-06 12:13:08 +01:00
);
$service -> addMethod ( 'pwg.categories.getList' , 'ws_categories_getList' ,
array (
'cat_id' => array ( 'default' => 0 ),
'recursive' => array ( 'default' => false ),
'public' => array ( 'default' => false ),
2011-05-31 22:25:40 +02:00
'tree_output' => array ( 'default' => false ),
feature 2406 added: if the user wants a new album in the upload form, the album
is created before the start of the upload. The ergonomy is now simpler, the
page is smaller and cleaner.
bug 2373 fixed: now that album is created before upload, uploadify.php gets the
category_id and the level: as soon as it is uploaded (function add_uploaded_file)
the photo gets its final privacy level and is directly associated to the album.
This way, we can have an error on a photo without making orphan all photos of
the same upload group.
feature 2405 added: as soon as a photo is uploaded, its thumbnail is displayed
in the "Uploaded Photos" fieldset, without waiting for other photos to be
uploaded. The latest photos comes first.
I have slighlty changed the integration of colorbox in core. Now we have 2
styles available and by default, we use style2 (overlay in black, title and
control icons outside the popup). It is also used for zooming on bulk manager
in unit mode.
display change: on each uploading photos, instead of showing the transfer
speed, we display the transfer progression in %
bug fixed: the color of the "Start Upload" button was not correct because the
button was not a submit button but a simple type=button.
language: "Upload" button becomes "Start Upload" button.
git-svn-id: http://piwigo.org/svn/trunk@11962 68402e56-0260-453c-a942-63ccdbb3a9ee
2011-08-17 21:56:07 +02:00
'fullname' => array ( 'default' => false ),
2007-01-06 12:13:08 +01:00
),
2011-05-31 22:25:40 +02:00
'retrieves a list of categories (tree_output option only compatible with json/php output format' );
2007-01-06 12:13:08 +01:00
2012-01-08 20:25:52 +01:00
$service -> addMethod ( 'pwg.getMissingDerivatives' , 'ws_getMissingDerivatives' ,
array (
'types' => array ( 'default' => array (), 'flags' => WS_PARAM_FORCE_ARRAY ),
'max_urls' => array ( 'default' => 200 ),
'prev_page' => array ( 'default' => null ),
'f_min_rate' => array ( 'default' => null ),
'f_max_rate' => array ( 'default' => null ),
'f_min_hit' => array ( 'default' => null ),
'f_max_hit' => array ( 'default' => null ),
'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 ),
'f_min_ratio' => array ( 'default' => null ),
'f_max_ratio' => array ( 'default' => null ),
'f_max_level' => array ( 'default' => null ),
),
'retrieves a list of derivatives to build' );
2007-02-22 02:12:32 +01:00
$service -> addMethod ( 'pwg.images.addComment' , 'ws_images_addComment' ,
array (
'image_id' => array (),
2007-06-06 00:01:15 +02:00
'author' => array ( 'default' => is_a_guest () ? 'guest' : $user [ 'username' ]),
2007-02-22 02:12:32 +01:00
'content' => array (),
'key' => array (),
),
'add a comment to an image' );
2007-01-06 12:13:08 +01:00
$service -> addMethod ( 'pwg.images.getInfo' , 'ws_images_getInfo' ,
2007-02-22 02:12:32 +01:00
array (
'image_id' => array (),
'comments_page' => array ( 'default' => 0 ),
2008-07-15 03:29:23 +02:00
'comments_per_page' => array (
'default' => $conf [ 'nb_comment_page' ],
2007-02-22 02:12:32 +01:00
'maxValue' => 2 * $conf [ 'nb_comment_page' ],
),
),
2007-01-06 12:13:08 +01:00
'retrieves information about the given photo' );
2008-07-15 03:29:23 +02:00
$service -> addMethod ( 'pwg.images.rate' , 'ws_images_rate' ,
array (
'image_id' => array (),
'rate' => array (),
),
'rate the image' );
2007-02-19 17:25:47 +01:00
$service -> addMethod ( 'pwg.images.search' , 'ws_images_search' ,
array (
'query' => array (),
'per_page' => array ( 'default' => 100 , 'maxValue' => $conf [ 'ws_max_images_per_page' ]),
'page' => array ( 'default' => 0 ),
'order' => array ( 'default' => null ),
'f_min_rate' => array ( 'default' => null ),
'f_max_rate' => array ( 'default' => null ),
'f_min_hit' => array ( 'default' => null ),
'f_max_hit' => array ( 'default' => null ),
'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 ),
'f_min_ratio' => array ( 'default' => null ),
'f_max_ratio' => array ( 'default' => null ),
2012-01-08 20:25:52 +01:00
'f_max_level' => array ( 'default' => null ),
2007-02-19 17:25:47 +01:00
),
'Returns elements for the corresponding query search.'
);
2008-09-11 03:20:25 +02:00
2008-07-30 23:53:00 +02:00
$service -> addMethod (
'pwg.images.setPrivacyLevel' ,
'ws_images_setPrivacyLevel' ,
array (
'image_id' => array ( 'flags' => WS_PARAM_FORCE_ARRAY ),
'level' => array ( 'maxValue' => $conf [ 'available_permission_levels' ]),
2008-07-02 03:11:26 +02:00
),
2009-12-18 22:12:41 +01:00
'sets the privacy levels for the images (POST method only)'
2008-07-30 23:53:00 +02:00
);
2007-02-19 17:25:47 +01:00
2011-06-14 15:54:05 +02:00
$service -> addMethod (
'pwg.images.setRank' ,
'ws_images_setRank' ,
array (
'image_id' => array (),
'category_id' => array (),
'rank' => array (),
),
'sets the rank of a photo for a given album (POST method only, for admins)'
);
2011-11-14 21:10:37 +01:00
$service -> addMethod ( 'pwg.rates.delete' , 'ws_rates_delete' ,
array (
'user_id' => array (),
'anonymous_id' => array ( 'default' => '' ),
),
'deletes all rates for a user (POST method only, admins only)'
);
2007-01-06 12:13:08 +01:00
$service -> addMethod ( 'pwg.session.getStatus' , 'ws_session_getStatus' , null , '' );
$service -> addMethod ( 'pwg.session.login' , 'ws_session_login' ,
array ( 'username' , 'password' ),
'POST method only' );
$service -> addMethod ( 'pwg.session.logout' , 'ws_session_logout' , null , '' );
$service -> addMethod ( 'pwg.tags.getList' , 'ws_tags_getList' ,
array ( 'sort_by_counter' => array ( 'default' => false ) ),
'retrieves a list of available tags' );
$service -> addMethod ( 'pwg.tags.getImages' , 'ws_tags_getImages' ,
array (
'tag_id' => array ( 'default' => null , 'flags' => WS_PARAM_FORCE_ARRAY ),
'tag_url_name' => array ( 'default' => null , 'flags' => WS_PARAM_FORCE_ARRAY ),
'tag_name' => array ( 'default' => null , 'flags' => WS_PARAM_FORCE_ARRAY ),
'tag_mode_and' => array ( 'default' => false ),
2007-02-06 02:02:06 +01:00
'per_page' => array ( 'default' => 100 , 'maxValue' => $conf [ 'ws_max_images_per_page' ]),
2007-01-06 12:13:08 +01:00
'page' => array ( 'default' => 0 ),
'order' => array ( 'default' => null ),
'f_min_rate' => array ( 'default' => null ),
'f_max_rate' => array ( 'default' => null ),
'f_min_hit' => array ( 'default' => null ),
'f_max_hit' => array ( 'default' => null ),
'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 ),
'f_min_ratio' => array ( 'default' => null ),
'f_max_ratio' => array ( 'default' => null ),
2012-01-08 20:25:52 +01:00
'f_max_level' => array ( 'default' => null ),
2007-01-06 12:13:08 +01:00
),
'Returns elements for the corresponding tags. Note that tag_id, tag_url_name, tag_name an be arrays. Fill at least one of them. '
);
2008-07-30 23:53:00 +02:00
2009-03-13 00:14:50 +01:00
$service -> addMethod (
'pwg.images.addChunk' ,
'ws_images_add_chunk' ,
array (
'data' => array (),
'original_sum' => array (),
'type' => array (),
'position' => array (),
),
'POST method only. For admin only.'
);
2009-11-23 00:59:14 +01:00
$service -> addMethod (
'pwg.images.addFile' ,
'ws_images_addFile' ,
array (
'image_id' => array (),
'type' => array (),
'sum' => array (),
),
'Add or update a file for an existing photo. pwg.images.addChunk must have been called before (maybe several times)'
);
2009-03-13 00:14:50 +01:00
2008-07-30 23:53:00 +02:00
$service -> addMethod (
'pwg.images.add' ,
'ws_images_add' ,
array (
2008-09-22 23:47:03 +02:00
'file_sum' => array (),
2011-12-13 15:01:10 +01:00
'thumbnail_sum' => array ( 'default' => null ),
2008-10-05 23:22:57 +02:00
'high_sum' => array ( 'default' => null ),
2009-01-09 00:33:35 +01:00
'original_sum' => array (),
2010-02-19 10:20:11 +01:00
'original_filename' => array ( 'default' => null ),
2008-09-22 23:47:03 +02:00
'name' => array ( 'default' => null ),
'author' => array ( 'default' => null ),
'date_creation' => array ( 'default' => null ),
'comment' => array ( 'default' => null ),
'categories' => array ( 'default' => null ),
'tag_ids' => array ( 'default' => null ),
'level' => array (
'default' => 0 ,
'maxValue' => $conf [ 'available_permission_levels' ]
),
2011-12-13 15:42:54 +01:00
'check_uniqueness' => array ( 'default' => true ),
2012-02-11 00:48:55 +01:00
'image_id' => array ( 'default' => null ),
2008-07-30 23:53:00 +02:00
),
2008-09-22 23:47:03 +02:00
' POST method only .
2009-03-09 20:41:45 +01:00
< 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 . '
2008-07-30 23:53:00 +02:00
);
2008-09-21 22:42:17 +02:00
2010-12-23 11:22:51 +01:00
$service -> addMethod (
'pwg.images.addSimple' ,
'ws_images_addSimple' ,
array (
'category' => array ( 'default' => null ),
'name' => array ( 'default' => null ),
'author' => array ( 'default' => null ),
'comment' => array ( 'default' => null ),
'level' => array (
'default' => 0 ,
'maxValue' => $conf [ 'available_permission_levels' ]
),
'tags' => array ( 'default' => null ),
2011-02-11 23:57:23 +01:00
'image_id' => array ( 'default' => null ),
2010-12-23 11:22:51 +01:00
),
2011-02-11 23:57:23 +01:00
'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.'
2010-12-23 11:22:51 +01:00
);
2010-12-23 21:51:33 +01:00
$service -> addMethod (
'pwg.images.delete' ,
'ws_images_delete' ,
array (
'image_id' => array ( 'default' => 0 ),
2011-04-19 22:06:39 +02:00
'pwg_token' => array (),
2010-12-23 21:51:33 +01:00
),
'Delete photos. You can give several image_ids, comma separated'
);
2008-09-21 22:42:17 +02:00
$service -> addMethod (
'pwg.categories.getAdminList' ,
'ws_categories_getAdminList' ,
array (),
'administration method only'
);
2008-09-24 22:25:39 +02:00
$service -> addMethod (
'pwg.categories.add' ,
'ws_categories_add' ,
array (
'name' => array (),
'parent' => array ( 'default' => null ),
),
'administration method only'
);
2008-09-24 23:30:33 +02:00
2010-12-23 21:51:33 +01:00
$service -> addMethod (
'pwg.categories.delete' ,
'ws_categories_delete' ,
array (
'category_id' => array ( 'default' => 0 ),
2011-04-19 22:06:39 +02:00
'pwg_token' => array (),
2010-12-23 21:51:33 +01:00
'photo_deletion_mode' => array ( 'default' => 'delete_orphans' ),
),
' Delete categories . You can give several category_ids , comma separated .
< 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 ) '
);
2010-12-23 23:41:28 +01:00
$service -> addMethod (
'pwg.categories.move' ,
'ws_categories_move' ,
array (
'category_id' => array ( 'default' => 0 ),
'parent' => array ( 'default' => 0 ),
2011-04-19 22:06:39 +02:00
'pwg_token' => array (),
2010-12-23 23:41:28 +01:00
),
'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.'
);
2011-07-14 23:44:14 +02:00
$service -> addMethod (
'pwg.categories.setRepresentative' ,
'ws_categories_setRepresentative' ,
array (
'category_id' => array ( 'default' => 0 ),
'image_id' => array ( 'default' => 0 ),
),
'Set the representative photo for an album. The photo doesn\'t have to belong to the album. POST method only. Administration method only.'
);
2008-09-24 23:30:33 +02:00
$service -> addMethod (
'pwg.tags.getAdminList' ,
'ws_tags_getAdminList' ,
array (),
'administration method only'
);
2008-10-01 23:08:51 +02:00
$service -> addMethod (
'pwg.tags.add' ,
'ws_tags_add' ,
array (
'name' => array (),
),
'administration method only'
);
2008-10-08 00:01:14 +02:00
$service -> addMethod (
'pwg.images.exist' ,
'ws_images_exist' ,
array (
2010-02-23 15:41:45 +01:00
'md5sum_list' => array ( 'default' => null ),
'filename_list' => array ( 'default' => null ),
2008-10-08 00:01:14 +02:00
),
'check existence of a photo list'
);
2008-12-03 23:55:17 +01:00
2009-11-23 00:58:44 +01:00
$service -> addMethod (
'pwg.images.checkFiles' ,
'ws_images_checkFiles' ,
array (
'image_id' => array (),
'thumbnail_sum' => array ( 'default' => null ),
'file_sum' => array ( 'default' => null ),
'high_sum' => array ( 'default' => null ),
),
'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"'
);
2010-05-03 11:09:40 +02:00
$service -> addMethod (
'pwg.images.checkUpload' ,
'ws_images_checkUpload' ,
null ,
'check if Piwigo is ready for upload'
);
2008-12-03 23:55:17 +01:00
$service -> addMethod (
'pwg.images.setInfo' ,
'ws_images_setInfo' ,
array (
'image_id' => array (),
2009-12-18 22:12:41 +01:00
2011-12-13 16:21:36 +01:00
'file' => array ( 'default' => null ),
2008-12-03 23:55:17 +01:00
'name' => array ( 'default' => null ),
'author' => array ( 'default' => null ),
'date_creation' => array ( 'default' => null ),
'comment' => array ( 'default' => null ),
'categories' => array ( 'default' => null ),
'tag_ids' => array ( 'default' => null ),
'level' => array (
2011-06-14 14:07:32 +02:00
'default' => null ,
2008-12-03 23:55:17 +01:00
'maxValue' => $conf [ 'available_permission_levels' ]
),
2009-12-09 23:19:06 +01:00
'single_value_mode' => array ( 'default' => 'fill_if_empty' ),
'multiple_value_mode' => array ( 'default' => 'append' ),
2008-12-03 23:55:17 +01:00
),
' POST method only . Admin only
2009-12-09 23:19:06 +01:00
< 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 .
< 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
< 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 '
2008-12-03 23:55:17 +01:00
);
2009-12-18 22:12:41 +01:00
2009-06-25 01:01:35 +02:00
$service -> addMethod (
'pwg.categories.setInfo' ,
'ws_categories_setInfo' ,
array (
'category_id' => array (),
2009-12-18 22:12:41 +01:00
2009-06-25 01:01:35 +02:00
'name' => array ( 'default' => null ),
'comment' => array ( 'default' => null ),
),
'POST method only.'
);
2010-12-24 00:12:03 +01:00
$service -> addMethod (
'pwg.plugins.getList' ,
'ws_plugins_getList' ,
array (),
' get the list of plugin with id , name , version , state and description
< br > administration status required '
);
$service -> addMethod (
'pwg.plugins.performAction' ,
'ws_plugins_performAction' ,
array (
2011-04-19 22:06:39 +02:00
'action' => array (),
'plugin' => array (),
'pwg_token' => array (),
2010-12-24 00:12:03 +01:00
),
' install / activate / deactivate / uninstall / delete a plugin
< br > administration status required '
);
2010-12-26 23:52:35 +01:00
$service -> addMethod (
'pwg.themes.performAction' ,
'ws_themes_performAction' ,
array (
2011-04-19 22:06:39 +02:00
'action' => array (),
'theme' => array (),
'pwg_token' => array (),
2010-12-26 23:52:35 +01:00
),
'activate/deactivate/delete/set_default a theme<br>administration status required'
);
2011-04-10 10:59:02 +02:00
$service -> addMethod (
2011-04-29 19:38:59 +02:00
'pwg.images.resizeThumbnail' ,
'ws_images_resizethumbnail' ,
2011-04-10 10:59:02 +02:00
array (
2011-04-22 13:34:57 +02:00
'image_id' => array ( 'default' => null ),
'image_path' => array ( 'default' => null ),
2011-04-29 19:38:59 +02:00
'maxwidth' => array ( 'default' => $conf [ 'upload_form_thumb_maxwidth' ]),
'maxheight' => array ( 'default' => $conf [ 'upload_form_thumb_maxheight' ]),
'quality' => array ( 'default' => $conf [ 'upload_form_thumb_quality' ]),
'crop' => array ( 'default' => $conf [ 'upload_form_thumb_crop' ]),
'follow_orientation' => array ( 'default' => $conf [ 'upload_form_thumb_follow_orientation' ]),
'library' => array ( 'default' => $conf [ 'graphics_library' ]),
),
' Create / Regenerate thumbnails photo with given arguments .
< br > One of arguments " image_id " or " image_path " must be sent . '
);
$service -> addMethod (
'pwg.images.resizeWebsize' ,
'ws_images_resizewebsize' ,
array (
'image_id' => array (),
'maxwidth' => array ( 'default' => $conf [ 'upload_form_websize_maxwidth' ]),
'maxheight' => array ( 'default' => $conf [ 'upload_form_websize_maxheight' ]),
'quality' => array ( 'default' => $conf [ 'upload_form_websize_quality' ]),
2011-04-27 19:03:25 +02:00
'automatic_rotation' => array ( 'default' => $conf [ 'upload_form_automatic_rotation' ]),
2011-04-29 19:10:00 +02:00
'library' => array ( 'default' => $conf [ 'graphics_library' ]),
2011-04-10 10:59:02 +02:00
),
2011-04-29 19:38:59 +02:00
'Regenerate websize photo with given arguments.'
);
2011-04-20 16:52:52 +02:00
$service -> addMethod (
'pwg.extensions.update' ,
'ws_extensions_update' ,
array (
'type' => array (),
'id' => array (),
'revision' => array (),
'pwg_token' => array (),
),
' Update an extension . Webmaster only .
< br > Parameter type must be " plugins " , " languages " or " themes " . '
);
$service -> addMethod (
'pwg.extensions.ignoreUpdate' ,
'ws_extensions_ignoreupdate' ,
array (
'type' => array ( 'default' => null ),
'id' => array ( 'default' => null ),
'reset' => array ( 'default' => null ),
'pwg_token' => array (),
),
' Ignore an extension if it need update .
< br > Parameter type must be " plugins " , " languages " or " themes " .
< br > If reset parameter is true , all ignored extensions will be reinitilized . '
);
2011-04-21 17:12:38 +02:00
$service -> addMethod (
'pwg.extensions.checkUpdates' ,
'ws_extensions_checkupdates' ,
array (),
'Check if piwigo or extensions are up to date.'
);
2007-01-06 12:13:08 +01:00
}
2007-01-29 21:38:08 +01:00
add_event_handler ( 'ws_add_methods' , 'ws_addDefaultMethods' );
2007-01-06 12:13:08 +01:00
2007-01-29 21:38:08 +01:00
add_event_handler ( 'ws_invoke_allowed' , 'ws_isInvokeAllowed' , EVENT_HANDLER_PRIORITY_NEUTRAL , 3 );
2011-12-05 10:09:55 +01:00
$requestFormat = 'rest' ;
2007-01-06 12:13:08 +01:00
$responseFormat = null ;
if ( isset ( $_GET [ 'format' ]) )
{
$responseFormat = $_GET [ 'format' ];
}
if ( ! isset ( $responseFormat ) and isset ( $requestFormat ) )
{
$responseFormat = $requestFormat ;
}
$service = new PwgServer ();
if ( ! is_null ( $requestFormat ))
{
$handler = null ;
switch ( $requestFormat )
{
case 'rest' :
include_once ( PHPWG_ROOT_PATH . 'include/ws_protocols/rest_handler.php' );
$handler = new PwgRestRequestHandler ();
break ;
}
$service -> setHandler ( $requestFormat , $handler );
}
if ( ! is_null ( $responseFormat ))
{
$encoder = null ;
switch ( $responseFormat )
{
case 'rest' :
include_once ( PHPWG_ROOT_PATH . 'include/ws_protocols/rest_encoder.php' );
$encoder = new PwgRestEncoder ();
break ;
case 'php' :
include_once ( PHPWG_ROOT_PATH . 'include/ws_protocols/php_encoder.php' );
$encoder = new PwgSerialPhpEncoder ();
break ;
case 'json' :
include_once ( PHPWG_ROOT_PATH . 'include/ws_protocols/json_encoder.php' );
$encoder = new PwgJsonEncoder ();
break ;
case 'xmlrpc' :
include_once ( PHPWG_ROOT_PATH . 'include/ws_protocols/xmlrpc_encoder.php' );
$encoder = new PwgXmlRpcEncoder ();
break ;
}
$service -> setEncoder ( $responseFormat , $encoder );
}
2007-01-24 06:07:08 +01:00
set_make_full_url ();
2007-01-06 12:13:08 +01:00
$service -> run ();
?>