2 /* vim: set expandtab sw=4 ts=4 sts=4: */
8 if (! defined('PHPMYADMIN')) {
13 * Gets some core libraries
15 require_once './libraries/common.inc.php';
16 require_once './libraries/bookmark.lib.php';
18 PMA_checkParameters(array('db'));
20 $is_show_stats = $cfg['ShowStats'];
22 if ($db == 'information_schema') {
23 $is_show_stats = false;
24 $db_is_information_schema = true;
26 $db_is_information_schema = false;
30 * Defines the urls to return to in case of error in a sql statement
32 $err_url_0 = 'main.php?' . PMA_generate_common_url();
33 $err_url = $cfg['DefaultTabDatabase'] . '?' . PMA_generate_common_url($db);
37 * Ensures the database exists (else move to the "parent" script) and displays
40 if (!isset($is_db) ||
!$is_db) {
41 // Not a valid db name -> back to the welcome page
43 $is_db = PMA_DBI_select_db($db);
45 if (! strlen($db) ||
!$is_db) {
46 PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'main.php?' . PMA_generate_common_url('', '', '&') . (isset($message) ?
'&message=' . urlencode($message) : '') . '&reload=1');
49 } // end if (ensures db exists)
52 * Changes database charset if requested by the user
54 if (isset($submitcollation) && !empty($db_collation)) {
55 list($db_charset) = explode('_', $db_collation);
56 $sql_query = 'ALTER DATABASE ' . PMA_backquote($db) . ' DEFAULT' . PMA_generateCharsetQueryPart($db_collation);
57 $result = PMA_DBI_query($sql_query);
58 $message = PMA_Message
::success();
59 unset($db_charset, $db_collation);
62 $GLOBALS['js_include'][] = 'functions.js';
63 require_once './libraries/header.inc.php';
66 * Set parameters for links
68 $url_query = PMA_generate_common_url($db);