Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Foellmann <foellmann@foe-services.de>2015-01-05 22:07:18 +0300
committerChristian Foellmann <foellmann@foe-services.de>2015-01-05 22:07:18 +0300
commit170cb05f4eec4322303658108f9eea6e55163e50 (patch)
treee9b7e9a7e287270392077d1099fe0b5dc54eeba1 /libraries
parentf3a2bbe4d8241664dbb92def1b413b616bfab1fd (diff)
UPDATE 4.3.54.3.5
Diffstat (limited to 'libraries')
-rw-r--r--libraries/Config.class.php2
-rw-r--r--libraries/Header.class.php6
-rw-r--r--libraries/Menu.class.php8
-rw-r--r--libraries/RecentFavoriteTable.class.php44
-rw-r--r--libraries/Table.class.php30
-rw-r--r--libraries/Tracker.class.php130
-rw-r--r--libraries/bookmark.lib.php4
-rw-r--r--libraries/central_columns.lib.php8
-rw-r--r--libraries/common.inc.php7
-rw-r--r--libraries/config.default.php2
-rw-r--r--libraries/config/messages.inc.php11
-rw-r--r--libraries/config/setup.forms.php5
-rw-r--r--libraries/config/user_preferences.forms.php4
-rw-r--r--libraries/core.lib.php35
-rw-r--r--libraries/dbi/DBIDummy.class.php4
-rw-r--r--libraries/language_stats.inc.php32
-rw-r--r--libraries/normalization.lib.php4
-rw-r--r--libraries/plugins/import/ImportSql.class.php73
-rw-r--r--libraries/relation.lib.php211
-rw-r--r--libraries/relation_cleanup.lib.php46
-rw-r--r--libraries/server_privileges.lib.php26
-rw-r--r--libraries/server_user_groups.lib.php29
-rw-r--r--libraries/sql.lib.php2
-rw-r--r--libraries/tracking.lib.php14
24 files changed, 369 insertions, 368 deletions
diff --git a/libraries/Config.class.php b/libraries/Config.class.php
index 86f70fe321..3508138822 100644
--- a/libraries/Config.class.php
+++ b/libraries/Config.class.php
@@ -114,7 +114,7 @@ class PMA_Config
*/
function checkSystem()
{
- $this->set('PMA_VERSION', '4.3.4');
+ $this->set('PMA_VERSION', '4.3.5');
/**
* @deprecated
*/
diff --git a/libraries/Header.class.php b/libraries/Header.class.php
index 67347389c0..50d332c490 100644
--- a/libraries/Header.class.php
+++ b/libraries/Header.class.php
@@ -220,6 +220,12 @@ class PMA_Header
$table = ! empty($GLOBALS['table']) ? $GLOBALS['table'] : '';
$pftext = ! empty($_SESSION['tmpval']['pftext'])
? $_SESSION['tmpval']['pftext'] : '';
+
+ // not sure when this happens, but it happens
+ if (! isset($GLOBALS['collation_connection'])) {
+ $GLOBALS['collation_connection'] = 'utf8_general_ci';
+ }
+
return array(
'common_query' => PMA_URL_getCommon(array(), 'text'),
'opendb_url' => $GLOBALS['cfg']['DefaultTabDatabase'],
diff --git a/libraries/Menu.class.php b/libraries/Menu.class.php
index 6d08c0134f..a9f2b15afb 100644
--- a/libraries/Menu.class.php
+++ b/libraries/Menu.class.php
@@ -130,11 +130,11 @@ class PMA_Menu
$allowedTabs = PMA_Util::getMenuTabList($level);
$cfgRelation = PMA_getRelationsParam();
if (isset($cfgRelation['menuswork']) && $cfgRelation['menuswork']) {
- $groupTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
+ $groupTable = PMA_Util::backquote($cfgRelation['db'])
. "."
- . PMA_Util::backquote($GLOBALS['cfg']['Server']['usergroups']);
- $userTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
- . "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['users']);
+ . PMA_Util::backquote($cfgRelation['usergroups']);
+ $userTable = PMA_Util::backquote($cfgRelation['db'])
+ . "." . PMA_Util::backquote($cfgRelation['users']);
$sql_query = "SELECT `tab` FROM " . $groupTable
. " WHERE `allowed` = 'N'"
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;
+ }
}
?>
diff --git a/libraries/Table.class.php b/libraries/Table.class.php
index 5ce972da30..931ab3ccea 100644
--- a/libraries/Table.class.php
+++ b/libraries/Table.class.php
@@ -1482,8 +1482,9 @@ class PMA_Table
*/
protected function getUiPrefsFromDb()
{
- $pma_table = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb']) . "."
- . PMA_Util::backquote($GLOBALS['cfg']['Server']['table_uiprefs']);
+ $cfgRelation = PMA_getRelationsParam();
+ $pma_table = PMA_Util::backquote($cfgRelation['db']) . "."
+ . PMA_Util::backquote($cfgRelation['table_uiprefs']);
// Read from phpMyAdmin database
$sql_query = " SELECT `prefs` FROM " . $pma_table
@@ -1506,16 +1507,18 @@ class PMA_Table
*/
protected function saveUiPrefsToDb()
{
- $pma_table = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb']) . "."
- . PMA_Util::backquote($GLOBALS['cfg']['Server']['table_uiprefs']);
+ $cfgRelation = PMA_getRelationsParam();
+ $pma_table = PMA_Util::backquote($cfgRelation['db']) . "."
+ . PMA_Util::backquote($cfgRelation['table_uiprefs']);
$secureDbName = PMA_Util::sqlAddSlashes($this->db_name);
$username = $GLOBALS['cfg']['Server']['user'];
$sql_query = " REPLACE INTO " . $pma_table
- . " VALUES ('" . $username . "', '" . $secureDbName
+ . " (username, db_name, table_name, prefs) VALUES ('"
+ . $username . "', '" . $secureDbName
. "', '" . PMA_Util::sqlAddSlashes($this->name) . "', '"
- . PMA_Util::sqlAddSlashes(json_encode($this->uiprefs)) . "', NULL)";
+ . PMA_Util::sqlAddSlashes(json_encode($this->uiprefs)) . "')";
$success = $GLOBALS['dbi']->tryQuery($sql_query, $GLOBALS['controllink']);
@@ -1577,6 +1580,7 @@ class PMA_Table
*/
protected function loadUiPrefs()
{
+ $cfgRelation = PMA_getRelationsParam();
$server_id = $GLOBALS['server'];
// set session variable if it's still undefined
@@ -1584,8 +1588,8 @@ class PMA_Table
// check whether we can get from pmadb
$_SESSION['tmpval']['table_uiprefs'][$server_id][$this->db_name]
[$this->name]
- = (/*overload*/mb_strlen($GLOBALS['cfg']['Server']['pmadb'])
- && /*overload*/mb_strlen($GLOBALS['cfg']['Server']['table_uiprefs'])
+ = (/*overload*/mb_strlen($cfgRelation['db'])
+ && /*overload*/mb_strlen($cfgRelation['table_uiprefs'])
)
? $this->getUiPrefsFromDb()
: array();
@@ -1718,8 +1722,9 @@ class PMA_Table
$this->uiprefs[$property] = $value;
// check if pmadb is set
- if (/*overload*/mb_strlen($GLOBALS['cfg']['Server']['pmadb'])
- && /*overload*/mb_strlen($GLOBALS['cfg']['Server']['table_uiprefs'])
+ $cfgRelation = PMA_getRelationsParam();
+ if (/*overload*/mb_strlen($cfgRelation['db'])
+ && /*overload*/mb_strlen($cfgRelation['table_uiprefs'])
) {
return $this->saveUiprefsToDb();
}
@@ -1741,9 +1746,10 @@ class PMA_Table
if (isset($this->uiprefs[$property])) {
unset($this->uiprefs[$property]);
+ $cfgRelation = PMA_getRelationsParam();
// check if pmadb is set
- if (/*overload*/mb_strlen($GLOBALS['cfg']['Server']['pmadb'])
- && /*overload*/mb_strlen($GLOBALS['cfg']['Server']['table_uiprefs'])
+ if (/*overload*/mb_strlen($cfgRelation['db'])
+ && /*overload*/mb_strlen($cfgRelation['table_uiprefs'])
) {
return $this->saveUiprefsToDb();
}
diff --git a/libraries/Tracker.class.php b/libraries/Tracker.class.php
index 0504400d77..7f6318cae8 100644
--- a/libraries/Tracker.class.php
+++ b/libraries/Tracker.class.php
@@ -24,52 +24,6 @@ class PMA_Tracker
static protected $enabled = false;
/**
- * Defines the internal PMA table which contains tracking data.
- *
- * @access protected
- * @var string
- */
- static protected $pma_table;
-
- /**
- * Defines the usage of DROP TABLE statement in SQL dumps.
- *
- * @access protected
- * @var boolean
- */
- static protected $add_drop_table;
-
- /**
- * Defines the usage of DROP VIEW statement in SQL dumps.
- *
- * @access protected
- * @var boolean
- */
- static protected $add_drop_view;
-
- /**
- * Defines the usage of DROP DATABASE statement in SQL dumps.
- *
- * @access protected
- * @var boolean
- */
- static protected $add_drop_database;
-
- /**
- * Defines auto-creation of tracking versions.
- *
- * @var boolean
- */
- static protected $version_auto_create;
-
- /**
- * Defines the default set of tracked statements.
- *
- * @var string
- */
- static protected $default_tracking_set;
-
- /**
* Flags copied from `tracking` column definition in `pma_tracking` table.
* Used for column type conversion in Drizzle.
*
@@ -82,35 +36,6 @@ class PMA_Tracker
'CREATE VIEW','ALTER VIEW','DROP VIEW'
);
-
- /**
- * Initializes settings.
- *
- * @static
- *
- * @return void
- */
- static protected function init()
- {
- self::$pma_table = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
- . '.' . PMA_Util::backquote($GLOBALS['cfg']['Server']['tracking']);
-
- self::$add_drop_table
- = $GLOBALS['cfg']['Server']['tracking_add_drop_table'];
-
- self::$add_drop_view
- = $GLOBALS['cfg']['Server']['tracking_add_drop_view'];
-
- self::$add_drop_database
- = $GLOBALS['cfg']['Server']['tracking_add_drop_database'];
-
- self::$default_tracking_set
- = $GLOBALS['cfg']['Server']['tracking_default_statements'];
-
- self::$version_auto_create
- = $GLOBALS['cfg']['Server']['tracking_version_auto_create'];
- }
-
/**
* Actually enables tracking. This needs to be done after all
* underlaying code is initialized.
@@ -146,9 +71,9 @@ class PMA_Tracker
if (! $cfgRelation['trackingwork']) {
return false;
}
- self::init();
- if (isset(self::$pma_table)) {
+ $pma_table = self::_getTrackingTable();
+ if (isset($pma_table)) {
return true;
} else {
return false;
@@ -210,7 +135,7 @@ class PMA_Tracker
return false;
}
- $sql_query = " SELECT tracking_active FROM " . self::$pma_table .
+ $sql_query = " SELECT tracking_active FROM " . self::_getTrackingTable() .
" WHERE db_name = '" . PMA_Util::sqlAddSlashes($dbname) . "' " .
" AND table_name = '" . PMA_Util::sqlAddSlashes($tablename) . "' " .
" ORDER BY version DESC";
@@ -256,7 +181,8 @@ class PMA_Tracker
global $sql_backquotes, $export_type;
if ($tracking_set == '') {
- $tracking_set = self::$default_tracking_set;
+ $tracking_set
+ = $GLOBALS['cfg']['Server']['tracking_default_statements'];
}
// get Export SQL instance
@@ -295,13 +221,17 @@ class PMA_Tracker
$create_sql = "";
- if (self::$add_drop_table == true && $is_view == false) {
+ if ($GLOBALS['cfg']['Server']['tracking_add_drop_table'] == true
+ && $is_view == false
+ ) {
$create_sql .= self::getLogComment()
. 'DROP TABLE IF EXISTS ' . PMA_Util::backquote($tablename) . ";\n";
}
- if (self::$add_drop_view == true && $is_view == true) {
+ if ($GLOBALS['cfg']['Server']['tracking_add_drop_view'] == true
+ && $is_view == true
+ ) {
$create_sql .= self::getLogComment()
. 'DROP VIEW IF EXISTS ' . PMA_Util::backquote($tablename) . ";\n";
}
@@ -312,7 +242,7 @@ class PMA_Tracker
// Save version
$sql_query = "/*NOTRACK*/\n" .
- "INSERT INTO" . self::$pma_table . " (" .
+ "INSERT INTO " . self::_getTrackingTable() . " (" .
"db_name, " .
"table_name, " .
"version, " .
@@ -359,7 +289,7 @@ class PMA_Tracker
static public function deleteTracking($dbname, $tablename)
{
$sql_query = "/*NOTRACK*/\n"
- . "DELETE FROM " . self::$pma_table
+ . "DELETE FROM " . self::_getTrackingTable()
. " WHERE `db_name` = '"
. PMA_Util::sqlAddSlashes($dbname) . "'"
. " AND `table_name` = '"
@@ -388,12 +318,13 @@ class PMA_Tracker
$date = date('Y-m-d H:i:s');
if ($tracking_set == '') {
- $tracking_set = self::$default_tracking_set;
+ $tracking_set
+ = $GLOBALS['cfg']['Server']['tracking_default_statements'];
}
$create_sql = "";
- if (self::$add_drop_database == true) {
+ if ($GLOBALS['cfg']['Server']['tracking_add_drop_database'] == true) {
$create_sql .= self::getLogComment()
. 'DROP DATABASE IF EXISTS ' . PMA_Util::backquote($dbname) . ";\n";
}
@@ -402,7 +333,7 @@ class PMA_Tracker
// Save version
$sql_query = "/*NOTRACK*/\n" .
- "INSERT INTO" . self::$pma_table . " (" .
+ "INSERT INTO " . self::_getTrackingTable() . " (" .
"db_name, " .
"table_name, " .
"version, " .
@@ -448,7 +379,7 @@ class PMA_Tracker
$version, $new_state
) {
- $sql_query = " UPDATE " . self::$pma_table .
+ $sql_query = " UPDATE " . self::_getTrackingTable() .
" SET `tracking_active` = '" . $new_state . "' " .
" WHERE `db_name` = '" . PMA_Util::sqlAddSlashes($dbname) . "' " .
" AND `table_name` = '" . PMA_Util::sqlAddSlashes($tablename) . "' " .
@@ -494,7 +425,7 @@ class PMA_Tracker
$new_data_processed = $new_data;
}
- $sql_query = " UPDATE " . self::$pma_table .
+ $sql_query = " UPDATE " . self::_getTrackingTable() .
" SET `" . $save_to . "` = '" . $new_data_processed . "' " .
" WHERE `db_name` = '" . PMA_Util::sqlAddSlashes($dbname) . "' " .
" AND `table_name` = '" . PMA_Util::sqlAddSlashes($tablename) . "' " .
@@ -553,7 +484,7 @@ class PMA_Tracker
*/
static public function getVersion($dbname, $tablename, $statement = null)
{
- $sql_query = " SELECT MAX(version) FROM " . self::$pma_table .
+ $sql_query = " SELECT MAX(version) FROM " . self::_getTrackingTable() .
" WHERE `db_name` = '" . PMA_Util::sqlAddSlashes($dbname) . "' " .
" AND `table_name` = '" . PMA_Util::sqlAddSlashes($tablename) . "' ";
@@ -587,10 +518,7 @@ class PMA_Tracker
*/
static public function getTrackedData($dbname, $tablename, $version)
{
- if (! isset(self::$pma_table)) {
- self::init();
- }
- $sql_query = " SELECT * FROM " . self::$pma_table .
+ $sql_query = " SELECT * FROM " . self::_getTrackingTable() .
" WHERE `db_name` = '" . PMA_Util::sqlAddSlashes($dbname) . "' ";
if (! empty($tablename)) {
$sql_query .= " AND `table_name` = '"
@@ -961,7 +889,7 @@ class PMA_Tracker
);
// If version not exists and auto-creation is enabled
- if (self::$version_auto_create == true
+ if ($GLOBALS['cfg']['Server']['tracking_version_auto_create'] == true
&& self::isTracked($dbname, $result['tablename']) == false
&& $version == -1
) {
@@ -1005,7 +933,7 @@ class PMA_Tracker
// Mark it as untouchable
$sql_query = " /*NOTRACK*/\n"
- . " UPDATE " . self::$pma_table
+ . " UPDATE " . self::_getTrackingTable()
. " SET " . PMA_Util::backquote($save_to)
. " = CONCAT( " . PMA_Util::backquote($save_to) . ",'\n"
. PMA_Util::sqlAddSlashes($query) . "') ,"
@@ -1089,5 +1017,17 @@ class PMA_Tracker
return $flags;
}
+
+ /**
+ * Returns the tracking table
+ *
+ * @return string tracking table
+ */
+ private static function _getTrackingTable()
+ {
+ $cfgRelation = PMA_getRelationsParam();
+ return PMA_Util::backquote($cfgRelation['db'])
+ . '.' . PMA_Util::backquote($cfgRelation['tracking']);
+ }
}
?>
diff --git a/libraries/bookmark.lib.php b/libraries/bookmark.lib.php
index dcb80d63c7..1b3d18ce1f 100644
--- a/libraries/bookmark.lib.php
+++ b/libraries/bookmark.lib.php
@@ -29,8 +29,8 @@ function PMA_Bookmark_getParams()
if ($cfgRelation['bookmarkwork']) {
$cfgBookmark = array(
'user' => $GLOBALS['cfg']['Server']['user'],
- 'db' => $GLOBALS['cfg']['Server']['pmadb'],
- 'table' => $GLOBALS['cfg']['Server']['bookmarktable'],
+ 'db' => $cfgRelation['db'],
+ 'table' => $cfgRelation['bookmark'],
);
} else {
$cfgBookmark = false;
diff --git a/libraries/central_columns.lib.php b/libraries/central_columns.lib.php
index eee9e23342..542d4b2a6e 100644
--- a/libraries/central_columns.lib.php
+++ b/libraries/central_columns.lib.php
@@ -30,8 +30,8 @@ function PMA_centralColumnsGetParams()
) {
$cfgCentralColumns = array(
'user' => $GLOBALS['cfg']['Server']['user'],
- 'db' => $GLOBALS['cfg']['Server']['pmadb'],
- 'table' => $GLOBALS['cfg']['Server']['central_columns'],
+ 'db' => $cfgRelation['db'],
+ 'table' => $cfgRelation['central_columns'],
);
} else {
$cfgCentralColumns = false;
@@ -57,9 +57,9 @@ function PMA_getColumnsList($db, $from=0, $num=25)
if (empty($cfgCentralColumns)) {
return array();
}
- $pmadb = $GLOBALS['cfg']['Server']['pmadb'];
+ $pmadb = $cfgCentralColumns['db'];
$GLOBALS['dbi']->selectDb($pmadb, $GLOBALS['controllink']);
- $central_list_table = $GLOBALS['cfg']['Server']['central_columns'];
+ $central_list_table = $cfgCentralColumns['table'];
//get current values of $db from central column list
if ($num == 0) {
$query = 'SELECT * FROM ' . PMA_Util::backquote($central_list_table) . ' '
diff --git a/libraries/common.inc.php b/libraries/common.inc.php
index fcdc313c5b..ff55609645 100644
--- a/libraries/common.inc.php
+++ b/libraries/common.inc.php
@@ -1151,6 +1151,11 @@ if (!empty($__redirect) && in_array($__redirect, $goto_whitelist)) {
if (isset($GLOBALS['cfg']['ZeroConf'])
&& $GLOBALS['cfg']['ZeroConf'] == true
) {
- PMA_checkAndFixPMATablesInCurrentDb();
+ if (! empty($GLOBALS['db'])) {
+ $cfgRelation = PMA_getRelationsParam();
+ if (empty($cfgRelation['db'])) {
+ PMA_fixPMATables($GLOBALS['db'], false);
+ }
+ }
}
?>
diff --git a/libraries/config.default.php b/libraries/config.default.php
index e4f38be69a..47a5288b38 100644
--- a/libraries/config.default.php
+++ b/libraries/config.default.php
@@ -2417,7 +2417,7 @@ $cfg['DefaultLang'] = 'en';
*
* @global string $cfg['DefaultConnectionCollation']
*/
-$cfg['DefaultConnectionCollation'] = 'utf8_general_ci';
+$cfg['DefaultConnectionCollation'] = 'utf8_unicode_ci';
/**
* Force: always use this language
diff --git a/libraries/config/messages.inc.php b/libraries/config/messages.inc.php
index 9277060873..c7fbd6495a 100644
--- a/libraries/config/messages.inc.php
+++ b/libraries/config/messages.inc.php
@@ -604,7 +604,11 @@ $strConfigServers_savedsearches_desc = __(
'Leave blank for no QBE saved searches support, suggested: '
. '[kbd]pma__savedsearches[/kbd].'
);
-
+$strConfigServers_central_columns_name = __('Central columns table');
+$strConfigServers_central_columns_desc = __(
+ 'Leave blank for no central columns support, suggested: '
+ . '[kbd]pma__central_columns[/kbd].'
+);
$strConfigServers_nopassword_desc = __('Try to connect without password.');
$strConfigServers_nopassword_name = __('Connect without password');
$strConfigServers_only_db_desc = __(
@@ -633,6 +637,11 @@ $strConfigServers_recent_desc = __(
. 'suggested: [kbd]pma__recent[/kbd].'
);
$strConfigServers_recent_name = __('Recently used table');
+$strConfigServers_favorite_desc = __(
+ 'Leave blank for no "persistent" favorite tables across sessions, '
+ . 'suggested: [kbd]pma__favorite[/kbd].'
+);
+$strConfigServers_favorite_name = __('Favorites table');
$strConfigServers_relation_desc = __(
'Leave blank for no '
. '[a@http://wiki.phpmyadmin.net/pma/relation]relation-links[/a] support, '
diff --git a/libraries/config/setup.forms.php b/libraries/config/setup.forms.php
index 28f146740d..68b409efb7 100644
--- a/libraries/config/setup.forms.php
+++ b/libraries/config/setup.forms.php
@@ -75,6 +75,7 @@ $forms['Servers']['Server_pmadb'] = array('Servers' => array(1 => array(
'column_info' => 'pma__column_info',
'history' => 'pma__history',
'recent' => 'pma__recent',
+ 'favorite' => 'pma_favorite',
'table_uiprefs' => 'pma__table_uiprefs',
'tracking' => 'pma__tracking',
'table_coords' => 'pma__table_coords',
@@ -171,7 +172,9 @@ $forms['Navi_panel']['Navi_panel'] = array(
'NavigationTreeEnableGrouping',
'NavigationTreeDisableDatabaseExpansion',
'NavigationTreeDisplayItemFilterMinimum',
- 'NumRecentTables');
+ 'NumRecentTables',
+ 'NumFavoriteTables'
+);
$forms['Navi_panel']['Navi_servers'] = array(
'NavigationDisplayServers',
'DisplayServersList');
diff --git a/libraries/config/user_preferences.forms.php b/libraries/config/user_preferences.forms.php
index 02241c8c89..6792e2e756 100644
--- a/libraries/config/user_preferences.forms.php
+++ b/libraries/config/user_preferences.forms.php
@@ -83,7 +83,9 @@ $forms['Navi_panel']['Navi_panel'] = array(
'NavigationTreeEnableGrouping',
'NavigationTreeDisableDatabaseExpansion',
'NavigationTreeDisplayItemFilterMinimum',
- 'NumRecentTables');
+ 'NumRecentTables',
+ 'NumFavoriteTables'
+);
$forms['Navi_panel']['Navi_databases'] = array(
'NavigationTreeDisplayDbFilterMinimum',
'NavigationTreeDbSeparator');
diff --git a/libraries/core.lib.php b/libraries/core.lib.php
index 296c461184..8633999a71 100644
--- a/libraries/core.lib.php
+++ b/libraries/core.lib.php
@@ -986,41 +986,6 @@ function PMA_emptyRecursive($value)
}
/**
- * Checks and fixes configuration storage in current DB.
- *
- * @return void
- */
-function PMA_checkAndFixPMATablesInCurrentDb()
-{
- if (isset($GLOBALS['db']) && ! empty($GLOBALS['db'])) {
- if (isset($GLOBALS['cfg']['Server']['pmadb'])
- && empty($GLOBALS['cfg']['Server']['pmadb'])
- ) {
- $default_tables = PMA_getDefaultPMATableNames();
- if (PMA_searchPMATablesInDb(
- $GLOBALS['db'],
- array_keys($default_tables)
- )
- ) {
- PMA_fixPMATables($GLOBALS['db']);
- // Since configuration storage is updated, we need to
- // re-initialize the favorite and recent tables stored in the
- // session from the current configuration storage.
- include_once 'libraries/RecentFavoriteTable.class.php';
- $fav_tables = PMA_RecentFavoriteTable::getInstance('favorite');
- $recent_tables = PMA_RecentFavoriteTable::getInstance('recent');
- $_SESSION['tmpval']['favorite_tables'][$GLOBALS['server']]
- = $fav_tables->getFromDb();
- $_SESSION['tmpval']['recent_tables'][$GLOBALS['server']]
- = $recent_tables->getFromDb();
- // Reload navi panel to update the recent/favorite lists.
- $GLOBALS['reload'] = true;
- }
- }
- }
-}
-
-/**
* Creates some globals from $_POST variables matching a pattern
*
* @param array $post_patterns The patterns to search for
diff --git a/libraries/dbi/DBIDummy.class.php b/libraries/dbi/DBIDummy.class.php
index 0453135773..f3a497f438 100644
--- a/libraries/dbi/DBIDummy.class.php
+++ b/libraries/dbi/DBIDummy.class.php
@@ -429,7 +429,7 @@ $GLOBALS['dummy_queries'] = array(
'result' => array(),
),
array(
- 'query' => "SELECT tracking_active FROM pma_table_tracking" .
+ 'query' => "SELECT tracking_active FROM `pmadb`.`tracking`" .
" WHERE db_name = 'pma_test_db'" .
" AND table_name = 'pma_test_table'" .
" ORDER BY version DESC",
@@ -439,7 +439,7 @@ $GLOBALS['dummy_queries'] = array(
)
),
array(
- 'query' => "SELECT tracking_active FROM pma_table_tracking" .
+ 'query' => "SELECT tracking_active FROM `pmadb`.`tracking`" .
" WHERE db_name = 'pma_test_db'" .
" AND table_name = 'pma_test_table2'" .
" ORDER BY version DESC",
diff --git a/libraries/language_stats.inc.php b/libraries/language_stats.inc.php
index 9d990f768b..417d7173ba 100644
--- a/libraries/language_stats.inc.php
+++ b/libraries/language_stats.inc.php
@@ -6,8 +6,8 @@ $GLOBALS["language_stats"] = array (
'af' => 10,
'ar' => 37,
'az' => 53,
- 'be' => 27,
'be@latin' => 27,
+ 'be' => 27,
'bg' => 62,
'bn' => 85,
'br' => 19,
@@ -16,12 +16,12 @@ $GLOBALS["language_stats"] = array (
'ckb' => 17,
'cs' => 94,
'cy' => 20,
- 'da' => 98,
- 'de' => 100,
- 'el' => 100,
+ 'da' => 99,
+ 'de' => 99,
+ 'el' => 99,
'en_GB' => 90,
- 'es' => 100,
- 'et' => 100,
+ 'es' => 99,
+ 'et' => 99,
'eu' => 17,
'fa' => 28,
'fi' => 62,
@@ -30,11 +30,11 @@ $GLOBALS["language_stats"] = array (
'he' => 19,
'hi' => 42,
'hr' => 33,
- 'hu' => 80,
+ 'hu' => 99,
'hy' => 3,
'ia' => 63,
'id' => 74,
- 'it' => 80,
+ 'it' => 79,
'ja' => 73,
'ka' => 15,
'kk' => 10,
@@ -51,19 +51,19 @@ $GLOBALS["language_stats"] = array (
'ms' => 11,
'nb' => 59,
'ne' => 1,
- 'nl' => 100,
+ 'nl' => 99,
'pa' => 2,
'pl' => 88,
- 'pt' => 61,
'pt_BR' => 93,
+ 'pt' => 60,
'ro' => 60,
'ru' => 99,
'si' => 67,
- 'sk' => 70,
- 'sl' => 100,
+ 'sk' => 76,
+ 'sl' => 99,
'sq' => 25,
- 'sr' => 25,
'sr@latin' => 51,
+ 'sr' => 25,
'sv' => 91,
'ta' => 39,
'te' => 10,
@@ -72,13 +72,13 @@ $GLOBALS["language_stats"] = array (
'tr' => 100,
'tt' => 18,
'ug' => 11,
- 'uk' => 91,
+ 'uk' => 92,
'ur' => 20,
- 'uz' => 37,
'uz@latin' => 36,
+ 'uz' => 37,
'vi' => 1,
'vls' => 3,
'zh_CN' => 82,
- 'zh_TW' => 98,
+ 'zh_TW' => 97,
);
?>
diff --git a/libraries/normalization.lib.php b/libraries/normalization.lib.php
index 6793889dd6..08e39469d6 100644
--- a/libraries/normalization.lib.php
+++ b/libraries/normalization.lib.php
@@ -378,7 +378,7 @@ function PMA_getHtmlForNewTables2NF($partialDependencies,$table)
{
$html = '<p><b>' . sprintf(
__(
- 'As per above partial dependencies, in order to put the '
+ 'In order to put the '
. 'original table \'%1$s\' into Second normal form we need '
. 'to create the following tables:'
), htmlspecialchars($table)
@@ -498,7 +498,7 @@ function PMA_getHtmlForNewTables3NF($dependencies, $tables, $db)
}
$html .= '<p><b>' . sprintf(
__(
- 'As per above dependencies, in order to put the '
+ 'In order to put the '
. 'original table \'%1$s\' into Third normal form we need '
. 'to create the following tables:'
), htmlspecialchars($table)
diff --git a/libraries/plugins/import/ImportSql.class.php b/libraries/plugins/import/ImportSql.class.php
index 8fa36a9d59..05727d65a3 100644
--- a/libraries/plugins/import/ImportSql.class.php
+++ b/libraries/plugins/import/ImportSql.class.php
@@ -41,11 +41,6 @@ class ImportSql extends ImportPlugin
private $_delimiterPosition = false;
/**
- * @var string Query to execute
- */
- private $_query = null;
-
- /**
* @var int Query start position
*/
private $_queryBeginPosition = 0;
@@ -217,10 +212,7 @@ class ImportSql extends ImportPlugin
{
//Search for closing quote
$posClosingString = $this->_stringFctToUse['strpos'](
- $this->_data, $this->_quote,
- $this->_delimiterPosition + $this->_stringFctToUse['strlen'](
- $this->_quote
- )
+ $this->_data, $this->_quote, $this->_delimiterPosition
);
if (false === $posClosingString) {
@@ -276,53 +268,45 @@ class ImportSql extends ImportPlugin
$posClosingComment = $this->_stringFctToUse['strpos'](
$this->_data,
"\n",
- $this->_delimiterPosition + $this->_stringFctToUse['strlen'](
- $this->_openingComment
- )
+ $this->_delimiterPosition
);
if (false === $posClosingComment) {
return false;
}
//Move after the end of the line.
$this->_delimiterPosition = $posClosingComment + 1;
+ $this->_isInComment = false;
+ $this->_openingComment = null;
} elseif ('/*' === $this->_openingComment) {
//Search for closing comment
$posClosingComment = $this->_stringFctToUse['strpos'](
$this->_data,
'*/',
- $this->_delimiterPosition + $this->_stringFctToUse['strlen'](
- $this->_openingComment
- )
+ $this->_delimiterPosition
);
if (false === $posClosingComment) {
return false;
}
//Move after closing comment.
$this->_delimiterPosition = $posClosingComment + 2;
+ $this->_isInComment = false;
+ $this->_openingComment = null;
} else {
//We shouldn't be able to come here.
//throw new Exception('Unknown case.');
break;
}
- $this->_queryBeginPosition = $this->_delimiterPosition;
- $this->_isInComment = false;
- $this->_openingComment = null;
-
continue;
}
if ($this->_isInDelimiter) {
- $posAfterKeyword = $this->_delimiterPosition
- + $this->_stringFctToUse['strlen'](
- $this->_delimiterKeyword
- );
//Search for new line.
if (!preg_match(
"/^(.*)\n/",
$this->_stringFctToUse['substr'](
$this->_data,
- $posAfterKeyword
+ $this->_delimiterPosition
),
$matches,
PREG_OFFSET_CAPTURE
@@ -332,8 +316,8 @@ class ImportSql extends ImportPlugin
$this->_setDelimiter($matches[1][0]);
//Start after delimiter and new line.
- $this->_queryBeginPosition = $posAfterKeyword + $matches[1][1]
- + $this->_delimiterLength + 1;
+ $this->_queryBeginPosition = $this->_delimiterPosition
+ + $matches[1][1] + $this->_delimiterLength + 1;
$this->_delimiterPosition = $this->_queryBeginPosition;
$this->_isInDelimiter = false;
$firstSqlDelimiter = null;
@@ -355,7 +339,6 @@ class ImportSql extends ImportPlugin
&& $firstSqlDelimiter < $this->_firstSearchChar)
) {
$this->_delimiterPosition = $firstSqlDelimiter;
- $this->_fillQuery();
return true;
}
@@ -367,8 +350,8 @@ class ImportSql extends ImportPlugin
if (in_array($specialChars, array('\'', '"', '`'))) {
$this->_isInString = true;
$this->_quote = $specialChars;
- //Move after quote.
- $this->_delimiterPosition = $this->_firstSearchChar;
+ //Move before quote.
+ $this->_delimiterPosition = $this->_firstSearchChar + 1;
continue;
}
@@ -376,16 +359,17 @@ class ImportSql extends ImportPlugin
if (in_array($specialChars, array('#', '-- ', '/*'))) {
$this->_isInComment = true;
$this->_openingComment = $specialChars;
- //Move after comment opening.
- $this->_delimiterPosition = $this->_firstSearchChar;
- $this->_fillQuery();
+ //Move before comment opening.
+ $this->_delimiterPosition = $this->_firstSearchChar
+ + $this->_stringFctToUse['strlen']($specialChars);
continue;
}
//If DELIMITER is found.
if ($specialChars === $this->_delimiterKeyword) {
$this->_isInDelimiter = true;
- $this->_delimiterPosition = $this->_firstSearchChar;
+ $this->_delimiterPosition = $this->_firstSearchChar
+ + $this->_stringFctToUse['strlen']($specialChars);
continue;
}
}
@@ -459,7 +443,11 @@ class ImportSql extends ImportPlugin
}
PMA_importRunQuery(
- $this->_query, //Query to execute
+ $this->_stringFctToUse['substr'](
+ $this->_data,
+ $this->_queryBeginPosition,
+ $this->_delimiterPosition - $this->_queryBeginPosition
+ ), //Query to execute
$this->_stringFctToUse['substr'](
$this->_data,
0,
@@ -468,7 +456,6 @@ class ImportSql extends ImportPlugin
false,
$sql_data
);
- $this->_query = null;
$this->_setData(
$this->_stringFctToUse['substr'](
@@ -625,20 +612,4 @@ class ImportSql extends ImportPlugin
return $this->_dataLength;
}
-
- /**
- * Fill current query from indexes
- *
- * @return string Current query
- */
- private function _fillQuery()
- {
- $this->_query .= $this->_stringFctToUse['substr'](
- $this->_data,
- $this->_queryBeginPosition,
- $this->_delimiterPosition - $this->_queryBeginPosition
- );
-
- return $this->_query;
- }
}
diff --git a/libraries/relation.lib.php b/libraries/relation.lib.php
index f4c5987e26..a3f7740074 100644
--- a/libraries/relation.lib.php
+++ b/libraries/relation.lib.php
@@ -59,10 +59,6 @@ function PMA_queryAsControlUser($sql, $show_error = true, $options = 0)
*/
function PMA_getRelationsParam()
{
- // avoid breakage if pmadb got unconfigured after login
- if (! defined('TESTSUITE') && empty($GLOBALS['cfg']['Server']['pmadb'])) {
- unset($_SESSION['relation'][$GLOBALS['server']]);
- }
if (empty($_SESSION['relation'][$GLOBALS['server']])) {
$_SESSION['relation'][$GLOBALS['server']] = PMA_checkRelationsParam();
}
@@ -97,7 +93,7 @@ function PMA_getRelationsParamDiagnostic($cfgRelation)
$messages['enabled'] = '<font color="green">' . __('Enabled') . '</font>';
$messages['disabled'] = '<font color="red">' . __('Disabled') . '</font>';
- if (false === $GLOBALS['cfg']['Server']['pmadb']) {
+ if (empty($GLOBALS['cfg']['Server']['pmadb'])) {
$retval .= __('Configuration of pmadb… ')
. $messages['error']
. PMA_Util::showDocu('setup', 'linked-tables')
@@ -215,6 +211,17 @@ function PMA_getRelationsParamDiagnostic($cfgRelation)
$messages
);
$retval .= PMA_getDiagMessageForParameter(
+ 'favorite',
+ isset($cfgRelation['favorite']),
+ $messages,
+ 'favorite'
+ );
+ $retval .= PMA_getDiagMessageForFeature(
+ __('Persistent favorite tables'),
+ 'favoritework',
+ $messages
+ );
+ $retval .= PMA_getDiagMessageForParameter(
'table_uiprefs',
isset($cfgRelation['table_uiprefs']),
$messages,
@@ -414,6 +421,7 @@ function PMA_checkRelationsParam()
$cfgRelation['mimework'] = false;
$cfgRelation['historywork'] = false;
$cfgRelation['recentwork'] = false;
+ $cfgRelation['favoritework'] = false;
$cfgRelation['uiprefswork'] = false;
$cfgRelation['trackingwork'] = false;
$cfgRelation['userconfigwork'] = false;
@@ -477,6 +485,8 @@ function PMA_checkRelationsParam()
$cfgRelation['history'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['recent']) {
$cfgRelation['recent'] = $curr_table[0];
+ } elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['favorite']) {
+ $cfgRelation['favorite'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['table_uiprefs']) {
$cfgRelation['table_uiprefs'] = $curr_table[0];
} elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['tracking']) {
@@ -523,6 +533,10 @@ function PMA_checkRelationsParam()
$cfgRelation['recentwork'] = true;
}
+ if (isset($cfgRelation['favorite'])) {
+ $cfgRelation['favoritework'] = true;
+ }
+
if (isset($cfgRelation['table_uiprefs'])) {
$cfgRelation['uiprefswork'] = true;
}
@@ -562,7 +576,7 @@ function PMA_checkRelationsParam()
&& $cfgRelation['trackingwork'] && $cfgRelation['userconfigwork']
&& $cfgRelation['bookmarkwork'] && $cfgRelation['central_columnswork']
&& $cfgRelation['menuswork'] && $cfgRelation['navwork']
- && $cfgRelation['savedsearcheswork']
+ && $cfgRelation['savedsearcheswork'] && $cfgRelation['favoritework']
) {
$cfgRelation['allworks'] = true;
}
@@ -1595,21 +1609,57 @@ function PMA_REL_renameTable($source_db, $target_db, $source_table, $target_tabl
);
}
- /**
- * @todo Can't get moving PDFs the right way. The page numbers
- * always get screwed up independently from duplication because the
- * numbers do not seem to be stored on a per-database basis. Would
- * the author of pdf support please have a look at it?
- */
-
if ($GLOBALS['cfgRelation']['pdfwork']) {
+ if ($source_db == $target_db) {
+ // rename within the database can be handled
+ PMA_REL_renameSingleTable(
+ 'table_coords',
+ $source_db, $target_db,
+ $source_table, $target_table,
+ 'db_name', 'table_name'
+ );
+ } else {
+ // if the table is moved out of the database we can no loger keep the
+ // record for table coordinate
+ $remove_query = "DELETE FROM "
+ . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . "."
+ . PMA_Util::backquote($GLOBALS['cfgRelation']['table_coords'])
+ . " WHERE db_name = '" . PMA_Util::sqlAddSlashes($source_db) . "'"
+ . " AND table_name = '" . PMA_Util::sqlAddSlashes($source_table)
+ . "'";
+ PMA_queryAsControlUser($remove_query);
+ }
+ }
+
+ if ($GLOBALS['cfgRelation']['uiprefswork']) {
PMA_REL_renameSingleTable(
- 'table_coords',
+ 'table_uiprefs',
$source_db, $target_db,
$source_table, $target_table,
'db_name', 'table_name'
);
}
+
+ if ($GLOBALS['cfgRelation']['navwork']) {
+ // update hidden items inside table
+ PMA_REL_renameSingleTable(
+ 'navigationhiding',
+ $source_db, $target_db,
+ $source_table, $target_table,
+ 'db_name', 'table_name'
+ );
+
+ // update data for hidden table
+ $query = "UPDATE "
+ . PMA_Util::backquote($GLOBALS['cfgRelation']['db']) . "."
+ . PMA_Util::backquote($GLOBALS['cfgRelation']['navigationhiding'])
+ . " SET db_name = '" . PMA_Util::sqlAddSlashes($target_db) . "',"
+ . " item_name = '" . PMA_Util::sqlAddSlashes($target_table) . "'"
+ . " WHERE db_name = '" . PMA_Util::sqlAddSlashes($source_db) . "'"
+ . " AND item_name = '" . PMA_Util::sqlAddSlashes($source_table) . "'"
+ . " AND item_type = 'table'";
+ PMA_queryAsControlUser($query);
+ }
}
/**
@@ -1774,35 +1824,6 @@ function PMA_searchColumnInForeigners($foreigners, $column)
}
/**
- * Searches a DB for the existence of PMA tables.
- *
- * @param string $db Database
- * @param array $tables Default table names
- *
- * @return bool
- */
-function PMA_searchPMATablesInDb($db, $tables)
-{
- $tab_rs = $GLOBALS['dbi']->getTables($db);
-
- if ($tab_rs === false) {
- return false;
- }
-
- foreach ($tab_rs as $curr_table) {
- if (in_array($curr_table, $tables)) {
- $tables = array_diff($tables, array($curr_table));
- }
- }
-
- if (count($tables) != 0) {
- return false;
- }
-
- return true;
-}
-
-/**
* Returns default PMA table names and their create queries.
*
* @return array table name, create query
@@ -1839,61 +1860,75 @@ function PMA_getDefaultPMATableNames()
/**
* Creates PMA tables in the given db, updates if already exists.
*
- * @param string $db Database
+ * @param string $db database
+ * @param boolean $create whether to create tables if they don't exist.
*
* @return void
*/
-function PMA_fixPMATables($db)
+function PMA_fixPMATables($db, $create = true)
{
- $default_tables = PMA_getDefaultPMATableNames();
- $GLOBALS['dbi']->selectDb($db);
-
- foreach ($default_tables as $table => $create_query) {
- $GLOBALS['dbi']->tryQuery($create_query);
+ $tablesToFeatures = array(
+ 'pma__bookmark' => 'bookmarktable',
+ 'pma__relation' => 'relation',
+ 'pma__table_info' => 'table_info',
+ 'pma__table_coords' => 'table_coords',
+ 'pma__pdf_pages' => 'pdf_pages',
+ 'pma__column_info' => 'column_info',
+ 'pma__history' => 'history',
+ 'pma__recent' => 'recent',
+ 'pma__favorite' => 'favorite',
+ 'pma__table_uiprefs' => 'table_uiprefs',
+ 'pma__tracking' => 'tracking',
+ 'pma__userconfig' => 'userconfig',
+ 'pma__users' => 'users',
+ 'pma__usergroups' => 'usergroups',
+ 'pma__navigationhiding' => 'navigationhiding',
+ 'pma__savedsearches' => 'savedsearches',
+ 'pma__central_columns' => 'central_columns'
+ );
- if ($error = $GLOBALS['dbi']->getError()) {
- $GLOBALS['message'] = $error;
- break;
- }
+ $existingTables = $GLOBALS['dbi']->getTables($db, $GLOBALS['controllink']);
- if ($table == 'pma__bookmark') {
- $GLOBALS['cfg']['Server']['bookmarktable'] = $table;
- } elseif ($table == 'pma__relation') {
- $GLOBALS['cfg']['Server']['relation'] = $table;
- } elseif ($table == 'pma__table_info') {
- $GLOBALS['cfg']['Server']['table_info'] = $table;
- } elseif ($table == 'pma__table_coords') {
- $GLOBALS['cfg']['Server']['table_coords'] = $table;
- } elseif ($table == 'pma__column_info') {
- $GLOBALS['cfg']['Server']['column_info'] = $table;
- } elseif ($table == 'pma__pdf_pages') {
- $GLOBALS['cfg']['Server']['pdf_pages'] = $table;
- } elseif ($table == 'pma__history') {
- $GLOBALS['cfg']['Server']['history'] = $table;
- } elseif ($table == 'pma__recent') {
- $GLOBALS['cfg']['Server']['recent'] = $table;
- } elseif ($table == 'pma__table_uiprefs') {
- $GLOBALS['cfg']['Server']['table_uiprefs'] = $table;
- } elseif ($table == 'pma__tracking') {
- $GLOBALS['cfg']['Server']['tracking'] = $table;
- } elseif ($table == 'pma__userconfig') {
- $GLOBALS['cfg']['Server']['userconfig'] = $table;
- } elseif ($table == 'pma__users') {
- $GLOBALS['cfg']['Server']['users'] = $table;
- } elseif ($table == 'pma__usergroups') {
- $GLOBALS['cfg']['Server']['usergroups'] = $table;
- } elseif ($table == 'pma__navigationhiding') {
- $GLOBALS['cfg']['Server']['navigationhiding'] = $table;
- } elseif ($table == 'pma__savedsearches') {
- $GLOBALS['cfg']['Server']['savedsearches'] = $table;
- } elseif ($table == 'pma__central_columns') {
- $GLOBALS['cfg']['Server']['central_columns'] = $table;
- } else if ($table == 'pma__designer_coords') {
- $GLOBALS['cfg']['Server']['designer_coords'] = $table;
+ $createQueries = null;
+ foreach ($tablesToFeatures as $table => $feature) {
+ if (! in_array($table, $existingTables)) {
+ if ($create) {
+ if ($createQueries == null) { // first create
+ $createQueries = PMA_getDefaultPMATableNames();
+ $GLOBALS['dbi']->selectDb($db);
+ }
+ $GLOBALS['dbi']->tryQuery($createQueries[$table]);
+ if ($error = $GLOBALS['dbi']->getError()) {
+ $GLOBALS['message'] = $error;
+ return;
+ }
+ $GLOBALS['cfg']['Server'][$feature] = $table;
+ } else {
+ return;
+ }
+ } else {
+ $GLOBALS['cfg']['Server'][$feature] = $table;
}
}
+
$GLOBALS['cfg']['Server']['pmadb'] = $db;
$_SESSION['relation'][$GLOBALS['server']] = PMA_checkRelationsParam();
+
+ // Since configuration storage is updated, we need to
+ // re-initialize the favorite and recent tables stored in the
+ // session from the current configuration storage.
+ include_once 'libraries/RecentFavoriteTable.class.php';
+
+ $fav_tables = PMA_RecentFavoriteTable::getInstance('favorite');
+ $_SESSION['tmpval']['favorite_tables'][$GLOBALS['server']]
+ = $fav_tables->getFromDb();
+
+ $recent_tables = PMA_RecentFavoriteTable::getInstance('recent');
+ $_SESSION['tmpval']['recent_tables'][$GLOBALS['server']]
+ = $recent_tables->getFromDb();
+
+ // Reload navi panel to update the recent/favorite lists.
+ $GLOBALS['reload'] = true;
}
/**
diff --git a/libraries/relation_cleanup.lib.php b/libraries/relation_cleanup.lib.php
index 78886be8f0..2b591d2fd3 100644
--- a/libraries/relation_cleanup.lib.php
+++ b/libraries/relation_cleanup.lib.php
@@ -106,6 +106,24 @@ function PMA_relationsCleanupTable($db, $table)
. ' AND foreign_table = \'' . PMA_Util::sqlAddSlashes($table) . '\'';
PMA_queryAsControlUser($remove_query);
}
+
+ if ($cfgRelation['uiprefswork']) {
+ $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db'])
+ . '.' . PMA_Util::backquote($cfgRelation['table_uiprefs'])
+ . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\''
+ . ' AND table_name = \'' . PMA_Util::sqlAddSlashes($table) . '\'';
+ PMA_queryAsControlUser($remove_query);
+ }
+
+ if ($cfgRelation['navwork']) {
+ $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db'])
+ . '.' . PMA_Util::backquote($cfgRelation['navigationhiding'])
+ . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\''
+ . ' AND (table_name = \'' . PMA_Util::sqlAddSlashes($table) . '\''
+ . ' OR (item_name = \'' . PMA_Util::sqlAddSlashes($table) . '\''
+ . ' AND item_type = \'table\'))';
+ PMA_queryAsControlUser($remove_query);
+ }
}
/**
@@ -163,6 +181,34 @@ function PMA_relationsCleanupDatabase($db)
. ' WHERE foreign_db = \'' . PMA_Util::sqlAddSlashes($db) . '\'';
PMA_queryAsControlUser($remove_query);
}
+
+ if ($cfgRelation['uiprefswork']) {
+ $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db'])
+ . '.' . PMA_Util::backquote($cfgRelation['table_uiprefs'])
+ . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\'';
+ PMA_queryAsControlUser($remove_query);
+ }
+
+ if ($cfgRelation['navwork']) {
+ $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db'])
+ . '.' . PMA_Util::backquote($cfgRelation['navigationhiding'])
+ . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\'';
+ PMA_queryAsControlUser($remove_query);
+ }
+
+ if ($cfgRelation['savedsearcheswork']) {
+ $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db'])
+ . '.' . PMA_Util::backquote($cfgRelation['savedsearches'])
+ . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\'';
+ PMA_queryAsControlUser($remove_query);
+ }
+
+ if ($cfgRelation['central_columnswork']) {
+ $remove_query = 'DELETE FROM ' . PMA_Util::backquote($cfgRelation['db'])
+ . '.' . PMA_Util::backquote($cfgRelation['central_columns'])
+ . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($db) . '\'';
+ PMA_queryAsControlUser($remove_query);
+ }
}
?>
diff --git a/libraries/server_privileges.lib.php b/libraries/server_privileges.lib.php
index 084bf2c4fb..93e101cde7 100644
--- a/libraries/server_privileges.lib.php
+++ b/libraries/server_privileges.lib.php
@@ -526,10 +526,11 @@ function PMA_getHtmlToChooseUserGroup($username)
$html_output .= '<fieldset id="fieldset_user_group_selection">';
$html_output .= '<legend>' . __('User group') . '</legend>';
- $groupTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
- . "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['usergroups']);
- $userTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
- . "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['users']);
+ $cfgRelation = PMA_getRelationsParam();
+ $groupTable = PMA_Util::backquote($cfgRelation['db'])
+ . "." . PMA_Util::backquote($cfgRelation['usergroups']);
+ $userTable = PMA_Util::backquote($cfgRelation['db'])
+ . "." . PMA_Util::backquote($cfgRelation['users']);
$userGroups = array();
$sql_query = "SELECT DISTINCT `usergroup` FROM " . $groupTable;
@@ -577,8 +578,9 @@ function PMA_getHtmlToChooseUserGroup($username)
*/
function PMA_setUserGroup($username, $userGroup)
{
- $userTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
- . "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['users']);
+ $cfgRelation = PMA_getRelationsParam();
+ $userTable = PMA_Util::backquote($cfgRelation['db'])
+ . "." . PMA_Util::backquote($cfgRelation['users']);
$sql_query = "SELECT `usergroup` FROM " . $userTable
. " WHERE `username` = '" . PMA_Util::sqlAddSlashes($username) . "'";
@@ -2306,8 +2308,9 @@ function PMA_getUserGroupEditLink($username)
*/
function PMA_getUserGroupCount()
{
- $user_group_table = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
- . '.' . PMA_Util::backquote($GLOBALS['cfg']['Server']['usergroups']);
+ $cfgRelation = PMA_getRelationsParam();
+ $user_group_table = PMA_Util::backquote($cfgRelation['db'])
+ . '.' . PMA_Util::backquote($cfgRelation['usergroups']);
$sql_query = 'SELECT COUNT(*) FROM ' . $user_group_table;
$user_group_count = $GLOBALS['dbi']->fetchValue(
$sql_query, 0, 0, $GLOBALS['controllink']
@@ -3016,9 +3019,10 @@ function PMA_getUsersOverview($result, $db_rights, $pmaThemeImage, $text_dir)
*/
function PMA_getHtmlTableBodyForUserRights($db_rights)
{
- if ($GLOBALS['cfgRelation']['menuswork']) {
- $users_table = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
- . "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['users']);
+ $cfgRelation = PMA_getRelationsParam();
+ if ($cfgRelation['menuswork']) {
+ $users_table = PMA_Util::backquote($cfgRelation['db'])
+ . "." . PMA_Util::backquote($cfgRelation['users']);
$sql_query = 'SELECT * FROM ' . $users_table;
$result = PMA_queryAsControlUser($sql_query, false);
$group_assignment = array();
diff --git a/libraries/server_user_groups.lib.php b/libraries/server_user_groups.lib.php
index 3e8ad89717..d3ec9c340a 100644
--- a/libraries/server_user_groups.lib.php
+++ b/libraries/server_user_groups.lib.php
@@ -23,8 +23,9 @@ function PMA_getHtmlForListingUsersofAGroup($userGroup)
. sprintf(__('Users of \'%s\' user group'), htmlspecialchars($userGroup))
. '</h2>';
- $usersTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
- . "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['users']);
+ $cfgRelation = PMA_getRelationsParam();
+ $usersTable = PMA_Util::backquote($cfgRelation['db'])
+ . "." . PMA_Util::backquote($cfgRelation['users']);
$sql_query = "SELECT `username` FROM " . $usersTable
. " WHERE `usergroup`='" . PMA_Util::sqlAddSlashes($userGroup) . "'";
$result = PMA_queryAsControlUser($sql_query, false);
@@ -61,8 +62,9 @@ function PMA_getHtmlForListingUsersofAGroup($userGroup)
function PMA_getHtmlForUserGroupsTable()
{
$html_output = '<h2>' . __('User groups') . '</h2>';
- $groupTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
- . "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['usergroups']);
+ $cfgRelation = PMA_getRelationsParam();
+ $groupTable = PMA_Util::backquote($cfgRelation['db'])
+ . "." . PMA_Util::backquote($cfgRelation['usergroups']);
$sql_query = "SELECT * FROM " . $groupTable . " ORDER BY `usergroup` ASC";
$result = PMA_queryAsControlUser($sql_query, false);
@@ -180,10 +182,11 @@ function _getAllowedTabNames($row, $level)
*/
function PMA_deleteUserGroup($userGroup)
{
- $userTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
- . "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['users']);
- $groupTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
- . "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['usergroups']);
+ $cfgRelation = PMA_getRelationsParam();
+ $userTable = PMA_Util::backquote($cfgRelation['db'])
+ . "." . PMA_Util::backquote($cfgRelation['users']);
+ $groupTable = PMA_Util::backquote($cfgRelation['db'])
+ . "." . PMA_Util::backquote($cfgRelation['usergroups']);
$sql_query = "DELETE FROM " . $userTable
. " WHERE `usergroup`='" . PMA_Util::sqlAddSlashes($userGroup) . "'";
PMA_queryAsControlUser($sql_query, true);
@@ -241,8 +244,9 @@ function PMA_getHtmlToEditUserGroup($userGroup = null)
'table' => array()
);
if ($userGroup != null) {
- $groupTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
- . "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['usergroups']);
+ $cfgRelation = PMA_getRelationsParam();
+ $groupTable = PMA_Util::backquote($cfgRelation['db'])
+ . "." . PMA_Util::backquote($cfgRelation['usergroups']);
$sql_query = "SELECT * FROM " . $groupTable
. " WHERE `usergroup`='" . PMA_Util::sqlAddSlashes($userGroup) . "'";
$result = PMA_queryAsControlUser($sql_query, false);
@@ -324,8 +328,9 @@ function _getTabList($title, $level, $selected)
function PMA_editUserGroup($userGroup, $new = false)
{
$tabs = PMA_Util::getMenuTabList();
- $groupTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
- . "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['usergroups']);
+ $cfgRelation = PMA_getRelationsParam();
+ $groupTable = PMA_Util::backquote($cfgRelation['db'])
+ . "." . PMA_Util::backquote($cfgRelation['usergroups']);
if (! $new) {
$sql_query = "DELETE FROM " . $groupTable
diff --git a/libraries/sql.lib.php b/libraries/sql.lib.php
index 626eb4c5dc..6c6c15fdcd 100644
--- a/libraries/sql.lib.php
+++ b/libraries/sql.lib.php
@@ -2204,7 +2204,7 @@ function PMA_sendQueryResponseForResultsReturned($result,
);
$profiling_chart_html = PMA_getHtmlForProfilingChart(
- $disp_mode, $db, isset($profiling_results) ? $profiling_results : null
+ $url_query, $db, isset($profiling_results) ? $profiling_results : null
);
$missing_unique_column_msg = PMA_getMessageIfMissingColumnIndex(
diff --git a/libraries/tracking.lib.php b/libraries/tracking.lib.php
index ba8e7c7c3b..ff45d16697 100644
--- a/libraries/tracking.lib.php
+++ b/libraries/tracking.lib.php
@@ -197,9 +197,10 @@ function PMA_getHtmlForActivateDeactivateTracking(
*/
function PMA_getListOfVersionsOfTable()
{
+ $cfgRelation = PMA_getRelationsParam();
$sql_query = " SELECT * FROM " .
- PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb']) . "." .
- PMA_Util::backquote($GLOBALS['cfg']['Server']['tracking']) .
+ PMA_Util::backquote($cfgRelation['db']) . "." .
+ PMA_Util::backquote($cfgRelation['tracking']) .
" WHERE db_name = '" . PMA_Util::sqlAddSlashes($_REQUEST['db']) . "' " .
" AND table_name = '" . PMA_Util::sqlAddSlashes($_REQUEST['table']) . "' " .
" ORDER BY version DESC ";
@@ -317,10 +318,11 @@ function PMA_getTableLastVersionNumber($sql_result)
function PMA_getSQLResultForSelectableTables()
{
include_once 'libraries/relation.lib.php';
+ $cfgRelation = PMA_getRelationsParam();
$sql_query = " SELECT DISTINCT db_name, table_name FROM " .
- PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb']) . "." .
- PMA_Util::backquote($GLOBALS['cfg']['Server']['tracking']) .
+ PMA_Util::backquote($cfgRelation['db']) . "." .
+ PMA_Util::backquote($cfgRelation['tracking']) .
" WHERE db_name = '" . PMA_Util::sqlAddSlashes($GLOBALS['db']) . "' " .
" ORDER BY db_name, table_name";
@@ -606,7 +608,7 @@ function PMA_getHtmlForDataManipulationStatements($data, $filter_users,
// no need for the secondth returned parameter
list($html,) = PMA_getHtmlForDataStatements(
$data, $filter_users, $filter_ts_from, $filter_ts_to, $url_params,
- $drop_image_or_text, 'dmlog', __('Data manipulation statement'),
+ $drop_image_or_text, 'dmlog', __('Data manipulation statement'),
$ddlog_count, 'dml_versions'
);
@@ -682,7 +684,7 @@ function PMA_getHtmlForDataDefinitionStatements($data, $filter_users,
) {
list($html, $line_number) = PMA_getHtmlForDataStatements(
$data, $filter_users, $filter_ts_from, $filter_ts_to, $url_params,
- $drop_image_or_text, 'ddlog', __('Data definition statement'),
+ $drop_image_or_text, 'ddlog', __('Data definition statement'),
1, 'ddl_versions'
);