source: trunk/include/menubar.inc.php @ 2288

Last change on this file since 2288 was 2288, checked in by rvelices, 16 years ago
  • minor language changes and use template->assign instead of template->assign_var
  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 8.4 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-2008 PhpWebGallery Team - http://phpwebgallery.net |
6// +-----------------------------------------------------------------------+
7// | file          : $Id: menubar.inc.php 2288 2008-03-21 01:01:25Z rvelices $
8// | last update   : $Date: 2008-03-21 01:01:25 +0000 (Fri, 21 Mar 2008) $
9// | last modifier : $Author: rvelices $
10// | revision      : $Revision: 2288 $
11// +-----------------------------------------------------------------------+
12// | This program is free software; you can redistribute it and/or modify  |
13// | it under the terms of the GNU General Public License as published by  |
14// | the Free Software Foundation                                          |
15// |                                                                       |
16// | This program is distributed in the hope that it will be useful, but   |
17// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
18// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
19// | General Public License for more details.                              |
20// |                                                                       |
21// | You should have received a copy of the GNU General Public License     |
22// | along with this program; if not, write to the Free Software           |
23// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
24// | USA.                                                                  |
25// +-----------------------------------------------------------------------+
26
27/**
28 * This file is included by the main page to show the menu bar
29 *
30 */
31$template->set_filenames(
32  array(
33    'menubar' => 'menubar.tpl',
34    )
35  );
36
37trigger_action('loc_begin_menubar');
38
39$template->assign(
40  array(
41    'NB_PICTURE' => $user['nb_total_images'],
42    'MENU_CATEGORIES_CONTENT' => get_categories_menu(),
43    'U_CATEGORIES' => make_index_url(array('section' => 'categories')),
44    'U_LOST_PASSWORD' => get_root_url().'password.php',
45    )
46  );
47
48//-------------------------------------------------------------- external links
49foreach ($conf['links'] as $url => $url_data)
50{
51  if (!is_array($url_data))
52  {
53    $url_data = array('label' => $url_data);
54  }
55
56  if
57    (
58      (!isset($url_data['eval_visible']))
59      or
60      (eval($url_data['eval_visible']))
61    )
62  {
63    $tpl_var = array(
64        'URL' => $url,
65        'LABEL' => $url_data['label']
66      );
67
68    if (!isset($url_data['new_window']) or $url_data['new_window'])
69    {
70      $tpl_var['new_window'] =
71        array(
72          'NAME' => (isset($url_data['nw_name']) ? $url_data['nw_name'] : ''),
73          'FEATURES' => (isset($url_data['nw_features']) ? $url_data['nw_features'] : '')
74        );
75    }
76    $template->append('links', $tpl_var);
77  }
78}
79
80//------------------------------------------------------------------------ filter
81if (!empty($conf['filter_pages']) and get_filter_page_value('used'))
82{
83  if ($filter['enabled'])
84  {
85    $template->assign(
86      'U_STOP_FILTER',
87      add_url_params(make_index_url(array()), array('filter' => 'stop'))
88      );
89  }
90  else
91  {
92    $template->assign(
93      'U_START_FILTER',
94      add_url_params(make_index_url(array()), array('filter' => 'start-recent-'.$user['recent_period']))
95      );
96  }
97}
98
99//------------------------------------------------------------------------ tags
100if ('tags' == @$page['section'])
101{
102  // display tags associated to currently tagged items, less current tags
103  $tags = array();
104  if ( !empty($page['items']) )
105  {
106    $tags = get_common_tags($page['items'],
107        $conf['menubar_tag_cloud_items_number'], $page['tag_ids']);
108  }
109
110  $tags = add_level_to_tags($tags);
111
112  foreach ($tags as $tag)
113  {
114    $template->append(
115      'related_tags',
116      array(
117        'U_TAG' => make_index_url(
118          array(
119            'tags' => array($tag)
120            )
121          ),
122
123        'NAME' => $tag['name'],
124
125        'CLASS' => 'tagLevel'.$tag['level'],
126
127        'add' => array(
128
129            'URL' => make_index_url(
130              array(
131                'tags' => array_merge(
132                  $page['tags'],
133                  array($tag)
134                  )
135                )
136              ),
137            'COUNTER' => $tag['counter'],
138            )
139        )
140      );
141  }
142}
143//---------------------------------------------------------- special categories
144// favorites categories
145if ( !is_a_guest() )
146{
147  $template->append(
148    'special_categories',
149    array(
150      'URL' => make_index_url(array('section' => 'favorites')),
151      'TITLE' => l10n('favorite_cat_hint'),
152      'NAME' => l10n('favorite_cat')
153      ));
154}
155// most visited
156$template->append(
157  'special_categories',
158  array(
159    'URL' => make_index_url(array('section' => 'most_visited')),
160    'TITLE' => l10n('most_visited_cat_hint'),
161    'NAME' => l10n('most_visited_cat')
162    ));
163// best rated
164if ($conf['rate'])
165{
166  $template->append(
167    'special_categories',
168    array(
169      'URL' => make_index_url(array('section' => 'best_rated')),
170      'TITLE' => l10n('best_rated_cat_hint'),
171      'NAME' => l10n('best_rated_cat')
172      )
173    );
174}
175// random
176$template->append(
177  'special_categories',
178  array(
179    'URL' => get_root_url().'random.php',
180    'TITLE' => l10n('random_cat_hint'),
181    'NAME' => l10n('random_cat'),
182    'REL'=> 'rel="nofollow"'
183    ));
184
185// recent pics
186$template->append(
187  'special_categories',
188  array(
189    'URL' => make_index_url(array('section' => 'recent_pics')),
190    'TITLE' => l10n('recent_pics_cat_hint'),
191    'NAME' => l10n('recent_pics_cat'),
192    ));
193// recent cats
194$template->append(
195  'special_categories',
196  array(
197    'URL' => make_index_url(array('section' => 'recent_cats')),
198    'TITLE' => l10n('recent_cats_cat_hint'),
199    'NAME' => l10n('recent_cats_cat'),
200    ));
201
202// calendar
203$template->append(
204  'special_categories',
205  array(
206    'URL' =>
207      make_index_url(
208        array(
209          'chronology_field' => ($conf['calendar_datefield']=='date_available'
210                                  ? 'posted' : 'created'),
211           'chronology_style'=> 'monthly',
212           'chronology_view' => 'calendar'
213        )
214      ),
215    'TITLE' => l10n('calendar_hint'),
216    'NAME' => l10n('calendar'),
217    'REL'=> 'rel="nofollow"'
218    )
219  );
220//--------------------------------------------------------------------- summary
221
222if (is_a_guest())
223{
224  $template->assign(
225      array(
226        'U_IDENTIFY' => get_root_url().'identification.php',
227        'AUTHORIZE_REMEMBERING' => $conf['authorize_remembering']
228      )
229    );
230
231  if ($conf['allow_user_registration'])
232  {
233    $template->assign( 'U_REGISTER', get_root_url().'register.php');
234  }
235}
236else
237{
238  $template->assign('USERNAME', $user['username']);
239
240  if (is_autorize_status(ACCESS_CLASSIC))
241  {
242    $template->assign('U_PROFILE', get_root_url().'profile.php');
243  }
244
245  // the logout link has no meaning with Apache authentication : it is not
246  // possible to logout with this kind of authentication.
247  if (!$conf['apache_authentication'])
248  {
249    $template->assign('U_LOGOUT', get_root_url().'?act=logout');
250  }
251
252  if (is_admin())
253  {
254    $template->assign('U_ADMIN', get_root_url().'admin.php');
255  }
256}
257
258// tags link
259$template->append(
260  'summaries',
261  array(
262    'TITLE' => l10n('See available tags'),
263    'NAME' => l10n('Tags'),
264    'U_SUMMARY'=> get_root_url().'tags.php',
265    )
266  );
267
268// search link
269$template->append(
270  'summaries',
271  array(
272    'TITLE'=>l10n('hint_search'),
273    'NAME'=>l10n('Search'),
274    'U_SUMMARY'=> get_root_url().'search.php',
275    'REL'=> 'rel="search"'
276    )
277  );
278
279// comments link
280$template->append(
281  'summaries',
282  array(
283    'TITLE'=>l10n('hint_comments'),
284    'NAME'=>l10n('comments'),
285    'U_SUMMARY'=> get_root_url().'comments.php',
286    )
287  );
288
289// about link
290$template->append(
291  'summaries',
292  array(
293    'TITLE'     => l10n('about_page_title'),
294    'NAME'      => l10n('About'),
295    'U_SUMMARY' => get_root_url().'about.php',
296    )
297  );
298
299// notification
300$template->append(
301  'summaries',
302  array(
303    'TITLE'=>l10n('RSS feed'),
304    'NAME'=>l10n('Notification'),
305    'U_SUMMARY'=> get_root_url().'notification.php',
306    'REL'=> 'rel="nofollow"'
307    )
308  );
309
310if (isset($page['category']) and $page['category']['uploadable'] )
311{ // upload a picture in the category
312  $url = get_root_url().'upload.php?cat='.$page['category']['id'];
313  $template->assign('U_UPLOAD', $url);
314}
315
316trigger_action('loc_end_menubar');
317$template->assign_var_from_handle('MENUBAR', 'menubar');
318?>
Note: See TracBrowser for help on using the repository browser.