aboutsummaryrefslogtreecommitdiffstats
path: root/admin/comments.php
diff options
context:
space:
mode:
authornikrou <nikrou@piwigo.org>2009-06-23 21:18:16 +0000
committernikrou <nikrou@piwigo.org>2009-06-23 21:18:16 +0000
commit64c872a83e726ec4d298be479b57dae13fb2c0c6 (patch)
tree6478da0a8067f078905038c312767690b440487c /admin/comments.php
parent1ce50505e4b9a6b533146e70902a7e426fd872a7 (diff)
Feature 1026 step 2 :
add author_id column so that guest cannot modify old users comments git-svn-id: http://piwigo.org/svn/trunk@3450 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/comments.php')
-rw-r--r--admin/comments.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/admin/comments.php b/admin/comments.php
index bbd616982..d62b4aca3 100644
--- a/admin/comments.php
+++ b/admin/comments.php
@@ -134,10 +134,12 @@ $template->assign(
$list = array();
$query = '
-SELECT c.id, c.image_id, c.date, c.author, c.content, i.path, i.tn_ext
+SELECT c.id, c.image_id, c.date, c.author, u.username, c.content, i.path, i.tn_ext
FROM '.COMMENTS_TABLE.' AS c
INNER JOIN '.IMAGES_TABLE.' AS i
ON i.id = c.image_id
+ LEFT JOIN '.USERS_TABLE.' AS u
+ ON u.id = c.author_id
WHERE validated = \'false\'
ORDER BY c.date DESC
;';
@@ -151,6 +153,14 @@ while ($row = mysql_fetch_assoc($result))
'tn_ext'=>@$row['tn_ext']
)
);
+ if (empty($row['author_id']))
+ {
+ $author_name = $row['author'];
+ }
+ else
+ {
+ $author_name = $row['username'];
+ }
$template->append(
'comments',
array(
@@ -159,7 +169,7 @@ while ($row = mysql_fetch_assoc($result))
'&amp;image_id='.$row['image_id'],
'ID' => $row['id'],
'TN_SRC' => $thumb,
- 'AUTHOR' => trigger_event('render_comment_author', $row['author']),
+ 'AUTHOR' => trigger_event('render_comment_author', $author_name),
'DATE' => format_date($row['date'], true),
'CONTENT' => trigger_event('render_comment_content',$row['content'])
)