$page['get_icon_cache']['sql_recent_date'] ) { if ( !isset($page['get_icon_cache']['_icons_'] ) ) { $icons = array(false => 'recent', true => 'recent_by_child' ); $title = sprintf( l10n('elements posted during the last %d days'), $user['recent_period'] ); foreach ($icons as $key => $icon) { $icon_url = get_themeconf('icon_dir').'/'.$icon.'.png'; $size = getimagesize( PHPWG_ROOT_PATH.$icon_url ); $icon_url = get_root_url().$icon_url; $output = ''; $page['get_icon_cache']['_icons_'][$key] = $output; } } $page['get_icon_cache'][$date] = true; } if (! $page['get_icon_cache'][$date] ) return ''; return $page['get_icon_cache']['_icons_'][$is_child_date]; } function create_navigation_bar( $url, $nb_element, $start, $nb_element_page, $clean_url = false ) { global $conf; $pages_around = $conf['paginate_pages_around']; $start_str = $clean_url ? '/start-' : ( ( strstr($url, '?')===false ? '?':'&') . 'start=' ); $navbar = ''; // current page detection if (!isset($start) or !is_numeric($start) or (is_numeric($start) and $start < 0)) { $start = 0; } // navigation bar useful only if more than one page to display ! if ($nb_element > $nb_element_page) { // current page and last page $cur_page = ceil($start / $nb_element_page) + 1; $maximum = ceil($nb_element / $nb_element_page); // link to first page ? if ($cur_page != 1) { $navbar.= '' .l10n('first_page') .''; } else { $navbar.= l10n('first_page'); } $navbar.= ' | '; // link on previous page ? if ($start != 0) { $previous = $start - $nb_element_page; $navbar.= '' .l10n('previous_page') .''; } else { $navbar.= l10n('previous_page'); } $navbar.= ' |'; if ($cur_page > $pages_around + 1) { $navbar.= ' 1'; if ($cur_page > $pages_around + 2) { $navbar.= ' ...'; } } // inspired from punbb source code for ($i = $cur_page - $pages_around, $stop = $cur_page + $pages_around + 1; $i < $stop; $i++) { if ($i < 1 or $i > $maximum) { continue; } else if ($i != $cur_page) { $temp_start = ($i - 1) * $nb_element_page; $navbar.= ' ' .'' .$i .''; } else { $navbar.= ' ' .'' .$i .''; } } if ($cur_page < ($maximum - $pages_around)) { $temp_start = ($maximum - 1) * $nb_element_page; if ($cur_page < ($maximum - $pages_around - 1)) { $navbar.= ' ...'; } $navbar.= ' '.$maximum.''; } $navbar.= ' | '; // link on next page ? if ($nb_element > $nb_element_page and $start + $nb_element_page < $nb_element) { $next = $start + $nb_element_page; $navbar.= '' .l10n('next_page') .''; } else { $navbar.= l10n('next_page'); } $navbar.= ' | '; // link to last page ? if ($cur_page != $maximum) { $temp_start = ($maximum - 1) * $nb_element_page; $navbar.= '' .l10n('last_page') .''; } else { $navbar.= l10n('last_page'); } } return $navbar; } /** * returns the list of categories as a HTML string * * categories string returned contains categories as given in the input * array $cat_informations. $cat_informations array must be an array * of array( id=>?, name=>?, permalink=>?). If url input parameter is null, * returns only the categories name without links. * * @param array cat_informations * @param string url * @param boolean replace_space * @return string */ function get_cat_display_name($cat_informations, $url = '', $replace_space = true) { global $conf; $output = ''; $is_first = true; foreach ($cat_informations as $cat) { is_array($cat) or trigger_error( 'get_cat_display_name wrong type for category ', E_USER_WARNING ); if ($is_first) { $is_first = false; } else { $output.= $conf['level_separator']; } if ( !isset($url) ) { $output.= $cat['name']; } elseif ($url == '') { $output.= ''; $output.= $cat['name'].''; } else { $output.= ''; $output.= $cat['name'].''; } } if ($replace_space) { return replace_space($output); } else { return $output; } } /** * returns the list of categories as a HTML string, with cache of names * * categories string returned contains categories as given in the input * array $cat_informations. $uppercats is the list of category ids to * display in the right order. If url input parameter is empty, returns only * the categories name without links. * * @param string uppercats * @param string url * @param boolean replace_space * @return string */ function get_cat_display_name_cache($uppercats, $url = '', $replace_space = true) { global $cache, $conf; if (!isset($cache['cat_names'])) { $query = ' SELECT id, name, permalink FROM '.CATEGORIES_TABLE.' ;'; $cache['cat_names'] = hash_from_query($query, 'id'); } $output = ''; $is_first = true; foreach (explode(',', $uppercats) as $category_id) { $cat = $cache['cat_names'][$category_id]; if ($is_first) { $is_first = false; } else { $output.= $conf['level_separator']; } if ( !isset($url) ) { $output.= $cat['name']; } elseif ($url == '') { $output.= ' '.$cat['name'].''; } else { $output.= ' '.$cat['name'].''; } } if ($replace_space) { return replace_space($output); } else { return $output; } } /** * returns the HTML code for a category item in the menu (for the main page) * * HTML code generated uses logical list tags ul and each category is an * item li. The paramter given is the category informations as an array, * used keys are : id, name, nb_images, max_date_last, date_last * count_images, count_categories * * @param array categories * @return string */ function get_html_menu_category($categories, $selected_category) { $ref_level = 0; $level = 0; $menu = trigger_event('get_html_menu_category', '', $categories, $selected_category); if (strlen($menu)) { return $menu; } foreach ($categories as $category) { $level = substr_count($category['global_rank'], '.') + 1; if ($level > $ref_level) { $menu.= "\n