mark fields that user can disable in setup script

This commit is contained in:
Crack
2010-07-21 01:21:32 +02:00
parent 43a7629da9
commit cc9b5c9028
4 changed files with 11 additions and 8 deletions

View File

@@ -2324,8 +2324,7 @@ $cfg['disable'] = array(
'UseDbSearch' => false, 'UseDbSearch' => false,
'QueryHistoryDB' => false, 'QueryHistoryDB' => false,
'ShowPhpInfo' => false, 'ShowPhpInfo' => false,
'ShowChgPassword' => false 'ShowChgPassword' => false);
);
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// custom-setup by mkkeck: 2004-05-04 // custom-setup by mkkeck: 2004-05-04

View File

@@ -328,8 +328,12 @@ 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);
'userprefs_comment' => PMA_lang_name($system_path, 'cmt', '')); $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];
} }

View File

@@ -141,7 +141,7 @@ function display_input($path, $name, $description = '', $type, $value, $value_is
$field_class .= ($field_class == '' ? '' : ' ') . ($has_errors ? 'custom field-error' : 'custom'); $field_class .= ($field_class == '' ? '' : ' ') . ($has_errors ? 'custom field-error' : 'custom');
} }
$field_class = $field_class ? ' class="' . $field_class . '"' : ''; $field_class = $field_class ? ' class="' . $field_class . '"' : '';
$name_id = 'name="' . $path . '" id="' . $path . '"'; $name_id = 'name="' . htmlspecialchars($path) . '" id="' . htmlspecialchars($path) . '"';
$tr_class = $_FormDisplayGroup ? ' class="group-field"' : ''; $tr_class = $_FormDisplayGroup ? ' class="group-field"' : '';
if (isset($opts['setvalue']) && $opts['setvalue'] == ':group') { if (isset($opts['setvalue']) && $opts['setvalue'] == ':group') {
unset($opts['setvalue']); unset($opts['setvalue']);
@@ -182,6 +182,9 @@ 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

@@ -66,9 +66,6 @@ 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')
{ {
if ($type == 'name' && strpos($canonical_path, 'disable/') === 0) {
return __('Disable') . ': ' . lcfirst(PMA_lang_name(substr($canonical_path, 8), $type, $default));
}
$lang_key = str_replace( $lang_key = str_replace(
array('Servers/1/', 'disable/', '/'), array('Servers/1/', 'disable/', '/'),
array('Servers/', '', '_'), array('Servers/', '', '_'),