From 01b388d518d664eea52ce8678d5da3df7e44f2ab Mon Sep 17 00:00:00 2001 From: plegall Date: Mon, 13 Feb 2006 21:51:22 +0000 Subject: bug 269 fixed: the icon HTML creation was bugged on recent PHP versions because stricter on arguments of mktime function. git-svn-id: http://piwigo.org/svn/branches/branch-1_5@1039 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions_html.inc.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php index 50a999854..43c2b3caf 100644 --- a/include/functions_html.inc.php +++ b/include/functions_html.inc.php @@ -27,15 +27,23 @@ function get_icon( $date ) { + // TODO $page['icon_cache'], for each date, associate the HTML icon global $user, $conf, $lang; - if (!preg_match('/\d{4}-\d{2}-\d{2}/', $date)) + if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})/', $date, $matches)) { + // date can be empty, no icon to display return ''; } - - list( $year,$month,$day ) = explode( '-', $date ); + + 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 + { + return ''; + } $diff = time() - $unixtime; $day_in_seconds = 24*60*60; -- cgit v1.2.3