diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-05-22 11:33:18 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-05-22 11:33:18 +0000 |
commit | dc4d421be78c471017fd8cf0d3b7986147844dab (patch) | |
tree | e33372f2f943eb1e32fff5922eed372b4b944184 /includes | |
parent | ef14b0df899a07fc002398040fffdfae8a09ad66 (diff) | |
download | brdo-dc4d421be78c471017fd8cf0d3b7986147844dab.tar.gz brdo-dc4d421be78c471017fd8cf0d3b7986147844dab.tar.bz2 |
- Patch #396284 by Berdir, chx, jcfiala, csevb10 et al: make sure to order by table headers first, before ordering by other fields.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/tablesort.inc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/includes/tablesort.inc b/includes/tablesort.inc index 382014fa8..e6a7b785a 100644 --- a/includes/tablesort.inc +++ b/includes/tablesort.inc @@ -23,8 +23,13 @@ class TableSort extends SelectQueryExtender { protected $header = array(); public function execute() { + return $this->query->execute(); + } + + public function orderByHeader(Array $header) { + $this->header = $header; $ts = $this->init(); - if ($ts['sql']) { + if (!empty($ts['sql'])) { // Based on code from db_escape_table(), but this can also contain a dot. $field = preg_replace('/[^A-Za-z0-9_.]+/', '', $ts['sql']); @@ -33,11 +38,6 @@ class TableSort extends SelectQueryExtender { $sort = in_array($sort, array('ASC', 'DESC')) ? $sort : ''; $this->orderBy($field, $sort); } - return $this->query->execute(); - } - - public function setHeader(Array $header) { - $this->header = $header; return $this; } |