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
This commit is contained in:
plegall 2006-02-13 21:51:22 +00:00
parent c4cb551358
commit 01b388d518

View file

@ -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($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 '';
}
list( $year,$month,$day ) = explode( '-', $date );
$unixtime = mktime( 0, 0, 0, $month, $day, $year );
$diff = time() - $unixtime;
$day_in_seconds = 24*60*60;