Changeset 85:8d0186be4d79 for inc/admin/prepend.php
- Timestamp:
- 05/02/11 09:20:35 (14 years ago)
- Branch:
- userprefs
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/prepend.php
r80 r85 147 147 } 148 148 */ 149 }150 151 if (!empty($_GET['logout'])) {152 // Nothing more to do here before logout153 return;154 149 } 155 150 … … 298 293 $core->auth->check('usage,contentadmin',$core->blog->id) && $core->auth->blog_count > 1); 299 294 300 // Set favorites menu 301 $ws = $core->auth->user_prefs->addWorkspace('favorites'); 302 $count = 0; 303 foreach ($ws->dumpPrefs() as $k => $v) { 304 // User favorites only 305 if (!$v['global']) { 306 $count++; 307 $fav = unserialize($v['value']); 308 $_menu['Favorites']->addItem($fav['title'],$fav['url'],$fav['small-icon'], 309 preg_match('/'.$fav['url'].'(\?.*)?$/',$_SERVER['REQUEST_URI']), 310 (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)),$fav['id'],$fav['class']); 311 } 312 } 313 if (!$count) { 314 // Global favorites if any 295 try { 296 // Set favorites menu 297 $ws = $core->auth->user_prefs->addWorkspace('favorites'); 298 $count = 0; 315 299 foreach ($ws->dumpPrefs() as $k => $v) { 316 $count++; 317 $fav = unserialize($v['value']); 318 $_menu['Favorites']->addItem($fav['title'],$fav['url'],$fav['small-icon'], 319 preg_match('/'.$fav['url'].'(\?.*)?$/',$_SERVER['REQUEST_URI']), 320 (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)),$fav['id'],$fav['class']); 321 } 322 } 323 if (!$count) { 324 // No user or global favorites, add "new entry" fav 325 $_menu['Favorites']->addItem(__('New entry'),'post.php','images/menu/edit.png', 326 preg_match('/post.php$/',$_SERVER['REQUEST_URI']), 327 $core->auth->check('usage,contentadmin',$core->blog->id),'menu-new-post',null); 300 // User favorites only 301 if (!$v['global']) { 302 $count++; 303 $fav = unserialize($v['value']); 304 $_menu['Favorites']->addItem($fav['title'],$fav['url'],$fav['small-icon'], 305 preg_match('/'.$fav['url'].'(\?.*)?$/',$_SERVER['REQUEST_URI']), 306 (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)),$fav['id'],$fav['class']); 307 } 308 } 309 if (!$count) { 310 // Global favorites if any 311 foreach ($ws->dumpPrefs() as $k => $v) { 312 $count++; 313 $fav = unserialize($v['value']); 314 $_menu['Favorites']->addItem($fav['title'],$fav['url'],$fav['small-icon'], 315 preg_match('/'.$fav['url'].'(\?.*)?$/',$_SERVER['REQUEST_URI']), 316 (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)),$fav['id'],$fav['class']); 317 } 318 } 319 if (!$count) { 320 // No user or global favorites, add "new entry" fav 321 $_menu['Favorites']->addItem(__('New entry'),'post.php','images/menu/edit.png', 322 preg_match('/post.php$/',$_SERVER['REQUEST_URI']), 323 $core->auth->check('usage,contentadmin',$core->blog->id),'menu-new-post',null); 324 } 325 } catch (Exception $e) { 326 $version = $core->getVersion('core'); 327 if (version_compare($version,'2.3','<')) { 328 ; // Ignore lack of dc_pref table before the logout following an auto-update 329 } else { 330 $core->error->add($e->getMessage()); 331 } 328 332 } 329 333 }
Note: See TracChangeset
for help on using the changeset viewer.