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
This commit is contained in:
nikrou
2009-06-23 21:18:16 +00:00
parent 1ce50505e4
commit 64c872a83e
6 changed files with 127 additions and 37 deletions
+12 -2
View File
@@ -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'])
)