Browse code

Smooth out remnants of public_html

Jenga Phoenix authored on 2019-02-15 01:20:06
Showing 13 changed files
... ...
@@ -13,7 +13,7 @@ if (!empty($_POST["desired_filename"])) {
13 13
 $file_name = sanitize_filename($file_name);
14 14
 
15 15
 $dest_name = $GLOBALS["file_beam_dir"] . $file_name;
16
-$dest_file = root("public_html/" . $dest_name);
16
+$dest_file = root("/" . $dest_name);
17 17
 
18 18
 
19 19
 
... ...
@@ -11,7 +11,7 @@ $visible_name = $url_alias . $GLOBALS["url_aliasize_visible_suffix"];
11 11
 $visible_dest = $GLOBALS["url_aliasize_dir"] . $visible_name;
12 12
 $dest_name = $GLOBALS["url_aliasize_dir"] . $url_alias
13 13
 		. $GLOBALS["url_aliasize_suffix"];
14
-$dest_file = root("public_html/" . $dest_name);
14
+$dest_file = root("/" . $dest_name);
15 15
 
16 16
 
17 17
 switch (true) {
18 18
deleted file mode 100644
19 19
Binary files a/public_html/private/.create.php.swp and /dev/null differ
... ...
@@ -4,18 +4,22 @@
4 4
 // This file contains some global configuration you might wanna do
5 5
 //
6 6
 
7
-$site_name = "insert-coin";	// what the site will be called
8
-$root_name = "insert-coin";	// the directory containing this instance
7
+$site_name = "insert-coin";      	// what the site will be called
8
+
9
+$root = "/srv/www/htdocs/insert-coin";	// the absolute path of this instance
10
+$webroot = "/insert-coin/"       	// path of instance relative to
11
+					// web-root (I.E., how it looks in
12
+					// the URL without the hostname)
9 13
 
10 14
 
11 15
 
12 16
 // vars related to URL shortening
13 17
 
14
-$url_aliasize_img = "/res/img/mask-big.png";
18
+$url_aliasize_img = "res/img/mask-big.png";
15 19
 $url_aliasize_alt = "A mask, floating in mid-air.";
16
-$url_aliasize_win_img = "/res/img/mask_win-big.png";
20
+$url_aliasize_win_img = "res/img/mask_win-big.png";
17 21
 $url_aliasize_win_alt = "A whimsical mask sparkling.";
18
-$url_aliasize_die_img = "/res/img/mask_die-big.png";
22
+$url_aliasize_die_img = "res/img/mask_die-big.png";
19 23
 $url_aliasize_die_alt = "A whimsical mask on fire.";
20 24
 
21 25
 $url_aliasize_item = "mask";	// what the alias is affectionately called
... ...
@@ -29,11 +33,11 @@ $url_aliasize_suffix = ".php";	// actual suffix in redirect links
29 33
 
30 34
 // vars related to file uploading
31 35
 
32
-$file_beam_img = "/res/img/coin-big.png";
36
+$file_beam_img = "res/img/coin-big.png";
33 37
 $file_beam_alt = "A big & yellow coin lying before a coin-slot";
34
-$file_beam_win_img = "/res/img/coin_win-big.png";
38
+$file_beam_win_img = "res/img/coin_win-big.png";
35 39
 $file_beam_win_alt = "A coin inserted into a coin slot.";
36
-$file_beam_die_img = "/res/img/coin_die-big.png";
40
+$file_beam_die_img = "res/img/coin_die-big.png";
37 41
 $file_beam_die_alt = "A coin on fire.";
38 42
 
39 43
 $file_beam_item = "coin";	// what the file is affectionately called
... ...
@@ -14,7 +14,7 @@ function create_page($page_title, $template, $image_alt_text, $image_path)
14 14
 	?>
15 15
 	<img
16 16
 		alt="<?php echo($image_alt_text); ?>"
17
-		src="<?php echo(root($image_path)); ?>">
17
+		src="<?php echo(webroot($image_path)); ?>">
18 18
 	</main> <?php
19 19
 	include(root("res/templates/footer.php"));
20 20
 	?></body>
... ...
@@ -18,6 +18,13 @@ function root($path)
18 18
 	return $absolute_path;
19 19
 }
20 20
 
21
+// PATH_RELATIVE_TO_PROJECT_ROOT --> PATH_RELATIVE_TO_WEB_ROOT
22
+//	Return the absolute path to something within the project's root.
23
+function webroot($path)
24
+{
25
+	return $GLOBALS['webroot'] . $path;
26
+}
27
+
21 28
 include(root("res/library/array.php"));
22 29
 include(root("res/library/file.php"));
23 30
 include(root("res/library/insert-coin.php"));
24 31
new file mode 100644
... ...
@@ -0,0 +1,6 @@
1
+<?php
2
+
3
+include("../config.php");
4
+include("main.php");
5
+
6
+echo(valid_url("htt/coinsh.red/hello.php"));
... ...
@@ -48,8 +48,7 @@ function make_url($path)
48 48
 {
49 49
         $url = protocol()
50 50
                 . $_SERVER['HTTP_HOST']
51
-                . "/"
52
-                . $path;
51
+                . webroot($path);
53 52
 
54 53
         return $url;
55 54
 }
... ...
@@ -1,4 +1,5 @@
1
-<form action="private/beam.php" method="post" enctype="multipart/form-data">
1
+<form action="<?php echo webroot("private/beam.php")?>"
2
+		method="post" enctype="multipart/form-data">
2 3
 	<p>
3 4
         	<input type="text" placeholder="Filename (Blank for uploaded name)" 
4 5
 			name="desired_filename" class="basic-text">
... ...
@@ -10,7 +10,7 @@
10 10
 			<li><a href="https://libregamenight.xyz">lgn</a></li>
11 11
 			<li><a href="https://fsf.org">fsf</a></li>
12 12
 			<li><a href="https://eunichx.us">eunichx</a></li>
13
-			<li><a href="http://coinsh.red/rse/img/war_duck.png">
13
+			<li><a href="http://4wxnumwn5zljjkyi.onion/">
14 14
 				onion</a></li>
15 15
 			<li><b><a href="https://git.eunichx.us/insert-coin.git">
16 16
 				source-code</a></b></li>
... ...
@@ -9,8 +9,8 @@
9 9
 	href="https://fontlibrary.org/face/connection" type="text/css"/>
10 10
 
11 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") ?>">
12
+	href="<?php echo webroot("res/css/style.css") ?>">
13
+<link rel="shortcut icon" href="<?php echo webroot("res/img/coin.png") ?>">
14 14
 
15 15
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
16 16
 
... ...
@@ -1,4 +1,5 @@
1
-<form action="private/create.php" method="post" enctype="multipart/form-data">
1
+<form action="<?php echo webroot("private/create.php")?>"
2
+		method="post" enctype="multipart/form-data">
2 3
 	<p>
3 4
         	<input type="text" placeholder="URL"
4 5
 			name="url_target" class="basic-text">
... ...
@@ -1,11 +1,15 @@
1 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") ?>"
2
+	<h2>	<a href="<?php echo webroot(""); ?>">
3
+			<?php echo($GLOBALS["site_name"]); ?>
4
+		</a>
5
+		<a href="<?php echo webroot("d"); ?>">
6
+			<img id="duck"
7
+			src="<?php echo webroot("res/img/war_duck.png") ?>"
5 8
 			alt="Warduck lives!">
9
+		</a>
6 10
 	</h2>
7 11
 	<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>
12
+		<li><a href="<?php echo webroot("coin.php"); ?>">file-beamer</a></li>
13
+		<li><a href="<?php echo webroot("mask.php") ?>">url-shortener</a></li>
10 14
 	</ul>
11 15
 </div>