From 11714951b33d340f13400aa8fc9a2b971f8d8e8b Mon Sep 17 00:00:00 2001 From: rvelices Date: Thu, 15 Feb 2007 00:10:41 +0000 Subject: - feature 642: display both subcategory thumbnails and element thumbnails (if a category has both) in the index page - get rid of $page['cat_nb_images'] and $page['thumbnails_include'] (superfluous) - changed sql queries in section_init.inc.php for better performance with flat category view - web service fixes for categories.getList git-svn-id: http://piwigo.org/svn/trunk@1820 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/ws_functions.inc.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'include/ws_functions.inc.php') 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 = ' -- cgit v1.2.3