aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrub <rub@piwigo.org>2008-01-14 21:03:17 +0000
committerrub <rub@piwigo.org>2008-01-14 21:03:17 +0000
commit972b8a1a9b161155db4c9870224019622c872ea6 (patch)
tree3c48981ad856c7ada62fa8679080da4fcb9428e6
parent99c692d3691928bbfd2f729c75f0b9e85abf9523 (diff)
Resolved issue 0000791: recent icon is wrong with winter time
git-svn-id: http://piwigo.org/svn/branches/branch-1_7@2181 68402e56-0260-453c-a942-63ccdbb3a9ee
-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 c875cfb7a..4fdbcf04a 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
)