getTables();
if (empty($fav_instance_tables)
&& isset($favorite_tables[$user])
) {
foreach ($favorite_tables[$user] as $key => $value) {
$fav_instance->add($value['db'], $value['table']);
}
}
$favorite_tables[$user] = $fav_instance->getTables();
$ajax_response = PMA_Response::getInstance();
$ajax_response->addJSON(
'favorite_tables',
json_encode($favorite_tables)
);
$ajax_response->addJSON(
'list',
$fav_instance->getHtmlList()
);
$server_id = $GLOBALS['server'];
// Set flag when localStorage and pmadb(if present) are in sync.
$_SESSION['tmpval']['favorites_synced'][$server_id] = true;
exit;
}
global $db;
$changes = true;
$msg = '';
$titles = PMA_Util::buildActionTitles();
$favorite_table = $_REQUEST['favorite_table'];
$already_favorite = PMA_checkFavoriteTable($db, $favorite_table);
if (isset($_REQUEST['remove_favorite'])) {
if ($already_favorite) {
// If already in favorite list, remove it.
$fav_instance->remove($db, $favorite_table);
}
} elseif (isset($_REQUEST['add_favorite'])) {
if (!$already_favorite) {
if (count($fav_instance->getTables()) == $GLOBALS['cfg']['NumFavoriteTables']) {
$changes = false;
$msg = '

'
. __("Favorite List is full!")
. '
';
} else {
// Otherwise add to favorite list.
$fav_instance->add($db, $favorite_table);
}
}
}
$favorite_tables[$user] = $fav_instance->getTables();
$ajax_response = PMA_Response::getInstance();
$ajax_response->addJSON(
'changes',
$changes
);
if ($changes) {
$ajax_response->addJSON(
'user',
$user
);
$ajax_response->addJSON(
'favorite_tables',
json_encode($favorite_tables)
);
$ajax_response->addJSON(
'list',
$fav_instance->getHtmlList()
);
$ajax_response->addJSON(
'anchor',
PMA_getHtmlForFavoriteAnchor(
$db, $favorite_table, $titles
)
);
} else {
$ajax_response->addJSON(
'message',
$msg
);
}
exit;
}
$response = PMA_Response::getInstance();
$header = $response->getHeader();
$scripts = $header->getScripts();
$scripts->addFile('db_structure.js');
$scripts->addFile('tbl_change.js');
$scripts->addFile('jquery/jquery-ui-timepicker-addon.js');
// Drops/deletes/etc. multiple tables if required
if ((!empty($_POST['submit_mult']) && isset($_POST['selected_tbl']))
|| isset($_POST['mult_btn'])
) {
$action = 'db_structure.php';
$err_url = 'db_structure.php?' . PMA_URL_getCommon($db);
// see bug #2794840; in this case, code path is:
// db_structure.php -> libraries/mult_submits.inc.php -> sql.php
// -> db_structure.php and if we got an error on the multi submit,
// we must display it here and not call again mult_submits.inc.php
if (! isset($_POST['error']) || false === $_POST['error']) {
include 'libraries/mult_submits.inc.php';
}
if (empty($_POST['message'])) {
$_POST['message'] = PMA_Message::success();
}
}
require 'libraries/db_common.inc.php';
$url_query .= '&goto=db_structure.php';
// Gets the database structure
$sub_part = '_structure';
require 'libraries/db_info.inc.php';
if (!PMA_DRIZZLE) {
include_once 'libraries/replication.inc.php';
} else {
$server_slave_status = false;
}
require_once 'libraries/bookmark.lib.php';
require_once 'libraries/mysql_charsets.inc.php';
$db_collation = PMA_getDbCollation($db);
$titles = PMA_Util::buildActionTitles();
// 1. No tables
if ($num_tables == 0) {
$response->addHTML(
'' . __('No tables found in database.') . '
' . "\n"
);
if (empty($db_is_system_schema)) {
ob_start();
include 'libraries/display_create_table.lib.php';
$content = ob_get_contents();
ob_end_clean();
$response->addHTML($content);
unset($content);
} // end if (Create Table dialog)
exit;
}
// else
// 2. Shows table informations
/**
* Displays the tables list
*/
$response->addHTML('');
$_url_params = array(
'pos' => $pos,
'db' => $db);
// Add the sort options if they exists
if (isset($_REQUEST['sort'])) {
$_url_params['sort'] = $_REQUEST['sort'];
}
if (isset($_REQUEST['sort_order'])) {
$_url_params['sort_order'] = $_REQUEST['sort_order'];
}
$response->addHTML(
PMA_Util::getListNavigator(
$total_num_tables, $pos, $_url_params, 'db_structure.php',
'frame_content', $GLOBALS['cfg']['MaxTableList']
)
);
// tables form
$response->addHTML(
'
'); //end of form
// display again the table list navigator
$response->addHTML(
PMA_Util::getListNavigator(
$total_num_tables, $pos, $_url_params, 'db_structure.php',
'frame_content', $GLOBALS['cfg']['MaxTableList']
)
);
$response->addHTML('
');
/**
* Work on the database
*/
/* DATABASE WORK */
/* Printable view of a table */
$response->addHTML(
PMA_getHtmlForTablePrintViewLink($url_query)
. PMA_getHtmlForDataDictionaryLink($url_query)
);
if (empty($db_is_system_schema)) {
ob_start();
include 'libraries/display_create_table.lib.php';
$content = ob_get_contents();
ob_end_clean();
$response->addHTML($content);
} // end if (Create Table dialog)
?>