aboutsummaryrefslogtreecommitdiffstats
path: root/include/ws_functions.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2008-07-02 01:11:26 +0000
committerrvelices <rv-github@modusoptimus.com>2008-07-02 01:11:26 +0000
commit644f8ee621549ce1a60f3e1e0dbff83eab8e0c87 (patch)
treebb44ac813d654261bcdc3b5dfd2bc0e5d7c66b53 /include/ws_functions.inc.php
parentd0e86480c46b6f48dfb37284b20b99b9ab862e9a (diff)
- first use of web services as Ajax: change the privacy level directly from the picture page
git-svn-id: http://piwigo.org/svn/trunk@2413 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/ws_functions.inc.php')
-rw-r--r--include/ws_functions.inc.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php
index dc10719b6..72540f2da 100644
--- a/include/ws_functions.inc.php
+++ b/include/ws_functions.inc.php
@@ -824,6 +824,35 @@ SELECT * FROM '.IMAGES_TABLE.'
);
}
+function ws_images_setPrivacyLevel($params, &$service)
+{
+ if (!is_admin() || is_adviser() )
+ {
+ return new PwgError(401, 'Access denied');
+ }
+ if ( empty($params['image_id']) )
+ {
+ return new PwgError(WS_ERR_INVALID_PARAM, "Invalid image_id");
+ }
+ global $conf;
+ if ( !in_array( (int)$params['level'], $conf['available_permission_levels']) )
+ {
+ return new PwgError(WS_ERR_INVALID_PARAM, "Invalid level");
+ }
+ $query = '
+UPDATE '.IMAGES_TABLE.'
+ SET level='.(int)$params['level'].'
+ WHERE id IN ('.implode(',',$params['image_id']).')';
+ $result = pwg_query($query);
+ $affected_rows = mysql_affected_rows();
+ if ($affected_rows)
+ {
+ include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
+ invalidate_user_cache();
+ }
+ return $affected_rows;
+}
+
/**
* perform a login (web service method)
*/