diff --git a/Documentation.html b/Documentation.html index bea715640..8b6239d06 100755 --- a/Documentation.html +++ b/Documentation.html @@ -1053,6 +1053,33 @@ $cfg['PmaAbsoluteUri'] = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://'

+
$cfg['DefaultCharset'] string
+
+ Default charset to use for recoding of MySQL queries. This must be + enabled and it's described by $cfg['AllowAnywhereRecoding'] option. + You can give here any charset which is in $cfg['AvailableCharsets'] + array and this is just default choice, user can select any of them. +

+
+ +
$cfg['AllowAnywhereRecoding'] string
+
+ Allow charset 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). +

+
+ +
$cfg['AvailableCharsets'] array
+
+ Available charsets for MySQL conversion. You can add your own (any of + supported by recode/iconv) or remove these which you don't use. + Charsets will be shown in same order as here listed, so if you + frequently use some of these move them to the top. +

+
+
$cfg['LeftWidth'] integer
Left frame width in pixel. diff --git a/config.inc.php3 b/config.inc.php3 index add2cea55..48aac60c3 100755 --- a/config.inc.php3 +++ b/config.inc.php3 @@ -192,6 +192,16 @@ $cfg['ManualBaseShort'] = 'http://www.mysql.com/doc'; */ // Default language to use, if not browser-defined or user-defined $cfg['DefaultLang'] = 'en'; + +/** + * Charset conversion settings + */ +// Default charset to use for recoding of MySQL queries +// (see $cfg['AvailableCharsets'] to possible choices, you can add your own) +$cfg['DefaultCharset'] = 'iso-8859-2'; +// Allow charset recoding of MySQL queries, must be also enabled in language +// file to make harder using other language files than unicode. +$cfg['AllowAnywhereRecoding'] = TRUE; // Force: always use this language - must be defined in // libraries/select_lang.lib.php3 // $cfg['Lang'] = 'en'; @@ -237,6 +247,45 @@ $cfg['colorStrings'] = '#008000'; $cfg['colorColType'] = '#FF9900'; $cfg['colorAdd'] = '#0000FF'; +/** + * Available charsets for MySQL conversion. currently contains all which could + * be found in lang/* files and few more. + * + * Charsets will be shown in same order as here listed, so if you frequently + * use some of these move them to the top. + */ + +$cfg['AvailableCharsets'] = array( + 'iso-8859-1', + 'iso-8859-2', + 'iso-8859-3', + 'iso-8859-4', + 'iso-8859-5', + 'iso-8859-6', + 'iso-8859-7', + 'iso-8859-8', + 'iso-8859-9', + 'iso-8859-10', + 'iso-8859-11', + 'iso-8859-12', + 'iso-8859-13', + 'iso-8859-14', + 'iso-8859-15', + 'windows-1250', + 'windows-1251', + 'windows-1252', + 'windows-1257', + 'koi8-r', + 'big5', + 'gb2312', + 'utf-8', + 'utf-7', + 'x-user-defined', + 'euc-jp', + 'ks_c_5601-1987', + 'tis-620', + 'SHIFT_JIS' +); /** * MySQL settings diff --git a/db_create.php3 b/db_create.php3 index 65da06495..ed801d270 100755 --- a/db_create.php3 +++ b/db_create.php3 @@ -15,6 +15,7 @@ require('./header.inc.php3'); */ $err_url = 'main.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server; @@ -33,7 +34,7 @@ if (PMA_MYSQL_INT_VERSION < 32306) { * Executes the db creation sql query */ $local_query = 'CREATE DATABASE ' . PMA_backquote($db); -$result = mysql_query('CREATE DATABASE ' . PMA_backquote($db)) or PMA_mysqlDie('', $local_query, FALSE, $err_url); +$result = PMA_mysql_query('CREATE DATABASE ' . PMA_backquote($db)) or PMA_mysqlDie('', $local_query, FALSE, $err_url); /** diff --git a/db_details.php3 b/db_details.php3 index 4e95e53c1..c617bf1a7 100755 --- a/db_details.php3 +++ b/db_details.php3 @@ -57,6 +57,7 @@ $is_upload = (PMA_PHP_INT_VERSION >= 40000 && function_exists('ini_get')) onsubmit="return checkSqlQuery(this)"> + diff --git a/db_details_common.php3 b/db_details_common.php3 index 6b96900f1..890eedad4 100644 --- a/db_details_common.php3 +++ b/db_details_common.php3 @@ -15,9 +15,11 @@ require('./libraries/bookmark.lib.php3'); */ $err_url_0 = 'main.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server; $err_url = 'db_details.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db); @@ -29,10 +31,10 @@ $err_url = 'db_details.php3' if (!isset($is_db) || !$is_db) { // Not a valid db name -> back to the welcome page if (!empty($db)) { - $is_db = @mysql_select_db($db); + $is_db = @PMA_mysql_select_db($db); } if (empty($db) || !$is_db) { - header('Location: ' . $cfg['PmaAbsoluteUri'] . 'main.php3?lang=' . $lang . '&server=' . $server . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1'); + header('Location: ' . $cfg['PmaAbsoluteUri'] . 'main.php3?lang=' . $lang . '&convcharset=' . $convcharset . '&server=' . $server . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1'); exit(); } } // end if (ensures db exists) @@ -47,7 +49,7 @@ if (!isset($message)) { ?> = 32303) { // Special speedup for newer MySQL Versions (in 4.0 format changed) if ($cfg['SkipLockedTables'] == TRUE && PMA_MYSQL_INT_VERSION >= 32330) { $local_query = 'SHOW OPEN TABLES FROM ' . PMA_backquote($db); - $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); + $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); // Blending out tables in use if ($result != FALSE && mysql_num_rows($result) > 0) { - while ($tmp = mysql_fetch_row($result)) { + while ($tmp = PMA_mysql_fetch_row($result)) { // if in use memorize tablename if (eregi('in_use=[1-9]+', $tmp[1])) { $sot_cache[$tmp[0]] = TRUE; @@ -24,13 +24,13 @@ if (PMA_MYSQL_INT_VERSION >= 32303) { if (isset($sot_cache)) { $local_query = 'SHOW TABLES FROM ' . PMA_backquote($db); - $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); + $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); if ($result != FALSE && mysql_num_rows($result) > 0) { - while ($tmp = mysql_fetch_row($result)) { + while ($tmp = PMA_mysql_fetch_row($result)) { if (!isset($sot_cache[$tmp[0]])) { $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\''; - $sts_result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); - $sts_tmp = mysql_fetch_array($sts_result); + $sts_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); + $sts_tmp = PMA_mysql_fetch_array($sts_result); $tables[] = $sts_tmp; } else { // table in use $tables[] = array('Name' => $tmp[0]); @@ -44,9 +44,9 @@ if (PMA_MYSQL_INT_VERSION >= 32303) { } if (!isset($sot_ready)) { $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db); - $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); + $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); if ($result != FALSE && mysql_num_rows($result) > 0) { - while ($sts_tmp = mysql_fetch_array($result)) { + while ($sts_tmp = PMA_mysql_fetch_array($result)) { $tables[] = $sts_tmp; } mysql_free_result($result); @@ -55,10 +55,10 @@ if (PMA_MYSQL_INT_VERSION >= 32303) { $num_tables = (isset($tables) ? count($tables) : 0); } // end if (PMA_MYSQL_INT_VERSION >= 32303) else { - $result = mysql_list_tables($db); + $result = PMA_mysql_list_tables($db); $num_tables = ($result) ? @mysql_numrows($result) : 0; for ($i = 0; $i < $num_tables; $i++) { - $tables[] = mysql_tablename($result, $i); + $tables[] = PMA_mysql_tablename($result, $i); } mysql_free_result($result); } diff --git a/db_details_links.php3 b/db_details_links.php3 index 5d36cdacf..12aa13cb3 100644 --- a/db_details_links.php3 +++ b/db_details_links.php3 @@ -17,8 +17,8 @@ else { // Drop link if allowed if (!$cfg['AllowUserDropDatabase']) { // Check if the user is a Superuser - $result = @mysql_query('USE mysql'); - $cfg['AllowUserDropDatabase'] = (!mysql_error()); + $result = @PMA_mysql_query('USE mysql'); + $cfg['AllowUserDropDatabase'] = (!PMA_mysql_error()); } if ($cfg['AllowUserDropDatabase']) { $lnk5 = ' + @@ -252,6 +253,7 @@ else if (PMA_MYSQL_INT_VERSION >= 32303) { // Check all tables url $checkall_url = 'db_details_structure.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db); echo "\n"; @@ -304,6 +306,7 @@ else { ?>
+ @@ -363,6 +366,7 @@ else { // Check all tables url $checkall_url = 'db_details_structure.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db); ?> @@ -422,6 +426,7 @@ if ($num_tables > 0) { onsubmit="return (emptyFormElements(this, 'table') && checkFormElementInRange(this, 'num_fields', 1))"> + ' . "\n"; @@ -450,21 +455,22 @@ if (!empty($cfg['Server']['table_coords']) 0){ ?>
  • +  :
      + @@ -206,9 +207,9 @@ if (isset($submit_search)) { // Executes the "COUNT" statement $local_query = $newsearchsqls['select_count']; - $res = @mysql_query($local_query) or PMA_mysqlDie('', $local_query, FALSE, $err_url); + $res = @PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, FALSE, $err_url); if ($res) { - $res_cnt = mysql_result($res, 0, 'count'); + $res_cnt = PMA_mysql_result($res, 0, 'count'); mysql_free_result($res); } else { $res_cnt = 0; @@ -240,9 +241,9 @@ if (isset($submit_search)) { // Executes the "COUNT" statement $local_query = $newsearchsqls['select_count']; - $res = @mysql_query($local_query) or PMA_mysqlDie('', $local_query, FALSE, $err_url); + $res = @PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, FALSE, $err_url); if ($res) { - $res_cnt = mysql_result($res, 0, 'count'); + $res_cnt = PMA_mysql_result($res, 0, 'count'); mysql_free_result($res); } else { $res_cnt = 0; @@ -310,6 +311,7 @@ if (empty($search_option)) {
    + diff --git a/db_stats.php3 b/db_stats.php3 index fbf3fccf5..034bed2b6 100644 --- a/db_stats.php3 +++ b/db_stats.php3 @@ -12,7 +12,7 @@ require('./header.inc.php3'); /** * Ensures the current user is super-user */ -if (!@mysql_query('USE mysql', $userlink)) { +if (!@PMA_mysql_query('USE mysql', $userlink)) { echo '

    ' . $strError . '

    ' . "\n"; echo '

        ' . $strNoRights . '

    ' . "\n"; include('./footer.inc.php3'); @@ -27,6 +27,7 @@ if ((!empty($submit_mult) && isset($selected_db)) || isset($mult_btn)) { $err_url = 'db_stats.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server; $action = 'db_stats.php3'; $show_query = 'y'; @@ -82,7 +83,7 @@ if ($server > 0) { // Get the valid databases list $num_dbs = count($dblist); $dbs = @mysql_list_dbs() or PMA_mysqlDie('', 'mysql_list_dbs()', '', 'main.php3?lang' . $lang . '&server=' . $server); - while ($a_db = mysql_fetch_object($dbs)) { + while ($a_db = PMA_mysql_fetch_object($dbs)) { if (!$num_dbs) { $dblist[] = $a_db->Database; } else { @@ -140,7 +141,7 @@ if ($server > 0) { */ if ($num_dbs > 0) { // Defines the urls used to sort the table - $common_url = 'db_stats.php3?lang=' . $lang . '&server=' . $server; + $common_url = 'db_stats.php3?lang=' . $lang . '&server=' . $server . '&convcharset=' . $convcharset; if (empty($sort_by)) { $sort_by = 'db_name'; $sort_order = 'asc'; @@ -182,6 +183,7 @@ if ($num_dbs > 0) { ?> + @@ -225,7 +227,7 @@ if ($num_dbs > 0) { // Gets the tables stats per database for ($i = 0; $i < $num_dbs; $i++) { $db = $dblist[$i]; - $tables = @mysql_list_tables($db); + $tables = @PMA_mysql_list_tables($db); // Number of tables $dbs_array[$db][0] = ($tables) ? @mysql_numrows($tables) : 0; @@ -239,10 +241,10 @@ if ($num_dbs > 0) { if (PMA_MYSQL_INT_VERSION >= 32303) { $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db); - $result = @mysql_query($local_query); + $result = @PMA_mysql_query($local_query); // needs the "@" below otherwise, warnings in case of special DB names if ($result && @mysql_num_rows($result)) { - while ($row = mysql_fetch_array($result)) { + while ($row = PMA_mysql_fetch_array($result)) { $dbs_array[$db][1] += $row['Data_length']; $dbs_array[$db][2] += $row['Index_length']; } @@ -264,6 +266,7 @@ if ($num_dbs > 0) { // Check/unchek all databases url $checkall_url = 'db_stats.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . (empty($sort_by) ? '' : '&sort_by=' . $sort_by) . (empty($sort_order) ? '' : '&sort_order=' . $sort_order); @@ -284,7 +287,7 @@ if ($num_dbs > 0) { echo ' ' . "\n"; - echo ' ' . "\n"; + echo ' ' . "\n"; echo ' ' . "\n"; echo ' ' . "\n"; echo ' ' . "\n"; diff --git a/header.inc.php3 b/header.inc.php3 index 5f79badc2..98da4745f 100755 --- a/header.inc.php3 +++ b/header.inc.php3 @@ -179,6 +179,7 @@ if ($cfg['RightBgImage'] != '') echo '" background="' . $cfg['RightBgImage']; ' . "\n"; echo ' ' . $strDatabase . ' ' . htmlspecialchars($db) . '' . "\n"; diff --git a/index.php3 b/index.php3 index 75f35d6f6..b41f5ce7e 100755 --- a/index.php3 +++ b/index.php3 @@ -38,6 +38,7 @@ if (isset($lightm_db)) { unset($lightm_db); } $url_query = 'lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . (empty($db) ? '' : '&db=' . urlencode($db)); ?> diff --git a/lang/albanian.inc.php3 b/lang/albanian.inc.php3 index f4263b139..d4db180b0 100644 --- a/lang/albanian.inc.php3 +++ b/lang/albanian.inc.php3 @@ -400,4 +400,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/arabic.inc.php3 b/lang/arabic.inc.php3 index b7a9bffcd..84f905aa8 100644 --- a/lang/arabic.inc.php3 +++ b/lang/arabic.inc.php3 @@ -401,4 +401,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/brazilian_portuguese.inc.php3 b/lang/brazilian_portuguese.inc.php3 index 6724554d0..130cd4f17 100644 --- a/lang/brazilian_portuguese.inc.php3 +++ b/lang/brazilian_portuguese.inc.php3 @@ -399,4 +399,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/bulgarian-koi8.inc.php3 b/lang/bulgarian-koi8.inc.php3 index b4e66bf18..7bfbbdbd1 100644 --- a/lang/bulgarian-koi8.inc.php3 +++ b/lang/bulgarian-koi8.inc.php3 @@ -400,4 +400,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/bulgarian-win1251.inc.php3 b/lang/bulgarian-win1251.inc.php3 index 096ae6ce6..431879d6b 100644 --- a/lang/bulgarian-win1251.inc.php3 +++ b/lang/bulgarian-win1251.inc.php3 @@ -400,4 +400,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/catala.inc.php3 b/lang/catala.inc.php3 index 06df67747..452df6b00 100644 --- a/lang/catala.inc.php3 +++ b/lang/catala.inc.php3 @@ -395,4 +395,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/chinese_big5.inc.php3 b/lang/chinese_big5.inc.php3 index f4c3df5e5..05c6d7e19 100644 --- a/lang/chinese_big5.inc.php3 +++ b/lang/chinese_big5.inc.php3 @@ -402,4 +402,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/chinese_gb.inc.php3 b/lang/chinese_gb.inc.php3 index 281c82fba..f02f0f53f 100644 --- a/lang/chinese_gb.inc.php3 +++ b/lang/chinese_gb.inc.php3 @@ -402,4 +402,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/croatian-iso8859-2.inc.php3 b/lang/croatian-iso8859-2.inc.php3 index 93878bcbf..4a63458a8 100644 --- a/lang/croatian-iso8859-2.inc.php3 +++ b/lang/croatian-iso8859-2.inc.php3 @@ -400,4 +400,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/croatian-win1250.inc.php3 b/lang/croatian-win1250.inc.php3 index 37d5e369c..9fe0b09c8 100644 --- a/lang/croatian-win1250.inc.php3 +++ b/lang/croatian-win1250.inc.php3 @@ -400,4 +400,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/czech-iso.inc.php3 b/lang/czech-iso.inc.php3 index 16296f914..1a8411d65 100644 --- a/lang/czech-iso.inc.php3 +++ b/lang/czech-iso.inc.php3 @@ -400,4 +400,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/czech-win1250.inc.php3 b/lang/czech-win1250.inc.php3 index 84ad41e38..7f3b6e65d 100644 --- a/lang/czech-win1250.inc.php3 +++ b/lang/czech-win1250.inc.php3 @@ -400,4 +400,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/danish.inc.php3 b/lang/danish.inc.php3 index b4ee8e8b2..27675e01b 100644 --- a/lang/danish.inc.php3 +++ b/lang/danish.inc.php3 @@ -394,4 +394,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/dutch.inc.php3 b/lang/dutch.inc.php3 index 459481e66..97dca9e1b 100644 --- a/lang/dutch.inc.php3 +++ b/lang/dutch.inc.php3 @@ -397,4 +397,7 @@ $strZip = '"Gezipt"'; // To translate $strMissingBracket = 'Missing Bracket'; //to translate $strHaveToShow = 'You have to choose at least one Column to display'; //to translate +$strCantLoadRecodeIconv = 'Can not load iconv or recode extension needed for charset conversion, configure php to allow using these extensions or disable charset conversion in phpMyAdmin.'; //to translate +$strCantUseRecodeIconv = 'Can not use iconv nor libiconv nor recode_string function while extension reports to be loaded. Check your php configuration.'; //to translate +$strMySQLCharset = 'MySQL Charset'; //to translate ?> diff --git a/lang/english.inc.php3 b/lang/english.inc.php3 index efba255dd..c825476f8 100644 --- a/lang/english.inc.php3 +++ b/lang/english.inc.php3 @@ -393,4 +393,7 @@ $strYes = 'Yes'; $strZip = '"zipped"'; $strHaveToShow = 'You have to choose at least one Column to display'; //to translate +$strCantLoadRecodeIconv = 'Can not load iconv or recode extension needed for charset conversion, configure php to allow using these extensions or disable charset conversion in phpMyAdmin.'; //to translate +$strCantUseRecodeIconv = 'Can not use iconv nor libiconv nor recode_string function while extension reports to be loaded. Check your php configuration.'; //to translate +$strMySQLCharset = 'MySQL Charset'; //to translate ?> diff --git a/lang/estonian.inc.php3 b/lang/estonian.inc.php3 index d04eb2d76..5afdc86a0 100644 --- a/lang/estonian.inc.php3 +++ b/lang/estonian.inc.php3 @@ -395,4 +395,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/finnish.inc.php3 b/lang/finnish.inc.php3 index 349360d7d..42b4c5f68 100644 --- a/lang/finnish.inc.php3 +++ b/lang/finnish.inc.php3 @@ -399,4 +399,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/french.inc.php3 b/lang/french.inc.php3 index 5f867d184..a8b0359c8 100644 --- a/lang/french.inc.php3 +++ b/lang/french.inc.php3 @@ -394,4 +394,7 @@ $strZip = '"zipp $strMissingBracket = 'Missing Bracket'; //to translate $strHaveToShow = 'You have to choose at least one Column to display'; //to translate +$strCantLoadRecodeIconv = 'Can not load iconv or recode extension needed for charset conversion, configure php to allow using these extensions or disable charset conversion in phpMyAdmin.'; //to translate +$strCantUseRecodeIconv = 'Can not use iconv nor libiconv nor recode_string function while extension reports to be loaded. Check your php configuration.'; //to translate +$strMySQLCharset = 'MySQL Charset'; //to translate ?> diff --git a/lang/galician.inc.php3 b/lang/galician.inc.php3 index 9a9d56698..5f86af0a8 100644 --- a/lang/galician.inc.php3 +++ b/lang/galician.inc.php3 @@ -399,4 +399,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/georgian.inc.php3 b/lang/georgian.inc.php3 index 28fbdb67f..f5f78217c 100644 --- a/lang/georgian.inc.php3 +++ b/lang/georgian.inc.php3 @@ -404,4 +404,7 @@ $strPrimaryKeyWarning = '("PRIMARY" must be the name of and only of diff --git a/lang/german.inc.php3 b/lang/german.inc.php3 index a60039dd7..1b0a17dab 100644 --- a/lang/german.inc.php3 +++ b/lang/german.inc.php3 @@ -401,4 +401,7 @@ $strYes = 'Ja'; $strZip = 'Zip komprimiert'; $strHaveToShow = 'Bitte wählen Sie mindestens eine anzuzeigende Spalte'; +$strCantLoadRecodeIconv = 'Can not load iconv or recode extension needed for charset conversion, configure php to allow using these extensions or disable charset conversion in phpMyAdmin.'; //to translate +$strCantUseRecodeIconv = 'Can not use iconv nor libiconv nor recode_string function while extension reports to be loaded. Check your php configuration.'; //to translate +$strMySQLCharset = 'MySQL Charset'; //to translate ?> diff --git a/lang/greek.inc.php3 b/lang/greek.inc.php3 index 53cf8bbd2..51d8aaccb 100644 --- a/lang/greek.inc.php3 +++ b/lang/greek.inc.php3 @@ -396,4 +396,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/hebrew.inc.php3 b/lang/hebrew.inc.php3 index 9540a0bda..69335e58c 100644 --- a/lang/hebrew.inc.php3 +++ b/lang/hebrew.inc.php3 @@ -395,4 +395,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/hungarian.inc.php3 b/lang/hungarian.inc.php3 index eb575eb99..db3b6a68f 100644 --- a/lang/hungarian.inc.php3 +++ b/lang/hungarian.inc.php3 @@ -398,4 +398,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/indonesian.inc.php3 b/lang/indonesian.inc.php3 index 754277cec..36f2e629f 100644 --- a/lang/indonesian.inc.php3 +++ b/lang/indonesian.inc.php3 @@ -397,4 +397,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/italian.inc.php3 b/lang/italian.inc.php3 index 6f2178977..6556a5293 100644 --- a/lang/italian.inc.php3 +++ b/lang/italian.inc.php3 @@ -401,4 +401,7 @@ $strZip = '"compresso con zip"'; // To translate $strMissingBracket = 'Missing Bracket'; //to translate $strHaveToShow = 'You have to choose at least one Column to display'; //to translate +$strCantLoadRecodeIconv = 'Can not load iconv or recode extension needed for charset conversion, configure php to allow using these extensions or disable charset conversion in phpMyAdmin.'; //to translate +$strCantUseRecodeIconv = 'Can not use iconv nor libiconv nor recode_string function while extension reports to be loaded. Check your php configuration.'; //to translate +$strMySQLCharset = 'MySQL Charset'; //to translate ?> diff --git a/lang/japanese-euc.inc.php3 b/lang/japanese-euc.inc.php3 index e2bc44c66..e0a737ef3 100644 --- a/lang/japanese-euc.inc.php3 +++ b/lang/japanese-euc.inc.php3 @@ -405,4 +405,7 @@ $strXkana = ' $strNotSet = '%s table not found or not set in %s'; //to translate $strMissingBracket = 'Missing Bracket'; //to translate $strHaveToShow = 'You have to choose at least one Column to display'; //to translate +$strCantLoadRecodeIconv = 'Can not load iconv or recode extension needed for charset conversion, configure php to allow using these extensions or disable charset conversion in phpMyAdmin.'; //to translate +$strCantUseRecodeIconv = 'Can not use iconv nor libiconv nor recode_string function while extension reports to be loaded. Check your php configuration.'; //to translate +$strMySQLCharset = 'MySQL Charset'; //to translate ?> diff --git a/lang/japanese-sjis.inc.php3 b/lang/japanese-sjis.inc.php3 index 4e3a77347..6c745e6c1 100644 --- a/lang/japanese-sjis.inc.php3 +++ b/lang/japanese-sjis.inc.php3 @@ -404,4 +404,7 @@ $strXkana = ' $strNotSet = '%s table not found or not set in %s'; //to translate $strMissingBracket = 'Missing Bracket'; //to translate $strHaveToShow = 'You have to choose at least one Column to display'; //to translate +$strCantLoadRecodeIconv = 'Can not load iconv or recode extension needed for charset conversion, configure php to allow using these extensions or disable charset conversion in phpMyAdmin.'; //to translate +$strCantUseRecodeIconv = 'Can not use iconv nor libiconv nor recode_string function while extension reports to be loaded. Check your php configuration.'; //to translate +$strMySQLCharset = 'MySQL Charset'; //to translate ?> diff --git a/lang/korean.inc.php3 b/lang/korean.inc.php3 index 8e26f94bc..6444ef179 100644 --- a/lang/korean.inc.php3 +++ b/lang/korean.inc.php3 @@ -396,4 +396,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/latvian.inc.php3 b/lang/latvian.inc.php3 index f0b39bd2c..4315cb3f8 100644 --- a/lang/latvian.inc.php3 +++ b/lang/latvian.inc.php3 @@ -399,4 +399,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/lithuanian.inc.php3 b/lang/lithuanian.inc.php3 index 2d97785c8..046a79763 100644 --- a/lang/lithuanian.inc.php3 +++ b/lang/lithuanian.inc.php3 @@ -396,4 +396,7 @@ $strReferentialIntegrity = 'Check referential integrity:'; $strMissingBracket = 'Missing Bracket'; //to translate $strHaveToShow = 'You have to choose at least one Column to display'; //to translate +$strCantLoadRecodeIconv = 'Can not load iconv or recode extension needed for charset conversion, configure php to allow using these extensions or disable charset conversion in phpMyAdmin.'; //to translate +$strCantUseRecodeIconv = 'Can not use iconv nor libiconv nor recode_string function while extension reports to be loaded. Check your php configuration.'; //to translate +$strMySQLCharset = 'MySQL Charset'; //to translate ?> diff --git a/lang/norwegian.inc.php3 b/lang/norwegian.inc.php3 index c57e05ab6..0e0292a7b 100644 --- a/lang/norwegian.inc.php3 +++ b/lang/norwegian.inc.php3 @@ -398,4 +398,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/polish.inc.php3 b/lang/polish.inc.php3 index fc3b8591f..d7c41fd25 100644 --- a/lang/polish.inc.php3 +++ b/lang/polish.inc.php3 @@ -396,4 +396,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/portuguese.inc.php3 b/lang/portuguese.inc.php3 index 3a88d8d20..96b0e5a33 100644 --- a/lang/portuguese.inc.php3 +++ b/lang/portuguese.inc.php3 @@ -402,4 +402,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/romanian.inc.php3 b/lang/romanian.inc.php3 index 5c889bd4d..dd96f0830 100644 --- a/lang/romanian.inc.php3 +++ b/lang/romanian.inc.php3 @@ -396,4 +396,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/russian-koi8.inc.php3 b/lang/russian-koi8.inc.php3 index 0a81ea4ce..36ae92378 100644 --- a/lang/russian-koi8.inc.php3 +++ b/lang/russian-koi8.inc.php3 @@ -400,4 +400,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/russian-win1251.inc.php3 b/lang/russian-win1251.inc.php3 index 914125159..792f28274 100644 --- a/lang/russian-win1251.inc.php3 +++ b/lang/russian-win1251.inc.php3 @@ -400,4 +400,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/serbian-win1250.inc.php3 b/lang/serbian-win1250.inc.php3 index 0683fb19f..b404adb37 100644 --- a/lang/serbian-win1250.inc.php3 +++ b/lang/serbian-win1250.inc.php3 @@ -401,4 +401,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/slovak-iso.inc.php3 b/lang/slovak-iso.inc.php3 index c4be730b9..d97b57a31 100644 --- a/lang/slovak-iso.inc.php3 +++ b/lang/slovak-iso.inc.php3 @@ -399,4 +399,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/slovak-win1250.inc.php3 b/lang/slovak-win1250.inc.php3 index c52fcc67f..233dec4c6 100644 --- a/lang/slovak-win1250.inc.php3 +++ b/lang/slovak-win1250.inc.php3 @@ -398,4 +398,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/spanish.inc.php3 b/lang/spanish.inc.php3 index 7b95788f3..9f54a23eb 100644 --- a/lang/spanish.inc.php3 +++ b/lang/spanish.inc.php3 @@ -393,4 +393,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/swedish.inc.php3 b/lang/swedish.inc.php3 index 13d3ae6c3..31ee28b5b 100644 --- a/lang/swedish.inc.php3 +++ b/lang/swedish.inc.php3 @@ -395,4 +395,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/thai.inc.php3 b/lang/thai.inc.php3 index 52500744c..b78804a35 100644 --- a/lang/thai.inc.php3 +++ b/lang/thai.inc.php3 @@ -405,4 +405,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/lang/turkish.inc.php3 b/lang/turkish.inc.php3 index ea1de55e8..adb34626d 100644 --- a/lang/turkish.inc.php3 +++ b/lang/turkish.inc.php3 @@ -395,4 +395,7 @@ $strStructPropose = 'Propose table structure'; // just no translation for $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    This might happen if php finds a parse error in it or php cannot find the file.
    Please call the configuration file directly using the link below and read the php error message(s) that you recieve. In most cases a quote or a semicolon is missing somewhere.
    If you recieve a blank page, everything is fine.'; //to translate $strMissingBracket = 'Missing Bracket'; //to translate $strHaveToShow = 'You have to choose at least one Column to display'; //to translate +$strCantLoadRecodeIconv = 'Can not load iconv or recode extension needed for charset conversion, configure php to allow using these extensions or disable charset conversion in phpMyAdmin.'; //to translate +$strCantUseRecodeIconv = 'Can not use iconv nor libiconv nor recode_string function while extension reports to be loaded. Check your php configuration.'; //to translate +$strMySQLCharset = 'MySQL Charset'; //to translate ?> diff --git a/lang/ukrainian-win1251.inc.php3 b/lang/ukrainian-win1251.inc.php3 index 0888b1bdd..3a7db9e10 100644 --- a/lang/ukrainian-win1251.inc.php3 +++ b/lang/ukrainian-win1251.inc.php3 @@ -395,4 +395,7 @@ $strConfigFileError = 'phpMyAdmin was unable to read your configuration file!
    diff --git a/ldi_table.php3 b/ldi_table.php3 index c47a1d1ca..d6bc15ef7 100755 --- a/ldi_table.php3 +++ b/ldi_table.php3 @@ -77,6 +77,7 @@ if (function_exists('PMA_set_enc_form')) { diff --git a/libraries/bookmark.lib.php3 b/libraries/bookmark.lib.php3 index b089cae3c..f54bb1f65 100644 --- a/libraries/bookmark.lib.php3 +++ b/libraries/bookmark.lib.php3 @@ -56,15 +56,15 @@ if (!defined('PMA_BOOKMARK_LIB_INCLUDED')){ . ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\''; if (isset($GLOBALS['dbh'])) { - $result = mysql_query($query, $GLOBALS['dbh']); + $result = PMA_mysql_query($query, $GLOBALS['dbh']); } else { - $result = mysql_query($query); + $result = PMA_mysql_query($query); } // There is some bookmarks -> store them if ($result > 0 && mysql_num_rows($result) > 0) { $flag = 1; - while ($row = mysql_fetch_row($result)) { + while ($row = PMA_mysql_fetch_row($result)) { $bookmark_list[$flag . ' - ' . $row[0]] = $row[1]; $flag++; } // end while @@ -95,11 +95,11 @@ if (!defined('PMA_BOOKMARK_LIB_INCLUDED')){ . ' AND user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\'' . ' AND id = ' . $id; if (isset($GLOBALS['dbh'])) { - $result = mysql_query($query, $GLOBALS['dbh']); + $result = PMA_mysql_query($query, $GLOBALS['dbh']); } else { - $result = mysql_query($query); + $result = PMA_mysql_query($query); } - $bookmark_query = mysql_result($result, 0, 'query'); + $bookmark_query = PMA_mysql_result($result, 0, 'query'); return $bookmark_query; } // end of the 'PMA_queryBookmarks()' function @@ -118,9 +118,9 @@ if (!defined('PMA_BOOKMARK_LIB_INCLUDED')){ $query = 'INSERT INTO ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table']) . ' (id, dbase, user, query, label) VALUES (\'\', \'' . PMA_sqlAddslashes($fields['dbase']) . '\', \'' . PMA_sqlAddslashes($fields['user']) . '\', \'' . PMA_sqlAddslashes(urldecode($fields['query'])) . '\', \'' . PMA_sqlAddslashes($fields['label']) . '\')'; if (isset($GLOBALS['dbh'])) { - $result = mysql_query($query, $GLOBALS['dbh']); + $result = PMA_mysql_query($query, $GLOBALS['dbh']); } else { - $result = mysql_query($query); + $result = PMA_mysql_query($query); } } // end of the 'PMA_addBookmarks()' function @@ -140,9 +140,9 @@ if (!defined('PMA_BOOKMARK_LIB_INCLUDED')){ . ' WHERE user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\'' . ' AND id = ' . $id; if (isset($GLOBALS['dbh'])) { - $result = mysql_query($query, $GLOBALS['dbh']); + $result = PMA_mysql_query($query, $GLOBALS['dbh']); } else { - $result = mysql_query($query); + $result = PMA_mysql_query($query); } } // end of the 'PMA_deleteBookmarks()' function diff --git a/libraries/build_dump.lib.php3 b/libraries/build_dump.lib.php3 index 86ee995b2..82134b5e6 100644 --- a/libraries/build_dump.lib.php3 +++ b/libraries/build_dump.lib.php3 @@ -60,13 +60,13 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){ if (PMA_MYSQL_INT_VERSION >= 32321) { // Whether to quote table and fields names or not if ($use_backquotes) { - mysql_query('SET SQL_QUOTE_SHOW_CREATE = 1'); + PMA_mysql_query('SET SQL_QUOTE_SHOW_CREATE = 1'); } else { - mysql_query('SET SQL_QUOTE_SHOW_CREATE = 0'); + PMA_mysql_query('SET SQL_QUOTE_SHOW_CREATE = 0'); } - $result = mysql_query('SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table)); + $result = PMA_mysql_query('SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table)); if ($result != FALSE && mysql_num_rows($result) > 0) { - $tmpres = mysql_fetch_array($result); + $tmpres = PMA_mysql_fetch_array($result); // Fix for case problems with winwin, thanks to // Pawe³ Szczepañski $pos = strpos($tmpres[1], ' ('); @@ -83,8 +83,8 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){ $schema_create .= 'CREATE TABLE ' . PMA_htmlFormat(PMA_backquote($table), $use_backquotes) . ' (' . $crlf; $local_query = 'SHOW FIELDS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table); - $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url); - while ($row = mysql_fetch_array($result)) { + $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url); + while ($row = PMA_mysql_fetch_array($result)) { $schema_create .= ' ' . PMA_htmlFormat(PMA_backquote($row['Field'], $use_backquotes)) . ' ' . $row['Type']; if (isset($row['Default']) && $row['Default'] != '') { $schema_create .= ' DEFAULT \'' . PMA_htmlFormat(PMA_sqlAddslashes($row['Default'])) . '\''; @@ -101,8 +101,8 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){ $schema_create = ereg_replace(',' . $crlf . '$', '', $schema_create); $local_query = 'SHOW KEYS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table); - $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url); - while ($row = mysql_fetch_array($result)) + $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url); + while ($row = PMA_mysql_fetch_array($result)) { $kname = $row['Key_name']; $comment = (isset($row['Comment'])) ? $row['Comment'] : ''; @@ -181,15 +181,15 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){ global $current_row; $local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . $add_query; - $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url); + $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url); if ($result != FALSE) { $fields_cnt = mysql_num_fields($result); $rows_cnt = mysql_num_rows($result); // Checks whether the field is an integer or not for ($j = 0; $j < $fields_cnt; $j++) { - $field_set[$j] = PMA_backquote(mysql_field_name($result, $j), $use_backquotes); - $type = mysql_field_type($result, $j); + $field_set[$j] = PMA_backquote(PMA_mysql_field_name($result, $j), $use_backquotes); + $type = PMA_mysql_field_type($result, $j); if ($type == 'tinyint' || $type == 'smallint' || $type == 'mediumint' || $type == 'int' || $type == 'bigint' ||$type == 'timestamp') { $field_num[$j] = TRUE; @@ -221,7 +221,7 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){ $time0 = time(); } - while ($row = mysql_fetch_row($result)) { + while ($row = PMA_mysql_fetch_row($result)) { $current_row++; for ($j = 0; $j < $fields_cnt; $j++) { if (!isset($row[$j])) { @@ -308,7 +308,7 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){ global $current_row; $local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . $add_query; - $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url); + $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url); $current_row = 0; $fields_cnt = mysql_num_fields($result); $rows_cnt = mysql_num_rows($result); @@ -322,11 +322,11 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){ $time0 = time(); } - while ($row = mysql_fetch_row($result)) { + while ($row = PMA_mysql_fetch_row($result)) { $current_row++; $table_list = '('; for ($j = 0; $j < $fields_cnt; $j++) { - $table_list .= PMA_backquote(mysql_field_name($result, $j), $use_backquotes) . ', '; + $table_list .= PMA_backquote(PMA_mysql_field_name($result, $j), $use_backquotes) . ', '; } $table_list = substr($table_list, 0, -2); $table_list .= ')'; @@ -348,7 +348,7 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){ if (!isset($row[$j])) { $schema_insert .= ' NULL, '; } else if ($row[$j] == '0' || $row[$j] != '') { - $type = mysql_field_type($result, $j); + $type = PMA_mysql_field_type($result, $j); // a number if ($type == 'tinyint' || $type == 'smallint' || $type == 'mediumint' || $type == 'int' || $type == 'bigint' ||$type == 'timestamp') { @@ -505,14 +505,14 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){ // Gets the data from the database $local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . $add_query; - $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url); + $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url); $fields_cnt = mysql_num_fields($result); @set_time_limit($GLOBALS['cfg']['ExecTimeLimit']); // Format the data $i = 0; - while ($row = mysql_fetch_row($result)) { + while ($row = PMA_mysql_fetch_row($result)) { $schema_insert = ''; for ($j = 0; $j < $fields_cnt; $j++) { if (!isset($row[$j])) { @@ -570,8 +570,8 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){ */ function PMA_getTableXML($db, $table, $limit_from = 0, $limit_to = 0, $crlf, $error_url) { $local_query = 'SHOW COLUMNS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db); - $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url); - for ($i = 0; $row = mysql_fetch_array($result, MYSQL_ASSOC); $i++) { + $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url); + for ($i = 0; $row = PMA_mysql_fetch_array($result, MYSQL_ASSOC); $i++) { $columns[$i] = $row['Field']; } $columns_cnt = count($columns); @@ -588,9 +588,9 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){ } $local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . $add_query; - $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url); + $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url); $buffer = ' ' . $crlf; - while ($record = mysql_fetch_array($result, MYSQL_ASSOC)) { + while ($record = PMA_mysql_fetch_array($result, MYSQL_ASSOC)) { $buffer .= ' <' . $table . '>' . $crlf; for ($i = 0; $i < $columns_cnt; $i++) { // There is no way to dectect a "NULL" value with PHP3 diff --git a/libraries/charset_conversion.lib.php3 b/libraries/charset_conversion.lib.php3 new file mode 100644 index 000000000..4fcda682a --- /dev/null +++ b/libraries/charset_conversion.lib.php3 @@ -0,0 +1,132 @@ += 40000 && !@ini_get('safe_mode') && @ini_get('enable_dl')) + || (PMA_PHP_INT_VERSION > 30009 && !@get_cfg_var('safe_mode'))) + && @function_exists('dl')) { + if (!(@extension_loaded('recode')||@extension_loaded('iconv'))) { + if (PMA_IS_WINDOWS) { + $suffix = '.dll'; + } else { + $suffix = '.so'; + } + @dl('recode'.$suffix); + if (!@extension_loaded('recode')) { + @dl('iconv'.$suffix); + if (!@extension_loaded('iconv')) { + echo $strCantLoadRecodeIconv; + exit(); + } + } + } + } // end load mysql extension + // if allowed recoding, we should try to load extensions for it... + + /** + * Converts encoding according to current settings. + * + * @param mixed what to convert (string or array of strings or object returned by mysql_fetch_field) + * + * @return string converted string or array of strings + * + * @access public + * + * @author nijel + */ + function PMA_convert_display_charset($what) { + global $cfg, $allow_recoding, $charset, $convcharset; + if (!($cfg['AllowAnywhereRecoding'] && $allow_recoding)) { + return $what; + } else { + if (is_array($what)) { + $result = array(); + reset($what); + while(list($key,$val) = each($what)) { +//Debug: echo '['.$key.']='.$val.'
    '; + + if (is_string($val) || is_array($val)) { + if (is_string($key)) { + $result[PMA_convert_display_charset($key)] = PMA_convert_display_charset($val); + } else { + $result[$key] = PMA_convert_display_charset($val); + } + } else { + $result[$key] = $val; + } + } + return $result; + } elseif (is_string($what)) { + if (@function_exists('iconv')) { +//Debug: echo 'PMA_convert_display_charset: '.$what.'->'.iconv($convcharset, $charset, $what)."\n
    "; + return iconv($convcharset, $charset, $what); + } else if (@function_exists('libiconv')) { + return iconv($convcharset, $charset, $what); + } else if (@function_exists('recode_string')) { + return recode_string($convcharset . '..' . $charset, $what); + } else { + echo $strCantUseRecodeIconv; + return $what; + } + } elseif (is_object($what)) { + // isn't it object returned from mysql_fetch_field ? + if (@is_string($what->name)) { + $what->name = PMA_convert_display_charset( $what->name ); + } + if (@is_string($what->table)) { + $what->table = PMA_convert_display_charset( $what->table ); + } + if (@is_string($what->Database)) { + $what->Database = PMA_convert_display_charset( $what->Database ); + } + return $what; + } else { + // when we don't know what it is we don't touch it... + return $what; + } + } + } + + /** + * Converts encoding of text according to current settings. + * + * @param string what to convert + * + * @return string converted text + * + * @access public + * + * @author nijel + */ + function PMA_convert_charset($what) { + global $cfg, $allow_recoding, $charset, $convcharset; + if (!($cfg['AllowAnywhereRecoding'] && $allow_recoding)) { + return $what; + } else { + if (@function_exists('iconv')) { +//Debug: echo 'PMA_convert_charset: '.$what.'->'.iconv($charset, $convcharset, $what)."\n
    "; + return iconv($charset, $convcharset, $what); + } else if (@function_exists('libiconv')) { + return iconv($charset, $convcharset, $what); + } else if (@function_exists('recode_string')) { + return recode_string($charset . '..' . $convcharset, $what); + } else { + echo $strCantUseRecodeIconv; + return $what; + } + } + } +} // PMA_CHARSET_CONVERSION_LIB_INCLUDED +?> diff --git a/libraries/common.lib.php3 b/libraries/common.lib.php3 index ff08a063b..d6e771c39 100644 --- a/libraries/common.lib.php3 +++ b/libraries/common.lib.php3 @@ -116,6 +116,16 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} include('./config.inc.developer.php3'); } + /** + * Include MySQL wrappers. + */ + include('./libraries/mysql_wrappers.lib.php3'); + + /** + * Include charset conversion. + */ + include('./libraries/charset_conversion.lib.php3'); + /** * Gets constants that defines the PHP, MySQL... releases. * This include must be located physically before any code that needs to @@ -331,7 +341,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} } if (!$error_message) { - $error_message = mysql_error(); + $error_message = PMA_mysql_error(); } if (!$the_query && !empty($GLOBALS['sql_query'])) { $the_query = $GLOBALS['sql_query']; @@ -348,7 +358,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} echo ' ' . $GLOBALS['strSQLQuery'] . ' : ' . "\n"; if ($is_modify_link) { echo ' [' - . '' . $GLOBALS['strEdit'] . '' + . '' . $GLOBALS['strEdit'] . '' . ']' . "\n"; } // end if if($cfg['UseSyntaxColoring']){ @@ -632,8 +642,8 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} $cfg['Server']['controlpass'] ); if ($dbh == FALSE) { - if (mysql_error()) { - $conn_error = mysql_error(); + if (PMA_mysql_error()) { + $conn_error = PMA_mysql_error(); } else if (isset($php_errormsg)) { $conn_error = $php_errormsg; } else { @@ -689,18 +699,18 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} for ($i = 0; $i < $dblist_cnt; $i++) { if ($is_show_dbs && ereg('(^|[^\])(_|%)', $dblist[$i])) { $local_query = 'SHOW DATABASES LIKE \'' . $dblist[$i] . '\''; - $rs = mysql_query($local_query, $dbh); + $rs = PMA_mysql_query($local_query, $dbh); // "SHOW DATABASES" statement is disabled if ($i == 0 - && (mysql_error() && mysql_errno() == 1045)) { + && (PMA_mysql_error() && mysql_errno() == 1045)) { $true_dblist[] = str_replace('\\_', '_', str_replace('\\%', '%', $dblist[$i])); $is_show_dbs = FALSE; } // Debug - // else if (mysql_error()) { + // else if (PMA_mysql_error()) { // PMA_mysqlDie('', $local_query, FALSE); // } - while ($row = @mysql_fetch_row($rs)) { + while ($row = @PMA_mysql_fetch_row($rs)) { $true_dblist[] = $row[0]; } // end while if ($rs) { @@ -720,13 +730,13 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} // (if MYSQL supports this) if (PMA_MYSQL_INT_VERSION >= 32330) { $local_query = 'SHOW VARIABLES LIKE \'safe_show_database\''; - $rs = mysql_query($local_query, $dbh); // Debug: or PMA_mysqlDie('', $local_query, FALSE); - $is_safe_show_dbs = ($rs) ? @mysql_result($rs, 0, 'Value') : FALSE; + $rs = PMA_mysql_query($local_query, $dbh); // Debug: or PMA_mysqlDie('', $local_query, FALSE); + $is_safe_show_dbs = ($rs) ? @PMA_mysql_result($rs, 0, 'Value') : FALSE; // ... and if on, try to get the available dbs list if ($is_safe_show_dbs && strtoupper($is_safe_show_dbs) != 'OFF') { $uva_alldbs = mysql_list_dbs($userlink); - while ($uva_row = mysql_fetch_array($uva_alldbs)) { + while ($uva_row = PMA_mysql_fetch_array($uva_alldbs)) { $dblist[] = $uva_row[0]; } // end while $dblist_cnt = count($dblist); @@ -740,7 +750,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} $auth_query = 'SELECT User, Select_priv ' . 'FROM mysql.user ' . 'WHERE User = \'' . PMA_sqlAddslashes($cfg['Server']['user']) . '\''; - $rs = mysql_query($auth_query, $dbh); // Debug: or PMA_mysqlDie('', $auth_query, FALSE); + $rs = PMA_mysql_query($auth_query, $dbh); // Debug: or PMA_mysqlDie('', $auth_query, FALSE); } // end } // end if (!$dblist_cnt) @@ -748,7 +758,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} // usable db list if (!$dblist_cnt && ($rs && @mysql_numrows($rs))) { - $row = mysql_fetch_array($rs); + $row = PMA_mysql_fetch_array($rs); mysql_free_result($rs); // Correction uva 19991215 // Previous code assumed database "mysql" admin table "db" column @@ -765,7 +775,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} // 1. get allowed dbs from the "mysql.db" table // lem9: User can be blank (anonymous user) $local_query = 'SELECT DISTINCT Db FROM mysql.db WHERE Select_priv = \'Y\' AND (User = \'' . PMA_sqlAddslashes($cfg['Server']['user']) . '\' OR User = \'\')'; - $rs = mysql_query($local_query, $dbh); // Debug: or PMA_mysqlDie('', $local_query, FALSE); + $rs = PMA_mysql_query($local_query, $dbh); // Debug: or PMA_mysqlDie('', $local_query, FALSE); if ($rs && @mysql_numrows($rs)) { // Will use as associative array of the following 2 code // lines: @@ -777,7 +787,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} // populating $dblist[], as previous code did. But it is // now populated with actual database names instead of // with regular expressions. - while ($row = mysql_fetch_array($rs)) { + while ($row = PMA_mysql_fetch_array($rs)) { // loic1: all databases cases - part 1 if (empty($row['Db']) || $row['Db'] == '%') { $uva_mydbs['%'] = 1; @@ -792,12 +802,12 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} $uva_alldbs = mysql_list_dbs($dbh); // loic1: all databases cases - part 2 if (isset($uva_mydbs['%'])) { - while ($uva_row = mysql_fetch_array($uva_alldbs)) { + while ($uva_row = PMA_mysql_fetch_array($uva_alldbs)) { $dblist[] = $uva_row[0]; } // end while } // end if else { - while ($uva_row = mysql_fetch_array($uva_alldbs)) { + while ($uva_row = PMA_mysql_fetch_array($uva_alldbs)) { $uva_db = $uva_row[0]; if (isset($uva_mydbs[$uva_db]) && $uva_mydbs[$uva_db] == 1) { $dblist[] = $uva_db; @@ -826,9 +836,9 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} // 2. get allowed dbs from the "mysql.tables_priv" table $local_query = 'SELECT DISTINCT Db FROM mysql.tables_priv WHERE Table_priv LIKE \'%Select%\' AND User = \'' . PMA_sqlAddslashes($cfg['Server']['user']) . '\''; - $rs = mysql_query($local_query, $dbh); // Debug: or PMA_mysqlDie('', $local_query, FALSE); + $rs = PMA_mysql_query($local_query, $dbh); // Debug: or PMA_mysqlDie('', $local_query, FALSE); if ($rs && @mysql_numrows($rs)) { - while ($row = mysql_fetch_array($rs)) { + while ($row = PMA_mysql_fetch_array($rs)) { if (PMA_isInto($row['Db'], $dblist) == -1) { $dblist[] = $row['Db']; } @@ -870,7 +880,7 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} if ($num_dbs) { $true_dblist = array(); for ($i = 0; $i < $num_dbs; $i++) { - $dblink = @mysql_select_db($dblist[$i]); + $dblink = @PMA_mysql_select_db($dblist[$i]); if ($dblink) { $true_dblist[] = $dblist[$i]; } // end if @@ -888,8 +898,8 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} $num_dbs = ($dbs) ? @mysql_num_rows($dbs) : 0; $real_num_dbs = 0; for ($i = 0; $i < $num_dbs; $i++) { - $db_name_tmp = mysql_dbname($dbs, $i); - $dblink = @mysql_select_db($db_name_tmp); + $db_name_tmp = PMA_mysql_dbname($dbs, $i); + $dblink = @PMA_mysql_select_db($db_name_tmp); if ($dblink) { $dblist[] = $db_name_tmp; $real_num_dbs++; @@ -912,10 +922,11 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} * Since MySQL 3.23.6 this allows to use non-alphanumeric characters in * these names. * - * @param string the database, table or field name to "backquote" + * @param mixed the database, table or field name to "backquote" or + * array of it * @param boolean a flag to bypass this function (used by dump functions) * - * @return string the "backquoted" database, table or field name if the + * @return mixed the "backquoted" database, table or field name if the * current MySQL release is >= 3.23.6, the original one * else * @@ -926,7 +937,17 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} if ($do_it && PMA_MYSQL_INT_VERSION >= 32306 && !empty($a_name) && $a_name != '*') { - return '`' . $a_name . '`'; + + if (is_array($a_name)) { + $result = array(); + reset($a_name); + while(list($key,$val) = each($a_name)) { + $result[$key] = '`' . $val . '`'; + } + return $result; + } else { + return '`' . $a_name . '`'; + } } else { return $a_name; } @@ -1005,8 +1026,8 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} */ function PMA_countRecords($db, $table, $ret = FALSE) { - $result = mysql_query('SELECT COUNT(*) AS num FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table)); - $num = ($result) ? mysql_result($result, 0, 'num') : 0; + $result = PMA_mysql_query('SELECT COUNT(*) AS num FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table)); + $num = ($result) ? PMA_mysql_result($result, 0, 'num') : 0; mysql_free_result($result); if ($ret) { return $num; @@ -1031,7 +1052,8 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold} if (isset($GLOBALS['reload']) && $GLOBALS['reload']) { echo "\n"; $reload_url = './left.php3' - . '?lang=' . $GLOBALS['lang'] + . '?convcharset=' . $GLOBALS['convcharset'] + . '&lang=' . $GLOBALS['lang'] . '&server=' . $GLOBALS['server'] . ((!empty($GLOBALS['db'])) ? '&db=' . urlencode($GLOBALS['db']) : ''); ?> @@ -1045,9 +1067,9 @@ window.parent.frames['nav'].location.replace(''); // Corrects the tooltip text via JS if required else if (isset($GLOBALS['table']) && $GLOBALS['cfg']['ShowTooltip'] && PMA_MYSQL_INT_VERSION >= 32303) { - $result = @mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], TRUE) . '\''); + $result = @PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], TRUE) . '\''); if ($result) { - $tmp = mysql_fetch_array($result, MYSQL_ASSOC); + $tmp = PMA_mysql_fetch_array($result, MYSQL_ASSOC); $tooltip = (empty($tmp['Comment'])) ? '' : $tmp['Comment'] . ' '; @@ -1083,6 +1105,7 @@ if (typeof(document.getElementById) != 'undefined' if ($GLOBALS['cfg']['ShowSQL'] == TRUE && !empty($GLOBALS['sql_query'])) { // Basic url query part $url_qpart = '?lang=' . $GLOBALS['lang'] + . '&convcharset=' . $GLOBALS['convcharset'] . '&server=' . $GLOBALS['server'] . ((!empty($GLOBALS['db'])) ? '&db=' . urlencode($GLOBALS['db']) : '') . ((!empty($GLOBALS['table'])) ? '&table=' . urlencode($GLOBALS['table']) : ''); diff --git a/libraries/defines.lib.php3 b/libraries/defines.lib.php3 index eb0d2a9cb..1bdd65c50 100644 --- a/libraries/defines.lib.php3 +++ b/libraries/defines.lib.php3 @@ -50,14 +50,14 @@ if (!defined('PMA_IS_WINDOWS')) { // MySQL Version if (!defined('PMA_MYSQL_INT_VERSION') && isset($userlink)) { if (!empty($server)) { - $result = mysql_query('SELECT VERSION() AS version'); + $result = PMA_mysql_query('SELECT VERSION() AS version'); if ($result != FALSE && @mysql_num_rows($result) > 0) { - $row = mysql_fetch_array($result); + $row = PMA_mysql_fetch_array($result); $match = explode('.', $row['version']); } else { - $result = @mysql_query('SHOW VARIABLES LIKE \'version\''); + $result = @PMA_mysql_query('SHOW VARIABLES LIKE \'version\''); if ($result != FALSE && @mysql_num_rows($result) > 0){ - $row = mysql_fetch_row($result); + $row = PMA_mysql_fetch_row($result); $match = explode('.', $row[1]); } } diff --git a/libraries/display_tbl.lib.php3 b/libraries/display_tbl.lib.php3 index ca4257413..eb2a2d354 100644 --- a/libraries/display_tbl.lib.php3 +++ b/libraries/display_tbl.lib.php3 @@ -159,8 +159,8 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ else if (($do_display['nav_bar'] == '1' || $do_display['sort_lnk'] == '1') && (!empty($db) && !empty($table))) { $local_query = 'SELECT COUNT(*) AS total FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table); - $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); - $the_total = mysql_result($result, 0, 'total'); + $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); + $the_total = PMA_mysql_result($result, 0, 'total'); mysql_free_result($result); } @@ -189,6 +189,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ * @param string the url-encoded query * * @global string the current language + * @global string the currect charset for MySQL * @global integer the server to use (refers to the number in the * configuration file) * @global string the database name @@ -210,7 +211,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ */ function PMA_displayTableNavigation($pos_next, $pos_prev, $encoded_query) { - global $lang, $server, $db, $table; + global $lang, $convcharset, $server, $db, $table; global $goto; global $num_rows, $unlim_num_rows, $pos, $session_max_rows; global $disp_direction, $repeat_cells; @@ -239,6 +240,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
    ' . "\n"; } else if ($row[$pointer] != '') { @@ -953,9 +966,9 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ . ' FROM ' . PMA_backquote($map[$meta->name][0]) . ' WHERE ' . PMA_backquote($map[$meta->name][1]) . ' = ' . $row[$pointer]; - $dispresult = mysql_query($dispsql); + $dispresult = PMA_mysql_query($dispsql); if ($dispresult && mysql_num_rows($dispresult) > 0) { - $dispval = mysql_result($dispresult, 0); + $dispval = PMA_mysql_result($dispresult, 0); } else { $dispval = $GLOBALS['strLinkNotFound']; @@ -968,6 +981,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ $vertical_display['data'][$row_no][$i] .= '' @@ -980,15 +994,15 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ $vertical_display['data'][$row_no][$i] = ' ' . "\n"; } } else if ($GLOBALS['cfg']['ShowBlob'] == FALSE && eregi('BLOB', $meta->type)) { - // loic1 : mysql_fetch_fields returns BLOB in place of TEXT + // loic1 : PMA_mysql_fetch_fields returns BLOB in place of TEXT // fields type, however TEXT fields must be displayed even // if $cfg['ShowBlob'] is false -> get the true type of the // fields. - $field_flags = mysql_field_flags($dt_result, $i); + $field_flags = PMA_mysql_field_flags($dt_result, $i); if (eregi('BINARY', $field_flags)) { $vertical_display['data'][$row_no][$i] = ' ' . "\n"; } else { - if (!isset($row[$meta->name]) + if (!isset($row[$pointer]) || (function_exists('is_null') && is_null($row[$pointer]))) { $vertical_display['data'][$row_no][$i] = ' ' . "\n"; } else if ($row[$pointer] != '') { @@ -1006,7 +1020,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ } } } else { - if (!isset($row[$meta->name]) + if (!isset($row[$pointer]) || (function_exists('is_null') && is_null($row[$pointer]))) { $vertical_display['data'][$row_no][$i] = ' ' . "\n"; } else if ($row[$pointer] != '') { @@ -1020,7 +1034,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ } } // loic1: displays special characters from binaries - $field_flags = mysql_field_flags($dt_result, $i); + $field_flags = PMA_mysql_field_flags($dt_result, $i); if (eregi('BINARY', $field_flags)) { $row[$pointer] = str_replace("\x00", '\0', $row[$pointer]); $row[$pointer] = str_replace("\x08", '\b', $row[$pointer]); @@ -1045,9 +1059,9 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ . ' FROM ' . PMA_backquote($map[$meta->name][0]) . ' WHERE ' . PMA_backquote($map[$meta->name][1]) . ' = \'' . PMA_sqlAddslashes($row[$pointer]) . '\''; - $dispresult = @mysql_query($dispsql); + $dispresult = @PMA_mysql_query($dispsql); if ($dispresult && mysql_num_rows($dispresult) > 0) { - $dispval = mysql_result($dispresult, 0); + $dispval = PMA_mysql_result($dispresult, 0); } else { $dispval = $GLOBALS['strLinkNotFound']; @@ -1060,6 +1074,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ $vertical_display['data'][$row_no][$i] .= '' @@ -1386,17 +1401,17 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ $local_query = 'SELECT master_field, foreign_table, foreign_field' . ' FROM ' . PMA_backquote($cfg['Server']['relation']) . ' WHERE master_table IN ' . $tabs; - $result = @mysql_query($local_query); + $result = @PMA_mysql_query($local_query); if ($result) { - while ($rel = mysql_fetch_row($result)) { + while ($rel = PMA_mysql_fetch_row($result)) { // check for display field? if (!empty($cfg['Server']['table_info'])) { $ti_query = 'SELECT display_field' . ' FROM ' . PMA_backquote($cfg['Server']['table_info']) . ' WHERE table_name = \'' . PMA_sqlAddslashes($rel[1]) . '\''; - $result_ti = @mysql_query($ti_query); + $result_ti = @PMA_mysql_query($ti_query); if ($result_ti) { - list($display_field) = mysql_fetch_row($result_ti); + list($display_field) = PMA_mysql_fetch_row($result_ti); } else { $display_field = ''; } diff --git a/libraries/mysql_wrappers.lib.php3 b/libraries/mysql_wrappers.lib.php3 new file mode 100644 index 000000000..08f391382 --- /dev/null +++ b/libraries/mysql_wrappers.lib.php3 @@ -0,0 +1,117 @@ + diff --git a/libraries/select_lang.lib.php3 b/libraries/select_lang.lib.php3 index ffce40cd7..5763777e0 100644 --- a/libraries/select_lang.lib.php3 +++ b/libraries/select_lang.lib.php3 @@ -45,11 +45,13 @@ $available_languages = array( 'bg-koi8r' => array('bg|bulgarian', 'bulgarian-koi8', 'bg'), 'ca' => array('ca|catalan', 'catala', 'ca'), 'cs-iso' => array('cs|czech', 'czech-iso', 'cs'), + 'cs-utf8' => array('cs|czech', 'czech-utf8', 'cs'), 'cs-win1250' => array('cs|czech', 'czech-win1250', 'cs'), 'da' => array('da|danish', 'danish', 'da'), 'de' => array('de([-_][[:alpha:]]{2})?|german', 'german', 'de'), 'el' => array('el|greek', 'greek', 'el'), 'en' => array('en([-_][[:alpha:]]{2})?|english', 'english', 'en'), + 'en-utf8' => array('en([-_][[:alpha:]]{2})?|english', 'english-utf8', 'en'), 'es' => array('es([-_][[:alpha:]]{2})?|spanish', 'spanish', 'es'), 'et' => array('et|estonian', 'estonian', 'et'), 'fi' => array('fi|finnish', 'finnish', 'fi'), @@ -209,6 +211,9 @@ if (empty($lang)) { $lang = $cfg['DefaultLang']; } +$allow_recoding = FALSE; // Default fallback value +if (!isset($convcharset) || empty($convcharset)) $convcharset = $cfg['DefaultCharset']; + // 4. Defines the associated filename and load the translation $lang_file = $lang_path . $available_languages[$lang][1] . '.inc.php3'; require('./' . $lang_file); diff --git a/libraries/user_details.js b/libraries/user_details.js index e3afe84da..583a840a7 100644 --- a/libraries/user_details.js +++ b/libraries/user_details.js @@ -143,6 +143,7 @@ function change(the_field) { else { if (lpos <= 0) { l += '?lang=' + the_form['lang'].value + += '&convcharset=' . the_form['convcharset'].value + '&server=' + the_form['server'].value + '&grants=1' + '&host=' + escape(the_form['host'].value) diff --git a/main.php3 b/main.php3 index 6abf80cdc..a4fd9fd30 100755 --- a/main.php3 +++ b/main.php3 @@ -34,7 +34,7 @@ else if (isset($reload) && $reload) { ?> 0) { // $server_info .= ':' . $cfg['Server']['socket']; // } $local_query = 'SELECT VERSION() as version, USER() as user'; - $res = mysql_query($local_query) or PMA_mysqlDie('', $local_query, FALSE, ''); - $mysql_cur_user_and_host = mysql_result($res, 0, 'user'); + $res = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, FALSE, ''); + $mysql_cur_user_and_host = PMA_mysql_result($res, 0, 'user'); $mysql_cur_user = substr($mysql_cur_user_and_host, 0, strpos($mysql_cur_user_and_host, '@')); - $full_string = str_replace('%pma_s1%', mysql_result($res, 0, 'version'), $strMySQLServerProcess); + $full_string = str_replace('%pma_s1%', PMA_mysql_result($res, 0, 'version'), $strMySQLServerProcess); $full_string = str_replace('%pma_s2%', $server_info, $full_string); $full_string = str_replace('%pma_s3%', $mysql_cur_user_and_host, $full_string); @@ -77,7 +77,7 @@ if ($server > 0) { * Reload mysql (flush privileges) */ if (($server > 0) && isset($mode) && ($mode == 'reload')) { - $result = mysql_query('FLUSH PRIVILEGES'); // Debug: or PMA_mysqlDie('', 'FLUSH PRIVILEGES', FALSE, 'main.php3?lang=' . $lang . '&server=' . $server); + $result = PMA_mysql_query('FLUSH PRIVILEGES'); // Debug: or PMA_mysqlDie('', 'FLUSH PRIVILEGES', FALSE, 'main.php3?lang=' . $lang . '&server=' . $server); echo '

    '; if ($result != 0) { echo $strMySQLReloaded; @@ -140,6 +140,7 @@ if ($server == 0 || count($cfg['Servers']) > 1) { ?> + @@ -165,12 +166,12 @@ if ($server > 0) { $is_create_priv = FALSE; $is_process_priv = FALSE; $is_reload_priv = FALSE; - $is_superuser = @mysql_query('USE mysql', $userlink); + $is_superuser = @PMA_mysql_query('USE mysql', $userlink); if ($dbh) { $local_query = 'SELECT Create_priv, Process_priv, Reload_priv FROM mysql.user WHERE User = \'' . PMA_sqlAddslashes($mysql_cur_user) . '\''; - $rs_usr = mysql_query($local_query, $dbh); // Debug: or PMA_mysqlDie('', $local_query, FALSE); + $rs_usr = PMA_mysql_query($local_query, $dbh); // Debug: or PMA_mysqlDie('', $local_query, FALSE); if ($rs_usr) { - while ($result_usr = mysql_fetch_array($rs_usr)) { + while ($result_usr = PMA_mysql_fetch_array($rs_usr)) { if (!$is_create_priv) { $is_create_priv = ($result_usr['Create_priv'] == 'Y'); } @@ -190,13 +191,13 @@ if ($server > 0) { // the one he just dropped :) if (!$is_create_priv) { $local_query = 'SELECT DISTINCT Db FROM mysql.db WHERE Create_priv = \'Y\' AND User = \'' . PMA_sqlAddslashes($mysql_cur_user) . '\''; - $rs_usr = mysql_query($local_query, $dbh); // Debug: or PMA_mysqlDie('', $local_query, FALSE); + $rs_usr = PMA_mysql_query($local_query, $dbh); // Debug: or PMA_mysqlDie('', $local_query, FALSE); if ($rs_usr) { $re0 = '(^|(\\\\\\\\)+|[^\])'; // non-escaped wildcards $re1 = '(^|[^\])(\\\)+'; // escaped wildcards - while ($row = mysql_fetch_array($rs_usr)) { + while ($row = PMA_mysql_fetch_array($rs_usr)) { if (ereg($re0 . '(%|_)', $row['Db']) - || (!mysql_select_db(ereg_replace($re1 . '(%|_)', '\\1\\3', $row['Db']), $userlink) && @mysql_errno() != 1044)) { + || (!PMA_mysql_select_db(ereg_replace($re1 . '(%|_)', '\\1\\3', $row['Db']), $userlink) && @mysql_errno() != 1044)) { $db_to_create = ereg_replace($re0 . '%', '\\1...', ereg_replace($re0 . '_', '\\1?', $row['Db'])); $db_to_create = ereg_replace($re1 . '(%|_)', '\\1\\3', $db_to_create); $is_create_priv = TRUE; @@ -210,16 +211,16 @@ if ($server > 0) { // GRANTS... // Maybe we'll find a little CREATE priv there :) $local_query = 'SHOW GRANTS FOR ' . $mysql_cur_user_and_host; - $rs_usr = mysql_query($local_query, $dbh); + $rs_usr = PMA_mysql_query($local_query, $dbh); if (!$rs_usr) { // OK, now we'd have to guess the user's hostname, but we // only try out the 'username'@'%' case. $local_query = 'SHOW GRANTS FOR ' . $mysql_cur_user; - $rs_usr = mysql_query($local_query, $dbh); + $rs_usr = PMA_mysql_query($local_query, $dbh); } if ($rs_usr) { $re = '(^|(\\\\\\\\)+|[^\])'; - while ($row = mysql_fetch_row($rs_usr)) { + while ($row = PMA_mysql_fetch_row($rs_usr)) { $show_grants_dbname = substr($row[0], strpos($row[0], ' ON ') + 4,(strpos($row[0], '.', strpos($row[0], ' ON ')) - strpos($row[0], ' ON ') - 4)); $show_grants_str = substr($row[0],6,(strpos($row[0],' ON ')-6)); if (($show_grants_str == 'ALL') || ($show_grants_str == 'ALL PRIVILEGES') || ($show_grants_str == 'CREATE') || strpos($show_grants_str, 'CREATE')) { @@ -228,7 +229,7 @@ if ($server > 0) { $db_to_create = ''; break; } // end if - else if (ereg($re . '%|_', $show_grants_dbname) || !mysql_select_db($show_grants_dbname, $userlink) && @mysql_errno() != 1044) { + else if (ereg($re . '%|_', $show_grants_dbname) || !PMA_mysql_select_db($show_grants_dbname, $userlink) && @mysql_errno() != 1044) { $show_grants_dbname = ereg_replace($re . '%', '\\1...', ereg_replace($re . '_', '\\1?', $show_grants_dbname)); $db_to_create = $show_grants_dbname; $is_create_priv = TRUE; @@ -246,7 +247,7 @@ if ($server > 0) { $db_to_create = ''; } // end else - $common_url_query = 'lang=' . $lang . '&server=' . $server; + $common_url_query = 'lang=' . $lang . '&server=' . $server . '&convcharset=' . $convcharset; if ($is_superuser) { $cfg['ShowMysqlInfo'] = TRUE; @@ -282,6 +283,7 @@ if ($server > 0) {
    + @@ -441,6 +443,7 @@ if (empty($cfg['Lang'])) {

    + + + + diff --git a/mult_submits.inc.php3 b/mult_submits.inc.php3 index 5acfac5ca..f74176688 100644 --- a/mult_submits.inc.php3 +++ b/mult_submits.inc.php3 @@ -102,6 +102,7 @@ if (!empty($submit_mult) && !empty($what)) { ?>
    + 0){ if($arrvalue['delete'] == 'y'){ $ch_query = 'DELETE FROM '.PMA_backquote($cfg['Server']['table_coords']) . @@ -96,7 +96,7 @@ if (!empty($cfg['Server']['pdf_pages'])){ ' VALUES (\''.$arrvalue['name'].'\','.$chpage.','. $arrvalue['x'].','.$arrvalue['y'].')'; } - mysql_query($ch_query) or PMA_mysqlDie('', $ch_query, '', $err_url_0); + PMA_mysql_query($ch_query) or PMA_mysqlDie('', $ch_query, '', $err_url_0); } } break; @@ -104,19 +104,20 @@ if (!empty($cfg['Server']['pdf_pages'])){ } // now first show some possibility to choose a page for the pdf $page_query = 'SELECT * FROM ' .PMA_backquote($cfg['Server']['pdf_pages']); - $page_rs = mysql_query($page_query) or PMA_mysqlDie('', $page_query, '', $err_url_0); + $page_rs = PMA_mysql_query($page_query) or PMA_mysqlDie('', $page_query, '', $err_url_0); if(mysql_num_rows($page_rs)>0){ ?> + + @@ -148,6 +150,7 @@ if (!empty($cfg['Server']['pdf_pages'])){ + @@ -158,9 +161,9 @@ if (!empty($cfg['Server']['pdf_pages'])){ if(isset($ctable)){unset($ctable);} $page_query = 'SELECT * FROM' . PMA_backquote($cfg['Server']['table_coords']) . ' WHERE pdf_page_number='.$chpage; - $page_rs = mysql_query($page_query) or PMA_mysqlDie('', $page_query, '', $err_url_0); + $page_rs = PMA_mysql_query($page_query) or PMA_mysqlDie('', $page_query, '', $err_url_0); $i=0; - while ($sh_page = @mysql_fetch_array($page_rs)) { + while ($sh_page = @PMA_mysql_fetch_array($page_rs)) { echo '
    ' . $GLOBALS['strBack'] . ''; @@ -281,7 +282,6 @@ class PMA_PDF extends FPDF } // end of the "PMA_PDF" class - /** * Draws tables schema * @@ -406,12 +406,12 @@ class PMA_RT_Table $this->table_name = $table_name; $sql = 'DESCRIBE ' . PMA_backquote($table_name); - $result = mysql_query($sql); + $result = PMA_mysql_query($sql); if (!$result || !mysql_num_rows($result)) { $pdf->PMA_PDF_die(sprintf($GLOBALS['strPdfInvalidTblName'], $table_name)); } // load fields - while ($row = mysql_fetch_array($result)) { + while ($row = PMA_mysql_fetch_array($result)) { $this->fields[] = $row[0]; } @@ -424,30 +424,30 @@ class PMA_RT_Table . PMA_backquote($GLOBALS['cfg']['Server']['table_coords']) . ' WHERE table_name = \'' . PMA_sqlAddslashes($table_name) . '\'' . ' AND pdf_page_number = ' . $pdf_page_number; - $result = mysql_query($sql); + $result = PMA_mysql_query($sql); if (!$result || !mysql_num_rows($result)) { $pdf->PMA_PDF_die(sprintf($GLOBALS['strConfigureTableCoord'], $table_name)); } - list($this->x, $this->y) = mysql_fetch_array($result); + list($this->x, $this->y) = PMA_mysql_fetch_array($result); $this->x = (double) $this->x; $this->y = (double) $this->y; //displayfield $sql = 'SELECT display_field from '.PMA_backquote($GLOBALS['cfg']['Server']['table_info']) . ' WHERE table_name = \'' . PMA_sqlAddslashes($table_name) . '\''; - $result = mysql_query($sql); + $result = PMA_mysql_query($sql); if(mysql_num_rows($result)>0){ - list($this->displayfield) = mysql_fetch_array($result); + list($this->displayfield) = PMA_mysql_fetch_array($result); } - while ($row = mysql_fetch_array($result)) { + while ($row = PMA_mysql_fetch_array($result)) { $this->displayfield = $row['display_field ']; } // index $sql = 'SHOW index from '.PMA_backquote($table_name); - $result = mysql_query($sql); + $result = PMA_mysql_query($sql); if(mysql_num_rows($result)>0){ - while ($row = mysql_fetch_array($result)) { + while ($row = PMA_mysql_fetch_array($result)) { if($row['Key_name'] == 'PRIMARY'){ $this->primary = $row['Column_name']; } @@ -806,8 +806,8 @@ class PMA_RT // get tables on this page $tab_sql = 'SELECT table_name from '.PMA_backquote($GLOBALS['cfg']['Server']['table_coords']) . ' WHERE pdf_page_number = ' . $which_rel; - $tab_rs = mysql_query($tab_sql) or PMA_mysqlDie('', $tab_sql, '', $err_url_0); - while ($curr_table = @mysql_fetch_array($tab_rs)) { + $tab_rs = PMA_mysql_query($tab_sql) or PMA_mysqlDie('', $tab_sql, '', $err_url_0); + while ($curr_table = @PMA_mysql_fetch_array($tab_rs)) { $alltables[] = $curr_table['table_name']; $intable = "'" . implode("','",$alltables) . "'"; } @@ -815,11 +815,11 @@ class PMA_RT . PMA_backquote($GLOBALS['cfg']['Server']['relation']) . ' WHERE master_table in (' . $intable . ') ' . ' AND foreign_table in (' . $intable . ')'; - $result = mysql_query($sql); + $result = PMA_mysql_query($sql); if (!$result || !mysql_num_rows($result)) { $pdf->PMA_PDF_die($GLOBALS['strPdfInvalidPageNum']); } - while ($row = mysql_fetch_array($result)) { + while ($row = PMA_mysql_fetch_array($result)) { $this->PMA_RT_addRelation($row['master_table'] , $row['master_field'], $row['foreign_table'], $row['foreign_field']); } diff --git a/phpinfo.php3 b/phpinfo.php3 index beb790fdf..4eaf83183 100644 --- a/phpinfo.php3 +++ b/phpinfo.php3 @@ -12,7 +12,7 @@ require('./libraries/common.lib.php3'); /** * Displays PHP information */ -$is_superuser = @mysql_query('USE mysql', $userlink); +$is_superuser = @PMA_mysql_query('USE mysql', $userlink); if ($is_superuser || $cfg['ShowPhpInfo']) { phpinfo(); } diff --git a/read_dump.php3 b/read_dump.php3 index 512759565..25cb73150 100644 --- a/read_dump.php3 +++ b/read_dump.php3 @@ -187,6 +187,7 @@ if (!isset($goto) } $err_url = $goto . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db) . (($goto == 'tbl_properties.php3') ? '&table=' . urlencode($table) : ''); @@ -304,8 +305,8 @@ if (!$cfg['AllowUserDropDatabase'] // Checks if the user is a Superuser // TODO: set a global variable with this information // loic1: optimized query - $result = @mysql_query('USE mysql'); - if (mysql_error()) { + $result = @PMA_mysql_query('USE mysql'); + if (PMA_mysql_error()) { include('./header.inc.php3'); PMA_mysqlDie($strNoDropDatabases, '', '', $err_url); } @@ -349,11 +350,11 @@ if ($sql_query != '') { } // Runs multiple queries - else if (mysql_select_db($db)) { + else if (PMA_mysql_select_db($db)) { $mult = TRUE; for ($i = 0; $i < $pieces_count; $i++) { $a_sql_query = $pieces[$i]; - $result = mysql_query($a_sql_query); + $result = PMA_mysql_query($a_sql_query); if ($result == FALSE) { // readdump failed $my_die = $a_sql_query; break; @@ -393,7 +394,7 @@ if ($goto == 'tbl_properties.php3') { if (!isset($table)) { $goto = 'db_details.php3'; } else { - $is_table = @mysql_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\''); + $is_table = @PMA_mysql_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\''); if (!($is_table && @mysql_numrows($is_table))) { $goto = 'db_details.php3'; unset($table); @@ -407,7 +408,7 @@ if ($goto == 'db_details.php3') { if (!isset($db)) { $goto = 'main.php3'; } else { - $is_db = @mysql_select_db($db); + $is_db = @PMA_mysql_select_db($db); if (!$is_db) { $goto = 'main.php3'; unset($db); diff --git a/scripts/sync_czech.sh b/scripts/sync_czech.sh new file mode 100644 index 000000000..4f9a4e4b7 --- /dev/null +++ b/scripts/sync_czech.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# +# Shell script that synchronises all czech translations using iso-8859-2 as basic + +echo -n "Creating windows-1250 ... " +iconv -f iso8859-2 -t windows-1250 czech-iso.inc.php3| sed 's/iso-8859-2/windows-1250/' > czech-win1250.inc.php3 +echo done +echo -n "Creating utf-8 ... " +iconv -f iso8859-2 -t utf-8 czech-iso.inc.php3| sed -e 's/iso-8859-2/utf-8/' -e '/\$charset/a\ +$allow_recoding = TRUE;' > czech-utf8.inc.php3 +echo done + diff --git a/scripts/sync_english.sh b/scripts/sync_english.sh new file mode 100644 index 000000000..8b61fcd75 --- /dev/null +++ b/scripts/sync_english.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# +# Shell script that synchronises all english translations using iso-8859-1 as basic + +echo -n "Creating utf-8 ... " +iconv -f iso8859-2 -t utf-8 english.inc.php3| sed -e 's/iso-8859-1/utf-8/' -e '/\$charset/a\ +$allow_recoding = TRUE;' > english-utf8.inc.php3 +echo done + diff --git a/sql.php3 b/sql.php3 index d8916326a..728404db0 100755 --- a/sql.php3 +++ b/sql.php3 @@ -29,6 +29,7 @@ if (empty($goto)) { if (!isset($err_url)) { $err_url = (!empty($back) ? $back : $goto) . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . (isset($db) ? '&db=' . urlencode($db) : '') . ((strpos(' ' . $goto, 'db_details') != 1 && isset($table)) ? '&table=' . urlencode($table) : ''); @@ -48,8 +49,8 @@ if (!defined('PMA_CHK_DROP') // Checks if the user is a Superuser // TODO: set a global variable with this information // loic1: optimized query - $result = @mysql_query('USE mysql'); - if (mysql_error()) { + $result = @PMA_mysql_query('USE mysql'); + if (PMA_mysql_error()) { include('./header.inc.php3'); PMA_mysqlDie($strNoDropDatabases, '', '', $err_url); } // end if @@ -106,6 +107,7 @@ if ($is_select) { if ($goto == 'sql.php3') { $goto = 'sql.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db) . '&table=' . urlencode($table) @@ -160,6 +162,7 @@ if ($do_confirm) { ?> + @@ -246,7 +249,7 @@ else { } // end if...else - mysql_select_db($db); + PMA_mysql_select_db($db); // If the query is a DELETE query with no WHERE clause, get the number of // rows that will be deleted (mysql_affected_rows will always return 0 in @@ -254,9 +257,9 @@ else { if ($is_delete && eregi('^DELETE([[:space:]].+)?([[:space:]]FROM[[:space:]](.+))$', $sql_query, $parts) && !eregi('[[:space:]]WHERE[[:space:]]', $parts[3])) { - $cnt_all_result = @mysql_query('SELECT COUNT(*) as count' . $parts[2]); + $cnt_all_result = @PMA_mysql_query('SELECT COUNT(*) as count' . $parts[2]); if ($cnt_all_result) { - $num_rows = mysql_result($cnt_all_result, 0, 'count'); + $num_rows = PMA_mysql_result($cnt_all_result, 0, 'count'); mysql_free_result($cnt_all_result); } else { $num_rows = 0; @@ -264,11 +267,11 @@ else { } // Executes the query - $result = @mysql_query($full_sql_query); + $result = @PMA_mysql_query($full_sql_query); // Displays an error message if required and stop parsing the script - if (mysql_error()) { - $error = mysql_error(); + if (PMA_mysql_error()) { + $error = PMA_mysql_error(); include('./header.inc.php3'); $full_err_url = (ereg('^(db_details|tbl_properties)', $err_url)) ? $err_url . '&show_query=y&sql_query=' . urlencode($sql_query) @@ -307,9 +310,9 @@ else { if (!empty($array[1])) { // ... and makes a count(*) to count the entries $count_query = 'SELECT COUNT(*) AS count FROM ' . $array[1]; - $cnt_all_result = mysql_query($count_query); + $cnt_all_result = PMA_mysql_query($count_query); if ($cnt_all_result) { - $unlim_num_rows = mysql_result($cnt_all_result, 0, 'count'); + $unlim_num_rows = PMA_mysql_result($cnt_all_result, 0, 'count'); mysql_free_result($cnt_all_result); } } else { @@ -345,7 +348,7 @@ else { if (!isset($table)) { $goto = 'db_details.php3'; } else { - $is_table = @mysql_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\''); + $is_table = @PMA_mysql_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\''); if (!($is_table && @mysql_numrows($is_table))) { $goto = 'db_details.php3'; unset($table); @@ -359,7 +362,7 @@ else { if (!isset($db)) { $goto = 'main.php3'; } else { - $is_db = @mysql_select_db($db); + $is_db = @PMA_mysql_select_db($db); if (!$is_db) { $goto = 'main.php3'; unset($db); @@ -397,7 +400,7 @@ else { } // Gets the list of fields properties - while ($field = mysql_fetch_field($result)) { + while ($field = PMA_mysql_fetch_field($result)) { $fields_meta[] = $field; } $fields_cnt = count($fields_meta); @@ -420,6 +423,7 @@ else { if ($disp_mode[6] == '1') { $lnk_goto = 'sql.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db) . '&table=' . urlencode($table) @@ -429,6 +433,7 @@ else { . '&repeat_cells=' . $repeat_cells . '&sql_query=' . urlencode($sql_query); $url_query = '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db) . '&table=' . urlencode($table) @@ -450,6 +455,7 @@ else { // Displays "printable view" link if required if ($disp_mode[9] == '1') { $url_query = '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db) . '&table=' . urlencode($table) @@ -475,6 +481,7 @@ else { $goto = 'sql.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db) . '&table=' . urlencode($table) diff --git a/tbl_addfield.php3 b/tbl_addfield.php3 index 2ab70a25d..b4e504515 100755 --- a/tbl_addfield.php3 +++ b/tbl_addfield.php3 @@ -17,6 +17,7 @@ require('./header.inc.php3'); */ $err_url = 'tbl_properties.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db) . '&table=' . urlencode($table); @@ -118,9 +119,9 @@ if (isset($submit)) { // To allow replication, we first select the db to use and then run queries // on this db. $sql_query = 'USE ' . PMA_backquote($db); - $result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); + $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD ' . $query; - $result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); + $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); $sql_query_cpy = $sql_query . ';'; // Builds the primary keys statements and updates the table @@ -134,7 +135,7 @@ if (isset($submit)) { $primary = ereg_replace(', $', '', $primary); if (!empty($primary)) { $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD PRIMARY KEY (' . $primary . ')'; - $result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); + $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); $sql_query_cpy .= "\n" . $sql_query . ';'; } } // end if @@ -150,7 +151,7 @@ if (isset($submit)) { $index = ereg_replace(', $', '', $index); if (!empty($index)) { $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD INDEX (' . $index . ')'; - $result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); + $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); $sql_query_cpy .= "\n" . $sql_query . ';'; } } // end if @@ -166,7 +167,7 @@ if (isset($submit)) { $unique = ereg_replace(', $', '', $unique); if (!empty($unique)) { $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD UNIQUE (' . $unique . ')'; - $result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); + $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); $sql_query_cpy .= "\n" . $sql_query . ';'; } } // end if @@ -183,7 +184,7 @@ if (isset($submit)) { $fulltext = ereg_replace(', $', '', $fulltext); if (!empty($fulltext)) { $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ADD FULLTEXT (' . $fulltext . ')'; - $result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); + $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); $sql_query_cpy .= "\n" . $sql_query . ';'; } } // end if diff --git a/tbl_alter.php3 b/tbl_alter.php3 index b1f66eaca..9ea146ae3 100755 --- a/tbl_alter.php3 +++ b/tbl_alter.php3 @@ -19,6 +19,7 @@ if (!isset($submit_mult)) { */ $err_url = 'tbl_properties_structure.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db) . '&table=' . urlencode($table); @@ -86,10 +87,10 @@ if (isset($submit)) { // To allow replication, we first select the db to use and then run queries // on this db. $sql_query = 'USE ' . PMA_backquote($db); - $result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); + $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); // Optimization fix - 2 May 2001 - Robbat2 $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' CHANGE ' . $query; - $result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); + $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); $message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenAltered; $btnDrop = 'Fake'; include('./tbl_properties_structure.php3'); @@ -120,8 +121,8 @@ else { $field = PMA_sqlAddslashes($selected[$i], TRUE); } $local_query = 'SHOW FIELDS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . " LIKE '$field'"; - $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); - $fields_meta[] = mysql_fetch_array($result); + $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); + $fields_meta[] = PMA_mysql_fetch_array($result); mysql_free_result($result); } diff --git a/tbl_change.php3 b/tbl_change.php3 index 57bb0813f..1ece0af35 100755 --- a/tbl_change.php3 +++ b/tbl_change.php3 @@ -13,6 +13,7 @@ if (!empty($message)) { $goto_cpy = $goto; $goto = 'tbl_properties.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db) . '&table=' . urlencode($table) @@ -59,6 +60,7 @@ if ($goto != 'db_details.php3' && $goto != 'tbl_properties.php3') { } else { $err_url = $goto . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db) . (($goto == 'tbl_properties.php3') ? '&table=' . urlencode($table) : ''); @@ -69,11 +71,11 @@ if ($goto != 'db_details.php3' && $goto != 'tbl_properties.php3') { * Get the list of the fields of the current table */ mysql_select_db($db); -$table_def = mysql_query('SHOW FIELDS FROM ' . PMA_backquote($table)); +$table_def = PMA_mysql_query('SHOW FIELDS FROM ' . PMA_backquote($table)); if (isset($primary_key)) { $local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $primary_key; - $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); - $row = mysql_fetch_array($result); + $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); + $row = PMA_mysql_fetch_array($result); // No row returned if (!$row) { unset($row); @@ -81,6 +83,7 @@ if (isset($primary_key)) { $goto_cpy = $goto; $goto = 'tbl_properties.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db) . '&table=' . urlencode($table) @@ -103,7 +106,7 @@ if (isset($primary_key)) { else { $local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' LIMIT 1'; - $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); + $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); unset($row); } @@ -123,6 +126,7 @@ $chg_evt_handler = (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5) + @@ -161,7 +165,7 @@ $timestamp_seen = 0; $fields_cnt = mysql_num_rows($table_def); for ($i = 0; $i < $fields_cnt; $i++) { - $row_table_def = mysql_fetch_array($table_def); + $row_table_def = PMA_mysql_fetch_array($table_def); $field = $row_table_def['Field']; if ($row_table_def['Type'] == 'datetime' && empty($row[$field])) { $row[$field] = date('Y-m-d H:i:s', time()); diff --git a/tbl_create.php3 b/tbl_create.php3 index de4153e7d..1af9e9abe 100755 --- a/tbl_create.php3 +++ b/tbl_create.php3 @@ -17,6 +17,7 @@ require('./header.inc.php3'); */ $err_url = 'tbl_properties.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db) . '&table=' . urlencode($table); @@ -204,7 +205,7 @@ if (isset($submit)) { } // Executes the query - $result = mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); + $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url); $sql_query = $query_cpy . ';'; unset($query_cpy); $message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenCreated; diff --git a/tbl_dump.php3 b/tbl_dump.php3 index 61e8c99cd..c317c13b1 100755 --- a/tbl_dump.php3 +++ b/tbl_dump.php3 @@ -89,6 +89,7 @@ require('./libraries/zip.lib.php3'); */ $err_url = 'tbl_properties.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db) . (isset($table) ? '&table=' . urlencode($table) : ''); @@ -179,7 +180,7 @@ else { */ // Gets the number of tables if a dump of a database has been required if (!isset($table)) { - $tables = mysql_list_tables($db); + $tables = PMA_mysql_list_tables($db); $num_tables = ($tables) ? @mysql_numrows($tables) : 0; } else { $num_tables = 1; @@ -219,7 +220,7 @@ else { } while ($i < $num_tables) { if (!isset($single)) { - $table = mysql_tablename($tables, $i); + $table = PMA_mysql_tablename($tables, $i); } if (isset($tmp_select) && !strpos(' ' . $tmp_select, '|' . $table . '|')) { $i++; @@ -303,7 +304,7 @@ else { $i = 0; while ($i < $num_tables) { if (!isset($single)) { - $table = mysql_tablename($tables, $i); + $table = PMA_mysql_tablename($tables, $i); } if (!isset($limit_from) || !isset($limit_to)) { $limit_from = $limit_to = 0; diff --git a/tbl_indexes.php3 b/tbl_indexes.php3 index 60be3d604..cf24af7fa 100644 --- a/tbl_indexes.php3 +++ b/tbl_indexes.php3 @@ -31,19 +31,19 @@ if (PMA_MYSQL_INT_VERSION >= 32323) { if (!defined('PMA_IDX_INCLUDED')) { // Not a valid db name -> back to the welcome page if (!empty($db)) { - $is_db = @mysql_select_db($db); + $is_db = @PMA_mysql_select_db($db); } if (empty($db) || !$is_db) { - header('Location: ' . $cfg['PmaAbsoluteUri'] . 'main.php3?lang=' . $lang . '&server=' . $server . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1'); + header('Location: ' . $cfg['PmaAbsoluteUri'] . 'main.php3?lang=' . $lang . '&convcharset=' . $convcharset . '&server=' . $server . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1'); exit(); } // Not a valid table name -> back to the db_details.php3 if (!empty($table)) { - $is_table = @mysql_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\''); + $is_table = @PMA_mysql_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\''); } if (empty($table) || !($is_table && @mysql_numrows($is_table))) { - header('Location: ' . $cfg['PmaAbsoluteUri'] . 'db_details.php3?lang=' . $lang . '&server=' . $server . '&db=' . urlencode($db) . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1'); + header('Location: ' . $cfg['PmaAbsoluteUri'] . 'db_details.php3?lang=' . $lang . '&convcharset=' . $convcharset . '&server=' . $server .'&db=' . urlencode($db) . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1'); exit(); } else if (isset($is_table)) { mysql_free_result($is_table); @@ -61,6 +61,7 @@ if (!defined('PMA_IDX_INCLUDED')) { if (defined('PMA_IDX_INCLUDED')) { $err_url_0 = 'db_details.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db); } @@ -75,12 +76,12 @@ if (defined('PMA_IDX_INCLUDED')) { $idx_cnt = count($ret_keys); } else { $local_query = 'SHOW KEYS FROM ' . PMA_backquote($table); - $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); + $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); $idx_cnt = mysql_num_rows($result); } for ($i = 0; $i < $idx_cnt; $i++) { - $row = (defined('PMA_IDX_INCLUDED') ? $ret_keys[$i] : mysql_fetch_array($result)); + $row = (defined('PMA_IDX_INCLUDED') ? $ret_keys[$i] : PMA_mysql_fetch_array($result)); if ($row['Key_name'] != $prev_index ){ $indexes[] = $row['Key_name']; @@ -115,13 +116,13 @@ if (defined('PMA_IDX_INCLUDED')) { mysql_data_seek($fields_rs, 0); } else { $local_query = 'SHOW FIELDS FROM ' . PMA_backquote($table); - $fields_rs = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); + $fields_rs = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); $fields_cnt = mysql_num_rows($fields_rs); } $fields_names = array(); $fields_types = array(); -while ($row = mysql_fetch_array($fields_rs)) { +while ($row = PMA_mysql_fetch_array($fields_rs)) { $fields_names[] = $row['Field']; // loic1: set or enum types: slashes single quotes inside options if (eregi('^(set|enum)\((.+)\)$', $row['Type'], $tmp)) { @@ -159,6 +160,7 @@ if (!defined('PMA_IDX_INCLUDED') $err_url = 'tbl_indexes.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db) . '&table=' . urlencode($table); @@ -218,7 +220,7 @@ if (!defined('PMA_IDX_INCLUDED') $sql_query .= $index_fields . ')'; } - $result = mysql_query($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url); + $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url); $message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenAltered; include('./tbl_properties.php3'); @@ -293,6 +295,7 @@ else if (!defined('PMA_IDX_INCLUDED') + @@ -410,6 +413,7 @@ else if (!defined('PMA_IDX_INCLUDED') + diff --git a/tbl_move_copy.php3 b/tbl_move_copy.php3 index 015e5fbd7..3cb8e410b 100644 --- a/tbl_move_copy.php3 +++ b/tbl_move_copy.php3 @@ -18,7 +18,7 @@ function PMA_myHandler($sql_insert = '') global $sql_insert_data; $sql_insert = eregi_replace('INSERT INTO (`?)' . $table . '(`?)', 'INSERT INTO ' . $target, $sql_insert); - $result = mysql_query($sql_insert) or PMA_mysqlDie('', $sql_insert, '', $GLOBALS['err_url']); + $result = PMA_mysql_query($sql_insert) or PMA_mysqlDie('', $sql_insert, '', $GLOBALS['err_url']); $sql_insert_data .= $sql_insert . ';' . "\n"; } // end of the 'PMA_myHandler()' function @@ -36,6 +36,7 @@ require('./libraries/common.lib.php3'); */ $err_url = 'tbl_properties.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db) . '&table=' . urlencode($table); @@ -80,8 +81,8 @@ if (isset($new_name) && trim($new_name) != '') { $sql_structure = PMA_getTableDef($db, $table, "\n", $err_url); $sql_structure = eregi_replace('^CREATE TABLE (`?)' . $table . '(`?)', 'CREATE TABLE ' . $target, $sql_structure); - $result = @mysql_query($sql_structure); - if (mysql_error()) { + $result = @PMA_mysql_query($sql_structure); + if (PMA_mysql_error()) { include('./header.inc.php3'); PMA_mysqlDie('', $sql_structure, '', $err_url); } else if (isset($sql_query)) { @@ -95,8 +96,8 @@ if (isset($new_name) && trim($new_name) != '') { // speedup copy table - staybyte - 22. Juni 2001 if (PMA_MYSQL_INT_VERSION >= 32300) { $sql_insert_data = 'INSERT INTO ' . $target . ' SELECT * FROM ' . $source; - $result = @mysql_query($sql_insert_data); - if (mysql_error()) { + $result = @PMA_mysql_query($sql_insert_data); + if (PMA_mysql_error()) { include('./header.inc.php3'); PMA_mysqlDie('', $sql_insert_data, '', $err_url); } @@ -111,8 +112,8 @@ if (isset($new_name) && trim($new_name) != '') { // Drops old table if the user has requested to move it if (isset($submit_move)) { $sql_drop_table = 'DROP TABLE ' . $source; - $result = @mysql_query($sql_drop_table); - if (mysql_error()) { + $result = @PMA_mysql_query($sql_drop_table); + if (PMA_mysql_error()) { include('./header.inc.php3'); PMA_mysqlDie('', $sql_drop_table, '', $err_url); } diff --git a/tbl_printview.php3 b/tbl_printview.php3 index ef4033acc..d76571d1a 100755 --- a/tbl_printview.php3 +++ b/tbl_printview.php3 @@ -17,12 +17,14 @@ if (!isset($selected_tbl)) { if (isset($table)) { $err_url = 'tbl_properties.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db) . '&table=' . urlencode($table); } else { $err_url = 'db_details.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db); } @@ -67,15 +69,15 @@ while (list($key, $table) = each($the_tables)) { // The 'show table' statement works correct since 3.23.03 if (PMA_MYSQL_INT_VERSION >= 32303) { $local_query = 'SHOW TABLE STATUS LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\''; - $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); - $showtable = mysql_fetch_array($result); + $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); + $showtable = PMA_mysql_fetch_array($result); $num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0); $show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : ''); } else { $local_query = 'SELECT COUNT(*) AS count FROM ' . PMA_backquote($table); - $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); + $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); $showtable = array(); - $num_rows = mysql_result($result, 0, 'count'); + $num_rows = PMA_mysql_result($result, 0, 'count'); $show_comment = ''; } // end display comments if ($result) { @@ -87,7 +89,7 @@ while (list($key, $table) = each($the_tables)) { * Gets table keys and retains them */ $local_query = 'SHOW KEYS FROM ' . PMA_backquote($table); - $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); + $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); $primary = ''; $indexes = array(); $lastIndex = ''; @@ -95,7 +97,7 @@ while (list($key, $table) = each($the_tables)) { $indexes_data = array(); $pk_array = array(); // will be use to emphasis prim. keys in the table // view - while ($row = mysql_fetch_array($result)) { + while ($row = PMA_mysql_fetch_array($result)) { // Backups the list of primary keys if ($row['Key_name'] == 'PRIMARY') { $primary .= $row['Column_name'] . ', '; @@ -129,14 +131,14 @@ while (list($key, $table) = each($the_tables)) { * Gets fields properties */ $local_query = 'SHOW FIELDS FROM ' . PMA_backquote($table); - $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); + $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url); $fields_cnt = mysql_num_rows($result); // check if we can use Relations (Mike Beck) $have_rel = FALSE; if ($cfg['Server']['relation']) { - $tables = @mysql_query('SELECT COUNT(*) AS count FROM ' . PMA_backquote($cfg['Server']['relation'])); - $have_rel = ($tables) ? mysql_result($tables, 0, 'count') : FALSE; + $tables = @PMA_mysql_query('SELECT COUNT(*) AS count FROM ' . PMA_backquote($cfg['Server']['relation'])); + $have_rel = ($tables) ? PMA_mysql_result($tables, 0, 'count') : FALSE; } // end if if ($have_rel) { // Find which tables are related with the current one and write it in @@ -145,9 +147,9 @@ while (list($key, $table) = each($the_tables)) { . ' FROM ' . PMA_backquote($cfg['Server']['relation']) . ' WHERE master_table = \'' . urldecode($table) .'\''; - $relations = @mysql_query($rel_query) or PMA_mysqlDie('', $rel_query, '', $err_url); + $relations = @PMA_mysql_query($rel_query) or PMA_mysqlDie('', $rel_query, '', $err_url); $res_rel = array(); - while ($relrow = @mysql_fetch_array($relations)) { + while ($relrow = @PMA_mysql_fetch_array($relations)) { $col = $relrow['master_field']; $res_rel[$col] = $relrow['rel']; } @@ -190,7 +192,7 @@ while (list($key, $table) = each($the_tables)) { "> + = 32300) { if ($action == 'tbl_create.php3') { // find mysql capability - staybyte - 11. June 2001 $query = 'SHOW VARIABLES LIKE \'have_%\''; - $result = mysql_query($query); + $result = PMA_mysql_query($query); if ($result != FALSE && mysql_num_rows($result) > 0) { - while ($tmp = mysql_fetch_array($result)) { + while ($tmp = PMA_mysql_fetch_array($result)) { if (isset($tmp['Variable_name'])) { switch ($tmp['Variable_name']) { case 'have_bdb': diff --git a/tbl_properties.php3 b/tbl_properties.php3 index 65606030d..c773eca89 100755 --- a/tbl_properties.php3 +++ b/tbl_properties.php3 @@ -52,6 +52,7 @@ require('./tbl_properties_table_info.php3'); onsubmit="return checkSqlQuery(this)"> + diff --git a/tbl_properties_common.php3 b/tbl_properties_common.php3 index 4187122c9..695db12ef 100755 --- a/tbl_properties_common.php3 +++ b/tbl_properties_common.php3 @@ -15,10 +15,12 @@ require('./libraries/bookmark.lib.php3'); */ $err_url_0 = 'db_details.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db); $err_url = 'tbl_properties.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db) . '&table=' . urlencode($table); @@ -31,21 +33,21 @@ $err_url = 'tbl_properties.php3' if (!isset($is_db) || !$is_db) { // Not a valid db name -> back to the welcome page if (!empty($db)) { - $is_db = @mysql_select_db($db); + $is_db = @PMA_mysql_select_db($db); } if (empty($db) || !$is_db) { - header('Location: ' . $cfg['PmaAbsoluteUri'] . 'main.php3?lang=' . $lang . '&server=' . $server . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1'); + header('Location: ' . $cfg['PmaAbsoluteUri'] . 'main.php3?lang=' . $lang . '&convcharset=' . $convcharset . '&server=' . $server . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1'); exit(); } } // end if (ensures db exists) if (!isset($is_table) || !$is_table) { // Not a valid table name -> back to the db_details.php3 if (!empty($table)) { - $is_table = @mysql_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\''); + $is_table = @PMA_mysql_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\''); } if (empty($table) || !($is_table && @mysql_numrows($is_table))) { - header('Location: ' . $cfg['PmaAbsoluteUri'] . 'db_details.php3?lang=' . $lang . '&server=' . $server . '&db=' . urlencode($db) . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1'); + header('Location: ' . $cfg['PmaAbsoluteUri'] . 'db_details.php3?lang=' . $lang . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db) . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1'); exit(); } else if (isset($is_table)) { mysql_free_result($is_table); @@ -64,6 +66,7 @@ if (!isset($message)) { * Set parameters for links */ $url_query = 'lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db) . '&table=' . urlencode($table) diff --git a/tbl_properties_export.php3 b/tbl_properties_export.php3 index 13c15997b..c98994a94 100755 --- a/tbl_properties_export.php3 +++ b/tbl_properties_export.php3 @@ -17,6 +17,7 @@ require('./tbl_properties_table_info.php3'); +
    ' . "\n"; echo '   ' . "\n"; echo '  ' . htmlentities($db_name) . '  ' . $db_name . '  ' . $dbs_array[$db_name][0] . '  ' . $data_size . ' ' . $data_unit . '  ' . $idx_size . ' ' . $idx_unit . ' 
    + diff --git a/left.php3 b/left.php3 index 989d1d3b6..13f3f2da7 100755 --- a/left.php3 +++ b/left.php3 @@ -167,8 +167,7 @@ echo "\n";
    - - +
    @@ -188,6 +187,7 @@ if ($num_dbs > 1) { if ($cfg['LeftFrameLight']) { echo ' ' . "\n"; echo ' ' . "\n"; + echo ' ' . "\n"; echo ' ' . "\n"; echo ' +
    + @@ -255,6 +257,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ + @@ -279,6 +282,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ + @@ -327,6 +331,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ + @@ -344,6 +349,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ + @@ -370,6 +376,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ + @@ -404,6 +411,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ * @return boolean always true * * @global string the current language + * @global string the current charset for MySQL * @global integer the server to use (refers to the number in the * configuration file) * @global string the database name @@ -425,7 +433,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ */ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0) { - global $lang, $server, $db, $table; + global $lang, $convcharset, $server, $db, $table; global $goto; global $sql_query, $num_rows, $pos, $session_max_rows; global $vertical_display, $disp_direction, $repeat_cells; @@ -455,6 +463,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ } $text_url = 'sql.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db) . '&table=' . urlencode($table) @@ -601,6 +610,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ $sorted_sql_query = $unsorted_sql_query . $sort_order; } $url_query = 'lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db) . '&table=' . urlencode($table) @@ -704,6 +714,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ * @return boolean always true * * @global string the current language + * @global string the current charset for MySQL * @global integer the server to use (refers to the number in the * configuration file) * @global string the database name @@ -726,7 +737,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ */ function PMA_displayTableBody(&$dt_result, &$is_display, $map) { - global $lang, $server, $db, $table; + global $lang, $convcharset, $server, $db, $table; global $goto; global $sql_query, $pos, $session_max_rows, $fields_meta, $fields_cnt; global $vertical_display, $disp_direction, $repeat_cells; @@ -757,10 +768,10 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ // table being displayed has one or more keys; but to display // delete/edit options correctly for tables without keys. - // loic1: use 'mysql_fetch_array' rather than 'mysql_fetch_row' to get + // loic1: use 'PMA_mysql_fetch_array' rather than 'PMA_mysql_fetch_row' to get // the NULL values - while ($row = mysql_fetch_array($dt_result)) { + while ($row = PMA_mysql_fetch_array($dt_result)) { // lem9: "vertical display" mode stuff if (($row_no != 0) && ($repeat_cells != 0) && !($row_no % $repeat_cells) && $disp_direction == 'horizontal') { @@ -824,7 +835,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ // php4 function is available or not $pointer = (function_exists('is_null') ? $i : $meta->name); - if (!isset($row[$meta->name]) + if (!isset($row[$pointer]) || (function_exists('is_null') && is_null($row[$pointer]))) { $condition .= 'IS NULL AND'; } else { @@ -853,6 +864,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ // 1.2 Defines the urls for the modify/delete link(s) $url_query = 'lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=' . urlencode($db) . '&table=' . urlencode($table) @@ -898,6 +910,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ . '&goto=main.php3'; $del_url = 'sql.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=mysql' . '&sql_query=' . urlencode('KILL ' . $row['Id']) @@ -941,7 +954,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ $pointer = (function_exists('is_null') ? $i : $meta->name); if ($meta->numeric == 1) { - if (!isset($row[$meta->name]) + if (!isset($row[$pointer]) || (function_exists('is_null') && is_null($row[$pointer]))) { $vertical_display['data'][$row_no][$i] = ' NULL [BLOB]NULLNULL
    + Language (*):
    item + + + + : + + + +
    diff --git a/tbl_properties_operations.php3 b/tbl_properties_operations.php3 index 1b83163b5..d57e2ae5d 100755 --- a/tbl_properties_operations.php3 +++ b/tbl_properties_operations.php3 @@ -16,7 +16,7 @@ $url_query .= '&back=tbl_properties_operations.php3'; if (isset($submitorderby) && !empty($order_field)) { $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' ORDER BY ' . PMA_backquote(urldecode($order_field)); - $result = mysql_query($sql_query) or PMA_mysqlDie('', $sql_query, '', $err_url); + $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', $sql_query, '', $err_url); PMA_showMessage((get_magic_quotes_gpc()) ? addslashes($strSuccess) : $strSuccess); } // end if @@ -31,8 +31,8 @@ require('./tbl_properties_table_info.php3'); * Get columns names */ $local_query = 'SHOW COLUMNS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table); -$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url); -for ($i = 0; $row = mysql_fetch_array($result); $i++) { +$result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url); +for ($i = 0; $row = PMA_mysql_fetch_array($result); $i++) { $columns[$i] = $row['Field']; } mysql_free_result($result); @@ -52,6 +52,7 @@ if (PMA_MYSQL_INT_VERSION >= 32334) { +  : @@ -81,6 +82,7 @@ echo "\n"; onsubmit="return emptyFormElements(this, 'new_name')"> + @@ -101,6 +103,7 @@ echo "\n"; onsubmit="return emptyFormElements(this, 'new_name')"> + @@ -143,6 +146,7 @@ for ($i = 0; $i < $num_dbs; $i++) { onsubmit="return emptyFormElements(this, 'new_name')"> + @@ -285,12 +289,12 @@ if (!empty($cfg['Server']['relation'])) { . ' FROM ' . $cfg['Server']['relation'] . ' WHERE master_table = \'' . $table . '\';'; - // we need this mysql_select_db if the user has access to more than one db + // we need this PMA_mysql_select_db if the user has access to more than one db // and $db is not the last of the list, because PMA_availableDatabases() - // has made a mysql_select_db() on the last one - mysql_select_db($db); + // has made a PMA_mysql_select_db() on the last one + PMA_mysql_select_db($db); - $result = @mysql_query($local_query); + $result = @PMA_mysql_query($local_query); if ($result != FALSE && mysql_num_rows($result) > 0) { ?> @@ -300,7 +304,7 @@ if (!empty($cfg['Server']['relation'])) {
    = 32322) { 0) { - while ($tmp = mysql_fetch_array($result)) { + while ($tmp = PMA_mysql_fetch_array($result)) { if (isset($tmp['Variable_name'])) { switch ($tmp['Variable_name']) { case 'have_bdb': diff --git a/tbl_properties_structure.php3 b/tbl_properties_structure.php3 index 889ac3706..a9c9b2186 100755 --- a/tbl_properties_structure.php3 +++ b/tbl_properties_structure.php3 @@ -28,11 +28,11 @@ require('./tbl_properties_table_info.php3'); // 2. Gets table keys and retains them $local_query = 'SHOW KEYS FROM ' . PMA_backquote($table); -$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); +$result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); $primary = ''; $ret_keys = array(); $pk_array = array(); // will be use to emphasis prim. keys in the table view -while ($row = mysql_fetch_array($result)) { +while ($row = PMA_mysql_fetch_array($result)) { $ret_keys[] = $row; // Backups the list of primary keys if ($row['Key_name'] == 'PRIMARY') { @@ -44,7 +44,7 @@ mysql_free_result($result); // 3. Get fields $local_query = 'SHOW FIELDS FROM ' . PMA_backquote($table); -$fields_rs = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); +$fields_rs = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); $fields_cnt = mysql_num_rows($fields_rs); @@ -78,7 +78,7 @@ $fields_cnt = mysql_num_rows($fields_rs); $i = 0; $aryFields = array(); -while ($row = mysql_fetch_array($fields_rs)) { +while ($row = PMA_mysql_fetch_array($fields_rs)) { $i++; $bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; $aryFields[] = $row['Field']; diff --git a/tbl_properties_table_info.php3 b/tbl_properties_table_info.php3 index 70dc2fbfe..d53213e9c 100755 --- a/tbl_properties_table_info.php3 +++ b/tbl_properties_table_info.php3 @@ -8,8 +8,8 @@ // The 'show table' statement works correct since 3.23.03 if (PMA_MYSQL_INT_VERSION >= 32303) { $local_query = 'SHOW TABLE STATUS LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\''; - $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); - $showtable = mysql_fetch_array($result); + $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); + $showtable = PMA_mysql_fetch_array($result); $tbl_type = strtoupper($showtable['Type']); $num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0); $show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : ''); @@ -27,9 +27,9 @@ if (PMA_MYSQL_INT_VERSION >= 32303) { unset($tmp); } else { $local_query = 'SELECT COUNT(*) AS count FROM ' . PMA_backquote($table); - $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); + $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0); $showtable = array(); - $num_rows = mysql_result($result, 0, 'count'); + $num_rows = PMA_mysql_result($result, 0, 'count'); $show_comment = ''; } mysql_free_result($result); diff --git a/tbl_qbe.php3 b/tbl_qbe.php3 index acb9ccec9..e7a881e44 100755 --- a/tbl_qbe.php3 +++ b/tbl_qbe.php3 @@ -104,7 +104,7 @@ if ($row < 0) { /** * Prepares the form */ -$tbl_result = mysql_list_tables($db); +$tbl_result = PMA_mysql_list_tables($db); $tbl_result_cnt = mysql_num_rows($tbl_result); $i = 0; $k = 0; @@ -118,8 +118,8 @@ if (!empty($TableList)) { // The tables list gets from MySQL while ($i < $tbl_result_cnt) { - $tbl = mysql_tablename($tbl_result, $i); - $fld_results = mysql_list_fields($db, $tbl); + $tbl = PMA_mysql_tablename($tbl_result, $i); + $fld_results = PMA_mysql_list_fields($db, $tbl); $fld_results_cnt = mysql_num_fields($fld_results); $j = 0; @@ -133,7 +133,7 @@ while ($i < $tbl_result_cnt) { if ($tbl_names[$tbl] == ' selected="selected"') { $fld[$k++] = PMA_backquote($tbl) . '.*'; while ($j < $fld_results_cnt) { - $fld[$k] = mysql_field_name($fld_results, $j); + $fld[$k] = PMA_mysql_field_name($fld_results, $j); $fld[$k] = PMA_backquote($tbl) . '.' . PMA_backquote($fld[$k]); // increase the width if necessary @@ -620,7 +620,7 @@ for ($x = 0; $x < $col; $x++) { ' . htmlspecialchars($key) . '' . "\n"; + echo '' . "\n"; } ?> @@ -664,6 +664,7 @@ $w--; + @@ -728,8 +729,8 @@ if (isset($Field) && count($Field) > 0) { } } // end while if ($cfg['Server']['relation']) { - $tables = @mysql_query('SELECT COUNT(*) AS count FROM ' . PMA_backquote($cfg['Server']['relation'])); - $rel_work = ($tables) ? mysql_result($tables, 0, 'count') : FALSE; + $tables = @PMA_mysql_query('SELECT COUNT(*) AS count FROM ' . PMA_backquote($cfg['Server']['relation'])); + $rel_work = ($tables) ? PMA_mysql_result($tables, 0, 'count') : FALSE; } // end if if ($rel_work && count($alltabs) > 0) { @@ -773,10 +774,10 @@ if (isset($Field) && count($Field) > 0) { . ' WHERE master_table IN ' . $incrit . ' AND foreign_table IN ' . $incrit . ' GROUP BY master_table ORDER BY hits DESC'; - $rel_id = @mysql_query($rel_query) or PMA_mysqlDie('', $rel_query, '', $err_url); + $rel_id = @PMA_mysql_query($rel_query) or PMA_mysqlDie('', $rel_query, '', $err_url); // if we don't find anything we try the other way round - while ($row = mysql_fetch_array($rel_id)) { + while ($row = PMA_mysql_fetch_array($rel_id)) { // we want the first one (highest number of hits) or the first one // that is in the WHERE clause if (!isset($master)) { @@ -809,9 +810,9 @@ if (isset($Field) && count($Field) > 0) { . ' WHERE master_table IN ' . $incrit . ' AND foreign_table IN ' . $incrit_s . ' ORDER BY foreign_table, master_table'; - $rel_id = @mysql_query($rel_query) or PMA_mysqlDie('', $rel_query, '', $err_url); + $rel_id = @PMA_mysql_query($rel_query) or PMA_mysqlDie('', $rel_query, '', $err_url); - while ($row = mysql_fetch_array($rel_id)) { + while ($row = PMA_mysql_fetch_array($rel_id)) { $foreign_table = $row['foreign_table']; if ($rel[$foreign_table]['mcon'] == 0) { // if we already found a link to the mastertable we don't @@ -843,12 +844,12 @@ if (isset($Field) && count($Field) > 0) { $incrit_d = '(\'' . implode('\', \'', $found) . '\')'; $incrit_s = '(\'' . implode('\', \'', $rest) . '\')'; - $rel_query = 'SELECT * FROM ' . $cfg['Server']['relation'] + $rel_query = 'SELECT * FROM ' . PMA_backquote($cfg['Server']['relation']) . ' WHERE master_table IN ' . $incrit_s . ' AND foreign_table IN ' . $incrit_d . ' ORDER BY master_table, foreign_table'; - $rel_id = @mysql_query($rel_query) or PMA_mysqlDie('', $rel_query, '', $err_url); + $rel_id = @PMA_mysql_query($rel_query) or PMA_mysqlDie('', $rel_query, '', $err_url); - while ($row = mysql_fetch_array($rel_id)) { + while ($row = PMA_mysql_fetch_array($rel_id)) { $found_table = $row['master_table']; if ($rel[$found_table]['mcon'] == 0) { // if we allready found a link to the mastertable we @@ -884,9 +885,9 @@ if (isset($Field) && count($Field) > 0) { } else if ($varr['mcon'] == 0) { // those that have no link with the mastertable we will // show at the end - $lj .= $varr['link']; + $lj .= PMA_backquote($varr['link']); } else { - $ljm .= $varr['link']; + $ljm .= PMA_backquote($varr['link']); } } // end while @@ -909,7 +910,7 @@ if (isset($Field) && count($Field) > 0) { while (list($k, $v) = each ($_temp)) { $alltabs[] = $k; } - $qry_from = implode(', ', $alltabs); + $qry_from = implode(', ', PMA_backquote($alltabs)); } } // end count($Field) > 0 diff --git a/tbl_relation.php3 b/tbl_relation.php3 index 7310c2b15..018ea1371 100644 --- a/tbl_relation.php3 +++ b/tbl_relation.php3 @@ -19,9 +19,9 @@ if (!empty($cfg['Server']['relation']) // first check if there is a entry allready $upd_query = 'SELECT master_field, foreign_table, foreign_field FROM ' . PMA_backquote($cfg['Server']['relation']) . ' WHERE master_table = \'' . PMA_sqlAddslashes($table) . '\''; - $upd_rs = mysql_query($upd_query) or PMA_mysqlDie('', $upd_query, '', $err_url_0); + $upd_rs = PMA_mysql_query($upd_query) or PMA_mysqlDie('', $upd_query, '', $err_url_0); - while ($foundrel = @mysql_fetch_array($upd_rs)) { + while ($foundrel = @PMA_mysql_fetch_array($upd_rs)) { $currfield = $foundrel['master_field']; $existrel[$currfield] = $foundrel['foreign_table'] . '.' . $foundrel['foreign_field']; } @@ -36,19 +36,19 @@ if (!empty($cfg['Server']['relation']) . '\'' . PMA_sqlAddslashes($key) . '\', ' . '\'' . PMA_sqlAddslashes($for[0]) . '\', ' . '\'' . PMA_sqlAddslashes($for[1]) . '\')'; - $upd_rs = mysql_query($upd_query) or PMA_mysqlDie('', $upd_query, '', $err_url_0); + $upd_rs = PMA_mysql_query($upd_query) or PMA_mysqlDie('', $upd_query, '', $err_url_0); } else if ($existrel[$key] != $value) { $for = explode('.', $destination[$key]); $upd_query = 'UPDATE ' . PMA_backquote($cfg['Server']['relation']) . ' SET' . ' foreign_table = \'' . PMA_sqlAddslashes($for[0]) . '\', foreign_field = \'' . PMA_sqlAddslashes($for[1]) . '\' ' . ' WHERE master_table = \'' . PMA_sqlAddslashes($table) . '\' AND master_field = \'' . PMA_sqlAddslashes($key) . '\''; - $upd_rs = mysql_query($upd_query) or PMA_mysqlDie('', $upd_query, '', $err_url_0); + $upd_rs = PMA_mysql_query($upd_query) or PMA_mysqlDie('', $upd_query, '', $err_url_0); } // end if... else.... } else if (isset($existrel[$key])) { $for = explode('.', $destination[$key]); $upd_query = 'DELETE FROM ' . PMA_backquote($cfg['Server']['relation']) . ' WHERE master_table = \'' . PMA_sqlAddslashes($table) . '\' AND master_field = \'' . PMA_sqlAddslashes($key) . '\''; - $upd_rs = mysql_query($upd_query) or PMA_mysqlDie('', $upd_query, '', $err_url_0); + $upd_rs = PMA_mysql_query($upd_query) or PMA_mysqlDie('', $upd_query, '', $err_url_0); } // end if... else.... } // end while } // end if @@ -57,16 +57,16 @@ if (!empty($cfg['Server']['table_info']) && isset($submit_show) && $submit_show == 'true') { $test_query = 'SELECT display_field FROM ' . PMA_backquote($cfg['Server']['table_info']) . ' WHERE table_name = \'' . PMA_sqlAddslashes($table) . '\''; - $test_rs = mysql_query($test_query) or PMA_mysqlDie('', $test_query, '', $err_url_0); + $test_rs = PMA_mysql_query($test_query) or PMA_mysqlDie('', $test_query, '', $err_url_0); if ($test_rs && mysql_num_rows($test_rs) > 0) { $upd_query = 'UPDATE ' . PMA_backquote($cfg['Server']['table_info']) . ' SET' . ' display_field = \'' . PMA_sqlAddslashes($display_field) . '\'' . ' WHERE table_name = \'' . PMA_sqlAddslashes($table) . '\''; - $upd_rs = mysql_query($upd_query) or PMA_mysqlDie('', $upd_query, '', $err_url_0); + $upd_rs = PMA_mysql_query($upd_query) or PMA_mysqlDie('', $upd_query, '', $err_url_0); } else { $ins_query = 'INSERT INTO ' . PMA_backquote($cfg['Server']['table_info']) . ' (table_name, display_field)' . ' VALUES(\'' . PMA_sqlAddslashes($table) . '\', \'' . PMA_sqlAddslashes($display_field) .'\')'; - $ins_rs = mysql_query($ins_query) or PMA_mysqlDie('', $ins_query, '', $err_url_0); + $ins_rs = PMA_mysql_query($ins_query) or PMA_mysqlDie('', $ins_query, '', $err_url_0); } } // end if @@ -78,14 +78,14 @@ if ($cfg['Server']['relation']) { $rel_work = FALSE; // Mike Beck: get all Table-Fields to choose relation $tab_query = 'SHOW TABLES FROM ' . PMA_backquote($db); - $tab_rs = mysql_query($tab_query) or PMA_mysqlDie('', $tab_query, '', $err_url_0); + $tab_rs = PMA_mysql_query($tab_query) or PMA_mysqlDie('', $tab_query, '', $err_url_0); $selectboxall['nix'] = '--'; - while ($curr_table = @mysql_fetch_array($tab_rs)) { + while ($curr_table = @PMA_mysql_fetch_array($tab_rs)) { if (($curr_table[0] != $table) && ($curr_table[0] != $cfg['Server']['relation'])) { $fi_query = 'SHOW KEYS FROM ' . PMA_backquote($curr_table[0]); - $fi_rs = mysql_query($fi_query) or PMA_mysqlDie('', $fi_query, '', $err_url_0); + $fi_rs = PMA_mysql_query($fi_query) or PMA_mysqlDie('', $fi_query, '', $err_url_0); if ($fi_rs && mysql_num_rows($fi_rs) > 0) { - while ($curr_field = mysql_fetch_array($fi_rs)) { + while ($curr_field = PMA_mysql_fetch_array($fi_rs)) { if (isset($curr_field['Key_name']) && $curr_field['Key_name'] == 'PRIMARY') { $field_full = $curr_field['Table'] . '.' . $curr_field['Column_name']; $field_v = $curr_field['Table'] . '->' . $curr_field['Column_name']; @@ -112,9 +112,9 @@ if ($cfg['Server']['relation']) { $rel_query = 'SELECT master_field, concat(foreign_table, \'.\', foreign_field) AS rel' . ' FROM ' . PMA_backquote($cfg['Server']['relation']) . ' WHERE master_table = \'' . PMA_sqlAddslashes($table) . '\''; - $relations = @mysql_query($rel_query) or PMA_mysqlDie('', $rel_query, '', $err_url); + $relations = @PMA_mysql_query($rel_query) or PMA_mysqlDie('', $rel_query, '', $err_url); - while ($relrow = @mysql_fetch_array($relations)) { + while ($relrow = @PMA_mysql_fetch_array($relations)) { $rel_col = $relrow['master_field']; $rel_dest[$rel_col] = $relrow['rel']; } // end while @@ -123,7 +123,7 @@ if ($cfg['Server']['relation']) { // now find out the columns of our $table $col_query = 'SHOW COLUMNS FROM ' . PMA_backquote($table); -$col_rs = mysql_query($col_query) or PMA_mysqlDie('', $col_query, '', $err_url_0); +$col_rs = PMA_mysql_query($col_query) or PMA_mysqlDie('', $col_query, '', $err_url_0); if ($col_rs && mysql_num_rows($col_rs) > 0) { ?> @@ -141,7 +141,7 @@ if ($col_rs && mysql_num_rows($col_rs) > 0) {
    @@ -183,8 +183,8 @@ if ($col_rs && mysql_num_rows($col_rs) > 0) { // Get "display_filed" infos $disp_query = 'SELECT display_field FROM ' . PMA_backquote($cfg['Server']['table_info']) . ' WHERE table_name = \'' . PMA_sqlAddslashes($table) . '\''; - $disp_rs = mysql_query($disp_query) or PMA_mysqlDie('', $disp_query, '', $err_url_0); - $row = ($disp_rs ? mysql_fetch_array($disp_rs) : ''); + $disp_rs = PMA_mysql_query($disp_query) or PMA_mysqlDie('', $disp_query, '', $err_url_0); + $row = ($disp_rs ? PMA_mysql_fetch_array($disp_rs) : ''); if (isset($row['display_field'])) { $disp = $row['display_field']; } @@ -203,7 +203,7 @@ if ($col_rs && mysql_num_rows($col_rs) > 0) { + diff --git a/user_details.php3 b/user_details.php3 index 008a75758..8bac0643a 100644 --- a/user_details.php3 +++ b/user_details.php3 @@ -14,6 +14,7 @@ require('./libraries/common.lib.php3'); */ $err_url = 'user_details.php3' . '?lang=' . $lang + . '&convcharset=' . $convcharset . '&server=' . $server . '&db=mysql' . '&table=user'; @@ -29,8 +30,10 @@ $err_url = 'user_details.php3' * @return boolean always true * * @global string the current language + * @global string the current charset for MySQL * @global integer the server to use (refers to the number in the * configuration file) + * @global string the current charset for MySQL * * @see PMA_checkDb() * @@ -39,7 +42,7 @@ $err_url = 'user_details.php3' * user while these privileges applies to all users. */ function PMA_tableGrants(&$host_db_result, $dbcheck = FALSE) { - global $lang, $server; + global $lang, $convcharset, $server, $convertcharset; ?> @@ -69,16 +72,16 @@ function PMA_tableGrants(&$host_db_result, $dbcheck = FALSE) { echo "\n"; // 2. Table body - $url_query = 'lang=' . $lang . '&server=' . $server . '&db=mysql&table=user'; + $url_query = 'lang=' . $lang . '&server=' . $server . '&db=mysql&table=user&convcharset=' . $convcharset; - while ($row = (is_array($host_db_result) ? $host_db_result : mysql_fetch_array($host_db_result))) { + while ($row = (is_array($host_db_result) ? $host_db_result : PMA_mysql_fetch_array($host_db_result))) { $local_query = 'SHOW GRANTS FOR \'' . $row['User'] . '\'@\'' . $row['Host'] . '\''; - $result = mysql_query($local_query); + $result = PMA_mysql_query($local_query); $grants_cnt = ($result) ? @mysql_num_rows($result) : 0; if ($grants_cnt) { $i = 0; - while ($usr_row = mysql_fetch_row($result)) { + while ($usr_row = PMA_mysql_fetch_row($result)) { if (eregi('GRANT (.*) ON ([^.]+).([^.]+) TO .*$', $usr_row[0], $parts)) { // loic1: bug #487673 - revoke 'reference' if ($parts[1] == 'USAGE') { @@ -220,7 +223,7 @@ function PMA_tableGrants(&$host_db_result, $dbcheck = FALSE) { function PMA_checkDb($dbcheck) { $local_query = 'SELECT Host, User FROM mysql.user ORDER BY Host, User'; - $result = mysql_query($local_query); + $result = PMA_mysql_query($local_query); $host_usr_cnt = ($result) ? @mysql_num_rows($result) : 0; if (!$host_usr_cnt) { @@ -321,19 +324,20 @@ function PMA_tablePrivileges($form, $row = FALSE) * @global string the current language * @global integer the server to use (refers to the number in the * configuration file) + * @global string the current charset for MySQL * * @see PMA_tablePrivileges() */ function PMA_normalOperations() { - global $lang, $server; + global $lang, $server, $convcharset; ?>
    • - +  
      @@ -349,9 +353,9 @@ function PMA_normalOperations() + @@ -430,6 +435,7 @@ function PMA_normalOperations() PMA_tablePrivileges('addUserForm'); ?> + @@ -452,6 +458,7 @@ function PMA_normalOperations() * @global string the current language * @global integer the server to use (refers to the number in the * configuration file) + * @global string the current charset for MySQL * @global string the host name to check grants for * @global string the username to check grants for * @global string the database to check grants for @@ -461,7 +468,7 @@ function PMA_normalOperations() */ function PMA_grantOperations($grants) { - global $lang, $server, $host, $pma_user; + global $lang, $server, $convcharset, $host, $pma_user; global $dbgrant, $tablegrant, $newdb; ?> @@ -469,7 +476,7 @@ function PMA_grantOperations($grants)
    • @@ -477,6 +484,7 @@ function PMA_grantOperations($grants)
    • + " /> @@ -504,9 +512,9 @@ function PMA_grantOperations($grants) // echo '' . "\n"; // } $is_selected_db = FALSE; - $result = mysql_query('SHOW DATABASES'); + $result = PMA_mysql_query('SHOW DATABASES'); if ($result && @mysql_num_rows($result)) { - while ($row = mysql_fetch_row($result)) { + while ($row = PMA_mysql_fetch_row($result)) { $selected = (($row[0] == $dbgrant) ? ' selected="selected"' : ''); if (!empty($selected)) { $is_selected_db = TRUE; @@ -543,9 +551,9 @@ function PMA_grantOperations($grants) // echo '' . "\n"; // } if (isset($dbgrant)) { - $result = mysql_query('SHOW TABLES FROM ' . PMA_backquote($dbgrant)); + $result = PMA_mysql_query('SHOW TABLES FROM ' . PMA_backquote($dbgrant)); if ($result && @mysql_num_rows($result)) { - while ($row = mysql_fetch_row($result)) { + while ($row = PMA_mysql_fetch_row($result)) { $selected = ((isset($tablegrant) && $row[0] == $tablegrant) ? ' selected="selected"' : ''); echo ' '; echo '' . $row[0] . '' . "\n"; @@ -579,11 +587,11 @@ function PMA_grantOperations($grants) echo ' ' . '' . "\n"; } else { - $result = mysql_query('SHOW COLUMNS FROM ' . PMA_backquote($dbgrant) . '.' . PMA_backquote($tablegrant)); + $result = PMA_mysql_query('SHOW COLUMNS FROM ' . PMA_backquote($dbgrant) . '.' . PMA_backquote($tablegrant)); if ($result && @mysql_num_rows($result)) { echo ' ' . '
    + " /> " /> @@ -749,6 +759,7 @@ function PMA_editOperations($host, $user) echo "\n"; ?> + " /> " /> @@ -775,10 +786,11 @@ function PMA_editOperations($host, $user) * @global string the current language * @global integer the server to use (refers to the number in the * configuration file) + * @global string the current charset for MySQL */ function PMA_tableUsers($host = FALSE, $user = FALSE) { - global $lang, $server; + global $lang, $server, $convcharset; $local_query = 'SELECT * FROM mysql.user '; if ($host || $user) { @@ -789,7 +801,7 @@ function PMA_tableUsers($host = FALSE, $user = FALSE) $local_query .= ' AND User = \'' . PMA_sqlAddslashes($user) . '\''; } $local_query .= ' ORDER BY Host, User'; - $result = mysql_query($local_query); + $result = PMA_mysql_query($local_query); $rows = ($result) ? @mysql_num_rows($result) : 0; if (!$rows) { @@ -807,7 +819,7 @@ function PMA_tableUsers($host = FALSE, $user = FALSE) echo '' . "\n"; $i = 0; - while ($row = mysql_fetch_array($result)) { + while ($row = PMA_mysql_fetch_array($result)) { $bgcolor = ($i % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']; @@ -858,10 +870,11 @@ function PMA_tableUsers($host = FALSE, $user = FALSE) $strPriv = '' . $GLOBALS['strNoPrivileges'] . ''; } - $query = 'lang=' . $lang . '&server=' . $server . '&db=mysql&table=user'; + $query = 'lang=' . $lang . '&server=' . $server . '&db=mysql&table=user&convcharset=' . $convcharset; if (!$user) { $edit_url = 'user_details.php3' . '?lang=' . $lang . '&server=' . $server + . '&convcharset=' . $convcharset . '&edit=1&host=' . urlencode($row['Host']) . '&pma_user=' . urlencode($row['User']); } $delete_url = 'user_details.php3' @@ -869,6 +882,7 @@ function PMA_tableUsers($host = FALSE, $user = FALSE) . '&delete=1&confirm=1&delete_host=' . urlencode($row['Host']) . '&delete_user=' . urlencode($row['User']); $check_url = 'user_details.php3' . '?lang=' . $lang . '&server=' . $server + . '&convcharset=' . $convcharset . '&grants=1&host=' . urlencode($row['Host']) . '&pma_user=' . urlencode($row['User']); ?> @@ -937,9 +951,10 @@ function PMA_tableUsers($host = FALSE, $user = FALSE) * @global string the current language * @global integer the server to use (refers to the number in the * configuration file) + * @global string the current charset for MySQL */ function PMA_confirm($the_host, $the_user) { - global $lang, $server; + global $lang, $server, $convcharset; if (get_magic_quotes_gpc() == 1) { $the_host = stripslashes($the_host); @@ -951,6 +966,7 @@ function PMA_confirm($the_host, $the_user) { ?> + @@ -972,16 +988,16 @@ function PMA_confirm($the_host, $the_user) { * Ensures the user is super-user and gets the case sensitive password field * name */ -$result = @mysql_query('USE mysql'); -if (mysql_error()) { +$result = @PMA_mysql_query('USE mysql'); +if (PMA_mysql_error()) { include('./header.inc.php3'); echo '

    ' . $strError . '

    ' . "\n"; echo '

        ' . $strNoRights . '

    ' . "\n"; include('./footer.inc.php3'); exit(); } -$result = @mysql_query('SELECT COUNT(Password) FROM mysql.user'); -$password_field = (($result && mysql_result($result, 0)) ? 'Password' : 'password'); +$result = @PMA_mysql_query('SELECT COUNT(Password) FROM mysql.user'); +$password_field = (($result && PMA_mysql_result($result, 0)) ? 'Password' : 'password'); /** @@ -1048,7 +1064,7 @@ if (isset($confirm) && $confirm) { // Reloads mysql else if (($server > 0) && isset($mode) && ($mode == 'reload')) { - $result = mysql_query('FLUSH PRIVILEGES'); + $result = PMA_mysql_query('FLUSH PRIVILEGES'); if ($result != 0) { echo '

    ' . $strMySQLReloaded . '

    ' . "\n"; } else { @@ -1068,17 +1084,17 @@ else if (isset($delete) && $delete // Delete Grants First! $sql_query = 'DELETE FROM mysql.db' . $common_where; $sql_query_cpy = $sql_query; - mysql_query($sql_query); + PMA_mysql_query($sql_query); $sql_query = 'DELETE FROM mysql.tables_priv' . $common_where; $sql_query_cpy .= ";\n" . $sql_query; - mysql_query($sql_query); + PMA_mysql_query($sql_query); $sql_query = 'DELETE FROM mysql.columns_priv' . $common_where; $sql_query_cpy .= ";\n" . $sql_query; - mysql_query($sql_query); + PMA_mysql_query($sql_query); $sql_query = 'DELETE FROM mysql.user' . $common_where; $sql_query_cpy .= ";\n" . $sql_query; - $result = mysql_query($sql_query); + $result = PMA_mysql_query($sql_query); $sql_query = $sql_query_cpy; unset($sql_query_cpy); @@ -1137,7 +1153,7 @@ else if (isset($submit_addUser)) { $sql_query = 'INSERT INTO mysql.user ' . 'SET Host = \'' . PMA_sqlAddslashes($host) . '\', User = \'' . PMA_sqlAddslashes($pma_user) . '\', ' . $password_field . ' = ' . (($pma_pw == '') ? '\'\'' : 'PASSWORD(\'' . ereg_replace('.', '*', $pma_pw) . '\')') . ', ' . $sql_query; - $result = @mysql_query($local_query) or PMA_mysqlDie('', '', FALSE, $err_url); + $result = @PMA_mysql_query($local_query) or PMA_mysqlDie('', '', FALSE, $err_url); unset($host); unset($pma_user); PMA_showMessage($strAddUserMessage . '
    ' . $strRememberReload); @@ -1211,19 +1227,19 @@ else if (isset($submit_updProfile)) { // Updates profile $local_query = 'UPDATE user SET ' . $local_query . $common_where; $sql_query_cpy = 'UPDATE user SET ' . $sql_query . $common_where; - $result = @mysql_query($local_query) or PMA_mysqlDie('', '', FALSE, $err_url . '&host=' . urlencode($host) . '&pma_user=' . urlencode($pma_user) . '&edit=1'); + $result = @PMA_mysql_query($local_query) or PMA_mysqlDie('', '', FALSE, $err_url . '&host=' . urlencode($host) . '&pma_user=' . urlencode($pma_user) . '&edit=1'); // Updates grants if (isset($new_server) || isset($new_user)) { $sql_query = 'UPDATE mysql.db SET ' . $common_upd . $common_where; $sql_query_cpy .= ";\n" . $sql_query; - mysql_query($sql_query); + PMA_mysql_query($sql_query); $sql_query = 'UPDATE mysql.tables_priv SET ' . $common_upd . $common_where; $sql_query_cpy .= ";\n" . $sql_query; - mysql_query($sql_query); + PMA_mysql_query($sql_query); $sql_query = 'UPDATE mysql.columns_priv SET ' . $common_upd . $common_where; $sql_query_cpy .= ";\n" . $sql_query; - mysql_query($sql_query); + PMA_mysql_query($sql_query); unset($common_upd); } @@ -1274,7 +1290,7 @@ else if (isset($submit_chgPriv)) { $sql_query = 'UPDATE user SET ' . $sql_query . ' WHERE Host = \'' . PMA_sqlAddslashes($host) . '\' AND User = \'' . PMA_sqlAddslashes($pma_user) . '\''; - $result = @mysql_query($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url . '&host=' . urlencode($host) . '&pma_user=' . urlencode($pma_user) . '&edit=1'); + $result = @PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url . '&host=' . urlencode($host) . '&pma_user=' . urlencode($pma_user) . '&edit=1'); PMA_showMessage(sprintf($strUpdatePrivMessage, '' . $pma_user . '@' . $host . '') . '
    ' . $strRememberReload); } @@ -1350,7 +1366,7 @@ else if (isset($grants) && $grants) { $sql_query .= ' TO ' . '\'' . PMA_sqlAddslashes($pma_user) . '\'' . '@' . '\'' . PMA_sqlAddslashes($host) . '\''; $sql_query = 'GRANT ' . $sql_query . $priv_grant; - $result = @mysql_query($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url . '&host=' . urlencode($host) . '&pma_user=' . urlencode($pma_user) . '&grants=1'); + $result = @PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url . '&host=' . urlencode($host) . '&pma_user=' . urlencode($pma_user) . '&grants=1'); PMA_showMessage($strAddPrivMessage . '.
    ' . $strRememberReload); } // end if } @@ -1381,8 +1397,8 @@ else if (isset($grants) && $grants) { $list_priv_new = array(); // Gets globals privileges - $result = mysql_query('SELECT * FROM mysql.user WHERE (Host = \'' . PMA_sqlAddslashes($host) . '\' OR Host = \'%\') AND (User = \'' . PMA_sqlAddslashes($pma_user) . '\' OR User = \'\')'); - $row = ($result) ? @mysql_fetch_array($result) : FALSE; + $result = PMA_mysql_query('SELECT * FROM mysql.user WHERE (Host = \'' . PMA_sqlAddslashes($host) . '\' OR Host = \'%\') AND (User = \'' . PMA_sqlAddslashes($pma_user) . '\' OR User = \'\')'); + $row = ($result) ? @PMA_mysql_fetch_array($result) : FALSE; if ($row) { while (list(,$priv) = each($list_priv)) { $priv_priv = $priv . '_priv'; @@ -1404,8 +1420,8 @@ else if (isset($grants) && $grants) { if (get_magic_quotes_gpc()) { $dbgrant = stripslashes($dbgrant); } - $result = mysql_query('SELECT * FROM mysql.db WHERE (Host = \'' . PMA_sqlAddslashes($host) . '\' OR Host = \'%\') AND (User = \'' . PMA_sqlAddslashes($pma_user) . '\' OR User = \'\') AND Db = \'' . PMA_sqlAddslashes($dbgrant) . '\''); - $row = ($result) ? @mysql_fetch_array($result) : FALSE; + $result = PMA_mysql_query('SELECT * FROM mysql.db WHERE (Host = \'' . PMA_sqlAddslashes($host) . '\' OR Host = \'%\') AND (User = \'' . PMA_sqlAddslashes($pma_user) . '\' OR User = \'\') AND Db = \'' . PMA_sqlAddslashes($dbgrant) . '\''); + $row = ($result) ? @PMA_mysql_fetch_array($result) : FALSE; if ($row) { while (list(,$priv) = each($list_priv)) { $priv_priv = $priv . '_priv'; @@ -1427,8 +1443,8 @@ else if (isset($grants) && $grants) { if (get_magic_quotes_gpc()) { $tablegrant = stripslashes($tablegrant); } - $result = mysql_query('SELECT * FROM mysql.tables_priv WHERE (Host = \'' . PMA_sqlAddslashes($host) . '\' OR Host = \'%\') AND (User = \'' . PMA_sqlAddslashes($pma_user) . '\' OR User = \'\') AND Db = \'' . PMA_sqlAddslashes($dbgrant) . '\' AND Table_name = \'' . PMA_sqlAddslashes($tablegrant) . '\''); - $row = ($result) ? @mysql_fetch_array($result) : FALSE; + $result = PMA_mysql_query('SELECT * FROM mysql.tables_priv WHERE (Host = \'' . PMA_sqlAddslashes($host) . '\' OR Host = \'%\') AND (User = \'' . PMA_sqlAddslashes($pma_user) . '\' OR User = \'\') AND Db = \'' . PMA_sqlAddslashes($dbgrant) . '\' AND Table_name = \'' . PMA_sqlAddslashes($tablegrant) . '\''); + $row = ($result) ? @PMA_mysql_fetch_array($result) : FALSE; if ($row && $row['Table_priv']) { while (list(,$priv) = each($list_priv)) { $priv_priv = $priv . '_priv'; @@ -1456,7 +1472,7 @@ else if (isset($check) && $check) { ?> diff --git a/user_password.php3 b/user_password.php3 index ee3bb6732..6a080c8d7 100644 --- a/user_password.php3 +++ b/user_password.php3 @@ -14,7 +14,7 @@ require('./libraries/common.lib.php3'); * script */ if (!$cfg['ShowChgPassword']) { - $cfg['ShowChgPassword'] = @mysql_query('USE mysql', $userlink); + $cfg['ShowChgPassword'] = @PMA_mysql_query('USE mysql', $userlink); } if ($cfg['Server']['auth_type'] == 'config' || !$cfg['ShowChgPassword']) { include('./header.inc.php3'); @@ -49,12 +49,15 @@ if (isset($nopass)) { } // Defines the url to return to in case of error in the sql statement - $common_url_query = 'lang=' . $lang . '&server=' . $server; + $common_url_query = 'lang=' . $lang + . '&server=' . $server; + . '&convcharset=' . $convcharset + $err_url = 'user_password.php3?' . $common_url_query; $sql_query = 'SET password = ' . (($pma_pw == '') ? '\'\'' : 'PASSWORD(\'' . ereg_replace('.', '*', $pma_pw) . '\')'); $local_query = 'SET password = ' . (($pma_pw == '') ? '\'\'' : 'PASSWORD(\'' . PMA_sqlAddslashes($pma_pw) . '\')'); - $result = @mysql_query($local_query) or PMA_mysqlDie('', '', FALSE, $err_url); + $result = @PMA_mysql_query($local_query) or PMA_mysqlDie('', '', FALSE, $err_url); // Changes password cookie if required if ($cfg['Server']['auth_type'] == 'cookie') {