Changeset 139:3ccd56e7922b
- Timestamp:
- 05/04/11 13:26:40 (14 years ago)
- Branch:
- userprefs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/index.php
r130 r139 44 44 45 45 # Check dashboard module prefs 46 $core->auth->user_prefs->loadPrefs();47 48 // Set favorites menu49 $ws = $core->auth->user_prefs->addWorkspace('favorites');50 $count = 0;51 foreach ($ws->dumpPrefs() as $k => $v) {52 // User favorites only53 if (!$v['global']) {54 $count++;55 $fav = unserialize($v['value']);56 $_menu['Favorites']->addItem($fav['title'],$fav['url'],$fav['small-icon'],57 preg_match('/'.$fav['url'].'(\?.*)?$/',$_SERVER['REQUEST_URI']),58 (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)),$fav['id'],$fav['class']);59 }60 }61 if (!$count) {62 // Global favorites if any63 foreach ($ws->dumpPrefs() as $k => $v) {64 $count++;65 $fav = unserialize($v['value']);66 $_menu['Favorites']->addItem($fav['title'],$fav['url'],$fav['small-icon'],67 preg_match('/'.$fav['url'].'(\?.*)?$/',$_SERVER['REQUEST_URI']),68 (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)),$fav['id'],$fav['class']);69 }70 }71 if (!$count) {72 // No user or global favorites, add "new entry" fav73 $_menu['Favorites']->addItem(__('New entry'),'post.php','images/menu/edit.png',74 preg_match('/post.php$/',$_SERVER['REQUEST_URI']),75 $core->auth->check('usage,contentadmin',$core->blog->id),'menu-new-post',null);76 }77 46 $core->auth->user_prefs->addWorkspace('dashboard'); 78 47 if (!$core->auth->user_prefs->dashboard->prefExists('doclinks')) { -
inc/admin/prepend.php
r106 r139 292 292 $core->auth->isSuperAdmin() || 293 293 $core->auth->check('usage,contentadmin',$core->blog->id) && $core->auth->blog_count > 1); 294 295 try { 296 // Set favorites menu 297 $ws = $core->auth->user_prefs->addWorkspace('favorites'); 298 $count = 0; 299 foreach ($ws->dumpPrefs() as $k => $v) { 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 } 332 } 294 333 } 295 334 ?> -
inc/core/class.dc.prefs.php
r106 r139 42 42 $this->table = $core->prefix.'pref'; 43 43 $this->user_id =& $user_id; 44 //~$this->loadPrefs();44 $this->loadPrefs(); 45 45 } 46 46 … … 48 48 Retrieves all workspaces (and their prefs) from database, with one query. 49 49 */ 50 p ublicfunction loadPrefs()50 private function loadPrefs() 51 51 { 52 52 $strReq = 'SELECT user_id, pref_id, pref_value, '. … … 60 60 } catch (Exception $e) { 61 61 trigger_error(__('Unable to retrieve workspaces:').' '.$this->con->error(), E_USER_ERROR); 62 throw $e;63 62 } 64 63
Note: See TracChangeset
for help on using the changeset viewer.