Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/packages/index.php
blob: ba783f9545de0f83094300025d9ef3fe7061d1e8 (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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
<!DOCTYPE html>

<?php

  foreach (array("bugs","sort") as $expected_param)
    if (! isset($_GET[$expected_param]))
      $_GET[$expected_param] = "";

?>

<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>Arch Linux 32 - Package Search</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" />
</head>
<body class="">
    <div id="archnavbar" class="anb-packages">
        <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://packages.archlinux32.org/">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">
        
<div id="pkglist-search" class="box filter-criteria">
    <h2>Package Search</h2>

    <form id="pkg-search" method="get" action="/">
        <p><input id="id_sort" name="sort" type="hidden" /></p>
        
        <fieldset>
            <legend>Enter search criteria</legend>
            <div>
                <label for="id_arch" title="Limit results to a specific CPU architecture">
                    Arch</label><select multiple="multiple" id="id_arch" name="arch">
<?php

$mysql = new mysqli("localhost", "webserver", "empty", "buildmaster");
if ($mysql->connect_error) {
  die("Connection failed: " . $mysql->connect_error);
}

if (! $result = $mysql -> query(
  "SELECT `name` FROM `architectures` ORDER BY `name`"
  ))
  die ($mysql -> error);

while ($row = $result -> fetch_assoc()) {
  $archs[$row["name"]] = $row["name"];
  print "<option value=\"" . $row["name"] . "\"";
  if (strpos("&".$_SERVER["QUERY_STRING"]."&", "&arch=".$row["name"]."&") !== false)
    print " selected=\"selected\"";
  print ">" . $row["name"] . "</option>\n";
}
?>
</select></div>
            <div>
                <label for="id_repo" title="Limit results to a specific respository">
                    Repository</label><select multiple="multiple" id="id_repo" name="repo">
<?php
if (! $result = $mysql -> query(
  "SELECT `name` FROM `repositories` WHERE `is_on_master_mirror` ORDER BY `stability`,`name`"
  ))
  die ($mysql -> error);

while ($row = $result -> fetch_assoc()) {
  $repos[$row["name"]] = $row["name"];
  print "<option value=\"" . $row["name"] . "\"";
  if (strpos("&".$_SERVER["QUERY_STRING"]."&", "&repo=".$row["name"]."&") !== false)
    print " selected=\"selected\"";
  print ">" . $row["name"] . "</option>\n";
}
?>
</select></div>
            <div>
                <label for="id_q" title="Enter keywords as desired">
                    Keywords</label><input id="id_q" name="q" size="30" type="text" <?php
if (isset($_GET["q"]))
  print "value=\"".$_GET["q"]."\"";
?>/></div>
            <div>
                <label for="id_bugs" title="Limit results based on bug-tracker status">
                    Bugs</label><select id="id_bugs" name="bugs">
<?php
  $bugs_drop_down = array("All", "Bugs", "No Bugs");
  foreach ($bugs_drop_down as $label) {
    print "<option value=\"";
    if ($label != "All")
      print $label;
    print "\"";
    if ($_GET["bugs"]==$label)
      print " selected=\"selected\"";
    print ">" . $label . "</option>\n";
  }
?>
</select></div>
            <div ><label>&nbsp;</label><input title="Search for packages using this criteria"
                type="submit" value="Search" /></div>
        </fieldset>
    </form>
</div>



<div id="pkglist-results" class="box">
    
<?php

  $sorts = array(
    "arch" => array(
      "title" => "architecture",
      "label" => "Arch",
      "mysql" => "`architectures`.`name`"
    ),
    "repo" => array(
      "title" => "repository",
      "label" => "Repo",
      "mysql" => "`repositories`.`name`"
    ),
    "pkgname" => array(
      "title" => "package name",
      "label" => "Name",
      "mysql" => "`binary_packages`.`pkgname`"
    ),
    "pkgver" => array(
      "title" => "package version",
      "label" => "Version",
      "mysql" => "CONCAT(`binary_packages`.`epoch`,\":\",`binary_packages`.`pkgver`,\"-\",`binary_packages`.`pkgrel`,\".\",`binary_packages`.`sub_pkgrel`)"
    ),
    "bugs" => array(
      "title" => "bug status",
      "label" => "Bugs",
      "mysql" => "NOT `binary_packages`.`has_issues`"
    )
  );


$filter = " WHERE 1";
if (isset($_GET["arch"])) {
  $filter .= " AND `architectures`.`name` IN (";
  foreach ($archs as $arch)
    if (strpos("&".$_SERVER["QUERY_STRING"]."&", "&arch=".$arch."&") !== false)
      $filter .= "\"" . $arch . "\",";
  $filter .= "\"\")";
}
if (isset($_GET["repo"])) {
  $filter .= " AND `repositories`.`name` IN (";
  foreach ($repos as $repo)
    if (strpos("&".$_SERVER["QUERY_STRING"]."&", "&repo=".$repo."&") !== false)
      $filter .= "\"" . $repo . "\",";
  $filter .= "\"\")";
}
if (isset($_GET["q"]))
  $filter .= " AND `binary_packages`.`pkgname` LIKE from_base64(\"".base64_encode("%".$_GET["q"]."%")."\")";
if ($_GET["bugs"] == "Bugs")
  $filter .= " AND `binary_packages`.`has_issues`";
if ($_GET["bugs"] == "No Bugs")
  $filter .= " AND NOT `binary_packages`.`has_issues`";

$query = " FROM `binary_packages`" .
  " JOIN `architectures` ON `architectures`.`id`=`binary_packages`.`architecture`" .
  " JOIN `repositories` ON `repositories`.`id`=`binary_packages`.`repository`" .
  " AND `repositories`.`is_on_master_mirror`" .
  $filter .
  " ORDER BY ";

if (isset($_GET["sort"])) {
  if (isset($sorts[$_GET["sort"]]["mysql"]))
    $query .= $sorts[$_GET["sort"]]["mysql"] . ",";
  elseif (isset($sorts[substr($_GET["sort"],1)]["mysql"]))
    $query .= $sorts[substr($_GET["sort"],1)]["mysql"] . " DESC,";
}

$query .= "`binary_packages`.`pkgname`,`repositories`.`stability`,`repositories`.`name`,`architectures`.`name`";

if (! $result = $mysql -> query(
  "SELECT COUNT(1)" . $query
  ))
  die ($mysql -> error);

  $num_results = implode($result -> fetch_assoc());

  $pages = max(ceil($num_results / 100), 1);
  if (isset($_GET["page"]))
    $page = max(min($_GET["page"]+0, $pages),1);
  else
    $page = 1;

if (! $result = $mysql -> query(
  "SELECT " .
  "`binary_packages`.`pkgname`," .
  "`repositories`.`name` AS `repo`," .
  "`architectures`.`name` AS `arch`," .
  "CONCAT(IF(`binary_packages`.`epoch`=\"0\",\"\",CONCAT(`binary_packages`.`epoch`,\":\"))," .
  "`binary_packages`.`pkgver`,\"-\"," .
  "`binary_packages`.`pkgrel`,\".\"," .
  "`binary_packages`.`sub_pkgrel`) AS `version`," .
  "IF(`binary_packages`.`has_issues`,1,0) AS `has_issues`" .
  $query .
  " LIMIT " . (($page-1)*100) . ", 100"
  ))
  die ($mysql -> error);


  function header_and_footer() {

    global $page, $pages, $num_results;

    print "<div class=\"pkglist-stats\">\n";

    print "<p>" . $num_results . " matching package";
    if ($num_results != 1)
      print "s";
    print " found.\n";

    if ($pages != 1) {
      print "Page " . $page . " of " . $pages . ".</p>\n";

      print "<div class=\"pkglist-nav\">\n";
      print "<span class=\"prev\">\n";

      if ($page > 1) {
        print "<a href=\"?";
        print substr(str_replace(
          "&page=".$page."&",
          "&",
          "&".$_SERVER["QUERY_STRING"]."&"
        ),1)."page=".($page-1);
        print "\" title=\"Go to previous page\">";
      };
      print "&lt; Prev";
      if ($page > 1)
        print "</a>";
      print "</span>\n";
      print "<span class=\"next\">\n";

      if ($page < $pages) {
        print "<a href=\"?";
        print substr(str_replace(
          "&page=".$page."&",
          "&",
          "&".$_SERVER["QUERY_STRING"]."&"
        ),1)."page=".($page+1);
        print "\" title=\"Go to next page\">";
      };
      print "Next &gt;";
      if ($page < $pages)
        print "</a>";
      print "</span>\n";
      print "</div>\n";
    };
    print "</div>\n";

  };

  header_and_footer();

?>

<table class="results">
    <thead>
        <tr>
<?php

  foreach ($sorts as $get => $sort) {
    print "<th><a href=\"/?";
    print substr(str_replace(
      "&sort=".$_GET["sort"]."&",
      "&",
      "&".$_SERVER["QUERY_STRING"]."&"
    ),1)."sort=";
    if ($_GET["sort"] == $get)
      print "-";
    print $get."\" ";
    print " title=\"Sort package by ".$sort["title"]."\">".$sort["label"]."</a></th>\n";
  }
?>
        </tr>
    </thead>
    <tbody>
<?php

  $oddity="odd";
  while ($row = $result -> fetch_assoc()) {
    print "<tr class=\"" . $oddity . "\">\n";
    print "<td>" . $row["arch"] . "</td>\n";
    print "<td>" . $row["repo"] . "</td>\n";
    print "<td><a href=\"/" . $row["repo"] . "/" . $row["arch"] . "/" . $row["pkgname"] ."/\" ";
    print "title=\"View package details for " . $row["pkgname"] . "\">" . $row["pkgname"] ."</a></td>\n";
    print "<td>" . $row["version"] . "</td>\n";
    print "<td>";
    if ($row["has_issues"])
      print "has open bug reports";
    else
      print "&nbsp;";
    print "</td>\n";
    print "</tr>\n";
    if ($oddity == "odd" )
      $oddity = "even";
    else
      $oddity = "odd";
  }

?>                
    </tbody>
</table>

<?php

  header_and_footer();

?>

<div id="pkglist-about" class="box">
    <p>Can't find what you are looking for? Try searching again
    using different criteria, or try
    searching the <a href="https://aur.archlinux.org/">AUR</a>
    to see if the package can be found there.</p>

    <p>You are browsing the Arch Linux 32 package database. From here you can find
    detailed information about packages located in the 32 bit repositories.</p>
</div>

        <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>.</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>