Browse code

Get rid of /public_html/ system

Jenga Phoenix authored on 2019-02-14 15:39:29
Showing 48 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,4 @@
1
+<FilesMatch ".*\.txt$">
2
+Order Allow,Deny
3
+Deny from all
4
+</FilesMatch>
... ...
@@ -16,7 +16,12 @@ matter).
16 16
 Then, create two directories-- "p/" and "u/"-- that are accessible and
17 17
 modifiable by your web-server user.
18 18
 Finally, make a "res/config.php" file (from "res/config.example.php").
19
-Then, profit!
19
+
20
+If you're using a web-server that supports .htaccess files (Apache and the
21
+ilk), then you should be good from here. Otherwise, you should manually block
22
+the files referenced in "/.htaccess" and "res/.htaccess"-- for sample config
23
+of Lighttpd, read "docs/lighttpd.txt".
24
+
20 25
 
21 26
 
22 27
 ----------------------------------------
23 28
similarity index 65%
24 29
rename from public_html/coin.php
25 30
rename to coin.php
... ...
@@ -1,6 +1,6 @@
1 1
 <?php
2
-include("../resources/config.php");
3
-include("../resources/library/main.php");
2
+include("res/config.php");
3
+include("res/library/main.php");
4 4
 
5 5
 create_page("insert " . strtolower($GLOBALS["file_beam_item"]), "coin/beam.php",
6 6
 		$GLOBALS["file_beam_alt"], $GLOBALS["file_beam_img"]);
7 7
new file mode 100644
... ...
@@ -0,0 +1,14 @@
1
+Since Lighttpd doesn't support .htaccess files, you'll need to manually
2
+restrict access to some files.
3
+You can use "mod_redirect" like so:
4
+
5
+	url.redirect = (
6
+		"^/README.txt$"  => "https://HOSTNAME/",
7
+		"^/COPYING.txt$"  => "https://HOSTNAME/",
8
+		"^/res/config.*$"  => "https://HOSTNAME/",
9
+		"^/res/library.*$"  => "https://HOSTNAME/",
10
+		"^/res/templates.*$"  => "https://HOSTNAME/"
11
+	)
12
+
13
+... just make sure to change HOSTNAME to your actual hostname, and to change
14
+"^/" to whatever the root to your insert-coin instance is.
0 15
similarity index 100%
1 16
rename from public_html/index.php
2 17
rename to index.php
3 18
similarity index 67%
4 19
rename from public_html/mask.php
5 20
rename to mask.php
... ...
@@ -1,6 +1,6 @@
1 1
 <?php
2
-include("../resources/config.php");
3
-include("../resources/library/main.php");
2
+include("res/config.php");
3
+include("res/library/main.php");
4 4
 
