1
0
mirror of https://github.com/phpmyadmin/phpmyadmin.git synced 2026-10-31 10:54:46 +03:00

Merge commit 'ede177c577668a712e0d89a8c895c1d0c200f42f'

This commit is contained in:
Marc Delisle
2011-06-21 08:13:41 -04:00
7 changed files with 44 additions and 24 deletions

View File

@@ -73,7 +73,7 @@ if (! strlen($GLOBALS['db'])) {
} else {
$_GET['db'] = $GLOBALS['db'];
$_GET['table'] = $GLOBALS['table'];
$main_target = $GLOBALS['cfg']['DefaultTabTable'];
$main_target = isset($GLOBALS['goto']) ? $GLOBALS['goto'] : $GLOBALS['cfg']['DefaultTabTable'];
}
$url_query = PMA_generate_common_url($_GET);

View File

@@ -314,6 +314,7 @@
db: window.parent.db,
table: window.parent.table,
token: window.parent.token,
server: window.parent.server,
set_col_order: true,
col_order: this.colOrder.toString(),
table_create_time: this.tableCreateTime

View File

@@ -46,11 +46,12 @@ class PMA_RecentTable
$this->pma_table = PMA_backquote($GLOBALS['cfg']['Server']['pmadb']) .".".
PMA_backquote($GLOBALS['cfg']['Server']['recent']);
}
if (! isset($_SESSION['tmp_user_values']['recent_tables'])) {
$_SESSION['tmp_user_values']['recent_tables'] =
$server_id = $GLOBALS['server'];
if (! isset($_SESSION['tmp_user_values']['recent_tables'][$server_id])) {
$_SESSION['tmp_user_values']['recent_tables'][$server_id] =
isset($this->pma_table) ? $this->getFromDb() : array();
}
$this->tables =& $_SESSION['tmp_user_values']['recent_tables'];
$this->tables =& $_SESSION['tmp_user_values']['recent_tables'][$server_id];
}
/**
@@ -163,9 +164,9 @@ class PMA_RecentTable
*/
public function getHtmlSelect()
{
$html = '<input type="hidden" id="LeftDefaultTabTable" value="' .
$html = '<input type="hidden" name="goto" id="LeftDefaultTabTable" value="' .
$GLOBALS['cfg']['LeftDefaultTabTable'] . '" />';
$html .= '<select id="recentTable">';
$html .= '<select name="table" id="recentTable">';
$html .= $this->getHtmlSelectOption();
$html .= '</select>';

View File

@@ -1286,15 +1286,16 @@ class PMA_Table
*/
protected function loadUiPrefs()
{
$server_id = $GLOBALS['server'];
// set session variable if it's still undefined
if (! isset($_SESSION['tmp_user_values']['table_uiprefs'][$this->db_name][$this->name])) {
$_SESSION['tmp_user_values']['table_uiprefs'][$this->db_name][$this->name] =
if (! isset($_SESSION['tmp_user_values']['table_uiprefs'][$server_id][$this->db_name][$this->name])) {
$_SESSION['tmp_user_values']['table_uiprefs'][$server_id][$this->db_name][$this->name] =
// check whether we can get from pmadb
(strlen($GLOBALS['cfg']['Server']['pmadb'])
&& strlen($GLOBALS['cfg']['Server']['table_uiprefs'])) ?
$this->getUiPrefsFromDb() : array();
}
$this->uiprefs =& $_SESSION['tmp_user_values']['table_uiprefs'][$this->db_name][$this->name];
$this->uiprefs =& $_SESSION['tmp_user_values']['table_uiprefs'][$server_id][$this->db_name][$this->name];
}
/**

View File

@@ -509,10 +509,21 @@ if (PMA_isValid($_REQUEST['db'])) {
*/
$GLOBALS['table'] = '';
if (PMA_isValid($_REQUEST['table'])) {
// can we strip tags from this?
// only \ and / is not allowed in table names for MySQL
$GLOBALS['table'] = $_REQUEST['table'];
$GLOBALS['url_params']['table'] = $GLOBALS['table'];
// check if specified table contain db name
if (strpos($_REQUEST['table'], '.')) {
$splitted = explode('.', $_REQUEST['table']);
if (count($splitted) == 2) { // make sure the format is "db.table"
$GLOBALS['db'] = $splitted[0];
$GLOBALS['url_params']['db'] = $GLOBALS['db'];
$GLOBALS['table'] = $splitted[1];
$GLOBALS['url_params']['table'] = $GLOBALS['table'];
}
} else {
// can we strip tags from this?
// only \ and / is not allowed in table names for MySQL
$GLOBALS['table'] = $_REQUEST['table'];
$GLOBALS['url_params']['table'] = $GLOBALS['table'];
}
}
/**

View File

@@ -1193,6 +1193,14 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
// name of the class added to all inline editable elements
$inline_edit_class = 'inline_edit';
// prepare to get the column order, if available
if (PMA_isSelect()) {
$pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
$col_order = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_ORDER);
} else {
$col_order = false;
}
// Correction University of Virginia 19991216 in the while below
// Previous code assumed that all tables have keys, specifically that
// the phpMyAdmin GUI should support row delete/edit only for such
@@ -1354,14 +1362,6 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
// 2. Displays the rows' values
if (PMA_isSelect()) {
// prepare to get the column order, if available
$pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
$col_order = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_ORDER);
} else {
$col_order = false;
}
for ($j = 0; $j < $fields_cnt; ++$j) {
// assign $i with appropriate column order
$i = $col_order ? $col_order[$j] : $j;

View File

@@ -194,9 +194,15 @@ require './libraries/navigation_header.inc.php';
// display recently used tables
if ($GLOBALS['cfg']['LeftRecentTable'] > 0) {
echo '<div id="recentTableList">';
echo PMA_RecentTable::getInstance()->getHtmlSelect();
echo '</div>';
echo '<div id="recentTableList">' . "\n"
.'<form method="post" action="index.php" target="_parent">' . "\n"
.PMA_generate_common_hidden_inputs() . "\n"
.PMA_RecentTable::getInstance()->getHtmlSelect()
.'<noscript>' . "\n"
.'<input type="submit" name="Go" value="' . __('Go') . '" />' . "\n"
.'</noscript>' . "\n"
.'</form>' . "\n"
.'</div>' . "\n";
}
if (! $GLOBALS['server']) {