[core] Dropped AllowAnywhereRecoding configuration variable.

It really does not make sense these days, now the recoding of
export/import is available when the necessary extensions are loaded and
it is possible to disable it using RecodingEngine directive.
This commit is contained in:
Michal Čihař
2010-07-20 12:05:07 +02:00
parent a4055b4773
commit 11e53fb141
14 changed files with 75 additions and 108 deletions

View File

@@ -88,6 +88,7 @@ $Id$
- bug [password] Generate password only available if JS is enabled
(fixed for Privileges and Change password)
- [core] RecodingEngine now accepts none as valid option.
+ [core] Dropped AllowAnywhereRecoding configuration variable.
3.3.6.0 (not yet released)

View File

@@ -1683,18 +1683,6 @@ CREATE DATABASE,ALTER DATABASE,DROP DATABASE</pre>
expression. For example if you want only Czech and English, you should
set filter to <code>'^(cs|en)'</code>.</dd>
<dt id="cfg_AllowAnywhereRecoding">$cfg['AllowAnywhereRecoding'] boolean</dt>
<dd>Allow character set recoding of MySQL queries. You need recode or iconv
support (compiled in or module) in PHP to allow MySQL queries recoding
and used language file must have it enabled (by default only these
which are in Unicode, just to avoid losing some characters).<br /><br />
Setting this to <tt>TRUE</tt> also activates a pull-down menu
in the Export and Import pages, to choose the character set when
exporting a file. The default value in this menu comes from
<tt>$cfg['Export']['charset']</tt> and <tt>$cfg['Import']['charset']</tt>.
</dd>
<dt id="cfg_RecodingEngine">$cfg['RecodingEngine'] string</dt>
<dd>You can select here which functions will be used for character set
conversion. Possible values are:
@@ -1705,6 +1693,12 @@ CREATE DATABASE,ALTER DATABASE,DROP DATABASE</pre>
<li>none - disable encoding conversion</li>
</ul>
Default is auto.</dd>
<dd>
Enabled charset conversion activates a pull-down menu
in the Export and Import pages, to choose the character set when
exporting a file. The default value in this menu comes from
<tt>$cfg['Export']['charset']</tt> and <tt>$cfg['Import']['charset']</tt>.
</dd>
<dt id="cfg_IconvExtraParams">$cfg['IconvExtraParams'] string</dt>
<dd>Specify some parameters for iconv used in charset conversion. See

View File

