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);
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);
77 $merge_base_id = pkgbase_from_name($_POST['merge_Into']);
78 if (!$merge_base_id) {
79 $output = __("Cannot find package to merge votes and comments into.");
81 } elseif (in_array($merge_base_id, $ids)) {
82 $output = __("Cannot merge a package base with itself.");
85 list($ret, $output) = pkgbase_delete($ids, $merge_base_id, $via);
91 $output = __("The selected packages have not been deleted, check the confirmation checkbox.");
94 } elseif (current_action("do_Notify")) {
95 list($ret, $output) = pkgbase_notify($ids);
96 } elseif (current_action("do_UnNotify")) {
97 list($ret, $output) = pkgbase_notify($ids, false);
98 } elseif (current_action("do_DeleteComment")) {
99 list($ret, $output) = pkgbase_delete_comment();
100 } elseif (current_action("do_SetKeywords")) {
101 list($ret, $output) = pkgbase_set_keywords($base_id, preg_split("/[\s,;]+/", $_POST['keywords'], -1, PREG_SPLIT_NO_EMPTY
));
102 } elseif (current_action("do_FileRequest")) {
103 list($ret, $output) = pkgreq_file($ids, $_POST['type'], $_POST['merge_into'], $_POST['comments']);
104 } elseif (current_action("do_CloseRequest")) {
105 list($ret, $output) = pkgreq_close($_POST['reqid'], $_POST['reason'], $_POST['comments']);
106 } elseif (current_action("do_EditComaintainers")) {
107 list($ret, $output) = pkgbase_set_comaintainers($base_id, explode("\n", $_POST['users']));
108 } elseif (current_action("do_AddComment")) {
109 $uid = uid_from_sid($_COOKIE["AURSID"]);
110 list($ret, $output) = pkgbase_add_comment($base_id, $uid, $_REQUEST['comment']);
112 } elseif (current_action("do_EditComment")) {
113 list($ret, $output) = pkgbase_edit_comment($_REQUEST['comment']);
114 if ($ret && isset($_POST["comment_id"])) {
115 $fragment = '#comment-' . intval($_POST["comment_id"]);
120 if (current_action("do_CloseRequest") ||
121 (current_action("do_Delete") && $_POST['via'])) {
122 /* Redirect back to package request page on success. */
123 header('Location: ' . get_pkgreq_route());
125 } if (isset($base_id)) {
126 /* Redirect back to package base page on success. */
127 header('Location: ' . get_pkgbase_uri($pkgbase_name) . $fragment);
130 /* Redirect back to package search page. */
131 header('Location: ' . get_pkg_route());
137 $pkgs = pkgbase_get_pkgnames($base_id);
138 if (!$output && count($pkgs) == 1) {
139 /* Not a split package. Redirect to the package page. */
140 if (empty($_SERVER['QUERY_STRING'])) {
141 header('Location: ' . get_pkg_uri($pkgs[0]) . $fragment);
143 header('Location: ' . get_pkg_uri($pkgs[0]) . '?' . $_SERVER['QUERY_STRING'] . $fragment);
147 $details = pkgbase_get_details($base_id);
148 html_header($title, $details);
151 <?php
if ($output): ?
>
153 <p
class="pkgoutput"><?
= htmlspecialchars($output) ?
></p
>
155 <ul
class="errorlist"><li
><?
= htmlspecialchars($output) ?
></li
></ul
>
160 include('pkg_search_form.php');
161 if (isset($_COOKIE["AURSID"])) {
162 pkgbase_display_details($base_id, $details, $_COOKIE["AURSID"]);
164 pkgbase_display_details($base_id, $details, null);
167 html_footer(AURWEB_VERSION
);