summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2010-05-22 15:22:32 +0200
committerRemi Collet <fedora@famillecollet.com>2010-05-22 15:22:32 +0200
commitafa9e729734e8bc78411c866dcd1ba1e2f6c914d (patch)
tree369d21eb1ab3a76cfc44e49438dbc4304cd331ca
parent1d9140560f969d4545e5b1ba762a90a5385f62f4 (diff)
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
-rw-r--r--.gitignore1
-rw-r--r--index.php29
-rw-r--r--zoom.php183
3 files changed, 109 insertions, 104 deletions
diff --git a/.gitignore b/.gitignore
index 7e9e3af..1b66367 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
config.inc.php
+*.gz
diff --git a/index.php b/index.php
index 77a6663..358fb41 100644
--- a/index.php
+++ b/index.php
@@ -71,6 +71,12 @@ try {
</div>
<div id="fedora-header-items">
+ <span class="fedora-header-search">
+ <form action='zoom.php' method='get'>
+ Package&nbsp;:&nbsp;
+ <input type='text' name='rpm' size='20' />
+ <input type="image" src='http://docs.fedoraproject.org/images/header-search.png' alt="Search" />
+ </form></span>
</div>
@@ -113,7 +119,7 @@ try {
$sql='SELECT * FROM repo ORDER BY ID';
$res=$db->query($sql);
if ($res) for ($i=0, $prev="xx" ; $repo=$res->fetchObject() ; $i++, $prev=$repo->main) {
- printf ("<tr class='%s'><td><strong>%s</strong></td><td>%s</td><td>%s</td><td><a href='%srepoview/' alt='Repoview'>%s</a></td><td>%s</td></tr>\n",
+ printf ("<tr class='%s'><td><strong>%s</strong></td><td>%s</td><td>%s</td><td><a href='%s' alt='RPM'>%s</a></td><td>%s</td></tr>\n",
($i%2 ? 'odd' : 'even'),
($repo->main != $prev ? $repo->main : "&nbsp;"),
($repo->main != $prev ? ($repo->active ? "<strong>Yes</strong>" : "no") : "&nbsp;"),
@@ -129,25 +135,10 @@ catch(PDOException $e) {
?>
<h2>Script sources</h2>
-<table id='fedora-list-packages'><tr><th>Name</th><th>Description</th><th>Date</th></tr>
-<?php
- $pages=array(
- "index.php" => "This page",
- "all.php" => "All Packages in Fedora",
- "rpm.php" => "PHP Extensions in Fedora",
- "refresh.php" => "The metadata refresh script launch twice a day by cron",
- "zoom.php" => "Package detail");
-
- $i=0;
- foreach ($pages as $page => $name) if (is_file($page) && is_link($page."s")) {
- $stat=stat($page);
- printf ("<tr class='%s'><td><a href='%ss'>%s</a></td><td>%s</td><td>%s</td></tr>\n",
- ($i%2 ? 'odd' : 'even'), $page, $page, $name, date("r", $stat["mtime"]));
- $i++;
- }
-?>
+<table id='fedora-list-packages'><tr><th>Repository on github.com</th></tr>
+<tr class='even'><td><a href='http://github.com/remicollet/rpmphp'>http://github.com/remicollet/rpmphp</a></td></tr>
+<tr class='odd'><td>Any feedback, RFE and patches are welcome.</td></tr>
</table>
-<p>Any feedback, RFE and patches are welcome.</p>
<!-- document END -->
</div>
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);
?>
</style>
@@ -74,7 +72,12 @@ try {
</div>
<div id="fedora-header-items">
-
+ <span class="fedora-header-search">
+ <form action='zoom.php' method='get'>
+ Package&nbsp;:&nbsp;
+ <input type='text' name='rpm' size='20' />
+ <input type="image" src='http://docs.fedoraproject.org/images/header-search.png' alt="Search" />
+ </form></span>
</div>
</div>
@@ -101,87 +104,98 @@ try {
<!-- document BEGIN -->
<?php
- echo "<h1>$name</h1>\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 "<table id='fedora-list-packages'>\n";
- echo "<tr><th colspan='2'>Upstream info</th></tr>\n";
- $i=0;
-
- if ($rpm && $rpm->summary) {
- echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
- echo "Summary</td><td><strong>". $rpm->summary . "</strong></td></tr>\n";
- } else if ($owner->summary) {
- echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
- echo "Summary</td><td><strong>". $owner->summary . "</strong></td></tr>\n";
- }
- if ($rpm && $rpm->url) {
- echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
- echo "URL</td><td><strong><a href='".$rpm->url."'>". $rpm->url . "</a></strong></td></tr>\n";
- }
- if ($up && $up->type) {
- echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
- echo "Type</td><td><strong>". $up->type . "</strong></td></tr>\n";
- }
- if ($up && $up->channel) {
- echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
- echo "Channel</td><td><strong>". $up->channel . "</strong></td></tr>\n";
- }
- if ($up && $up->stable) {
- echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
- echo "Stable version</td><td><strong>". $up->stable . "</strong></td></tr>\n";
- }
- if ($up && $up->unstable && $up->stable!=$up->unstable) {
- echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
- echo "Unstable version</td><td><strong>". $up->unstable . "</strong>";
- if ($up->state) {
- echo " (". $up->state . ")\n";
- }
- echo "</td></tr>\n";
- }
- if ($owner && $owner->owner) {
- echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
- echo "Owner</td><td><strong>". $owner->owner . "</strong>";
- if ($owner->cc) {
- echo " (". $owner->cc . ")\n";
- }
- }
- echo "</table>";
-
- if ($rpm) {
- echo "<br /><table id='fedora-list-packages'>\n";
- echo "<tr><th colspan='3'>Packages available in Fedora Repositories</th></tr>\n";
- $prev=false;
- do {
- echo "<tr class='".($i%2 ? 'odd' : 'even')."'>"; $i++;
- echo "<td><strong>".($rpm->repo_main==$prev ? "&nbsp;" : $prev=$rpm->repo_main)."</strong></td>";
- echo "<td>".$rpm->repo_sub."</td>";
- echo "<td>".($rpm->epoch ? $rpm->epoch.":" : "").$rpm->ver."-".$rpm->rel."</td>";
- echo "</tr>\n";
- } while ($rpm = $resrpm->fetchObject());
- echo "</table>";
- }
-
-}
-catch(PDOException $e) {
- printf("%s ERREUR : %s\n", date("r"), $e->getMessage());
+if (!$name) {
+ echo "<h1>Enter a package name</h1>\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 "<h1>$name not found</h1>\n";
+ } else {
+ echo "<h1>Package: $name</h1>\n";
+ echo "<table id='fedora-list-packages'>\n";
+ echo "<tr><th colspan='2'>Upstream info</th></tr>\n";
+ $i=0;
+
+ if ($rpm->summary) {
+ echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
+ echo "Summary</td><td><strong>". $rpm->summary . "</strong></td></tr>\n";
+ } else if ($owner->summary) {
+ echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
+ echo "Summary</td><td><strong>". $owner->summary . "</strong></td></tr>\n";
+ }
+ if ($rpm->url) {
+ echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
+ echo "URL</td><td><strong><a href='".$rpm->url."'>". $rpm->url . "</a></strong></td></tr>\n";
+ }
+ if ($up && $up->type) {
+ echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
+ echo "Type</td><td><strong>". $up->type . "</strong></td></tr>\n";
+ }
+ if ($up && $up->channel) {
+ echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
+ echo "Channel</td><td><strong>". $up->channel . "</strong></td></tr>\n";
+ }
+ if ($up && $up->stable) {
+ echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
+ echo "Stable version</td><td><strong>". $up->stable . "</strong></td></tr>\n";
+ }
+ if ($up && $up->unstable && $up->stable!=$up->unstable) {
+ echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
+ echo "Unstable version</td><td><strong>". $up->unstable . "</strong>";
+ if ($up->state) {
+ echo " (". $up->state . ")\n";
+ }
+ echo "</td></tr>\n";
+ }
+ if ($owner && $owner->owner) {
+ echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
+ echo "Owner</td><td><strong>". $owner->owner . "</strong>";
+ if ($owner->cc) {
+ echo " (". $owner->cc . ")\n";
+ }
+ echo "</td></tr>\n";
+ }
+ echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>ViewVC</td>"; $i++;
+ echo "<td><a href='http://cvs.fedoraproject.org/viewvc/rpms/$name/'>http://cvs.fedoraproject.org/viewvc/rpms/$name/</a>";
+ echo "</td></tr>\n";
+
+ echo "</table>";
+
+ echo "<br /><table id='fedora-list-packages'>\n";
+ echo "<tr><th colspan='3'>Packages available in Fedora Repositories</th></tr>\n";
+ $prev=false;
+ do {
+ echo "<tr class='".($i%2 ? 'odd' : 'even')."'>"; $i++;
+ echo "<td><strong>".($rpm->repo_main==$prev ? "&nbsp;" : $prev=$rpm->repo_main)."</strong></td>";
+ echo "<td>".$rpm->repo_sub."</td>";
+ echo "<td>".($rpm->epoch ? $rpm->epoch.":" : "").$rpm->ver."-".$rpm->rel."</td>";
+ echo "</tr>\n";
+ } while ($rpm = $resrpm->fetchObject());
+ echo "</table>";
+ }
+ }
+ catch(PDOException $e) {
+ printf("%s ERREUR : %s\n", date("r"), $e->getMessage());
+ }
}
-
?>
@@ -204,4 +218,3 @@ catch(PDOException $e) {
<!-- footer END -->
</body>
</html>
-