@@ -207,7 +207,7 @@ if ($what == 'sql') {
$output_kanji_conversion = function_exists('PMA_kanji_str_conv') && $type != 'xls';
// Do we need to convert charset?
$output_charset_conversion = $asfile && $cfg['AllowAnywhereRecoding']
$output_charset_conversion = $asfile && $GLOBALS['PMA_recoding_engine'] != PMA_CHARSET_NONE
&& isset($charset_of_file) && $charset_of_file != $charset
&& $type != 'xls';

View File

@@ -343,7 +343,7 @@ if ($import_file != 'none' && !$error) {
//$_SESSION['Import_message'] = $message->getDisplay();
// Convert the file's charset if necessary
if ($cfg['AllowAnywhereRecoding'] && isset($charset_of_file)) {
if ($GLOBALS['PMA_recoding_engine'] != PMA_CHARSET_NONE && isset($charset_of_file)) {
if ($charset_of_file != $charset) {
$charset_conversion = TRUE;
}

View File

@@ -20,20 +20,17 @@ function PMA_failRecoding() {
/**
* Loads the recode or iconv extensions if any of it is not loaded yet
*/
if (isset($cfg['AllowAnywhereRecoding'])
&& $cfg['AllowAnywhereRecoding']) {
if ($cfg['RecodingEngine'] == 'recode') {
if ($cfg['RecodingEngine'] == 'recode') {
if (!@extension_loaded('recode')) {
PMA_failRecoding();
}
$PMA_recoding_engine = 'recode';
} elseif ($cfg['RecodingEngine'] == 'iconv') {
} elseif ($cfg['RecodingEngine'] == 'iconv') {
if (!@extension_loaded('iconv')) {
PMA_failRecoding();
}
$PMA_recoding_engine = 'iconv';
} elseif ($cfg['RecodingEngine'] == 'auto') {
} elseif ($cfg['RecodingEngine'] == 'auto') {
if (@extension_loaded('iconv')) {
$PMA_recoding_engine = 'iconv';
} elseif (@extension_loaded('recode')) {
@@ -41,10 +38,9 @@ if (isset($cfg['AllowAnywhereRecoding'])
} else {
$PMA_recoding_engine = 'none';
}
} else {
} else {
$PMA_recoding_engine = 'none';
}
} // end load recode/iconv extension
}
define('PMA_CHARSET_NONE', 0);
define('PMA_CHARSET_ICONV', 1);
@@ -57,13 +53,7 @@ if (!isset($cfg['IconvExtraParams'])) {
}
// Finally detect which function we will use:
if (isset($cfg['AllowAnywhereRecoding'])
&& $cfg['AllowAnywhereRecoding']) {
if (!isset($PMA_recoding_engine)) {
$PMA_recoding_engine = $cfg['RecodingEngine'];
}
if ($PMA_recoding_engine == 'iconv') {
if ($PMA_recoding_engine == 'iconv') {
if (@function_exists('iconv')) {
if ((@stristr(PHP_OS, 'AIX')) && (@strcasecmp(ICONV_IMPL, 'unknown') == 0) && (@strcasecmp(ICONV_VERSION, 'unknown') == 0)) {
$PMA_recoding_engine = PMA_CHARSET_ICONV_AIX;
@@ -82,7 +72,7 @@ if (isset($cfg['AllowAnywhereRecoding'])
require_once './libraries/footer.inc.php';
exit();
}
} elseif ($PMA_recoding_engine == 'recode') {
} elseif ($PMA_recoding_engine == 'recode') {
if (@function_exists('recode_string')) {
$PMA_recoding_engine = PMA_CHARSET_RECODE;
} else {
@@ -93,7 +83,7 @@ if (isset($cfg['AllowAnywhereRecoding'])
require_once './libraries/footer.inc.php';
exit;
}
} else {
} else {
if (@function_exists('iconv')) {
if ((@stristr(PHP_OS, 'AIX')) && (@strcasecmp(ICONV_IMPL, 'unknown') == 0) && (@strcasecmp(ICONV_VERSION, 'unknown') == 0)) {
$PMA_recoding_engine = PMA_CHARSET_ICONV_AIX;
@@ -112,9 +102,6 @@ if (isset($cfg['AllowAnywhereRecoding'])
require_once './libraries/footer.inc.php';
exit;
}
}
} else {
$PMA_recoding_engine = PMA_CHARSET_NONE;
}
/* Load AIX iconv wrapper if needed */

View File

@@ -1950,16 +1950,6 @@ $cfg['DefaultConnectionCollation'] = 'utf8_general_ci';
*/
$cfg['FilterLanguages'] = '';
/**
* Allow character set recoding of MySQL queries, must be also enabled in language
* file to make harder using other language files than Unicode.
* Default value is false to avoid problems on servers without the iconv
* extension
*
* @global boolean $cfg['AllowAnywhereRecoding']
*/
$cfg['AllowAnywhereRecoding'] = false;
/**
* You can select here which functions will be used for character set conversion.
* Possible values are:

View File

@@ -226,7 +226,7 @@ function PMA_fatalError($error_message, $message_args = null)
if (! isset($GLOBALS['available_languages'])) {
$GLOBALS['cfg'] = array(
'DefaultLang' => 'en',
'AllowAnywhereRecoding' => false);
);
// Loads the language file
require_once './libraries/select_lang.lib.php';

View File

@@ -205,7 +205,7 @@ echo PMA_pluginGetJavascript($export_list);
<div class="formelementrow">
<?php
// charset of file
if ($cfg['AllowAnywhereRecoding']) {
if ($GLOBALS['PMA_recoding_engine'] != PMA_CHARSET_NONE) {
echo ' <label for="select_charset_of_file">'
. __('Character set of the file:') . '</label>' . "\n";

View File

@@ -173,7 +173,7 @@ if ($_SESSION[$SESSION_KEY]["handler"]!="noplugin") {
// charset of file
echo '<div class="formelementrow">' . "\n";
if ($cfg['AllowAnywhereRecoding']) {
if ($GLOBALS['PMA_recoding_engine'] != PMA_CHARSET_NONE) {
echo '<label for="charset_of_file">' . __('Character set of the file:') . '</label>';
reset($cfg['AvailableCharsets']);
echo '<select id="charset_of_file" name="charset_of_file" size="1">';

View File

@@ -187,7 +187,6 @@ function PMA_exportFooter()
}
// restore connection settings
// (not set if $cfg['AllowAnywhereRecoding'] is false)
$charset_of_file = isset($GLOBALS['charset_of_file']) ? $GLOBALS['charset_of_file'] : '';
if (!empty($GLOBALS['asfile']) && isset($mysql_charset_map[$charset_of_file])) {
$foot .= $crlf
@@ -276,8 +275,7 @@ function PMA_exportHeader()
// so that a utility like the mysql client can interpret
// the file correctly
if (isset($GLOBALS['charset_of_file']) && isset($mysql_charset_map[$GLOBALS['charset_of_file']])) {
// $cfg['AllowAnywhereRecoding'] was true so we got a charset from
// the export dialog
// we got a charset from the export dialog
$set_names = $mysql_charset_map[$GLOBALS['charset_of_file']];
} else {
// by default we use the connection charset

View File

@@ -29,7 +29,7 @@ $gnu_iconv_to_aix_iconv_codepage_map = array (
// "big5" --> "IBM-eucTW" according to http://kadesh.cepba.upc.es/mancpp/classref/ref/ITranscoder_DSC.htm
'big5' => 'IBM-eucTW',
// Other mappings corresponding to the phpMyAdmin dropdown box when using the AllowAnywhereRecoding feature
// Other mappings corresponding to the phpMyAdmin dropdown box when using the charset conversion feature
'euc-jp' => 'IBM-eucJP',
'koi8-r' => 'IBM-eucKR',
'ks_c_5601-1987' => 'KSC5601.1987-0',

View File

@@ -487,7 +487,6 @@ function PMA_sqlQueryFormBookmark()
* @uses $GLOBALS['cfg']['BZipDump']
* @uses $GLOBALS['cfg']['UploadDir']
* @uses $GLOBALS['cfg']['AvailableCharsets']
* @uses $GLOBALS['cfg']['AllowAnywhereRecoding']
* @uses __('bzipped')
* @uses __('Character set of the file:')
* @uses __('Compression')

View File

@@ -74,7 +74,6 @@ $forms['Server_tracking'] = array('Servers' => array(1 => array(
$forms['Import_export'] = array(
'UploadDir',
'SaveDir',
'AllowAnywhereRecoding',
'RecodingEngine',
'IconvExtraParams',
'ZipDump',

View File

@@ -13,7 +13,6 @@ if (!function_exists('__')) {
}
$strSetupAllowAnywhereRecoding_name = __('Allow character set conversion');
$strSetupAllowArbitraryServer_desc = __('If enabled user can enter any MySQL server in login form for cookie auth');
$strSetupAllowArbitraryServerMsg = __('This [a@?page=form&amp;formset=features#tab_Security]option[/a] should be disabled as it allows attackers to bruteforce login to any MySQL server. If you feel this is necessary, use [a@?page=form&amp;formset=features#tab_Security]trusted proxies list[/a]. However, IP-based protection may not be reliable if your IP belongs to an ISP where thousands of users, including you, are connected to.');
$strSetupAllowArbitraryServer_name = __('Allow login to any MySQL server');