source: trunk/tags.php @ 2358

Last change on this file since 2358 was 2299, checked in by plg, 17 years ago

Bug fixed: as rvelices notified me by email, my header replacement script was
bugged (r2297 was repeating new and old header).

By the way, I've also removed the replacement keywords. We were using them
because it was a common usage with CVS but it is advised not to use them with
Subversion. Personnaly, it is a problem when I search differences between 2
Piwigo installations outside Subversion.

  • Property keywords set to Author Date Id Revision
  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Piwigo - a PHP based picture gallery                                  |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2008      Piwigo Team                  http://piwigo.org |
6// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
7// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
8// +-----------------------------------------------------------------------+
9// | This program is free software; you can redistribute it and/or modify  |
10// | it under the terms of the GNU General Public License as published by  |
11// | the Free Software Foundation                                          |
12// |                                                                       |
13// | This program is distributed in the hope that it will be useful, but   |
14// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
15// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
16// | General Public License for more details.                              |
17// |                                                                       |
18// | You should have received a copy of the GNU General Public License     |
19// | along with this program; if not, write to the Free Software           |
20// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
21// | USA.                                                                  |
22// +-----------------------------------------------------------------------+
23
24// +-----------------------------------------------------------------------+
25// |                             functions                                 |
26// +-----------------------------------------------------------------------+
27
28function counter_compare($a, $b)
29{
30  if ($a['counter'] == $b['counter'])
31  {
32    return id_compare($a, $b);
33  }
34
35  return ($a['counter'] < $b['counter']) ? +1 : -1;
36}
37
38function id_compare($a, $b)
39{
40  return ($a['id'] < $b['id']) ? -1 : 1;
41}
42
43// +-----------------------------------------------------------------------+
44// |                           initialization                              |
45// +-----------------------------------------------------------------------+
46
47define('PHPWG_ROOT_PATH','./');
48include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
49
50check_status(ACCESS_GUEST);
51
52// +-----------------------------------------------------------------------+
53// |                       page header and options                         |
54// +-----------------------------------------------------------------------+
55
56$title= l10n('Tags');
57$page['body_id'] = 'theTagsPage';
58
59$template->set_filenames(array('tags'=>'tags.tpl'));
60
61// +-----------------------------------------------------------------------+
62// |                        tag cloud construction                         |
63// +-----------------------------------------------------------------------+
64
65// find all tags available for the current user
66$tags = get_available_tags();
67
68// we want only the first most represented tags, so we sort them by counter
69// and take the first tags
70usort($tags, 'counter_compare');
71$tags = array_slice($tags, 0, $conf['full_tag_cloud_items_number']);
72
73// depending on its counter and the other tags counter, each tag has a level
74$tags = add_level_to_tags($tags);
75
76// we want tags diplayed in alphabetic order
77usort($tags, 'name_compare');
78
79// display sorted tags
80foreach ($tags as $tag)
81{
82  $template->append(
83    'tags',
84    array(
85      'URL' => make_index_url(
86        array(
87          'tags' => array($tag),
88          )
89        ),
90
91      'NAME' => $tag['name'],
92      'TITLE' => $tag['counter'],
93      'CLASS' => 'tagLevel'.$tag['level'],
94      )
95    );
96}
97
98include(PHPWG_ROOT_PATH.'include/page_header.php');
99$template->pparse('tags');
100include(PHPWG_ROOT_PATH.'include/page_tail.php');
101?>
Note: See TracBrowser for help on using the repository browser.