Get rid of /public_html/ system

This commit is contained in:
Jenga Phoenix 2019-02-14 09:39:29 -06:00
parent 5e58a61813
commit 08756e769b
48 changed files with 62 additions and 36 deletions

4
.htaccess Normal file
View File

@ -0,0 +1,4 @@
<FilesMatch ".*\.txt$">
Order Allow,Deny
Deny from all
</FilesMatch>

View File

@ -16,7 +16,12 @@ matter).
Then, create two directories-- "p/" and "u/"-- that are accessible and
modifiable by your web-server user.
Finally, make a "res/config.php" file (from "res/config.example.php").
Then, profit!
If you're using a web-server that supports .htaccess files (Apache and the
ilk), then you should be good from here. Otherwise, you should manually block
the files referenced in "/.htaccess" and "res/.htaccess"-- for sample config
of Lighttpd, read "docs/lighttpd.txt".
----------------------------------------

View File

@ -1,6 +1,6 @@
<?php
include("../resources/config.php");
include("../resources/library/main.php");
include("res/config.php");
include("res/library/main.php");
create_page("insert " . strtolower($GLOBALS["file_beam_item"]), "coin/beam.php",
$GLOBALS["file_beam_alt"], $GLOBALS["file_beam_img"]);

14
docs/lighttpd.txt Normal file
View File

@ -0,0 +1,14 @@
Since Lighttpd doesn't support .htaccess files, you'll need to manually
restrict access to some files.
You can use "mod_redirect" like so:
url.redirect = (
"^/README.txt$" => "https://HOSTNAME/",
"^/COPYING.txt$" => "https://HOSTNAME/",
"^/res/config.*$" => "https://HOSTNAME/",
"^/res/library.*$" => "https://HOSTNAME/",
"^/res/templates.*$" => "https://HOSTNAME/"
)
... just make sure to change HOSTNAME to your actual hostname, and to change
"^/" to whatever the root to your insert-coin instance is.

View File

@ -1,6 +1,6 @@
<?php
include("../resources/config.php");
include("../resources/library/main.php");
include("res/config.php");
include("res/library/main.php");
create_page("create " . strtolower($GLOBALS["url_aliasize_item"]),
"mask/create.php", $GLOBALS["url_aliasize_alt"],

View File

@ -1,6 +1,6 @@
<?php
include("../../resources/config.php");
include("../../resources/library/main.php");
include("../res/config.php");
include("../res/library/main.php");
$file_name = $_FILES["uploadcoin"]["name"];
$file_ext = file_extension($file_name);

View File

@ -1,7 +1,7 @@
<?php
include("../../resources/config.php");
include("../../resources/library/main.php");
include("../res/config.php");
include("../res/library/main.php");
$url_target = $_POST["url_target"];

View File

Before

Width:  |  Height:  |  Size: 963 B

After

Width:  |  Height:  |  Size: 963 B

View File

Before

Width:  |  Height:  |  Size: 442 B

After

Width:  |  Height:  |  Size: 442 B

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 567 B

After

Width:  |  Height:  |  Size: 567 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 482 B

After

Width:  |  Height:  |  Size: 482 B

View File

Before

Width:  |  Height:  |  Size: 890 B

After

Width:  |  Height:  |  Size: 890 B

View File

Before

Width:  |  Height:  |  Size: 619 B

After

Width:  |  Height:  |  Size: 619 B

View File

Before

Width:  |  Height:  |  Size: 251 B

After

Width:  |  Height:  |  Size: 251 B

View File

Before

Width:  |  Height:  |  Size: 799 B

After

Width:  |  Height:  |  Size: 799 B

View File

Before

Width:  |  Height:  |  Size: 344 B

After

Width:  |  Height:  |  Size: 344 B

View File

Before

Width:  |  Height:  |  Size: 764 B

After

Width:  |  Height:  |  Size: 764 B

View File

Before

Width:  |  Height:  |  Size: 277 B

After

Width:  |  Height:  |  Size: 277 B

View File

Before

Width:  |  Height:  |  Size: 254 B

After

Width:  |  Height:  |  Size: 254 B

View File

@ -2,21 +2,21 @@
// TITLE_STING TEMPLATE_PATH IMAGE_ALT IMAGE_PATH --> HTML
// Create a general insert-coin webpage; relative path from rootdir
// for $image_path, and relative path from /resources/templates/
// for $image_path, and relative path from /res/templates/
// for $template
function create_page($page_title, $template, $image_alt_text, $image_path)
{
include(root("resources/templates/header.php"));
include(root("res/templates/header.php"));
?><body><?php
include(root("resources/templates/menu.php"));
include(root("res/templates/menu.php"));
?><main><?php
include(root("resources/templates/" . $template));
include(root("res/templates/" . $template));
?>
<img
alt="<?php echo($image_alt_text); ?>"
src="<?php echo($image_path); ?>">
src="<?php echo(root($image_path)); ?>">
</main> <?php
include(root("resources/templates/footer.php"));
include(root("res/templates/footer.php"));
?></body>
</html><?php
}

View File

@ -18,11 +18,11 @@ function root($path)
return $absolute_path;
}
include(root("resources/library/array.php"));
include(root("resources/library/file.php"));
include(root("resources/library/insert-coin.php"));
include(root("resources/library/sanitization.php"));
include(root("resources/library/string.php"));
include(root("resources/library/urls.php"));
include(root("res/library/array.php"));
include(root("res/library/file.php"));
include(root("res/library/insert-coin.php"));
include(root("res/library/sanitization.php"));
include(root("res/library/string.php"));
include(root("res/library/urls.php"));
?>

View File

@ -8,8 +8,9 @@
<link rel="stylesheet" media="screen"
href="https://fontlibrary.org/face/connection" type="text/css"/>
<link rel="stylesheet" type="text/css" href="/res/css/style.css">
<link rel="shortcut icon" href="/res/img/coin.png">
<link rel="stylesheet" type="text/css"
href="<?php echo root("res/css/style.css") ?>">
<link rel="shortcut icon" href="<?php echo root("res/img/coin.png") ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

11
res/templates/menu.php Normal file
View File

@ -0,0 +1,11 @@
<div class="menu top-menu">
<h2><a href="/"><?php echo($GLOBALS["site_name"]); ?></a>
<img id="duck"
src="<?php echo root("/res/img/war_duck.png") ?>"
alt="Warduck lives!">
</h2>
<ul>
<li><a href="<?php echo root("coin.php"); ?>">file-beamer</a></li>
<li><a href="<?php echo root("mask.php") ?>">url-shortener</a></li>
</ul>
</div>

View File

@ -1,9 +0,0 @@
<div class="menu top-menu">
<h2><a href="/"><?php echo($GLOBALS["site_name"]); ?></a>
<img id="duck" src="/res/img/war_duck.png" alt="Warduck lives!">
</h2>
<ul>
<li><a href="/coin.php">file-beamer</a></li>
<li><a href="/mask.php">url-shortener</a></li>
</ul>
</div>

View File

@ -1,6 +1,6 @@
<?php
include("../../resources/config.php");
include("../../resources/library/main.php");
include("../res/config.php");
include("../res/library/main.php");
$item = strtolower($GLOBALS["file_beam_item"]);

View File

@ -1,6 +1,6 @@
<?php
include("../../resources/config.php");
include("../../resources/library/main.php");
include("../res/config.php");
include("../res/library/main.php");
$item = strtolower($GLOBALS["url_aliasize_item"]);