- 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
This commit is contained in:
parent
d0e86480c4
commit
644f8ee621
6 changed files with 188 additions and 16 deletions
|
|
@ -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)
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue