aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/comments.php4
-rw-r--r--admin/themes/default/template/comments.tpl2
-rw-r--r--include/functions_comment.inc.php10
3 files changed, 9 insertions, 7 deletions
diff --git a/admin/comments.php b/admin/comments.php
index 7a5ec4642..2666cc27b 100644
--- a/admin/comments.php
+++ b/admin/comments.php
@@ -167,7 +167,8 @@ SELECT
c.content,
i.path,
i.representative_ext,
- validated
+ validated,
+ c.anonymous_id
FROM '.COMMENTS_TABLE.' AS c
INNER JOIN '.IMAGES_TABLE.' AS i
ON i.id = c.image_id
@@ -204,6 +205,7 @@ while ($row = pwg_db_fetch_assoc($result))
'DATE' => format_date($row['date'], array('day_name','day','month','year','time')),
'CONTENT' => trigger_change('render_comment_content',$row['content']),
'IS_PENDING' => ('false' == $row['validated']),
+ 'IP' => $row['anonymous_id'],
)
);
diff --git a/admin/themes/default/template/comments.tpl b/admin/themes/default/template/comments.tpl
index 3b3a40422..6e0c351c2 100644
--- a/admin/themes/default/template/comments.tpl
+++ b/admin/themes/default/template/comments.tpl
@@ -65,7 +65,7 @@ jQuery(document).ready(function(){
<td>
<div class="comment">
<a class="illustration" href="{$comment.U_PICTURE}"><img src="{$comment.TN_SRC}"></a>
- <p class="commentHeader">{if $comment.IS_PENDING}<span class="pendingFlag">{'Waiting'|@translate}</span> - {/if}<strong>{$comment.AUTHOR}</strong> - <em>{$comment.DATE}</em></p>
+ <p class="commentHeader">{if $comment.IS_PENDING}<span class="pendingFlag">{'Waiting'|@translate}</span> - {/if}{if !empty($comment.IP)}{$comment.IP} - {/if}<strong>{$comment.AUTHOR}</strong> - <em>{$comment.DATE}</em></p>
<blockquote>{$comment.CONTENT}</blockquote>
</div>
</td>
diff --git a/include/functions_comment.inc.php b/include/functions_comment.inc.php
index 9bd0b9f25..2dcc4fcc1 100644
--- a/include/functions_comment.inc.php
+++ b/include/functions_comment.inc.php
@@ -173,13 +173,13 @@ SELECT COUNT(*) AS user_exists
{
$comm['email'] = $user['email'];
}
- else if ($conf['comments_email_mandatory'])
+ elseif ($conf['comments_email_mandatory'])
{
$infos[] = l10n('Email address is missing. Please specify an email address.');
$comment_action='reject';
}
}
- else if (!email_check_format($comm['email']))
+ elseif (!email_check_format($comm['email']))
{
$infos[] = l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)');
$comment_action='reject';
@@ -191,7 +191,7 @@ SELECT COUNT(*) AS user_exists
{
array_pop($ip_components);
}
- $comm['anonymous_id'] = implode('.', $ip_components);
+ $anonymous_id = implode('.', $ip_components);
if ($comment_action!='reject' and $conf['anti-flood_time']>0 and !is_admin())
{ // anti-flood system
@@ -204,7 +204,7 @@ SELECT count(1) FROM '.COMMENTS_TABLE.'
if (!is_classic_user())
{
$query.= '
- AND anonymous_id = "'.$comm['anonymous_id'].'"';
+ AND anonymous_id LIKE "'.$anonymous_id.'.%"';
}
$query.= '
;';
@@ -231,7 +231,7 @@ INSERT INTO '.COMMENTS_TABLE.'
VALUES (
\''.$comm['author'].'\',
'.$comm['author_id'].',
- \''.$comm['anonymous_id'].'\',
+ \''.$comm['ip'].'\',
\''.$comm['content'].'\',
NOW(),
\''.($comment_action=='validate' ? 'true':'false').'\',