From 816c869c3bd174d78a710f4d384442bf31a24a6d Mon Sep 17 00:00:00 2001 From: "Johan \"Papa\" Cwiklinski" Date: Sun, 30 May 2010 13:20:02 +0200 Subject: rpm.php Smarty variable assigned twice, export reposlist function so it could be used elsewhere --- main.inc.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'main.inc.php') diff --git a/main.inc.php b/main.inc.php index e94a62b..bbc300c 100644 --- a/main.inc.php +++ b/main.inc.php @@ -47,4 +47,31 @@ $ariane[] = array( 'url' => './', 'text' => 'Reports home' ); + +/** +* Get repositories list +* +* @param object $db a reference to the database +* +* @return array +*/ +function listRepos($db) +{ + $repos = array(); + $res=$db->query("SELECT * FROM repo WHERE active=1 ORDER BY ID"); + if ( $res ) { + while ($repo = $res->fetchObject()) { + $repos[$repo->main][$repo->sub]=$repo; + } + } + // echo "
"; print_r($repos);echo "
"; + foreach ( $repos as $repomain ) { + foreach ($repomain as $repo) { + $repos[$repo->main][$repo->sub] = $repo; + break; + } + } + return $repos; +} + ?> \ No newline at end of file -- cgit