diff options
author | Remi Collet <fedora@famillecollet.com> | 2010-08-07 18:32:09 +0200 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2010-08-07 18:32:09 +0200 |
commit | fe3d37364bbc072aedac951d4b2acc724ba7393a (patch) | |
tree | dc8dcc9ec2f864962dba5c59f46289659861495e /all.php | |
parent | 6d2954c5e9da8cd36c231114df5184d4a3101ddd (diff) |
add Class TableRpmRepo and use it everywhere
Diffstat (limited to 'all.php')
-rw-r--r-- | all.php | 39 |
1 files changed, 29 insertions, 10 deletions
@@ -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 "<p>SQL=$sql</p>"; @@ -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<br/>", $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() ) { |