Ignore:
Timestamp:
Mar 11, 2009, 6:25:26 PM (15 years ago)
Author:
patdenice
Message:

Move get_icon function.

File:
1 edited

Legend:

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

    r3173 r3188  
    15491549  return $navbar;
    15501550}
     1551
     1552/**
     1553 * return an array which will be sent to template to display recent icon
     1554 */
     1555function get_icon($date, $is_child_date = false)
     1556{
     1557  global $cache, $user;
     1558
     1559  if (empty($date))
     1560  {
     1561    return false;
     1562  }
     1563
     1564  if (!isset($cache['get_icon']['title']))
     1565  {
     1566    $cache['get_icon']['title'] = sprintf(
     1567      l10n('elements posted during the last %d days'),
     1568      $user['recent_period']
     1569      );
     1570  }
     1571
     1572  $icon = array(
     1573    'TITLE' => $cache['get_icon']['title'],
     1574    'IS_CHILD_DATE' => $is_child_date,
     1575    );
     1576
     1577  if (isset($cache['get_icon'][$date]))
     1578  {
     1579    return $cache['get_icon'][$date] ? $icon : array();
     1580  }
     1581
     1582  if (!isset($cache['get_icon']['sql_recent_date']))
     1583  {
     1584    // Use MySql date in order to standardize all recent "actions/queries"
     1585    list($cache['get_icon']['sql_recent_date']) =
     1586      mysql_fetch_array(pwg_query('select SUBDATE(
     1587      CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)'));
     1588  }
     1589
     1590  $cache['get_icon'][$date] = $date > $cache['get_icon']['sql_recent_date'];
     1591
     1592  return $cache['get_icon'][$date] ? $icon : array();
     1593}
    15511594?>
Note: See TracChangeset for help on using the changeset viewer.