Changeset 1876


Ignore:
Timestamp:
Mar 7, 2007, 7:51:58 PM (17 years ago)
Author:
rub
Message:

0000662: Recent elements don't use sometimes time and not truncated datetime
&
Standardize system date used

Location:
trunk/include
Files:
4 edited

Legend:

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

    r1873 r1876  
    4040  FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.'
    4141  ON id = cat_id and user_id = '.$user['id'].'
    42   WHERE date_last > SUBDATE(
     42  WHERE date_last >= SUBDATE(
    4343    CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY
    4444  )
  • trunk/include/filter.inc.php

    r1860 r1876  
    9696    }
    9797  $query.= '
    98     date_available  > SUBDATE(
     98    date_available >= SUBDATE(
    9999      CURRENT_DATE,INTERVAL '.$filter['recent_period'].' DAY)';
    100100
  • trunk/include/functions_html.inc.php

    r1866 r1876  
    5656  }
    5757
    58   $diff = time() - $unixtime;
     58  if (!isset($page['get_icon_cache']['unix_timestamp']))
     59  {
     60    // 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;
    5966  $day_in_seconds = 24*60*60;
    6067  $page['get_icon_cache'][$date] = false;
    61   if ( $diff < $user['recent_period'] * $day_in_seconds )
     68  if ( $diff <= $user['recent_period'] * $day_in_seconds )
    6269  {
    6370    if ( !isset($page['get_icon_cache']['_icons_'] ) )
  • trunk/include/section_init.inc.php

    r1866 r1876  
    558558  FROM '.IMAGES_TABLE.'
    559559    INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
    560   WHERE date_available > \''.
    561       date('Y-m-d', time() - 60*60*24*$user['recent_period']).'\'
     560  WHERE
     561    date_available >= SUBDATE(
     562      CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)
    562563    '.$forbidden.'
    563564  '.$conf['order_by'].'
Note: See TracChangeset for help on using the changeset viewer.