(int)$b[$sort_by] ? 1 : -1); } } // end of the 'PMA_dbCmp()' function /** * avoids 'undefined index' errors */ if (empty($sort_by)) { $sort_by = 'SCHEMA_NAME'; } else { $sort_by = PMA_sanitize($sort_by); } if (empty($sort_order)) { if ($sort_by == 'SCHEMA_NAME') { $sort_order = 'asc'; } else { $sort_order = 'desc'; } } else { $sort_order = PMA_sanitize($sort_order); } $dbstats = empty( $dbstats ) ? 0 : 1; /** * Drops multiple databases */ if ((!empty($drop_selected_dbs) || isset($query_type)) && ($is_superuser || $cfg['AllowUserDropDatabase'])) { if (empty($selected_db) && ! (isset($query_type) && !empty($selected))) { $message = $strNoDatabasesSelected; } else { $action = 'server_databases.php'; $submit_mult = 'drop_db' ; $err_url = 'server_databases.php?' . PMA_generate_common_url(); require('./mult_submits.inc.php'); if ($mult_btn == $strYes) { $message = sprintf($strDatabasesDropped, count($selected)); } else { $message = sprintf($strDatabasesDropped, 0); } } } /** * Displays the links */ require('./server_links.inc.php'); /** * Displays the sub-page heading */ echo '

' . "\n" . ( $GLOBALS['cfg']['MainPageIconic'] ? '' : '' ) . ( $dbstats ? $strDatabasesStats : $strDatabases ) . "\n" .'

' . "\n"; /** * Checks if the user is allowed to do what he tries to... */ if ( $dbstats && ! $is_superuser ) { echo $strNoPrivileges . "\n"; require_once('./footer.inc.php'); } /** * Gets the databases list */ if ( $server > 0 ) { $databases = PMA_DBI_get_databases_full( NULL, $dbstats ); } else { $databases = array(); } /** * Displays the page */ if ( count($databases) > 0 ) { // sorts the array usort( $databases, 'PMA_dbCmp' ); // table col order $column_order = array( 'DEFAULT_COLLATION_NAME' => array( 'disp_name' => $strCollation, 'description_function' => 'PMA_getCollationDescr', 'format' => 'string', 'footer' => PMA_getServerCollation(), ), 'SCHEMA_TABLES' => array( 'disp_name' => $strNumTables, 'format' => 'number', 'footer' => 0, ), 'SCHEMA_TABLE_ROWS' => array( 'disp_name' => $strRows, 'format' => 'number', 'footer' => 0, ), 'SCHEMA_DATA_LENGTH' => array( 'disp_name' => $strData, 'format' => 'byte', 'footer' => 0, ), 'SCHEMA_INDEX_LENGTH' => array( 'disp_name' => $strIndexes, 'format' => 'byte', 'footer' => 0, ), 'SCHEMA_LENGTH' => array( 'disp_name' => $strTotalUC, 'format' => 'byte', 'footer' => 0, ), 'SCHEMA_DATA_FREE' => array( 'disp_name' => $strOverhead, 'format' => 'byte', 'footer' => 0, ), ); echo '
' . "\n" . PMA_generate_common_hidden_inputs('', '', 1) . '' . "\n" . '' . "\n" . '' . "\n" . '' . "\n" . '' . "\n" . '' . "\n" . ($is_superuser || $cfg['AllowUserDropDatabase'] ? ' ' . "\n" : '') . ' ' . "\n"; $table_columns = 3; foreach ( $column_order as $stat_name => $stat ) { if ( array_key_exists( $stat_name, $databases[0] ) ) { if ( $stat['format'] === 'byte' ) { $table_columns += 2; $colspan = ' colspan="2"'; } else { $table_columns++; $colspan = ''; } echo ' ' .'' . "\n" .' ' . $stat['disp_name'] . "\n" .($sort_by == $stat_name ? ' ' . ($sort_order == 'asc' ? $strAscending : $strDescending) . '' . "\n" : '') .' ' . "\n"; } } if ($is_superuser) { echo ' ' . "\n"; } echo '' . "\n" . '' . "\n" . '' . "\n"; $odd_row = true; foreach ( $databases as $key => $current ) { echo '' . "\n"; $odd_row = ! $odd_row; if ( $is_superuser || $cfg['AllowUserDropDatabase'] ) { echo ' ' . "\n"; } echo ' ' . "\n"; foreach ( $column_order as $stat_name => $stat ) { if ( array_key_exists( $stat_name, $current ) ) { if ( is_numeric( $stat['footer'] ) ) { $column_order[$stat_name]['footer'] += $current[$stat_name]; } if ( $stat['format'] === 'byte' ) { list( $value, $unit ) = PMA_formatByteDown( $current[$stat_name], 3, 1 ); } elseif ( $stat['format'] === 'number' ) { $value = PMA_formatNumber( $current[$stat_name], 0 ); } else { $value = htmlentities( $current[$stat_name], 0 ); } echo ' ' . "\n"; if ( $stat['format'] === 'byte' ) { echo ' ' . "\n"; } } } if ($is_superuser) { echo ' ' . "\n"; } echo '' . "\n"; } // end foreach ( $databases as $key => $current ) unset( $key, $current, $odd_row ); echo '' . "\n"; if ( $is_superuser ) { echo ' ' . "\n"; } echo ' ' . "\n"; foreach ( $column_order as $stat_name => $stat ) { if ( array_key_exists( $stat_name, $databases[0] ) ) { if ( $stat['format'] === 'byte' ) { list( $value, $unit ) = PMA_formatByteDown( $stat['footer'], 3, 1 ); } elseif ( $stat['format'] === 'number' ) { $value = PMA_formatNumber( $stat['footer'], 0 ); } else { $value = htmlentities( $stat['footer'], 0 ); } echo ' ' . "\n"; if ( $stat['format'] === 'byte' ) { echo ' ' . "\n"; } } } if ( $is_superuser ) { echo ' ' . "\n"; } echo '' . "\n"; unset( $column_order, $stat_name, $stat, $databases ); if ($is_superuser || $cfg['AllowUserDropDatabase']) { $common_url_query = PMA_generate_common_url() . '&sort_by=' . $sort_by . '&sort_order=' . $sort_order . '&dbstats=' . $dbstats; echo '' . "\n" . '' . "\n"; } echo '' . "\n" .'
 ' . "\n" . ' ' . $strDatabase . "\n" . ($sort_by == 'SCHEMA_NAME' ? ' ' . ($sort_order == 'asc' ? $strAscending : $strDescending) . '' . "\n" : '') . ' ' . ($cfg['PropertiesIconic'] ? ' ' : $strAction ) . "\n" . '
