(int)$b[$sort_by] ? 1 : -1);
}
} // end of the 'PMA_dbCmp()' function
/**
* avoids 'undefined index' errors
*/
if (empty($_REQUEST['sort_by'])) {
$sort_by = 'SCHEMA_NAME';
} else {
$sort_by = PMA_sanitize($_REQUEST['sort_by']);
}
if (empty($_REQUEST['sort_order'])) {
if ($sort_by == 'SCHEMA_NAME') {
$sort_order = 'asc';
} else {
$sort_order = 'desc';
}
} else {
$sort_order = PMA_sanitize($_REQUEST['sort_order']);
}
$dbstats = empty($dbstats) ? 0 : 1;
/**
* 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'])) {
if (! isset($_REQUEST['selected_dbs']) && ! isset($_REQUEST['query_type'])) {
$message = $strNoDatabasesSelected;
} else {
$action = 'server_databases.php';
$submit_mult = 'drop_db' ;
$err_url = 'server_databases.php?' . PMA_generate_common_url();
if (isset($_REQUEST['selected_dbs'])) {
$selected_db = $_REQUEST['selected_dbs'];
}
require './libraries/mult_submits.inc.php';
unset($action, $submit_mult, $err_url, $selected_db);
if ($mult_btn == $strYes) {
$message = sprintf($strDatabasesDropped, count($selected));
} else {
$message = sprintf($strDatabasesDropped, 0);
}
}
}
/**
* Displays the links
*/
require './libraries/server_links.inc.php';
/**
* Displays the sub-page heading
*/
echo '
' . "\n"
. ( $GLOBALS['cfg']['MainPageIconic']
? '
'
: '' )
. ( $dbstats ? $strDatabasesStats : $strDatabases ) . "\n"
.'
' . "\n";
/**
* Gets the databases list
*/
if ($server > 0) {
$databases = PMA_DBI_get_databases_full(null, $dbstats);
} else {
$databases = array();
}
/**
* Displays the page
*/
$tmp_count = count($databases);
if ($tmp_count > 0) {
if ($tmp_count > 1) {
// sorts the array
usort( $databases, 'PMA_dbCmp' );
} else {
// when there is only one database, the sort would not happen and
// the index would not become numeric (reproduced in MySQL 3.23.52)
$tmp_each = each($databases);
$databases = array();
$databases[0] = $tmp_each['value'];
unset($tmp_each);
}
// table col order
// there is no db specific collation or charset prior 4.1.0
if (PMA_MYSQL_INT_VERSION >= 40100) {
$column_order['DEFAULT_COLLATION_NAME'] = array(
'disp_name' => $strCollation,
'description_function' => 'PMA_getCollationDescr',
'format' => 'string',
'footer' => PMA_getServerCollation(),
);
}
$column_order['SCHEMA_TABLES'] = array(
'disp_name' => $strNumTables,
'format' => 'number',
'footer' => 0,
);
$column_order['SCHEMA_TABLE_ROWS'] = array(
'disp_name' => $strRows,
'format' => 'number',
'footer' => 0,
);
$column_order['SCHEMA_DATA_LENGTH'] = array(
'disp_name' => $strData,
'format' => 'byte',
'footer' => 0,
);
$column_order['SCHEMA_INDEX_LENGTH'] = array(
'disp_name' => $strIndexes,
'format' => 'byte',
'footer' => 0,
);
$column_order['SCHEMA_LENGTH'] = array(
'disp_name' => $strTotalUC,
'format' => 'byte',
'footer' => 0,
);
$column_order['SCHEMA_DATA_FREE'] = array(
'disp_name' => $strOverhead,
'format' => 'byte',
'footer' => 0,
);
echo '';
} else {
echo $strNoDatabases;
}
unset($tmp_count);
/**
* Create new database.
*/
echo '- ' . "\n";
require './libraries/display_create_database.lib.php';
echo '
' . "\n";
echo '
' . "\n";
/**
* Sends the footer
*/
require_once './libraries/footer.inc.php';
?>