5 5
 create_page("create " . strtolower($GLOBALS["url_aliasize_item"]),
6 6
 		"mask/create.php", $GLOBALS["url_aliasize_alt"],
7 7
similarity index 92%
8 8
rename from public_html/private/beam.php
9 9
rename to private/beam.php
... ...
@@ -1,6 +1,6 @@
1 1
 <?php 
2
-include("../../resources/config.php");
3
-include("../../resources/library/main.php");
2
+include("../res/config.php");
3
+include("../res/library/main.php");
4 4
 
5 5
 $file_name = $_FILES["uploadcoin"]["name"];
6 6
 $file_ext = file_extension($file_name);
7 7
similarity index 91%
8 8
rename from public_html/private/create.php
9 9
rename to private/create.php
... ...
@@ -1,7 +1,7 @@
1 1
 <?php 
2 2
 
3
-include("../../resources/config.php");
4
-include("../../resources/library/main.php");
3
+include("../res/config.php");
4
+include("../res/library/main.php");
5 5
 
6 6
 
7 7
 $url_target = $_POST["url_target"];
8 8
similarity index 100%
9 9
rename from resources/config.example.php
10 10
rename to res/config.example.php
11 11
similarity index 100%
12 12
rename from public_html/res/css/style.css
13 13
rename to res/css/style.css
14 14
similarity index 100%
15 15
rename from public_html/res/img/coin-big.png
16 16
rename to res/img/coin-big.png
17 17
similarity index 100%
18 18
rename from public_html/res/img/coin.png
19 19
rename to res/img/coin.png
20 20
similarity index 100%
21 21
rename from public_html/res/img/coin_die-big.png
22 22
rename to res/img/coin_die-big.png
23 23
similarity index 100%
24 24
rename from public_html/res/img/coin_die.png
25 25
rename to res/img/coin_die.png
26 26
similarity index 100%
27 27
rename from public_html/res/img/coin_win-big.png
28 28
rename to res/img/coin_win-big.png
29 29
similarity index 100%
30 30
rename from public_html/res/img/coin_win.png
31 31
rename to res/img/coin_win.png
32 32
similarity index 100%
33 33
rename from public_html/res/img/logo.png
34 34
rename to res/img/logo.png
35 35
similarity index 100%
36 36
rename from public_html/res/img/mask-big.png
37 37
rename to res/img/mask-big.png
38 38
similarity index 100%
39 39
rename from public_html/res/img/mask.png
40 40
rename to res/img/mask.png
41 41
similarity index 100%
42 42
rename from public_html/res/img/mask_die-big.png
43 43
rename to res/img/mask_die-big.png
44 44
similarity index 100%
45 45
rename from public_html/res/img/mask_die.png
46 46
rename to res/img/mask_die.png
47 47
similarity index 100%
48 48
rename from public_html/res/img/mask_win-big.png
49 49
rename to res/img/mask_win-big.png
50 50
similarity index 100%
51 51
rename from public_html/res/img/mask_win.png
52 52
rename to res/img/mask_win.png
53 53
similarity index 100%
54 54
rename from public_html/res/img/war_duck.png
55 55
rename to res/img/war_duck.png
56 56
similarity index 100%
57 57
rename from resources/library/array.php
58 58
rename to res/library/array.php
59 59
similarity index 100%
60 60
rename from resources/library/file.php
61 61
rename to res/library/file.php
62 62
similarity index 53%
63 63
rename from resources/library/insert-coin.php
64 64
rename to res/library/insert-coin.php
... ...
@@ -2,21 +2,21 @@
2 2
 
3 3
 // TITLE_STING TEMPLATE_PATH IMAGE_ALT IMAGE_PATH --> HTML
4 4
 //	Create a general insert-coin webpage; relative path from rootdir 
5
-//	for $image_path, and relative path from /resources/templates/
5
+//	for $image_path, and relative path from /res/templates/
6 6
 //	for $template
7 7
 function create_page($page_title, $template, $image_alt_text, $image_path)
8 8
 {
9
-	include(root("resources/templates/header.php"));
9
+	include(root("res/templates/header.php"));
10 10
 	?><body><?php
11
-	include(root("resources/templates/menu.php"));
11
+	include(root("res/templates/menu.php"));
12 12
 	?><main><?php
13
-	include(root("resources/templates/" . $template));
13
+	include(root("res/templates/" . $template));
14 14
 	?>
15 15
 	<img
16 16
 		alt="<?php echo($image_alt_text); ?>"
17
-		src="<?php echo($image_path); ?>">
17
+		src="<?php echo(root($image_path)); ?>">
18 18
 	</main> <?php
19
-	include(root("resources/templates/footer.php"));
19
+	include(root("res/templates/footer.php"));
20 20
 	?></body>
21 21
 </html><?php
22 22
 }
23 23
similarity index 62%
24 24
rename from resources/library/main.php
25 25
rename to res/library/main.php
... ...
@@ -18,11 +18,11 @@ function root($path)
18 18
 	return $absolute_path;
19 19
 }
20 20
 
21
-include(root("resources/library/array.php"));
22
-include(root("resources/library/file.php"));
23
-include(root("resources/library/insert-coin.php"));
24
-include(root("resources/library/sanitization.php"));
25
-include(root("resources/library/string.php"));
26
-include(root("resources/library/urls.php"));
21
+include(root("res/library/array.php"));
22
+include(root("res/library/file.php"));
23
+include(root("res/library/insert-coin.php"));
24
+include(root("res/library/sanitization.php"));
25
+include(root("res/library/string.php"));
26
+include(root("res/library/urls.php"));
27 27
 
28 28
 ?>
