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: menubar.inc.php 1743 2007-01-22 22:06:17Z rub $ |
---|
9 | // | last update : $Date: 2007-01-22 22:06:17 +0000 (Mon, 22 Jan 2007) $ |
---|
10 | // | last modifier : $Author: rub $ |
---|
11 | // | revision : $Revision: 1743 $ |
---|
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 | * This file is included by the main page to show the menu bar |
---|
30 | * |
---|
31 | */ |
---|
32 | $template->set_filenames( |
---|
33 | array( |
---|
34 | 'menubar' => 'menubar.tpl', |
---|
35 | ) |
---|
36 | ); |
---|
37 | |
---|
38 | trigger_action('loc_begin_menubar'); |
---|
39 | |
---|
40 | $template->assign_vars( |
---|
41 | array( |
---|
42 | 'NB_PICTURE' => $user['nb_total_images'], |
---|
43 | 'USERNAME' => $user['username'], |
---|
44 | 'MENU_CATEGORIES_CONTENT' => get_categories_menu(), |
---|
45 | 'F_IDENTIFY' => get_root_url().'identification.php', |
---|
46 | 'U_HOME' => make_index_url(), |
---|
47 | 'U_REGISTER' => get_root_url().'register.php', |
---|
48 | 'U_LOST_PASSWORD' => get_root_url().'password.php', |
---|
49 | 'U_LOGOUT' => get_root_url().'?act=logout', |
---|
50 | 'U_ADMIN'=> get_root_url().'admin.php', |
---|
51 | 'U_PROFILE'=> get_root_url().'profile.php', |
---|
52 | ) |
---|
53 | ); |
---|
54 | |
---|
55 | //-------------------------------------------------------------- external links |
---|
56 | foreach ($conf['links'] as $url => $url_data) |
---|
57 | { |
---|
58 | if (!is_array($url_data)) |
---|
59 | { |
---|
60 | $url_data = array('label' => $url_data); |
---|
61 | } |
---|
62 | |
---|
63 | if |
---|
64 | ( |
---|
65 | (!isset($url_data['eval_visible'])) |
---|
66 | or |
---|
67 | (eval($url_data['eval_visible'])) |
---|
68 | ) |
---|
69 | { |
---|
70 | $template->assign_block_vars( |
---|
71 | 'links.link', |
---|
72 | array( |
---|
73 | 'URL' => $url, |
---|
74 | 'LABEL' => $url_data['label'] |
---|
75 | ) |
---|
76 | ); |
---|
77 | if (!isset($url_data['new_window']) or $url_data['new_window']) |
---|
78 | { |
---|
79 | $template->assign_block_vars( |
---|
80 | 'links.link.new_window', |
---|
81 | array( |
---|
82 | 'name' => (isset($url_data['nw_name']) ? $url_data['nw_name'] : ''), |
---|
83 | 'features' => (isset($url_data['nw_features']) ? $url_data['nw_features'] : '') |
---|
84 | ) |
---|
85 | ); |
---|
86 | } |
---|
87 | } |
---|
88 | } |
---|
89 | |
---|
90 | //------------------------------------------------------------------------ filter |
---|
91 | if (!empty($conf['filter_pages']) and get_filter_page_value('used')) |
---|
92 | { |
---|
93 | if ($filter['enabled']) |
---|
94 | { |
---|
95 | $template->assign_block_vars( |
---|
96 | 'stop_filter', |
---|
97 | array( |
---|
98 | 'URL' => add_url_params(make_index_url(array()), array('filter' => 'stop')) |
---|
99 | ) |
---|
100 | ); |
---|
101 | } |
---|
102 | else |
---|
103 | { |
---|
104 | $template->assign_block_vars( |
---|
105 | 'start_filter', |
---|
106 | array( |
---|
107 | 'URL' => add_url_params(make_index_url(array()), array('filter' => 'start-recent-'.$user['recent_period'])) |
---|
108 | ) |
---|
109 | ); |
---|
110 | } |
---|
111 | } |
---|
112 | |
---|
113 | //------------------------------------------------------------------------ tags |
---|
114 | if ('tags' == $page['section']) |
---|
115 | { |
---|
116 | // display tags associated to currently tagged items, less current tags |
---|
117 | $tags = array(); |
---|
118 | if ( !empty($page['items']) ) |
---|
119 | { |
---|
120 | $tags = get_common_tags($page['items'], |
---|
121 | $conf['menubar_tag_cloud_items_number'], $page['tag_ids']); |
---|
122 | } |
---|
123 | |
---|
124 | $tags = add_level_to_tags($tags); |
---|
125 | |
---|
126 | foreach ($tags as $tag) |
---|
127 | { |
---|
128 | $template->assign_block_vars( |
---|
129 | 'tags.tag', |
---|
130 | array( |
---|
131 | 'URL' => make_index_url( |
---|
132 | array( |
---|
133 | 'tags' => array( |
---|
134 | array( |
---|
135 | 'id' => $tag['tag_id'], |
---|
136 | 'url_name' => $tag['url_name'], |
---|
137 | ), |
---|
138 | ) |
---|
139 | ) |
---|
140 | ), |
---|
141 | |
---|
142 | 'NAME' => $tag['name'], |
---|
143 | |
---|
144 | 'TITLE' => l10n('See pictures linked to this tag only'), |
---|
145 | |
---|
146 | 'CLASS' => 'tagLevel'.$tag['level'] |
---|
147 | ) |
---|
148 | ); |
---|
149 | |
---|
150 | $template->assign_block_vars( |
---|
151 | 'tags.tag.add', |
---|
152 | array( |
---|
153 | 'URL' => make_index_url( |
---|
154 | array( |
---|
155 | 'tags' => array_merge( |
---|
156 | $page['tags'], |
---|
157 | array( |
---|
158 | array( |
---|
159 | 'id' => $tag['tag_id'], |
---|
160 | 'url_name' => $tag['url_name'], |
---|
161 | ), |
---|
162 | ) |
---|
163 | ) |
---|
164 | ) |
---|
165 | ), |
---|
166 | 'TITLE' => sprintf( |
---|
167 | l10n('%d pictures are also linked to current tags'), |
---|
168 | $tag['counter'] |
---|
169 | ), |
---|
170 | ) |
---|
171 | ); |
---|
172 | |
---|
173 | } |
---|
174 | } |
---|
175 | //---------------------------------------------------------- special categories |
---|
176 | // favorites categories |
---|
177 | if ( !$user['is_the_guest'] ) |
---|
178 | { |
---|
179 | $template->assign_block_vars('username', array()); |
---|
180 | |
---|
181 | $template->assign_block_vars( |
---|
182 | 'special_cat', |
---|
183 | array( |
---|
184 | 'URL' => make_index_url(array('section' => 'favorites')), |
---|
185 | 'TITLE' => $lang['favorite_cat_hint'], |
---|
186 | 'NAME' => $lang['favorite_cat'] |
---|
187 | )); |
---|
188 | } |
---|
189 | // most visited |
---|
190 | $template->assign_block_vars( |
---|
191 | 'special_cat', |
---|
192 | array( |
---|
193 | 'URL' => make_index_url(array('section' => 'most_visited')), |
---|
194 | 'TITLE' => $lang['most_visited_cat_hint'], |
---|
195 | 'NAME' => $lang['most_visited_cat'] |
---|
196 | )); |
---|
197 | // best rated |
---|
198 | if ($conf['rate']) |
---|
199 | { |
---|
200 | $template->assign_block_vars( |
---|
201 | 'special_cat', |
---|
202 | array( |
---|
203 | 'URL' => make_index_url(array('section' => 'best_rated')), |
---|
204 | 'TITLE' => $lang['best_rated_cat_hint'], |
---|
205 | 'NAME' => $lang['best_rated_cat'] |
---|
206 | ) |
---|
207 | ); |
---|
208 | } |
---|
209 | // random |
---|
210 | $template->assign_block_vars( |
---|
211 | 'special_cat', |
---|
212 | array( |
---|
213 | 'URL' => get_root_url().'random.php', |
---|
214 | 'TITLE' => $lang['random_cat_hint'], |
---|
215 | 'NAME' => $lang['random_cat'], |
---|
216 | 'REL'=> 'rel="nofollow"' |
---|
217 | )); |
---|
218 | |
---|
219 | // recent pics |
---|
220 | $template->assign_block_vars( |
---|
221 | 'special_cat', |
---|
222 | array( |
---|
223 | 'URL' => make_index_url(array('section' => 'recent_pics')), |
---|
224 | 'TITLE' => $lang['recent_pics_cat_hint'], |
---|
225 | 'NAME' => $lang['recent_pics_cat'], |
---|
226 | )); |
---|
227 | // recent cats |
---|
228 | $template->assign_block_vars( |
---|
229 | 'special_cat', |
---|
230 | array( |
---|
231 | 'URL' => make_index_url(array('section' => 'recent_cats')), |
---|
232 | 'TITLE' => $lang['recent_cats_cat_hint'], |
---|
233 | 'NAME' => $lang['recent_cats_cat'], |
---|
234 | )); |
---|
235 | |
---|
236 | // calendar |
---|
237 | $template->assign_block_vars( |
---|
238 | 'special_cat', |
---|
239 | array( |
---|
240 | 'URL' => |
---|
241 | make_index_url( |
---|
242 | array( |
---|
243 | 'chronology_field' => ($conf['calendar_datefield']=='date_available' |
---|
244 | ? 'posted' : 'created'), |
---|
245 | 'chronology_style'=> 'monthly', |
---|
246 | 'chronology_view' => 'calendar' |
---|
247 | ) |
---|
248 | ), |
---|
249 | 'TITLE' => $lang['calendar_hint'], |
---|
250 | 'NAME' => $lang['calendar'], |
---|
251 | 'REL'=> 'rel="nofollow"' |
---|
252 | ) |
---|
253 | ); |
---|
254 | //--------------------------------------------------------------------- summary |
---|
255 | |
---|
256 | if ($user['is_the_guest']) |
---|
257 | { |
---|
258 | $template->assign_block_vars('login', array()); |
---|
259 | |
---|
260 | $template->assign_block_vars('quickconnect', array()); |
---|
261 | if ($conf['authorize_remembering']) |
---|
262 | { |
---|
263 | $template->assign_block_vars('quickconnect.remember_me', array()); |
---|
264 | } |
---|
265 | if ($conf['allow_user_registration']) |
---|
266 | { |
---|
267 | $template->assign_block_vars('register', array()); |
---|
268 | $template->assign_block_vars('quickconnect.register', array()); |
---|
269 | } |
---|
270 | } |
---|
271 | else |
---|
272 | { |
---|
273 | $template->assign_block_vars('hello', array()); |
---|
274 | |
---|
275 | if (is_autorize_status(ACCESS_CLASSIC)) |
---|
276 | { |
---|
277 | $template->assign_block_vars('profile', array()); |
---|
278 | } |
---|
279 | |
---|
280 | // the logout link has no meaning with Apache authentication : it is not |
---|
281 | // possible to logout with this kind of authentication. |
---|
282 | if (!$conf['apache_authentication']) |
---|
283 | { |
---|
284 | $template->assign_block_vars('logout', array()); |
---|
285 | } |
---|
286 | |
---|
287 | if (is_admin()) |
---|
288 | { |
---|
289 | $template->assign_block_vars('admin', array()); |
---|
290 | } |
---|
291 | } |
---|
292 | |
---|
293 | // tags link |
---|
294 | $template->assign_block_vars( |
---|
295 | 'summary', |
---|
296 | array( |
---|
297 | 'TITLE' => l10n('See available tags'), |
---|
298 | 'NAME' => l10n('Tags'), |
---|
299 | 'U_SUMMARY'=> get_root_url().'tags.php', |
---|
300 | ) |
---|
301 | ); |
---|
302 | |
---|
303 | // search link |
---|
304 | $template->assign_block_vars( |
---|
305 | 'summary', |
---|
306 | array( |
---|
307 | 'TITLE'=>$lang['hint_search'], |
---|
308 | 'NAME'=>$lang['search'], |
---|
309 | 'U_SUMMARY'=> get_root_url().'search.php', |
---|
310 | 'REL'=> 'rel="search"' |
---|
311 | ) |
---|
312 | ); |
---|
313 | $template->assign_block_vars( 'summary.quick_search', array() ); |
---|
314 | |
---|
315 | // comments link |
---|
316 | $template->assign_block_vars( |
---|
317 | 'summary', |
---|
318 | array( |
---|
319 | 'TITLE'=>$lang['hint_comments'], |
---|
320 | 'NAME'=>$lang['comments'], |
---|
321 | 'U_SUMMARY'=> get_root_url().'comments.php', |
---|
322 | ) |
---|
323 | ); |
---|
324 | |
---|
325 | // about link |
---|
326 | $template->assign_block_vars( |
---|
327 | 'summary', |
---|
328 | array( |
---|
329 | 'TITLE' => $lang['about_page_title'], |
---|
330 | 'NAME' => $lang['About'], |
---|
331 | 'U_SUMMARY' => get_root_url().'about.php', |
---|
332 | ) |
---|
333 | ); |
---|
334 | |
---|
335 | // notification |
---|
336 | $template->assign_block_vars( |
---|
337 | 'summary', |
---|
338 | array( |
---|
339 | 'TITLE'=>l10n('RSS feed'), |
---|
340 | 'NAME'=>l10n('Notification'), |
---|
341 | 'U_SUMMARY'=> get_root_url().'notification.php', |
---|
342 | 'REL'=> 'rel="nofollow"' |
---|
343 | ) |
---|
344 | ); |
---|
345 | |
---|
346 | if (isset($page['category']) and $page['cat_uploadable'] ) |
---|
347 | { // upload a picture in the category |
---|
348 | $url = get_root_url().'upload.php?cat='.$page['category']; |
---|
349 | $template->assign_block_vars( |
---|
350 | 'upload', |
---|
351 | array( |
---|
352 | 'U_UPLOAD'=> $url |
---|
353 | ) |
---|
354 | ); |
---|
355 | } |
---|
356 | |
---|
357 | trigger_action('loc_end_menubar'); |
---|
358 | $template->assign_var_from_handle('MENUBAR', 'menubar'); |
---|
359 | ?> |
---|