[1367] | 1 | <?php |
---|
| 2 | // +-----------------------------------------------------------------------+ |
---|
[2297] | 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 | // +-----------------------------------------------------------------------+ |
---|
[1367] | 23 | |
---|
| 24 | /** |
---|
| 25 | * This file is included by the main page to show the menu bar |
---|
| 26 | * |
---|
[1436] | 27 | */ |
---|
[1367] | 28 | $template->set_filenames( |
---|
| 29 | array( |
---|
| 30 | 'menubar' => 'menubar.tpl', |
---|
| 31 | ) |
---|
| 32 | ); |
---|
| 33 | |
---|
[1595] | 34 | trigger_action('loc_begin_menubar'); |
---|
| 35 | |
---|
[2231] | 36 | $template->assign( |
---|
[1367] | 37 | array( |
---|
| 38 | 'NB_PICTURE' => $user['nb_total_images'], |
---|
| 39 | 'MENU_CATEGORIES_CONTENT' => get_categories_menu(), |
---|
[1788] | 40 | 'U_CATEGORIES' => make_index_url(array('section' => 'categories')), |
---|
[1367] | 41 | 'U_LOST_PASSWORD' => get_root_url().'password.php', |
---|
[2325] | 42 | 'U_UPLOAD' => get_upload_menu_link() |
---|
[1367] | 43 | ) |
---|
| 44 | ); |
---|
| 45 | |
---|
| 46 | //-------------------------------------------------------------- external links |
---|
[1728] | 47 | foreach ($conf['links'] as $url => $url_data) |
---|
[1367] | 48 | { |
---|
[1728] | 49 | if (!is_array($url_data)) |
---|
| 50 | { |
---|
| 51 | $url_data = array('label' => $url_data); |
---|
| 52 | } |
---|
| 53 | |
---|
[2231] | 54 | if |
---|
[1728] | 55 | ( |
---|
| 56 | (!isset($url_data['eval_visible'])) |
---|
| 57 | or |
---|
| 58 | (eval($url_data['eval_visible'])) |
---|
| 59 | ) |
---|
| 60 | { |
---|
[2231] | 61 | $tpl_var = array( |
---|
[1728] | 62 | 'URL' => $url, |
---|
| 63 | 'LABEL' => $url_data['label'] |
---|
| 64 | ); |
---|
[2231] | 65 | |
---|
[1736] | 66 | if (!isset($url_data['new_window']) or $url_data['new_window']) |
---|
[1728] | 67 | { |
---|
[2231] | 68 | $tpl_var['new_window'] = |
---|
[1743] | 69 | array( |
---|
[2231] | 70 | 'NAME' => (isset($url_data['nw_name']) ? $url_data['nw_name'] : ''), |
---|
| 71 | 'FEATURES' => (isset($url_data['nw_features']) ? $url_data['nw_features'] : '') |
---|
[1743] | 72 | ); |
---|
[1728] | 73 | } |
---|
[2231] | 74 | $template->append('links', $tpl_var); |
---|
[1728] | 75 | } |
---|
[1367] | 76 | } |
---|
[1677] | 77 | |
---|
| 78 | //------------------------------------------------------------------------ filter |
---|
[1722] | 79 | if (!empty($conf['filter_pages']) and get_filter_page_value('used')) |
---|
[1677] | 80 | { |
---|
[1722] | 81 | if ($filter['enabled']) |
---|
| 82 | { |
---|
[2231] | 83 | $template->assign( |
---|
| 84 | 'U_STOP_FILTER', |
---|
| 85 | add_url_params(make_index_url(array()), array('filter' => 'stop')) |
---|
[1722] | 86 | ); |
---|
| 87 | } |
---|
| 88 | else |
---|
| 89 | { |
---|
[2231] | 90 | $template->assign( |
---|
| 91 | 'U_START_FILTER', |
---|
| 92 | add_url_params(make_index_url(array()), array('filter' => 'start-recent-'.$user['recent_period'])) |
---|
[1722] | 93 | ); |
---|
| 94 | } |
---|
[1677] | 95 | } |
---|
| 96 | |
---|
[1367] | 97 | //------------------------------------------------------------------------ tags |
---|
[2231] | 98 | if ('tags' == @$page['section']) |
---|
[1367] | 99 | { |
---|
| 100 | // display tags associated to currently tagged items, less current tags |
---|
| 101 | $tags = array(); |
---|
| 102 | if ( !empty($page['items']) ) |
---|
| 103 | { |
---|
[1537] | 104 | $tags = get_common_tags($page['items'], |
---|
| 105 | $conf['menubar_tag_cloud_items_number'], $page['tag_ids']); |
---|
[1367] | 106 | } |
---|
| 107 | |
---|
| 108 | $tags = add_level_to_tags($tags); |
---|
| 109 | |
---|
| 110 | foreach ($tags as $tag) |
---|
| 111 | { |
---|
[2231] | 112 | $template->append( |
---|
| 113 | 'related_tags', |
---|
[2409] | 114 | array_merge( $tag, |
---|
| 115 | array( |
---|
| 116 | 'URL' => make_index_url( |
---|
| 117 | array( |
---|
| 118 | 'tags' => array($tag) |
---|
| 119 | ) |
---|
| 120 | ), |
---|
[1367] | 121 | |
---|
[2409] | 122 | 'U_ADD' => make_index_url( |
---|
| 123 | array( |
---|
| 124 | 'tags' => array_merge( |
---|
| 125 | $page['tags'], |
---|
| 126 | array($tag) |
---|
| 127 | ) |
---|
[2231] | 128 | ) |
---|
[2409] | 129 | ), |
---|
| 130 | ) |
---|
[1367] | 131 | ) |
---|
| 132 | ); |
---|
| 133 | } |
---|
| 134 | } |
---|
| 135 | //---------------------------------------------------------- special categories |
---|
| 136 | // favorites categories |
---|
[2029] | 137 | if ( !is_a_guest() ) |
---|
[1367] | 138 | { |
---|
[2231] | 139 | $template->append( |
---|
| 140 | 'special_categories', |
---|
[1367] | 141 | array( |
---|
[1503] | 142 | 'URL' => make_index_url(array('section' => 'favorites')), |
---|
[2201] | 143 | 'TITLE' => l10n('favorite_cat_hint'), |
---|
| 144 | 'NAME' => l10n('favorite_cat') |
---|
[1367] | 145 | )); |
---|
| 146 | } |
---|
| 147 | // most visited |
---|
[2231] | 148 | $template->append( |
---|
| 149 | 'special_categories', |
---|
[1367] | 150 | array( |
---|
[1503] | 151 | 'URL' => make_index_url(array('section' => 'most_visited')), |
---|
[2201] | 152 | 'TITLE' => l10n('most_visited_cat_hint'), |
---|
| 153 | 'NAME' => l10n('most_visited_cat') |
---|
[1367] | 154 | )); |
---|
| 155 | // best rated |
---|
| 156 | if ($conf['rate']) |
---|
| 157 | { |
---|
[2231] | 158 | $template->append( |
---|
| 159 | 'special_categories', |
---|
[1367] | 160 | array( |
---|
[1503] | 161 | 'URL' => make_index_url(array('section' => 'best_rated')), |
---|
[2201] | 162 | 'TITLE' => l10n('best_rated_cat_hint'), |
---|
| 163 | 'NAME' => l10n('best_rated_cat') |
---|
[1367] | 164 | ) |
---|
| 165 | ); |
---|
| 166 | } |
---|
| 167 | // random |
---|
[2231] | 168 | $template->append( |
---|
| 169 | 'special_categories', |
---|
[1367] | 170 | array( |
---|
| 171 | 'URL' => get_root_url().'random.php', |
---|
[2201] | 172 | 'TITLE' => l10n('random_cat_hint'), |
---|
| 173 | 'NAME' => l10n('random_cat'), |
---|
[1703] | 174 | 'REL'=> 'rel="nofollow"' |
---|
[1367] | 175 | )); |
---|
| 176 | |
---|
[1650] | 177 | // recent pics |
---|
[2231] | 178 | $template->append( |
---|
| 179 | 'special_categories', |
---|
[1650] | 180 | array( |
---|
| 181 | 'URL' => make_index_url(array('section' => 'recent_pics')), |
---|
[2201] | 182 | 'TITLE' => l10n('recent_pics_cat_hint'), |
---|
| 183 | 'NAME' => l10n('recent_pics_cat'), |
---|
[1650] | 184 | )); |
---|
| 185 | // recent cats |
---|
[2231] | 186 | $template->append( |
---|
| 187 | 'special_categories', |
---|
[1650] | 188 | array( |
---|
| 189 | 'URL' => make_index_url(array('section' => 'recent_cats')), |
---|
[2201] | 190 | 'TITLE' => l10n('recent_cats_cat_hint'), |
---|
| 191 | 'NAME' => l10n('recent_cats_cat'), |
---|
[1650] | 192 | )); |
---|
[1648] | 193 | |
---|
[1367] | 194 | // calendar |
---|
[2231] | 195 | $template->append( |
---|
| 196 | 'special_categories', |
---|
[1367] | 197 | array( |
---|
| 198 | 'URL' => |
---|
[1503] | 199 | make_index_url( |
---|
[1367] | 200 | array( |
---|
| 201 | 'chronology_field' => ($conf['calendar_datefield']=='date_available' |
---|
| 202 | ? 'posted' : 'created'), |
---|
| 203 | 'chronology_style'=> 'monthly', |
---|
| 204 | 'chronology_view' => 'calendar' |
---|
| 205 | ) |
---|
| 206 | ), |
---|
[2201] | 207 | 'TITLE' => l10n('calendar_hint'), |
---|
| 208 | 'NAME' => l10n('calendar'), |
---|
[1703] | 209 | 'REL'=> 'rel="nofollow"' |
---|
[1367] | 210 | ) |
---|
| 211 | ); |
---|
| 212 | //--------------------------------------------------------------------- summary |
---|
| 213 | |
---|
[2029] | 214 | if (is_a_guest()) |
---|
[1367] | 215 | { |
---|
[2231] | 216 | $template->assign( |
---|
| 217 | array( |
---|
| 218 | 'U_IDENTIFY' => get_root_url().'identification.php', |
---|
| 219 | 'AUTHORIZE_REMEMBERING' => $conf['authorize_remembering'] |
---|
| 220 | ) |
---|
| 221 | ); |
---|
[1367] | 222 | |
---|
[1652] | 223 | if ($conf['allow_user_registration']) |
---|
| 224 | { |
---|
[2231] | 225 | $template->assign( 'U_REGISTER', get_root_url().'register.php'); |
---|
[1652] | 226 | } |
---|
[1367] | 227 | } |
---|
| 228 | else |
---|
| 229 | { |
---|
[2231] | 230 | $template->assign('USERNAME', $user['username']); |
---|
[1367] | 231 | |
---|
| 232 | if (is_autorize_status(ACCESS_CLASSIC)) |
---|
| 233 | { |
---|
[2231] | 234 | $template->assign('U_PROFILE', get_root_url().'profile.php'); |
---|
[1367] | 235 | } |
---|
| 236 | |
---|
| 237 | // the logout link has no meaning with Apache authentication : it is not |
---|
| 238 | // possible to logout with this kind of authentication. |
---|
| 239 | if (!$conf['apache_authentication']) |
---|
| 240 | { |
---|
[2231] | 241 | $template->assign('U_LOGOUT', get_root_url().'?act=logout'); |
---|
[1367] | 242 | } |
---|
| 243 | |
---|
| 244 | if (is_admin()) |
---|
| 245 | { |
---|
[2231] | 246 | $template->assign('U_ADMIN', get_root_url().'admin.php'); |
---|
[1367] | 247 | } |
---|
| 248 | } |
---|
| 249 | |
---|
| 250 | // tags link |
---|
[2231] | 251 | $template->append( |
---|
| 252 | 'summaries', |
---|
[1367] | 253 | array( |
---|
| 254 | 'TITLE' => l10n('See available tags'), |
---|
| 255 | 'NAME' => l10n('Tags'), |
---|
| 256 | 'U_SUMMARY'=> get_root_url().'tags.php', |
---|
| 257 | ) |
---|
| 258 | ); |
---|
| 259 | |
---|
| 260 | // search link |
---|
[2231] | 261 | $template->append( |
---|
| 262 | 'summaries', |
---|
[1367] | 263 | array( |
---|
[2201] | 264 | 'TITLE'=>l10n('hint_search'), |
---|
[2288] | 265 | 'NAME'=>l10n('Search'), |
---|
[1367] | 266 | 'U_SUMMARY'=> get_root_url().'search.php', |
---|
| 267 | 'REL'=> 'rel="search"' |
---|
| 268 | ) |
---|
| 269 | ); |
---|
| 270 | |
---|
| 271 | // comments link |
---|
[2231] | 272 | $template->append( |
---|
| 273 | 'summaries', |
---|
[1367] | 274 | array( |
---|
[2201] | 275 | 'TITLE'=>l10n('hint_comments'), |
---|
| 276 | 'NAME'=>l10n('comments'), |
---|
[1367] | 277 | 'U_SUMMARY'=> get_root_url().'comments.php', |
---|
| 278 | ) |
---|
| 279 | ); |
---|
| 280 | |
---|
| 281 | // about link |
---|
[2231] | 282 | $template->append( |
---|
| 283 | 'summaries', |
---|
[1367] | 284 | array( |
---|
[2201] | 285 | 'TITLE' => l10n('about_page_title'), |
---|
| 286 | 'NAME' => l10n('About'), |
---|
[1367] | 287 | 'U_SUMMARY' => get_root_url().'about.php', |
---|
| 288 | ) |
---|
| 289 | ); |
---|
| 290 | |
---|
| 291 | // notification |
---|
[2231] | 292 | $template->append( |
---|
| 293 | 'summaries', |
---|
[1367] | 294 | array( |
---|
[1636] | 295 | 'TITLE'=>l10n('RSS feed'), |
---|
[1367] | 296 | 'NAME'=>l10n('Notification'), |
---|
| 297 | 'U_SUMMARY'=> get_root_url().'notification.php', |
---|
| 298 | 'REL'=> 'rel="nofollow"' |
---|
| 299 | ) |
---|
| 300 | ); |
---|
[1436] | 301 | |
---|
[1595] | 302 | trigger_action('loc_end_menubar'); |
---|
[1367] | 303 | $template->assign_var_from_handle('MENUBAR', 'menubar'); |
---|
[2325] | 304 | |
---|
[1367] | 305 | ?> |
---|