29 29
similarity index 100%
30 30
rename from resources/library/sanitization.php
31 31
rename to res/library/sanitization.php
32 32
similarity index 100%
33 33
rename from resources/library/string.php
34 34
rename to res/library/string.php
35 35
similarity index 100%
36 36
rename from resources/library/urls.php
37 37
rename to res/library/urls.php
38 38
similarity index 100%
39 39
rename from resources/templates/coin/beam.php
40 40
rename to res/templates/coin/beam.php
41 41
similarity index 100%
42 42
rename from resources/templates/coin/celebrate.php
43 43
rename to res/templates/coin/celebrate.php
44 44
similarity index 100%
45 45
rename from resources/templates/coin/death-1.html
46 46
rename to res/templates/coin/death-1.html
47 47
similarity index 100%
48 48
rename from resources/templates/coin/death-2.html
49 49
rename to res/templates/coin/death-2.html
50 50
similarity index 100%
51 51
rename from resources/templates/coin/death.html
52 52
rename to res/templates/coin/death.html
53 53
similarity index 100%
54 54
rename from resources/templates/footer.php
55 55
rename to res/templates/footer.php
56 56
similarity index 71%
57 57
rename from resources/templates/header.php
58 58
rename to res/templates/header.php
... ...
@@ -8,8 +8,9 @@
8 8
 <link rel="stylesheet" media="screen"
9 9
 	href="https://fontlibrary.org/face/connection" type="text/css"/>
10 10
 
11
-<link rel="stylesheet" type="text/css" href="/res/css/style.css">
12
-<link rel="shortcut icon" href="/res/img/coin.png">
11
+<link rel="stylesheet" type="text/css"
12
+	href="<?php echo root("res/css/style.css") ?>">
13
+<link rel="shortcut icon" href="<?php echo root("res/img/coin.png") ?>">
13 14
 
14 15
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
15 16
 
16 17
similarity index 100%
17 18
rename from resources/templates/mask/celebrate.php
18 19
rename to res/templates/mask/celebrate.php
19 20
similarity index 100%
20 21
rename from resources/templates/mask/create.php
21 22
rename to res/templates/mask/create.php
22 23
similarity index 100%
23 24
rename from resources/templates/mask/death-1.html
24 25
rename to res/templates/mask/death-1.html
25 26
similarity index 100%
26 27
rename from resources/templates/mask/death-2.php
27 28
rename to res/templates/mask/death-2.php
28 29
similarity index 100%
29 30
rename from resources/templates/mask/death-3.html
30 31
rename to res/templates/mask/death-3.html
31 32
similarity index 100%
32 33
rename from resources/templates/mask/death.html
33 34
rename to res/templates/mask/death.html
34 35
new file mode 100644
... ...
@@ -0,0 +1,11 @@
1
+<div class="menu top-menu">
2
+	<h2><a href="/"><?php echo($GLOBALS["site_name"]); ?></a>
3
+		<img id="duck"
4
+			src="<?php echo root("/res/img/war_duck.png") ?>"
5
+			alt="Warduck lives!">
6
+	</h2>
7
+	<ul>
8
+		<li><a href="<?php echo root("coin.php"); ?>">file-beamer</a></li>
9
+		<li><a href="<?php echo root("mask.php") ?>">url-shortener</a></li>
10
+	</ul>
11
+</div>
0 12
deleted file mode 100644
... ...
@@ -1,9 +0,0 @@
1
-<div class="menu top-menu">
2
-	<h2><a href="/"><?php echo($GLOBALS["site_name"]); ?></a>
3
-		<img id="duck" src="/res/img/war_duck.png" alt="Warduck lives!">
4
-	</h2>
5
-	<ul>
6
-		<li><a href="/coin.php">file-beamer</a></li>
7
-		<li><a href="/mask.php">url-shortener</a></li>
8
-	</ul>
9
-</div>
10 0
similarity index 90%
11 1
rename from public_html/result/beam.php
12 2
rename to result/beam.php
... ...
@@ -1,6 +1,6 @@
1 1
 <?php
2
-include("../../resources/config.php");
3
-include("../../resources/library/main.php");
2
+include("../res/config.php");
3
+include("../res/library/main.php");
4 4
 
5 5
 $item = strtolower($GLOBALS["file_beam_item"]);
6 6
 
7 7
similarity index 92%
8 8
rename from public_html/result/create.php
9 9
rename to result/create.php
... ...
@@ -1,6 +1,6 @@
1 1
 <?php
2
-include("../../resources/config.php");
3
-include("../../resources/library/main.php");
2
+include("../res/config.php");
3
+include("../res/library/main.php");
4 4
 
5 5
 $item = strtolower($GLOBALS["url_aliasize_item"]);
6 6