diff options
author | Christian Foellmann <foellmann@foe-services.de> | 2015-01-05 22:07:18 +0300 |
---|---|---|
committer | Christian Foellmann <foellmann@foe-services.de> | 2015-01-05 22:07:18 +0300 |
commit | 170cb05f4eec4322303658108f9eea6e55163e50 (patch) | |
tree | e9b7e9a7e287270392077d1099fe0b5dc54eeba1 /libraries/RecentFavoriteTable.class.php | |
parent | f3a2bbe4d8241664dbb92def1b413b616bfab1fd (diff) |
UPDATE 4.3.54.3.5
Diffstat (limited to 'libraries/RecentFavoriteTable.class.php')
-rw-r--r-- | libraries/RecentFavoriteTable.class.php | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/libraries/RecentFavoriteTable.class.php b/libraries/RecentFavoriteTable.class.php index e1f31b0eb7..2cf934b3ca 100644 --- a/libraries/RecentFavoriteTable.class.php +++ b/libraries/RecentFavoriteTable.class.php @@ -23,14 +23,6 @@ require_once './libraries/Message.class.php'; class PMA_RecentFavoriteTable { /** - * Defines the internal PMA table which contains recent/favorite tables. - * - * @access private - * @var string - */ - private $_pmaTable; - - /** * Reference to session variable containing recently used or favorite tables. * * @access private @@ -64,18 +56,11 @@ class PMA_RecentFavoriteTable private function __construct($type) { $this->_tableType = $type; - if (/*overload*/mb_strlen($GLOBALS['cfg']['Server']['pmadb']) - && /*overload*/mb_strlen($GLOBALS['cfg']['Server'][$this->_tableType]) - ) { - $this->_pmaTable - = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb']) . "." - . PMA_Util::backquote($GLOBALS['cfg']['Server'][$this->_tableType]); - } $server_id = $GLOBALS['server']; if (! isset($_SESSION['tmpval'][$this->_tableType . '_tables'][$server_id]) ) { $_SESSION['tmpval'][$this->_tableType . '_tables'][$server_id] - = isset($this->_pmaTable) ? $this->getFromDb() : array(); + = $this->_getPmaTable() ? $this->getFromDb() : array(); } $this->_tables =& $_SESSION['tmpval'][$this->_tableType . '_tables'][$server_id]; @@ -115,7 +100,7 @@ class PMA_RecentFavoriteTable { // Read from phpMyAdmin database, if recent tables is not in session $sql_query - = " SELECT `tables` FROM " . $this->_pmaTable . + = " SELECT `tables` FROM " . $this->_getPmaTable() . " WHERE `username` = '" . $GLOBALS['cfg']['Server']['user'] . "'"; $return = array(); @@ -138,7 +123,7 @@ class PMA_RecentFavoriteTable { $username = $GLOBALS['cfg']['Server']['user']; $sql_query - = " REPLACE INTO " . $this->_pmaTable . " (`username`, `tables`)" . + = " REPLACE INTO " . $this->_getPmaTable() . " (`username`, `tables`)" . " VALUES ('" . $username . "', '" . PMA_Util::sqlAddSlashes( json_encode($this->_tables) @@ -285,7 +270,7 @@ class PMA_RecentFavoriteTable */ public function add($db, $table) { - // If table does not exist, do not add. + // If table does not exist, do not add._getPmaTable() if (! $GLOBALS['dbi']->getColumns($db, $table)) { return true; } @@ -299,7 +284,7 @@ class PMA_RecentFavoriteTable array_unshift($this->_tables, $table_arr); $this->_tables = array_merge(array_unique($this->_tables, SORT_REGULAR)); $this->trim(); - if (isset($this->_pmaTable)) { + if ($this->_getPmaTable()) { return $this->saveToDb(); } } @@ -346,7 +331,7 @@ class PMA_RecentFavoriteTable unset($this->_tables[$key]); } } - if (isset($this->_pmaTable)) { + if ($this->_getPmaTable()) { return $this->saveToDb(); } return true; @@ -387,5 +372,22 @@ class PMA_RecentFavoriteTable $retval .= ' href="' . $url . '"></a>'; return $retval; } + + /** + * Reutrn the name of the configuration storage table + * + * @return string pma table name + */ + private function _getPmaTable() + { + $cfgRelation = PMA_getRelationsParam(); + if (/*overload*/mb_strlen($cfgRelation['db']) + && /*overload*/mb_strlen($cfgRelation[$this->_tableType]) + ) { + return PMA_Util::backquote($cfgRelation['db']) . "." + . PMA_Util::backquote($cfgRelation[$this->_tableType]); + } + return null; + } } ?> |