diff --git a/index.php b/index.php index 36a611878e..070099b069 100644 --- a/index.php +++ b/index.php @@ -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); diff --git a/js/makegrid.js b/js/makegrid.js index 80a62adf1c..6e16db9bee 100644 --- a/js/makegrid.js +++ b/js/makegrid.js @@ -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 diff --git a/libraries/RecentTable.class.php b/libraries/RecentTable.class.php index b42a0aa832..4e5bd27bff 100644 --- a/libraries/RecentTable.class.php +++ b/libraries/RecentTable.class.php @@ -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 = ''; - $html .= ''; $html .= $this->getHtmlSelectOption(); $html .= ''; diff --git a/libraries/Table.class.php b/libraries/Table.class.php index cfc28d6ee5..cec5b66772 100644 --- a/libraries/Table.class.php +++ b/libraries/Table.class.php @@ -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]; } /** diff --git a/libraries/common.inc.php b/libraries/common.inc.php index a0b8628830..0887db824f 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -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']; + } } /** diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php index d41e2452c5..85eac32e10 100644 --- a/libraries/display_tbl.lib.php +++ b/libraries/display_tbl.lib.php @@ -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; diff --git a/navigation.php b/navigation.php index af3f138bd3..b63f775053 100644 --- a/navigation.php +++ b/navigation.php @@ -194,9 +194,15 @@ require './libraries/navigation_header.inc.php'; // display recently used tables if ($GLOBALS['cfg']['LeftRecentTable'] > 0) { - echo '
'; - echo PMA_RecentTable::getInstance()->getHtmlSelect(); - echo '
'; + echo '
' . "\n" + .'
' . "\n" + .PMA_generate_common_hidden_inputs() . "\n" + .PMA_RecentTable::getInstance()->getHtmlSelect() + .'' . "\n" + .'
' . "\n" + .'
' . "\n"; } if (! $GLOBALS['server']) {