From da21a99873a5fd74e4d476fdc948bb052a267949 Mon Sep 17 00:00:00 2001 From: rvelices Date: Fri, 10 Feb 2006 02:10:41 +0000 Subject: feature 77: standard navigation link - finalized 3 small fixes: simplified code (unnecessary $page['tab_expand']), urls in comments (at end of line nl2br issue+regex+html 4 validated) and $page['where'] correction for most_visited git-svn-id: http://piwigo.org/svn/trunk@1031 68402e56-0260-453c-a942-63ccdbb3a9ee --- category.php | 22 ++------------- include/functions_category.inc.php | 19 +++++++------ include/functions_html.inc.php | 57 ++++++++++++++++++++++---------------- template/yoga/category.tpl | 6 ++-- template/yoga/picture.tpl | 8 +++--- template/yoga/search.tpl | 2 +- 6 files changed, 54 insertions(+), 60 deletions(-) diff --git a/category.php b/category.php index ba7e741eb..d90e76886 100644 --- a/category.php +++ b/category.php @@ -88,24 +88,6 @@ SELECT DISTINCT(id) fill_caddie(array_from_query($query, 'id')); } -// creation of the array containing the cat ids to expand in the menu -// $page['tab_expand'] contains an array with the category ids -// $page['expand'] contains the string to display in URL with comma -$page['tab_expand'] = array(); -if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) ) -{ - // the category displayed (in the URL cat=23) must be seen in the menu -> - // parent categories must be expanded - $uppercats = explode( ',', $page['uppercats'] ); - foreach ( $uppercats as $uppercat ) { - array_push( $page['tab_expand'], $uppercat ); - } -} -// in case of expanding all authorized cats $page['tab_expand'] is empty -if ( $user['expand'] ) -{ - $page['tab_expand'] = array(); -} //----------------------------------------------------- template initialization // // Start output of page @@ -300,6 +282,7 @@ $template->assign_block_vars('summary', array( 'TITLE'=>$lang['hint_search'], 'NAME'=>$lang['search'], 'U_SUMMARY'=> 'search.php', +'REL'=> 'rel="search"' )); // comments link @@ -322,7 +305,8 @@ $template->assign_block_vars( array( 'TITLE'=>l10n('notification'), 'NAME'=>l10n('Notification'), - 'U_SUMMARY'=> PHPWG_ROOT_PATH.'notification.php' + 'U_SUMMARY'=> PHPWG_ROOT_PATH.'notification.php', + 'REL'=> 'rel="nofollow"' )); if (isset($page['cat']) diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php index 9e0e16a1d..351fa1007 100644 --- a/include/functions_category.inc.php +++ b/include/functions_category.inc.php @@ -132,9 +132,9 @@ SELECT name,id,date_last,nb_images,global_rank { $query.= ' AND (id_uppercat is NULL'; - if (isset ($page['tab_expand']) and count($page['tab_expand']) > 0) + if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) ) { - $query.= ' OR id_uppercat IN ('.implode(',',$page['tab_expand']).')'; + $query.= ' OR id_uppercat IN ('.$page['uppercats'].')'; } $query.= ')'; } @@ -323,12 +323,12 @@ function get_category_preferred_image_orders() { global $conf; return array( - array('Default', '', true), - array(get_lang('best_rated_cat'), 'average_rate DESC', $conf['rate']), - array(get_lang('most_visited_cat'), 'hit DESC', true), - array(get_lang('Creation date'), 'date_creation DESC', true), - array(get_lang('Availability date'), 'date_available DESC', true), - array(get_lang('File name'), 'file ASC', true) + array('Default', '', true), + array(l10n('best_rated_cat'), 'average_rate DESC', $conf['rate']), + array(l10n('most_visited_cat'), 'hit DESC', true), + array(l10n('Creation date'), 'date_creation DESC', true), + array(l10n('Availability date'), 'date_available DESC', true), + array(l10n('File name'), 'file ASC', true) ); } @@ -371,6 +371,7 @@ function initialize_category( $calling_page = 'category' ) $page['cat_site_id'] = $result['site_id']; $page['cat_uploadable'] = $result['uploadable']; $page['cat_commentable'] = $result['commentable']; + $page['cat_id_uppercat'] = $result['id_uppercat']; $page['uppercats'] = $result['uppercats']; $page['title'] = get_cat_display_name($page['cat_name'], @@ -468,7 +469,7 @@ SELECT COUNT(DISTINCT(id)) AS nb_total_images $page['where'] = 'WHERE hit > 0'; if (isset($forbidden)) { - $page['where'] = "\n".' AND '.$forbidden; + $page['where'] .= "\n".' AND '.$forbidden; } $conf['order_by'] = ' ORDER BY hit DESC, file ASC'; diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php index bee99f92f..e53e5e2f1 100644 --- a/include/functions_html.inc.php +++ b/include/functions_html.inc.php @@ -81,7 +81,7 @@ function create_navigation_bar($url, $nb_element, $start, if ($cur_page != 1) { $navbar.= ''.$lang['first_page']; $navbar.= ''; } @@ -95,7 +95,11 @@ function create_navigation_bar($url, $nb_element, $start, { $previous = $start - $nb_element_page; $navbar.= ''; } @@ -103,12 +107,12 @@ function create_navigation_bar($url, $nb_element, $start, { $navbar.= $lang['previous_page']; } - $navbar.= ' | '; + $navbar.= ' |'; if ($cur_page > $pages_around + 1) { $navbar.= ' 1'; if ($cur_page > $pages_around + 2) { @@ -129,16 +133,12 @@ function create_navigation_bar($url, $nb_element, $start, { $temp_start = ($i - 1) * $nb_element_page; $navbar.= ' 0) { - $navbar.= ' rel="prev"'; - } - if ($i == $cur_page + 1) - { - $navbar.= ' rel="next"'; + $navbar.= '&start='.$temp_start; } + $navbar.= '" class="'.$link_class.'"'; $navbar.='>'.$i.''; } else @@ -182,7 +182,7 @@ function create_navigation_bar($url, $nb_element, $start, $temp_start = ($maximum - 1) * $nb_element_page; $navbar.= ''.$lang['last_page']; + $navbar.= '" class="'.$link_class.'" rel="last">'.$lang['last_page']; $navbar.= ''; } else @@ -350,6 +350,11 @@ function get_html_menu_category($categories) $level = 0; $menu = ''; + $page_cat = 0; + if (isset($page['cat']) and is_numeric($page['cat']) ) + { + $page_cat = $page['cat']; + } foreach ($categories as $category) { $level = substr_count($category['global_rank'], '.') + 1; @@ -370,16 +375,19 @@ function get_html_menu_category($categories) $ref_level = $level; $menu.= "\n\n".''.$category['name'].''; + $menu.= "\n".''; if ($category['nb_images'] > 0) { @@ -408,11 +416,11 @@ function get_html_menu_category($categories) */ function parse_comment_content($content) { - $content = nl2br($content); - - $pattern = '/(http?:\/\/\S*)/'; - $replacement = '$1'; + $pattern = '/(https?:\/\/\S*)/'; + $replacement = '$1'; $content = preg_replace($pattern, $replacement, $content); + + $content = nl2br($content); // replace _word_ by an underlined word $pattern = '/\b_(\S*)_\b/'; @@ -425,10 +433,11 @@ function parse_comment_content($content) $content = preg_replace($pattern, $replacement, $content); // replace /word/ by an italic word - $pattern = "/\/(\S*)\/(\s)/"; - $replacement = '$1$2'; - $content = preg_replace($pattern, $replacement, $content); + $pattern = "/\/(\S*)\/(\s)/"; + $replacement = '$1$2'; + $content = preg_replace($pattern, $replacement, $content); + $content = '
'.$content.'
'; return $content; } diff --git a/template/yoga/category.tpl b/template/yoga/category.tpl index 263342408..39056d720 100644 --- a/template/yoga/category.tpl +++ b/template/yoga/category.tpl @@ -34,7 +34,7 @@
    -
  • {summary.NAME}
  • +
  • {summary.NAME}
  • {L_UPLOAD}
  • @@ -50,10 +50,10 @@
      -
    • {L_REGISTER}
    • +
    • {L_REGISTER}
    • -
    • {lang:Connection}
    • +
    • {lang:Connection}
    • {L_LOGOUT}
    • diff --git a/template/yoga/picture.tpl b/template/yoga/picture.tpl index 1c6387ee6..b68d23a13 100644 --- a/template/yoga/picture.tpl +++ b/template/yoga/picture.tpl @@ -3,7 +3,7 @@
      -
      {L_HOME}{LEVEL_SEPARATOR}{CATEGORY}
      +
      {L_HOME}{LEVEL_SEPARATOR}{CATEGORY}
      {PHOTO}

      {TITLE}

      @@ -35,17 +35,17 @@ diff --git a/template/yoga/search.tpl b/template/yoga/search.tpl index 648fa12c9..17573e0c5 100644 --- a/template/yoga/search.tpl +++ b/template/yoga/search.tpl @@ -3,7 +3,7 @@
      • (?)
      • -
      • {lang:home}
      • +
      • {lang:home}

      {lang:Search}

      -- cgit v1.2.3