bug #1351743 undefined function: pma_getservercollation()

This commit is contained in:
Sebastian Mendel
2005-11-09 08:56:35 +00:00
parent 743416fe24
commit c2413163c0
3 changed files with 369 additions and 353 deletions

View File

@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
$Id$
$Source$
2005-11-09 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* server_databases.php, mysql_charsets-lib.php:
bug #1351743 undefined function: pma_getservercollation()
2005-11-08 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* Documentation.html, browse_foreigners.php, error.php,
header_printview.inc.php, index.php, left.php, translators.html,
@@ -21,17 +25,17 @@ $Source$
bug #985399 MIME-based in print view / need to select the pk
* db_details_db_info.php: Undefined variable: db_is_information_schema
* tbl_properties.inc.php: bug #1305585 Add field(s) -> type ENTER
2005-11-06 Marc Delisle <lem9@users.sourceforge.net>
* lang/norwegian: Update, thanks to Sven-Erik Andersen
2005-11-06 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* libraries/database_interface.lib.php,
* libraries/database_interface.lib.php,
libraries/dbi/*.dbi.lib.php:
- added PMA_DBI_convert_message()
- bug #1344654 Not converted mysql error message to chosen user language
* sql.php: use fieldset for 'bookmark this'
2005-11-05 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* themes/*/css/theme_right.css.php:
dropped deprecated style classes
@@ -51,14 +55,14 @@ $Source$
- enabled export for views
* db_details_common.php, db_details_structure.php, db_details_links.php:
- no import, drop, rights, operation for information_schema
2005-11-04 Marc Delisle <lem9@users.sourceforge.net>
* lang/spanish: Updated, thanks to Daniel Hinostroza (hinostroza)
2005-11-04 Michal Čihař <michal@cihar.com>
* db_details_structure.php: Read InnoDB exact count before rendering icons
for truncating (bug #1337744).
2005-11-04 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* db_details_structure.php:
fixed display of stats for InnoDB and information_schema
@@ -73,7 +77,7 @@ $Source$
fixed position of link meta tag
* libraries/select_server.lib.php
fixed html output
2005-11-03 Marc Delisle <lem9@users.sourceforge.net>
* tbl_change.php, tbl_replace.php, tbl_replace_fields.php:
bug #1339184, problems in strict mode inserting auto-increment fields
@@ -91,7 +95,7 @@ $Source$
use $GLOBALS as this scripts can be included from inside a function
* left.php, libraries/common.lib.php:
fixed some rtl lang issues
2005-11-02 Michal Čihař <michal@cihar.com>
* config.default.php: This is not a configuration file.
* config.default.php, Documentation.html, libraries/common.lib.php: Use
@@ -116,7 +120,7 @@ $Source$
* libraries/display_create_tbl.php
- XHTML compl.
- added class icon
2005-11-01 Marc Delisle <lem9@users.sourceforge.net>
* server_privileges.php: undefined variable when changing a password
@@ -134,7 +138,7 @@ $Source$
* main.php, phpmyadmin.css.php, libraries/mysql_charsets.lib.php:
- fixed some rtl language issues
* favicon.ico: changed icon
2005-10-31 Marc Delisle <lem9@users.sourceforge.net>
* server_privileges.php: do not display No under the Password column
if this is not a "real user" definition
@@ -175,7 +179,7 @@ $Source$
* scripts/upgrade.pl: various fixes (was not handling rc/pl correctely),
and improvements (--force option, installation summary, backup
directory timestamp)
2005-10-29 Marc Delisle <lem9@users.sourceforge.net>
* Documentation.html: clarification on FAQ 6.20
* server_privileges.php: respect the chosen initial
@@ -193,7 +197,7 @@ $Source$
* index.php, favicon.ico: added favicon.ico
2005-10-27 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* libraries/common.lib.php::PMA_formatNumber(),
* libraries/common.lib.php::PMA_formatNumber(),
db_details_structure.php: do not truncate rowcount
* libraries/mysql_charsets.lib.php::PMA_getDbCollation():
- preserve selected db
@@ -218,7 +222,7 @@ $Source$
* left.php, libraries/common.lib.php: format rowcount in left frame
* server_privileges.php:
bug #688255 Can't edit priv. when different host in db and user
2005-10-26 Marc Delisle <lem9@users.sourceforge.net>
* lang/french* updates
@@ -229,7 +233,7 @@ $Source$
libraries/auth/cookie.auth.lib.php:
unified message boxes (error, warning, confirmation)
* server_privilegs.php: MySQL 5 requires CREATE USER before GRANT
2005-10-25 Michal Čihař <michal@cihar.com>
* lang/english: "Log in" is correct naming for action (RFE #945440).
* tbl_properties_operations.php: Allow to change auto_increment for
@@ -251,7 +255,7 @@ $Source$
ON UPDATE CURRENT TIMESTAMP attribute (phew! repeat this 3 times)
2005-10-21 Marc Delisle <lem9@users.sourceforge.net>
* libraries/relation.lib.php: foreign dropdowns: sort id-content by id
* libraries/relation.lib.php: foreign dropdowns: sort id-content by id
and content-id by content
* libraries/common.lib.php: bug #1330847, undefined index connect_type
@@ -267,7 +271,7 @@ $Source$
- make use of information_schema
- always fill fields for information_schema and show table status
* db_details_db_info.php: make use of function PMA_DBI_get_tables_full()
2005-10-20 Marc Delisle <lem9@users.sourceforge.net>
* server_databases.php: security fix
* libraries/common.lib.php, /grab_globals.lib.php: security fix
@@ -308,7 +312,7 @@ $Source$
* libraries/sql_query_form.lib.php: open db link from querywindow in main frame
* footer.inc.php, header.inc.php, libraries/tooltip.js:
moved tooltip javascript include into header
2005-10-18 Michal Čihař <michal@cihar.com>
* libraries/relation.lib.php: Do not set database if not needed.
* libraries/common.lib.php: Use common infrastructure for getting tables.
@@ -328,7 +332,7 @@ $Source$
libraries/querywindow.js: update row count in left frame bug #1243908
* libraries/common.lib.php:
bug #1216521: display duplicate rows for failed unique key creation
2005-10-17 Michal Čihař <michal@cihar.com>
* lang/czech: Translation fixes.
* libraries/common.lib.php: Group databases by rightmost separator (bug
@@ -348,8 +352,8 @@ $Source$
libraries/common.lib.php, libraries/left_header.inc.php,
libraries/sql_query_form.lib.php, libraries/querywindow.js:
code cleanup whole querywindow js stuff, moved all in one new js file,
now included in index.php, bug #1327055
now included in index.php, bug #1327055
2005-10-16 Michal Čihař <michal@cihar.com>
* db_details_links.php: Disable drop tab on mysql database (RFE #1327514).
* server_databases.php: Don't allow to check mysql database for dropping
@@ -379,7 +383,7 @@ $Source$
* lang/*: typo 'unser' -> 'user'
* lang/german: partial Update
* libraries/import.lib.php: uninitialized variables
2005-10-13 Marc Delisle <lem9@users.sourceforge.net>
* tbl_addfield.php: undefined $field_collation under MySQL < 4.1.x
@@ -416,7 +420,7 @@ $Source$
* css/phpmyadmin.css.php, libraries/common.lib.php,
themes/darkblue_orange/css/theme_right.css.php,
themes/original/css/theme_right.css.php:
use list for navigation tabs RFE #1290423
use list for navigation tabs RFE #1290423
* db_details_structure.php: fixed NOTICE
* css/phpmyadmin.css.php, themes/*/css/theme_*.css.php:
revert icon size to fixed width and height
@@ -554,7 +558,7 @@ $Source$
* lsng/czech: Update.
2005-10-07 Marc Delisle <lem9@users.sourceforge.net>
* libraries/check_user_privileges.lib.php: bug #1313821, dbname containing a
* libraries/check_user_privileges.lib.php: bug #1313821, dbname containing a
hyphen was not detected as being already created
2005-10-07 Michal Čihař <michal@cihar.com>
@@ -576,7 +580,7 @@ $Source$
thanks to Vernon Lyon - vlyon
* libraries/charset_conversion.lib.php: PMA_MYSQL_INT_VERSION is not
defined at login time but what tested
* libraries/display_create_table.lib.php, bug #1311384, Create table
* libraries/display_create_table.lib.php, bug #1311384, Create table
dialog on escaped wildcard privileges
2005-10-04 Sebastian Mendel <cybot_tm@users.sourceforge.net>
@@ -661,7 +665,7 @@ $Source$
(RFE #1255931).
2005-09-25 Marc Delisle <lem9@users.sourceforge.net>
* server_privileges.php: support MySQL 5 privileges
* server_privileges.php: support MySQL 5 privileges
2005-09-25 Michal Čihař <michal@cihar.com>
* lang/*: Messages for Sebastian.
@@ -727,7 +731,7 @@ $Source$
2005-09-18 Marc Delisle <lem9@users.sourceforge.net>
* libraries/display_export.lib.php: bug #1293937 Export compression
default: bzip instead of bzip2, thanks to Rene Leonhardt
2005-09-15 Michal Čihař <michal@cihar.com>
* config.default.php, libraries/common.lib.php: Simplify loading of
defaults, why did I write such crap before?
@@ -817,7 +821,7 @@ $Source$
2005-08-23 Marc Delisle <lem9@users.sourceforge.net>
* libraries/display_tbl.lib.php: bug #1267177, wrong return page
* main.php, libraries/common.lib.php, Documentation.html,
config.inc.php: patch #1257134, removed code to display the warning if
config.inc.php: patch #1257134, removed code to display the warning if
PmaAbsoluteUri is not set. A notice will still display if the autodetect
code is unable to figure out the proper URI. Thanks to Isaac Bennetch
@@ -839,7 +843,7 @@ $Source$
* libraries/common.lib.php, new error.php: patch #1258978, move common
code for error pages out of common.lib.php, thanks to Sebastian Mendel
* lang/german*: bug #1258956, typo
* libraries/defines.lib.php, themes/original/info.inc.php,
* libraries/defines.lib.php, themes/original/info.inc.php,
themes/darkblue_orange/info.inc.php: PMA 2.6.4 needs theme version 3
2005-08-19 Marc Delisle <lem9@users.sourceforge.net>
@@ -894,7 +898,7 @@ $Source$
* db_details.php: undefined $header_url_qry
* sql.php: bug #1255869, "MySQL returned an empty result set" not
displayed in all cases
2005-08-09 Marc Delisle <lem9@users.sourceforge.net>
* read_dump.php: add unique numbers to $strFileCouldNotBeRead to
improve support when someone gets this error
@@ -909,7 +913,7 @@ $Source$
* libraries/dbi/mysqli.dbi.lib.php: bug #1253453, using mysqli extension
with MySQL 4.0.x
* libraries/mysql_charsets.lib.php, /relation_cleanup.lib.php,
/tbl_move_copy.php: patch #1253461 (code cleanup),
/tbl_move_copy.php: patch #1253461 (code cleanup),
thanks to Sebastian Mendel
* libraries/sqlparser.lib.php: patch #1253478, variable initialization
and code cleanup, thanks to Sebastian Mendel
@@ -928,7 +932,7 @@ $Source$
group, and proper closing of optgroup, thanks to Ryan Schmidt
2005-08-05 Marc Delisle <lem9@users.sourceforge.net>
* Documentation.html, readme.php, license.php:
* Documentation.html, readme.php, license.php:
bug #965548, displaying README and LICENSE, thanks to Ryan Schmidt
2005-08-04 Michal Čihař <michal@cihar.com>
@@ -1053,7 +1057,7 @@ $Source$
* export.php: bug #1116026, export under IE 6 (XP SP2)
2005-07-11 Marc Delisle <lem9@users.sourceforge.net>
* tbl_relations.php: bug #1227710, unsaved relations lost when changing
* tbl_relations.php: bug #1227710, unsaved relations lost when changing
field to display
2005-07-11 Michal Čihař <michal@cihar.com>
@@ -1095,7 +1099,7 @@ $Source$
* db_details_qbe.php: bug #1234616, minor theme text color issue
2005-07-06 Marc Delisle <lem9@users.sourceforge.net>
* db_search.php: bug #1233349, db search in MySQL 5.0.x on fields
* db_search.php: bug #1233349, db search in MySQL 5.0.x on fields
without a charset
2005-07-04 Marc Delisle <lem9@users.sourceforge.net>
@@ -1124,7 +1128,7 @@ $Source$
* lang/swedish: Updated, thanks to Björn T. Hallberg (bth).
2005-06-29 Marc Delisle <lem9@users.sourceforge.net>
* tbl_properties_table_info.php: bug #1228862, creating a table under
* tbl_properties_table_info.php: bug #1228862, creating a table under
MySQL 5.x with wrong table type
2005-06-28 Marc Delisle <lem9@users.sourceforge.net>

View File

@@ -12,16 +12,15 @@ if (PMA_MYSQL_INT_VERSION >= 40100){
$mysql_charsets_maxlen[$row['Charset']] = $row['Maxlen'];
$mysql_charsets_descriptions[$row['Charset']] = $row['Description'];
}
@PMA_DBI_free_result($res);
unset($res, $row);
$res = PMA_DBI_query('SHOW COLLATION;');
@PMA_DBI_free_result( $res );
$mysql_charsets_count = count($mysql_charsets);
sort($mysql_charsets, SORT_STRING);
$mysql_collations = array_flip($mysql_charsets);
$mysql_default_collations = $mysql_collations_flat = $mysql_charsets_available = $mysql_collations_available = array();
$res = PMA_DBI_query('SHOW COLLATION;');
while ($row = PMA_DBI_fetch_assoc($res)) {
if (!is_array($mysql_collations[$row['Charset']])) {
$mysql_collations[$row['Charset']] = array($row['Collation']);
@@ -36,6 +35,8 @@ if (PMA_MYSQL_INT_VERSION >= 40100){
$mysql_collations_available[$row['Collation']] = TRUE;
$mysql_charsets_available[$row['Charset']] = !empty($mysql_charsets_available[$row['Charset']]) || !empty($mysql_collations_available[$row['Collation']]);
}
@PMA_DBI_free_result( $res );
unset( $res, $row );
$mysql_collations_count = count($mysql_collations_flat);
sort($mysql_collations_flat, SORT_STRING);
@@ -44,270 +45,6 @@ if (PMA_MYSQL_INT_VERSION >= 40100){
reset($mysql_collations[$key]);
}
@PMA_DBI_free_result($res);
unset($res, $row);
function PMA_getCollationDescr($collation) {
static $collation_cache;
if (!is_array($collation_cache)) {
$collation_cache = array();
} elseif (isset($collation_cache[$collation])) {
return $collation_cache[$collation];
}
if ($collation == 'binary') {
return $GLOBALS['strBinary'];
}
$parts = explode('_', $collation);
if (count($parts) == 1) {
$parts[1] = 'general';
} elseif ($parts[1] == 'ci' || $parts[1] == 'cs') {
$parts[2] = $parts[1];
$parts[1] = 'general';
}
$descr = '';
switch ($parts[1]) {
case 'bulgarian':
$descr = $GLOBALS['strBulgarian'];
break;
case 'chinese':
if ($parts[0] == 'gb2312' || $parts[0] == 'gbk') {
$descr = $GLOBALS['strSimplifiedChinese'];
} elseif ($parts[0] == 'big5') {
$descr = $GLOBALS['strTraditionalChinese'];
}
break;
case 'ci':
$descr = $GLOBALS['strCaseInsensitive'];
break;
case 'cs':
$descr = $GLOBALS['strCaseSensitive'];
break;
case 'croatian':
$descr = $GLOBALS['strCroatian'];
break;
case 'czech':
$descr = $GLOBALS['strCzech'];
break;
case 'danish':
$descr = $GLOBALS['strDanish'];
break;
case 'english':
$descr = $GLOBALS['strEnglish'];
break;
case 'esperanto':
$descr = $GLOBALS['strEsperanto'];
break;
case 'estonian':
$descr = $GLOBALS['strEstonian'];
break;
case 'german1':
$descr = $GLOBALS['strGerman'] . ' (' . $GLOBALS['strDictionary'] . ')';
break;
case 'german2':
$descr = $GLOBALS['strGerman'] . ' (' . $GLOBALS['strPhoneBook'] . ')';
break;
case 'hungarian':
$descr = $GLOBALS['strHungarian'];
break;
case 'icelandic':
$descr = $GLOBALS['strIcelandic'];
break;
case 'japanese':
$descr = $GLOBALS['strJapanese'];
break;
case 'latvian':
$descr = $GLOBALS['strLatvian'];
break;
case 'lithuanian':
$descr = $GLOBALS['strLithuanian'];
break;
case 'korean':
$descr = $GLOBALS['strKorean'];
break;
case 'persian':
$descr = $GLOBALS['strPersian'];
break;
case 'polish':
$descr = $GLOBALS['strPolish'];
break;
case 'roman':
$descr = $GLOBALS['strWestEuropean'];
break;
case 'romanian':
$descr = $GLOBALS['strRomanian'];
break;
case 'slovak':
$descr = $GLOBALS['strSlovak'];
break;
case 'slovenian':
$descr = $GLOBALS['strSlovenian'];
break;
case 'spanish':
$descr = $GLOBALS['strSpanish'];
break;
case 'spanish2':
$descr = $GLOBALS['strTraditionalSpanish'];
break;
case 'swedish':
$descr = $GLOBALS['strSwedish'];
break;
case 'thai':
$descr = $GLOBALS['strThai'];
break;
case 'turkish':
$descr = $GLOBALS['strTurkish'];
break;
case 'ukrainian':
$descr = $GLOBALS['strUkrainian'];
break;
case 'unicode':
$descr = $GLOBALS['strUnicode'] . ' (' . $GLOBALS['strMultilingual'] . ')';
break;
case 'bin':
$is_bin = TRUE;
case 'general':
switch ($parts[0]) {
// Unicode charsets
case 'ucs2':
case 'utf8':
$descr = $GLOBALS['strUnicode'] . ' (' . $GLOBALS['strMultilingual'] . ')';
break;
// West European charsets
case 'ascii':
case 'cp850':
case 'dec8':
case 'hp8':
case 'latin1':
case 'macroman':
$descr = $GLOBALS['strWestEuropean'] . ' (' . $GLOBALS['strMultilingual'] . ')';
break;
// Central European charsets
case 'cp1250':
case 'cp852':
case 'latin2':
case 'macce':
$descr = $GLOBALS['strCentralEuropean'] . ' (' . $GLOBALS['strMultilingual'] . ')';
break;
// Russian charsets
case 'cp866':
case 'koi8r':
$descr = $GLOBALS['strRussian'];
break;
// Simplified Chinese charsets
case 'gb2312':
case 'gbk':
$descr = $GLOBALS['strSimplifiedChinese'];
break;
// Japanese charsets
case 'sjis':
case 'ujis':
case 'cp932':
case 'eucjpms':
$descr = $GLOBALS['strJapanese'];
break;
// Baltic charsets
case 'cp1257':
case 'latin7':
$descr = $GLOBALS['strBaltic'] . ' (' . $GLOBALS['strMultilingual'] . ')';
break;
// Other
case 'armscii8':
case 'armscii':
$descr = $GLOBALS['strArmenian'];
break;
case 'big5':
$descr = $GLOBALS['strTraditionalChinese'];
break;
case 'cp1251':
$descr = $GLOBALS['strCyrillic'] . ' (' . $GLOBALS['strMultilingual'] . ')';
break;
case 'cp1256':
$descr = $GLOBALS['strArabic'];
break;
case 'euckr':
$descr = $GLOBALS['strKorean'];
break;
case 'hebrew':
$descr = $GLOBALS['strHebrew'];
break;
case 'geostd8':
$descr = $GLOBALS['strGeorgian'];
break;
case 'greek':
$descr = $GLOBALS['strGreek'];
break;
case 'keybcs2':
$descr = $GLOBALS['strCzechSlovak'];
break;
case 'koi8u':
$descr = $GLOBALS['strUkrainian'];
break;
case 'latin5':
$descr = $GLOBALS['strTurkish'];
break;
case 'swe7':
$descr = $GLOBALS['strSwedish'];
break;
case 'tis620':
$descr = $GLOBALS['strThai'];
break;
default:
$descr = $GLOBALS['strUnknown'];
break;
}
if (!empty($is_bin)) {
$descr .= ', ' . $GLOBALS['strBinary'];
}
break;
default: $descr = $GLOBALS['strUnknown'];
}
if (!empty($parts[2])) {
if ($parts[2] == 'ci') {
$descr .= ', ' . $GLOBALS['strCaseInsensitive'];
} elseif ($parts[2] == 'cs') {
$descr .= ', ' . $GLOBALS['strCaseSensitive'];
}
}
$collation_cache[$collation] = $descr;
return $descr;
}
/**
* returns collation of given db
*
* @uses PMA_MYSQL_INT_VERSION
* @uses PMA_DBI_fetch_value()
* @uses PMA_DBI_select_db()
* @uses PMA_sqlAddSlashes()
* @uses $GLOBALS['db']
* @param string $db name of db
* @return string collation of $db
*/
function PMA_getDbCollation( $db ) {
if (PMA_MYSQL_INT_VERSION >= 50000 && $db == 'information_schema') {
// We don't have to check the collation of the virtual
// information_schema database: We know it!
return 'utf8_general_ci';
}
if (PMA_MYSQL_INT_VERSION >= 50006) {
// Since MySQL 5.0.6, we don't have to parse SHOW CREATE DATABASE anymore.
return PMA_DBI_fetch_value('SELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = \'' . PMA_sqlAddSlashes($db) . '\' LIMIT 1;');
} else if (PMA_MYSQL_INT_VERSION >= 40101) {
// MySQL 4.1.0 does not support seperate charset settings
// for databases.
PMA_DBI_select_db( $db );
$return = PMA_DBI_fetch_value( 'SHOW VARIABLES LIKE "collation_database"', 0, 1 );
if ( ! empty( $GLOBALS['db'] ) && $db !== $GLOBALS['db'] ) {
PMA_DBI_select_db( $GLOBALS['db'] );
}
return $return;
}
return '';
}
define('PMA_CSDROPDOWN_COLLATION', 0);
define('PMA_CSDROPDOWN_CHARSET', 1);
@@ -359,15 +96,289 @@ if (PMA_MYSQL_INT_VERSION >= 40100){
}
/**
* returns default server collation from show variables
*
* returns collation of given db
*
* @uses PMA_MYSQL_INT_VERSION
* @uses PMA_DBI_fetch_value()
* @return string $server_collation
* @uses PMA_DBI_select_db()
* @uses PMA_sqlAddSlashes()
* @uses $GLOBALS['db']
* @param string $db name of db
* @return string collation of $db
*/
function PMA_getServerCollation() {
return PMA_DBI_fetch_value(
'SHOW VARIABLES LIKE \'collation_server\'', 0, 1 );
function PMA_getDbCollation( $db ) {
if ( PMA_MYSQL_INT_VERSION >= 50000 && $db == 'information_schema' ) {
// We don't have to check the collation of the virtual
// information_schema database: We know it!
return 'utf8_general_ci';
}
if ( PMA_MYSQL_INT_VERSION >= 50006 ) {
// Since MySQL 5.0.6, we don't have to parse SHOW CREATE DATABASE anymore.
return PMA_DBI_fetch_value('SELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = \'' . PMA_sqlAddSlashes($db) . '\' LIMIT 1;');
} elseif ( PMA_MYSQL_INT_VERSION >= 40101 ) {
// MySQL 4.1.0 does not support seperate charset settings
// for databases.
PMA_DBI_select_db( $db );
$return = PMA_DBI_fetch_value( 'SHOW VARIABLES LIKE "collation_database"', 0, 1 );
if ( ! empty( $GLOBALS['db'] ) && $db !== $GLOBALS['db'] ) {
PMA_DBI_select_db( $GLOBALS['db'] );
}
return $return;
}
return '';
}
} else {
function PMA_getDbCollation( $db ) { return PMA_getServerCollation(); }
}
/**
* returns default server collation from show variables
*
* @uses PMA_DBI_fetch_value()
* @return string $server_collation
*/
function PMA_getServerCollation() {
return PMA_DBI_fetch_value(
'SHOW VARIABLES LIKE \'collation_server\'', 0, 1 );
}
/**
* returns description for given collation
*
* @uses is_array()
* @uses explode()
* @uses count()
* @uses $GLOBALS['str[Languages|Sorting]']
*
* @param string $collation MySQL collation string
* @return string collation description
*/
function PMA_getCollationDescr( $collation ) {
static $collation_cache;
if (!is_array($collation_cache)) {
$collation_cache = array();
} elseif (isset($collation_cache[$collation])) {
return $collation_cache[$collation];
}
if ($collation == 'binary') {
return $GLOBALS['strBinary'];
}
$parts = explode('_', $collation);
if (count($parts) == 1) {
$parts[1] = 'general';
} elseif ($parts[1] == 'ci' || $parts[1] == 'cs') {
$parts[2] = $parts[1];
$parts[1] = 'general';
}
$descr = '';
switch ($parts[1]) {
case 'bulgarian':
$descr = $GLOBALS['strBulgarian'];
break;
case 'chinese':
if ($parts[0] == 'gb2312' || $parts[0] == 'gbk') {
$descr = $GLOBALS['strSimplifiedChinese'];
} elseif ($parts[0] == 'big5') {
$descr = $GLOBALS['strTraditionalChinese'];
}
break;
case 'ci':
$descr = $GLOBALS['strCaseInsensitive'];
break;
case 'cs':
$descr = $GLOBALS['strCaseSensitive'];
break;
case 'croatian':
$descr = $GLOBALS['strCroatian'];
break;
case 'czech':
$descr = $GLOBALS['strCzech'];
break;
case 'danish':
$descr = $GLOBALS['strDanish'];
break;
case 'english':
$descr = $GLOBALS['strEnglish'];
break;
case 'esperanto':
$descr = $GLOBALS['strEsperanto'];
break;
case 'estonian':
$descr = $GLOBALS['strEstonian'];
break;
case 'german1':
$descr = $GLOBALS['strGerman'] . ' (' . $GLOBALS['strDictionary'] . ')';
break;
case 'german2':
$descr = $GLOBALS['strGerman'] . ' (' . $GLOBALS['strPhoneBook'] . ')';
break;
case 'hungarian':
$descr = $GLOBALS['strHungarian'];
break;
case 'icelandic':
$descr = $GLOBALS['strIcelandic'];
break;
case 'japanese':
$descr = $GLOBALS['strJapanese'];
break;
case 'latvian':
$descr = $GLOBALS['strLatvian'];
break;
case 'lithuanian':
$descr = $GLOBALS['strLithuanian'];
break;
case 'korean':
$descr = $GLOBALS['strKorean'];
break;
case 'persian':
$descr = $GLOBALS['strPersian'];
break;
case 'polish':
$descr = $GLOBALS['strPolish'];
break;
case 'roman':
$descr = $GLOBALS['strWestEuropean'];
break;
case 'romanian':
$descr = $GLOBALS['strRomanian'];
break;
case 'slovak':
$descr = $GLOBALS['strSlovak'];
break;
case 'slovenian':
$descr = $GLOBALS['strSlovenian'];
break;
case 'spanish':
$descr = $GLOBALS['strSpanish'];
break;
case 'spanish2':
$descr = $GLOBALS['strTraditionalSpanish'];
break;
case 'swedish':
$descr = $GLOBALS['strSwedish'];
break;
case 'thai':
$descr = $GLOBALS['strThai'];
break;
case 'turkish':
$descr = $GLOBALS['strTurkish'];
break;
case 'ukrainian':
$descr = $GLOBALS['strUkrainian'];
break;
case 'unicode':
$descr = $GLOBALS['strUnicode'] . ' (' . $GLOBALS['strMultilingual'] . ')';
break;
case 'bin':
$is_bin = TRUE;
case 'general':
switch ($parts[0]) {
// Unicode charsets
case 'ucs2':
case 'utf8':
$descr = $GLOBALS['strUnicode'] . ' (' . $GLOBALS['strMultilingual'] . ')';
break;
// West European charsets
case 'ascii':
case 'cp850':
case 'dec8':
case 'hp8':
case 'latin1':
case 'macroman':
$descr = $GLOBALS['strWestEuropean'] . ' (' . $GLOBALS['strMultilingual'] . ')';
break;
// Central European charsets
case 'cp1250':
case 'cp852':
case 'latin2':
case 'macce':
$descr = $GLOBALS['strCentralEuropean'] . ' (' . $GLOBALS['strMultilingual'] . ')';
break;
// Russian charsets
case 'cp866':
case 'koi8r':
$descr = $GLOBALS['strRussian'];
break;
// Simplified Chinese charsets
case 'gb2312':
case 'gbk':
$descr = $GLOBALS['strSimplifiedChinese'];
break;
// Japanese charsets
case 'sjis':
case 'ujis':
case 'cp932':
case 'eucjpms':
$descr = $GLOBALS['strJapanese'];
break;
// Baltic charsets
case 'cp1257':
case 'latin7':
$descr = $GLOBALS['strBaltic'] . ' (' . $GLOBALS['strMultilingual'] . ')';
break;
// Other
case 'armscii8':
case 'armscii':
$descr = $GLOBALS['strArmenian'];
break;
case 'big5':
$descr = $GLOBALS['strTraditionalChinese'];
break;
case 'cp1251':
$descr = $GLOBALS['strCyrillic'] . ' (' . $GLOBALS['strMultilingual'] . ')';
break;
case 'cp1256':
$descr = $GLOBALS['strArabic'];
break;
case 'euckr':
$descr = $GLOBALS['strKorean'];
break;
case 'hebrew':
$descr = $GLOBALS['strHebrew'];
break;
case 'geostd8':
$descr = $GLOBALS['strGeorgian'];
break;
case 'greek':
$descr = $GLOBALS['strGreek'];
break;
case 'keybcs2':
$descr = $GLOBALS['strCzechSlovak'];
break;
case 'koi8u':
$descr = $GLOBALS['strUkrainian'];
break;
case 'latin5':
$descr = $GLOBALS['strTurkish'];
break;
case 'swe7':
$descr = $GLOBALS['strSwedish'];
break;
case 'tis620':
$descr = $GLOBALS['strThai'];
break;
default:
$descr = $GLOBALS['strUnknown'];
break;
}
if (!empty($is_bin)) {
$descr .= ', ' . $GLOBALS['strBinary'];
}
break;
default: $descr = $GLOBALS['strUnknown'];
}
if (!empty($parts[2])) {
if ($parts[2] == 'ci') {
$descr .= ', ' . $GLOBALS['strCaseInsensitive'];
} elseif ($parts[2] == 'cs') {
$descr .= ', ' . $GLOBALS['strCaseSensitive'];
}
}
$collation_cache[$collation] = $descr;
return $descr;
}
?>

View File

@@ -91,7 +91,7 @@ require('./server_links.inc.php');
echo '<h2>' . "\n"
. ( $GLOBALS['cfg']['MainPageIconic']
? '<img class="icon" src="' . $pmaThemeImage . 's_db.png" width="16"'
.' height="16" alt="" />'
.' height="16" alt="" />'
: '' )
. ( $dbstats ? $strDatabasesStats : $strDatabases ) . "\n"
.'</h2>' . "\n";
@@ -122,45 +122,46 @@ if ( $server > 0 ) {
if ( count($databases) > 0 ) {
// sorts the array
usort( $databases, 'PMA_dbCmp' );
// table col order
$column_order = array(
'DEFAULT_COLLATION_NAME' => array(
'disp_name' => $strCollation,
'description_function' => 'PMA_getCollationDescr',
'format' => 'string',
'footer' => PMA_getServerCollation(),
),
'SCHEMA_TABLES' => array(
'disp_name' => $strNumTables,
'format' => 'number',
'footer' => 0,
),
'SCHEMA_TABLE_ROWS' => array(
'disp_name' => $strRows,
'format' => 'number',
'footer' => 0,
),
'SCHEMA_DATA_LENGTH' => array(
'disp_name' => $strData,
'format' => 'byte',
'footer' => 0,
),
'SCHEMA_INDEX_LENGTH' => array(
'disp_name' => $strIndexes,
'format' => 'byte',
'footer' => 0,
),
'SCHEMA_LENGTH' => array(
'disp_name' => $strTotalUC,
'format' => 'byte',
'footer' => 0,
),
'SCHEMA_DATA_FREE' => array(
'disp_name' => $strOverhead,
'format' => 'byte',
'footer' => 0,
),
// there is no db specific collation or charset prior 4.1.0
if ( PMA_MYSQL_INT_VERSION >= 40100 ) {
$column_order['DEFAULT_COLLATION_NAME'] = array(
'disp_name' => $strCollation,
'description_function' => 'PMA_getCollationDescr',
'format' => 'string',
'footer' => PMA_getServerCollation(),
);
}
$column_order['SCHEMA_TABLES'] = array(
'disp_name' => $strNumTables,
'format' => 'number',
'footer' => 0,
);
$column_order['SCHEMA_TABLE_ROWS'] = array(
'disp_name' => $strRows,
'format' => 'number',
'footer' => 0,
);
$column_order['SCHEMA_DATA_LENGTH'] = array(
'disp_name' => $strData,
'format' => 'byte',
'footer' => 0,
);
$column_order['SCHEMA_INDEX_LENGTH'] = array(
'disp_name' => $strIndexes,
'format' => 'byte',
'footer' => 0,
);
$column_order['SCHEMA_LENGTH'] = array(
'disp_name' => $strTotalUC,
'format' => 'byte',
'footer' => 0,
);
$column_order['SCHEMA_DATA_FREE'] = array(
'disp_name' => $strOverhead,
'format' => 'byte',
'footer' => 0,
);
echo '<form action="./server_databases.php" method="post" name="dbStatsForm">' . "\n"
@@ -203,10 +204,10 @@ if ( count($databases) > 0 ) {
$odd_row = true;
foreach ( $databases as $key => $current ) {
echo '<tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">' . "\n";
$odd_row = ! $odd_row;
if ( $is_superuser || $cfg['AllowUserDropDatabase'] ) {
echo ' <td class="tool">' . "\n";
if ($current['SCHEMA_NAME'] != 'mysql' && (PMA_MYSQL_INT_VERSION < 50002 || $current['SCHEMA_NAME'] != 'information_schema')) {
@@ -221,7 +222,7 @@ if ( count($databases) > 0 ) {
. ' ' . htmlspecialchars($current['SCHEMA_NAME']) . "\n"
. ' </a>' . "\n"
. ' </td>' . "\n";
foreach ( $column_order as $stat_name => $stat ) {
if ( array_key_exists( $stat_name, $current ) ) {
if ( is_numeric( $stat['footer'] ) ) {
@@ -248,7 +249,7 @@ if ( count($databases) > 0 ) {
}
}
}
if ($is_superuser) {
echo ' <td class="tool">' . "\n"
. ' <a onclick="window.parent.setDb(\'' . urlencode($current['SCHEMA_NAME']) . '\');" href="./server_privileges.php?' . $url_query . '&amp;checkprivs=' . urlencode($current['SCHEMA_NAME']) . '" title="' . sprintf($strCheckPrivsLong, htmlspecialchars($current['SCHEMA_NAME'])) . '">'. "\n"
@@ -258,7 +259,7 @@ if ( count($databases) > 0 ) {
echo '</tr>' . "\n";
} // end foreach ( $databases as $key => $current )
unset( $key, $current, $odd_row );
echo '<tr>' . "\n";
if ( $is_superuser ) {
echo ' <th>&nbsp;</th>' . "\n";
@@ -292,7 +293,7 @@ if ( count($databases) > 0 ) {
}
echo '</tr>' . "\n";
unset( $column_order, $stat_name, $stat, $databases );
if ($is_superuser || $cfg['AllowUserDropDatabase']) {
$common_url_query = PMA_generate_common_url() . '&amp;sort_by=' . $sort_by . '&amp;sort_order=' . $sort_order . '&amp;dbstats=' . $dbstats;
echo '<tr><td colspan="' . $table_columns . '">' . "\n"
@@ -311,7 +312,7 @@ if ( count($databases) > 0 ) {
echo '</tbody>' . "\n"
.'</table>' . "\n";
unset( $table_columns );
if ( $GLOBALS['cfg']['PropertiesIconic'] ) {
// iconic view
if ($is_superuser || $cfg['AllowUserDropDatabase']) {