Merge branch 'master' into master-security

This commit is contained in:
Michal Čihař 2016-06-20 17:35:42 +02:00
commit c8abc5fab6
3 changed files with 49 additions and 83 deletions

View File

@ -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);
@ -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
*
@ -627,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
@ -1260,7 +1214,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',
@ -1406,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
*
@ -1427,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);
}
/**
@ -1451,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);
}
/**
@ -2383,7 +2349,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 +2370,7 @@ class Table
*
* @return array an array of columns
*/
function getColumnsWithIndex($types)
public function getColumnsWithIndex($types)
{
$columns_with_index = array();
foreach (

View File

@ -142,11 +142,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;

View File

@ -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 <kaneawk@gmail.com>\n"
"PO-Revision-Date: 2016-06-18 09:31+0000\n"
"Last-Translator: uncle_cat <jdhao@hotmail.com>\n"
"Language-Team: Chinese (China) "
"<https://hosted.weblate.org/projects/phpmyadmin/master/zh_CN/>\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."