aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2012-08-30 12:54:29 +0000
committerplegall <plg@piwigo.org>2012-08-30 12:54:29 +0000
commit6beee17904e7a8829fde211dba053993800ab04b (patch)
tree3048cf29d959164a11c50a90ec0f60e240dce9da /include
parent62452b90cee3fb982e6f3298c84ae87549ccd179 (diff)
merge r17668 from branch 2.4 to trunk
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/trunk@17669 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();