' . "\n"; if ($current['SCHEMA_NAME'] != 'mysql' && (PMA_MYSQL_INT_VERSION < 50002 || $current['SCHEMA_NAME'] != 'information_schema')) { echo ' ' . "\n"; } else { echo ' ' . "\n"; } echo ' ' . "\n" . ' ' . "\n" . ' ' . htmlspecialchars($current['SCHEMA_NAME']) . "\n" . ' ' . "\n" . ' '; if ( isset( $stat['description_function'] ) ) { echo ''; } echo $value; if ( isset( $stat['description_function'] ) ) { echo ''; } echo '' . $unit . '' . "\n" . ' '. "\n" . ' ' .($cfg['PropertiesIconic'] ? ' ' .$strCheckPrivs . ' ' : $strCheckPrivs ). "\n" . '
 ' . $strTotalUC . ': ' . count( $databases ) . ''; if ( isset( $stat['description_function'] ) ) { echo ''; } echo $value; if ( isset( $stat['description_function'] ) ) { echo ''; } echo '' . $unit . ' 
' . "\n" . ' ' . $strWithChecked . '' . "\n" . ' ' . "\n" . ' ' . $strCheckAll . ' / ' . "\n" . ' ' . "\n" . ' ' . $strUncheckAll . ' ' . "\n" . ' ' . $strWithChecked . '' . "\n"; PMA_buttonOrImage( 'drop_selected_dbs', 'mult_submit', 'drop_selected_dbs', $strDrop, 'b_deltbl.png' ); echo '
' . "\n"; unset( $table_columns ); if ( $GLOBALS['cfg']['PropertiesIconic'] ) { // iconic view if ($is_superuser || $cfg['AllowUserDropDatabase']) { echo '' . "\n"; if ( $is_superuser && ! $dbstats && PMA_MYSQL_INT_VERSION < 50002 ) { echo '' . "\n" . ' ' . "\n"; } elseif ( $is_superuser && $dbstats ) { echo '' . "\n"; } echo '
' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . $strDatabasesStatsEnable . "\n" . ' ' . "\n" . ' ' . "\n" . '
' . "\n" . ' ' . $strDatabasesStatsHeavyTraffic . "\n" . '
 
' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . $strDatabasesStatsDisable . "\n" . ' ' . "\n" . ' ' . "\n" . '
 
' . "\n"; } } else { // classic view if ($is_superuser || $cfg['AllowUserDropDatabase']) { echo '' . "\n"; } } echo '
' . "\n"; } else { echo $strNoDatabases . "\n"; } /** * Create new database. */ if ( $GLOBALS['cfg']['PropertiesIconic'] ) { echo '' . "\n"; echo '' . "\n" . '
' . "\n" . ' ' . "\n" . ' ' . "\n"; } else { echo '
  • ' . "\n"; } require('./libraries/display_create_database.lib.php'); if ( $GLOBALS['cfg']['PropertiesIconic'] ) { echo '
' . "\n"; } else { echo ' ' . "\n"; echo '' . "\n"; } /** * Sends the footer */ require_once('./footer.inc.php'); ?>