From 7aae3dd9853e0bbbecd2b7fc48acf3b0b96aa9e0 Mon Sep 17 00:00:00 2001 From: plegall Date: Fri, 29 Oct 2010 22:34:41 +0000 Subject: merge r7487 from branch 2.1 to trunk bug 1973 fixed: aboid SQL syntax error if the category id given in the URL is unknown. git-svn-id: http://piwigo.org/svn/trunk@7488 68402e56-0260-453c-a942-63ccdbb3a9ee --- comments.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'comments.php') diff --git a/comments.php b/comments.php index 0ffb05d97..78f3d011d 100644 --- a/comments.php +++ b/comments.php @@ -105,9 +105,15 @@ $page['where_clauses'] = array(); if (isset($_GET['cat']) and 0 != $_GET['cat']) { check_input_parameter('cat', $_GET, false, PATTERN_ID); + + $category_ids = get_subcat_ids(array($_GET['cat'])); + if (empty($category_id)) + { + $category_ids = array(-1); + } $page['where_clauses'][] = - 'category_id IN ('.implode(',', get_subcat_ids(array($_GET['cat']))).')'; + 'category_id IN ('.implode(',', $category_ids).')'; } // search a particular author -- cgit v1.2.3