summaryrefslogtreecommitdiff
path: root/lib/style.php
blob: 051a0a52969c550bc42b83853754c76225538629 (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
<?php

if (function_exists("print_header"))
  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        *
 *                                                                    *
 **********************************************************************/

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, $sorts, $print_order_links) {

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

  foreach ($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";
}