Dotclear


Ignore:
Timestamp:
02/05/16 17:05:45 (9 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Use new pref type 'array' for some prefs, addresses #1833

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/admin/class.dc.favorites.php

    r3075 r3161  
    5252 
    5353          if ($this->ws->prefExists('favorites')) { 
    54                $this->local_prefs = @unserialize($this->ws->getLocal('favorites')); 
    55                $this->global_prefs = @unserialize($this->ws->getGlobal('favorites')); 
     54               $this->local_prefs = $this->ws->getLocal('favorites'); 
     55               $this->global_prefs = $this->ws->getGlobal('favorites'); 
    5656               // Since we never know what user puts through user:preferences ... 
    5757               if (!is_array($this->local_prefs)) { 
     
    106106               $fattr = $this->fav_defs[$p]; 
    107107          } 
    108           $fattr = array_merge (array('id' => null,'class'=>null),$fattr); 
     108          $fattr = array_merge(array('id' => null,'class' => null),$fattr); 
    109109          if (isset($fattr['permissions'])) { 
    110110               if (is_bool($fattr['permissions']) && !$fattr['permissions'] ) { 
     
    158158          $u = explode('?',$_SERVER['REQUEST_URI']); 
    159159          // Loop over prefs to enable active favorites 
    160           foreach ($this->user_prefs as $k=>&$v) { 
     160          foreach ($this->user_prefs as $k => &$v) { 
    161161               if (isset($v['active_cb']) && is_callable($v['active_cb'])) { 
    162162                    // Use callback if defined to match whether favorite is active or not 
     
    164164               } else { 
    165165                    // Failback active detection. We test against URI name & parameters 
    166                     $v['active']=true; // true until something proves it is false 
     166                    $v['active'] = true; // true until something proves it is false 
    167167                    $u = explode('?',$v['url'],2); 
    168168                    if (!preg_match('/'.preg_quote($u[0],"/").'/',$_SERVER['REQUEST_URI'])) { 
     
    203203               } 
    204204          } 
    205           $this->ws->put('favorites',serialize($this->global_prefs),'string','User favorites',true,true); 
    206           $this->ws->put('favorites',serialize($this->local_prefs)); 
     205          $this->ws->put('favorites',$this->global_prefs,'array','User favorites',true,true); 
     206          $this->ws->put('favorites',$this->local_prefs); 
    207207          $this->user_prefs = $this->getFavorites($this->local_prefs); 
    208208     } 
     
    271271     */ 
    272272     public function setFavoriteIDs($ids,$global=false) { 
    273           $this->ws->put('favorites',serialize($ids),null,null,true,$global); 
     273          $this->ws->put('favorites',$ids,null,null,true,$global); 
    274274     } 
    275275 
     
    307307     */ 
    308308     public function appendMenu($menu) { 
    309           foreach ($this->user_prefs as $k=>$v) { 
     309          foreach ($this->user_prefs as $k => $v) { 
    310310               $menu['Favorites']->addItem( 
    311311                    $v['title'], 
     
    330330     */ 
    331331     public function appendDashboardIcons($icons) { 
    332           foreach ($this->user_prefs as $k=>$v) { 
     332          foreach ($this->user_prefs as $k => $v) { 
    333333               if (isset($v['dashboard_cb']) && is_callable($v['dashboard_cb'])) { 
    334334                    $v = new ArrayObject($v); 
     
    368368     */ 
    369369      public function registerMultiple($data) { 
    370           foreach ($data as $k=>$v) { 
     370          foreach ($data as $k => $v) { 
    371371               $this->register($k,$v); 
    372372          } 
Note: See TracChangeset for help on using the changeset viewer.

Sites map