Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/groups.php
blob: c3bd77889e64e33936bae3697aebb6cbc3c3bb67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php

require_once "init.php";

require_once BASE . "/lib/style.php";
require_once BASE . "/lib/mysql.php";

$uri_parts = explode('/', $_SERVER['REQUEST_URI']);

if ($uri_parts[0] != '' || $uri_parts[1] != 'groups')
  throw_http_error(422, 'Unprocessable Entity');

$options = '';

$last = array_pop($uri_parts);
if (substr($last, 0, 1) == '?') {
  $options = $last;
  $last = array_pop($uri_parts);
}
if ($last != '')
  array_push($uri_parts, $last);

array_splice(
  $uri_parts,
  0, 2
);

$arch_filter = '1';
if (count($uri_parts) != 0) {
  $repo_arch = $uri_parts[0];
  $arch_filter = '`r_a`.`name`=from_base64("' . base64_encode($repo_arch) . '")';
  array_splice(
    $uri_parts,
    0, 1
  );
}

if (count($uri_parts) == 0) {
  // TODO: display overwiev
  print 'Good so far, but the rest is yet to be implemented.';

  die();
  print_header('Package Groups');
}

if (count($uri_parts) != 1)
  throw_http_error(422, 'Unprocessable Entity');

$group = $uri_parts[0];
$group_filter = '`install_targets`.`name`=from_base64("' . base64_encode($group) . '")';

$packages = query_package_listing(
  mysql_join_binary_packages_install_target_providers() .
  mysql_join_install_target_providers_install_targets() .
  ' WHERE ' . $arch_filter .
  ' AND ' . $group_filter,
  '',
  array(),
  false,
  true
);

if (count($packages) == 0)
  throw_http_error(404, 'Not Found');

print_header('Group Details');

print "      <div class=\"box\">\n";
print "        <h2>\n";
print "          Group Details - " . $group . " (" . $repo_arch . ")\n";
print "        </h2>\n";
print "        <p>" . count($packages) . " packages found.</p>\n";
print "        <table class=\"results\">\n";
print "          <thead>\n";
print "            <tr>\n";
foreach ($sorts as $sort) {
  print "              <th>\n";
  print "                " . $sort['label'] . "\n";
  print "              </th>\n";
}
print "            </tr>\n";
print "          </thead>\n";
print "          <tbody>\n";

print_package_listing($packages, true);

print_footer();