Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/style.php
blob: 99d98409b2a0000ae478fae1b322d3241f2dc169 (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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
<?php

if (isset($pkglist_sorts))
  return;

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

function print_header($title, $subdir = "packages") {
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>Arch Linux 32<?php
if (!empty($title))
  print " - " . $title;
?></title>
    <link rel="stylesheet" type="text/css" href="/static/archweb.css" media="screen, projection" />
    <link rel="icon" type="image/x-icon" href="/static/favicon.ico" />
    <link rel="shortcut icon" type="image/x-icon" href="/static/favicon.ico" />
    <link rel="stylesheet" type="text/css" href="/static/flags/fam.47411010d402.css" media="screen, projection" />
  </head>
  <body class="">
    <div id="archnavbar" class="anb-<?php print $subdir; ?>">
      <div id="archnavbarlogo">
        <h1><a href="/" title="Return to the main page">Arch Linux</a></h1>
      </div>
      <div id="archnavbarmenu">
        <ul id="archnavbarlist">
          <li id="anb-home"><a href="https://www.archlinux32.org/">Home</a></li>
          <li id="anb-news"><a href="https://news.archlinux32.org/">News</a></li>
          <li id="anb-packages"><a href="https://www.archlinux32.org/packages">Packages</a></li>
          <li id="anb-forums"><a href="https://bbs.archlinux32.org/">Forums</a></li>
          <li id="anb-bugs"><a href="https://bugs.archlinux32.org/" title="Report and track bugs">Bugs</a></li>
          <li id="anb-mailing-list"><a href="https://lists.archlinux.org/listinfo/arch-ports">Mailing List</a></li>
          <li id="anb-download"><a href="https://www.archlinux32.org/download/" title="Get Arch Linux">Download</a></li>
          <li id="anb-arch-linux-official"><a href="https://www.archlinux.org/">Arch Linux Official</a></li>
        </ul>
      </div>
    </div>
    <div id="content">
<?php
  show_warning_on_offline_slave();
}

function print_footer() {
?>
      <div id="footer">
        <p>
          Copyright © 2002-2018 <a href="mailto:jvinet@zeroflux.org" title="Contact Judd Vinet">Judd Vinet</a> and <a href="mailto:aaron@archlinux.org" title="Contact Aaron Griffin">Aaron Griffin</a>.
          Copyright © 2018 <a href="mailto:arch@eckner.net" title="Contact Erich Eckner">Erich Eckner</a>.
        </p>
        <p>
          The Arch Linux name and logo are recognized <a href="https://wiki.archlinux.org/index.php/DeveloperWiki:TrademarkPolicy" title="Arch Linux Trademark Policy">trademarks</a>. Some rights reserved.
        </p>
        <p>
          The registered trademark Linux® is used pursuant to a sublicense from LMI, the exclusive licensee of Linus Torvalds, owner of the mark on a world-wide basis.
        </p>
      </div>
    </div>
    <script type="application/ld+json">
      {
        "@context": "http://schema.org",
        "@type": "WebSite",
        "url": "/",
        "potentialAction": {
          "@type": "SearchAction",
          "target": "/?q={search_term}",
          "query-input": "required name=search_term"
        }
      }
    </script>
  </body>
</html>
<?php
}

/**********************************************************************
 *                                                                    *
 * Functions for generating and diplaying listings of packages        *
 *                                                                    *
 **********************************************************************/

$pkglist_sorts = array(
  "arch" => array(
    "title" => "architecture",
    "label" => "Arch",
    "mysql" => "`architectures`.`name`"
  ),
  "repo" => array(
    "title" => "repository",
    "label" => "Repo",
    "mysql" => "CONCAT(`r_a`.`name`,\"/\",`repositories`.`name`)"
  ),
  "pkgname" => array(
    "title" => "package name",
    "label" => "Name",
    "mysql" => "`binary_packages`.`pkgname`"
  ),
  "pkgver" => array(
    "title" => "package version",
    "label" => "Version",
    "mysql" => mysql_query_package_version("binary_packages")
  ),
  "bugs" => array(
    "title" => "bug status",
    "label" => "Bugs",
    "mysql" => "NOT `binary_packages`.`has_issues`"
  ),
  "build_date" => array(
    "title" => "build date",
    "label" => "Build Date",
    "mysql" => "IFNULL(`build_assignments`.`return_date`,\"00-00-0000 00:00:00\")"
  ),
  "move_date" => array(
    "title" => "last update",
    "label" => "Last Updated",
    "mysql" => "IFNULL(`binary_packages_in_repositories`.`last_moved`,\"00-00-0000 00:00:00\")"
  ),
  "del" => array(
    "title" => "to be deleted",
    "label" => "Delete",
    "mysql" => "`binary_packages_in_repositories`.`is_to_be_deleted`"
  )
);

function package_listing_query_order_by() {
  global $pkglist_sorts;
  if (!array_key_exists('sort', $_GET))
    return;
  $criterium = $_GET['sort'];
  if (
    array_key_exists($criterium, $pkglist_sorts) &&
    array_key_exists('mysql', $pkglist_sorts[$criterium])
  )
    return $pkglist_sorts[$criterium]['mysql'] . ',';

  if (substr($criterium, 0, 1) != '-')
    return;
  $criterium = substr($criterium, 1);

  if (
    array_key_exists($criterium, $pkglist_sorts) &&
    array_key_exists('mysql', $pkglist_sorts[$criterium])
  )
    return $pkglist_sorts[$criterium]['mysql'] . ' DESC,';

  return;
}

function query_package_listing($filter_and_order, $float_columns, $count_only) {
  if ($count_only)
    $columns = "COUNT(DISTINCT `binary_packages`.`id`)";
  else
    $columns =
      "DISTINCT " .
      "`binary_packages`.`pkgname`," .
      "`package_sources`.`pkgbase`," .
      "CONCAT(`r_a`.`name`,\"/\",`repositories`.`name`) AS `repo`," .
      "`architectures`.`name` AS `arch`," .
      mysql_query_package_version("binary_packages") .
      " AS `version`," .
      "IF(`binary_packages`.`has_issues`,1,0) AS `has_issues`," .
      "`build_assignments`.`return_date` AS `build_date`," .
      "`binary_packages_in_repositories`.`last_moved` AS `move_date`," .
      "IF(`binary_packages_in_repositories`.`is_to_be_deleted`,1,0) AS `is_to_be_deleted`";

  $result = mysql_run_query(
    "SELECT " .
    $columns .
    " FROM `binary_packages`" .
    mysql_join_binary_packages_architectures() .
    mysql_join_binary_packages_binary_packages_in_repositories() .
    mysql_join_binary_packages_in_repositories_repositories() .
    " AND `repositories`.`is_on_master_mirror`" .
    mysql_join_repositories_architectures("","r_a") .
    mysql_join_binary_packages_build_assignments() .
    mysql_join_build_assignments_package_sources() .
    $filter_and_order
  );
  if ($count_only)
    return implode($result -> fetch_assoc());
  else {
    $return = array();
    while ($row = $result -> fetch_assoc()) {
      foreach ($float_columns as $float_column)
        $row[$float_column] = floatval($row[$float_column]);
      $return[] = $row;
    }
    return $return;
  }
}

function print_package_listing($list, $print_order_links) {

  global $pkglist_sorts;
  print "        <table class=\"results\">\n";
  print "          <thead>\n";
  print "            <tr>\n";

  foreach ($pkglist_sorts as $get => $sort) {
    print "              <th>\n";
    if ($print_order_links) {
      print "                <a href=\"?";
      print
        substr(
          str_replace(
            "&sort=" . $_GET["sort"] . "&",
            "&",
            "&" . $_SERVER["QUERY_STRING"] . "&"
          ),
        1) . "sort=";
      if ($_GET["sort"] == $get)
        print "-";
      print $get . "\" title=\"Sort packages by " . $sort["title"] . "\">" . $sort["label"] . "</a>\n";
    } else
      print "                " . $sort["label"] . "\n";
    print "              </th>\n";
  }

  print "            </tr>\n";
  print "          </thead>\n";
  print "          <tbody>\n";
  $oddity = "odd";
  foreach ($list as $row) {
    print "            <tr class=\"" . $oddity . "\">\n";
    print "              <td>\n";
    print "                " . $row["arch"] . "\n";
    print "              </td>\n";
    print "              <td>\n";
    print "                " . $row["repo"] . "\n";
    print "              </td>\n";
    print "              <td>\n";
    print "                <a href=\"" . $row["repo"] . "/" . $row["pkgname"] ."/\" ";
    print "title=\"View package details for " . $row["pkgname"] . "\">" . $row["pkgname"] . "</a>\n";
    print "              </td>\n";
    print "              <td>\n";
    print "                " . $row["version"] . "\n";
    print "              </td>\n";
    print "              <td>\n";
    print "                ";
    if ($row["has_issues"])
      print "has open bug reports";
    else
      print "&nbsp;";
    print "\n";
    print "              </td>\n";
    print "              <td>\n";
    print "                ";
    if (isset($row["build_date"]))
      print $row["build_date"];
    else
      print "&nbsp;";
    print "\n";
    print "              </td>\n";
    print "              <td>\n";
    print "                ";
    if (isset($row["move_date"]))
      print $row["move_date"];
    else
      print "&nbsp;";
    print "\n";
    print "              </td>\n";
    print "              <td>\n";
    print "                ";
    if ($row["is_to_be_deleted"])
      print "to be deleted";
    else
      print "&nbsp;";
    print "\n";
    print "              </td>\n";
    print "            </tr>\n";
    if ($oddity == "odd" )
      $oddity = "even";
    else
      $oddity = "odd";
  }
  print "          </tbody>\n";
  print "        </table>\n";
}