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