source: trunk/tags.php @ 2107

Last change on this file since 2107 was 2107, checked in by rvelices, 17 years ago
  • admin, comments and tags pages include page_header later in the code (as in picture and index) allowing plugins to change the header until the very end
  • fix in admin.php : picture_modify requires cache invalidation
  • fix in site_update.php : some echo func calls changed to $template->output .= ...
  • upgraded prototype.js to latest version 1.5.1.1
  • 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: 4.0 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | PhpWebGallery - a PHP based picture gallery                           |
4// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
5// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
6// +-----------------------------------------------------------------------+
7// | branch        : BSF (Best So Far)
8// | file          : $Id: tags.php 2107 2007-09-27 22:46:17Z rvelices $
9// | last update   : $Date: 2007-09-27 22:46:17 +0000 (Thu, 27 Sep 2007) $
10// | last modifier : $Author: rvelices $
11// | revision      : $Revision: 2107 $
12// +-----------------------------------------------------------------------+
13// | This program is free software; you can redistribute it and/or modify  |
14// | it under the terms of the GNU General Public License as published by  |
15// | the Free Software Foundation                                          |
16// |                                                                       |
17// | This program is distributed in the hope that it will be useful, but   |
18// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
19// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
20// | General Public License for more details.                              |
21// |                                                                       |
22// | You should have received a copy of the GNU General Public License     |
23// | along with this program; if not, write to the Free Software           |
24// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
25// | USA.                                                                  |
26// +-----------------------------------------------------------------------+
27
28// +-----------------------------------------------------------------------+
29// |                             functions                                 |
30// +-----------------------------------------------------------------------+
31
32function counter_compare($a, $b)
33{
34  if ($a['counter'] == $b['counter'])
35  {
36    return id_compare($a, $b);
37  }
38
39  return ($a['counter'] < $b['counter']) ? +1 : -1;
40}
41
42function id_compare($a, $b)
43{
44  return ($a['id'] < $b['id']) ? -1 : 1;
45}
46
47// +-----------------------------------------------------------------------+
48// |                           initialization                              |
49// +-----------------------------------------------------------------------+
50
51define('PHPWG_ROOT_PATH','./');
52include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
53
54check_status(ACCESS_GUEST);
55
56// +-----------------------------------------------------------------------+
57// |                       page header and options                         |
58// +-----------------------------------------------------------------------+
59
60$title= l10n('Tags');
61$page['body_id'] = 'theTagsPage';
62
63$template->set_filenames(array('tags'=>'tags.tpl'));
64$template->assign_vars(
65  array(
66    'U_HOME' => make_index_url(),
67    )
68  );
69
70// +-----------------------------------------------------------------------+
71// |                        tag cloud construction                         |
72// +-----------------------------------------------------------------------+
73
74// find all tags available for the current user
75$tags = get_available_tags();
76
77// we want only the first most represented tags, so we sort them by counter
78// and take the first tags
79usort($tags, 'counter_compare');
80$tags = array_slice($tags, 0, $conf['full_tag_cloud_items_number']);
81
82// depending on its counter and the other tags counter, each tag has a level
83$tags = add_level_to_tags($tags);
84
85// we want tags diplayed in alphabetic order
86usort($tags, 'name_compare');
87
88// display sorted tags
89foreach ($tags as $tag)
90{
91  $template->assign_block_vars(
92    'tag',
93    array(
94      'URL' => make_index_url(
95        array(
96          'tags' => array($tag),
97          )
98        ),
99
100      'NAME' => $tag['name'],
101      'TITLE' => $tag['counter'],
102      'CLASS' => 'tagLevel'.$tag['level'],
103      )
104    );
105}
106
107include(PHPWG_ROOT_PATH.'include/page_header.php');
108$template->parse('tags');
109include(PHPWG_ROOT_PATH.'include/page_tail.php');
110?>
Note: See TracBrowser for help on using the repository browser.