The branch, master has been updated via 11e53fb1418f57529ef2fdd88bff7f7b41600ffe (commit) via a4055b4773909e84cb727d269de0ebb6ac05c1c9 (commit) from d7192b3a95bbaef2fccbd34ab57accb077085b4d (commit)
- Log ----------------------------------------------------------------- commit 11e53fb1418f57529ef2fdd88bff7f7b41600ffe Author: Michal Čihař mcihar@novell.com Date: Tue Jul 20 12:05:07 2010 +0200
[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.
commit a4055b4773909e84cb727d269de0ebb6ac05c1c9 Author: Michal Čihař mcihar@novell.com Date: Tue Jul 20 11:56:21 2010 +0200
[core] RecodingEngine now accepts none as valid option.
-----------------------------------------------------------------------
Summary of changes: ChangeLog | 2 + Documentation.html | 19 ++--- export.php | 2 +- import.php | 4 +- libraries/charset_conversion.lib.php | 131 +++++++++++++++------------------ libraries/config.default.php | 11 +--- libraries/core.lib.php | 2 +- libraries/display_export.lib.php | 2 +- libraries/display_import.lib.php | 2 +- libraries/export/sql.php | 4 +- libraries/iconv_wrapper.lib.php | 2 +- libraries/sql_query_form.lib.php | 1 - setup/lib/config_info.inc.php | 2 +- setup/lib/forms.inc.php | 1 - setup/lib/messages.inc.php | 1 - 15 files changed, 79 insertions(+), 107 deletions(-)
diff --git a/ChangeLog b/ChangeLog index 4240463..f19f496 100644 --- a/ChangeLog +++ b/ChangeLog @@ -87,6 +87,8 @@ $Id$ thanks to Piotr Przybylski - crackpl - 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)
diff --git a/Documentation.html b/Documentation.html index 63705ca..4c23ec6 100644 --- a/Documentation.html +++ b/Documentation.html @@ -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: @@ -1702,8 +1690,15 @@ CREATE DATABASE,ALTER DATABASE,DROP DATABASE</pre> iconv, then recode)</li> <li>iconv - use iconv or libiconv functions</li> <li>recode - use recode_string function</li> + <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 diff --git a/export.php b/export.php index 8476a52..9c1be55 100644 --- a/export.php +++ b/export.php @@ -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';
diff --git a/import.php b/import.php index 4d45a59..85616a9 100644 --- a/import.php +++ b/import.php @@ -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; } @@ -451,7 +451,7 @@ if (isset($my_die)) { if (! empty($last_query_with_results)) { // but we want to show intermediate results too $disp_query = $sql_query; - $disp_message = __('Your SQL query has been executed successfully'); + $disp_message = __('Your SQL query has been executed successfully'); $sql_query = $last_query_with_results; $go_sql = true; } diff --git a/libraries/charset_conversion.lib.php b/libraries/charset_conversion.lib.php index ed44a64..6254e67 100644 --- a/libraries/charset_conversion.lib.php +++ b/libraries/charset_conversion.lib.php @@ -20,29 +20,27 @@ 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 (!@extension_loaded('recode')) { - PMA_failRecoding(); - } - $PMA_recoding_engine = 'recode'; - } elseif ($cfg['RecodingEngine'] == 'iconv') { - if (!@extension_loaded('iconv')) { - PMA_failRecoding(); - } - $PMA_recoding_engine = 'iconv'; +if ($cfg['RecodingEngine'] == 'recode') { + if (!@extension_loaded('recode')) { + PMA_failRecoding(); + } + $PMA_recoding_engine = 'recode'; +} elseif ($cfg['RecodingEngine'] == 'iconv') { + if (!@extension_loaded('iconv')) { + PMA_failRecoding(); + } + $PMA_recoding_engine = 'iconv'; +} elseif ($cfg['RecodingEngine'] == 'auto') { + if (@extension_loaded('iconv')) { + $PMA_recoding_engine = 'iconv'; + } elseif (@extension_loaded('recode')) { + $PMA_recoding_engine = 'recode'; } else { - if (@extension_loaded('iconv')) { - $PMA_recoding_engine = 'iconv'; - } elseif (@extension_loaded('recode')) { - $PMA_recoding_engine = 'recode'; - } else { - PMA_failRecoding(); - } + $PMA_recoding_engine = 'none'; } -} // end load recode/iconv extension +} else { + $PMA_recoding_engine = 'none'; +}
define('PMA_CHARSET_NONE', 0); define('PMA_CHARSET_ICONV', 1); @@ -55,64 +53,55 @@ 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 (@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; - } else { - $PMA_recoding_engine = PMA_CHARSET_ICONV; - } - } elseif (@function_exists('libiconv')) { - $PMA_recoding_engine = PMA_CHARSET_LIBICONV; +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; } else { - $PMA_recoding_engine = PMA_CHARSET_NONE; - - if (!isset($GLOBALS['is_header_sent'])) { - include './libraries/header.inc.php'; - } - echo __('Couldn't use the iconv, libiconv, or recode_string functions, although the necessary extensions appear to be loaded. Check your PHP configuration.'); - require_once './libraries/footer.inc.php'; - exit(); + $PMA_recoding_engine = PMA_CHARSET_ICONV; } - } elseif ($PMA_recoding_engine == 'recode') { - if (@function_exists('recode_string')) { - $PMA_recoding_engine = PMA_CHARSET_RECODE; - } else { - $PMA_recoding_engine = PMA_CHARSET_NONE; + } elseif (@function_exists('libiconv')) { + $PMA_recoding_engine = PMA_CHARSET_LIBICONV; + } else { + $PMA_recoding_engine = PMA_CHARSET_NONE;
- require_once './libraries/header.inc.php'; - echo __('Couldn't use the iconv, libiconv, or recode_string functions, although the necessary extensions appear to be loaded. Check your PHP configuration.'); - require_once './libraries/footer.inc.php'; - exit; + if (!isset($GLOBALS['is_header_sent'])) { + include './libraries/header.inc.php'; } + echo __('Couldn't use the iconv, libiconv, or recode_string functions, although the necessary extensions appear to be loaded. Check your PHP configuration.'); + require_once './libraries/footer.inc.php'; + exit(); + } +} elseif ($PMA_recoding_engine == 'recode') { + if (@function_exists('recode_string')) { + $PMA_recoding_engine = PMA_CHARSET_RECODE; } 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; - } else { - $PMA_recoding_engine = PMA_CHARSET_ICONV; - } - } elseif (@function_exists('libiconv')) { - $PMA_recoding_engine = PMA_CHARSET_LIBICONV; - } elseif (@function_exists('recode_string')) { - $PMA_recoding_engine = PMA_CHARSET_RECODE; - } else { - $PMA_recoding_engine = PMA_CHARSET_NONE; + $PMA_recoding_engine = PMA_CHARSET_NONE;
- require_once './libraries/header.inc.php'; - echo __('Couldn't use the iconv, libiconv, or recode_string functions, although the necessary extensions appear to be loaded. Check your PHP configuration.'); - require_once './libraries/footer.inc.php'; - exit; - } + require_once './libraries/header.inc.php'; + echo __('Couldn't use the iconv, libiconv, or recode_string functions, although the necessary extensions appear to be loaded. Check your PHP configuration.'); + require_once './libraries/footer.inc.php'; + exit; } } else { - $PMA_recoding_engine = PMA_CHARSET_NONE; + 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; + } else { + $PMA_recoding_engine = PMA_CHARSET_ICONV; + } + } elseif (@function_exists('libiconv')) { + $PMA_recoding_engine = PMA_CHARSET_LIBICONV; + } elseif (@function_exists('recode_string')) { + $PMA_recoding_engine = PMA_CHARSET_RECODE; + } else { + $PMA_recoding_engine = PMA_CHARSET_NONE; + + require_once './libraries/header.inc.php'; + echo __('Couldn't use the iconv, libiconv, or recode_string functions, although the necessary extensions appear to be loaded. Check your PHP configuration.'); + require_once './libraries/footer.inc.php'; + exit; + } }
/* Load AIX iconv wrapper if needed */ diff --git a/libraries/config.default.php b/libraries/config.default.php index 7d7d084..e16216c 100644 --- a/libraries/config.default.php +++ b/libraries/config.default.php @@ -1951,22 +1951,13 @@ $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: * auto - automatically use available one (first is tested iconv, then * recode) * iconv - use iconv or libiconv functions * recode - use recode_string function + * none - disable encoding conversion * * @global string $cfg['RecodingEngine'] */ diff --git a/libraries/core.lib.php b/libraries/core.lib.php index 12e28c5..acc9814 100644 --- a/libraries/core.lib.php +++ b/libraries/core.lib.php @@ -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'; diff --git a/libraries/display_export.lib.php b/libraries/display_export.lib.php index 54867f5..895f30c 100644 --- a/libraries/display_export.lib.php +++ b/libraries/display_export.lib.php @@ -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";
diff --git a/libraries/display_import.lib.php b/libraries/display_import.lib.php index dd9f650..e1833bf 100644 --- a/libraries/display_import.lib.php +++ b/libraries/display_import.lib.php @@ -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">'; diff --git a/libraries/export/sql.php b/libraries/export/sql.php index c2f68bc..d5c6c84 100644 --- a/libraries/export/sql.php +++ b/libraries/export/sql.php @@ -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 diff --git a/libraries/iconv_wrapper.lib.php b/libraries/iconv_wrapper.lib.php index 106cf93..6fadfeb 100644 --- a/libraries/iconv_wrapper.lib.php +++ b/libraries/iconv_wrapper.lib.php @@ -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', diff --git a/libraries/sql_query_form.lib.php b/libraries/sql_query_form.lib.php index 6a4b6e9..30f02f6 100644 --- a/libraries/sql_query_form.lib.php +++ b/libraries/sql_query_form.lib.php @@ -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') diff --git a/setup/lib/config_info.inc.php b/setup/lib/config_info.inc.php index 3d95641..afc124a 100644 --- a/setup/lib/config_info.inc.php +++ b/setup/lib/config_info.inc.php @@ -40,7 +40,7 @@ $cfg_db['Servers'] = array(1 => array( 'AllowDeny' => array( 'order' => array('', 'deny,allow', 'allow,deny', 'explicit')), 'only_db' => 'array')); -$cfg_db['RecodingEngine'] = array('auto', 'iconv', 'recode'); +$cfg_db['RecodingEngine'] = array('auto', 'iconv', 'recode', 'none'); $cfg_db['OBGzip'] = array('auto', true, false); $cfg_db['ShowTooltipAliasTB'] = array('nested', true, false); $cfg_db['DisplayDatabasesList'] = array('auto', true, false); diff --git a/setup/lib/forms.inc.php b/setup/lib/forms.inc.php index e60cf6f..9770a4f 100644 --- a/setup/lib/forms.inc.php +++ b/setup/lib/forms.inc.php @@ -74,7 +74,6 @@ $forms['Server_tracking'] = array('Servers' => array(1 => array( $forms['Import_export'] = array( 'UploadDir', 'SaveDir', - 'AllowAnywhereRecoding', 'RecodingEngine', 'IconvExtraParams', 'ZipDump', diff --git a/setup/lib/messages.inc.php b/setup/lib/messages.inc.php index 5284e03..ef1f42b 100644 --- a/setup/lib/messages.inc.php +++ b/setup/lib/messages.inc.php @@ -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&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&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');
hooks/post-receive