aboutsummaryrefslogtreecommitdiffstats
path: root/include/category_subcats.inc.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/category_subcats.inc.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/category_subcats.inc.php b/include/category_subcats.inc.php
index 7e6d080d8..4ee5929ea 100644
--- a/include/category_subcats.inc.php
+++ b/include/category_subcats.inc.php
@@ -69,7 +69,14 @@ while ($row = mysql_fetch_array($result))
SELECT path, tn_ext
FROM '.CATEGORIES_TABLE.' AS c INNER JOIN '.IMAGES_TABLE.' AS i
ON i.id = c.representative_picture_id
- WHERE uppercats REGEXP \'(^|,)'.$row['id'].'(,|$)\'
+ WHERE uppercats REGEXP \'(^|,)'.$row['id'].'(,|$)\'';
+ // we must not show pictures of a forbidden category
+ if ($user['forbidden_categories'] != '')
+ {
+ $query.= '
+ AND c.id NOT IN ('.$user['forbidden_categories'].')';
+ }
+ $query.= '
ORDER BY RAND()
LIMIT 0,1
;';