From 1cb24e744fcdd5aab89c4958c7cfa4ffa33b2248 Mon Sep 17 00:00:00 2001 From: z0rglub Date: Fri, 18 Jun 2004 23:25:06 +0000 Subject: get_icon function takes a date in YYY-MM-DD format git-svn-id: http://piwigo.org/svn/trunk@438 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/htmlfunctions.inc.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/htmlfunctions.inc.php b/include/htmlfunctions.inc.php index 25b330ff3..3c6046c99 100644 --- a/include/htmlfunctions.inc.php +++ b/include/htmlfunctions.inc.php @@ -25,27 +25,31 @@ // | USA. | // +-----------------------------------------------------------------------+ -function get_icon( $date_comparaison ) +function get_icon( $date ) { global $user, $conf, $lang; - $difference = time() - $date_comparaison; - $jours = 24*60*60; + + list( $year,$month,$day ) = explode( '-', $date ); + $unixtime = mktime( 0, 0, 0, $month, $day, $year ); + + $diff = time() - $unixtime; + $day_in_seconds = 24*60*60; $output = ''; $title = $lang['recent_image'].' '; - if ( $difference < $user['long_period'] * $jours ) + if ( $diff < $user['long_period'] * $day_in_seconds ) { $icon_url = './template/'.$user['template'].'/theme/'; - if ( $difference < $user['short_period'] * $jours ) + if ( $diff < $user['short_period'] * $day_in_seconds ) { $icon_url.= 'new_short.gif'; - $title .= $user['short_period']; + $title .= $user['short_period']; } else { $icon_url.= 'new_long.gif'; - $title .= $user['long_period']; + $title .= $user['long_period']; } - $title .= ' '.$lang['days']; + $title .= ' '.$lang['days']; $size = getimagesize( $icon_url ); $output = ''; -- cgit v1.2.3