Dropped server side functionality for reloading the left frame from user preferences forms
This commit is contained in:
parent
50266d206b
commit
9008ba42fa
@ -93,15 +93,6 @@ class PMA_Footer
|
||||
window.parent.refreshNavigation();
|
||||
}"
|
||||
);
|
||||
} else if (isset($_GET['reload_left_frame'])
|
||||
&& $_GET['reload_left_frame'] == '1'
|
||||
) {
|
||||
// reload left frame (used by user preferences)
|
||||
$this->_scripts->addCode(
|
||||
"if (window.parent && window.parent.frame_navigation) {
|
||||
window.parent.frame_navigation.location.reload();
|
||||
}"
|
||||
);
|
||||
}
|
||||
|
||||
// set current db, table and sql query in the querywindow
|
||||
|
||||
@ -223,42 +223,17 @@ function PMA_persistOption($path, $value, $default_value)
|
||||
/**
|
||||
* Redirects after saving new user preferences
|
||||
*
|
||||
* @param array $forms
|
||||
* @param array $old_settings
|
||||
* @param string $file_name
|
||||
* @param array $params
|
||||
* @param string $hash
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function PMA_userprefsRedirect(array $forms, array $old_settings, $file_name,
|
||||
function PMA_userprefsRedirect($file_name,
|
||||
$params = null, $hash = null
|
||||
) {
|
||||
$reload_left_frame = isset($params['reload_left_frame']) && $params['reload_left_frame'];
|
||||
if (!$reload_left_frame) {
|
||||
// compute differences and check whether left frame should be refreshed
|
||||
$old_settings = isset($old_settings['config_data'])
|
||||
? $old_settings['config_data']
|
||||
: array();
|
||||
$new_settings = ConfigFile::getInstance()->getConfigArray();
|
||||
$diff_keys = array_keys(
|
||||
array_diff_assoc($old_settings, $new_settings)
|
||||
+ array_diff_assoc($new_settings, $old_settings)
|
||||
);
|
||||
$check_keys = array('NaturalOrder', 'DefaultTabDatabase',
|
||||
'Server/hide_db', 'Server/only_db');
|
||||
$check_keys = array_merge(
|
||||
$check_keys, $forms['Left_frame']['Left_frame'],
|
||||
$forms['Left_frame']['Left_databases']
|
||||
);
|
||||
$diff = array_intersect($check_keys, $diff_keys);
|
||||
$reload_left_frame = !empty($diff);
|
||||
}
|
||||
|
||||
// redirect
|
||||
$url_params = array(
|
||||
'saved' => 1,
|
||||
'reload_left_frame' => $reload_left_frame);
|
||||
$url_params = array('saved' => 1);
|
||||
if (is_array($params)) {
|
||||
$url_params = array_merge($params, $url_params);
|
||||
}
|
||||
|
||||
@ -52,15 +52,15 @@ if (isset($_POST['revert'])) {
|
||||
$error = null;
|
||||
if ($form_display->process(false) && !$form_display->hasErrors()) {
|
||||
// save settings
|
||||
$old_settings = PMA_loadUserprefs();
|
||||
$result = PMA_saveUserprefs(ConfigFile::getInstance()->getConfigArray());
|
||||
if ($result === true) {
|
||||
// reload config
|
||||
$GLOBALS['PMA_Config']->loadUserPreferences();
|
||||
$hash = ltrim(filter_input(INPUT_POST, 'tab_hash'), '#');
|
||||
PMA_userprefsRedirect(
|
||||
$forms, $old_settings, 'prefs_forms.php',
|
||||
array('form' => $form_param), $hash
|
||||
'prefs_forms.php',
|
||||
array('form' => $form_param),
|
||||
$hash
|
||||
);
|
||||
exit;
|
||||
} else {
|
||||
|
||||
@ -142,29 +142,24 @@ if (isset($_POST['submit_export'])
|
||||
) {
|
||||
$_SESSION['PMA_Theme_Manager']->setActiveTheme($config['ThemeDefault']);
|
||||
$_SESSION['PMA_Theme_Manager']->setThemeCookie();
|
||||
$params['reload_left_frame'] = true;
|
||||
}
|
||||
if (isset($config['fontsize'])
|
||||
&& $config['fontsize'] != $GLOBALS['PMA_Config']->get('fontsize')
|
||||
) {
|
||||
$params['set_fontsize'] = $config['fontsize'];
|
||||
$params['reload_left_frame'] = true;
|
||||
}
|
||||
if (isset($config['lang'])
|
||||
&& $config['lang'] != $GLOBALS['lang']
|
||||
) {
|
||||
$params['lang'] = $config['lang'];
|
||||
$params['reload_left_frame'] = true;
|
||||
}
|
||||
if (isset($config['collation_connection'])
|
||||
&& $config['collation_connection'] != $GLOBALS['collation_connection']
|
||||
) {
|
||||
$params['collation_connection'] = $config['collation_connection'];
|
||||
$params['reload_left_frame'] = true;
|
||||
}
|
||||
|
||||
// save settings
|
||||
$old_settings = PMA_loadUserprefs();
|
||||
$result = PMA_saveUserprefs($cf->getConfigArray());
|
||||
if ($result === true) {
|
||||
if ($return_url) {
|
||||
@ -183,14 +178,13 @@ if (isset($_POST['submit_export'])
|
||||
}
|
||||
// reload config
|
||||
$GLOBALS['PMA_Config']->loadUserPreferences();
|
||||
PMA_userprefsRedirect($forms, $old_settings, $return_url, $params);
|
||||
PMA_userprefsRedirect($return_url, $params);
|
||||
exit;
|
||||
} else {
|
||||
$error = $result;
|
||||
}
|
||||
}
|
||||
} else if (isset($_POST['submit_clear'])) {
|
||||
$old_settings = PMA_loadUserprefs();
|
||||
$result = PMA_saveUserprefs(array());
|
||||
if ($result === true) {
|
||||
$params = array();
|
||||
@ -200,15 +194,13 @@ if (isset($_POST['submit_export'])
|
||||
);
|
||||
unset($_SESSION['PMA_Theme_Manager']);
|
||||
unset($_SESSION['PMA_Theme']);
|
||||
$params['reload_left_frame'] = true;
|
||||
}
|
||||
if ($GLOBALS['PMA_Config']->get('fontsize') != '82%') {
|
||||
$GLOBALS['PMA_Config']->removeCookie('pma_fontsize');
|
||||
$params['reload_left_frame'] = true;
|
||||
}
|
||||
$GLOBALS['PMA_Config']->removeCookie('pma_collaction_connection');
|
||||
$GLOBALS['PMA_Config']->removeCookie('pma_lang');
|
||||
PMA_userprefsRedirect($forms, $old_settings, 'prefs_manage.php', $params);
|
||||
PMA_userprefsRedirect('prefs_manage.php', $params);
|
||||
exit;
|
||||
} else {
|
||||
$error = $result;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user