forked from phpmyadmin/phpmyadmin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server_databases.php
111 lines (96 loc) · 2.48 KB
/
server_databases.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Server databases
*
* @package PhpMyAdmin
*/
/**
* Does the common work
*/
require_once 'libraries/common.inc.php';
require_once 'libraries/server_common.inc.php';
require_once 'libraries/server_databases.lib.php';
$response = PMA_Response::getInstance();
$header = $response->getHeader();
$scripts = $header->getScripts();
$scripts->addFile('server_databases.js');
require_once 'libraries/replication.inc.php';
require 'libraries/build_html_for_db.lib.php';
/**
* Sets globals from $_POST
*/
$post_params = array(
'mult_btn',
'query_type',
'selected'
);
foreach ($post_params as $one_post_param) {
if (isset($_POST[$one_post_param])) {
$GLOBALS[$one_post_param] = $_POST[$one_post_param];
}
}
list($sort_by, $sort_order) = PMA_getListForSortDatabase();
$dbstats = empty($_REQUEST['dbstats']) ? 0 : 1;
$pos = empty($_REQUEST['pos']) ? 0 : (int) $_REQUEST['pos'];
/**
* Drops multiple databases
*/
// workaround for IE behavior (it returns some coordinates based on where
// the mouse was on the Drop image):
if (isset($_REQUEST['drop_selected_dbs_x'])) {
$_REQUEST['drop_selected_dbs'] = true;
}
if ((isset($_REQUEST['drop_selected_dbs']) || isset($_REQUEST['query_type']))
&& ($is_superuser || $cfg['AllowUserDropDatabase'])
) {
PMA_dropMultiDatabases();
}
/**
* Displays the sub-page heading
*/
$header_type = $dbstats ? "database_statistics" : "databases";
$response->addHTML(PMA_getHtmlForSubPageHeader($header_type));
/**
* Displays For Create database.
*/
$html = '';
if ($cfg['ShowCreateDb']) {
$html .= '<ul><li id="li_create_database" class="no_bullets">' . "\n";
include 'libraries/display_create_database.lib.php';
$html .= ' </li>' . "\n";
$html .= '</ul>' . "\n";
}
/**
* Gets the databases list
*/
if ($server > 0) {
$databases = $GLOBALS['dbi']->getDatabasesFull(
null, $dbstats, null, $sort_by, $sort_order, $pos, true
);
$databases_count = count($GLOBALS['pma']->databases);
} else {
$databases_count = 0;
}
/**
* Displays the page
*/
if ($databases_count > 0) {
$html .= PMA_getHtmlForDatabase(
$databases,
$databases_count,
$pos,
$dbstats,
$sort_by,
$sort_order,
$is_superuser,
$cfg,
$replication_types,
$GLOBALS['replication_info'],
$url_query
);
} else {
$html .= __('No databases');
}
unset($databases_count);
$response->addHTML($html);