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