Changeset 3161:468195e4ad8b
- Timestamp:
- 02/05/16 17:05:45 (10 years ago)
- Branch:
- default
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/media.php
r3153 r3161 146 146 $nb_last_dirs = (integer)($core->auth->user_prefs->interface->media_nb_last_dirs); 147 147 if ($nb_last_dirs > 0) { 148 $last_dirs = @unserialize($core->auth->user_prefs->interface->media_last_dirs);148 $last_dirs = $core->auth->user_prefs->interface->media_last_dirs; 149 149 if (!is_array($last_dirs)) { 150 150 $last_dirs = array(); … … 163 163 } 164 164 // Store new list 165 $core->auth->user_prefs->interface->put('media_last_dirs', serialize($last_dirs));165 $core->auth->user_prefs->interface->put('media_last_dirs',$last_dirs); 166 166 } 167 167 } … … 404 404 if ($nb_last_dirs > 0) { 405 405 if (!is_array($last_dirs)) { 406 $last_dirs = @unserialize($core->auth->user_prefs->interface->media_last_dirs);406 $last_dirs = $core->auth->user_prefs->interface->media_last_dirs; 407 407 } 408 408 if (is_array($last_dirs)) { -
inc/admin/class.dc.favorites.php
r3075 r3161 52 52 53 53 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'); 56 56 // Since we never know what user puts through user:preferences ... 57 57 if (!is_array($this->local_prefs)) { … … 106 106 $fattr = $this->fav_defs[$p]; 107 107 } 108 $fattr = array_merge (array('id' => null,'class'=>null),$fattr);108 $fattr = array_merge(array('id' => null,'class' => null),$fattr); 109 109 if (isset($fattr['permissions'])) { 110 110 if (is_bool($fattr['permissions']) && !$fattr['permissions'] ) { … … 158 158 $u = explode('?',$_SERVER['REQUEST_URI']); 159 159 // Loop over prefs to enable active favorites 160 foreach ($this->user_prefs as $k =>&$v) {160 foreach ($this->user_prefs as $k => &$v) { 161 161 if (isset($v['active_cb']) && is_callable($v['active_cb'])) { 162 162 // Use callback if defined to match whether favorite is active or not … … 164 164 } else { 165 165 // Failback active detection. We test against URI name & parameters 166 $v['active'] =true; // true until something proves it is false166 $v['active'] = true; // true until something proves it is false 167 167 $u = explode('?',$v['url'],2); 168 168 if (!preg_match('/'.preg_quote($u[0],"/").'/',$_SERVER['REQUEST_URI'])) { … … 203 203 } 204 204 } 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); 207 207 $this->user_prefs = $this->getFavorites($this->local_prefs); 208 208 } … … 271 271 */ 272 272 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); 274 274 } 275 275 … … 307 307 */ 308 308 public function appendMenu($menu) { 309 foreach ($this->user_prefs as $k =>$v) {309 foreach ($this->user_prefs as $k => $v) { 310 310 $menu['Favorites']->addItem( 311 311 $v['title'], … … 330 330 */ 331 331 public function appendDashboardIcons($icons) { 332 foreach ($this->user_prefs as $k =>$v) {332 foreach ($this->user_prefs as $k => $v) { 333 333 if (isset($v['dashboard_cb']) && is_callable($v['dashboard_cb'])) { 334 334 $v = new ArrayObject($v); … … 368 368 */ 369 369 public function registerMultiple($data) { 370 foreach ($data as $k =>$v) {370 foreach ($data as $k => $v) { 371 371 $this->register($k,$v); 372 372 } -
inc/dbschema/upgrade.php
r3159 r3161 486 486 settings2array('pings','pings_uris'); 487 487 settings2array('system','simpleMenu'); 488 prefs2array('dashboard','favorites'); 489 prefs2array('interface','media_last_dirs'); 488 490 } 489 491 … … 558 560 "AND pref_ws = '%s' ". 559 561 "AND pref_type = 'string'"; 560 $rs = $core->con->select(sprintf($strReqSelect,$pref,$ ns));562 $rs = $core->con->select(sprintf($strReqSelect,$pref,$ws)); 561 563 while ($rs->fetch()) { 562 564 $value = json_encode(unserialize($rs->pref_value)); -
plugins/userPref/index.php
r3091 r3161 27 27 try 28 28 { 29 foreach ($_POST['s'] as $ws => $s) 30 { 29 foreach ($_POST['s'] as $ws => $s) { 31 30 $core->auth->user_prefs->addWorkspace($ws); 32 33 foreach ($s as $k => $v) { 31 foreach ($s as $k => $v) { 32 if ($_POST['s_type'][$ws][$k] == 'array') { 33 $v = json_decode($v,true); 34 } 34 35 $core->auth->user_prefs->$ws->put($k,$v); 35 36 } … … 50 51 try 51 52 { 52 foreach ($_POST['gs'] as $ws => $s) 53 { 53 foreach ($_POST['gs'] as $ws => $s) { 54 54 $core->auth->user_prefs->addWorkspace($ws); 55 56 foreach ($s as $k => $v) { 55 foreach ($s as $k => $v) { 56 if ($_POST['gs_type'][$ws][$k] == 'array') { 57 $v = json_decode($v,true); 58 } 57 59 $core->auth->user_prefs->$ws->put($k,$v,null,null,true,true); 58 60 } … … 76 78 array(__('yes') => 1, __('no') => 0),$s['value'] ? 1 : 0); 77 79 } else { 78 $field = form::field(array($field_name.'['.$ws.']['.$id.']',$field_name.'_'.$ws.'_'.$id),40,null, 79 html::escapeHTML($s['value'])); 80 } 80 if ($s['type'] == 'array') { 81 $field = form::field(array($field_name.'['.$ws.']['.$id.']',$field_name.'_'.$ws.'_'.$id),40,null, 82 html::escapeHTML(json_encode($s['value']))); 83 } else { 84 $field = form::field(array($field_name.'['.$ws.']['.$id.']',$field_name.'_'.$ws.'_'.$id),40,null, 85 html::escapeHTML($s['value'])); 86 } 87 } 88 $type = form::hidden(array($field_name.'_type'.'['.$ws.']['.$id.']',$field_name.'_'.$ws.'_'.$id.'_type'), 89 html::escapeHTML($s['type'])); 81 90 82 91 $slabel = $strong_label ? '<strong>%s</strong>' : '%s'; … … 86 95 '<td scope="row"><label for="'.$field_name.'_'.$ws.'_'.$id.'">'.sprintf($slabel,html::escapeHTML($id)).'</label></td>'. 87 96 '<td>'.$field.'</td>'. 88 '<td>'.$s['type']. '</td>'.97 '<td>'.$s['type'].$type.'</td>'. 89 98 '<td>'.html::escapeHTML($s['label']).'</td>'. 90 99 '</tr>';
Note: See TracChangeset
for help on using the changeset viewer.