aboutsummaryrefslogtreecommitdiffstats
path: root/include/ws_functions.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/ws_functions.inc.php')
-rw-r--r--include/ws_functions.inc.php20
1 files changed, 11 insertions, 9 deletions
diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php
index dca9740d1..1c71a6900 100644
--- a/include/ws_functions.inc.php
+++ b/include/ws_functions.inc.php
@@ -405,33 +405,35 @@ LIMIT '.$params['per_page']*$params['page'].','.$params['per_page'];
*/
function ws_categories_getList($params, &$service)
{
- global $user;
+ global $user,$conf;
$where = array();
- $where[]= 'user_id='.$user['id'];
- if ($params['cat_id']>0)
- {
- $where[] = 'uppercats REGEXP \'(^|,)'.
- (int)($params['cat_id'])
- .'(,|$)\'';
- }
if (!$params['recursive'])
{
if ($params['cat_id']>0)
- $where[] = 'id_uppercat='.(int)($params['cat_id']);
+ $where[] = '(id_uppercat='.(int)($params['cat_id']).'
+ OR id='.(int)($params['cat_id']).')';
else
$where[] = 'id_uppercat IS NULL';
}
+ else if ($params['cat_id']>0)
+ {
+ $where[] = 'uppercats REGEXP \'(^|,)'.
+ (int)($params['cat_id'])
+ .'(,|$)\'';
+ }
if ($params['public'])
{
$where[] = 'status = "public"';
$where[] = 'visible = "true"';
+ $where[]= 'user_id='.$conf['guest_id'];
}
else
{
$where[] = 'id NOT IN ('.$user['forbidden_categories'].')';
+ $where[]= 'user_id='.$user['id'];
}
$query = '