aboutsummaryrefslogtreecommitdiffstats
path: root/include/picture_comment.inc.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2010-04-04 22:50:12 +0000
committerplegall <plg@piwigo.org>2010-04-04 22:50:12 +0000
commitdd843c78230c95fb44b95239e3d440f50be3506e (patch)
treefd34c425b73bab1d6edce0e6321f921f7101bf7a /include/picture_comment.inc.php
parent80067101ca8bf487e3adc77b5405a9bdac0db71b (diff)
bug 1579: admins should see all user comments on picture.php, validated or not.
git-svn-id: http://piwigo.org/svn/trunk@5654 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/picture_comment.inc.php40
1 files changed, 25 insertions, 15 deletions
diff --git a/include/picture_comment.inc.php b/include/picture_comment.inc.php
index 2f0198b22..ac0cd9356 100644
--- a/include/picture_comment.inc.php
+++ b/include/picture_comment.inc.php
@@ -88,11 +88,23 @@ elseif ( isset($_POST['content']) )
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
@@ -118,23 +130,21 @@ SELECT COUNT(*) AS nb_comments
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'].'
;';