pkg_details.php 5.18 KB
Newer Older
1
<?php
2
3

$pkgid = intval($_REQUEST['ID']);
4
5
if ($uid == $row["MaintainerUID"] or
	($atype == "Developer" or $atype == "Trusted User")) {
6

7
	$catarr = pkgCategories();
Lukas Fleischer's avatar
Lukas Fleischer committed
8
9
10
11
	$edit_cat = "<form method='post' action='packages.php?ID=".$pkgid."'>\n";
	$edit_cat.= "<p>";
	$edit_cat.= "<input type='hidden' name='action' value='do_ChangeCategory' />";
	$edit_cat.= "<span class='f3'>Category:</span> ";
12
13
14
15
	$edit_cat.= "<select name='category_id'>\n";
	foreach ($catarr as $cid => $catname) {
		$edit_cat.= "<option value='$cid'";
		if ($cid == $row["CategoryID"]) {
Lukas Fleischer's avatar
Lukas Fleischer committed
16
		    $edit_cat.=" selected='selected'";
17
18
19
		}
		$edit_cat.=">".$catname."</option>";
	}
Lukas Fleischer's avatar
Lukas Fleischer committed
20
21
	$edit_cat.= "</select>&nbsp;<input type='submit' value='Change category' />";
	$edit_cat.= "</p>";
22
23
	$edit_cat.= "</form>";

24
25
}
else {
Lukas Fleischer's avatar
Lukas Fleischer committed
26
	$edit_cat = "<span class='f3'>Category: " . $row['Category'] . "</span>";
27
28
}

29
30
31
if ($row["SubmitterUID"]) {
	$submitter = username_from_id($row["SubmitterUID"]);
	if ($SID) {
32
		$submitter = '<a href="account.php?Action=AccountInfo&amp;ID=' . htmlspecialchars($row['SubmitterUID'], ENT_QUOTES) . '">' . htmlspecialchars($submitter) . '</a>';
33
34
35
36
37
38
	}

} else {
	$submitter = "None";
}

39
40
41
if ($row["MaintainerUID"]) {
	$maintainer = username_from_id($row["MaintainerUID"]);
	if ($SID) {
42
		$maintainer = '<a href="account.php?Action=AccountInfo&amp;ID=' . htmlspecialchars($row['MaintainerUID'], ENT_QUOTES) . '">' . htmlspecialchars($maintainer) . '</a>';
43
44
45
46
47
48
	}

} else {
	$maintainer = "None";
}

49
50
51
52
53
$votes = __('Votes') . ': ' . $row['NumVotes'];
if ($atype == "Developer" or $atype == "Trusted User") {
	$votes = "<a href=\"voters.php?ID=$pkgid\">$votes</a>";
}

54
55
56
57
58
# In case of wanting to put a custom message
$msg = __('unknown');
$license = empty($row['License']) ? $msg : $row['License'];

# Print the timestamps for last updates
59
60
$updated_time = ($row["ModifiedTS"] == 0) ? $msg : gmdate("r", intval($row["ModifiedTS"]));
$submitted_time = ($row["SubmittedTS"] == 0) ? $msg : gmdate("r", intval($row["SubmittedTS"]));
61
$out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("r", intval($row["OutOfDateTS"]));
62
63
64
65
66
67
68

?>
<div class="pgbox">
	<div class="pgboxtitle"><span class="f3"><?php echo __("Package Details") ?></span></div>
	<div class="pgboxbody">

	<p>
69
70
	<span class='f2'><?php echo htmlspecialchars($row['Name']) . ' ' . htmlspecialchars($row['Version']) ?></span><br />
	<span class='f3'><a href="<?php echo htmlspecialchars($row['URL'], ENT_QUOTES) . '">' . $row['URL'] ?></a></span><br />
71
	<span class='f3'><?php echo htmlspecialchars($row['Description'], ENT_QUOTES); ?></span>
72
73
	</p>

Lukas Fleischer's avatar
Lukas Fleischer committed
74
75
	<?php echo $edit_cat ?>

