aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2012-08-30 12:52:40 +0000
committerplegall <plg@piwigo.org>2012-08-30 12:52:40 +0000
commit2c24b0b38ae678a0269b308ddf03ab1bc85630d2 (patch)
tree2d2a74dbd541a8f18190a9dd1b9249a8c6d3b38e /include
parent391ac76cbea0e091534861c884d0e40761f0fba7 (diff)
bug 2733 fixed: when creating a sub-album in a private album with
pwg.categories.add, it is automatically private too. git-svn-id: http://piwigo.org/svn/branches/2.4@17668 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r--include/ws_functions.inc.php49
1 files changed, 20 insertions, 29 deletions
diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php
index 4e9d8d3fb..4e439af88 100644
--- a/include/ws_functions.inc.php
+++ b/include/ws_functions.inc.php
@@ -2302,46 +2302,37 @@ function ws_categories_add($params, &$service)
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
- $creation_output = create_virtual_category(
- $params['name'],
- $params['parent']
- );
-
- if (isset($creation_output['error']))
+ $options = array();
+ if (!empty($params['status']) and in_array($params['status'], array('private','public')))
{
- return new PwgError(500, $creation_output['error']);
+ $options['status'] = $params['status'];
}
- $updates = array();
- if ( !empty($params['status']) and in_array($params['status'], array('private','public')) )
+ if (!empty($params['visible']) and in_array($params['visible'], array('true','false')))
{
- $updates['status'] = $params['status'];
+ $options['visible'] = get_boolean($params['visible']);
}
- if ( !empty($params['visible']) and in_array($params['visible'], array('true','false')) )
- {
- $updates['visible'] = $params['visible'];
- }
- if ( !empty($params['commentable']) and in_array($params['commentable'], array('true','false')) )
- {
- $updates['commentable'] = $params['commentable'];
- }
- if ( !empty($params['comment']) )
+
+ if (!empty($params['commentable']) and in_array($params['commentable'], array('true','false')) )
{
- $updates['comment'] = strip_tags($params['comment']);
+ $options['commentable'] = get_boolean($params['commentable']);
}
-
- if (!empty($updates))
+
+ if (!empty($params['comment']))
{
- single_update(
- CATEGORIES_TABLE,
- $updates,
- array('id'=>$creation_output['id'])
- );
+ $options['comment'] = $params['comment'];
}
- if ( isset($updates['status']) and 'private' == $updates['status'] )
+
+ $creation_output = create_virtual_category(
+ $params['name'],
+ $params['parent'],
+ $options
+ );
+
+ if (isset($creation_output['error']))
{
- add_permission_on_category($creation_output['id'], get_admins());
+ return new PwgError(500, $creation_output['error']);
}
invalidate_user_cache();