summaryrefslogtreecommitdiffstats
path: root/zoom.php
blob: 09f37f498b5f3a708a160120a4bf5f8f422817fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<?php

require "config.inc.php";
require "FedoraClient.php";

$fedcli = new FedoraPkgdb();

if (!isset($_GET['rpm'])) {
   die("missing arg.");
}
$name = $_GET['rpm'];

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head>
		<title>Packages in Fedora</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
                <link rel="stylesheet" type="text/css" media="screen" href="css/rpmphp.css"/>
		<!--<link rel="stylesheet" type="text/css" media="print" href="css/rpmphp-print.css">-->
		<link rel="shortcut icon" href="images/favicon.ico"/>
		<link rel="icon" href="images/favicon.ico"/>
	</head>

	<body>
		<div id="wrapper">
<?php
include '_header.php';
?>
			<div id="fedora-content">
				<div id="ariane">
					<p>You are here: </p>
					<ul>
						<li><a href="./">Reports home</a></li>
						<li><a href="#">Package detail</a></li>
					</ul>
				</div>
<?php
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";
         
         if (isset($_GET['pkgdb'])) {
            $fedpkg = $fedcli->getPackageInfo($name);
            echo "<p><a href='".$_SERVER['PHP_SELF']."?rpm=$name'>Hide pkgdb informations</a></p>";
         } else {
            $fedpkg = false;
            echo "<p><a href='".$_SERVER['PHP_SELF']."?rpm=$name&amp;pkgdb=1'>Show more informations from pkgdb</a></p>";
         }
         echo "<table id=\"upstream\">\n";
         echo "<caption>Upstream info</caption>\n";
         $i=0;

         if ($rpm->summary) {
            echo "<tr class='".($i%2 ? 'odd' : 'even')."'><th>"; $i++;
            echo "Summary: </th><td><strong>". $rpm->summary . "</strong></td></tr>\n";
         } else if ($owner->summary) {
            echo "<tr class='".($i%2 ? 'odd' : 'even')."'><th>"; $i++;
            echo "Summary: </th><td><strong>". $owner->summary . "</strong></td></tr>\n";
         }
         if (isset($fedpkg['devel']['package']['description'])) {
            echo "<tr class='".($i%2 ? 'odd' : 'even')."'><th>"; $i++;
            echo "Description: </th><td>".$fedpkg['devel']['package']['description']."</td></tr>\n";
         }
         if ($rpm->url) {
            echo "<tr class='".($i%2 ? 'odd' : 'even')."'><th>"; $i++;
            echo "URL: </th><td><strong><a href='".$rpm->url."'>". $rpm->url . "</a></strong></td></tr>\n";
         }
         if ($up && $up->type) {
            echo "<tr class='".($i%2 ? 'odd' : 'even')."'><th>"; $i++;
            echo "Type: </th><td><strong>". $up->type . "</strong></td></tr>\n";
         }
         if ($up && $up->channel) {
            echo "<tr class='".($i%2 ? 'odd' : 'even')."'><th>"; $i++;
            echo "Channel: </th><td><strong>". $up->channel . "</strong></td></tr>\n";
         }
         if ($up && $up->stable) {
            echo "<tr class='".($i%2 ? 'odd' : 'even')."'><th>"; $i++;
            echo "Stable version: </th><td><strong>". $up->stable . "</strong></td></tr>\n";
         }
         if ($up && $up->unstable && $up->stable!=$up->unstable) {
            echo "<tr class='".($i%2 ? 'odd' : 'even')."'><th>"; $i++;
            echo "Unstable version: </th><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')."\"><th>"; $i++;
            echo "Owner: </th><td><strong>". $owner->owner . "</strong>";
            if ($owner->cc) {
               echo " (". $owner->cc . ")\n";
            }
            echo "</td></tr>\n";
         }
         echo "<tr class=\"".($i%2 ? 'odd' : 'even')."\"><th>ViewVC: </th>"; $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 "<table id=\"list-packages\">\n";
         echo "<caption>Packages available in Fedora Repositories</caption>\n";
         echo "<thead><tr><th>Branch</th><th>Repository</th><th>Version-Release</th><th>Owner</th><th>Co-maintainers</th></tr></thead><tbody>\n";
         $prev=false;
         do {
            if ($rpm->repo_main=='rawhide' && isset($fedpkg['devel']['owner'])) {
               $owner = $fedpkg['devel']['owner'];
               $people = $fedpkg['devel']['people'];
            } else if (isset($fedpkg[$rpm->repo_main]['owner'])) {
               $owner = $fedpkg[$rpm->repo_main]['owner'];
               $people = $fedpkg[$rpm->repo_main]['people'];
            } else {
               $owner ="&nbsp;";
               $people = false;
            }
            $comaint = '';
            if ($people) foreach ($people as $user) {
               if (isset($user['aclOrder']['commit']['statuscode']) && $user['aclOrder']['commit']['statuscode']==3) {
                  $comaint .= $user['username'];
               }
            }
            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 "<td>$owner</td><td>$comaint</td></tr>\n";
         } while ($rpm = $resrpm->fetchObject());
         echo "</tbody></table>";
      }
   }
   catch(PDOException $e) {
      printf("%s ERREUR : %s\n", date("r"),  $e->getMessage());
   }
}
?>


        <!-- document END -->
        </div>

		<!-- content END -->
<?php
include '_footer.php';
?>
		</div>
	</body>
</html>