Changeset 2182


Ignore:
Timestamp:
Jan 14, 2008, 10:08:26 PM (16 years ago)
Author:
rub
Message:

Resolved issue 0000791: recent icon is wrong with winter time

Merge branch-1_7 2180:2181 into BSF

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_html.inc.php

    r2117 r2182  
    3333    return '';
    3434  }
    35 
     35 
    3636  if (isset($page['get_icon_cache'][$date]))
    3737  {
     
    4141  }
    4242
    43   if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})/', $date, $matches))
    44   {// date can be empty, no icon to display
    45     $page['get_icon_cache'][$date] = false;
    46     return '';
    47   }
    48 
    49   list($devnull, $year, $month, $day) = $matches;
    50   $unixtime = mktime( 0, 0, 0, $month, $day, $year );
    51   if ($unixtime === false  // PHP 5.1.0 and above
    52       or $unixtime === -1) // PHP prior to 5.1.0
    53   {
    54     $page['get_icon_cache'][$date] = false;
    55     return '';
    56   }
    57 
    58   if (!isset($page['get_icon_cache']['unix_timestamp']))
     43  if (!isset($page['get_icon_cache']['sql_recent_date']))
    5944  {
    6045    // Use MySql date in order to standardize all recent "actions/queries"
    61     list($page['get_icon_cache']['unix_timestamp']) =
    62       mysql_fetch_array(pwg_query('select UNIX_TIMESTAMP(CURRENT_DATE)'));
    63   }
    64 
    65   $diff = $page['get_icon_cache']['unix_timestamp'] - $unixtime;
    66   $day_in_seconds = 24*60*60;
     46    list($page['get_icon_cache']['sql_recent_date']) =
     47      mysql_fetch_array(pwg_query('select SUBDATE(
     48      CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)'));
     49  }
     50
    6751  $page['get_icon_cache'][$date] = false;
    68   if ( $diff <= $user['recent_period'] * $day_in_seconds )
     52  if ( $date > $page['get_icon_cache']['sql_recent_date'] )
    6953  {
    7054    if ( !isset($page['get_icon_cache']['_icons_'] ) )
     
    8569    $page['get_icon_cache'][$date] = true;
    8670  }
     71
    8772  if (! $page['get_icon_cache'][$date] )
    8873    return '';
    8974  return $page['get_icon_cache']['_icons_'][$is_child_date];
    9075}
    91 
    9276
    9377function create_navigation_bar(
Note: See TracChangeset for help on using the changeset viewer.