Feature #306 and Bug #5277 - Transforming the administrator's setting "Platform character set" from text box into select box. For now, the list of proposed encodings is not restricted according the platform language + enabled languages, for avoiding questions in the forums. Suppressing an annoying warning caused by htmlspecialchars() in PEAR's html forms and other minor fixes.

skala
Ivan Tcholakov 17 years ago
parent 7409c475af
commit 9522150c9c
  1. 29
      main/admin/settings.php
  2. 2
      main/inc/lib/pear/HTML/Common.php

@ -80,7 +80,7 @@ $interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAd
$tool_name = get_lang('DokeosConfigSettings');
// Build the form
if (!empty($_GET['category']) and !in_array($_GET['category'], array('Plugins', 'stylesheets', 'Search')))
if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', 'stylesheets', 'Search')))
{
$form = new FormValidator('settings', 'post', 'settings.php?category='.$_GET['category']);
$renderer = & $form->defaultRenderer();
@ -187,6 +187,31 @@ if (!empty($_GET['category']) and !in_array($_GET['category'], array('Plugins',
$form->addElement('text', $row['variable'], get_lang($row['comment']),array('maxlength'=>'5'));
$form->applyFilter($row['variable'],'html_filter');
$default_values[$row['variable']] = $row['selected_value'];
// For platform character set selection: Conversion of the textfield to a select box with valid values.
} elseif ($row['variable'] == 'platform_charset') {
$current_system_encoding = api_refine_encoding_id(trim($row['selected_value']));
$valid_encodings = array_flip(api_get_valid_encodings());
if (!isset($valid_encodings[$current_system_encoding])) {
$is_alias_encoding = false;
foreach ($valid_encodings as $encoding) {
if (api_equal_encodings($encoding, $current_system_encoding)) {
$is_alias_encoding = true;
$current_system_encoding = $encoding;
break;
}
}
if (!$is_alias_encoding) {
$valid_encodings[$current_system_encoding] = $current_system_encoding;
}
}
foreach ($valid_encodings as $key => &$encoding) {
$encoding = api_is_encoding_supported($key) ? $key : $key.' (n.a.)';
}
$form->addElement('select', $row['variable'], get_lang($row['comment']), $valid_encodings);
$default_values[$row['variable']] = $current_system_encoding;
//
} else {
$form->addElement('text', $row['variable'], get_lang($row['comment']),$hideme);
$form->applyFilter($row['variable'],'html_filter');
@ -367,7 +392,7 @@ echo "\n\t<a href=\"".api_get_self()."?category=Templates\">".Display::return_ic
echo "\n\t<a href=\"".api_get_self()."?category=Search\">".Display::return_icon($action_images['search'], api_ucfirst(get_lang('Search'))).api_ucfirst(get_lang('Search'))."</a>";
echo "\n</div>";
if (isset ($_GET['category']))
if (!empty($_GET['category']))
{
switch ($_GET['category'])
{

@ -138,7 +138,7 @@ class HTML_Common {
global $charset;
if (is_array($attributes)) {
foreach ($attributes as $key => $value) {
$strAttr .= ' ' . $key . '="' . htmlspecialchars($value, ENT_QUOTES, $charset) . '"';
$strAttr .= ' ' . $key . '="' . @htmlspecialchars($value, ENT_QUOTES, $charset) . '"';
}
}
return $strAttr;

Loading…
Cancel
Save