diff options
author | Johan "Papa" Cwiklinski <trasher@odysseus.(none)> | 2010-05-30 13:20:02 +0200 |
---|---|---|
committer | Johan "Papa" Cwiklinski <trasher@odysseus.(none)> | 2010-05-30 13:20:02 +0200 |
commit | 816c869c3bd174d78a710f4d384442bf31a24a6d (patch) | |
tree | e13b2331acff847058bc37f93357808517905882 | |
parent | 6fd2b5d30b183d17ff81f2f9b69446c497e78294 (diff) |
rpm.php
Smarty variable assigned twice, export reposlist function so it could be used elsewhere
-rw-r--r-- | main.inc.php | 27 |
1 files changed, 27 insertions, 0 deletions
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 "<pre>"; print_r($repos);echo "</pre>"; + foreach ( $repos as $repomain ) { + foreach ($repomain as $repo) { + $repos[$repo->main][$repo->sub] = $repo; + break; + } + } + return $repos; +} + ?>
\ No newline at end of file |