From 6f348e19401b16503873c846968d51eb2da7f6bc Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 19 Apr 2017 17:15:32 -0700 Subject: [PATCH] Downloads: Fix for drop-down category ordering. --- e107_handlers/mysql_class.php | 14 ++++---------- e107_plugins/download/e_sitelink.php | 2 +- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/e107_handlers/mysql_class.php b/e107_handlers/mysql_class.php index 8bc4e939d..2bad7126f 100644 --- a/e107_handlers/mysql_class.php +++ b/e107_handlers/mysql_class.php @@ -2027,7 +2027,7 @@ class e_db_mysql /** - * Return a sorted list of parent/child tree with an optional ordering field. + * Return a sorted list of parent/child tree with an optional where clause. * @param string $table Name of table (without the prefix) * @param string $parent Name of the parent field * @param string $pid Name of the primary id @@ -2036,7 +2036,7 @@ class e_db_mysql * @todo Add extra params to each procedure so we only need 2 of them site-wide. * @return boolean | integer with the addition of _treesort and _depth fields in the results. */ - public function selectTree($table, $parent, $pid, $where=null, $order=null) + public function selectTree($table, $parent, $pid, $order, $where=null) { if(empty($table) || empty($parent) || empty($pid)) @@ -2110,14 +2110,8 @@ class e_db_mysql } - if($order === null) - { - $qry .= " ORDER BY _treesort"; - } - else - { - $qry .= " ORDER BY ".$order; - } + $qry .= " ORDER BY _treesort"; + return $this->gen($qry); diff --git a/e107_plugins/download/e_sitelink.php b/e107_plugins/download/e_sitelink.php index 09181e3c1..df439a9b5 100644 --- a/e107_plugins/download/e_sitelink.php +++ b/e107_plugins/download/e_sitelink.php @@ -53,7 +53,7 @@ class download_sitelink // include plugin-folder in the name. $where = "download_category_class IN (".USERCLASS_LIST.")"; - $sql->selectTree('download_category','download_category_parent', 'download_category_id', $where, 'download_category_order'); + $sql->selectTree('download_category','download_category_parent', 'download_category_id', 'download_category_order', $where ); while($row = $sql->fetch()) {