Ignore:
Timestamp:
Dec 8, 2006, 12:21:54 AM (17 years ago)
Author:
rvelices
Message:
  • remove #user_cache_categories.is_child_date_last
  • optimize code in get_icon
  • correct css font-wigth:italic to font-style:italic
  • aditionnal check on $confauthorize_remembering before allowing auto_login
File:
1 edited

Legend:

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

    r1624 r1641  
    2727function get_icon($date, $is_child_date = false)
    2828{
    29   global $page, $user, $conf, $lang;
     29  global $page, $user, $lang;
    3030
    3131  if (empty($date))
    3232  {
    33     $date = 'NULL';
    34   }
    35 
    36   if (isset($page['get_icon_cache'][$is_child_date][$date]))
    37   {
    38     return $page['get_icon_cache'][$is_child_date][$date];
     33    return '';
     34  }
     35
     36  if (isset($page['get_icon_cache'][$date]))
     37  {
     38    if (! $page['get_icon_cache'][$date] )
     39      return '';
     40    return $page['get_icon_cache']['_icons_'][$is_child_date];
    3941  }
    4042
    4143  if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})/', $date, $matches))
    42   {
    43     // date can be empty, no icon to display
    44     $page['get_icon_cache'][$is_child_date][$date] = '';
    45     return $page['get_icon_cache'][$is_child_date][$date];
     44  {// date can be empty, no icon to display
     45    $page['get_icon_cache'][$date] = false;
     46    return '';
    4647  }
    4748
    4849  list($devnull, $year, $month, $day) = $matches;
    4950  $unixtime = mktime( 0, 0, 0, $month, $day, $year );
    50 
    5151  if ($unixtime === false  // PHP 5.1.0 and above
    5252      or $unixtime === -1) // PHP prior to 5.1.0
    5353  {
    54     $page['get_icon_cache'][$is_child_date][$date] = '';
    55     return $page['get_icon_cache'][$is_child_date][$date];
     54    $page['get_icon_cache'][$date] = false;
     55    return '';
    5656  }
    5757
    5858  $diff = time() - $unixtime;
    5959  $day_in_seconds = 24*60*60;
    60   $output = '';
    61   $title = $lang['recent_image'].' ';
     60  $page['get_icon_cache'][$date] = false;
    6261  if ( $diff < $user['recent_period'] * $day_in_seconds )
    6362  {
    64     $icon_url = get_themeconf('icon_dir').'/'.($is_child_date ? 'recent_by_child.png' : 'recent.png');
    65     $title .= $user['recent_period'];
    66     $title .=  '&nbsp;'.$lang['days'];
    67     $size = getimagesize( PHPWG_ROOT_PATH.$icon_url );
    68     $icon_url = get_root_url().$icon_url;
    69     $output = '<img title="'.$title.'" src="'.$icon_url.'" class="icon" style="border:0;';
    70     $output.= 'height:'.$size[1].'px;width:'.$size[0].'px" alt="(!)" />';
    71   }
    72 
    73   $page['get_icon_cache'][$is_child_date][$date] = $output;
    74 
    75   return $page['get_icon_cache'][$is_child_date][$date];
    76 }
     63    if ( !isset($page['get_icon_cache']['_icons_'] ) )
     64    {
     65      $icons = array(false => 'recent', true => 'recent_by_child' );
     66      $title = $lang['recent_image'].'&nbsp;'.$user['recent_period']
     67          .'&nbsp;'.$lang['days'];
     68      foreach ($icons as $key => $icon)
     69      {
     70        $icon_url = get_themeconf('icon_dir').'/'.$icon.'.png';
     71        $size = getimagesize( PHPWG_ROOT_PATH.$icon_url );
     72        $icon_url = get_root_url().$icon_url;
     73        $output = '<img title="'.$title.'" src="'.$icon_url.'" class="icon" style="border:0;';
     74        $output.= 'height:'.$size[1].'px;width:'.$size[0].'px" alt="(!)" />';
     75        $page['get_icon_cache']['_icons_'][$key] = $output;
     76      }
     77    }
     78    $page['get_icon_cache'][$date] = true;
     79  }
     80  if (! $page['get_icon_cache'][$date] )
     81    return '';
     82  return $page['get_icon_cache']['_icons_'][$is_child_date];
     83}
     84
    7785
    7886function create_navigation_bar(
     
    393401 * HTML code generated uses logical list tags ul and each category is an
    394402 * item li. The paramter given is the category informations as an array,
    395  * used keys are : id, name, nb_images, max_date_last, is_child_date_last,
     403 * used keys are : id, name, nb_images, max_date_last, date_last
    396404 * count_images, count_categories
    397405 *
     
    474482      $menu.= '</span>';
    475483    }
    476 
    477     $menu.= get_icon($category['max_date_last'], $category['is_child_date_last']);
     484    $child_date_last = isset($category['date_last'])
     485        and $category['max_date_last']>$category['date_last'] ;
     486    $menu.= get_icon($category['max_date_last'], $child_date_last);
    478487  }
    479488
Note: See TracChangeset for help on using the changeset viewer.