Dotclear

Changeset 106:cca7b21765d2


Ignore:
Timestamp:
05/02/11 13:50:51 (14 years ago)
Author:
xpla@…
Branch:
userprefs
Message:

Bugfix for userprefs load.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • admin/index.php

    r82 r106  
    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     } 
    4677$core->auth->user_prefs->addWorkspace('dashboard'); 
    4778if (!$core->auth->user_prefs->dashboard->prefExists('doclinks')) { 
     
    221252 
    222253# Dashboard icons 
    223 echo '<div id="dashboard-main"><div id="icons" class="clear">'; 
     254echo '<div id="dashboard-main"><div id="icons">'; 
    224255foreach ($__dashboard_icons as $i) 
    225256{ 
  • inc/admin/prepend.php

    r85 r106  
    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      } 
    333 } 
     294     } 
    334295?> 
  • inc/core/class.dc.prefs.php

    r3 r106  
    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      private function loadPrefs() 
     50     public 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; 
    6263          } 
    6364           
Note: See TracChangeset for help on using the changeset viewer.

Sites map