Refactored ConfigFile class so that it is no longer a singleton
[phpmyadmin.git] / server_databases.php
blob2ee0c2b5800bddee31978b1746577288fc30dcbf
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Server databases
6 * @package PhpMyAdmin
7 */
9 /**
10 * Does the common work
12 require_once 'libraries/common.inc.php';
13 require_once 'libraries/server_common.inc.php';
14 require_once 'libraries/server_databases.lib.php';
16 $response = PMA_Response::getInstance();
17 $header = $response->getHeader();
18 $scripts = $header->getScripts();
19 $scripts->addFile('server_databases.js');
21 if (! PMA_DRIZZLE) {
22 include_once 'libraries/replication.inc.php';
23 } else {
24 $replication_types = array();
25 $replication_info = null;
27 require 'libraries/build_html_for_db.lib.php';
29 /**
30 * Sets globals from $_POST
32 $post_params = array(
33 'mult_btn',
34 'query_type',
35 'selected'
37 foreach ($post_params as $one_post_param) {
38 if (isset($_POST[$one_post_param])) {
39 $GLOBALS[$one_post_param] = $_POST[$one_post_param];
43 list($sort_by, $sort_order) = PMA_getListForSortDatabase();
45 $dbstats = empty($_REQUEST['dbstats']) ? 0 : 1;
46 $pos = empty($_REQUEST['pos']) ? 0 : (int) $_REQUEST['pos'];
49 /**
50 * Drops multiple databases
52 // workaround for IE behavior (it returns some coordinates based on where
53 // the mouse was on the Drop image):
54 if (isset($_REQUEST['drop_selected_dbs_x'])) {
55 $_REQUEST['drop_selected_dbs'] = true;
58 if ((isset($_REQUEST['drop_selected_dbs']) || isset($_REQUEST['query_type']))
59 && ($is_superuser || $cfg['AllowUserDropDatabase'])
60 ) {
61 PMA_dropMultiDatabases();
64 /**
65 * Displays the sub-page heading
67 $header_type = $dbstats ? "database_statistics" : "databases";
68 $response->addHTML(PMA_getHtmlForSubPageHeader($header_type));
70 /**
71 * Displays For Create database.
73 $html = '';
74 if ($cfg['ShowCreateDb']) {
75 $html .= '<ul><li id="li_create_database" class="no_bullets">' . "\n";
76 include 'libraries/display_create_database.lib.php';
77 $html .= ' </li>' . "\n";
78 $html .= '</ul>' . "\n";
81 /**
82 * Gets the databases list
84 if ($server > 0) {
85 $databases = $GLOBALS['dbi']->getDatabasesFull(
86 null, $dbstats, null, $sort_by, $sort_order, $pos, true
88 $databases_count = count($GLOBALS['pma']->databases);
89 } else {
90 $databases_count = 0;
94 /**
95 * Displays the page
97 if ($databases_count > 0) {
98 $html .= PMA_getHtmlForDatabase(
99 $databases,
100 $databases_count,
101 $pos,
102 $dbstats,
103 $sort_by,
104 $sort_order,
105 $is_superuser,
106 $cfg,
107 $replication_types,
108 $replication_info,
109 $url_query
111 } else {
112 $html .= __('No databases');
114 unset($databases_count);
116 $response->addHTML($html);