-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
48 lines (48 loc) · 1.5 KB
/
index.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
42
43
44
45
46
47
48
<?php
//Figure out what protocol the client wanted
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on')
$protocol = "https://";
else
$protocol = "http://";
?>
<html>
<head>
<title>webOS Archive - Docs</title>
<style>
body, html {width: 100%; height: 100%; margin: 0; padding: 0}
.menu-wrapper {position: absolute;top: 0; left: 0; right: 0; height: 45px; }
.second-row {position: absolute; top: 45px; left: 0; right: 0; bottom: 0; }
.second-row iframe {display: block; width: 100%; height: 100%; border: none;}
</style>
<link rel="shortcut icon" href="<?php echo $protocol ?>www.webosarchive.org/favicon.ico">
</head>
<body>
<?php
//Handle reverse proxy redirects
$uri = $_SERVER['REQUEST_URI'];
$usePath = "home/";
if (!isset($_GET["redir"])) {
if (strpos($uri, '?') !== false) {
$uriParts = explode("?", $uri);
$uri = end($uriParts);
$uri = str_replace("/docs/", "", $uri);
if (!isset($uri) || $uri == "" || $uri == "/") {
$uri = "home";
}
$uri = str_replace("//", "/", $uri);
$usePath = $protocol . $_SERVER['HTTP_HOST'] . "/" . urldecode($uri);
}
}
?>
<?php
if ($uri == "community") {
echo file_get_contents($protocol . "www.webosarchive.org/menu.php?content=community");
} else {
echo file_get_contents($protocol . "www.webosarchive.org/menu.php?content=docs");
}
?>
<div class="second-row">
<iframe src="<?PHP echo $usePath ?>" width="100%" height="100%" />
</div>
</body>
</html>