diff options
author | rvelices <rv-github@modusoptimus.com> | 2008-07-01 02:09:21 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2008-07-01 02:09:21 +0000 |
commit | d91d0ac444a08c664d05c00a8593fc88fbb0c605 (patch) | |
tree | 7f560292f25e68b67604def548d2db595228bb94 /tags.php | |
parent | 1d3706a42171b409e9d455194ee96d3fc87479a4 (diff) |
- remember me cookie security improvement (the time when the cookie was generated is saved and checked in range [now-remember_me_length; now]
- tags improvements
* pass to templates all fields in table #tags (handy for plugins such as type tags)
* fix issue with tag letter when first letter is accentuated (utf-8)
* tags are sorted on url_name instead of name (accentuated first letter chars are the same as without accent)
* better use of columns in by letter display mode
git-svn-id: http://piwigo.org/svn/trunk@2409 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'tags.php')
-rw-r--r-- | tags.php | 60 |
1 files changed, 30 insertions, 30 deletions
@@ -84,12 +84,12 @@ $tags = get_available_tags(); if ($page['display_mode'] == 'letters') { // we want tags diplayed in alphabetic order - usort($tags, 'name_compare'); + usort($tags, 'tag_alpha_compare'); $current_letter = null; - $is_first_tag = true; $nb_tags = count($tags); - $current_column_tags = 0; + $current_column = 1; + $current_tag_idx = 0; $letter = array( 'tags' => array() @@ -97,21 +97,21 @@ if ($page['display_mode'] == 'letters') { foreach ($tags as $tag) { - $tag_letter = strtoupper(substr($tag['name'], 0, 1)); + $tag_letter = strtoupper(substr($tag['url_name'], 0, 1)); - if ($is_first_tag) { + if ($current_tag_idx==0) { $current_letter = $tag_letter; $letter['TITLE'] = $tag_letter; - $is_first_tag = false; } //lettre precedente differente de la lettre suivante if ($tag_letter !== $current_letter) { - if ($current_column_tags > $nb_tags/$conf['tag_letters_column_number']) + if ($current_column<$conf['tag_letters_column_number'] + and $current_tag_idx > $current_column*$nb_tags/$conf['tag_letters_column_number'] ) { $letter['CHANGE_COLUMN'] = true; - $current_column_tags = 0; + $current_column++; } $letter['TITLE'] = $current_letter; @@ -120,7 +120,7 @@ if ($page['display_mode'] == 'letters') { 'letters', $letter ); - + $current_letter = $tag_letter; $letter = array( 'tags' => array() @@ -129,18 +129,19 @@ if ($page['display_mode'] == 'letters') { array_push( $letter['tags'], - array( - 'URL' => make_index_url( - array( - 'tags' => array($tag), - ) - ), - 'NAME' => $tag['name'], - 'COUNTER' => $tag['counter'], + array_merge( + $tag, + array( + 'URL' => make_index_url( + array( + 'tags' => array($tag), + ) + ), + ) ) ); - - $current_column_tags++; + + $current_tag_idx++; } // flush last letter @@ -168,23 +169,22 @@ $tags = array_slice($tags, 0, $conf['full_tag_cloud_items_number']); $tags = add_level_to_tags($tags); // we want tags diplayed in alphabetic order -usort($tags, 'name_compare'); +usort($tags, 'tag_alpha_compare'); // display sorted tags foreach ($tags as $tag) { $template->append( 'tags', - array( - 'URL' => make_index_url( - array( - 'tags' => array($tag), - ) - ), - - 'NAME' => $tag['name'], - 'TITLE' => $tag['counter'], - 'CLASS' => 'tagLevel'.$tag['level'], + array_merge( + $tag, + array( + 'URL' => make_index_url( + array( + 'tags' => array($tag), + ) + ), + ) ) ); } |