Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
bug 1579: admins should see all user comments on picture.php, validat…
…ed or not.

git-svn-id: http://piwigo.org/svn/trunk@5654 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
plegall committed Apr 4, 2010
1 parent 8006710 commit dd843c7
Showing 1 changed file with 25 additions and 15 deletions.
40 changes: 25 additions & 15 deletions include/picture_comment.inc.php
Expand Up @@ -88,11 +88,23 @@

if ($page['show_comments'])
{
if ( !is_admin() )
{
$validated_clause = ' AND validated = \'true\'';
}
else
{
$validated_clause = '';
}

// number of comments for this picture
$query = '
SELECT COUNT(*) AS nb_comments
SELECT
COUNT(*) AS nb_comments
FROM '.COMMENTS_TABLE.'
WHERE image_id='.$page['image_id']." AND validated = 'true'";
WHERE image_id = '.$page['image_id']
.$validated_clause.'
;';
$row = pwg_db_fetch_assoc( pwg_query( $query ) );

// navigation bar creation
Expand All @@ -118,23 +130,21 @@

if ($row['nb_comments'] > 0)
{
if ( !is_admin() )
{
$validated_clause = ' AND validated = \'true\'';
}
else
{
$validated_clause = '';
}

$query = '
SELECT com.id,author,author_id,'.$conf['user_fields']['username'].' AS username,
date,image_id,content,validated
SELECT
com.id,
author,
author_id,
'.$conf['user_fields']['username'].' AS username,
date,
image_id,
content,
validated
FROM '.COMMENTS_TABLE.' AS com
LEFT JOIN '.USERS_TABLE.' AS u
ON u.'.$conf['user_fields']['id'].' = author_id
WHERE image_id = '.$page['image_id'].
$validated_clause.'
WHERE image_id = '.$page['image_id'].'
'.$validated_clause.'
ORDER BY date ASC
LIMIT '.$conf['nb_comment_page'].' OFFSET '.$page['start'].'
;';
Expand Down

0 comments on commit dd843c7

Please sign in to comment.