3 set_include_path(get_include_path() . PATH_SEPARATOR
. '../lib');
5 include_once("aur.inc.php");
7 include_once('pkgfuncs.inc.php');
11 * Retrieve package base ID and name, unless initialized by the routing
14 if (!isset($base_id) ||
!isset($pkgbase_name)) {
15 if (isset($_GET['ID'])) {
16 $base_id = intval($_GET['ID']);
17 $pkgbase_name = pkgbase_name_from_id($_GET['ID']);
18 } else if (isset($_GET['N'])) {
19 $base_id = pkgbase_from_name($_GET['N']);
20 $pkgbase_name = $_GET['N'];
22 unset($base_id, $pkgbase_name);
25 if (isset($base_id) && ($base_id == 0 ||
$base_id == NULL ||
$pkgbase_name == NULL)) {
26 header("HTTP/1.0 404 Not Found");
32 /* Set the title to package base name. */
33 $title = $pkgbase_name;
35 /* Grab the list of package base IDs to be operated on. */
37 if (isset($_POST['IDs'])) {
38 foreach ($_POST['IDs'] as $id => $i) {
46 /* Perform package base actions. */
50 if (current_action("do_Flag")) {
51 list($ret, $output) = pkgbase_flag($ids);
52 } elseif (current_action("do_UnFlag")) {
53 list($ret, $output) = pkgbase_unflag($ids);
54 } elseif (current_action("do_Adopt")) {
55 list($ret, $output) = pkgbase_adopt($ids, true, NULL);
56 } elseif (current_action("do_Disown")) {
57 if (isset($_POST['confirm'])) {
58 $via = isset($_POST['via']) ?
$_POST['via'] : NULL;
59 list($ret, $output) = pkgbase_adopt($ids, false, $via);
61 $output = __("The selected packages have not been disowned, check the confirmation checkbox.");
64 } elseif (current_action("do_Vote")) {
65 list($ret, $output) = pkgbase_vote($ids, true);
66 } elseif (current_action("do_UnVote")) {
67 list($ret, $output) = pkgbase_vote($ids, false);
68 } elseif (current_action("do_Delete")) {
69 if (isset($_POST['confirm'])) {
70 $via = isset($_POST['via']) ?
$_POST['via'] : NULL;
71 if (!isset($_POST['merge_Into']) ||
empty($_POST['merge_Into'])) {
72 list($ret, $output) = pkgbase_delete($ids, NULL, $via);
76 $merge_base_id = pkgbase_from_name($_POST['merge_Into']);
77 if (!$merge_base_id) {
78 $output = __("Cannot find package to merge votes and comments into.");
80 } elseif (in_array($merge_base_id, $ids)) {
81 $output = __("Cannot merge a package base with itself.");
84 list($ret, $output) = pkgbase_delete($ids, $merge_base_id, $via);
90 $output = __("The selected packages have not been deleted, check the confirmation checkbox.");
93 } elseif (current_action("do_Notify")) {
94 list($ret, $output) = pkgbase_notify($ids);
95 } elseif (current_action("do_UnNotify")) {
96 list($ret, $output) = pkgbase_notify($ids, false);
97 } elseif (current_action("do_DeleteComment")) {
98 list($ret, $output) = pkgbase_delete_comment();
99 } elseif (current_action("do_SetKeywords")) {
100 list($ret, $output) = pkgbase_set_keywords($base_id, preg_split("/[\s,;]+/", $_POST['keywords'], -1, PREG_SPLIT_NO_EMPTY
));
101 } elseif (current_action("do_FileRequest")) {
102 list($ret, $output) = pkgreq_file($ids, $_POST['type'], $_POST['merge_into'], $_POST['comments']);
103 } elseif (current_action("do_CloseRequest")) {
104 list($ret, $output) = pkgreq_close($_POST['reqid'], $_POST['reason'], $_POST['comments']);
105 } elseif (current_action("do_EditComaintainers")) {
106 list($ret, $output) = pkgbase_set_comaintainers($base_id, explode("\n", $_POST['users']));
109 if (isset($_REQUEST['comment'])) {
110 $uid = uid_from_sid($_COOKIE["AURSID"]);
111 pkgbase_add_comment($base_id, $uid, $_REQUEST['comment']);
116 if (current_action("do_CloseRequest") ||
117 (current_action("do_Delete") && $_POST['via'])) {
118 /* Redirect back to package request page on success. */
119 header('Location: ' . get_pkgreq_route());
121 } if (isset($base_id)) {
122 /* Redirect back to package base page on success. */
123 header('Location: ' . get_pkgbase_uri($pkgbase_name));
126 /* Redirect back to package search page. */
127 header('Location: ' . get_pkg_route());
133 $pkgs = pkgbase_get_pkgnames($base_id);
134 if (!$output && count($pkgs) == 1) {
135 /* Not a split package. Redirect to the package page. */
136 if (empty($_SERVER['QUERY_STRING'])) {
137 header('Location: ' . get_pkg_uri($pkgs[0]));
139 header('Location: ' . get_pkg_uri($pkgs[0]) . '?' . $_SERVER['QUERY_STRING']);
143 $details = pkgbase_get_details($base_id);
144 html_header($title, $details);
147 <?php
if ($output): ?
>
149 <p
class="pkgoutput"><?
= htmlspecialchars($output) ?
></p
>
151 <ul
class="errorlist"><li
><?
= htmlspecialchars($output) ?
></li
></ul
>
156 include('pkg_search_form.php');
157 if (isset($_COOKIE["AURSID"])) {
158 pkgbase_display_details($base_id, $details, $_COOKIE["AURSID"]);
160 pkgbase_display_details($base_id, $details, null);
163 html_footer(AURWEB_VERSION
);