mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-06-02 04:15:05 +02:00
0000662: Recent elements don't use sometimes time and not truncated datetime
& Standardize system date used git-svn-id: http://piwigo.org/svn/trunk@1876 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -39,7 +39,7 @@ SELECT
|
|||||||
date_last, max_date_last, count_images, count_categories, global_rank
|
date_last, max_date_last, count_images, count_categories, global_rank
|
||||||
FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.'
|
FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.'
|
||||||
ON id = cat_id and user_id = '.$user['id'].'
|
ON id = cat_id and user_id = '.$user['id'].'
|
||||||
WHERE date_last > SUBDATE(
|
WHERE date_last >= SUBDATE(
|
||||||
CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY
|
CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY
|
||||||
)
|
)
|
||||||
'.get_sql_condition_FandF
|
'.get_sql_condition_FandF
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ WHERE ';
|
|||||||
category_id IN ('.$filter['visible_categories'].') and';
|
category_id IN ('.$filter['visible_categories'].') and';
|
||||||
}
|
}
|
||||||
$query.= '
|
$query.= '
|
||||||
date_available > SUBDATE(
|
date_available >= SUBDATE(
|
||||||
CURRENT_DATE,INTERVAL '.$filter['recent_period'].' DAY)';
|
CURRENT_DATE,INTERVAL '.$filter['recent_period'].' DAY)';
|
||||||
|
|
||||||
$filter['visible_images'] = implode(',', array_from_query($query, 'image_id'));
|
$filter['visible_images'] = implode(',', array_from_query($query, 'image_id'));
|
||||||
|
|||||||
@@ -55,10 +55,17 @@ function get_icon($date, $is_child_date = false)
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$diff = time() - $unixtime;
|
if (!isset($page['get_icon_cache']['unix_timestamp']))
|
||||||
|
{
|
||||||
|
// Use MySql date in order to standardize all recent "actions/queries"
|
||||||
|
list($page['get_icon_cache']['unix_timestamp']) =
|
||||||
|
mysql_fetch_array(pwg_query('select UNIX_TIMESTAMP(CURRENT_DATE)'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$diff = $page['get_icon_cache']['unix_timestamp'] - $unixtime;
|
||||||
$day_in_seconds = 24*60*60;
|
$day_in_seconds = 24*60*60;
|
||||||
$page['get_icon_cache'][$date] = false;
|
$page['get_icon_cache'][$date] = false;
|
||||||
if ( $diff < $user['recent_period'] * $day_in_seconds )
|
if ( $diff <= $user['recent_period'] * $day_in_seconds )
|
||||||
{
|
{
|
||||||
if ( !isset($page['get_icon_cache']['_icons_'] ) )
|
if ( !isset($page['get_icon_cache']['_icons_'] ) )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -557,8 +557,9 @@ SELECT image_id
|
|||||||
SELECT DISTINCT(id)
|
SELECT DISTINCT(id)
|
||||||
FROM '.IMAGES_TABLE.'
|
FROM '.IMAGES_TABLE.'
|
||||||
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
|
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
|
||||||
WHERE date_available > \''.
|
WHERE
|
||||||
date('Y-m-d', time() - 60*60*24*$user['recent_period']).'\'
|
date_available >= SUBDATE(
|
||||||
|
CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)
|
||||||
'.$forbidden.'
|
'.$forbidden.'
|
||||||
'.$conf['order_by'].'
|
'.$conf['order_by'].'
|
||||||
;';
|
;';
|
||||||
|
|||||||
Reference in New Issue
Block a user