The branch, master has been updated via c0482e135b3a01ede5328ee8fbeb920e1345f3a2 (commit) via a82b355fc90081194c71806f851274fa817bbed2 (commit) via 1dba66c13f5cb4e89ae326654bfa8c350974a601 (commit) from 9a9399e07a7b1d11e18e1dd0aa7a2668188fc03c (commit)
- Log ----------------------------------------------------------------- commit c0482e135b3a01ede5328ee8fbeb920e1345f3a2 Merge: a82b355fc90081194c71806f851274fa817bbed2 9a9399e07a7b1d11e18e1dd0aa7a2668188fc03c Author: Crack piotrprz@gmail.com Date: Sat Aug 28 12:12:52 2010 +0200
Merge branch 'master' of ssh://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit a82b355fc90081194c71806f851274fa817bbed2 Author: Crack piotrprz@gmail.com Date: Fri Aug 27 15:57:45 2010 +0200
simplified PMA_SETUP checks
commit 1dba66c13f5cb4e89ae326654bfa8c350974a601 Author: Crack piotrprz@gmail.com Date: Fri Aug 27 15:55:06 2010 +0200
user cannot restore a setting to its default value if it's set in config.inc.php
-----------------------------------------------------------------------
Summary of changes: libraries/config/ConfigFile.class.php | 18 ++++++++++++------ libraries/config/FormDisplay.class.php | 6 +++--- libraries/config/FormDisplay.tpl.php | 6 +++--- libraries/config/validate.lib.php | 2 +- 4 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/libraries/config/ConfigFile.class.php b/libraries/config/ConfigFile.class.php index 41ffe4b..7a15a89 100644 --- a/libraries/config/ConfigFile.class.php +++ b/libraries/config/ConfigFile.class.php @@ -174,6 +174,8 @@ class ConfigFile /** * Sets config value * + * @uses $GLOBALS['cfg'] + * @uses PMA_array_read() * @uses PMA_array_remove() * @uses PMA_array_write() * @param string $path @@ -190,13 +192,17 @@ class ConfigFile return; } // remove if the path isn't protected and it's empty or has a default value - $default_value = $this->getDefault($canonical_path); - if (!isset($this->persistKeys[$canonical_path]) - && (($value === $default_value) || (empty($value) && empty($default_value)))) { - PMA_array_remove($path, $_SESSION[$this->id]); - } else { - PMA_array_write($path, $_SESSION[$this->id], $value); + if (!isset($this->persistKeys[$canonical_path])) { + $default_value = $this->getDefault($canonical_path); + // check $GLOBALS['cfg'] to allow overwriting options set in config.inc.php with default value + $current_global = PMA_array_read($canonical_path, $GLOBALS['cfg']); + if (($value === $default_value && (defined('PMA_SETUP') || $current_global === $default_value)) + || (empty($value) && empty($default_value) && (defined('PMA_SETUP') || empty($current_global)))) { + PMA_array_remove($path, $_SESSION[$this->id]); + return; + } } + PMA_array_write($path, $_SESSION[$this->id], $value); }
/** diff --git a/libraries/config/FormDisplay.class.php b/libraries/config/FormDisplay.class.php index 5a08f5e..fb07052 100755 --- a/libraries/config/FormDisplay.class.php +++ b/libraries/config/FormDisplay.class.php @@ -498,7 +498,7 @@ class FormDisplay
$values = array(); $to_save = array(); - $is_setup_script = defined('PMA_SETUP') && PMA_SETUP; + $is_setup_script = defined('PMA_SETUP'); if ($is_setup_script) { $this->_loadUserprefsInfo(); } @@ -706,7 +706,7 @@ class FormDisplay if ($this->userprefs_keys === null) { $this->userprefs_keys = array_flip(PMA_read_userprefs_fieldnames()); // read real config for user preferences display - $userprefs_disallow = defined('PMA_SETUP') && PMA_SETUP + $userprefs_disallow = defined('PMA_SETUP') ? ConfigFile::getInstance()->get('UserprefsDisallow', array()) : $GLOBALS['cfg']['UserprefsDisallow']; $this->userprefs_disallow = array_flip($userprefs_disallow); @@ -767,7 +767,7 @@ class FormDisplay } } } - if (!defined('PMA_SETUP') || !PMA_SETUP) { + if (!defined('PMA_SETUP')) { if (($system_path == 'MaxDbList' || $system_path == 'MaxTableList' || $system_path == 'QueryHistoryMax')) { $opts['comment'] = sprintf(__('maximum %s'), $GLOBALS['cfg'][$system_path]); diff --git a/libraries/config/FormDisplay.tpl.php b/libraries/config/FormDisplay.tpl.php index 40c59d1..8667208 100644 --- a/libraries/config/FormDisplay.tpl.php +++ b/libraries/config/FormDisplay.tpl.php @@ -132,7 +132,7 @@ function display_input($path, $name, $description = '', $type, $value, $value_is global $_FormDisplayGroup; static $base_dir, $img_path;
- $is_setup_script = defined('PMA_SETUP') && PMA_SETUP; + $is_setup_script = defined('PMA_SETUP'); if ($base_dir === null) { $base_dir = $is_setup_script ? '../' : ''; $img_path = $is_setup_script @@ -298,7 +298,7 @@ function display_group_header($header_text) return; } $colspan = 2; - if (defined('PMA_SETUP') && PMA_SETUP) { + if (defined('PMA_SETUP')) { $colspan++; } ?> @@ -328,7 +328,7 @@ function display_group_footer() function display_fieldset_bottom() { $colspan = 2; - if (defined('PMA_SETUP') && PMA_SETUP) { + if (defined('PMA_SETUP')) { $colspan++; } ?> diff --git a/libraries/config/validate.lib.php b/libraries/config/validate.lib.php index 7c35fff..59df2b8 100755 --- a/libraries/config/validate.lib.php +++ b/libraries/config/validate.lib.php @@ -29,7 +29,7 @@ function PMA_config_get_validators() if ($validators === null) { $cf = ConfigFile::getInstance(); $validators = $cf->getDbEntry('_validators', array()); - if (!defined('PMA_SETUP') || !PMA_SETUP) { + if (!defined('PMA_SETUP')) { $uvs = $cf->getDbEntry('_userValidators', array()); foreach ($uvs as $field => $uv_list) { $uv_list = (array)$uv_list;
hooks/post-receive