diff --git a/config.inc.php b/config.inc.php
index db5a70113..b43bd190b 100644
--- a/config.inc.php
+++ b/config.inc.php
@@ -509,6 +509,8 @@ $cfg['MaxExactCount'] = 20000; // When approximate count < this, PM
$cfg['WYSIWYG-PDF'] = TRUE; // Utilize DHTML/JS capabilities to allow WYSIWYG editing of
// the PDF page editor. Requires an IE6/Mozilla based browser.
+$cfg['NaturalOrder'] = TRUE; // Sort table and database in natural order
+
/**
* Default queries.
* %d will be replaced by database name
diff --git a/left.php b/left.php
index 761b11ef4..521164e9c 100644
--- a/left.php
+++ b/left.php
@@ -399,6 +399,17 @@ if ($num_dbs > 1) {
$selected_db = 0;
+ // natural order for db list
+ if ($cfg['NaturalOrder'] && $num_dbs > 0) {
+ $dblist_temp = $dblist;
+ natsort($dblist_temp);
+ $i = 0;
+ foreach ($dblist_temp as $each) {
+ $dblist[$i] = $each;
+ $i++;
+ }
+ }
+
// Gets the tables list per database
for ($i = 0; $i < $num_dbs; $i++) {
$db = $dblist[$i];
@@ -539,15 +550,29 @@ if ($num_dbs > 1) {
$book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label');
- $table_list .= ' ' . "\n";
+ // natural order or not, use an array for the table list
+
+ $table_array[$table] .= '
' . "\n";
+
if (PMA_USR_BROWSER_AGENT == 'IE') {
- $table_list .= ' ' . ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)) . '
' . "\n";
+ $table_array[$table] .= ' ' . ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)) . '
' . "\n";
} else {
- $table_list .= ' ' . ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)) . '
' . "\n";
+ $table_array[$table] .= ' ' . ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)) . '
' . "\n";
}
+
+ $table_title[$table] = htmlspecialchars($table);
+
} // end while (tables list)
+ if ($cfg['NaturalOrder'] && $num_tables > 0) {
+ natsort($table_title);
+ }
+ foreach (array_keys($table_title) as $each){
+ $table_list .= " $table_array[$each]";
+ }
+
if (!$table_list) {
$table_list = '
' . "\n"
. '