summaryrefslogtreecommitdiffstats
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php44
1 files changed, 22 insertions, 22 deletions
diff --git a/index.php b/index.php
index 24d4fbd..03412ef 100644
--- a/index.php
+++ b/index.php
@@ -39,38 +39,38 @@ require 'include/main.php';
$smarty->assign('ariane', $ariane);
$smarty->assign('page_title', 'Packages in Fedora repositories');
+
try {
$db = new PDO ("mysql:dbname=" . MYBASE . ";host=" . MYHOST, MYUSER, MYPASS);
- $sql='SELECT * FROM repo ORDER BY ID';
- $res=$db->query($sql);
- $repositories = null;
- if ( $res ) {
- for ( $i=0, $prev="xx";
- $repo=$res->fetchObject();
- $i++, $prev=$repo->main
- ) {
- $repositories[] = array(
- 'repo_name' => ($repo->main != $prev ? $repo->main : " "),
- 'active' => ($repo->main != $prev ?
- ($repo->active ? "<strong>Yes</strong>" : "no") :
- "&nbsp;"
- ),
- 'sub_name' => $repo->sub,
- 'url' => $repo->url,
- 'date' => ($repo->stamp
- ? date("r", $repo->stamp)
- : '')
- );
- }
- $smarty->assign('repositories', $repositories);
+ $repo = new TableRpmRepo($db);
+
+ $prev = false;
+ $repositories = array();
+ foreach ($repo->request(array('ORDER'=>'id')) as $repo) {
+ $repositories[] = array(
+ 'repo_name' => ($repo['main'] != $prev ? $repo['main'] : "&nbsp;"),
+ 'active' => ($repo['main'] != $prev ?
+ ($repo['active'] ? "<strong>Yes</strong>" : "no") :
+ "&nbsp;"
+ ),
+ 'sub_name' => $repo['sub'],
+ 'url' => $repo['url'],
+ 'date' => ($repo['stamp']
+ ? date("r", $repo['stamp'])
+ : '')
+ );
+ $prev = $repo['main'];
}
+ $smarty->assign('repositories', $repositories);
+
} catch(PDOException $e) {
$smarty->assign(
'error',
sprintf("%s ERREUR : %s\n", date("r"), $e->getMessage())
);
}
+
$smarty->assign('rpmphp_version', RPMPHP_VERSION);
$smarty->assign('fedcli_version', FedoraClient::VERSION);