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
This commit is contained in:
nikrou
2010-06-25 19:45:19 +00:00
parent 6394613e9f
commit d7fa727afa
6 changed files with 28 additions and 7 deletions
+5 -1
View File
@@ -560,7 +560,6 @@ function boolean_to_string($var)
*
*/
function pwg_db_get_recent_period_expression($period, $date='CURRENT_DATE')
{
if ($date!='CURRENT_DATE')
@@ -580,6 +579,11 @@ SELECT '.pwg_db_get_recent_period_expression($period);
return $d;
}
function pwg_db_get_flood_period_expression($seconds)
{
return 'SUBDATE(now(), INTERVAL '.$seconds.' SECOND)';
}
function pwg_db_get_hour($date)
{
return 'hour('.$date.')';
@@ -499,6 +499,11 @@ function pwg_db_get_recent_period($period, $date='CURRENT_DATE')
return $d;
}
function pwg_db_get_flood_period_expression($seconds)
{
return 'datetime(\'now\', \'localtime\', \''.-$seconds.' seconds\')';
}
function pwg_db_get_hour($date)
{
return 'strftime(\'%H\', '.$date.')';
+5
View File
@@ -546,6 +546,11 @@ function pwg_db_get_recent_period($period, $date='CURRENT_DATE')
return $d;
}
function pwg_db_get_flood_period_expression($seconds)
{
return 'now() - \''.$seconds.' SECOND\'::interval';
}
function pwg_db_get_hour($date)
{
return 'EXTRACT(HOUR FROM '.$date.')';
+5
View File
@@ -511,6 +511,11 @@ function pwg_db_get_recent_period($period, $date='CURRENT_DATE')
return $d;
}
function pwg_db_get_flood_period_expression($seconds)
{
return 'datetime(\'now\', \'localtime\', \''.-$seconds.' seconds\')';
}
function pwg_db_get_hour($date)
{
return 'strftime(\'%H\', '.$date.')';