diff --git a/index.php b/index.php index 42e03df39e..2d33c3939b 100644 --- a/index.php +++ b/index.php @@ -198,7 +198,6 @@ if ($server > 0 || count($cfg['Servers']) > 1 'select_collation_connection', $collation_connection, true, - 4, true ) . ' ' . "\n" diff --git a/libraries/display_create_database.lib.php b/libraries/display_create_database.lib.php index 2662719dc9..0f9ac15f40 100644 --- a/libraries/display_create_database.lib.php +++ b/libraries/display_create_database.lib.php @@ -36,8 +36,7 @@ if ($is_create_db_priv) { 'db_collation', null, null, - true, - 5 + true ); if (! empty($dbstats)) { diff --git a/libraries/insert_edit.lib.php b/libraries/insert_edit.lib.php index 901d9ed725..4cb8ba0aa7 100644 --- a/libraries/insert_edit.lib.php +++ b/libraries/insert_edit.lib.php @@ -267,9 +267,19 @@ function PMA_analyzeTableColumnsArray($column, $comments_map, $timestamp_seen) $column['True_Type'] = preg_replace('@\(.*@s', '', $column['Type']); $column['len'] = preg_match('@float|double@', $column['Type']) ? 100 : -1; $column['Field_title'] = PMA_getColumnTitle($column, $comments_map); - $column['is_binary'] = PMA_isColumnBinary($column); - $column['is_blob'] = PMA_isColumnBlob($column); - $column['is_char'] = PMA_isColumnChar($column); + $column['is_binary'] = PMA_isColumn( + $column, + array('binary', 'varbinary') + ); + $column['is_blob'] = PMA_isColumn( + $column, + array('blob', 'tinyblob', 'mediumblob', 'longblob') + ); + $column['is_char'] = PMA_isColumn( + $column, + array('char', 'varchar') + ); + list($column['pma_type'], $column['wrap'], $column['first_timestamp']) = PMA_getEnumSetAndTimestampColumns($column, $timestamp_seen); @@ -296,77 +306,28 @@ function PMA_getColumnTitle($column, $comments_map) } /** - * check whether the column is a binary + * check whether the column is of a certain type + * the goal is to ensure that types such as "enum('one','two','binary',..)" + * or "enum('one','two','varbinary',..)" are not categorized as binary * * @param array $column description of column in given table + * @param array $types the types to verify * - * @return boolean If check to ensure types such as "enum('one','two','binary',..)" - * or "enum('one','two','varbinary',..)" are not categorized as - * binary. + * @return boolean whether the column's type if one of the $types */ -function PMA_isColumnBinary($column) +function PMA_isColumn($column, $types) { /** @var PMA_String $pmaString */ $pmaString = $GLOBALS['PMA_String']; - // The type column. - // Fix for bug #3152931 'ENUM and SET cannot have "Binary" option' - if ($pmaString->stripos($column['Type'], 'binary') === 0 - || $pmaString->stripos($column['Type'], 'varbinary') === 0 - ) { - return stristr($column['Type'], 'binary'); - } else { - return false; + foreach ($types as $one_type) { + if ($pmaString->stripos($column['Type'], $one_type) === 0) { + return true; + } } - + return false; } - /** - * check whether the column is a blob - * - * @param array $column description of column in given table - * - * @return boolean If check to ensure types such as "enum('one','two','blob',..)" - * or "enum('one','two','tinyblob',..)" etc. are not categorized - * as blob. - */ -function PMA_isColumnBlob($column) -{ - /** @var PMA_String $pmaString */ - $pmaString = $GLOBALS['PMA_String']; - - if ($pmaString->stripos($column['Type'], 'blob') === 0 - || $pmaString->stripos($column['Type'], 'tinyblob') === 0 - || $pmaString->stripos($column['Type'], 'mediumblob') === 0 - || $pmaString->stripos($column['Type'], 'longblob') === 0 - ) { - return stristr($column['Type'], 'blob'); - } else { - return false; - } -} - -/** - * check is table column char - * - * @param array $column description of column in given table - * - * @return boolean If check to ensure types such as "enum('one','two','char',..)" or - * "enum('one','two','varchar',..)" are not categorized as char. - */ -function PMA_isColumnChar($column) -{ - /** @var PMA_String $pmaString */ - $pmaString = $GLOBALS['PMA_String']; - - if ($pmaString->stripos($column['Type'], 'char') === 0 - || $pmaString->stripos($column['Type'], 'varchar') === 0 - ) { - return stristr($column['Type'], 'char'); - } else { - return false; - } -} /** * Retrieve set, enum, timestamp table columns * diff --git a/libraries/mysql_charsets.lib.php b/libraries/mysql_charsets.lib.php index a5b3dbdfac..f01b1b5465 100644 --- a/libraries/mysql_charsets.lib.php +++ b/libraries/mysql_charsets.lib.php @@ -24,8 +24,8 @@ if (! defined('PHPMYADMIN')) { * @return string */ function PMA_generateCharsetDropdownBox($type = PMA_CSDROPDOWN_COLLATION, - $name = null, $id = null, $default = null, $label = true, $indent = 0, - $submitOnChange = false, $displayUnavailable = false + $name = null, $id = null, $default = null, $label = true, + $submitOnChange = false ) { global $mysql_charsets, $mysql_charsets_descriptions, $mysql_charsets_available, $mysql_collations, $mysql_collations_available; diff --git a/libraries/operations.lib.php b/libraries/operations.lib.php index e9097a151c..eb8132626b 100644 --- a/libraries/operations.lib.php +++ b/libraries/operations.lib.php @@ -245,8 +245,7 @@ function PMA_getHtmlForChangeDatabaseCharset($db, $table) 'db_collation', 'select_db_collation', isset($_REQUEST['db_collation']) ? $_REQUEST['db_collation'] : '', - false, - 3 + false ) . '' . '