Merge remote branch 'origin/master'

This commit is contained in:
Pootle server
2010-08-28 12:40:25 +02:00
4 changed files with 19 additions and 13 deletions

View File

@@ -174,6 +174,8 @@ class ConfigFile
/** /**
* Sets config value * Sets config value
* *
* @uses $GLOBALS['cfg']
* @uses PMA_array_read()
* @uses PMA_array_remove() * @uses PMA_array_remove()
* @uses PMA_array_write() * @uses PMA_array_write()
* @param string $path * @param string $path
@@ -190,13 +192,17 @@ class ConfigFile
return; return;
} }
// remove if the path isn't protected and it's empty or has a default value // 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])) {
if (!isset($this->persistKeys[$canonical_path]) $default_value = $this->getDefault($canonical_path);
&& (($value === $default_value) || (empty($value) && empty($default_value)))) { // check $GLOBALS['cfg'] to allow overwriting options set in config.inc.php with default value
PMA_array_remove($path, $_SESSION[$this->id]); $current_global = PMA_array_read($canonical_path, $GLOBALS['cfg']);
} else { if (($value === $default_value && (defined('PMA_SETUP') || $current_global === $default_value))
PMA_array_write($path, $_SESSION[$this->id], $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);
} }
/** /**

View File

@@ -498,7 +498,7 @@ class FormDisplay
$values = array(); $values = array();
$to_save = array(); $to_save = array();
$is_setup_script = defined('PMA_SETUP') && PMA_SETUP; $is_setup_script = defined('PMA_SETUP');
if ($is_setup_script) { if ($is_setup_script) {
$this->_loadUserprefsInfo(); $this->_loadUserprefsInfo();
} }
@@ -706,7 +706,7 @@ class FormDisplay
if ($this->userprefs_keys === null) { if ($this->userprefs_keys === null) {
$this->userprefs_keys = array_flip(PMA_read_userprefs_fieldnames()); $this->userprefs_keys = array_flip(PMA_read_userprefs_fieldnames());
// read real config for user preferences display // read real config for user preferences display
$userprefs_disallow = defined('PMA_SETUP') && PMA_SETUP $userprefs_disallow = defined('PMA_SETUP')
? ConfigFile::getInstance()->get('UserprefsDisallow', array()) ? ConfigFile::getInstance()->get('UserprefsDisallow', array())
: $GLOBALS['cfg']['UserprefsDisallow']; : $GLOBALS['cfg']['UserprefsDisallow'];
$this->userprefs_disallow = array_flip($userprefs_disallow); $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' if (($system_path == 'MaxDbList' || $system_path == 'MaxTableList'
|| $system_path == 'QueryHistoryMax')) { || $system_path == 'QueryHistoryMax')) {
$opts['comment'] = sprintf(__('maximum %s'), $GLOBALS['cfg'][$system_path]); $opts['comment'] = sprintf(__('maximum %s'), $GLOBALS['cfg'][$system_path]);

View File

@@ -132,7 +132,7 @@ function display_input($path, $name, $description = '', $type, $value, $value_is
global $_FormDisplayGroup; global $_FormDisplayGroup;
static $base_dir, $img_path; static $base_dir, $img_path;
$is_setup_script = defined('PMA_SETUP') && PMA_SETUP; $is_setup_script = defined('PMA_SETUP');
if ($base_dir === null) { if ($base_dir === null) {
$base_dir = $is_setup_script ? '../' : ''; $base_dir = $is_setup_script ? '../' : '';
$img_path = $is_setup_script $img_path = $is_setup_script
@@ -298,7 +298,7 @@ function display_group_header($header_text)
return; return;
} }
$colspan = 2; $colspan = 2;
if (defined('PMA_SETUP') && PMA_SETUP) { if (defined('PMA_SETUP')) {
$colspan++; $colspan++;
} }
?> ?>
@@ -328,7 +328,7 @@ function display_group_footer()
function display_fieldset_bottom() function display_fieldset_bottom()
{ {
$colspan = 2; $colspan = 2;
if (defined('PMA_SETUP') && PMA_SETUP) { if (defined('PMA_SETUP')) {
$colspan++; $colspan++;
} }
?> ?>

View File

@@ -29,7 +29,7 @@ function PMA_config_get_validators()
if ($validators === null) { if ($validators === null) {
$cf = ConfigFile::getInstance(); $cf = ConfigFile::getInstance();
$validators = $cf->getDbEntry('_validators', array()); $validators = $cf->getDbEntry('_validators', array());
if (!defined('PMA_SETUP') || !PMA_SETUP) { if (!defined('PMA_SETUP')) {
$uvs = $cf->getDbEntry('_userValidators', array()); $uvs = $cf->getDbEntry('_userValidators', array());
foreach ($uvs as $field => $uv_list) { foreach ($uvs as $field => $uv_list) {
$uv_list = (array)$uv_list; $uv_list = (array)$uv_list;