Changeset 1039


Ignore:
Timestamp:
Feb 13, 2006, 10:51:22 PM (18 years ago)
Author:
plg
Message:

bug 269 fixed: the icon HTML creation was bugged on recent PHP versions
because stricter on arguments of mktime function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/branch-1_5/include/functions_html.inc.php

    r1005 r1039  
    2828function get_icon( $date )
    2929{
     30  // TODO $page['icon_cache'], for each date, associate the HTML icon
    3031  global $user, $conf, $lang;
    3132
    32   if (!preg_match('/\d{4}-\d{2}-\d{2}/', $date))
    33   {
     33  if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})/', $date, $matches))
     34  {
     35    // date can be empty, no icon to display
    3436    return '';
    3537  }
    36 
    37   list( $year,$month,$day ) = explode( '-', $date );
     38 
     39  list($devnull, $year, $month, $day) = $matches;
    3840  $unixtime = mktime( 0, 0, 0, $month, $day, $year );
     41
     42  if ($unixtime === false  // PHP 5.1.0 and above
     43      or $unixtime === -1) // PHP prior to 5.1.0
     44  {
     45    return '';
     46  }
    3947 
    4048  $diff = time() - $unixtime;
Note: See TracChangeset for help on using the changeset viewer.