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. */
51 if (current_action("do_Flag")) {
52 list($ret, $output) = pkgbase_flag($ids, $_POST['comments']);
53 } elseif (current_action("do_UnFlag")) {
54 list($ret, $output) = pkgbase_unflag($ids);
55 } elseif (current_action("do_Adopt")) {
56 list($ret, $output) = pkgbase_adopt($ids, true, NULL);
57 } elseif (current_action("do_Disown")) {
58 if (isset($_POST['confirm'])) {
59 $via = isset($_POST['via']) ?
$_POST['via'] : NULL;
60 list($ret, $output) = pkgbase_adopt($ids, false, $via);
62 $output = __("The selected packages have not been disowned, check the confirmation checkbox.");
65 } elseif (current_action("do_Vote")) {
66 list($ret, $output) = pkgbase_vote($ids, true);
67 } elseif (current_action("do_UnVote")) {
68 list($ret, $output) = pkgbase_vote($ids, false);
69 } elseif (current_action("do_Delete")) {
70 if (isset($_POST['confirm'])) {
71 $via = isset($_POST['via']) ?
$_POST['via'] : NULL;
72 if (!isset($_POST['merge_Into']) ||
empty($_POST['merge_Into'])) {
73 list($ret, $output) = pkgbase_delete($ids, NULL, $via);
78 $merge_base_id = pkgbase_from_name($_POST['merge_Into']);
79 if (!$merge_base_id) {
80 $output = __("Cannot find package to merge votes and comments into.");
82 } elseif (in_array($merge_base_id, $ids)) {
83 $output = __("Cannot merge a package base with itself.");
86 list($ret, $output) = pkgbase_delete($ids, $merge_base_id, $via);
93 $output = __("The selected packages have not been deleted, check the confirmation checkbox.");
96 } elseif (current_action("do_Notify")) {
97 list($ret, $output) = pkgbase_notify($ids);
98 } elseif (current_action("do_UnNotify")) {
99 list($ret, $output) = pkgbase_notify($ids, false);
100 } elseif (current_action("do_DeleteComment")) {
101 list($ret, $output) = pkgbase_delete_comment();
102 } elseif (current_action("do_UndeleteComment")) {
103 list($ret, $output) = pkgbase_delete_comment(true);
104 if ($ret && isset($_POST["comment_id"])) {
105 $fragment = '#comment-' . intval($_POST["comment_id"]);
107 } elseif (current_action("do_PinComment")) {
108 list($ret, $output) = pkgbase_pin_comment();
109 } elseif (current_action("do_UnpinComment")) {
110 list($ret, $output) = pkgbase_pin_comment(true);
111 } elseif (current_action("do_SetKeywords")) {
112 list($ret, $output) = pkgbase_set_keywords($base_id, preg_split("/[\s,;]+/", $_POST['keywords'], -1, PREG_SPLIT_NO_EMPTY
));
113 } elseif (current_action("do_FileRequest")) {
114 list($ret, $output) = pkgreq_file($ids, $_POST['type'], $_POST['merge_into'], $_POST['comments']);
115 } elseif (current_action("do_CloseRequest")) {
116 list($ret, $output) = pkgreq_close($_POST['reqid'], $_POST['reason'], $_POST['comments']);
117 } elseif (current_action("do_EditComaintainers")) {
118 list($ret, $output) = pkgbase_set_comaintainers($base_id, explode("\n", $_POST['users']));
119 } elseif (current_action("do_AddComment")) {
120 $uid = uid_from_sid($_COOKIE["AURSID"]);
121 list($ret, $output) = pkgbase_add_comment($base_id, $uid, $_REQUEST['comment']);
123 } elseif (current_action("do_EditComment")) {
124 list($ret, $output) = pkgbase_edit_comment($_REQUEST['comment']);
125 if ($ret && isset($_POST["comment_id"])) {
126 $fragment = '#comment-' . intval($_POST["comment_id"]);
131 if (current_action("do_CloseRequest") ||
132 (current_action("do_Delete") && $_POST['via'])) {
133 /* Redirect back to package request page on success. */
134 header('Location: ' . get_pkgreq_route());
136 } if (isset($base_id)) {
137 /* Redirect back to package base page on success. */
138 header('Location: ' . get_pkgbase_uri($pkgbase_name) . $fragment);
141 /* Redirect back to package search page. */
142 header('Location: ' . get_pkg_route());
148 $pkgs = pkgbase_get_pkgnames($base_id);
149 if (!$output && count($pkgs) == 1) {
150 /* Not a split package. Redirect to the package page. */
151 if (empty($_SERVER['QUERY_STRING'])) {
152 header('Location: ' . get_pkg_uri($pkgs[0]) . $fragment);
154 header('Location: ' . get_pkg_uri($pkgs[0]) . '?' . $_SERVER['QUERY_STRING'] . $fragment);
158 $details = pkgbase_get_details($base_id);
159 html_header($title, $details);
162 <?php
if ($output): ?
>
164 <p
class="pkgoutput"><?
= htmlspecialchars($output) ?
></p
>
166 <ul
class="errorlist"><li
><?
= htmlspecialchars($output) ?
></li
></ul
>
171 include('pkg_search_form.php');
172 if (isset($_COOKIE["AURSID"])) {
173 pkgbase_display_details($base_id, $details, $_COOKIE["AURSID"]);
175 pkgbase_display_details($base_id, $details, null);
178 html_footer(AURWEB_VERSION
);