aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorrub <rub@piwigo.org>2008-01-14 21:08:26 +0000
committerrub <rub@piwigo.org>2008-01-14 21:08:26 +0000
commitaea7649f99d95c92714ac02307b9370356cd69e6 (patch)
tree03bc9638496b8d414ca20a71a70351c6b296cfcf /include
parent4cd60bf64cd8011debf91801e67c826430eb6207 (diff)
Resolved issue 0000791: recent icon is wrong with winter time
Merge branch-1_7 2180:2181 into BSF git-svn-id: http://piwigo.org/svn/trunk@2182 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/functions_html.inc.php30
1 files changed, 7 insertions, 23 deletions
diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php
index d5b0a4bf1..7394e69d9 100644
--- a/include/functions_html.inc.php
+++ b/include/functions_html.inc.php
@@ -32,7 +32,7 @@ function get_icon($date, $is_child_date = false)
{
return '';
}
-
+
if (isset($page['get_icon_cache'][$date]))
{
if (! $page['get_icon_cache'][$date] )
@@ -40,32 +40,16 @@ function get_icon($date, $is_child_date = false)
return $page['get_icon_cache']['_icons_'][$is_child_date];
}
- if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})/', $date, $matches))
- {// date can be empty, no icon to display
- $page['get_icon_cache'][$date] = false;
- return '';
- }
-
- list($devnull, $year, $month, $day) = $matches;
- $unixtime = mktime( 0, 0, 0, $month, $day, $year );
- if ($unixtime === false // PHP 5.1.0 and above
- or $unixtime === -1) // PHP prior to 5.1.0
- {
- $page['get_icon_cache'][$date] = false;
- return '';
- }
-
- if (!isset($page['get_icon_cache']['unix_timestamp']))
+ if (!isset($page['get_icon_cache']['sql_recent_date']))
{
// 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)'));
+ list($page['get_icon_cache']['sql_recent_date']) =
+ mysql_fetch_array(pwg_query('select SUBDATE(
+ CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)'));
}
- $diff = $page['get_icon_cache']['unix_timestamp'] - $unixtime;
- $day_in_seconds = 24*60*60;
$page['get_icon_cache'][$date] = false;
- if ( $diff <= $user['recent_period'] * $day_in_seconds )
+ if ( $date > $page['get_icon_cache']['sql_recent_date'] )
{
if ( !isset($page['get_icon_cache']['_icons_'] ) )
{
@@ -84,12 +68,12 @@ function get_icon($date, $is_child_date = false)
}
$page['get_icon_cache'][$date] = true;
}
+
if (! $page['get_icon_cache'][$date] )
return '';
return $page['get_icon_cache']['_icons_'][$is_child_date];
}
-
function create_navigation_bar(
$url, $nb_element, $start, $nb_element_page, $clean_url = false
)