summaryrefslogtreecommitdiffstats
path: root/web/lib/pkgbasefuncs.inc.php
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2014-04-05 19:32:07 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2014-04-05 19:58:00 +0200
commitc0044290238e247ba3facc210d736b3c0a50ce89 (patch)
treeea7087a6792d81e74e5eca9ab7afd34afd122191 /web/lib/pkgbasefuncs.inc.php
parent5415bc945aa43e5ee293cd0b6025ccb62426c159 (diff)
downloadaurweb-c0044290238e247ba3facc210d736b3c0a50ce89.tar.xz
Refactor pkgbase_categories()
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web/lib/pkgbasefuncs.inc.php')
-rw-r--r--web/lib/pkgbasefuncs.inc.php10
1 files changed, 4 insertions, 6 deletions
diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php
index 5be7048..c55bd89 100644
--- a/web/lib/pkgbasefuncs.inc.php
+++ b/web/lib/pkgbasefuncs.inc.php
@@ -9,17 +9,15 @@ include_once("config.inc.php");
* @return array All package categories
*/
function pkgbase_categories() {
- $cats = array();
$dbh = DB::connect();
$q = "SELECT * FROM PackageCategories WHERE ID != 1 ";
$q.= "ORDER BY Category ASC";
$result = $dbh->query($q);
- if ($result) {
- while ($row = $result->fetch(PDO::FETCH_NUM)) {
- $cats[$row[0]] = $row[1];
- }
+ if (!$result) {
+ return null;
}
- return $cats;
+
+ return $result->fetchAll(PDO::FETCH_KEY_PAIR);
}
/**