Changeset 25979 for extensions/AdminTools/include/MultiView.class.php
- Timestamp:
- Dec 17, 2013, 12:14:08 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AdminTools/include/MultiView.class.php
r25915 r25979 12 12 /** @var array $data */ 13 13 private $data = array(); 14 private $data_url_params = array(); 14 15 15 16 /** @var array $user */ … … 36 37 pwg_get_session_var('multiview', array()) 37 38 ); 39 40 $this->data_url_params = array_keys($this->data); 41 $this->data_url_params = array_map(create_function('$d', 'return "ato_".$d;'), $this->data_url_params); 38 42 } 39 43 … … 80 84 if (script_basename() == 'picture') 81 85 { 82 $url = duplicate_picture_url(array(), array_keys($this->data));86 $url = duplicate_picture_url(array(), $this->data_url_params); 83 87 } 84 88 else if (script_basename() == 'index') 85 89 { 86 $url = duplicate_index_url(array(), array_keys($this->data));90 $url = duplicate_index_url(array(), $this->data_url_params); 87 91 } 88 92 else 89 93 { 90 $url = get_query_string_diff( array_keys($this->data));94 $url = get_query_string_diff($this->data_url_params); 91 95 } 92 96 … … 111 115 'id' => $user['id'], 112 116 'username' => $user['username'], 117 'language' => $user['language'], 118 'theme' => $user['theme'], 113 119 ); 114 120 … … 130 136 131 137 // view_as 132 if (isset($_GET['ato_view_as'])) 133 { 134 $this->data['view_as'] = (int)$_GET['ato_view_as']; 135 } 136 if ($this->data['view_as'] != $user['id']) 137 { 138 $user = build_user($this->data['view_as'], true); 139 $this->data['theme'] = $user['theme']; 140 $this->data['lang'] = $user['language']; 138 if (!defined('IN_ADMIN')) 139 { 140 if (isset($_GET['ato_view_as'])) 141 { 142 $this->data['view_as'] = (int)$_GET['ato_view_as']; 143 } 144 if ($this->data['view_as'] != $user['id']) 145 { 146 $user = build_user($this->data['view_as'], true); 147 if (isset($_GET['ato_view_as'])) 148 { 149 $this->data['theme'] = $user['theme']; 150 $this->data['lang'] = $user['language']; 151 } 152 } 141 153 } 142 154 … … 195 207 $this->save(); 196 208 } 209 } 210 211 /** 212 * Returns the language of the current user if different from the current language 213 * false otherwise 214 */ 215 function get_user_language() 216 { 217 if (isset($this->user['language']) && isset($this->data['lang']) 218 && $this->user['language'] != $this->data['lang'] 219 ) 220 { 221 return $this->user['language']; 222 } 223 return false; 197 224 } 198 225
Note: See TracChangeset
for help on using the changeset viewer.