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>2014-12-23 14:48:13 +0300
committerChristian Foellmann <foellmann@foe-services.de>2014-12-23 14:48:13 +0300
commit2bfb20e57418ebf396149782be9f98e868fe8608 (patch)
treea5ec4011410970603d3f462a535a5a359057fa77 /libraries/RecentFavoriteTable.class.php
parent20f1bf77c8281efc675a14e0f6bf52f657dabd9a (diff)
UPDATE 4.3.34.3.3
Diffstat (limited to 'libraries/RecentFavoriteTable.class.php')
-rw-r--r--libraries/RecentFavoriteTable.class.php62
1 files changed, 47 insertions, 15 deletions
diff --git a/libraries/RecentFavoriteTable.class.php b/libraries/RecentFavoriteTable.class.php
index 9221ba38b6..e1f31b0eb7 100644
--- a/libraries/RecentFavoriteTable.class.php
+++ b/libraries/RecentFavoriteTable.class.php
@@ -57,25 +57,28 @@ class PMA_RecentFavoriteTable
/**
* Creates a new instance of PMA_RecentFavoriteTable
*
- * @access private
* @param string $type the table type
+ *
+ * @access private
*/
private function __construct($type)
{
$this->_tableType = $type;
- if (strlen($GLOBALS['cfg']['Server']['pmadb'])
- && strlen($GLOBALS['cfg']['Server'][$this->_tableType])
+ 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])) {
+ if (! isset($_SESSION['tmpval'][$this->_tableType . '_tables'][$server_id])
+ ) {
$_SESSION['tmpval'][$this->_tableType . '_tables'][$server_id]
= isset($this->_pmaTable) ? $this->getFromDb() : array();
}
- $this->_tables =& $_SESSION['tmpval'][$this->_tableType . '_tables'][$server_id];
+ $this->_tables
+ =& $_SESSION['tmpval'][$this->_tableType . '_tables'][$server_id];
}
/**
@@ -191,13 +194,6 @@ class PMA_RecentFavoriteTable
*/
public function getHtmlList()
{
- // Remove Recent/Favorite tables that don't exist.
- foreach ($this->_tables as $tbl) {
- if (! $GLOBALS['dbi']->getColumns($tbl['db'], $tbl['table'])) {
- $this->remove($tbl['db'], $tbl['table']);
- }
- }
-
$html = '';
if (count($this->_tables)) {
if ($this->_tableType == 'recent') {
@@ -207,7 +203,7 @@ class PMA_RecentFavoriteTable
'db' => $table['db'],
'table' => $table['table']
);
- $recent_url = 'sql.php'
+ $recent_url = 'tbl_recent_favorite.php'
. PMA_URL_getCommon($recent_params);
$html .= '<a href="' . $recent_url . '">`'
. htmlspecialchars($table['db']) . '`.`'
@@ -239,7 +235,7 @@ class PMA_RecentFavoriteTable
'db' => $table['db'],
'table' => $table['table']
);
- $table_url = 'sql.php'
+ $table_url = 'tbl_recent_favorite.php'
. PMA_URL_getCommon($fav_params);
$html .= '<a href="' . $table_url . '">`'
. htmlspecialchars($table['db']) . '`.`'
@@ -289,7 +285,7 @@ class PMA_RecentFavoriteTable
*/
public function add($db, $table)
{
- // If table doesnot exist, do not add.
+ // If table does not exist, do not add.
if (! $GLOBALS['dbi']->getColumns($db, $table)) {
return true;
}
@@ -311,6 +307,28 @@ class PMA_RecentFavoriteTable
}
/**
+ * Removes recent/favorite tables that don't exist.
+ *
+ * @param string $db database
+ * @param string $table table
+ *
+ * @return booean|PMA_Message True if invalid and removed, False if not invalid,
+ * PMA_Message if error while removing
+ */
+ public function removeIfInvalid($db, $table)
+ {
+ foreach ($this->_tables as $tbl) {
+ if ($tbl['db'] == $db && $tbl['table'] == $table) {
+ // TODO Figure out a better way to find the existance of a table
+ if (! $GLOBALS['dbi']->getColumns($tbl['db'], $tbl['table'])) {
+ return $this->remove($tbl['db'], $tbl['table']);
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
* Remove favorite tables.
*
* @param string $db database name where the table is located
@@ -355,5 +373,19 @@ class PMA_RecentFavoriteTable
}
return $retval;
}
+
+ /**
+ * Generate Html to update recent tables.
+ *
+ * @return string html
+ */
+ public static function getHtmlUpdateRecentTables()
+ {
+ $params = array('ajax_request' => true, 'recent_table' => true);
+ $url = 'index.php' . PMA_URL_getCommon($params);
+ $retval = '<a class="hide" id="update_recent_tables"';
+ $retval .= ' href="' . $url . '"></a>';
+ return $retval;
+ }
}
?>