Navigation Menu

Skip to content

Commit

Permalink
feature 2657: More options for pwg.categories.add
Browse files Browse the repository at this point in the history
git-svn-id: http://piwigo.org/svn/trunk@15850 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
mistic100 committed Jun 20, 2012
1 parent d355647 commit 07c7470
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
27 changes: 27 additions & 0 deletions include/ws_functions.inc.php
Expand Up @@ -2302,6 +2302,33 @@ function ws_categories_add($params, &$service)
{
return new PwgError(500, $creation_output['error']);
}

$updates = array();
if ( !empty($params['status']) and in_array($params['status'], array('private','public')) )
{
$updates['status'] = $params['status'];
}
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']) )
{
$updates['comment'] = strip_tags($params['comment']);
}

if (!empty($updates))
{
single_update(
CATEGORIES_TABLE,
$updates,
array('id'=>$creation_output['id'])
);
}

invalidate_user_cache();

Expand Down
4 changes: 4 additions & 0 deletions ws.php
Expand Up @@ -308,6 +308,10 @@ function ws_addDefaultMethods( $arr )
array(
'name' => array(),
'parent' => array('default' => null),
'comment' => array('default' => null),
'visible' => array('default' => boolean_to_string($conf['newcat_default_visible'])),
'status' => array('default' => $conf['newcat_default_status']),
'commentable' => array('default' => 'true'),
),
'administration method only'
);
Expand Down

0 comments on commit 07c7470

Please sign in to comment.