Dotclear

Changeset 139:3ccd56e7922b


Ignore:
Timestamp:
05/04/11 13:26:40 (14 years ago)
Author:
xave <xave@…>
Branch:
userprefs
Message:

Back where we started!

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • admin/index.php

    r130 r139  
    4444 
    4545# Check dashboard module prefs 
    46 $core->auth->user_prefs->loadPrefs(); 
    47       
    48      // Set favorites menu 
    49      $ws = $core->auth->user_prefs->addWorkspace('favorites'); 
    50      $count = 0; 
    51      foreach ($ws->dumpPrefs() as $k => $v) { 
    52           // User favorites only 
    53           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 any 
    63           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" fav 
    73           $_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      } 
    7746$core->auth->user_prefs->addWorkspace('dashboard'); 
    7847if (!$core->auth->user_prefs->dashboard->prefExists('doclinks')) { 
  • inc/admin/prepend.php

    r106 r139  
    292292          $core->auth->isSuperAdmin() || 
    293293          $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     } 
    294333     } 
    295334?> 
  • inc/core/class.dc.prefs.php

    r106 r139  
    4242          $this->table = $core->prefix.'pref'; 
    4343          $this->user_id =& $user_id; 
    44           //~ $this->loadPrefs(); 
     44          $this->loadPrefs(); 
    4545     } 
    4646      
     
    4848     Retrieves all workspaces (and their prefs) from database, with one query.  
    4949     */ 
    50      public function loadPrefs() 
     50     private function loadPrefs() 
    5151     { 
    5252          $strReq = 'SELECT user_id, pref_id, pref_value, '. 
     
    6060          } catch (Exception $e) { 
    6161               trigger_error(__('Unable to retrieve workspaces:').' '.$this->con->error(), E_USER_ERROR); 
    62                throw $e; 
    6362          } 
    6463           
Note: See TracChangeset for help on using the changeset viewer.

Sites map