summaryrefslogtreecommitdiff
blob: a63966be568adb1b10c589de6f7775d328c58cf4 (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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<?
		
		$p = new DBPackage($package_id);
		
		$str_changelog = $p->changelog;
		
		echo "<div id='data'></div>";
		
		/** Changelog **/
		echo "<div id='changelog' style='display: none;'>\n";
		
		$arr_patterns = array(
			'/((bug\n?)( {1,2}\D?)|#)(\d+)/i',
 			'/([0123]?[0-9] (Jan|Feb|Mar|Apr|May|Ju[nl]|Aug|Sep|Oct|Nov|Dec) (19|20)\d{2});/',
  			'/&lt;(.+)@gentoo.org&gt;/'
		);
		$arr_replacements = array(
			"<a href='https://bugs.gentoo.org/$4'>$1$4</a>",
 			"<span class='date'>$1</span>;",
  			"(<a href='http://cia.vc/stats/author/$1'>$1</a>)",
		);
		
 		$str_changelog = wordwrap($str_changelog, 80);
		$str_changelog = htmlspecialchars($str_changelog);
		$str_changelog = preg_replace($arr_patterns, $arr_replacements, $str_changelog);
		
		if(!empty($str_changelog)) {
		
			$str = gettext("CHANGELOG");
		
			echo "<h4>$str</h4>";
			
			echo "<div style='margin-left: 25px; margin-bottom: 25px;'>\n";
			echo "<div class='changelog'>";
			echo "<pre>";
			echo $str_changelog;
			echo "</pre>";
			echo "</div>";
			
			echo "</div>\n";
			
		}
		
		echo "</div>\n";
		
		/** Bugs **/
		echo "<div id='bugs' style='display: none;'>\n";
		
		$gentoo_bugs = "https://bugs.gentoo.org/buglist.cgi?query_format=&amp;short_desc_type=allwords&amp;short_desc=".urlencode($p->name)."&amp;bug_status=UNCONFIRMED&amp;bug_status=NEW&amp;bug_status=ASSIGNED&amp;bug_status=REOPENED";
		
		$str = gettext("BUGS");
		
		echo "<h4>$str</h4>\n";
		
		$sql = "SELECT bug, description FROM package_bugs WHERE package = ".$db->quote($package_id)." AND status = 0 ORDER BY bug;";
		$arr = $db->getAssoc($sql);
		
		if(count($arr)) {
		
			echo "<table class='bugs' cellpadding='4' cellspacing='0'>\n";
// 			echo "\t<tr>\n";
// 			echo "\t\t<th>Bug</th><th>Description</th>\n";
// 			echo "\t</tr>\n";
			
			$x = 0;
		
			foreach($arr as $bug => $description) {
			
				$class = getRowClass($x++);
			
				echo "\t<tr class='$class'>\n";
				echo "\t\t<td><a href='https://bugs.gentoo.org/$bug'>$bug</a></td>\n";
				echo "\t\t<td>".htmlentities($description)."</td>\n";
				echo "\t</tr>\n";
			
			}
			
			echo "</table>\n";
			
		} else {
			$str = gettext("No bugs found");
			echo "<p><b>$str</b></p>\n";
		}
		
		
		if($lingua == "en")
			echo "<p style='margin: 0 20px;'><b>Notes:</b> This list is taken from a snapshot, and is not a reliable reference.  Search <a href='$gentoo_bugs'>bugzilla</a> for accurate results.</p>\n";
		
		echo "</div>\n";
		
		
		/** Use Flags **/
		echo "<div id='useflags' style='display: none;'>\n";
		
		$str = gettext("USE FLAGS");
		echo "<h4>$str</h4>\n";
		
		if($view == 'ebuild')
			$sql = "SELECT name, description FROM view_ebuild_use WHERE ebuild = ".$db->quote($ebuild_id)." ORDER BY name;";
		else
			$sql = "SELECT name, description FROM view_package_use WHERE package = ".$db->quote($package_id)." ORDER BY name;";
		
		$arr = $db->getAssoc($sql);
		
		if(count($arr)) {
			echo "<table class='useflags' cellpadding='4' cellspacing='0'>\n";
		
			$x = 0;
		
			foreach($arr as $name => $description) {
			
				$class = getRowClass($x++);
			
				$url = $base_uri.'useflags/'.urlencode($name);
			
				echo "\t<tr class='$class'>\n";
				echo "\t\t<td valign='top'><a href='$url'>$name</a></td>\n";
				echo "\t\t<td>".htmlentities($description)."</td>\n";
				echo "\t</tr>\n";
			
			}
			
			echo "</table>\n";
		} else {
		
			$str = gettext("No Use Flags");
			echo "<div class='about'>$str</div>";
		}
		
		echo "</div>\n";
		
		/** Dependencies **/
		echo "<div id='dependencies' style='display: none;'>\n";
		
		if($view == 'ebuild')
			$sql = "SELECT type, cp, description FROM view_ebuild_depend WHERE ebuild = ".$db->quote($ebuild_id)." ORDER BY cp;";
		else
			$sql = "SELECT type, cp, description FROM view_package_depend WHERE package = ".$db->quote($package_id)." ORDER BY cp;";
			
		$arr = $db->getAll($sql);
		
		foreach($arr as $row) {
			$arr_depends[$row['type']][$row['cp']] = $row['description'];
		}
		
		if(count($arr_depends)) {
		
			ksort($arr_depends);
		
			foreach($arr_depends as $type => $arr) {
			
				if($type == 'depend')
					$str = gettext('BUILD DEPENDENCIES');
				else
					$str = gettext('RUNTIME DEPENDENCIES');
			
				if(count($arr)) {
				
					echo "<h4>$str</h4>\n";
				
					echo "<table class='dependencies' cellpadding='4' cellspacing='0'>\n";
					
					$x = 0;
					
					foreach($arr as $cp => $description) {
					
						$class = getRowClass($x++);
						$url = $base_uri.$cp;
					
						echo "\t<tr class='$class'>\n";
						echo "\t\t<td  valign='top'><a href='$url'>$cp</a></td>\n";
						echo "\t\t<td>$description</td>\n";
						echo "\t</tr>\n";
					}
					echo "</table>\n";
				}
			}
		}
		
		if($view == 'package') {
			$sql = "SELECT DISTINCT cp, description FROM view_reverse_depend WHERE package = ".$db->quote($package_id)." ORDER BY cp;";
			$arr = $db->getAssoc($sql);
			
			if(count($arr)) {
			
				$str = gettext("REVERSE DEPENDENCIES");
			
				echo "<h4>$str</h4>\n";
				
				echo "<table class='dependencies' cellpadding='4' cellspacing='0'>\n";
				
				$x = 0;
			
				foreach($arr as $cp => $description) {
				
					$class = getRowClass($x++);
					$url = $base_uri.$cp;
				
					echo "\t<tr class='$class'>\n";
					echo "\t\t<td valign='top'><a href='$url'>$cp</a></td>\n";
					echo "\t\t<td>$description</td>\n";
					echo "\t</tr>\n";
				}
				echo "</table>\n";
				
			}
			
			$arr_licenses = $p->getLicenses();
		
			$url_licenses = array();
			
			/** License **/
			echo "<div id='license' style='display: none;'>\n";
			$str = gettext("LICENSE");
			echo "<h4>$str</h4>\n";
		
			if(count($arr_licenses)) {
				foreach($arr_licenses as $name) {
					$str = nl2br(wordwrap(str_replace('-', ' ', $name), 25));
					$url_licenses[$str] = $base_uri."licenses/".urlencode($name);
				}
			}
			
			$str = "\t\t\t\t\t<ul>\n";
			foreach($url_licenses as $name => $url)
				$str .= "\t\t\t\t\t\t<li><a href='$url'>$name</a></li>\n";
			$str .= "\t\t\t\t\t</ul>\n";
			
			echo $str;
			
			echo "</div>\n";
			
		}
		
		echo "</div>\n";
		
		/** Ebuild Source **/
		if($view == 'ebuild') {
		
			$e = new DBEbuild($ebuild_id);
		
			$sql = "SELECT source FROM ebuild WHERE id = ".$db->quote($ebuild_id).";";
			$source = $db->getOne($sql);
			
			echo "<div id='source' style='display: none;'>\n";
			$str = gettext("SOURCE CODE");
			echo "<h4>$str</h4>\n";
			echo "<div style='margin: 0 25px;'>\n";
			$str = wordwrap($source, 80);
			echo "<pre>$str</pre>";
			echo "</div>\n";
			echo "</div>\n";
			
			$arr_licenses = $e->licenses;
		
			$url_licenses = array();
			
			/** License **/
			echo "<div id='license' style='display: none;'>\n";
			$str = gettext("LICENSE");
			echo "<h4>$str</h4>\n";
		
			if(count($arr_licenses)) {
				foreach($arr_licenses as $name) {
					$str = nl2br(wordwrap(str_replace('-', ' ', $name), 25));
					$url_licenses[$str] = $base_uri."licenses/".urlencode($name);
				}
			}
			
			$str = "\t\t\t\t\t<ul>\n";
			foreach($url_licenses as $name => $url)
				$str .= "\t\t\t\t\t\t<li><a href='$url'>$name</a></li>\n";
			$str .= "\t\t\t\t\t</ul>\n";
			
			echo $str;
			
			echo "</div>\n";
		
		}
		
		
		
		/** Downloads **/
		echo "<div id='downloads' style='display: none;'>\n";
		$str = gettext("DOWNLOADS");
		echo "<h4>$str</h4>\n";
		echo "</div>\n";
		
		if(($view == 'package' && in_array($section, $arr_package_sections)) || ($view == 'ebuild' && in_array($section, $arr_ebuild_sections))) {
			echo "<script type='text/javascript'>\n";
			echo "$('data').update($('$section').innerHTML);";
			echo "</script>\n";
		}
?>