From afa9e729734e8bc78411c866dcd1ba1e2f6c914d Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 22 May 2010 15:22:32 +0200 Subject: index.php - quick access to package page (zomm) from input on the top/right - link to github for sources access zoom.php - input on the top right corner - message if package not found - ViewVC link --- zoom.php | 183 ++++++++++++++++++++++++++++++++++----------------------------- 1 file changed, 98 insertions(+), 85 deletions(-) (limited to 'zoom.php') diff --git a/zoom.php b/zoom.php index d597ec4..4e1fb75 100644 --- a/zoom.php +++ b/zoom.php @@ -51,12 +51,10 @@ body { require "config.inc.php"; if (!isset($_GET['rpm'])) { - die("missing arg."); + die("missing arg."); } $name = $_GET['rpm']; -try { - $db = new PDO ("mysql:dbname=" . MYBASE . ";host=" . MYHOST, MYUSER, MYPASS); ?> @@ -74,7 +72,12 @@ try {
- + +
+ Package :  + + +
@@ -101,87 +104,98 @@ try { $name\n"; - - $sql = "SELECT rpm.* - FROM rpm - INNER JOIN repo ON (repo.main=rpm.repo_main AND repo.sub=rpm.repo_sub) - WHERE rpm.name='$name' - ORDER BY repo.id DESC"; - $resrpm = $db->query($sql); - $rpm = ($resrpm ? $resrpm->fetchObject() : false); - - $sql = "SELECT * FROM upstream WHERE name = '$name'"; - $resup=$db->query($sql); - $up = ($resup ? $resup->fetchObject() : false); - - $sql = "SELECT * FROM acls WHERE name = '$name'"; - $resown=$db->query($sql); - $owner = ($resown ? $resown->fetchObject() : false); - - echo "\n"; - echo "\n"; - $i=0; - - if ($rpm && $rpm->summary) { - echo "\n"; - } else if ($owner->summary) { - echo "\n"; - } - if ($rpm && $rpm->url) { - echo "\n"; - } - if ($up && $up->type) { - echo "\n"; - } - if ($up && $up->channel) { - echo "\n"; - } - if ($up && $up->stable) { - echo "\n"; - } - if ($up && $up->unstable && $up->stable!=$up->unstable) { - echo "\n"; - } - if ($owner && $owner->owner) { - echo "
Upstream info
"; $i++; - echo "Summary". $rpm->summary . "
"; $i++; - echo "Summary". $owner->summary . "
"; $i++; - echo "URL". $rpm->url . "
"; $i++; - echo "Type". $up->type . "
"; $i++; - echo "Channel". $up->channel . "
"; $i++; - echo "Stable version". $up->stable . "
"; $i++; - echo "Unstable version". $up->unstable . ""; - if ($up->state) { - echo " (". $up->state . ")\n"; - } - echo "
"; $i++; - echo "Owner". $owner->owner . ""; - if ($owner->cc) { - echo " (". $owner->cc . ")\n"; - } - } - echo "
"; - - if ($rpm) { - echo "
\n"; - echo "\n"; - $prev=false; - do { - echo ""; $i++; - echo ""; - echo ""; - echo ""; - echo "\n"; - } while ($rpm = $resrpm->fetchObject()); - echo "
Packages available in Fedora Repositories
".($rpm->repo_main==$prev ? " " : $prev=$rpm->repo_main)."".$rpm->repo_sub."".($rpm->epoch ? $rpm->epoch.":" : "").$rpm->ver."-".$rpm->rel."
"; - } - -} -catch(PDOException $e) { - printf("%s ERREUR : %s\n", date("r"), $e->getMessage()); +if (!$name) { + echo "

Enter a package name

\n"; +} else { + try { + $db = new PDO ("mysql:dbname=" . MYBASE . ";host=" . MYHOST, MYUSER, MYPASS); + + $sql = "SELECT rpm.* + FROM rpm + INNER JOIN repo ON (repo.main=rpm.repo_main AND repo.sub=rpm.repo_sub) + WHERE rpm.name='$name' + ORDER BY repo.id DESC"; + $resrpm = $db->query($sql); + $rpm = ($resrpm ? $resrpm->fetchObject() : false); + + $sql = "SELECT * FROM upstream WHERE name = '$name'"; + $resup=$db->query($sql); + $up = ($resup ? $resup->fetchObject() : false); + + $sql = "SELECT * FROM acls WHERE name = '$name'"; + $resown=$db->query($sql); + $owner = ($resown ? $resown->fetchObject() : false); + + if (!$rpm) { + echo "

$name not found

\n"; + } else { + echo "

Package: $name

\n"; + echo "\n"; + echo "\n"; + $i=0; + + if ($rpm->summary) { + echo "\n"; + } else if ($owner->summary) { + echo "\n"; + } + if ($rpm->url) { + echo "\n"; + } + if ($up && $up->type) { + echo "\n"; + } + if ($up && $up->channel) { + echo "\n"; + } + if ($up && $up->stable) { + echo "\n"; + } + if ($up && $up->unstable && $up->stable!=$up->unstable) { + echo "\n"; + } + if ($owner && $owner->owner) { + echo "\n"; + } + echo ""; $i++; + echo "\n"; + + echo "
Upstream info
"; $i++; + echo "Summary". $rpm->summary . "
"; $i++; + echo "Summary". $owner->summary . "
"; $i++; + echo "URL". $rpm->url . "
"; $i++; + echo "Type". $up->type . "
"; $i++; + echo "Channel". $up->channel . "
"; $i++; + echo "Stable version". $up->stable . "
"; $i++; + echo "Unstable version". $up->unstable . ""; + if ($up->state) { + echo " (". $up->state . ")\n"; + } + echo "
"; $i++; + echo "Owner". $owner->owner . ""; + if ($owner->cc) { + echo " (". $owner->cc . ")\n"; + } + echo "
ViewVChttp://cvs.fedoraproject.org/viewvc/rpms/$name/"; + echo "
"; + + echo "
\n"; + echo "\n"; + $prev=false; + do { + echo ""; $i++; + echo ""; + echo ""; + echo ""; + echo "\n"; + } while ($rpm = $resrpm->fetchObject()); + echo "
Packages available in Fedora Repositories
".($rpm->repo_main==$prev ? " " : $prev=$rpm->repo_main)."".$rpm->repo_sub."".($rpm->epoch ? $rpm->epoch.":" : "").$rpm->ver."-".$rpm->rel."
"; + } + } + catch(PDOException $e) { + printf("%s ERREUR : %s\n", date("r"), $e->getMessage()); + } } - ?> @@ -204,4 +218,3 @@ catch(PDOException $e) { - -- cgit