From 64c872a83e726ec4d298be479b57dae13fb2c0c6 Mon Sep 17 00:00:00 2001 From: nikrou Date: Tue, 23 Jun 2009 21:18:16 +0000 Subject: 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 --- admin/comments.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'admin/comments.php') 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)) '&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']) ) -- cgit v1.2.3