Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2017-09-04 15:08:03 +02:00
commit 17821c2bcb
4 changed files with 40 additions and 19 deletions

View File

@ -41,6 +41,8 @@ phpMyAdmin - ChangeLog
- issue #13628 Fixed javascript error in server monitor
- issue #13444 Fixed server monitor on non Linux and Windows systems
- issue #13633 Reload javscript messages when changing language
- issue #13604 Fixed crash on invalid ordering data
- issue #13639 Fixed error when browsing non SELECT results
4.7.4 (2017-08-23)
- issue #13415 Remove shadow from the logo

View File

@ -1307,9 +1307,7 @@ class DisplayResults
. '</div>';
// Output data needed for column reordering and show/hide column
if ($this->_isSelect($analyzed_sql_results)) {
$table_headers_html .= $this->_getDataForResettingColumnOrder();
}
$table_headers_html .= $this->_getDataForResettingColumnOrder($analyzed_sql_results);
$display_params['emptypre'] = 0;
$display_params['emptyafter'] = 0;
@ -1650,28 +1648,32 @@ class DisplayResults
/**
* Prepare data for column restoring and show/hide
*
* @param array $analyzed_sql_results analyzed sql results
*
* @return string $data_html html content
*
* @access private
*
* @see _getTableHeaders()
*/
private function _getDataForResettingColumnOrder()
private function _getDataForResettingColumnOrder($analyzed_sql_results)
{
$data_html = '';
if (! $this->_isSelect($analyzed_sql_results)) {
return '';
}
// generate the column order, if it is set
$pmatable = new Table($this->__get('table'), $this->__get('db'));
$col_order = $pmatable->getUiProp(Table::PROP_COLUMN_ORDER);
list($col_order, $col_visib) = $this->_getColumnParams(
$analyzed_sql_results
);
$data_html = '';
if ($col_order) {
$data_html .= '<input class="col_order" type="hidden" value="'
. implode(',', $col_order) . '" />';
}
$col_visib = $pmatable->getUiProp(Table::PROP_COLUMN_VISIB);
if ($col_visib) {
$data_html .= '<input class="col_visib" type="hidden" value="'
. implode(',', $col_visib) . '" />';
@ -3393,6 +3395,16 @@ class DisplayResults
if ($this->_isSelect($analyzed_sql_results)) {
$pmatable = new Table($this->__get('table'), $this->__get('db'));
$col_order = $pmatable->getUiProp(Table::PROP_COLUMN_ORDER);
/* Validate the value */
if ($col_order !== false) {
$fields_cnt = $this->__get('fields_cnt');
foreach ($col_order as $value) {
if ($value >= $fields_cnt) {
$this->removeUiProp(Table::PROP_COLUMN_ORDER);
$fields_cnt = false;
}
}
}
$col_visib = $pmatable->getUiProp(Table::PROP_COLUMN_VISIB);
} else {
$col_order = false;
@ -4243,7 +4255,11 @@ class DisplayResults
* The statement this table is built for.
* @var \PhpMyAdmin\SqlParser\Statements\SelectStatement
*/
$statement = $analyzed_sql_results['statement'];
if (isset($analyzed_sql_results['statement'])) {
$statement = $analyzed_sql_results['statement'];
} else {
$statement = null;
}
$table_html = '';
// Following variable are needed for use in isset/empty or
@ -4294,7 +4310,7 @@ class DisplayResults
$sort_expression_nodirection = array();
$sort_direction = array();
if (!empty($statement->order)) {
if (!is_null($statement) && !empty($statement->order)) {
foreach ($statement->order as $o) {
$sort_expression[] = $o->expr->expr . ' ' . $o->type;
$sort_expression_nodirection[] = $o->expr->expr;
@ -4372,7 +4388,7 @@ class DisplayResults
$sort_by_key_html = $unsorted_sql_query = '';
}
if (($displayParts['nav_bar'] == '1') && (empty($statement->limit))) {
if (($displayParts['nav_bar'] == '1') && !is_null($statement) && (empty($statement->limit))) {
$table_html .= $this->_getPlacedTableNavigations(
$pos_next, $pos_prev, self::PLACE_TOP_DIRECTION_DROPDOWN,
$is_innodb, $sort_by_key_html
@ -4386,7 +4402,7 @@ class DisplayResults
$map = array();
$target = array();
if (!empty($statement->from)) {
if (!is_null($statement) && !empty($statement->from)) {
foreach ($statement->from as $field) {
if (!empty($field->table)) {
$target[] = $field->table;
@ -4455,7 +4471,7 @@ class DisplayResults
}
// 5. ----- Get the navigation bar at the bottom if required -----
if (($displayParts['nav_bar'] == '1') && empty($statement->limit)) {
if (($displayParts['nav_bar'] == '1') && !is_null($statement) && empty($statement->limit)) {
$table_html .= $this->_getPlacedTableNavigations(
$pos_next, $pos_prev, self::PLACE_BOTTOM_DIRECTION_DROPDOWN,
$is_innodb, $sort_by_key_html

View File

@ -1315,6 +1315,9 @@ EOT;
*/
public static function deleteTransformationInfo($db, $table, $analyzed_sql_results)
{
if (! isset($analyzed_sql_results['statement'])) {
return;
}
$statement = $analyzed_sql_results['statement'];
if ($statement instanceof AlterStatement) {
if (!empty($statement->altered[0])
@ -1674,7 +1677,7 @@ EOT;
} while ($GLOBALS['dbi']->moreResults() && $GLOBALS['dbi']->nextResult());
} else {
if (isset($result) && $result) {
if (isset($result) && $result !== false) {
$fields_meta = $GLOBALS['dbi']->getFieldsMeta($result);
$fields_cnt = count($fields_meta);
}
@ -1883,7 +1886,7 @@ EOT;
$updatableView = false;
$statement = $analyzed_sql_results['statement'];
$statement = isset($analyzed_sql_results['statement']) ? $analyzed_sql_results['statement'] : null;
if ($statement instanceof SelectStatement) {
if (!empty($statement->expr)) {
if ($statement->expr[0]->expr === '*') {

View File

@ -1841,7 +1841,7 @@ class Table
}
}
// remove the property, since it no longer exists in database
$this->removeUiProp(self::PROP_SORTED_COLUMN);
$this->removeUiProp($property);
return false;
}
@ -1859,7 +1859,7 @@ class Table
}
// remove the property, since the table has been modified
$this->removeUiProp(self::PROP_COLUMN_ORDER);
$this->removeUiProp($property);
return false;
}