76
	<p>
77
	<span class='f3'><?php echo __('Submitter') .': ' . $submitter ?></span><br />
78
	<span class='f3'><?php echo __('Maintainer') .': ' . $maintainer ?></span><br />
79
	<span class='f3'><?php echo $votes ?></span>
80
81
	</p>

82
	<p><span class='f3'><?php echo __('License') . ': ' . htmlspecialchars($license) ?></span></p>
83
84
85
86
87
88
89
90
91
92

	<p>
	<span class='f3'>
	<?php echo __('Last Updated') . ': ' . $updated_time ?><br />
	<?php echo __('First Submitted') . ': '. $submitted_time ?>
	</span>
	</p>

	<p><span class='f3'>
<?php
93
		$urlpath = URL_DIR . substr($row['Name'], 0, 2) . "/" . $row['Name'];
94
95
		print "<a href='$urlpath/" . $row['Name'] . ".tar.gz'>".__("Tarball")."</a> :: ";
		print "<a href='$urlpath/PKGBUILD'>".__("PKGBUILD")."</a></span>";
96

97
98
		if ($row["OutOfDateTS"] !== NULL) {
			echo "<br /><span class='f6'>".__("This package has been flagged out of date.")." (${out_of_date_time})</span>";
99
100
101
102
103
104
		}
?>
	</p>
<?php

	$deps = package_dependencies($row["ID"]);
Dan McGee's avatar
Dan McGee committed
105
	$requiredby = package_required($row["Name"]);
106
107
108
109
110
111
112
113
114

	if (count($deps) > 0 || count($requiredby) > 0) {
		echo '<p>';
	}

	if (count($deps) > 0) {
		echo "<span class='boxSoftTitle'><span class='f3'>". __("Dependencies")."</span></span>";

		while (list($k, $darr) = each($deps)) {
Dan McGee's avatar
Dan McGee committed
115
116
117
			# darr: (DepName, DepCondition, PackageID), where ID is NULL if it didn't exist
			if (!is_null($darr[2])) {
				echo " <a href='packages.php?ID=".$darr[2]."'>".$darr[0].$darr[1]."</a>";
118
			} else {
119
				echo " <a href='http://www.archlinux.org/packages/?q=".urlencode($darr[0])."'>".$darr[0].$darr[1]."</a>";
120
121
122
123
124
125
126
127
128
129
130
131
			}
		}

		if (count($requiredby) > 0) {
			echo '<br />';
		}
	}

	if (count($requiredby) > 0) {
		echo "<span class='boxSoftTitle'><span class='f3'>". __("Required by")."</span></span>";

		while (list($k, $darr) = each($requiredby)) {
Dan McGee's avatar
Dan McGee committed
132
133
			# darr: (PackageName, PackageID)
			echo " <a href='packages.php?ID=".$darr[1]."'>".$darr[0]."</a>";
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
		}
	}

	if (count($deps) > 0 || count($requiredby) > 0) {
		echo '</p>';
	}


	# $sources[0] = 'src';
	$sources = package_sources($row["ID"]);

	if (count($sources) > 0) {

?>
	<div class='boxSoftTitle'><span class='f3'><?php echo __('Sources') ?></span></div>
	<div>
<?php
		while (list($k, $src) = each($sources)) {
152
153
			$src = explode('::', $src);
			$parsed_url = parse_url($src[0]);
154

155
			if (isset($parsed_url['scheme']) || isset($src[1])) {
156
				# It is an external source
157
				echo "<a href=\"" . htmlspecialchars((isset($src[1]) ? $src[1] : $src[0]), ENT_QUOTES) . "\">" . htmlspecialchars($src[0]) . "</a><br />\n";
158
			}
159
160
			else {
				$src = $src[0];
161
				# It is presumably an internal source
162
				echo "<span class='f8'>" . htmlspecialchars($src) . "</span>";
163
				echo "<br />\n";
164
165
166
167
168
169
170
171
172
173
174
			}
		}
?>
	</div>
<?php
	}

?>

	</div>
</div>