From fe3d37364bbc072aedac951d4b2acc724ba7393a Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 7 Aug 2010 18:32:09 +0200 Subject: add Class TableRpmRepo and use it everywhere --- all.php | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'all.php') diff --git a/all.php b/all.php index 6976dc5..4a5a5ab 100644 --- a/all.php +++ b/all.php @@ -57,14 +57,27 @@ function report ($db) { global $what, $smarty; $packages = null; - $repos = listRepos($db); + $rpmrepo = new TableRpmRepo($db); + $repos = $rpmrepo->getAllRepoHash(); $smarty->assign('repos', $repos); if (substr($what, 0, 1)=='%') { - $sql=sprintf("SELECT DISTINCT name FROM rpm WHERE SUBSTRING(name,1,1)='%s' ORDER BY name", substr($what, 1, 1)); + $sql = sprintf( + "SELECT DISTINCT name + FROM rpm + WHERE SUBSTRING(name,1,1)='%s' + ORDER BY name", + substr($what, 1, 1) + ); } else { - $sql=sprintf("SELECT DISTINCT name FROM acls WHERE owner='%s' ORDER BY name", $what); + $sql = sprintf( + "SELECT DISTINCT name + FROM acls + WHERE owner='%s' + ORDER BY name", + $what + ); } //echo "

SQL=$sql

"; @@ -107,14 +120,16 @@ function report ($db) $display=""; $class=""; foreach ($repomain as $repo) { - if (isset($rpms[$repo->main."-".$repo->sub])) { - $rpm=$rpms[$repo->main."-".$repo->sub]; + if (isset($rpms[$repo['main']."-".$repo['sub']])) { + $rpm=$rpms[$repo['main']."-".$repo['sub']]; - $maxver = (isset($rpms["devel-"]) ? $rpms["devel-"]->ver : ""); + $maxver = (isset($rpms["devel-"]) + ? $rpms["devel-"]->ver + : ""); - switch ($repo->sub) { + switch ($repo['sub']) { case "base": - if (isset($rpms[$repo->main."-updates"])) { + if (isset($rpms[$repo['main']."-updates"])) { $display .= sprintf( "%s-%s
", $rpm->ver, @@ -126,7 +141,9 @@ function report ($db) $rpm->ver, $rpm->rel ); - $class = ($rpm->ver == $maxver ? "check" : "attn"); + $class = ($rpm->ver == $maxver + ? "check" + : "attn"); } break; case "": @@ -174,7 +191,9 @@ function report ($db) try { $db = new PDO ("mysql:dbname=" . MYBASE . ";host=" . MYHOST, MYUSER, MYPASS); - $sql="SELECT DISTINCT CONCAT('%',SUBSTRING(name,1,1)) as init FROM rpm ORDER BY init"; + $sql="SELECT DISTINCT CONCAT('%',SUBSTRING(name,1,1)) as init + FROM rpm + ORDER BY init"; $res=$db->query($sql); if ( $res ) { while ( $s = $res->fetchObject() ) { -- cgit