From 2674e503f2761cdee895b8f0e28841e67faefbc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 20 Jun 2016 12:07:13 +0200 Subject: [PATCH 1/7] Assign helperFunctions before doing extract MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This way we avoid possiblity of rewriting it from within the context. Signed-off-by: Michal Čihař --- libraries/Template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Template.php b/libraries/Template.php index 73d3a400f5..6f2faa0e6b 100644 --- a/libraries/Template.php +++ b/libraries/Template.php @@ -143,11 +143,11 @@ class Template $template = static::BASE_PATH . $this->name . '.phtml'; try { $this->set($data); - extract($this->data); $this->helperFunctions = array_merge( $this->helperFunctions, $helperFunctions ); + extract($this->data); ob_start(); if (file_exists($template)) { include $template; From 8c17e279620e952e9f09dba44059e181dab69e94 Mon Sep 17 00:00:00 2001 From: uncle_cat Date: Sat, 18 Jun 2016 09:31:28 +0000 Subject: [PATCH 2/7] Translated using Weblate (Chinese (China)) Currently translated at 87.7% (2816 of 3208 strings) [CI skip] --- po/zh_CN.po | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/po/zh_CN.po b/po/zh_CN.po index fc94446c38..d33e64ac6e 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -4,8 +4,8 @@ msgstr "" "Project-Id-Version: phpMyAdmin 4.7.0-dev\n" "Report-Msgid-Bugs-To: translators@phpmyadmin.net\n" "POT-Creation-Date: 2016-05-23 14:30+0200\n" -"PO-Revision-Date: 2016-05-31 13:48+0000\n" -"Last-Translator: Charles Kane \n" +"PO-Revision-Date: 2016-06-18 09:31+0000\n" +"Last-Translator: uncle_cat \n" "Language-Team: Chinese (China) " "\n" "Language: zh_CN\n" @@ -2445,6 +2445,7 @@ msgid "Time taken:" msgstr "用时:" #: js/messages.php:712 +#, fuzzy msgid "" "There was a problem accessing your browser storage, some features may not " "work properly for you. It is likely that the browser doesn't support storage " @@ -2452,6 +2453,9 @@ msgid "" "cause such a problem, clearing your \"Offline Website Data\" might help. In " "Safari, such problem is commonly caused by \"Private Mode Browsing\"." msgstr "" +"查看你的浏览器保存数据时出现错误,因此一些功能可能不能正常工作。造成这个问题的原因可能是你的浏览器不支持保存数据或者浏览器能够保存的数据达到极限。另外对于" +"Firefox浏览器,这个问题可能是由于浏览器存储数据被损坏导致,清理浏览器的“离线网站数据”可能会解决这个问题。对于Safari浏览器,这个问题通常是由" +"于“隐私浏览模式”导致的。" #: js/messages.php:714 msgid "Copy tables to" @@ -2949,7 +2953,7 @@ msgstr "朝鲜语" #: libraries/Charsets.php:313 msgid "Burmese" -msgstr "" +msgstr "缅甸语" #: libraries/Charsets.php:316 msgid "Persian" @@ -3069,16 +3073,14 @@ msgid "binary collation" msgstr "排序规则" #: libraries/Charsets.php:467 -#, fuzzy #| msgid "case-insensitive" msgid "case-insensitive collation" -msgstr "不区分大小写" +msgstr "不区分大小写的排序" #: libraries/Charsets.php:469 -#, fuzzy #| msgid "case-sensitive" msgid "case-sensitive collation" -msgstr "区分大小写" +msgstr "区分大小写的排序" #: libraries/Config.php:1155 #, php-format @@ -5297,8 +5299,7 @@ msgstr "高亮指针" #| "Enable [a@http://en.wikipedia.org/wiki/Bzip2]bzip2[/a] compression for " #| "import operations." msgid "Enable bzip2 compression for import operations." -msgstr "" -"允许在导入和导出时使用 [a@http://zh.wikipedia.org/wiki/Bzip2]bzip2[/a] 压缩。" +msgstr "允许在导入的时候使用bzip2进行压缩" #: libraries/config/messages.inc.php:50 msgid "Bzip2" @@ -6496,10 +6497,9 @@ msgid "Show row links anyway" msgstr "始终显示行链接" #: libraries/config/messages.inc.php:552 libraries/config/messages.inc.php:553 -#, fuzzy #| msgid "Disable foreign key checks" msgid "Disable shortcut keys" -msgstr "禁止外键约束" +msgstr "禁止快捷键" #: libraries/config/messages.inc.php:555 msgid "Use natural order for sorting table and database names." From 04590894069e2c1ccaaed3b80907cf7d55785170 Mon Sep 17 00:00:00 2001 From: uncle_cat Date: Sat, 18 Jun 2016 09:30:12 +0000 Subject: [PATCH 3/7] Translated using Weblate (Chinese (China)) Currently translated at 88.0% (2824 of 3209 strings) [CI skip] --- po/zh_CN.po | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/po/zh_CN.po b/po/zh_CN.po index 4003b73069..dfef2def99 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -4,8 +4,8 @@ msgstr "" "Project-Id-Version: phpMyAdmin 4.6.2-dev\n" "Report-Msgid-Bugs-To: translators@phpmyadmin.net\n" "POT-Creation-Date: 2016-05-23 14:29+0200\n" -"PO-Revision-Date: 2016-05-31 13:48+0000\n" -"Last-Translator: Charles Kane \n" +"PO-Revision-Date: 2016-06-18 09:30+0000\n" +"Last-Translator: uncle_cat \n" "Language-Team: Chinese (China) " "\n" "Language: zh_CN\n" @@ -2464,6 +2464,7 @@ msgid "Time taken:" msgstr "用时:" #: js/messages.php:709 +#, fuzzy msgid "" "There was a problem accessing your browser storage, some features may not " "work properly for you. It is likely that the browser doesn't support storage " @@ -2471,6 +2472,9 @@ msgid "" "cause such a problem, clearing your \"Offline Website Data\" might help. In " "Safari, such problem is commonly caused by \"Private Mode Browsing\"." msgstr "" +"查看你的浏览器保存数据时出现错误,因此一些功能可能不能正常工作。造成这个问题的原因可能是你的浏览器不支持保存数据或者浏览器能够保存的数据达到极限。另外对于" +"Firefox浏览器,这个问题可能是由于浏览器存储数据被损坏导致,清理浏览器的“离线网站数据”可能会解决这个问题。对于Safari浏览器,这个问题通常是由" +"于“隐私浏览模式”导致的。" #: js/messages.php:711 msgid "Copy tables to" @@ -5230,8 +5234,7 @@ msgstr "高亮指针" #| "Enable [a@http://en.wikipedia.org/wiki/Bzip2]bzip2[/a] compression for " #| "import operations." msgid "Enable bzip2 compression for import operations." -msgstr "" -"允许在导入和导出时使用 [a@http://zh.wikipedia.org/wiki/Bzip2]bzip2[/a] 压缩。" +msgstr "允许在导入的时候使用bzip2进行压缩" #: libraries/config/messages.inc.php:50 msgid "Bzip2" From 2a9123fe10562672814800b1064f7a1972c1da69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 20 Jun 2016 17:17:56 +0200 Subject: [PATCH 4/7] Define visibility for public methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- libraries/Table.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libraries/Table.php b/libraries/Table.php index e9909001c7..fb5d858711 100644 --- a/libraries/Table.php +++ b/libraries/Table.php @@ -76,7 +76,7 @@ class Table * @param string $db_name database name * @param DatabaseInterface $dbi database interface for the table */ - function __construct($table_name, $db_name, DatabaseInterface $dbi = null) + public function __construct($table_name, $db_name, DatabaseInterface $dbi = null) { if (empty($dbi)) { $dbi = $GLOBALS['dbi']; @@ -92,7 +92,7 @@ class Table * @see Table::getName() * @return string table name */ - function __toString() + public function __toString() { return $this->getName(); } @@ -102,7 +102,7 @@ class Table * * @return string the last error */ - function getLastError() + public function getLastError() { return end($this->errors); } @@ -112,7 +112,7 @@ class Table * * @return string the last message */ - function getLastMessage() + public function getLastMessage() { return end($this->messages); } @@ -124,7 +124,7 @@ class Table * * @return string table name */ - function getName($backquoted = false) + public function getName($backquoted = false) { if ($backquoted) { return Util::backquote($this->_name); @@ -139,7 +139,7 @@ class Table * * @return string database name for this table */ - function getDbName($backquoted = false) + public function getDbName($backquoted = false) { if ($backquoted) { return Util::backquote($this->_db_name); @@ -154,7 +154,7 @@ class Table * * @return string */ - function getFullName($backquoted = false) + public function getFullName($backquoted = false) { return $this->getDbName($backquoted) . '.' . $this->getName($backquoted); @@ -1260,7 +1260,7 @@ class Table * * @return bool success */ - function rename($new_name, $new_db = null) + public function rename($new_name, $new_db = null) { $lowerCaseTableNames = Util::cacheGet( 'lower_case_table_names', @@ -2383,7 +2383,7 @@ class Table * * @return number */ - function getRealRowCountTable() + public function getRealRowCountTable() { // SQL query to get row count for a table. $result = $this->_dbi->fetchSingleRow( @@ -2404,7 +2404,7 @@ class Table * * @return array an array of columns */ - function getColumnsWithIndex($types) + public function getColumnsWithIndex($types) { $columns_with_index = array(); foreach ( From 3606276e56e5005462d43295e314209e2571eb8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 20 Jun 2016 17:19:59 +0200 Subject: [PATCH 5/7] Remove unused method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- libraries/Table.php | 46 --------------------------------------------- 1 file changed, 46 deletions(-) diff --git a/libraries/Table.php b/libraries/Table.php index fb5d858711..d665114bfb 100644 --- a/libraries/Table.php +++ b/libraries/Table.php @@ -217,52 +217,6 @@ class Table return $result ? true : false; } - /** - * Returns the analysis of 'SHOW CREATE TABLE' query for the table. - * In case of a view, the values are taken from the information_schema. - * - * @return array analysis of 'SHOW CREATE TABLE' query for the table - */ - public function analyzeStructure() - { - if (empty($this->_db_name) || empty($this->_name)) { - return false; - } - - $analyzed_sql = array(); - if ($this->isView()) { - // For a view, 'SHOW CREATE TABLE' returns the definition, - // but the structure of the view. So, we try to mock - // the result of analyzing 'SHOW CREATE TABLE' query. - $analyzed_sql[0] = array(); - $analyzed_sql[0]['create_table_fields'] = array(); - - $results = $this->_dbi->fetchResult( - "SELECT COLUMN_NAME, DATA_TYPE - FROM information_schema.COLUMNS - WHERE TABLE_SCHEMA = '" . Util::sqlAddSlashes($this->_db_name) - . " AND TABLE_NAME = '" . Util::sqlAddSlashes($this->_name) . "'" - ); - - foreach ($results as $result) { - $analyzed_sql[0]['create_table_fields'][$result['COLUMN_NAME']] - = array( - 'type' => mb_strtoupper($result['DATA_TYPE']) - ); - } - } else { - $show_create_table = $this->_dbi->fetchValue( - 'SHOW CREATE TABLE ' - . Util::backquote($this->_db_name) - . '.' . Util::backquote($this->_name), - 0, - 1 - ); - $analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table)); - } - return $analyzed_sql; - } - /** * Checks if this is a merge table * From bdb1e7af4ee5f12df52faf639d785e61f9199f8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 20 Jun 2016 17:21:23 +0200 Subject: [PATCH 6/7] Clarify return value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- libraries/Table.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Table.php b/libraries/Table.php index d665114bfb..6a0e3c08f0 100644 --- a/libraries/Table.php +++ b/libraries/Table.php @@ -581,7 +581,7 @@ class Table * * @global relation variable * - * @return int|true + * @return int|boolean */ static public function duplicateInfo($work, $pma_table, $get_fields, $where_fields, $new_fields From fac96d342f77b79ffbf44a3ebe83d5506b477a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 20 Jun 2016 17:24:22 +0200 Subject: [PATCH 7/7] Share code for columns formatting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- libraries/Table.php | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/libraries/Table.php b/libraries/Table.php index 6a0e3c08f0..bdbbcc6c0c 100644 --- a/libraries/Table.php +++ b/libraries/Table.php @@ -1360,6 +1360,30 @@ class Table return $return; } + /** + * Formats lists of columns + * + * returns an array with all columns that make use of an index + * + * e.g. index(col1, col2) would return col1, col2 + * + * @param array $indexed column data + * @param bool $backquoted whether to quote name with backticks `` + * @param bool $fullName whether to include full name of the table as a prefix + * + * @return array + */ + private function _formatColumns($indexed, $backquoted, $fullName) + { + $return = array(); + foreach ($indexed as $column) { + $return[] = ($fullName ? $this->getFullName($backquoted) . '.' : '') + . ($backquoted ? Util::backquote($column) : $column); + } + + return $return; + } + /** * Get all indexed columns * @@ -1381,13 +1405,7 @@ class Table ); $indexed = $this->_dbi->fetchResult($sql, 'Column_name', 'Column_name'); - $return = array(); - foreach ($indexed as $column) { - $return[] = ($fullName ? $this->getFullName($backquoted) . '.' : '') - . ($backquoted ? Util::backquote($column) : $column); - } - - return $return; + return $this->_formatColumns($indexed, $backquoted, $fullName); } /** @@ -1405,13 +1423,7 @@ class Table $sql = 'SHOW COLUMNS FROM ' . $this->getFullName(true); $indexed = $this->_dbi->fetchResult($sql, 'Field', 'Field'); - $return = array(); - foreach ($indexed as $column) { - $return[] = ($fullName ? $this->getFullName($backquoted) . '.' : '') - . ($backquoted ? Util::backquote($column) : $column); - } - - return $return; + return $this->_formatColumns($indexed, $backquoted, $fullName); } /**