diff options
author | Alexander M. Turek <me@derrabus.de> | 2005-03-29 22:09:47 +0400 |
---|---|---|
committer | Alexander M. Turek <me@derrabus.de> | 2005-03-29 22:09:47 +0400 |
commit | e08f775b68f7c52f7287974623a7ca42a2ab149b (patch) | |
tree | cb5788c44f854e0666f3403f22d1f38ff2442cb2 | |
parent | 532c1ee25fc72bfa81f052676ffd6b3980e5ad11 (diff) |
Don't offer unavailable collations.
-rwxr-xr-x | ChangeLog | 4 | ||||
-rw-r--r-- | libraries/mysql_charsets.lib.php | 14 | ||||
-rw-r--r-- | server_collations.php | 2 |
3 files changed, 16 insertions, 4 deletions
@@ -5,6 +5,10 @@ phpMyAdmin - Changelog $Id$ $Source$ +2005-03-29 Alexander M. Turek <me@derrabus.de> + * server_collations.php, libraries/mysql_charsets.lib.php: Don't offer + unavailable collations (bug #1172517). + 2005-03-28 Alexander M. Turek <me@derrabus.de> * left.php: Implemented the forgotten view icon. diff --git a/libraries/mysql_charsets.lib.php b/libraries/mysql_charsets.lib.php index 616ad45229..1bb5f1d21b 100644 --- a/libraries/mysql_charsets.lib.php +++ b/libraries/mysql_charsets.lib.php @@ -21,7 +21,7 @@ if (PMA_MYSQL_INT_VERSION >= 40100){ sort($mysql_charsets, SORT_STRING); $mysql_collations = array_flip($mysql_charsets); - $mysql_default_collations = $mysql_collations_flat = array();; + $mysql_default_collations = $mysql_collations_flat = $mysql_charsets_available = $mysql_collations_available = array(); while ($row = PMA_DBI_fetch_assoc($res)) { if (!is_array($mysql_collations[$row['Charset']])) { $mysql_collations[$row['Charset']] = array($row['Collation']); @@ -32,6 +32,8 @@ if (PMA_MYSQL_INT_VERSION >= 40100){ if ((isset($row['D']) && $row['D'] == 'Y') || (isset($row['Default']) && $row['Default'] == 'Yes')) { $mysql_default_collations[$row['Charset']] = $row['Collation']; } + $mysql_collations_available[$row['Collation']] = !isset($row['Compiled']) || $row['Compiled'] == 'Yes'; + $mysql_charsets_available[$row['Charset']] = !empty($mysql_charsets_available[$row['Charset']]) || !empty($mysql_collations_available[$row['Collation']]); } $mysql_collations_count = count($mysql_collations_flat); @@ -304,8 +306,8 @@ if (PMA_MYSQL_INT_VERSION >= 40100){ define('PMA_CSDROPDOWN_COLLATION', 0); define('PMA_CSDROPDOWN_CHARSET', 1); - function PMA_generateCharsetDropdownBox($type = PMA_CSDROPDOWN_COLLATION, $name = NULL, $id = NULL, $default = NULL, $label = TRUE, $indent = 0, $submitOnChange = FALSE) { - global $mysql_charsets, $mysql_charsets_descriptions, $mysql_collations; + function PMA_generateCharsetDropdownBox($type = PMA_CSDROPDOWN_COLLATION, $name = NULL, $id = NULL, $default = NULL, $label = TRUE, $indent = 0, $submitOnChange = FALSE, $displayUnavailable = FALSE) { + global $mysql_charsets, $mysql_charsets_descriptions, $mysql_charsets_available, $mysql_collations, $mysql_collations_available; if (empty($name)) { if ($type == PMA_CSDROPDOWN_COLLATION) { @@ -324,10 +326,16 @@ if (PMA_MYSQL_INT_VERSION >= 40100){ } $return_str .= $spacer . ' <option value=""></option>' . "\n"; foreach ($mysql_charsets as $current_charset) { + if (!$mysql_charsets_available[$current_charset]) { + continue; + } $current_cs_descr = empty($mysql_charsets_descriptions[$current_charset]) ? $current_charset : $mysql_charsets_descriptions[$current_charset]; if ($type == PMA_CSDROPDOWN_COLLATION) { $return_str .= $spacer . ' <optgroup label="' . $current_charset . '" title="' . $current_cs_descr . '">' . "\n"; foreach ($mysql_collations[$current_charset] as $current_collation) { + if (!$mysql_collations_available[$current_collation]) { + continue; + } $return_str .= $spacer . ' <option value="' . $current_collation . '" title="' . PMA_getCollationDescr($current_collation) . '"' . ($default == $current_collation ? ' selected="selected"' : '') . '>' . $current_collation . '</option>' . "\n"; } $return_str .= $spacer . ' </optgroup>' . "\n"; diff --git a/server_collations.php b/server_collations.php index ea78d0d0e7..15b6ca7ea5 100644 --- a/server_collations.php +++ b/server_collations.php @@ -84,7 +84,7 @@ foreach ($mysql_charsets as $current_charset) { $useBgcolorOne = TRUE; foreach ($mysql_collations[$current_charset] as $current_collation) { $i++; - echo ' <tr>' . "\n" + echo ' <tr' . ($mysql_collations_available[$current_collation] ? '' : ' class="disabled"') . '>' . "\n" . ' <td bgcolor="' . ($mysql_default_collations[$current_charset] == $current_collation ? $cfg['BrowseMarkerColor'] : ($useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'])) . '">' . "\n" . ' ' . htmlspecialchars($current_collation) . ' ' . "\n" . ' </td>' . "\n" |