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:
parent
c4cb551358
commit
01b388d518
1 changed files with 12 additions and 4 deletions
|
@ -27,15 +27,23 @@
|
||||||
|
|
||||||
function get_icon( $date )
|
function get_icon( $date )
|
||||||
{
|
{
|
||||||
|
// TODO $page['icon_cache'], for each date, associate the HTML icon
|
||||||
global $user, $conf, $lang;
|
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 '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
list( $year,$month,$day ) = explode( '-', $date );
|
|
||||||
$unixtime = mktime( 0, 0, 0, $month, $day, $year );
|
|
||||||
|
|
||||||
$diff = time() - $unixtime;
|
$diff = time() - $unixtime;
|
||||||
$day_in_seconds = 24*60*60;
|
$day_in_seconds = 24*60*60;
|
||||||
|
|
Loading…
Add table
Reference in a new issue