Changeset 25979 for extensions/AdminTools/include
- Timestamp:
- Dec 17, 2013, 12:14:08 PM (10 years ago)
- Location:
- extensions/AdminTools/include
- Files:
-
- 2 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 -
extensions/AdminTools/include/events.inc.php
r25916 r25979 26 26 $tpl_vars['DELETE_CACHE'] = isset($conf['multiview_invalidate_cache']); 27 27 28 include_once(PHPWG_ROOT_PATH . 'include/functions_mail.inc.php'); 29 switch_lang_to(get_default_language()); 28 if (($admin_lang = $MultiView->get_user_language()) !== false) 29 { 30 include_once(PHPWG_ROOT_PATH . 'include/functions_mail.inc.php'); 31 switch_lang_to($admin_lang); 32 } 30 33 } 31 34 else if (script_basename() == 'picture' and $picture['current']['added_by'] == $user['id']) … … 76 79 ); 77 80 78 $query = ' 79 SELECT id FROM ' . CATEGORIES_TABLE.' 80 WHERE id = ' . $page['category']['id'] .' 81 AND representative_picture_id = ' . $page['image_id'] .' 82 ;'; 83 $tpl_vars['IS_REPRESENTATIVE'] = pwg_db_num_rows(pwg_query($query)) > 0; 81 $tpl_vars['IS_REPRESENTATIVE'] = $page['category']['representative_picture_id'] == $page['image_id']; 84 82 } 85 83 … … 167 165 $template->parse('ato_public_controller'); 168 166 169 if ($MultiView->is_admin() )167 if ($MultiView->is_admin() && @$admin_lang !== false) 170 168 { 171 169 switch_lang_back();
Note: See TracChangeset
for help on using the changeset viewer.