Changeset 1793:a25f8d0fd400 for inc/admin/prepend.php
- Timestamp:
- 09/11/13 17:10:01 (12 years ago)
- Branch:
- default
- Children:
- 1795:5c5c52124ab4, 1796:ef72fa20ed9d
- Parents:
- 1792:3ad2e47ed52d (diff), 514:5cacbd2e1fa9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/prepend.php
r494 r1793 4 4 # This file is part of Dotclear 2. 5 5 # 6 # Copyright (c) 2003-201 1Olivier Meunier & Association Dotclear6 # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear 7 7 # Licensed under the GPL version 2.0 license. 8 8 # See LICENSE file or … … 11 11 # -- END LICENSE BLOCK ----------------------------------------- 12 12 13 define('DC_CONTEXT_ADMIN',true); 14 13 15 require_once dirname(__FILE__).'/../prepend.php'; 14 16 … … 19 21 // HTTP/1.0 20 22 header("Pragma: no-cache"); 21 22 define('DC_CONTEXT_ADMIN',true);23 23 24 24 function dc_valid_fav($url) { … … 37 37 function dc_prepare_url($url) { 38 38 39 $u = str_replace(array('?','&' ),array('\?','&'),$url);39 $u = str_replace(array('?','&','/'),array('\?','&','\\/'),$url); 40 40 return (!strpos($u,'\?') ? 41 41 '/'.$u.'$/' : … … 55 55 } 56 56 l10n::set(dirname(__FILE__).'/../../locales/'.$_lang.'/main'); 57 l10n::set(dirname(__FILE__).'/../../locales/'.$_lang.'/public'); 57 58 l10n::set(dirname(__FILE__).'/../../locales/'.$_lang.'/plugins'); 59 } 60 61 function dc_admin_icon_url($img) 62 { 63 global $core; 64 65 $core->auth->user_prefs->addWorkspace('interface'); 66 $user_ui_iconset = @$core->auth->user_prefs->interface->iconset; 67 if (($user_ui_iconset) && ($img)) { 68 $icon = false; 69 if ((preg_match('/^images\/menu\/(.+)$/',$img,$m)) || 70 (preg_match('/^index\.php\?pf=(.+)$/',$img,$m))) { 71 if ($m[1]) { 72 $icon = path::real(dirname(__FILE__).'/../../admin/images/iconset/'.$user_ui_iconset.'/'.$m[1],false); 73 if ($icon !== false) { 74 $allow_types = array('png','jpg','jpeg','gif'); 75 if (is_file($icon) && is_readable($icon) && in_array(files::getExtension($icon),$allow_types)) { 76 return DC_ADMIN_URL.'images/iconset/'.$user_ui_iconset.'/'.$m[1]; 77 } 78 } 79 } 80 } 81 } 82 return $img; 58 83 } 59 84 … … 191 216 } 192 217 unset($hfiles,$locales_root); 218 219 $core->auth->user_prefs->addWorkspace('interface'); 220 $user_ui_nofavmenu = $core->auth->user_prefs->interface->nofavmenu; 193 221 194 222 # Standard favorites … … 233 261 'images/menu/users.png','images/menu/users-b.png', 234 262 null,null,null)); 235 $_fav['plugins'] = new ArrayObject(array('plugins','Plugins ','plugins.php',263 $_fav['plugins'] = new ArrayObject(array('plugins','Plugins management','plugins.php', 236 264 'images/menu/plugins.png','images/menu/plugins-b.png', 237 265 null,null,null)); … … 246 274 # Menus creation 247 275 $_menu['Dashboard'] = new dcMenu('dashboard-menu',null); 248 $_menu['Favorites'] = new dcMenu('favorites-menu','My favorites'); 276 if (!$user_ui_nofavmenu) 277 $_menu['Favorites'] = new dcMenu('favorites-menu','My favorites'); 249 278 $_menu['Blog'] = new dcMenu('blog-menu','Blog'); 250 279 $_menu['System'] = new dcMenu('system-menu','System'); … … 259 288 # Set menu titles 260 289 261 $_menu['System']->title = __('System ');290 $_menu['System']->title = __('System settings'); 262 291 $_menu['Blog']->title = __('Blog'); 263 292 $_menu['Plugins']->title = __('Plugins'); 264 $_menu['Favorites']->title = __('My favorites'); 293 if (!$user_ui_nofavmenu) 294 $_menu['Favorites']->title = __('My favorites'); 265 295 266 296 /* … … 296 326 $core->auth->check('usage,contentadmin',$core->blog->id),'menu-new-post'); 297 327 298 $_menu['System']->prependItem(__('Update s'),'update.php','images/menu/update.png',328 $_menu['System']->prependItem(__('Update'),'update.php','images/menu/update.png', 299 329 preg_match('/update.php(\?.*)?$/',$_SERVER['REQUEST_URI']), 300 330 $core->auth->isSuperAdmin() && is_readable(DC_DIGESTS)); … … 302 332 preg_match('/langs.php(\?.*)?$/',$_SERVER['REQUEST_URI']), 303 333 $core->auth->isSuperAdmin()); 304 $_menu['System']->prependItem(__('Plugins '),'plugins.php','images/menu/plugins.png',334 $_menu['System']->prependItem(__('Plugins management'),'plugins.php','images/menu/plugins.png', 305 335 preg_match('/plugins.php(\?.*)?$/',$_SERVER['REQUEST_URI']), 306 336 $core->auth->isSuperAdmin()); … … 313 343 $core->auth->check('usage,contentadmin',$core->blog->id) && $core->auth->blog_count > 1); 314 344 315 // Set favorites menu 316 $ws = $core->auth->user_prefs->addWorkspace('favorites'); 317 $count = 0; 318 foreach ($ws->dumpPrefs() as $k => $v) { 319 // User favorites only 320 if (!$v['global']) { 321 $fav = unserialize($v['value']); 322 if (dc_valid_fav($fav['url'])) { 323 $count++; 324 $_menu['Favorites']->addItem(__($fav['title']),$fav['url'],$fav['small-icon'], 325 preg_match(dc_prepare_url($fav['url']),$_SERVER['REQUEST_URI']), 326 (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)),$fav['id'],$fav['class']); 327 } 328 } 329 } 330 if (!$count) { 331 // Global favorites if any 345 if (!$user_ui_nofavmenu) { 346 // Set favorites menu 347 $ws = $core->auth->user_prefs->addWorkspace('favorites'); 348 $count = 0; 332 349 foreach ($ws->dumpPrefs() as $k => $v) { 333 $fav = unserialize($v['value']); 334 if (dc_valid_fav($fav['url'])) { 335 $count++; 336 $_menu['Favorites']->addItem(__($fav['title']),$fav['url'],$fav['small-icon'], 337 preg_match(dc_prepare_url($fav['url']),$_SERVER['REQUEST_URI']), 338 (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)),$fav['id'],$fav['class']); 339 } 340 } 341 } 342 if (!$count) { 343 // No user or global favorites, add "new entry" fav 344 $_menu['Favorites']->addItem(__('New entry'),'post.php','images/menu/edit.png', 345 preg_match('/post.php$/',$_SERVER['REQUEST_URI']), 346 $core->auth->check('usage,contentadmin',$core->blog->id),'menu-new-post',null); 350 // User favorites only 351 if (!$v['global']) { 352 $fav = unserialize($v['value']); 353 if (dc_valid_fav($fav['url'])) { 354 $count++; 355 $_menu['Favorites']->addItem(__($fav['title']),$fav['url'],$fav['small-icon'], 356 preg_match(dc_prepare_url($fav['url']),$_SERVER['REQUEST_URI']), 357 (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)),$fav['id'],$fav['class']); 358 } 359 } 360 } 361 if (!$count) { 362 // Global favorites if any 363 foreach ($ws->dumpPrefs() as $k => $v) { 364 $fav = unserialize($v['value']); 365 if (dc_valid_fav($fav['url'])) { 366 $count++; 367 $_menu['Favorites']->addItem(__($fav['title']),$fav['url'],$fav['small-icon'], 368 preg_match(dc_prepare_url($fav['url']),$_SERVER['REQUEST_URI']), 369 (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)),$fav['id'],$fav['class']); 370 } 371 } 372 } 373 if (!$count) { 374 // No user or global favorites, add "new entry" fav 375 $_menu['Favorites']->addItem(__('New entry'),'post.php','images/menu/edit.png', 376 preg_match('/post.php$/',$_SERVER['REQUEST_URI']), 377 $core->auth->check('usage,contentadmin',$core->blog->id),'menu-new-post',null); 378 } 379 } 380 381 if (empty($core->blog->settings->system->jquery_migrate_mute)) { 382 $core->blog->settings->system->put('jquery_migrate_mute', true, 'boolean', 'Mute warnings for jquery migrate plugin ?', false); 347 383 } 348 384 } -
inc/admin/prepend.php
r1771 r1793 267 267 'images/menu/langs.png','images/menu/langs-b.png', 268 268 null,null,null)); 269 270 $_fav['help'] = new ArrayObject(array('help','Global help','help.php', 271 'images/menu/help.png','images/menu/help-b.png', 272 '*',null,null)); 269 273 270 274 # Menus creation
Note: See TracChangeset
for help on using the changeset viewer.