pkg_details.php 5.29 KB
Newer Older
1
<?php
2
3
$atype = account_from_sid($SID);
$uid = uid_from_sid($SID);
4
5

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

9
	$catarr = pkgCategories();
Lukas Fleischer's avatar
Lukas Fleischer committed
10
11
12
	$edit_cat = "<form method='post' action='packages.php?ID=".$pkgid."'>\n";
	$edit_cat.= "<p>";
	$edit_cat.= "<input type='hidden' name='action' value='do_ChangeCategory' />";
13
	$edit_cat.= "<span class='f3'>" . __("Category") . ":</span> ";
14
15
16
17
	$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
18
		    $edit_cat.=" selected='selected'";
19
20
21
		}
		$edit_cat.=">".$catname."</option>";
	}
22
	$edit_cat.= "</select>&nbsp;<input type='submit' value='" . __("Change category") . "' />";
Lukas Fleischer's avatar
Lukas Fleischer committed
23
	$edit_cat.= "</p>";
24
25
	$edit_cat.= "</form>";

26
27
}
else {
28
	$edit_cat = "<span class='f3'>" . __("Category") . ": " . $row['Category'] . "</span>";
29
30
}

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

} else {
	$submitter = "None";
}

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

} else {
	$maintainer = "None";
}

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

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

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

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

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

Lukas Fleischer's avatar
Lukas Fleischer committed
76
77
	<?php echo $edit_cat ?>

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

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

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

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

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

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

	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
117
118
119
			# 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>";
120
			} else {
121
				echo " <a href='http://www.archlinux.org/packages/?q=".urlencode($darr[0])."'>".$darr[0].$darr[1]."</a>";
122
123
124
125
126
127
128
129
130
131
132
133
			}
		}

		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
134
135
			# darr: (PackageName, PackageID)
			echo " <a href='packages.php?ID=".$darr[1]."'>".$darr[0]."</a>";
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
		}
	}

	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)) {
154
155
			$src = explode('::', $src);
			$parsed_url = parse_url($src[0]);
156

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

?>

	</div>
</div>