aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_comment.inc.php
diff options
context:
space:
mode:
authornikrou <nikrou@piwigo.org>2010-06-25 19:45:19 +0000
committernikrou <nikrou@piwigo.org>2010-06-25 19:45:19 +0000
commitd7fa727afabf29f8f14824d4b1fc2f2be65bfbc3 (patch)
tree701dd822383a93073cb7115fb7ce491ea7aef087 /include/functions_comment.inc.php
parent6394613e9f99f466fb1ba98c95286a828a3cee36 (diff)
Bug 1744 fixed : Incorrect use of timezone with SQLite
Fixed anti-flood system. Merge from trunk git-svn-id: http://piwigo.org/svn/branches/2.1@6605 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_comment.inc.php')
-rw-r--r--include/functions_comment.inc.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/include/functions_comment.inc.php b/include/functions_comment.inc.php
index 67fc40716..7f2fd9257 100644
--- a/include/functions_comment.inc.php
+++ b/include/functions_comment.inc.php
@@ -133,12 +133,14 @@ SELECT COUNT(*) AS user_exists
if ($comment_action!='reject' and $conf['anti-flood_time']>0 )
{ // anti-flood system
- $reference_date = date('c', time() - $conf['anti-flood_time']);
+ $reference_date = pwg_db_get_flood_period_expression($conf['anti-flood_time']);
+
$query = '
-SELECT id FROM '.COMMENTS_TABLE.'
- WHERE date > \''.$reference_date.'\'
+SELECT count(1) FROM '.COMMENTS_TABLE.'
+ WHERE date > '.$reference_date.'
AND author_id = '.$comm['author_id'];
- if ( pwg_db_num_rows( pwg_query( $query ) ) > 0 )
+ list($counter) = pwg_db_fetch_row(pwg_query($query));
+ if ( $counter > 0 )
{
array_push( $infos, l10n('Anti-flood system : please wait for a moment before trying to post another comment') );
$comment_action='reject';