-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
ports.php
41 lines (36 loc) · 1.12 KB
/
ports.php
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
<?php
include("includes/common.inc");
$by = isset($_GET['by']) ? $_GET['by'] : '';
$substr = isset($_GET['substr']) ? $_GET['substr'] : '';
$seeother = false;
// URL for "All Ports" page [ports.macports.org/search/]
$newurl = $portdb_url . 'search/';
switch ($by) {
case 'name':
case 'library':
$newurl .= '?q=' . rawurlencode($substr) . '&name=on';
break;
case 'category':
$newurl .= '?selected_facets=categories_exact:' . rawurlencode($substr);
break;
case 'maintainer':
/* ports.macports.org only groups by GitHub user, probably not worth
* the effort to save those */
$seeother = true;
break;
case 'variant':
$newurl .= '?selected_facets=variants_exact:' . rawurlencode($substr);
break;
case 'platform':
/* ports.macports.org does not allow searching by platform. */
$seeother = true;
break;
case 'all':
case '':
// do nothing, $newurl and $seeother already set
break;
}
/* 301 Moved Permanently, 303 See Other */
header('Location: ' . $newurl, true, $seeother ? 303 : 301);
exit();
?>