Dotclear

Changeset 80:095353a21556 for inc


Ignore:
Timestamp:
05/02/11 08:10:42 (14 years ago)
Author:
Franck <carnet.franck.paul@…>
Branch:
userprefs
Message:

Finally avoid to do some unecessary things before logout

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/admin/prepend.php

    r79 r80  
    147147     } 
    148148*/ 
     149} 
     150 
     151if (!empty($_GET['logout'])) { 
     152     // Nothing more to do here before logout 
     153     return; 
    149154} 
    150155 
     
    293298          $core->auth->check('usage,contentadmin',$core->blog->id) && $core->auth->blog_count > 1); 
    294299 
    295      try { 
    296           // Set favorites menu 
    297           $ws = $core->auth->user_prefs->addWorkspace('favorites'); 
    298           $count = 0; 
     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 
    299315          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','<') && !empty($_GET['logout'])) { 
    328                ;    // Ignore lack of dc_pref table before the logout following an auto-update 
    329           } else { 
    330                $core->error->add($e->getMessage()); 
    331           } 
     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); 
    332328     } 
    333329} 
Note: See TracChangeset for help on using the changeset viewer.

Sites map