The branch, master has been updated via 90e7b7518981cefbd2e6386b2a69b24cfb37a04a (commit) via 9317162dcc44a392a4528fcb3567ae9f801a6787 (commit) via f7d85630ed4f0ee01a77c1ec1ca34c8cc46afca2 (commit) via bc17e5eeddcfeb08b2b8e534fe8a43280771175e (commit) via 617f6f5c241470a16a102eafdcb7de0bdbc39330 (commit) via 747ab57391145c855f81efb89cd98d1c0e5b3c4a (commit) via fae95bd225f63551445f51bb4645bd8c1ea6d065 (commit) from ed1519ee76a572306bfa668e0cb72ce8e2d1bf0d (commit)
- Log ----------------------------------------------------------------- commit 90e7b7518981cefbd2e6386b2a69b24cfb37a04a Author: Michal Čihař mcihar@suse.cz Date: Mon Aug 8 17:40:00 2011 +0200
Fix indentation
commit 9317162dcc44a392a4528fcb3567ae9f801a6787 Author: Michal Čihař mcihar@suse.cz Date: Mon Aug 8 17:39:19 2011 +0200
Fix indentation
commit f7d85630ed4f0ee01a77c1ec1ca34c8cc46afca2 Author: Michal Čihař mcihar@suse.cz Date: Mon Aug 8 17:38:26 2011 +0200
Improve coding style
commit bc17e5eeddcfeb08b2b8e534fe8a43280771175e Author: Michal Čihař mcihar@suse.cz Date: Mon Aug 8 17:36:31 2011 +0200
Fix indentation
commit 617f6f5c241470a16a102eafdcb7de0bdbc39330 Author: Michal Čihař mcihar@suse.cz Date: Mon Aug 8 17:36:16 2011 +0200
Adjust switch blocks to PEAR coding standards
commit 747ab57391145c855f81efb89cd98d1c0e5b3c4a Author: Michal Čihař mcihar@suse.cz Date: Mon Aug 8 17:35:03 2011 +0200
Adjust switch blocks to PEAR coding standards
commit fae95bd225f63551445f51bb4645bd8c1ea6d065 Author: Michal Čihař mcihar@suse.cz Date: Mon Aug 8 17:33:54 2011 +0200
Fix indentation of some code blocks
-----------------------------------------------------------------------
Summary of changes: libraries/common.lib.php | 254 ++++++++++++++-------------- libraries/mysql_charsets.lib.php | 348 +++++++++++++++++++------------------- tbl_printview.php | 8 +- 3 files changed, 306 insertions(+), 304 deletions(-)
diff --git a/libraries/common.lib.php b/libraries/common.lib.php index b03e5dc..84e13b7 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -50,21 +50,21 @@ function PMA_pow($base, $exp, $use_function = false) return false; } switch ($use_function) { - case 'bcpow' : - // bcscale() needed for testing PMA_pow() with base values < 1 - bcscale(10); - $pow = bcpow($base, $exp); - break; - case 'gmp_pow' : - $pow = gmp_strval(gmp_pow($base, $exp)); - break; - case 'pow' : - $base = (float) $base; - $exp = (int) $exp; - $pow = pow($base, $exp); - break; - default: - $pow = $use_function($base, $exp); + case 'bcpow' : + // bcscale() needed for testing PMA_pow() with base values < 1 + bcscale(10); + $pow = bcpow($base, $exp); + break; + case 'gmp_pow' : + $pow = gmp_strval(gmp_pow($base, $exp)); + break; + case 'pow' : + $base = (float) $base; + $exp = (int) $exp; + $pow = pow($base, $exp); + break; + default: + $pow = $use_function($base, $exp); }
return $pow; @@ -301,23 +301,23 @@ function PMA_formatSql($parsed_sql, $unparsed_sql = '') $formatted_sql = '';
switch ($cfg['SQP']['fmtType']) { - case 'none': - if ($unparsed_sql != '') { - $formatted_sql = '<span class="inner_sql"><pre>' . "\n" - . PMA_SQP_formatNone(array('raw' => $unparsed_sql)) . "\n" - . '</pre></span>'; - } else { - $formatted_sql = PMA_SQP_formatNone($parsed_sql); - } - break; - case 'html': - $formatted_sql = PMA_SQP_formatHtml($parsed_sql, 'color'); - break; - case 'text': - $formatted_sql = PMA_SQP_formatHtml($parsed_sql, 'text'); - break; - default: - break; + case 'none': + if ($unparsed_sql != '') { + $formatted_sql = '<span class="inner_sql"><pre>' . "\n" + . PMA_SQP_formatNone(array('raw' => $unparsed_sql)) . "\n" + . '</pre></span>'; + } else { + $formatted_sql = PMA_SQP_formatNone($parsed_sql); + } + break; + case 'html': + $formatted_sql = PMA_SQP_formatHtml($parsed_sql, 'color'); + break; + case 'text': + $formatted_sql = PMA_SQP_formatHtml($parsed_sql, 'text'); + break; + default: + break; } // end switch
return $formatted_sql; @@ -350,57 +350,57 @@ function PMA_showMySQLDocu($chapter, $link, $big_icon = false, $anchor = '', $ju $link = str_replace('_', '-', strtolower($link));
switch ($cfg['MySQLManualType']) { - case 'chapters': - if (empty($chapter)) { - $chapter = 'index'; - } - if (empty($anchor)) { - $anchor = $link; - } - $url = $cfg['MySQLManualBase'] . '/' . $chapter . '.html#' . $anchor; - break; - case 'big': - if (empty($anchor)) { - $anchor = $link; - } - $url = $cfg['MySQLManualBase'] . '#' . $anchor; - break; - case 'searchable': - if (empty($link)) { - $link = 'index'; - } - $url = $cfg['MySQLManualBase'] . '/' . $link . '.html'; - if (!empty($anchor)) { - $url .= '#' . $anchor; - } - break; - case 'viewable': - default: - if (empty($link)) { - $link = 'index'; - } - $mysql = '5.0'; - $lang = 'en'; - if (defined('PMA_MYSQL_INT_VERSION')) { - if (PMA_MYSQL_INT_VERSION >= 50500) { - $mysql = '5.5'; - /* l10n: Language to use for MySQL 5.5 documentation, please use only languages which do exist in official documentation. */ - $lang = _pgettext('MySQL 5.5 documentation language', 'en'); - } else if (PMA_MYSQL_INT_VERSION >= 50100) { - $mysql = '5.1'; - /* l10n: Language to use for MySQL 5.1 documentation, please use only languages which do exist in official documentation. */ - $lang = _pgettext('MySQL 5.1 documentation language', 'en'); - } else { - $mysql = '5.0'; - /* l10n: Language to use for MySQL 5.0 documentation, please use only languages which do exist in official documentation. */ - $lang = _pgettext('MySQL 5.0 documentation language', 'en'); - } - } - $url = $cfg['MySQLManualBase'] . '/' . $mysql . '/' . $lang . '/' . $link . '.html'; - if (!empty($anchor)) { - $url .= '#' . $anchor; + case 'chapters': + if (empty($chapter)) { + $chapter = 'index'; + } + if (empty($anchor)) { + $anchor = $link; + } + $url = $cfg['MySQLManualBase'] . '/' . $chapter . '.html#' . $anchor; + break; + case 'big': + if (empty($anchor)) { + $anchor = $link; + } + $url = $cfg['MySQLManualBase'] . '#' . $anchor; + break; + case 'searchable': + if (empty($link)) { + $link = 'index'; + } + $url = $cfg['MySQLManualBase'] . '/' . $link . '.html'; + if (!empty($anchor)) { + $url .= '#' . $anchor; + } + break; + case 'viewable': + default: + if (empty($link)) { + $link = 'index'; + } + $mysql = '5.0'; + $lang = 'en'; + if (defined('PMA_MYSQL_INT_VERSION')) { + if (PMA_MYSQL_INT_VERSION >= 50500) { + $mysql = '5.5'; + /* l10n: Language to use for MySQL 5.5 documentation, please use only languages which do exist in official documentation. */ + $lang = _pgettext('MySQL 5.5 documentation language', 'en'); + } else if (PMA_MYSQL_INT_VERSION >= 50100) { + $mysql = '5.1'; + /* l10n: Language to use for MySQL 5.1 documentation, please use only languages which do exist in official documentation. */ + $lang = _pgettext('MySQL 5.1 documentation language', 'en'); + } else { + $mysql = '5.0'; + /* l10n: Language to use for MySQL 5.0 documentation, please use only languages which do exist in official documentation. */ + $lang = _pgettext('MySQL 5.0 documentation language', 'en'); } - break; + } + $url = $cfg['MySQLManualBase'] . '/' . $mysql . '/' . $lang . '/' . $link . '.html'; + if (!empty($anchor)) { + $url .= '#' . $anchor; + } + break; }
$open_link = '<a href="' . PMA_linkURL($url) . '" target="mysql_doc">'; @@ -615,14 +615,14 @@ function PMA_mysqlDie($error_message = '', $the_query = '', $_SESSION['Import_message']['message'] = $error_msg_output;
if ($exit) { - /** - * If in an Ajax request - * - avoid displaying a Back link - * - use PMA_ajaxResponse() to transmit the message and exit - */ - if ($GLOBALS['is_ajax_request'] == true) { - PMA_ajaxResponse($error_msg_output, false); - } + /** + * If in an Ajax request + * - avoid displaying a Back link + * - use PMA_ajaxResponse() to transmit the message and exit + */ + if ($GLOBALS['is_ajax_request'] == true) { + PMA_ajaxResponse($error_msg_output, false); + } if (! empty($back_url)) { if (strstr($back_url, '?')) { $back_url .= '&no_history=true'; @@ -635,13 +635,13 @@ function PMA_mysqlDie($error_message = '', $the_query = '', $error_msg_output .= '<fieldset class="tblFooters">'; $error_msg_output .= '[ <a href="' . $back_url . '">' . __('Back') . '</a> ]'; $error_msg_output .= '</fieldset>' . "\n\n"; - } + }
- echo $error_msg_output; - /** - * display footer and exit - */ - require './libraries/footer.inc.php'; + echo $error_msg_output; + /** + * display footer and exit + */ + require './libraries/footer.inc.php'; } else { echo $error_msg_output; } @@ -855,8 +855,9 @@ function PMA_reloadNavigation($jsonly=false) unset($_SESSION['tmp_user_values']['table_limit_offset']); echo "\n"; $reload_url = './navigation.php?' . PMA_generate_common_url($GLOBALS['db'], '', '&'); - if (!$jsonly) - echo '<script type="text/javascript">' . PHP_EOL; + if (!$jsonly) { + echo '<script type="text/javascript">' . PHP_EOL; + } ?> //<![CDATA[ if (typeof(window.parent) != 'undefined' @@ -866,8 +867,9 @@ if (typeof(window.parent) != 'undefined' } //]]> <?php -if (!$jsonly) - echo '</script>' . PHP_EOL; + if (!$jsonly) { + echo '</script>' . PHP_EOL; + }
unset($GLOBALS['reload']); } @@ -1204,8 +1206,8 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view // mode because 1) it currently does not work and 2) we would // have two similar mechanisms on the page for the same goal if ($is_select || $GLOBALS['is_ajax_request'] === false && ! $query_too_big) { - // see in js/functions.js the jQuery code attached to id inline_edit - // document.write conflicts with jQuery, hence used $().append() + // see in js/functions.js the jQuery code attached to id inline_edit + // document.write conflicts with jQuery, hence used $().append() echo "<script type="text/javascript">\n" . "//<![CDATA[\n" . "$('.tools form').last().after('[<a href="#" title="" . @@ -1497,44 +1499,44 @@ function PMA_extractValueFromFormattedSize($formatted_size) function PMA_localisedDate($timestamp = -1, $format = '') { $month = array( -/* l10n: Short month name */ + /* l10n: Short month name */ __('Jan'), -/* l10n: Short month name */ + /* l10n: Short month name */ __('Feb'), -/* l10n: Short month name */ + /* l10n: Short month name */ __('Mar'), -/* l10n: Short month name */ + /* l10n: Short month name */ __('Apr'), -/* l10n: Short month name */ + /* l10n: Short month name */ _pgettext('Short month name', 'May'), -/* l10n: Short month name */ + /* l10n: Short month name */ __('Jun'), -/* l10n: Short month name */ + /* l10n: Short month name */ __('Jul'), -/* l10n: Short month name */ + /* l10n: Short month name */ __('Aug'), -/* l10n: Short month name */ + /* l10n: Short month name */ __('Sep'), -/* l10n: Short month name */ + /* l10n: Short month name */ __('Oct'), -/* l10n: Short month name */ + /* l10n: Short month name */ __('Nov'), -/* l10n: Short month name */ + /* l10n: Short month name */ __('Dec')); $day_of_week = array( -/* l10n: Short week day name */ + /* l10n: Short week day name */ _pgettext('Short week day name', 'Sun'), -/* l10n: Short week day name */ + /* l10n: Short week day name */ __('Mon'), -/* l10n: Short week day name */ + /* l10n: Short week day name */ __('Tue'), -/* l10n: Short week day name */ + /* l10n: Short week day name */ __('Wed'), -/* l10n: Short week day name */ + /* l10n: Short week day name */ __('Thu'), -/* l10n: Short week day name */ + /* l10n: Short week day name */ __('Fri'), -/* l10n: Short week day name */ + /* l10n: Short week day name */ __('Sat'));
if ($format == '') { @@ -2700,13 +2702,13 @@ function PMA_extractFieldSpec($fieldspec) if (! $in_string) { $in_string = true; $working = ""; - // Otherwise, it may be either an end of a string, or a 'double quote' which can be handled as-is } else { - // Check out the next character (if possible) + // Otherwise, it may be either an end of a string, or a 'double quote' which can be handled as-is + // Check out the next character (if possible) $has_next = isset($fieldspec[$index + 1]); $next = $has_next ? $fieldspec[$index + 1] : null;
- // If we have reached the end of our 'working' string (because there are no more chars, or the next char is not another quote) + // If we have reached the end of our 'working' string (because there are no more chars, or the next char is not another quote) if (! $has_next || $next != "'") { $enum_set_values[] = $working; $in_string = false; @@ -2718,12 +2720,12 @@ function PMA_extractFieldSpec($fieldspec) $index++; } } - // escaping of a quote? } elseif ('\' == $char && isset($fieldspec[$index + 1]) && "'" == $fieldspec[$index + 1]) { + // escaping of a quote? $working .= "'"; $index++; - // Otherwise, add it to our working string like normal } else { + // Otherwise, add it to our working string like normal $working .= $char; } // Increment character index diff --git a/libraries/mysql_charsets.lib.php b/libraries/mysql_charsets.lib.php index 45f9255..05a5c3b 100644 --- a/libraries/mysql_charsets.lib.php +++ b/libraries/mysql_charsets.lib.php @@ -210,200 +210,200 @@ function PMA_getCollationDescr($collation) } $descr = ''; switch ($parts[1]) { - case 'bulgarian': - $descr = __('Bulgarian'); - break; - case 'chinese': - if ($parts[0] == 'gb2312' || $parts[0] == 'gbk') { - $descr = __('Simplified Chinese'); - } elseif ($parts[0] == 'big5') { - $descr = __('Traditional Chinese'); - } - break; - case 'ci': - $descr = __('case-insensitive'); - break; - case 'cs': - $descr = __('case-sensitive'); - break; - case 'croatian': - $descr = __('Croatian'); - break; - case 'czech': - $descr = __('Czech'); - break; - case 'danish': - $descr = __('Danish'); - break; - case 'english': - $descr = __('English'); - break; - case 'esperanto': - $descr = __('Esperanto'); - break; - case 'estonian': - $descr = __('Estonian'); - break; - case 'german1': - $descr = __('German') . ' (' . __('dictionary') . ')'; + case 'bulgarian': + $descr = __('Bulgarian'); + break; + case 'chinese': + if ($parts[0] == 'gb2312' || $parts[0] == 'gbk') { + $descr = __('Simplified Chinese'); + } elseif ($parts[0] == 'big5') { + $descr = __('Traditional Chinese'); + } + break; + case 'ci': + $descr = __('case-insensitive'); + break; + case 'cs': + $descr = __('case-sensitive'); + break; + case 'croatian': + $descr = __('Croatian'); + break; + case 'czech': + $descr = __('Czech'); + break; + case 'danish': + $descr = __('Danish'); + break; + case 'english': + $descr = __('English'); + break; + case 'esperanto': + $descr = __('Esperanto'); + break; + case 'estonian': + $descr = __('Estonian'); + break; + case 'german1': + $descr = __('German') . ' (' . __('dictionary') . ')'; + break; + case 'german2': + $descr = __('German') . ' (' . __('phone book') . ')'; + break; + case 'hungarian': + $descr = __('Hungarian'); + break; + case 'icelandic': + $descr = __('Icelandic'); + break; + case 'japanese': + $descr = __('Japanese'); + break; + case 'latvian': + $descr = __('Latvian'); + break; + case 'lithuanian': + $descr = __('Lithuanian'); + break; + case 'korean': + $descr = __('Korean'); + break; + case 'persian': + $descr = __('Persian'); + break; + case 'polish': + $descr = __('Polish'); + break; + case 'roman': + $descr = __('West European'); + break; + case 'romanian': + $descr = __('Romanian'); + break; + case 'slovak': + $descr = __('Slovak'); + break; + case 'slovenian': + $descr = __('Slovenian'); + break; + case 'spanish': + $descr = __('Spanish'); + break; + case 'spanish2': + $descr = __('Traditional Spanish'); + break; + case 'swedish': + $descr = __('Swedish'); + break; + case 'thai': + $descr = __('Thai'); + break; + case 'turkish': + $descr = __('Turkish'); + break; + case 'ukrainian': + $descr = __('Ukrainian'); + break; + case 'unicode': + $descr = __('Unicode') . ' (' . __('multilingual') . ')'; + break; + case 'bin': + $is_bin = true; + case 'general': + switch ($parts[0]) { + // Unicode charsets + case 'ucs2': + case 'utf8': + $descr = __('Unicode') . ' (' . __('multilingual') . ')'; break; - case 'german2': - $descr = __('German') . ' (' . __('phone book') . ')'; + // West European charsets + case 'ascii': + case 'cp850': + case 'dec8': + case 'hp8': + case 'latin1': + case 'macroman': + $descr = __('West European') . ' (' . __('multilingual') . ')'; + break; + // Central European charsets + case 'cp1250': + case 'cp852': + case 'latin2': + case 'macce': + $descr = __('Central European') . ' (' . __('multilingual') . ')'; + break; + // Russian charsets + case 'cp866': + case 'koi8r': + $descr = __('Russian'); + break; + // Simplified Chinese charsets + case 'gb2312': + case 'gbk': + $descr = __('Simplified Chinese'); + break; + // Japanese charsets + case 'sjis': + case 'ujis': + case 'cp932': + case 'eucjpms': + $descr = __('Japanese'); break; - case 'hungarian': - $descr = __('Hungarian'); + // Baltic charsets + case 'cp1257': + case 'latin7': + $descr = __('Baltic') . ' (' . __('multilingual') . ')'; break; - case 'icelandic': - $descr = __('Icelandic'); + // Other + case 'armscii8': + case 'armscii': + $descr = __('Armenian'); break; - case 'japanese': - $descr = __('Japanese'); + case 'big5': + $descr = __('Traditional Chinese'); break; - case 'latvian': - $descr = __('Latvian'); + case 'cp1251': + $descr = __('Cyrillic') . ' (' . __('multilingual') . ')'; break; - case 'lithuanian': - $descr = __('Lithuanian'); + case 'cp1256': + $descr = __('Arabic'); break; - case 'korean': + case 'euckr': $descr = __('Korean'); break; - case 'persian': - $descr = __('Persian'); + case 'hebrew': + $descr = __('Hebrew'); break; - case 'polish': - $descr = __('Polish'); + case 'geostd8': + $descr = __('Georgian'); break; - case 'roman': - $descr = __('West European'); + case 'greek': + $descr = __('Greek'); break; - case 'romanian': - $descr = __('Romanian'); + case 'keybcs2': + $descr = __('Czech-Slovak'); break; - case 'slovak': - $descr = __('Slovak'); - break; - case 'slovenian': - $descr = __('Slovenian'); - break; - case 'spanish': - $descr = __('Spanish'); + case 'koi8u': + $descr = __('Ukrainian'); break; - case 'spanish2': - $descr = __('Traditional Spanish'); + case 'latin5': + $descr = __('Turkish'); break; - case 'swedish': + case 'swe7': $descr = __('Swedish'); break; - case 'thai': + case 'tis620': $descr = __('Thai'); break; - case 'turkish': - $descr = __('Turkish'); - break; - case 'ukrainian': - $descr = __('Ukrainian'); - break; - case 'unicode': - $descr = __('Unicode') . ' (' . __('multilingual') . ')'; + default: + $descr = __('unknown'); break; - case 'bin': - $is_bin = true; - case 'general': - switch ($parts[0]) { - // Unicode charsets - case 'ucs2': - case 'utf8': - $descr = __('Unicode') . ' (' . __('multilingual') . ')'; - break; - // West European charsets - case 'ascii': - case 'cp850': - case 'dec8': - case 'hp8': - case 'latin1': - case 'macroman': - $descr = __('West European') . ' (' . __('multilingual') . ')'; - break; - // Central European charsets - case 'cp1250': - case 'cp852': - case 'latin2': - case 'macce': - $descr = __('Central European') . ' (' . __('multilingual') . ')'; - break; - // Russian charsets - case 'cp866': - case 'koi8r': - $descr = __('Russian'); - break; - // Simplified Chinese charsets - case 'gb2312': - case 'gbk': - $descr = __('Simplified Chinese'); - break; - // Japanese charsets - case 'sjis': - case 'ujis': - case 'cp932': - case 'eucjpms': - $descr = __('Japanese'); - break; - // Baltic charsets - case 'cp1257': - case 'latin7': - $descr = __('Baltic') . ' (' . __('multilingual') . ')'; - break; - // Other - case 'armscii8': - case 'armscii': - $descr = __('Armenian'); - break; - case 'big5': - $descr = __('Traditional Chinese'); - break; - case 'cp1251': - $descr = __('Cyrillic') . ' (' . __('multilingual') . ')'; - break; - case 'cp1256': - $descr = __('Arabic'); - break; - case 'euckr': - $descr = __('Korean'); - break; - case 'hebrew': - $descr = __('Hebrew'); - break; - case 'geostd8': - $descr = __('Georgian'); - break; - case 'greek': - $descr = __('Greek'); - break; - case 'keybcs2': - $descr = __('Czech-Slovak'); - break; - case 'koi8u': - $descr = __('Ukrainian'); - break; - case 'latin5': - $descr = __('Turkish'); - break; - case 'swe7': - $descr = __('Swedish'); - break; - case 'tis620': - $descr = __('Thai'); - break; - default: - $descr = __('unknown'); - break; - } - if (!empty($is_bin)) { - $descr .= ', ' . __('Binary'); - } - break; - default: $descr = __('unknown'); + } + if (!empty($is_bin)) { + $descr .= ', ' . __('Binary'); + } + break; + default: $descr = __('unknown'); } if (!empty($parts[2])) { if ($parts[2] == 'ci') { diff --git a/tbl_printview.php b/tbl_printview.php index 068cfbc..a8eb5d6 100644 --- a/tbl_printview.php +++ b/tbl_printview.php @@ -101,10 +101,10 @@ foreach ($the_tables as $key => $table) { $columns = PMA_DBI_get_columns($db, $table);
-// We need this to correctly learn if a TIMESTAMP is NOT NULL, since -// SHOW FULL FIELDS or INFORMATION_SCHEMA incorrectly says NULL -// and SHOW CREATE TABLE says NOT NULL (tested -// in MySQL 4.0.25 and 5.0.21, http://bugs.mysql.com/20910). + // We need this to correctly learn if a TIMESTAMP is NOT NULL, since + // SHOW FULL FIELDS or INFORMATION_SCHEMA incorrectly says NULL + // and SHOW CREATE TABLE says NOT NULL (tested + // in MySQL 4.0.25 and 5.0.21, http://bugs.mysql.com/20910).
$show_create_table = PMA_DBI_fetch_value( 'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table),
hooks/post-receive