Skip to content

Commit

Permalink
Merge branch 'master' of github.com:phpmyadmin/phpmyadmin
Browse files Browse the repository at this point in the history
  • Loading branch information
lem9 committed Oct 28, 2012
2 parents a0cfa28 + 1a177f1 commit 417ccad
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 28 deletions.
6 changes: 3 additions & 3 deletions libraries/Config.class.php
Expand Up @@ -692,9 +692,9 @@ function loadUserPreferences()
) {
// load required libraries
include_once './libraries/user_preferences.lib.php';
$prefs = PMA_load_userprefs();
$prefs = PMA_loadUserprefs();
$_SESSION['cache'][$cache_key]['userprefs']
= PMA_apply_userprefs($prefs['config_data']);
= PMA_applyUserprefs($prefs['config_data']);
$_SESSION['cache'][$cache_key]['userprefs_mtime'] = $prefs['mtime'];
$_SESSION['cache'][$cache_key]['userprefs_type'] = $prefs['type'];
$_SESSION['cache'][$cache_key]['config_mtime'] = $config_mtime;
Expand Down Expand Up @@ -834,7 +834,7 @@ function setUserValue($cookie_name, $cfg_path, $new_cfg_value,
if ($default_value === null) {
$default_value = PMA_arrayRead($cfg_path, $this->default);
}
PMA_persist_option($cfg_path, $new_cfg_value, $default_value);
PMA_persistOption($cfg_path, $new_cfg_value, $default_value);
}
if ($prefs_type != 'db' && $cookie_name) {
// fall back to cookies
Expand Down
2 changes: 1 addition & 1 deletion libraries/config/FormDisplay.class.php
Expand Up @@ -736,7 +736,7 @@ private function _getOptName($path)
private function _loadUserprefsInfo()
{
if ($this->_userprefs_keys === null) {
$this->_userprefs_keys = array_flip(PMA_read_userprefs_fieldnames());
$this->_userprefs_keys = array_flip(PMA_readUserprefsFieldNames());
// read real config for user preferences display
$userprefs_disallow = defined('PMA_SETUP')
? ConfigFile::getInstance()->get('UserprefsDisallow', array())
Expand Down
22 changes: 11 additions & 11 deletions libraries/user_preferences.lib.php
Expand Up @@ -14,9 +14,9 @@
*
* @return void
*/
function PMA_userprefs_pageinit()
function PMA_userprefsPageInit()
{
$forms_all_keys = PMA_read_userprefs_fieldnames($GLOBALS['forms']);
$forms_all_keys = PMA_readUserprefsFieldNames($GLOBALS['forms']);
$cf = ConfigFile::getInstance();
$cf->resetConfigData(); // start with a clean instance
$cf->setAllowedKeys($forms_all_keys);
Expand All @@ -39,7 +39,7 @@ function PMA_userprefs_pageinit()
*
* @return array
*/
function PMA_load_userprefs()
function PMA_loadUserprefs()
{
$cfgRelation = PMA_getRelationsParam();
if (! $cfgRelation['userconfigwork']) {
Expand Down Expand Up @@ -76,7 +76,7 @@ function PMA_load_userprefs()
*
* @return true|PMA_Message
*/
function PMA_save_userprefs(array $config_array)
function PMA_saveUserprefs(array $config_array)
{
$cfgRelation = PMA_getRelationsParam();
$server = isset($GLOBALS['server'])
Expand Down Expand Up @@ -137,7 +137,7 @@ function PMA_save_userprefs(array $config_array)
*
* @return array
*/
function PMA_apply_userprefs(array $config_data)
function PMA_applyUserprefs(array $config_data)
{
$cfg = array();
$blacklist = array_flip($GLOBALS['cfg']['UserprefsDisallow']);
Expand All @@ -147,7 +147,7 @@ function PMA_apply_userprefs(array $config_data)
$blacklist['Error_Handler/gather'] = true;
$blacklist['DBG/sql'] = true;
}
$whitelist = array_flip(PMA_read_userprefs_fieldnames());
$whitelist = array_flip(PMA_readUserprefsFieldNames());
// whitelist some additional fields which are custom handled
$whitelist['ThemeDefault'] = true;
$whitelist['fontsize'] = true;
Expand All @@ -171,7 +171,7 @@ function PMA_apply_userprefs(array $config_data)
*
* @return array
*/
function PMA_read_userprefs_fieldnames(array $forms = null)
function PMA_readUserprefsFieldNames(array $forms = null)
{
static $names;

Expand Down Expand Up @@ -205,9 +205,9 @@ function PMA_read_userprefs_fieldnames(array $forms = null)
*
* @return void
*/
function PMA_persist_option($path, $value, $default_value)
function PMA_persistOption($path, $value, $default_value)
{
$prefs = PMA_load_userprefs();
$prefs = PMA_loadUserprefs();
if ($value === $default_value) {
if (isset($prefs['config_data'][$path])) {
unset($prefs['config_data'][$path]);
Expand All @@ -217,7 +217,7 @@ function PMA_persist_option($path, $value, $default_value)
} else {
$prefs['config_data'][$path] = $value;
}
PMA_save_userprefs($prefs['config_data']);
PMA_saveUserprefs($prefs['config_data']);
}

/**
Expand All @@ -231,7 +231,7 @@ function PMA_persist_option($path, $value, $default_value)
*
* @return void
*/
function PMA_userprefs_redirect(array $forms, array $old_settings, $file_name,
function PMA_userprefsRedirect(array $forms, array $old_settings, $file_name,
$params = null, $hash = null
) {
$reload_left_frame = isset($params['reload_left_frame']) && $params['reload_left_frame'];
Expand Down
8 changes: 4 additions & 4 deletions prefs_forms.php
Expand Up @@ -18,7 +18,7 @@
require_once 'libraries/config/FormDisplay.class.php';
require 'libraries/config/user_preferences.forms.php';

PMA_userprefs_pageinit();
PMA_userprefsPageInit();

// handle form processing

Expand Down Expand Up @@ -52,13 +52,13 @@
$error = null;
if ($form_display->process(false) && !$form_display->hasErrors()) {
// save settings
$old_settings = PMA_load_userprefs();
$result = PMA_save_userprefs(ConfigFile::getInstance()->getConfigArray());
$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_userprefs_redirect(
PMA_userprefsRedirect(
$forms, $old_settings, 'prefs_forms.php',
array('form' => $form_param), $hash
);
Expand Down
18 changes: 9 additions & 9 deletions prefs_manage.php
Expand Up @@ -18,7 +18,7 @@
require_once 'libraries/config/FormDisplay.class.php';
require 'libraries/config/user_preferences.forms.php';

PMA_userprefs_pageinit();
PMA_userprefsPageInit();

$error = '';
if (isset($_POST['submit_export'])
Expand All @@ -28,11 +28,11 @@
PMA_Response::getInstance()->disable();
$filename = 'phpMyAdmin-config-' . urlencode(PMA_getenv('HTTP_HOST')) . '.json';
PMA_downloadHeader($filename, 'application/json');
$settings = PMA_load_userprefs();
$settings = PMA_loadUserprefs();
echo json_encode($settings['config_data']);
exit;
} else if (isset($_POST['submit_get_json'])) {
$settings = PMA_load_userprefs();
$settings = PMA_loadUserprefs();
$response = PMA_Response::getInstance();
$response->addJSON('prefs', json_encode($settings['config_data']));
$response->addJSON('mtime', $settings['mtime']);
Expand Down Expand Up @@ -164,8 +164,8 @@
}

// save settings
$old_settings = PMA_load_userprefs();
$result = PMA_save_userprefs($cf->getConfigArray());
$old_settings = PMA_loadUserprefs();
$result = PMA_saveUserprefs($cf->getConfigArray());
if ($result === true) {
if ($return_url) {
$query = explode('&', parse_url($return_url, PHP_URL_QUERY));
Expand All @@ -183,15 +183,15 @@
}
// reload config
$GLOBALS['PMA_Config']->loadUserPreferences();
PMA_userprefs_redirect($forms, $old_settings, $return_url, $params);
PMA_userprefsRedirect($forms, $old_settings, $return_url, $params);
exit;
} else {
$error = $result;
}
}
} else if (isset($_POST['submit_clear'])) {
$old_settings = PMA_load_userprefs();
$result = PMA_save_userprefs(array());
$old_settings = PMA_loadUserprefs();
$result = PMA_saveUserprefs(array());
if ($result === true) {
$params = array();
if ($_SESSION['PMA_Theme_Manager']->theme->getId() != 'original') {
Expand All @@ -208,7 +208,7 @@
}
$GLOBALS['PMA_Config']->removeCookie('pma_collaction_connection');
$GLOBALS['PMA_Config']->removeCookie('pma_lang');
PMA_userprefs_redirect($forms, $old_settings, 'prefs_manage.php', $params);
PMA_userprefsRedirect($forms, $old_settings, 'prefs_manage.php', $params);
exit;
} else {
$error = $result;
Expand Down

0 comments on commit 417ccad

Please sign in to comment.