aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2006-02-13 21:51:22 +0000
committerplegall <plg@piwigo.org>2006-02-13 21:51:22 +0000
commit01b388d518d664eea52ce8678d5da3df7e44f2ab (patch)
treeb6e2693506afebeeaeb22bd6e2d168752e8227f4
parentc4cb551358ac8b81b3ea1dcab51b618ea058661f (diff)
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
-rw-r--r--include/functions_html.inc.php14
1 files 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;