This commit is contained in:
Alexander M. Turek
2002-10-14 19:59:35 +00:00
parent 68e916f815
commit 966b1dc53a
2 changed files with 20 additions and 8 deletions

View File

@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
$Id$
$Source$
2002-10-14 Alexander M. Turek <rabus@users.sourceforge.net>
* libraries/display_tbl.lib.php3: Fixed bug #623185 (Ordering by
FUNCTION(`field`) fails).
2002-10-14 Marc Delisle <lem9@users.sourceforge.net>
* Documentation.html: clarification about pmadb when you are not
the superuser
@@ -24,7 +28,7 @@ $Source$
2002-10-10 Michal Cihar <nijel@users.sourceforge.net>
* libraries/auth/config.auth.lib.php3: bug #620624 - displaying password
from config when MySQL connection can't be established
2002-10-09 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* libraries/display_tbl.lib.php3, bug 619735: display broken (bad HTML)

View File

@@ -586,23 +586,31 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
} else {
$sort_tbl = '';
}
// 2.1.4 Do define the sorting url
// 2.1.4 Check the field name for backquotes.
// If it contains some, it's probably a function column
// like 'COUNT(`field`)'
if (strpos(' ' . $fields_meta[$i]->name, '`') > 0) {
$sort_order = ' ORDER BY \'' . $fields_meta[$i]->name . '\' ';
} else {
$sort_order = ' ORDER BY ' . $sort_tbl . PMA_backquote($fields_meta[$i]->name) . ' ';
}
// 2.1.5 Do define the sorting url
if (!$is_in_sort) {
// loic1: patch #455484 ("Smart" order)
$cfg['Order'] = strtoupper($GLOBALS['cfg']['Order']);
if ($cfg['Order'] == 'SMART') {
$cfg['Order'] = (eregi('time|date', $fields_meta[$i]->type)) ? 'DESC' : 'ASC';
}
$sort_order = ' ORDER BY ' . $sort_tbl . PMA_backquote($fields_meta[$i]->name) . ' ' . $cfg['Order'];
$order_img = '';
$sort_order .= $cfg['Order'];
$order_img = '';
}
else if (eregi('[[:space:]]ASC$', $sql_order)) {
$sort_order = ' ORDER BY ' . $sort_tbl . PMA_backquote($fields_meta[$i]->name) . ' DESC';
$order_img = '&nbsp;<img src="./images/asc_order.gif" border="0" width="7" height="7" alt="'. $GLOBALS['strAscending'] . '" title="'. $GLOBALS['strAscending'] . '" />';
$sort_order .= ' DESC';
$order_img = '&nbsp;<img src="./images/asc_order.gif" border="0" width="7" height="7" alt="'. $GLOBALS['strAscending'] . '" title="'. $GLOBALS['strAscending'] . '" />';
}
else if (eregi('[[:space:]]DESC$', $sql_order)) {
$sort_order = ' ORDER BY ' . $sort_tbl . PMA_backquote($fields_meta[$i]->name) . ' ASC';
$order_img = '&nbsp;<img src="./images/desc_order.gif" border="0" width="7" height="7" alt="'. $GLOBALS['strDescending'] . '" title="'. $GLOBALS['strDescending'] . '" />';
$sort_order .= ' ASC';
$order_img = '&nbsp;<img src="./images/desc_order.gif" border="0" width="7" height="7" alt="'. $GLOBALS['strDescending'] . '" title="'. $GLOBALS['strDescending'] . '" />';
}
if (eregi('(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|LOCK IN SHARE MODE))', $unsorted_sql_query, $regs3)) {
$sorted_sql_query = $regs3[1] . $sort_order . $regs3[2];