-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
83 lines (69 loc) · 2.36 KB
/
Copy pathindex.php
File metadata and controls
83 lines (69 loc) · 2.36 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>smolik.xyz CDN</title>
<style>
* {
font-family: "Segoe UI";
font-size: 1.5rem;
background: #222;
color: #ddd;
text-decoration: none;
text-align: center;
}
a {
color: #ab5;
}
body {
margin: 2em;
}
ul,
li,
p {
text-align: left;
}
li {
padding-left: 1em;
list-style-type: none;
}
ul.sub-dir:before {
content: '📁';
}
@media screen and (max-width:800px) and (min-width: 600px) {
* { font-size: 1.3rem }
}
@media screen and (max-width:599px) {
* { font-size: 1.1rem }
}
</style>
</head>
<body>
<h1>smolik.xyz CDN server</h1>
<p>Available endpoints:</p>
<?php
# disable displaying endpoints that shall not be displayed (those should also be disabled via .htaccess)
$invalid_endpoints = array("index.php", ".env", ".", "..", "api", "domains", "subdom", ".htaccess", ".log");
# Lists the content of a directory and all subdirs in <ul> > <li> fashion
function CreateTree($inv_endpoints, $dir, $curr_dirname) {
if ($dir == "./s/")
echo "<ul>";
else
echo "<ul class=\"sub-dir\">" . $curr_dirname;
foreach (scandir($dir) as $file) {
if (!in_array($file, $inv_endpoints)) {
$file_path = $dir . $file;
if (is_dir($file_path))
CreateTree($inv_endpoints, $file_path . "/", $file);
else
echo "<li class=\"is-link\"> <a href=\"" . $dir . $file . "\">" . $file . "</a></li>";
}
}
echo "</ul>";
}
CreateTree($invalid_endpoints, "./s/", "./s/");
?>
</body>
</html>