diff --git a/e107_handlers/mysql_class.php b/e107_handlers/mysql_class.php index 6fe2f9115..17d91d4c5 100644 --- a/e107_handlers/mysql_class.php +++ b/e107_handlers/mysql_class.php @@ -429,7 +429,7 @@ class e_db_mysql { return null; } - elseif(!$select && $this->gen($table, $debug)) + elseif(!$select && !$this->gen($table, $debug)) { return null; } @@ -441,7 +441,7 @@ class e_db_mysql { return array(); } - elseif(!$select && $this->gen($table, $debug)) + elseif(!$select && !$this->gen($table, $debug)) { return array(); } @@ -453,7 +453,7 @@ class e_db_mysql { return array(); } - elseif(!$select && $this->gen($table, $debug)) + elseif(!$select && !$this->gen($table, $debug)) { return array(); } diff --git a/e107_handlers/sitelinks_class.php b/e107_handlers/sitelinks_class.php index 7c28a7ed6..1614867cc 100644 --- a/e107_handlers/sitelinks_class.php +++ b/e107_handlers/sitelinks_class.php @@ -1422,29 +1422,17 @@ class e_navigation /** * --------------- CODE-EFFICIENT APPROACH ------------------------- - * Less than 10 lines of code (once retrieve() is working) * FIXME syscache */ public function initData($cat=1) { - $sql = e107::getDb('sqlSiteLinks'); - $ins = ($cat > 0) ? "link_category = ".intval($cat)." AND " : ""; - $query = "SELECT * FROM #links WHERE ".$ins." link_class IN (".USERCLASS_LIST.") ORDER BY link_order,link_parent ASC"; - - $ret = array(); - $data = array(); - - // $data = $sql->retrieve($query,true); // FIXME $sql->retrieve() fails. - if($sql->gen($query)) - { - while ($row = $sql->db_Fetch()) - { - $id = $row['link_id']; - $data [$id] = $row; - } - } - - $outArray = array(); + $sql = e107::getDb('sqlSiteLinks'); + $ins = ($cat > 0) ? "link_category = ".intval($cat)." AND " : ""; + $query = "SELECT * FROM #links WHERE ".$ins." link_class IN (".USERCLASS_LIST.") ORDER BY link_order,link_parent ASC"; + $ret = array(); + $outArray = array(); + $data = $sql->retrieve($query,true); // FIXME $sql->retrieve() fails. + return $this->compile($data, $outArray); }