Index: /trunk/include/ws_functions.inc.php
===================================================================
--- /trunk/include/ws_functions.inc.php	(revision 8265)
+++ /trunk/include/ws_functions.inc.php	(revision 8266)
@@ -1990,4 +1990,43 @@
 }
 
+function ws_images_delete($params, &$service)
+{
+  global $conf;
+  if (!is_admin() || is_adviser() )
+  {
+    return new PwgError(401, 'Access denied');
+  }
+
+  if (!$service->isPost())
+  {
+    return new PwgError(405, "This method requires HTTP POST");
+  }
+
+  if (empty($params['pwg_token']) or get_pwg_token() != $params['pwg_token'])
+  {
+    return new PwgError(403, 'Invalid security token');
+  }
+
+  $params['image_id'] = preg_split(
+    '/[\s,;\|]/',
+    $params['image_id'],
+    -1,
+    PREG_SPLIT_NO_EMPTY
+    );
+  $params['image_id'] = array_map('intval', $params['image_id']);
+
+  $image_ids = array();
+  foreach ($params['image_id'] as $image_id)
+  {
+    if ($image_id > 0)
+    {
+      array_push($image_ids, $image_id);
+    }
+  }
+
+  include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
+  delete_elements($image_ids, true);
+}
+
 function ws_add_image_category_relations($image_id, $categories_string, $replace_mode=false)
 {
@@ -2202,4 +2241,72 @@
 }
 
+function ws_categories_delete($params, &$service)
+{
+  global $conf;
+  if (!is_admin() || is_adviser() )
+  {
+    return new PwgError(401, 'Access denied');
+  }
+
+  if (!$service->isPost())
+  {
+    return new PwgError(405, "This method requires HTTP POST");
+  }
+
+  if (empty($params['pwg_token']) or get_pwg_token() != $params['pwg_token'])
+  {
+    return new PwgError(403, 'Invalid security token');
+  }
+
+  $modes = array('no_delete', 'delete_orphans', 'force_delete');
+  if (!in_array($params['photo_deletion_mode'], $modes))
+  {
+    return new PwgError(
+      500,
+      '[ws_categories_delete]'
+      .' invalid parameter photo_deletion_mode "'.$params['photo_deletion_mode'].'"'
+      .', possible values are {'.implode(', ', $modes).'}.'
+      );
+  }
+
+  $params['category_id'] = preg_split(
+    '/[\s,;\|]/',
+    $params['category_id'],
+    -1,
+    PREG_SPLIT_NO_EMPTY
+    );
+  $params['category_id'] = array_map('intval', $params['category_id']);
+
+  $category_ids = array();
+  foreach ($params['category_id'] as $category_id)
+  {
+    if ($category_id > 0)
+    {
+      array_push($category_ids, $category_id);
+    }
+  }
+
+  if (count($category_ids) == 0)
+  {
+    return;
+  }
+
+  $query = '
+SELECT id
+  FROM '.CATEGORIES_TABLE.'
+  WHERE id IN ('.implode(',', $category_ids).')
+;';
+  $category_ids = array_from_query($query, 'id');
+
+  if (count($category_ids) == 0)
+  {
+    return;
+  }
+  
+  include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
+  delete_categories($category_ids, $params['photo_deletion_mode']);
+  update_global_rank();
+}
+
 function ws_logfile($string)
 {
Index: /trunk/ws.php
===================================================================
--- /trunk/ws.php	(revision 8265)
+++ /trunk/ws.php	(revision 8266)
@@ -237,5 +237,15 @@
     '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.'
     );
-  
+
+  $service->addMethod(
+    'pwg.images.delete',
+    'ws_images_delete',
+    array(
+      'image_id'=>array('default'=>0),
+      'pwg_token' => array('default' => null),
+      ),
+    'Delete photos. You can give several image_ids, comma separated'
+    );
+
   $service->addMethod(
     'pwg.categories.getAdminList',
@@ -253,4 +263,16 @@
       ),
     'administration method only'
+    );
+
+  $service->addMethod(
+    'pwg.categories.delete',
+    'ws_categories_delete',
+    array(
+      'category_id'=>array('default'=>0),
+      'pwg_token' => array('default' => null),
+      '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)'
     );
 
