aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2006-02-10 02:10:41 +0000
committerrvelices <rv-github@modusoptimus.com>2006-02-10 02:10:41 +0000
commitda21a99873a5fd74e4d476fdc948bb052a267949 (patch)
tree0590e5dd81ba1577f8c1f1b7ed5d6568551d02ba
parentc8e9793412ac8207754021a69753ead23a6c29d5 (diff)
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
Diffstat (limited to '')
-rw-r--r--category.php22
-rw-r--r--include/functions_category.inc.php19
-rw-r--r--include/functions_html.inc.php57
-rw-r--r--template/yoga/category.tpl6
-rw-r--r--template/yoga/picture.tpl8
-rw-r--r--template/yoga/search.tpl2
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.= '<a href="';
- $navbar.= $url.'&amp;start=0';
+ $navbar.= $url;
$navbar.= '" class="'.$link_class.'" rel="start">'.$lang['first_page'];
$navbar.= '</a>';
}
@@ -95,7 +95,11 @@ function create_navigation_bar($url, $nb_element, $start,
{
$previous = $start - $nb_element_page;
$navbar.= '<a href="';
- $navbar.= $url.'&amp;start='.$previous;
+ $navbar.= $url;
+ if ($previous>0)
+ {
+ $navbar.= '&amp;start='.$previous;
+ }
$navbar.= '" class="'.$link_class.'" rel="prev">'.$lang['previous_page'];
$navbar.= '</a>';
}
@@ -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.= '&nbsp;<a href="';
- $navbar.= $url.'&amp;start=0';
+ $navbar.= $url;
$navbar.= '" class="'.$link_class.'">1</a>';
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.= '&nbsp;<a href="';
- $navbar.= $url.'&amp;start='.$temp_start;
- $navbar.= '" class="'.$link_class.'"';
- if ($i == $cur_page - 1)
+ $navbar.= $url;
+ if ($temp_start>0)
{
- $navbar.= ' rel="prev"';
- }
- if ($i == $cur_page + 1)
- {
- $navbar.= ' rel="next"';
+ $navbar.= '&amp;start='.$temp_start;
}
+ $navbar.= '" class="'.$link_class.'"';
$navbar.='>'.$i.'</a>';
}
else
@@ -182,7 +182,7 @@ function create_navigation_bar($url, $nb_element, $start,
$temp_start = ($maximum - 1) * $nb_element_page;
$navbar.= '<a href="';
$navbar.= $url.'&amp;start='.$temp_start;
- $navbar.= '" class="'.$link_class.'">'.$lang['last_page'];
+ $navbar.= '" class="'.$link_class.'" rel="last">'.$lang['last_page'];
$navbar.= '</a>';
}
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".'<li';
- if (isset($page['cat'])
- and is_numeric($page['cat'])
- and $category['id'] == $page['cat'])
+ if ($category['id'] == $page_cat)
{
$menu.= ' class="selected"';
}
$menu.= '>';
$url = PHPWG_ROOT_PATH.'category.php?cat='.$category['id'];
- $menu.= "\n".'<a href="'.$url.'">'.$category['name'].'</a>';
+ $menu.= "\n".'<a href="'.$url.'"';
+ if ($category['id'] == $page['cat_id_uppercat'])
+ {
+ $menu.= ' rel="up"';
+ }
+ $menu.= '>'.$category['name'].'</a>';
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 = '<a href="$1">$1</a>';
+ $pattern = '/(https?:\/\/\S*)/';
+ $replacement = '<a href="$1" rel="nofollow">$1</a>';
$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 = '<span style="font-style:italic;">$1$2</span>';
- $content = preg_replace($pattern, $replacement, $content);
+ $pattern = "/\/(\S*)\/(\s)/";
+ $replacement = '<span style="font-style:italic;">$1$2</span>';
+ $content = preg_replace($pattern, $replacement, $content);
+ $content = '<div>'.$content.'</div>';
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 @@
<dd>
<ul>
<!-- BEGIN summary -->
- <li><a href="{summary.U_SUMMARY}" title="{summary.TITLE}">{summary.NAME}</a></li>
+ <li><a href="{summary.U_SUMMARY}" title="{summary.TITLE}" {summary.REL}>{summary.NAME}</a></li>
<!-- END summary -->
<!-- BEGIN upload -->
<li><a href="{upload.U_UPLOAD}">{L_UPLOAD}</a></li>
@@ -50,10 +50,10 @@
<!-- END hello -->
<ul>
<!-- BEGIN register -->
- <li><a href="{U_REGISTER}">{L_REGISTER}</a></li>
+ <li><a href="{U_REGISTER}" rel="nofollow">{L_REGISTER}</a></li>
<!-- END register -->
<!-- BEGIN login -->
- <li><a href="{F_IDENTIFY}">{lang:Connection}</a></li>
+ <li><a href="{F_IDENTIFY}" rel="nofollow">{lang:Connection}</a></li>
<!-- END login -->
<!-- BEGIN logout -->
<li><a href="{U_LOGOUT}">{L_LOGOUT}</a></li>
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 @@
<!-- END information -->
<div id="imageHeaderBar">
- <div class="browsePath"><a href="{U_HOME}">{L_HOME}</a>{LEVEL_SEPARATOR}{CATEGORY}</div>
+ <div class="browsePath"><a href="{U_HOME}" rel="home">{L_HOME}</a>{LEVEL_SEPARATOR}{CATEGORY}</div>
<div class="imageNumber">{PHOTO}</div>
<!-- BEGIN title -->
<h2>{TITLE}</h2>
@@ -35,17 +35,17 @@
<div class="navButtons">
<!-- BEGIN last -->
- <a class="navButton prev" href="{last.U_IMG}"><img src="{themeconf:icon_dir}/last.png" class="button" alt="{lang:last_page}"></a>
+ <a class="navButton prev" href="{last.U_IMG}" rel="last"><img src="{themeconf:icon_dir}/last.png" class="button" alt="{lang:last_page}"></a>
<!-- END last -->
<!-- BEGIN next -->
<a class="navButton next" href="{next.U_IMG}" title="{L_NEXT_IMG}{next.TITLE_IMG}" rel="next"><img src="{themeconf:icon_dir}/right.png" class="button" alt="next"></a>
<!-- END next -->
- <a class="navButton up" href="{U_UP}" title="{L_UP_HINT}"><img src="{themeconf:icon_dir}/up.png" class="button" alt="{L_UP_ALT}"></a>
+ <a class="navButton up" href="{U_UP}" title="{L_UP_HINT}" rel="up"><img src="{themeconf:icon_dir}/up.png" class="button" alt="{L_UP_ALT}"></a>
<!-- BEGIN previous -->
<a class="navButton prev" href="{previous.U_IMG}" title="{L_PREV_IMG}{previous.TITLE_IMG}" rel="prev"><img src="{themeconf:icon_dir}/left.png" class="button" alt="previous"></a>
<!-- END previous -->
<!-- BEGIN first -->
- <a class="navButton prev" href="{first.U_IMG}" rel="start"><img src="{themeconf:icon_dir}/first.png" class="button" alt="{lang:first_page}"></a>
+ <a class="navButton prev" href="{first.U_IMG}" rel="first"><img src="{themeconf:icon_dir}/first.png" class="button" alt="{lang:first_page}"></a>
<!-- END first -->
</div>
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 @@
<div class="titrePage">
<ul class="categoryActions">
<li><a href="{U_HELP}" onclick="popuphelp(this.href); return false;" title="{lang:Help}"><img src="{themeconf:icon_dir}/help.png" class="button" alt="(?)"></a></li>
- <li><a href="{U_HOME}" title="{lang:return to homepage}"><img src="{themeconf:icon_dir}/home.png" class="button" alt="{lang:home}"/></a></li>
+ <li><a href="{U_HOME}" title="{lang:return to homepage}" rel="home"><img src="{themeconf:icon_dir}/home.png" class="button" alt="{lang:home}"/></a></li>
</ul>
<h2>{lang:Search}</h2>
</div>