po/POTFILES: Fix library file paths
[aur.git] / web / html / packages.php
blobdc06c7e46957ba38a77ba665f1cb5bad5f4de529
1 <?php
3 set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
5 include_once("aur.inc.php"); # access AUR common functions
6 set_lang(); # this sets up the visitor's language
7 include_once('pkgfuncs.inc.php'); # package specific functions
8 check_sid(); # see if they're still logged in
10 # Set the title to the current query if required
11 if (isset($_GET['ID']) && ($pkgname = pkgname_from_id($_GET['ID']))) {
12 $title = $pkgname;
13 } else if (!empty($_GET['K'])) {
14 $title = __("Search Criteria") . ": " . $_GET['K'];
15 } else {
16 $title = __("Packages");
19 # Retrieve account type
20 if (isset($_COOKIE["AURSID"])) {
21 $atype = account_from_sid($_COOKIE["AURSID"]);
22 } else {
23 $atype = "";
26 # Grab the list of Package IDs to be operated on
27 $ids = array();
28 if (isset($_POST['IDs'])) {
29 foreach ($_POST['IDs'] as $id => $i) {
30 $id = intval($id);
31 if ($id > 0) {
32 $ids[] = $id;
37 # Determine what action to do
38 $output = "";
39 if (current_action("do_Flag")) {
40 $output = pkg_flag($atype, $ids, true);
41 } elseif (current_action("do_UnFlag")) {
42 $output = pkg_flag($atype, $ids, False);
43 } elseif (current_action("do_Adopt")) {
44 $output = pkg_adopt($atype, $ids, true);
45 } elseif (current_action("do_Disown")) {
46 $output = pkg_adopt($atype, $ids, False);
47 } elseif (current_action("do_Vote")) {
48 $output = pkg_vote($atype, $ids, true);
49 } elseif (current_action("do_UnVote")) {
50 $output = pkg_vote($atype, $ids, False);
51 } elseif (current_action("do_Delete")) {
52 if (isset($_POST['confirm_Delete'])) {
53 if (!isset($_POST['merge_Into']) || empty($_POST['merge_Into'])) {
54 $output = pkg_delete($atype, $ids, NULL);
55 unset($_GET['ID']);
57 else {
58 $mergepkgid = pkgid_from_name($_POST['merge_Into']);
59 if ($mergepkgid) {
60 $output = pkg_delete($atype, $ids, $mergepkgid);
61 unset($_GET['ID']);
63 else {
64 $output = __("Cannot find package to merge votes and comments into.");
68 else {
69 $output = __("The selected packages have not been deleted, check the confirmation checkbox.");
71 } elseif (current_action("do_Notify")) {
72 $output = pkg_notify($atype, $ids);
73 } elseif (current_action("do_UnNotify")) {
74 $output = pkg_notify($atype, $ids, False);
75 } elseif (current_action("do_DeleteComment")) {
76 $output = pkg_delete_comment($atype);
77 } elseif (current_action("do_ChangeCategory")) {
78 $output = pkg_change_category($atype);
81 html_header($title);
84 <?php if ($output): ?>
85 <p class="pkgoutput"><?php print $output ?></p>
86 <?php endif; ?>
88 <?php
89 if (isset($_GET['ID'])) {
90 include('pkg_search_form.php');
91 if (!$_GET['ID'] = intval($_GET['ID'])) {
92 print __("Error trying to retrieve package details.")."<br />\n";
93 } else {
94 if (isset($_COOKIE["AURSID"])) {
95 package_details($_GET['ID'], $_COOKIE["AURSID"]);
97 else {
98 package_details($_GET['ID'], null);
101 } else {
102 if (!isset($_GET['K']) && !isset($_GET['SB'])) {
103 $_GET['SB'] = 'v';
104 $_GET['SO'] = 'd';
106 if (isset($_COOKIE["AURSID"])) {
107 pkg_search_page($_COOKIE["AURSID"]);
108 } else {
109 pkg_search_page();
113 html_footer(AUR_VERSION);