revert disable/* options

This commit is contained in:
Crack
2010-07-25 22:58:14 +02:00
parent 5afd385f30
commit b39567f381
6 changed files with 7 additions and 47 deletions

View File

@@ -2314,16 +2314,6 @@ $cfg['UserprefsDisallow'] = array();
*/ */
$cfg['UserprefsDeveloperTab'] = false; $cfg['UserprefsDeveloperTab'] = false;
/**
* User preferences: disabling options by users
*/
$cfg['disable'] = array(
'AllowUserDropDatabase' => false,
'UseDbSearch' => false,
'QueryHistoryDB' => false,
'ShowPhpInfo' => false,
'ShowChgPassword' => false);
/******************************************************************************* /*******************************************************************************
* Window title settings * Window title settings
*/ */

View File

@@ -321,12 +321,8 @@ class FormDisplay
'doc' => $this->getDocLink($system_path), 'doc' => $this->getDocLink($system_path),
'wiki' => $this->getWikiLink($system_path), 'wiki' => $this->getWikiLink($system_path),
'show_restore_default' => $show_restore_default, 'show_restore_default' => $show_restore_default,
'userprefs_allow' => $userprefs_allow); 'userprefs_allow' => $userprefs_allow,
$comment = PMA_lang_name($system_path, 'cmt', ''); 'userprefs_comment' => PMA_lang_name($system_path, 'cmt', ''));
if ($cf->getDefault('disable/' . $system_path) === false) {
$comment .= ($comment ? "\n" : '') . __('Users can disable this option');
}
$opts['userprefs_comment'] = $comment;
if (isset($form->default[$system_path])) { if (isset($form->default[$system_path])) {
$opts['setvalue'] = $form->default[$system_path]; $opts['setvalue'] = $form->default[$system_path];
} }
@@ -690,9 +686,7 @@ class FormDisplay
*/ */
private function _getOptName($path) private function _getOptName($path)
{ {
return str_replace( return str_replace(array('Servers/1/', '/'), array('Servers/', '_'), $path);
array('Servers/1/', 'disable/', '/'),
array('Servers/', '', '_'), $path);
} }
/** /**

View File

@@ -188,9 +188,6 @@ function display_input($path, $name, $description = '', $type, $value, $value_is
. ' value="' . htmlspecialchars($value) . '" />'; . ' value="' . htmlspecialchars($value) . '" />';
break; break;
case 'checkbox': case 'checkbox':
if (strpos($path, 'disable-') === 0) {
echo '<label for="' . htmlspecialchars($path) . '" title="' . __('Mark to disable this option') . '">' . __('Disable') . '</label> ';
}
echo '<span' . $field_class . '><input type="checkbox" ' . $name_id echo '<span' . $field_class . '><input type="checkbox" ' . $name_id
. ($value ? ' checked="checked"' : '') . ' /></span>'; . ($value ? ' checked="checked"' : '') . ' /></span>';
break; break;

View File

@@ -67,8 +67,8 @@ function PMA_lang($lang_key)
function PMA_lang_name($canonical_path, $type = 'name', $default = 'key') function PMA_lang_name($canonical_path, $type = 'name', $default = 'key')
{ {
$lang_key = str_replace( $lang_key = str_replace(
array('Servers/1/', 'disable/', '/'), array('Servers/1/', '/'),
array('Servers/', '', '_'), array('Servers/', '_'),
$canonical_path) . '_' . $type; $canonical_path) . '_' . $type;
return isset($GLOBALS["strConfig$lang_key"]) return isset($GLOBALS["strConfig$lang_key"])
? ($type == 'desc' ? PMA_lang($lang_key) : $GLOBALS["strConfig$lang_key"]) ? ($type == 'desc' ? PMA_lang($lang_key) : $GLOBALS["strConfig$lang_key"])

View File

@@ -20,10 +20,7 @@ $forms['Features']['General'] = array(
'ReplaceHelpImg', 'ReplaceHelpImg',
'SkipLockedTables', 'SkipLockedTables',
'MaxDbList', 'MaxDbList',
'MaxTableList', 'MaxTableList');
'disable/AllowUserDropDatabase',
'disable/UseDbSearch',
'disable/QueryHistoryDB');
$forms['Features']['Text_fields'] = array( $forms['Features']['Text_fields'] = array(
'CharEditing', 'CharEditing',
'CharTextareaCols', 'CharTextareaCols',
@@ -94,9 +91,7 @@ $forms['Main_frame']['Startup'] = array(
'SuggestDBName', 'SuggestDBName',
':group:end', ':group:end',
'ShowStats', 'ShowStats',
'ShowServerInfo', 'ShowServerInfo');
'disable/ShowPhpInfo',
'disable/ShowChgPassword');
$forms['Main_frame']['Browse'] = array( $forms['Main_frame']['Browse'] = array(
'NavigationBarIconic', 'NavigationBarIconic',
'ShowAll', 'ShowAll',

View File

@@ -151,22 +151,6 @@ function PMA_apply_userprefs(array $config_data)
if (!isset($whitelist[$path]) || isset($blacklist[$path])) { if (!isset($whitelist[$path]) || isset($blacklist[$path])) {
continue; continue;
} }
if (strpos($path, 'disable/') === 0) {
// write disable/ value
PMA_array_write($path, $cfg, $value);
// prepare path and value for disabled key
$path = substr($path, 8);
switch (gettype(PMA_array_read($path, $GLOBALS['PMA_Config']->default))) {
case 'string':
$value = '';
break;
case 'double':
case 'integer':
$value = 0;
default:
$value = false;
}
}
PMA_array_write($path, $cfg, $value); PMA_array_write($path, $cfg, $value);
} }
return $cfg; return $cfg;