diff options
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 44 |
1 files changed, 22 insertions, 22 deletions
@@ -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") : - " " - ), - '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'] : " "), + 'active' => ($repo['main'] != $prev ? + ($repo['active'] ? "<strong>Yes</strong>" : "no") : + " " + ), + '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); |