diff --git a/doc/config.rst b/doc/config.rst index 998061ec64..066255162e 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -1916,6 +1916,7 @@ Languages recode) * iconv - use iconv or libiconv functions * recode - use recode\_string function + * mb - use mbstring extension * none - disable encoding conversion Enabled charset conversion activates a pull-down menu in the Export diff --git a/export.php b/export.php index e17897b68c..081eddf4b3 100644 --- a/export.php +++ b/export.php @@ -324,7 +324,7 @@ function PMA_exportOutputHandler($line) ) { $dump_buffer = bzcompress($dump_buffer); } elseif ($GLOBALS['compression'] == 'gzip' - && PMA_gzencodeNeeded() + && PMA_gzencodeNeeded() ) { // as a gzipped file // without the optional parameter level because it bugs diff --git a/index.php b/index.php index ee14a67f9c..b157512239 100644 --- a/index.php +++ b/index.php @@ -575,7 +575,7 @@ if (file_exists('libraries/language_stats.inc.php')) { && $GLOBALS['language_stats'][$lang] < $cfg['TranslationWarningThreshold'] ) { trigger_error( - 'You are using an incomplete translation, please help to make it better by contributing.', + 'You are using an incomplete translation, please help to make it better by [a@http://www.phpmyadmin.net/home_page/improve.php#translate@_blank]contributing[/a].', E_USER_NOTICE ); } diff --git a/libraries/Advisor.class.php b/libraries/Advisor.class.php index f7d537197c..38ff201455 100644 --- a/libraries/Advisor.class.php +++ b/libraries/Advisor.class.php @@ -39,8 +39,8 @@ class Advisor $this->variables = array_merge( $this->variables, $GLOBALS['dbi']->fetchResult( - "SELECT concat('Com_', variable_name), variable_value " - . "FROM data_dictionary.GLOBAL_STATEMENTS", 0, 1 + "SELECT concat('Com_', variable_name), variable_value " + . "FROM data_dictionary.GLOBAL_STATEMENTS", 0, 1 ) ); } diff --git a/libraries/DatabaseInterface.class.php b/libraries/DatabaseInterface.class.php index 5f7d91e611..29502e2751 100644 --- a/libraries/DatabaseInterface.class.php +++ b/libraries/DatabaseInterface.class.php @@ -257,43 +257,7 @@ class PMA_DatabaseInterface $encoding = 'CP1252'; } - if (function_exists('iconv')) { - if ((@stristr(PHP_OS, 'AIX')) - && (@strcasecmp(ICONV_IMPL, 'unknown') == 0) - && (@strcasecmp(ICONV_VERSION, 'unknown') == 0) - ) { - include_once './libraries/iconv_wrapper.lib.php'; - $message = PMA_aix_iconv_wrapper( - $encoding, - 'utf-8' . $GLOBALS['cfg']['IconvExtraParams'], - $message - ); - } else { - $message = iconv( - $encoding, - 'utf-8' . $GLOBALS['cfg']['IconvExtraParams'], - $message - ); - } - } elseif (function_exists('recode_string')) { - $message = recode_string( - $encoding . '..' . 'utf-8', - $message - ); - } elseif (function_exists('libiconv')) { - $message = libiconv($encoding, 'utf-8', $message); - } elseif (function_exists('mb_convert_encoding')) { - // do not try unsupported charsets - if (! in_array($server_language, array('ukrainian', 'greek', 'serbian'))) { - $message = mb_convert_encoding( - $message, - 'utf-8', - $encoding - ); - } - } - - return $message; + return PMA_convertString($encoding, 'utf-8', $message); } /** @@ -619,7 +583,8 @@ class PMA_DatabaseInterface $each_tables[$table_name]['Type'] =& $each_tables[$table_name]['Engine']; } elseif (! isset($each_tables[$table_name]['Engine']) - && isset($each_tables[$table_name]['Type'])) { + && isset($each_tables[$table_name]['Type']) + ) { // old MySQL reports Type, newer MySQL reports Engine $each_tables[$table_name]['Engine'] =& $each_tables[$table_name]['Type']; diff --git a/libraries/DisplayResults.class.php b/libraries/DisplayResults.class.php index 1acf310f77..fabb04fabd 100644 --- a/libraries/DisplayResults.class.php +++ b/libraries/DisplayResults.class.php @@ -881,9 +881,9 @@ class PMA_DisplayResults * Prepare fields for table navigation * Number of rows * - * @param string $html_sql_query the sql encoded by html special - * characters - * @param string $id_for_direction_dropdown the id for the direction dropdown + * @param string $html_sql_query the sql encoded by html special + * characters + * @param string $id_for_direction_dropdown the id for the direction dropdown * * @return string $additional_fields_html html content * @@ -4212,9 +4212,9 @@ class PMA_DisplayResults { $sql_md5 = md5($this->__get('sql_query')); + $query = $_SESSION['tmp_user_values']['query'][$sql_md5]; - $_SESSION['tmp_user_values']['query'][$sql_md5]['sql'] - = $this->__get('sql_query'); + $query['sql'] = $this->__get('sql_query'); $valid_disp_dir = PMA_isValid( $_REQUEST['disp_direction'], @@ -4224,45 +4224,33 @@ class PMA_DisplayResults ); if ($valid_disp_dir) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['disp_direction'] - = $_REQUEST['disp_direction']; + $query['disp_direction'] = $_REQUEST['disp_direction']; unset($_REQUEST['disp_direction']); - } elseif ( - empty($_SESSION['tmp_user_values']['query'][$sql_md5]['disp_direction']) - ) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['disp_direction'] - = $GLOBALS['cfg']['DefaultDisplay']; + } elseif (empty($query['disp_direction'])) { + $query['disp_direction'] = $GLOBALS['cfg']['DefaultDisplay']; } - if ( - empty($_SESSION['tmp_user_values']['query'][$sql_md5]['repeat_cells']) - ) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['repeat_cells'] - = $GLOBALS['cfg']['RepeatCells']; + if (empty($query['repeat_cells'])) { + $query['repeat_cells'] = $GLOBALS['cfg']['RepeatCells']; } // as this is a form value, the type is always string so we cannot // use PMA_isValid($_REQUEST['session_max_rows'], 'integer') - if ((PMA_isValid($_REQUEST['session_max_rows'], 'numeric') - && ((int) $_REQUEST['session_max_rows'] == $_REQUEST['session_max_rows'])) - || ($_REQUEST['session_max_rows'] == self::ALL_ROWS) - ) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['max_rows'] - = $_REQUEST['session_max_rows']; + if (PMA_isValid($_REQUEST['session_max_rows'], 'numeric')) { + $query['max_rows'] = (int)$_REQUEST['session_max_rows']; unset($_REQUEST['session_max_rows']); - } elseif ( - empty($_SESSION['tmp_user_values']['query'][$sql_md5]['max_rows']) - ) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['max_rows'] - = $GLOBALS['cfg']['MaxRows']; + } elseif ($_REQUEST['session_max_rows'] == self::ALL_ROWS) { + $query['max_rows'] = self::ALL_ROWS; + unset($_REQUEST['session_max_rows']); + } elseif (empty($query['max_rows'])) { + $query['max_rows'] = $GLOBALS['cfg']['MaxRows']; } if (PMA_isValid($_REQUEST['pos'], 'numeric')) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['pos'] - = $_REQUEST['pos']; + $query['pos'] = $_REQUEST['pos']; unset($_REQUEST['pos']); - } elseif (empty($_SESSION['tmp_user_values']['query'][$sql_md5]['pos'])) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['pos'] = 0; + } elseif (empty($query['pos'])) { + $query['pos'] = 0; } if (PMA_isValid( @@ -4272,14 +4260,10 @@ class PMA_DisplayResults ) ) ) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['display_text'] - = $_REQUEST['display_text']; + $query['display_text'] = $_REQUEST['display_text']; unset($_REQUEST['display_text']); - } elseif ( - empty($_SESSION['tmp_user_values']['query'][$sql_md5]['display_text']) - ) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['display_text'] - = self::DISPLAY_PARTIAL_TEXT; + } elseif (empty($query['display_text'])) { + $query['display_text'] = self::DISPLAY_PARTIAL_TEXT; } if (PMA_isValid( @@ -4289,16 +4273,10 @@ class PMA_DisplayResults ) ) ) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['relational_display'] - = $_REQUEST['relational_display']; + $query['relational_display'] = $_REQUEST['relational_display']; unset($_REQUEST['relational_display']); - } elseif ( - empty( - $_SESSION['tmp_user_values']['query'][$sql_md5]['relational_display'] - ) - ) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['relational_display'] - = self::RELATIONAL_KEY; + } elseif (empty($query['relational_display'])) { + $query['relational_display'] = self::RELATIONAL_KEY; } if (PMA_isValid( @@ -4309,42 +4287,33 @@ class PMA_DisplayResults ) ) ) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['geometry_display'] - = $_REQUEST['geometry_display']; + $query['geometry_display'] = $_REQUEST['geometry_display']; unset($_REQUEST['geometry_display']); - } elseif ( - empty( - $_SESSION['tmp_user_values']['query'][$sql_md5]['geometry_display'] - ) - ) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['geometry_display'] - = self::GEOMETRY_DISP_GEOM; + } elseif (empty($query['geometry_display'])) { + $query['geometry_display'] = self::GEOMETRY_DISP_GEOM; } if (isset($_REQUEST['display_binary'])) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['display_binary'] = true; + $query['display_binary'] = true; unset($_REQUEST['display_binary']); } elseif (isset($_REQUEST['display_options_form'])) { // we know that the checkbox was unchecked - unset($_SESSION['tmp_user_values']['query'][$sql_md5]['display_binary']); + unset($query['display_binary']); } elseif (isset($_REQUEST['full_text_button'])) { // do nothing to keep the value that is there in the session } else { // selected by default because some operations like OPTIMIZE TABLE // and all queries involving functions return "binary" contents, // according to low-level field flags - $_SESSION['tmp_user_values']['query'][$sql_md5]['display_binary'] = true; + $query['display_binary'] = true; } if (isset($_REQUEST['display_binary_as_hex'])) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['display_binary_as_hex'] - = true; + $query['display_binary_as_hex'] = true; unset($_REQUEST['display_binary_as_hex']); } elseif (isset($_REQUEST['display_options_form'])) { // we know that the checkbox was unchecked - unset($_SESSION['tmp_user_values']['query'][$sql_md5] - ['display_binary_as_hex'] - ); + unset($query['display_binary_as_hex']); } elseif (isset($_REQUEST['full_text_button'])) { // do nothing to keep the value that is there in the session } else { @@ -4352,36 +4321,31 @@ class PMA_DisplayResults if (isset($GLOBALS['cfg']['DisplayBinaryAsHex']) && ($GLOBALS['cfg']['DisplayBinaryAsHex'] === true) ) { - $_SESSION['tmp_user_values']['query'][$sql_md5] - ['display_binary_as_hex'] = true; + $query['display_binary_as_hex'] = true; } } if (isset($_REQUEST['display_blob'])) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['display_blob'] = true; + $query['display_blob'] = true; unset($_REQUEST['display_blob']); } elseif (isset($_REQUEST['display_options_form'])) { // we know that the checkbox was unchecked - unset($_SESSION['tmp_user_values']['query'][$sql_md5]['display_blob']); + unset($query['display_blob']); } if (isset($_REQUEST['hide_transformation'])) { - $_SESSION['tmp_user_values']['query'][$sql_md5]['hide_transformation'] - = true; + $query['hide_transformation'] = true; unset($_REQUEST['hide_transformation']); } elseif (isset($_REQUEST['display_options_form'])) { // we know that the checkbox was unchecked - unset($_SESSION['tmp_user_values']['query'][$sql_md5] - ['hide_transformation'] - ); + unset($query['hide_transformation']); } // move current query to the last position, to be removed last - // so only least executed query will be removed if maximum remembered queries - // limit is reached - $tmp = $_SESSION['tmp_user_values']['query'][$sql_md5]; + // so only least executed query will be removed if maximum remembered + // queries limit is reached unset($_SESSION['tmp_user_values']['query'][$sql_md5]); - $_SESSION['tmp_user_values']['query'][$sql_md5] = $tmp; + $_SESSION['tmp_user_values']['query'][$sql_md5] = $query; // do not exceed a maximum number of queries to remember if (count($_SESSION['tmp_user_values']['query']) > 10) { @@ -4391,41 +4355,31 @@ class PMA_DisplayResults // populate query configuration $_SESSION['tmp_user_values']['display_text'] - = $_SESSION['tmp_user_values']['query'][$sql_md5]['display_text']; + = $query['display_text']; $_SESSION['tmp_user_values']['relational_display'] - = $_SESSION['tmp_user_values']['query'][$sql_md5]['relational_display']; + = $query['relational_display']; $_SESSION['tmp_user_values']['geometry_display'] - = $_SESSION['tmp_user_values']['query'][$sql_md5]['geometry_display']; - $_SESSION['tmp_user_values']['display_binary'] - = isset($_SESSION['tmp_user_values']['query'][$sql_md5] - ['display_binary'] - ) - ? true - : false; - $_SESSION['tmp_user_values']['display_binary_as_hex'] - = isset($_SESSION['tmp_user_values']['query'][$sql_md5] - ['display_binary_as_hex'] - ) - ? true - : false; - $_SESSION['tmp_user_values']['display_blob'] - = isset($_SESSION['tmp_user_values']['query'][$sql_md5]['display_blob']) - ? true - : false; - $_SESSION['tmp_user_values']['hide_transformation'] - = isset($_SESSION['tmp_user_values']['query'][$sql_md5] - ['hide_transformation'] - ) - ? true - : false; + = $query['geometry_display']; + $_SESSION['tmp_user_values']['display_binary'] = isset( + $query['display_binary'] + ); + $_SESSION['tmp_user_values']['display_binary_as_hex'] = isset( + $query['display_binary_as_hex'] + ); + $_SESSION['tmp_user_values']['display_blob'] = isset( + $query['display_blob'] + ); + $_SESSION['tmp_user_values']['hide_transformation'] = isset( + $query['hide_transformation'] + ); $_SESSION['tmp_user_values']['pos'] - = $_SESSION['tmp_user_values']['query'][$sql_md5]['pos']; + = $query['pos']; $_SESSION['tmp_user_values']['max_rows'] - = $_SESSION['tmp_user_values']['query'][$sql_md5]['max_rows']; + = $query['max_rows']; $_SESSION['tmp_user_values']['repeat_cells'] - = $_SESSION['tmp_user_values']['query'][$sql_md5]['repeat_cells']; + = $query['repeat_cells']; $_SESSION['tmp_user_values']['disp_direction'] - = $_SESSION['tmp_user_values']['query'][$sql_md5]['disp_direction']; + = $query['disp_direction']; } @@ -4447,7 +4401,8 @@ class PMA_DisplayResults * @see sql.php file */ public function getTable( - &$dt_result, &$the_disp_mode, $analyzed_sql, $is_limited_display = false + &$dt_result, &$the_disp_mode, $analyzed_sql, + $is_limited_display = false ) { $table_html = ''; diff --git a/libraries/File.class.php b/libraries/File.class.php index d20e2db5c3..c0d1dfb56a 100644 --- a/libraries/File.class.php +++ b/libraries/File.class.php @@ -247,7 +247,7 @@ class PMA_File * Loads uploaded file from table change request. * * @param string $key the md5 hash of the column name - * @param string $rownumber + * @param string $rownumber number of row to process * * @return boolean success * @access public @@ -320,8 +320,8 @@ class PMA_File * * * @param array $file the array - * @param string $rownumber - * @param string $key + * @param string $rownumber number of row to process + * @param string $key key to process * * @return array * @access public @@ -345,7 +345,7 @@ class PMA_File * sets the name if the file to the one selected in the tbl_change form * * @param string $key the md5 hash of the column name - * @param string $rownumber + * @param string $rownumber number of row to process * * @return boolean success * @access public @@ -391,7 +391,7 @@ class PMA_File * and uses the submitted/selected file * * @param string $key the md5 hash of the column name - * @param string $rownumber + * @param string $rownumber number of row to process * * @return boolean success * @access public @@ -791,7 +791,8 @@ class PMA_File $result = substr($result, 3); // UTF-16 BE, LE } elseif (strncmp($result, "\xFE\xFF", 2) == 0 - || strncmp($result, "\xFF\xFE", 2) == 0) { + || strncmp($result, "\xFF\xFE", 2) == 0 + ) { $result = substr($result, 2); } } diff --git a/libraries/Header.class.php b/libraries/Header.class.php index 905093dec5..01f750dfad 100644 --- a/libraries/Header.class.php +++ b/libraries/Header.class.php @@ -540,7 +540,9 @@ class PMA_Header $retval = ''; $retval .= ''; $retval .= ''; - $retval .= ''; + if (! $GLOBALS['cfg']['AllowThirdPartyFraming']) { + $retval .= ''; + } return $retval; } diff --git a/libraries/ServerStatusData.class.php b/libraries/ServerStatusData.class.php index 47c8c0d3a2..324493a348 100644 --- a/libraries/ServerStatusData.class.php +++ b/libraries/ServerStatusData.class.php @@ -62,7 +62,7 @@ class PMA_ServerStatusData $server_status = $GLOBALS['dbi']->fetchResult('SHOW GLOBAL STATUS', 0, 1); if (PMA_DRIZZLE) { // Drizzle doesn't put query statistics into variables, add it - $sql = "SELECT concat('Com_', variable_name), variable_value " + $sql = "SELECT concat('Com_', variable_name), variable_value " . "FROM data_dictionary.GLOBAL_STATEMENTS"; $statements = $GLOBALS['dbi']->fetchResult($sql, 0, 1); $server_status = array_merge($server_status, $statements); @@ -93,7 +93,8 @@ class PMA_ServerStatusData / $server_variables['key_buffer_size'] * 100; } elseif (isset($server_status['Key_blocks_used']) - && isset($server_variables['key_buffer_size'])) { + && isset($server_variables['key_buffer_size']) + ) { $server_status['Key_buffer_fraction_%'] = $server_status['Key_blocks_used'] * 1024 diff --git a/libraries/TableSearch.class.php b/libraries/TableSearch.class.php index d3c367fd6b..6c4b723f27 100644 --- a/libraries/TableSearch.class.php +++ b/libraries/TableSearch.class.php @@ -1378,10 +1378,10 @@ EOT; /** * Replaces a given string in a column with a give replacement * - * @param int $columnIndex index of the column - * @param string $find string to find in the column - * @param string $replaceWith string to replace with - * @param string $charSet character set of the connection + * @param int $columnIndex index of the column + * @param string $find string to find in the column + * @param string $replaceWith string to replace with + * @param string $charSet character set of the connection * * @return void */ diff --git a/libraries/Util.class.php b/libraries/Util.class.php index b1a0faf1e5..ea210f328a 100644 --- a/libraries/Util.class.php +++ b/libraries/Util.class.php @@ -1116,7 +1116,8 @@ class PMA_Util ) ); } elseif (! empty($GLOBALS['parsed_sql']) - && $query_base == $GLOBALS['parsed_sql']['raw']) { + && $query_base == $GLOBALS['parsed_sql']['raw'] + ) { // (here, use "! empty" because when deleting a bookmark, // $GLOBALS['parsed_sql'] is set but empty $parsed_sql = $GLOBALS['parsed_sql']; @@ -1743,7 +1744,8 @@ class PMA_Util ) { $tab['class'] = 'active'; } elseif (is_null($tab['active']) && empty($GLOBALS['active_page']) - && (basename($GLOBALS['PMA_PHP_SELF']) == $tab['link'])) { + && (basename($GLOBALS['PMA_PHP_SELF']) == $tab['link']) + ) { $tab['class'] = 'active'; } } @@ -2229,8 +2231,8 @@ class PMA_Util $con_val = '= ' . $row[$i]; } elseif ((($meta->type == 'blob') || ($meta->type == 'string')) // hexify only if this is a true not empty BLOB or a BINARY - && stristr($field_flags, 'BINARY') - && ! empty($row[$i]) + && stristr($field_flags, 'BINARY') + && ! empty($row[$i]) ) { // do not waste memory building a too big condition if (strlen($row[$i]) < 1000) { @@ -4264,24 +4266,16 @@ class PMA_Util } } - if ($save) { - $_SESSION['cache']['version_check'] = array( - 'response' => $response, - 'timestamp' => time() - ); - } - $data = json_decode($response); if (is_object($data) && strlen($data->version) && strlen($data->date) + && $save ) { - if ($save) { - $_SESSION['cache']['version_check'] = array( - 'response' => $response, - 'timestamp' => time() - ); - } + $_SESSION['cache']['version_check'] = array( + 'response' => $response, + 'timestamp' => time() + ); } return $data; diff --git a/libraries/charset_conversion.lib.php b/libraries/charset_conversion.lib.php index fc303f70e7..ae4ac8ac07 100644 --- a/libraries/charset_conversion.lib.php +++ b/libraries/charset_conversion.lib.php @@ -13,6 +13,7 @@ define('PMA_CHARSET_NONE', 0); define('PMA_CHARSET_ICONV', 1); define('PMA_CHARSET_RECODE', 2); define('PMA_CHARSET_ICONV_AIX', 3); +define('PMA_CHARSET_MB', 4); if (! isset($GLOBALS['cfg']['RecodingEngine'])) { $GLOBALS['cfg']['RecodingEngine'] = ''; @@ -39,6 +40,13 @@ if ($GLOBALS['cfg']['RecodingEngine'] == 'iconv') { $PMA_recoding_engine = PMA_CHARSET_NONE; PMA_warnMissingExtension('recode'); } +} elseif ($GLOBALS['cfg']['RecodingEngine'] == 'mb') { + if (@function_exists('mb_convert_encoding')) { + $PMA_recoding_engine = PMA_CHARSET_MB; + } else { + $PMA_recoding_engine = PMA_CHARSET_NONE; + PMA_warnMissingExtension('mbstring'); + } } elseif ($GLOBALS['cfg']['RecodingEngine'] == 'auto') { if (@function_exists('iconv')) { if ((@stristr(PHP_OS, 'AIX')) @@ -51,6 +59,8 @@ if ($GLOBALS['cfg']['RecodingEngine'] == 'iconv') { } } elseif (@function_exists('recode_string')) { $PMA_recoding_engine = PMA_CHARSET_RECODE; + } elseif (@function_exists('mb_convert_encoding')) { + $PMA_recoding_engine = PMA_CHARSET_MB; } else { $PMA_recoding_engine = PMA_CHARSET_NONE; } @@ -89,9 +99,13 @@ function PMA_convertString($src_charset, $dest_charset, $what) $src_charset, $dest_charset . $GLOBALS['cfg']['IconvExtraParams'], $what ); case PMA_CHARSET_ICONV_AIX: - return PMA_aix_iconv_wrapper( + return PMA_convertAIXIconv( $src_charset, $dest_charset . $GLOBALS['cfg']['IconvExtraParams'], $what ); + case PMA_CHARSET_MB: + return mb_convert_encoding( + $message, $dest_charset, $src_charset + ); default: return $what; } diff --git a/libraries/config.default.php b/libraries/config.default.php index e14bbe8213..e4bc00d46e 100644 --- a/libraries/config.default.php +++ b/libraries/config.default.php @@ -2325,6 +2325,7 @@ $cfg['FilterLanguages'] = ''; * recode) * iconv - use iconv or libiconv functions * recode - use recode_string function + * mb - use mbstring extension * none - disable encoding conversion * * @global string $cfg['RecodingEngine'] diff --git a/libraries/config.values.php b/libraries/config.values.php index 80640109d6..272883e1b9 100644 --- a/libraries/config.values.php +++ b/libraries/config.values.php @@ -32,7 +32,7 @@ $cfg_db['Servers'] = array( 'only_db' => 'array' ) ); -$cfg_db['RecodingEngine'] = array('auto', 'iconv', 'recode', 'none'); +$cfg_db['RecodingEngine'] = array('auto', 'iconv', 'recode', 'mb', 'none'); $cfg_db['OBGzip'] = array('auto', true, false); $cfg_db['MemoryLimit'] = 'short_string'; $cfg_db['NavigationLogoLinkWindow'] = array('main', 'new'); diff --git a/libraries/config/Form.class.php b/libraries/config/Form.class.php index b06be3f043..efc7076377 100644 --- a/libraries/config/Form.class.php +++ b/libraries/config/Form.class.php @@ -47,8 +47,8 @@ class Form /** * Constructor, reads default config values * - * @param string $form_name - * @param array $form + * @param string $form_name Form name + * @param array $form Form data * @param int $index arbitrary index, stored in Form::$index */ public function __construct($form_name, array $form, $index = null) diff --git a/libraries/config/FormDisplay.class.php b/libraries/config/FormDisplay.class.php index 3b155ff4e8..f7bd81ae7e 100644 --- a/libraries/config/FormDisplay.class.php +++ b/libraries/config/FormDisplay.class.php @@ -459,8 +459,8 @@ class FormDisplay /** * Validates select field and casts $value to correct type * - * @param string $value - * @param array $allowed + * @param string &$value Current value + * @param array $allowed List of allowed values * * @return bool */ @@ -743,8 +743,8 @@ class FormDisplay /** * Sets field comments and warnings based on current environment * - * @param string $system_path - * @param array $opts + * @param string $system_path Path to settings + * @param array &$opts Chosen options * * @return void */ @@ -766,6 +766,13 @@ class FormDisplay 'recode', 'recode' ); } + if (!function_exists('mb_convert_encoding')) { + $opts['values']['mb'] .= ' (' . __('unavailable') . ')'; + $comment .= ($comment ? ", " : '') . sprintf( + __('"%s" requires %s extension'), + 'mb', 'mbstring' + ); + } $opts['comment'] = $comment; $opts['comment_warning'] = true; } diff --git a/libraries/config/config_functions.lib.php b/libraries/config/config_functions.lib.php index c9029c83fa..571aa97362 100644 --- a/libraries/config/config_functions.lib.php +++ b/libraries/config/config_functions.lib.php @@ -35,9 +35,9 @@ function PMA_lang($lang_key, $args = null) /** * Returns translated field name/description or comment * - * @param string $canonical_path + * @param string $canonical_path path to handle * @param string $type 'name', 'desc' or 'cmt' - * @param mixed $default + * @param mixed $default default value * * @return string */ diff --git a/libraries/core.lib.php b/libraries/core.lib.php index fe26d3f2f3..7292477e62 100644 --- a/libraries/core.lib.php +++ b/libraries/core.lib.php @@ -515,7 +515,8 @@ function PMA_getenv($var_name) } elseif (getenv($var_name)) { return getenv($var_name); } elseif (function_exists('apache_getenv') - && apache_getenv($var_name, true)) { + && apache_getenv($var_name, true) + ) { return apache_getenv($var_name, true); } diff --git a/libraries/create_addfield.lib.php b/libraries/create_addfield.lib.php index 63a3b69f1c..3fdd68797a 100644 --- a/libraries/create_addfield.lib.php +++ b/libraries/create_addfield.lib.php @@ -50,6 +50,7 @@ function PMA_getIndexedColumns() * add columns to a existing table * * @param int $field_cnt number of columns + * @param int $field_primary primary index field * @param boolean $is_create_tbl true if requirement is to get the statement * for table creation * diff --git a/libraries/iconv_wrapper.lib.php b/libraries/iconv_wrapper.lib.php index eddb19353f..17e4fe0188 100644 --- a/libraries/iconv_wrapper.lib.php +++ b/libraries/iconv_wrapper.lib.php @@ -53,14 +53,14 @@ $gnu_iconv_to_aix_iconv_codepage_map = array ( * @access public * */ -function PMA_aix_iconv_wrapper($in_charset, $out_charset, $str) +function PMA_convertAIXIconv($in_charset, $out_charset, $str) { - list($in_charset, $out_charset) = PMA_aix_iconv_mapCharsets( + list($in_charset, $out_charset) = PMA_convertAIXMapCharsets( $in_charset, $out_charset ); // Call iconv() with the possibly modified parameters return iconv($in_charset, $out_charset, $str); -} // end of the "PMA_aix_iconv_wrapper()" function +} // end of the "PMA_convertAIXIconv()" function /** * Maps input and output character set names to corresponding AIX ones @@ -70,7 +70,7 @@ function PMA_aix_iconv_wrapper($in_charset, $out_charset, $str) * * @return array array of mapped input and output character set names */ -function PMA_aix_iconv_mapCharsets($in_charset, $out_charset) +function PMA_convertAIXMapCharsets($in_charset, $out_charset) { global $gnu_iconv_to_aix_iconv_codepage_map; diff --git a/libraries/import.lib.php b/libraries/import.lib.php index 72657b17db..7d10590bac 100644 --- a/libraries/import.lib.php +++ b/libraries/import.lib.php @@ -139,7 +139,7 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false, } $sql_query = $import_run_buffer['sql']; $sql_data['valid_sql'][] = $import_run_buffer['sql']; - if(! isset($sql_data['valid_queries'])) { + if (! isset($sql_data['valid_queries'])) { $sql_data['valid_queries'] = 0; } $sql_data['valid_queries']++; @@ -192,7 +192,7 @@ function PMA_importRunQuery($sql = '', $full = '', $controluser = false, if (($a_num_rows > 0) || $is_use_query) { $sql_data['valid_sql'][] = $import_run_buffer['sql']; - if(! isset($sql_data['valid_queries'])) { + if (! isset($sql_data['valid_queries'])) { $sql_data['valid_queries'] = 0; } $sql_data['valid_queries']++; diff --git a/libraries/plugins/import/ImportMediawiki.class.php b/libraries/plugins/import/ImportMediawiki.class.php index 48870f7018..3011b4e730 100644 --- a/libraries/plugins/import/ImportMediawiki.class.php +++ b/libraries/plugins/import/ImportMediawiki.class.php @@ -217,8 +217,8 @@ class ImportMediawiki extends ImportPlugin // End processing because the current line does not // contain any column information } elseif (substr($cur_buffer_line, 0, 2) === '|-' - || substr($cur_buffer_line, 0, 2) === '|+' - || substr($cur_buffer_line, 0, 2) === '|}' + || substr($cur_buffer_line, 0, 2) === '|+' + || substr($cur_buffer_line, 0, 2) === '|}' ) { // Check begin row or end table @@ -570,4 +570,4 @@ class ImportMediawiki extends ImportPlugin { $this->_analyze = $analyze; } -} \ No newline at end of file +} diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php index 314ec1cdc4..5b4b773281 100644 --- a/libraries/server_privileges.lib.php +++ b/libraries/server_privileges.lib.php @@ -115,8 +115,9 @@ function PMA_extractPrivInfo($row = '', $enableHTML = false) $privs[] = $current_grant[1]; } } elseif (! empty($GLOBALS[$current_grant[0]]) - && is_array($GLOBALS[$current_grant[0]]) - && empty($GLOBALS[$current_grant[0] . '_none'])) { + && is_array($GLOBALS[$current_grant[0]]) + && empty($GLOBALS[$current_grant[0] . '_none']) + ) { if ($enableHTML) { $priv_string = '' . $current_grant[1] . ''; @@ -137,9 +138,8 @@ function PMA_extractPrivInfo($row = '', $enableHTML = false) $privs[] = 'USAGE'; } } elseif ($allPrivileges - && (! isset($_POST['grant_count']) - || count($privs) == $_POST['grant_count']) - ) { + && (! isset($_POST['grant_count']) || count($privs) == $_POST['grant_count']) + ) { if ($enableHTML) { $privs = array(''; $html_output .= ''; $html_output .= '