aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/picture_comment.inc.php2
-rw-r--r--picture.php14
2 files changed, 5 insertions, 11 deletions
diff --git a/include/picture_comment.inc.php b/include/picture_comment.inc.php
index 5d007d4ea..df823edbc 100644
--- a/include/picture_comment.inc.php
+++ b/include/picture_comment.inc.php
@@ -31,7 +31,7 @@
$page['show_comments'] = false;
foreach ($related_categories as $category)
{
- if ($category['commentable'])
+ if ($category['commentable']=='true')
{
$page['show_comments'] = true;
break;
diff --git a/picture.php b/picture.php
index d291de151..e394ddf96 100644
--- a/picture.php
+++ b/picture.php
@@ -453,7 +453,7 @@ UPDATE
//---------------------------------------------------------- related categories
$query = '
-SELECT category_id,uppercats,commentable,global_rank
+SELECT id,uppercats,commentable,visible,status,global_rank
FROM '.IMAGE_CATEGORY_TABLE.'
INNER JOIN '.CATEGORIES_TABLE.' ON category_id = id
WHERE image_id = '.$page['image_id'].'
@@ -461,19 +461,13 @@ SELECT category_id,uppercats,commentable,global_rank
(
array
(
- 'forbidden_categories' => 'category_id',
- 'visible_categories' => 'category_id'
+ 'forbidden_categories' => 'id',
+ 'visible_categories' => 'id'
),
'AND'
).'
;';
-$result = pwg_query($query);
-$related_categories = array();
-while ($row = pwg_db_fetch_assoc($result))
-{
- $row['commentable'] = get_boolean($row['commentable']);
- array_push($related_categories, $row);
-}
+$related_categories = array_from_query($query);
usort($related_categories, 'global_rank_compare');
//-------------------------first, prev, current, next & last picture management
$picture = array();