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