From 4e5b85c29beb6b3e2a5ddbf40ef9cf542b44eada Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?=
Date: Mon, 27 Aug 2001 16:24:52 +0000
Subject: [PATCH] Merged patch #455484 ("Smart" order) thanks to Jakub Wilk
---
Documentation.html | 38 ++++++++++++++++++++------------------
config.inc.php3 | 10 +++++++---
lib.inc.php3 | 22 ++++++++++++----------
3 files changed, 39 insertions(+), 31 deletions(-)
diff --git a/Documentation.html b/Documentation.html
index 359f3bb10..127e44e8b 100755
--- a/Documentation.html
+++ b/Documentation.html
@@ -279,9 +279,10 @@
$cfgServers[n]['connect_type'] string
- What type connection to use with the MySQL server. Your options are 'socket' &
- 'tcp'. It defaults to 'tcp' as that is nearly guarenteed to be available on all MySQL
- servers, while sockets are not supported on some platforms.
+ What type connection to use with the MySQL server. Your options are
+ 'socket' & 'tcp'. It defaults to 'tcp' as that is nearly guarenteed
+ to be available on all MySQL servers, while sockets are not supported
+ on some platforms.
@@ -314,7 +315,8 @@
Advanced authentication is secure as the standard user needs just
- read-only-access to the mysql database.
+ read-only-access to the mysql database.
+
All you have to provide in config.inc is a standard user which can
connect to MySQL and read the mysql user/db table
@@ -470,11 +472,12 @@
- $cfgOrder string ["DESC"|"ASC"]
+ $cfgOrder string [DESC|ASC|SMART]
- Defines whether fields are displayed in ascending ("ASC")
- order or in descending ("DESC") order when you click on the
- field-name.
+ Defines whether fields are displayed in ascending (ASC) order,
+ in descending (DESC) order or in a "smart" (SMART)
+ order -ie descending order for fields of type TIME, DATE, DATETIME &
+ TIMESTAMP, ascending order else- by default.
@@ -746,8 +749,8 @@
If you're running a server which cannot be accessed by other people, it's
sufficient to use the directory protection bundled with your webserver
(with Apache you can use .htaccess files, for example).
- If other people have telnet access to your server,
- you should use phpMyAdmin's advanced authentication feature.
+ If other people have telnet access to your server, you should use
+ phpMyAdmin's advanced authentication feature.
Suggestions:
@@ -885,18 +888,17 @@
I have found a bug. How do I inform developpers?
- Our Bug Tracker is located at
- http://sourceforge.net/projects/phpmyadmin
- under the Bugs section.
-
-
- But please first discuss your bug with other users:
+ Our Bug Tracker is located at
+ http://sourceforge.net/projects/phpmyadmin under the Bugs section.
+
+ But please first discuss your bug with other users:
- http://sourceforge.net/projects/phpmyadmin (and choose Forums)
+ http://sourceforge.net/projects/phpmyadmin (and choose Forums)
- http://www.phpwizard.net/projects/phpMyAdmin (and choose Support Forum)
+ http://www.phpwizard.net/projects/phpMyAdmin (and choose Support
+ Forum)
diff --git a/config.inc.php3 b/config.inc.php3
index 2fa787446..12edf9104 100755
--- a/config.inc.php3
+++ b/config.inc.php3
@@ -97,14 +97,18 @@ unset($cfgServers[0]);
$cfgConfirm = TRUE; // confirm 'DROP TABLE' & 'DROP DATABASE'
$cfgPersistentConnections = FALSE; // use persistent connections to MySQL database
$cfgShowBlob = FALSE; // display blob field contents in browse mode
-$cfgProtectBlob = TRUE; // disallow editing of blob fields in edit mode
+$cfgProtectBlob = TRUE; // disallow editing of blob fields in edit mode
$cfgAllowUserDropDatabase = FALSE; // disallow users to delete their own database
$cfgShowSQL = TRUE; // show SQL queries as run
$cfgSkipLockedTables = FALSE; // mark used tables, make possible to show
// locked tables (since MySQL 3.23.30)
$cfgMaxRows = 30; // maximum number of rows to display in browse mode
-$cfgOrder = 'ASC'; // default for 'ORDER BY' clause
-$cfgOBGzip = TRUE; // GZIP output buffering
+$cfgOrder = 'ASC'; // default for 'ORDER BY' clause (valid
+ // values are 'ASC', 'DESC' or 'SMART' -ie
+ // descending order for fields of type
+ // TIME, DATE, DATETIME & TIMESTAMP,
+ // ascending order else-)
+$cfgOBGzip = TRUE; // GZIP output buffering
$cfgGZipDump = TRUE; // Allow the use of gzip/bzip compression
$cfgBZipDump = TRUE; // for dump files
diff --git a/lib.inc.php3 b/lib.inc.php3
index 67b99d79a..74aeda4ed 100755
--- a/lib.inc.php3
+++ b/lib.inc.php3
@@ -146,25 +146,22 @@ if (!defined('__LIB_INC__')){
}
echo ''. $GLOBALS['strError'] . '' . "\n";
- if (!empty($the_query)) {
+ // if the config password is wrong, or the MySQL server does not
+ // respond, do not show the query that would reveal the
+ // username/password
+ if (!empty($the_query) && !strstr($the_query, 'connect')) {
$query_base = htmlspecialchars($the_query);
$query_base = ereg_replace("((\015\012)|(\015)|(\012)){3,}", "\n\n", $query_base);
echo '' . "\n";
-
-// if the config password is wrong, or the MySQL server does not respond,
-// do not show the query that would reveal the username/password
-
- if (!strstr($query_base,"connect")) {
echo ' ' . $GLOBALS['strSQLQuery'] . ' : ' . "\n";
if ($is_modify_link) {
echo ' ['
. '' . $GLOBALS['strEdit'] . ''
. ']' . "\n";
- }
+ } // end if
echo '
' . "\n" . $query_base . "\n" . '
' . "\n";
echo '' . "\n";
- }
- }
+ } // end if
if (!empty($error_message)) {
$error_message = htmlspecialchars($error_message);
$error_message = ereg_replace("((\015\012)|(\015)|(\012)){3,}", "\n\n", $error_message);
@@ -1079,7 +1076,12 @@ var errorMsg2 = 'name) . ' ' . $GLOBALS['cfgOrder'];
+ // loic1: patch #455484 ("Smart" order)
+ $cfgOrder = strtoupper($GLOBALS['cfgOrder']);
+ if ($cfgOrder == 'SMART') {
+ $cfgOrder = (eregi('time|date', $field->type)) ? 'DESC' : 'ASC';
+ }
+ $sort_order = ' ORDER BY ' . backquote($field->name) . ' ' . $cfgOrder;
$order_img = '';
}
else if (substr($sql_order, -3) == 'ASC' && $is_in_sort) {