diff --git a/ChangeLog b/ChangeLog index 7acf06212..f19f49635 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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) diff --git a/Documentation.html b/Documentation.html index d6e2b6fdf..4c23ec6d4 100644 --- a/Documentation.html +++ b/Documentation.html @@ -1683,18 +1683,6 @@ CREATE DATABASE,ALTER DATABASE,DROP DATABASE expression. For example if you want only Czech and English, you should set filter to '^(cs|en)'. -
$cfg['AllowAnywhereRecoding'] boolean
-
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).

- - Setting this to TRUE 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 - $cfg['Export']['charset'] and $cfg['Import']['charset']. -
-
$cfg['RecodingEngine'] string
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
  • none - disable encoding conversion
  • Default is auto.
    +
    + 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 + $cfg['Export']['charset'] and $cfg['Import']['charset']. +
    $cfg['IconvExtraParams'] string
    Specify some parameters for iconv used in charset conversion. See diff --git a/export.php b/export.php index 8476a5250..9c1be559d 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 4d45a59d8..85616a9aa 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 222b4f3d8..6254e6766 100644 --- a/libraries/charset_conversion.lib.php +++ b/libraries/charset_conversion.lib.php @@ -20,31 +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'; - } elseif ($cfg['RecodingEngine'] == 'auto') { - if (@extension_loaded('iconv')) { - $PMA_recoding_engine = 'iconv'; - } elseif (@extension_loaded('recode')) { - $PMA_recoding_engine = 'recode'; - } else { - $PMA_recoding_engine = 'none'; - } +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 { $PMA_recoding_engine = 'none'; } -} // end load recode/iconv extension +} else { + $PMA_recoding_engine = 'none'; +} define('PMA_CHARSET_NONE', 0); define('PMA_CHARSET_ICONV', 1); @@ -57,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(); - } - } elseif ($PMA_recoding_engine == 'recode') { - if (@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; + $PMA_recoding_engine = PMA_CHARSET_ICONV; } + } elseif (@function_exists('libiconv')) { + $PMA_recoding_engine = PMA_CHARSET_LIBICONV; } 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; + 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 { + $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; } } 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 73e241ee4..e16216c17 100644 --- a/libraries/config.default.php +++ b/libraries/config.default.php @@ -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: diff --git a/libraries/core.lib.php b/libraries/core.lib.php index 12e28c531..acc98145f 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 54867f503..895f30c17 100644 --- a/libraries/display_export.lib.php +++ b/libraries/display_export.lib.php @@ -205,7 +205,7 @@ echo PMA_pluginGetJavascript($export_list);
    ' . __('Character set of the file:') . '' . "\n"; diff --git a/libraries/display_import.lib.php b/libraries/display_import.lib.php index dd9f650cc..e1833bfab 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 '
    ' . "\n"; - if ($cfg['AllowAnywhereRecoding']) { + if ($GLOBALS['PMA_recoding_engine'] != PMA_CHARSET_NONE) { echo ''; reset($cfg['AvailableCharsets']); echo '