forked from macports/macports-www
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ports.php
40 lines (35 loc) · 1.03 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
<?php
include("includes/common.inc");
$by = isset($_GET['by']) ? $_GET['by'] : '';
$substr = isset($_GET['substr']) ? $_GET['substr'] : '';
$seeother = false;
$newurl = $portdb_url;
switch ($by) {
case 'name':
case 'library':
$newurl .= '?search=' . rawurlencode($substr) . '&search_by=name';
break;
case 'category':
$newurl .= 'ports/category/' . 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 .= 'ports/variant/' . 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();
?>