Big-time abstraction & refactoring
|
@ -1,89 +0,0 @@
|
||||||
<?php
|
|
||||||
$page_title = "The Beaming";
|
|
||||||
|
|
||||||
include("../resources/config.php");
|
|
||||||
include("../resources/library/main.php");
|
|
||||||
|
|
||||||
include("../resources/templates/header.php");
|
|
||||||
echo("\n<main>\n");
|
|
||||||
|
|
||||||
|
|
||||||
if (!empty($_POST["desired_filename"]))
|
|
||||||
{
|
|
||||||
$file_name = $_POST["desired_filename"];
|
|
||||||
|
|
||||||
if (!pathinfo($file_name, PATHINFO_EXTENSION))
|
|
||||||
{
|
|
||||||
$file_name = $file_name . "." .
|
|
||||||
(pathinfo($_FILES["fileToUpload"]["name"],
|
|
||||||
PATHINFO_EXTENSION));
|
|
||||||
}
|
|
||||||
|
|
||||||
$beaming_permitted = 0;
|
|
||||||
}
|
|
||||||
else if (!empty($_FILES["fileToUpload"]["name"]))
|
|
||||||
{
|
|
||||||
$file_name = $_FILES["fileToUpload"]["name"];
|
|
||||||
$file_name = sanitize_filename($file_name);
|
|
||||||
$dest_file = $file_beam_dir . $file_name;
|
|
||||||
|
|
||||||
$beaming_permitted = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$beaming_permitted = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$file_name = sanitize_filename($file_name);
|
|
||||||
$dest_file = $file_beam_dir . $file_name;
|
|
||||||
|
|
||||||
if (file_exists($dest_file))
|
|
||||||
{
|
|
||||||
$beaming_permitted = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch ($beaming_permitted)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
celebrate_death($dest_file, $file_beam_item,
|
|
||||||
$file_beam_die_img, $file_beam_die_alt,
|
|
||||||
"<p>… you didn't upload anything, dope.
|
|
||||||
<p>Try again.</p>");
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
celebrate_death($dest_file, $url_aliasize_item,
|
|
||||||
$file_beam_die_img, $file_beam_die_alt,
|
|
||||||
"<p>Er, that coin already exists— try a different file-name.</p>");
|
|
||||||
break;
|
|
||||||
case 0:
|
|
||||||
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"],$dest_file))
|
|
||||||
{
|
|
||||||
// $file_ext = pathinfo($dest_file, PATHINFO_EXTENSION);
|
|
||||||
// if ($file_ext == "jpg")
|
|
||||||
// {
|
|
||||||
// sanitize_image($dest_file);
|
|
||||||
// }
|
|
||||||
write_metadata($dest_file, $_POST["file_source"]);
|
|
||||||
|
|
||||||
celebrate($dest_file, $file_beam_item,
|
|
||||||
$file_beam_win_img, $file_beam_win_alt, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
celebrate_death($dest_file, $url_aliasize_item,
|
|
||||||
$file_beam_die_img, $file_beam_die_alt,
|
|
||||||
"<p>What the hell just happened? :o</p>
|
|
||||||
<p>I dunno, but maybe you should give it another go?</p>");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
include("../resources/templates/footer.html");
|
|
||||||
?>
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?php
|
||||||
|
include("../resources/config.php");
|
||||||
|
include("../resources/library/main.php");
|
||||||
|
|
||||||
|
create_page("insert " . strtolower($GLOBALS["file_beam_item"]), "coin/beam.php",
|
||||||
|
$GLOBALS["file_beam_alt"], $GLOBALS["file_beam_img"]);
|
||||||
|
|
||||||
|
?>
|
|
@ -1,70 +0,0 @@
|
||||||
<?php
|
|
||||||
$page_title = "The Conjuring";
|
|
||||||
|
|
||||||
include("../resources/config.php");
|
|
||||||
include("../resources/library/main.php");
|
|
||||||
|
|
||||||
include("../resources/templates/header.php");
|
|
||||||
echo("\n<main>\n");
|
|
||||||
|
|
||||||
|
|
||||||
if (!empty($_POST["url_target"]) && !empty($_POST["url_alias"]))
|
|
||||||
{
|
|
||||||
$url_target = $_POST["url_target"];
|
|
||||||
$url_alias = $_POST["url_alias"];
|
|
||||||
$url_alias = sanitize_filename($url_alias);
|
|
||||||
|
|
||||||
$visible_dest = $url_aliasize_dir . $url_alias . $url_aliasize_visible_suffix;
|
|
||||||
$dest_file = $url_aliasize_dir . $url_alias . $url_aliasize_suffix;
|
|
||||||
|
|
||||||
$beaming_permitted = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$beaming_permitted = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!filter_var($url_target, FILTER_VALIDATE_URL))
|
|
||||||
{
|
|
||||||
$beaming_permitted = 3;
|
|
||||||
}
|
|
||||||
else if (file_exists($dest_file))
|
|
||||||
{
|
|
||||||
$beaming_permitted = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
switch ($beaming_permitted)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
celebrate_death($dest_file, $url_aliasize_item,
|
|
||||||
$url_aliasize_die_img, $url_aliasize_die_alt,
|
|
||||||
"<p>... you didn't pick a URL/target.</p>
|
|
||||||
<p>Do it next time >;c</p>");
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
celebrate_death($dest_file, $url_aliasize_item,
|
|
||||||
$url_aliasize_die_img, $url_aliasize_die_alt,
|
|
||||||
"<p>Oh, sorry. Some-one just took that mask before you got here!</p>
|
|
||||||
<p>Try a different target name, doggo</p>");
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
celebrate_death($dest_file, $url_aliasize_item,
|
|
||||||
$url_aliasize_die_img, $url_aliasize_die_alt,
|
|
||||||
"<p>Are you screwing with me? That's not a URL</p>
|
|
||||||
<p>Nice try, buck-o</p>");
|
|
||||||
break;
|
|
||||||
case 0:
|
|
||||||
write_alias($dest_file, $url_target);
|
|
||||||
celebrate($visible_dest, $url_aliasize_item,
|
|
||||||
$url_aliasize_win_img, $url_aliasize_win_alt);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
include("../resources/templates/footer.html");
|
|
||||||
?>
|
|
|
@ -1,31 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
include("../resources/config.php");
|
|
||||||
|
|
||||||
$page_title = "Insert " . ucfirst($file_beam_item);
|
include("coin.php");
|
||||||
|
|
||||||
include("../resources/templates/header.php");
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<main>
|
|
||||||
|
|
||||||
<form action="beam.php" method="post" enctype="multipart/form-data">
|
|
||||||
<p>
|
|
||||||
<input type="text" placeholder="Filename (Blank for uploaded name)"
|
|
||||||
name="desired_filename" class="basic-text">
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<input type="text" placeholder="Source (Optional)"
|
|
||||||
name="file_source" class="basic-text">
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<input type="file" name="fileToUpload" id="fileToUpload" style="margin: 0 auto">
|
|
||||||
<input style="margin-top: 10px; margin-bottom: 10px" type="submit"
|
|
||||||
value="INSERT <?php echo(strtoupper($file_beam_item)); ?>" name="submit">
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<img alt="<?php echo($file_beam_alt); ?>" src="<?php echo($file_beam_img); ?>">
|
|
||||||
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<?php include("../resources/templates/footer.html");?>
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
include("../resources/config.php");
|
||||||
|
include("../resources/library/main.php");
|
||||||
|
|
||||||
|
create_page("create " . strtolower($GLOBALS["url_aliasize_item"]),
|
||||||
|
"mask/create.php", $GLOBALS["url_aliasize_alt"],
|
||||||
|
$GLOBALS["url_aliasize_img"]);
|
||||||
|
|
||||||
|
?>
|
|
@ -0,0 +1,8 @@
|
||||||
|
[FileDialog]
|
||||||
|
history=file:///home/media/roms/The.Elder.Scrolls.III.Morrowind.GOTY-WaLMaRT, file:///mnt, file:///mnt/WALMART, file:///home/media/roms/ThElderScr3IIMoMorrowindGOTYGOG/Data Files, file:///home/media/roms/morrowind/Data Files
|
||||||
|
lastVisited=file:///home/media/roms/morrowind/Data Files
|
||||||
|
qtVersion=5.9.4
|
||||||
|
shortcuts=file:, file:///home/jaidyn
|
||||||
|
sidebarWidth=90
|
||||||
|
treeViewHeader=@ByteArray(\0\0\0\xff\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x1\xf7\0\0\0\x4\x1\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x64\xff\xff\xff\xff\0\0\0\x81\0\0\0\0\0\0\0\x4\0\0\x1\x4\0\0\0\x1\0\0\0\0\0\0\0\x41\0\0\0\x1\0\0\0\0\0\0\0\x41\0\0\0\x1\0\0\0\0\0\0\0q\0\0\0\x1\0\0\0\0\0\0\x3\xe8\0\xff\xff\xff\xff)
|
||||||
|
viewMode=Detail
|
|
@ -0,0 +1,2 @@
|
||||||
|
Source:
|
||||||
|
[citation needed]
|
|
@ -0,0 +1,2 @@
|
||||||
|
Source:
|
||||||
|
[citation needed]
|
|
@ -0,0 +1,5 @@
|
||||||
|
[Defaults]
|
||||||
|
Profile=Default
|
||||||
|
|
||||||
|
[PROFILE_Default]
|
||||||
|
ServerType=
|
|
@ -0,0 +1,2 @@
|
||||||
|
Source:
|
||||||
|
[citation needed]
|
|
@ -0,0 +1,2 @@
|
||||||
|
Source:
|
||||||
|
[citation needed]
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
include("../../resources/config.php");
|
||||||
|
include("../../resources/library/main.php");
|
||||||
|
|
||||||
|
$file_name = $_FILES["uploadcoin"]["name"];
|
||||||
|
$file_ext = file_extension($file_name);
|
||||||
|
if (!empty($_POST["desired_filename"])) {
|
||||||
|
$file_name = $_POST["desired_filename"];
|
||||||
|
if (!file_extension($file_name)) {
|
||||||
|
$file_name = $file_name . $file_ext;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$file_name = sanitize_filename($file_name);
|
||||||
|
|
||||||
|
$dest_name = $GLOBALS["file_beam_dir"] . $file_name;
|
||||||
|
$dest_file = root("public_html/" . $dest_name);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
switch (true) {
|
||||||
|
case (empty($file_name) || empty($dest_name)):
|
||||||
|
redirect(make_url("result/beam.php?error=1"));
|
||||||
|
break;
|
||||||
|
case (file_exists($dest_file)):
|
||||||
|
redirect(make_url("result/beam.php?error=2"));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case (move_uploaded_file($_FILES["uploadcoin"]["tmp_name"], $dest_file)
|
||||||
|
&& write_metadata($dest_file, $_POST["file_source"])):
|
||||||
|
redirect(make_url("result/beam.php?success="
|
||||||
|
. $file_name));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
redirect(make_url("result/beam.php"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
include("../../resources/config.php");
|
||||||
|
include("../../resources/library/main.php");
|
||||||
|
|
||||||
|
|
||||||
|
$url_target = $_POST["url_target"];
|
||||||
|
$url_alias = sanitize_filename($_POST["url_alias"]);
|
||||||
|
|
||||||
|
$visible_name = $url_alias . $GLOBALS["url_aliasize_visible_suffix"];
|
||||||
|
$visible_dest = $GLOBALS["url_aliasize_dir"] . $visible_name;
|
||||||
|
$dest_name = $GLOBALS["url_aliasize_dir"] . $url_alias
|
||||||
|
. $GLOBALS["url_aliasize_suffix"];
|
||||||
|
$dest_file = root("public_html/" . $dest_name);
|
||||||
|
|
||||||
|
|
||||||
|
switch (true) {
|
||||||
|
case (empty($url_target) || empty($url_alias)):
|
||||||
|
redirect(make_url("result/create.php?error=1"));
|
||||||
|
break;
|
||||||
|
case (file_exists($dest_file)):
|
||||||
|
redirect(make_url("result/create.php?error=2"));
|
||||||
|
break;
|
||||||
|
case (!valid_url($url_target)):
|
||||||
|
redirect(make_url("result/create.php?error=3"));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case (write_alias($dest_file, $url_target)):
|
||||||
|
redirect(make_url("result/create.php?success="
|
||||||
|
. $visible_name));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
redirect(make_url("result/create.php"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
Before Width: | Height: | Size: 963 B After Width: | Height: | Size: 963 B |
Before Width: | Height: | Size: 442 B After Width: | Height: | Size: 442 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 567 B After Width: | Height: | Size: 567 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 482 B After Width: | Height: | Size: 482 B |
Before Width: | Height: | Size: 890 B After Width: | Height: | Size: 890 B |
Before Width: | Height: | Size: 619 B After Width: | Height: | Size: 619 B |
Before Width: | Height: | Size: 251 B After Width: | Height: | Size: 251 B |
Before Width: | Height: | Size: 799 B After Width: | Height: | Size: 799 B |
Before Width: | Height: | Size: 344 B After Width: | Height: | Size: 344 B |
Before Width: | Height: | Size: 764 B After Width: | Height: | Size: 764 B |
Before Width: | Height: | Size: 277 B After Width: | Height: | Size: 277 B |
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
include("../../resources/config.php");
|
||||||
|
include("../../resources/library/main.php");
|
||||||
|
|
||||||
|
$item = strtolower($GLOBALS["file_beam_item"]);
|
||||||
|
|
||||||
|
$filename = $_GET["success"];
|
||||||
|
$error = $_GET["error"];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
switch (true) {
|
||||||
|
case (!empty($filename)):
|
||||||
|
$coin_url = make_url($GLOBALS["file_beam_dir"] . $filename);
|
||||||
|
|
||||||
|
create_page("happy " . $item, "coin/celebrate.php",
|
||||||
|
$file_beam_win_alt, $file_beam_win_img);
|
||||||
|
break;
|
||||||
|
case ($error == 1):
|
||||||
|
create_page($item . " on fire",
|
||||||
|
"coin/death-1.html",
|
||||||
|
$file_beam_die_alt, $file_beam_die_img);
|
||||||
|
break;
|
||||||
|
case ($error == 2):
|
||||||
|
create_page($item . " on fire",
|
||||||
|
"coin/death-2.html",
|
||||||
|
$file_beam_die_alt, $file_beam_die_img);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
create_page($item . " on fire",
|
||||||
|
"coin/death.html",
|
||||||
|
$file_beam_die_alt, $file_beam_die_img);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
include("../../resources/config.php");
|
||||||
|
include("../../resources/library/main.php");
|
||||||
|
|
||||||
|
$item = strtolower($GLOBALS["url_aliasize_item"]);
|
||||||
|
|
||||||
|
$filename = $_GET["success"];
|
||||||
|
$error = $_GET["error"];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
switch (true) {
|
||||||
|
case (!empty($filename)):
|
||||||
|
$mask_url = make_url($GLOBALS["url_aliasize_dir"] . $filename);
|
||||||
|
|
||||||
|
create_page("happy " . $item, "mask/celebrate.php",
|
||||||
|
$GLOBALS["url_aliasize_win_alt"],
|
||||||
|
$GLOBALS["url_aliasize_win_img"]);
|
||||||
|
break;
|
||||||
|
case ($error == 1):
|
||||||
|
create_page($item . " on fire",
|
||||||
|
"mask/death-1.html",
|
||||||
|
$GLOBALS["url_aliasize_die_alt"],
|
||||||
|
$GLOBALS["url_aliasize_die_img"]);
|
||||||
|
break;
|
||||||
|
case ($error == 2):
|
||||||
|
create_page($item . " on fire",
|
||||||
|
"mask/death-2.php",
|
||||||
|
$GLOBALS["url_aliasize_die_alt"],
|
||||||
|
$GLOBALS["url_aliasize_die_img"]);
|
||||||
|
break;
|
||||||
|
case ($error == 3):
|
||||||
|
create_page($item . " on fire",
|
||||||
|
"mask/death-3.html",
|
||||||
|
$GLOBALS["url_aliasize_die_alt"],
|
||||||
|
$GLOBALS["url_aliasize_die_img"]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
create_page($item . " on fire",
|
||||||
|
"mask/death.html",
|
||||||
|
$GLOBALS["url_aliasize_die_alt"],
|
||||||
|
$GLOBALS["url_aliasize_die_img"]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
|
@ -0,0 +1 @@
|
||||||
|
<?php header('Location: https://death.io'); ?>
|
|
@ -0,0 +1 @@
|
||||||
|
<?php header('Location: https://raddle.me'); ?>
|
|
@ -0,0 +1 @@
|
||||||
|
<?php header('Location: https://coinsh.red'); ?>
|
|
@ -1,31 +0,0 @@
|
||||||
<?php
|
|
||||||
$page_title = "Create Mask";
|
|
||||||
|
|
||||||
include("../resources/config.php");
|
|
||||||
include("../resources/templates/header.php");
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
||||||
<main>
|
|
||||||
|
|
||||||
<form action="conjure.php" method="post" enctype="multipart/form-data">
|
|
||||||
<p>
|
|
||||||
<input type="text" placeholder="URL"
|
|
||||||
name="url_target" class="basic-text">
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<input type="text" placeholder="Alias (Shortened URL)"
|
|
||||||
name="url_alias" class="basic-text">
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<input style="margin-top: 10px; margin-bottom: 10px" type="submit"
|
|
||||||
value="FORGE <?php echo(strtoupper($url_aliasize_item)); ?>" name="submit">
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<img alt="<?php echo($url_aliasize_alt); ?>" src="<?php echo($url_aliasize_img); ?>">
|
|
||||||
|
|
||||||
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<?php include("../resources/templates/footer.html");?>
|
|
|
@ -5,22 +5,23 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
$site_name = "insert-coin"; // what the site will be called
|
$site_name = "insert-coin"; // what the site will be called
|
||||||
|
$root_name = "insert-coin"; // the directory containing this instance
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// vars related to URL shortening
|
// vars related to URL shortening
|
||||||
|
|
||||||
$url_aliasize_img = "img/mask-big.png";
|
$url_aliasize_img = "/res/img/mask-big.png";
|
||||||
$url_aliasize_alt = "A mask, floating in mid-air.";
|
$url_aliasize_alt = "A mask, floating in mid-air.";
|
||||||
$url_aliasize_win_img = "img/mask_win-big.png";
|
$url_aliasize_win_img = "/res/img/mask_win-big.png";
|
||||||
$url_aliasize_win_alt = "A whimsical mask sparkling.";
|
$url_aliasize_win_alt = "A whimsical mask sparkling.";
|
||||||
$url_aliasize_die_img = "img/mask_die-big.png";
|
$url_aliasize_die_img = "/res/img/mask_die-big.png";
|
||||||
$url_aliasize_die_alt = "A whimsical mask on fire.";
|
$url_aliasize_die_alt = "A whimsical mask on fire.";
|
||||||
|
|
||||||
$url_aliasize_item = "mask"; // what the alias is affectionately called
|
$url_aliasize_item = "mask"; // what the alias is affectionately called
|
||||||
$url_aliasize_dir = "u/"; // where the redirects go
|
$url_aliasize_dir = "u/"; // where the redirects go
|
||||||
$url_aliasize_visible_suffix = "php"; // suffix visible in redirect links
|
$url_aliasize_visible_suffix = ".php"; // suffix visible in redirect links
|
||||||
$url_aliasize_suffix = "php"; // actual suffix in redirect links
|
$url_aliasize_suffix = ".php"; // actual suffix in redirect links
|
||||||
// (the distinction is important if you use
|
// (the distinction is important if you use
|
||||||
// URL rewriting for the /u/ folder or
|
// URL rewriting for the /u/ folder or
|
||||||
//something
|
//something
|
||||||
|
@ -28,15 +29,19 @@ $url_aliasize_suffix = "php"; // actual suffix in redirect links
|
||||||
|
|
||||||
// vars related to file uploading
|
// vars related to file uploading
|
||||||
|
|
||||||
$file_beam_img = "img/coin-big.png";
|
$file_beam_img = "/res/img/coin-big.png";
|
||||||
$file_beam_alt = "A big & yellow coin lying before a coin-slot";
|
$file_beam_alt = "A big & yellow coin lying before a coin-slot";
|
||||||
$file_beam_win_img = "img/coin_win-big.png";
|
$file_beam_win_img = "/res/img/coin_win-big.png";
|
||||||
$file_beam_win_alt = "A coin inserted into a coin slot.";
|
$file_beam_win_alt = "A coin inserted into a coin slot.";
|
||||||
$file_beam_die_img = "img/coin_die-big.png";
|
$file_beam_die_img = "/res/img/coin_die-big.png";
|
||||||
$file_beam_die_alt = "A coin on fire.";
|
$file_beam_die_alt = "A coin on fire.";
|
||||||
|
|
||||||
$file_beam_item = "coin"; // what the file is affectionately called
|
$file_beam_item = "coin"; // what the file is affectionately called
|
||||||
$file_beam_dir = "p/"; // where the files go
|
$file_beam_dir = "p/"; // where the files go
|
||||||
|
|
||||||
|
|
||||||
|
// for sanitization of images (stripping EXIF, etc) with an external program.
|
||||||
$image_sanitize_command = "mogrify";
|
$image_sanitize_command = "mogrify";
|
||||||
$image_sanitize_args = "strip";
|
$image_sanitize_args = "strip";
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
|
@ -8,11 +8,15 @@
|
||||||
function write_alias($filepath, $url)
|
function write_alias($filepath, $url)
|
||||||
{
|
{
|
||||||
$file_p = fopen($filepath, 'w');
|
$file_p = fopen($filepath, 'w');
|
||||||
|
$redirect_string = "<?php header('Location: " . $url . "'); ?>\n";
|
||||||
|
|
||||||
fwrite($file_p, "<?php header('Location: " . $url . "'); ?>\n");
|
if (fwrite($file_p, $redirect_string)) {
|
||||||
fclose($file_p);
|
fclose($file_p);
|
||||||
|
return $filepath;
|
||||||
return $filepath;
|
}
|
||||||
|
else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,8 +36,22 @@ function write_metadata($filepath, $source)
|
||||||
. prefix_text(set_line_length($source, 50),
|
. prefix_text(set_line_length($source, 50),
|
||||||
" ");
|
" ");
|
||||||
|
|
||||||
fwrite($file_p, $source_string);
|
if (fwrite($file_p, $source_string)) {
|
||||||
fclose($file_p);
|
fclose($file_p);
|
||||||
|
return $source_string;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// FILENAME --> FILE_EXTENSION
|
||||||
|
// Return the file-extension of a filename.
|
||||||
|
function file_extension($file_name)
|
||||||
|
{
|
||||||
|
return pathinfo($file_name, PATHINFO_EXTENSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,40 +1,22 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
// TITLE_STING TEMPLATE_PATH IMAGE_ALT IMAGE_PATH --> HTML
|
||||||
function celebrate($dest_file, $item_type, $image_url, $image_alt, $meta_data = false)
|
// Create a general insert-coin webpage; relative path from rootdir
|
||||||
|
// for $image_path, and relative path from /resources/templates/
|
||||||
|
// for $template
|
||||||
|
function create_page($page_title, $template, $image_alt_text, $image_path)
|
||||||
{
|
{
|
||||||
|
include(root("resources/templates/header.php"));
|
||||||
?>
|
?><body><?php
|
||||||
<title><?php echo($site_name . ": " . $item_type); ?> inserted <3</title>
|
include(root("resources/templates/menu.php"));
|
||||||
<p>Thanks for feeding me</p>
|
?><main><?php
|
||||||
<p>Your <?php echo($item_type); ?>'s in safe hands</p>
|
include(root("resources/templates/" . $template));
|
||||||
|
?>
|
||||||
<img alt="<?php echo($image_alt); ?>" src="<?php echo($image_url); ?>">
|
<img
|
||||||
|
alt="<?php echo($image_alt_text); ?>"
|
||||||
<p>Your <?php echo($item_type); ?>'s
|
src="<?php echo($image_path); ?>">
|
||||||
<a href="<?php echo ($dest_file); ?>">over here</a></p>
|
</main> <?php
|
||||||
<p><b><?php echo("https://" . get_cwd($_SERVER["REQUEST_URI"]) . "/" . $dest_file); ?></b></p>
|
include(root("resources/templates/footer.php"));
|
||||||
<?php
|
?></body>
|
||||||
if ($meta_data) {
|
</html><?php
|
||||||
?>
|
|
||||||
<p>It's meta-stuff (or lack thereof) is
|
|
||||||
<a href="<?php echo($dest_file); ?>.txt">here</a></p>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function celebrate_death($dest_file, $item_type, $image_url, $image_alt, $message)
|
|
||||||
{
|
|
||||||
|
|
||||||
?>
|
|
||||||
<title><?php echo($site_name . ": " . $item_type); ?> burned </3</title>
|
|
||||||
<p>Oh God, I've never seen so much blood—</p>
|
|
||||||
<p>err, I mean, there're just some minor problems under the hood!</p>
|
|
||||||
|
|
||||||
<img alt="<?php echo($image_alt); ?>" src="<?php echo($image_url); ?>">
|
|
||||||
|
|
||||||
<?php echo($message); ?>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,28 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
include("array.php");
|
// PROJECT_ROOTDIR_NAME --> ABSOLUTE_PATH_TO_PROJECT_DIR
|
||||||
include("file.php");
|
// Return the absolute path to the project's root.
|
||||||
include("insert-coin.php");
|
function get_project_root()
|
||||||
include("sanitization.php");
|
{
|
||||||
include("string.php");
|
return preg_replace("%" . $GLOBALS["root_name"] . ".*" . "%",
|
||||||
include("urls.php");
|
$GLOBALS["root_name"] . "/",
|
||||||
|
getcwd());
|
||||||
|
}
|
||||||
|
|
||||||
|
// PATH_RELATIVE_TO_PROJECT_ROOT --> ABSOLUTE_PATH
|
||||||
|
// Return the absolute path to something within the project's root.
|
||||||
|
function root($path)
|
||||||
|
{
|
||||||
|
$absolute_path = get_project_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"));
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -92,4 +92,29 @@ function is_punctuation($character)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// STRING --> FIRST_CHARACTER
|
||||||
|
// Return the first character of a string.
|
||||||
|
function strcar($string)
|
||||||
|
{
|
||||||
|
return substr($string, 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// STRING --> ALL_BUT_FIRST_CHARACTER
|
||||||
|
// Return all but the first character of a string.
|
||||||
|
function strcdr($string)
|
||||||
|
{
|
||||||
|
return substr($string, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// STRING --> SECOND_CHARACTER
|
||||||
|
// Return the second character of a string.
|
||||||
|
function strcadr($string)
|
||||||
|
{
|
||||||
|
return strcar(strcdr($string));
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -27,4 +27,49 @@ function get_cwd($url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// --> PROTOCOL://
|
||||||
|
// Return "http://" or "https://", depending on what's currently used.
|
||||||
|
function protocol()
|
||||||
|
{
|
||||||
|
if (isset($_SERVER['HTTPS'])) {
|
||||||
|
return "https://";
|
||||||
|
} else {
|
||||||
|
return "http://";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ABSOLUTE_PATH --> FULL_URL
|
||||||
|
// Create a full URL with the current protocol, domain, and provided path.
|
||||||
|
function make_url($path)
|
||||||
|
{
|
||||||
|
$url = protocol()
|
||||||
|
. $_SERVER['HTTP_HOST']
|
||||||
|
. "/"
|
||||||
|
. $path;
|
||||||
|
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// URL --> HEADER_REDIRECTION
|
||||||
|
// Create a redirection header.
|
||||||
|
function redirect($url)
|
||||||
|
{
|
||||||
|
return header('Location: ' . $url);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// URL --> BOOLEAN
|
||||||
|
// Return whether or not a URL is a valid one.
|
||||||
|
function valid_url($url)
|
||||||
|
{
|
||||||
|
return filter_var($url_target, FILTER_VALIDATE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
<form action="private/beam.php" method="post" enctype="multipart/form-data">
|
||||||
|
<p>
|
||||||
|
<input type="text" placeholder="Filename (Blank for uploaded name)"
|
||||||
|
name="desired_filename" class="basic-text">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<input type="text" placeholder="Source (Optional)"
|
||||||
|
name="file_source" class="basic-text">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<input type="file" name="uploadcoin" id="uploadcoin"
|
||||||
|
style="margin: 0 auto">
|
||||||
|
<input style="margin-top: 10px; margin-bottom: 10px" type="submit"
|
||||||
|
value="INSERT <?php echo(strtoupper($GLOBALS["file_beam_item"])); ?>" name="submit">
|
||||||
|
</form>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<p>Thanks for feeding me; it'll be in safe hands</p>
|
||||||
|
|
||||||
|
<p>Your coin's <a href="<?php echo($GLOBALS["coin_url"]); ?>">over here</a></p>
|
||||||
|
|
||||||
|
<p><b><?php echo($GLOBALS["coin_url"]); ?></b></p>
|
||||||
|
|
||||||
|
<p>It's meta-stuff (or lack thereof) is
|
||||||
|
<a href="<?php echo($GLOBALS["coin_url"] . ".txt"); ?>">here</a></p>
|
|
@ -0,0 +1,2 @@
|
||||||
|
<p>You didn't upload anything, dope.</p>
|
||||||
|
<p>Try again.</p>
|
|
@ -0,0 +1 @@
|
||||||
|
<p>Er, that coin already exists— try a different file-name.</p>
|
|
@ -0,0 +1,2 @@
|
||||||
|
<p>What the hell just happened? :o</p>
|
||||||
|
<p>I dunno, but maybe you should give it another go?</p>
|
|
@ -15,8 +15,3 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -5,20 +5,12 @@
|
||||||
<!-- THIS ENTIRE FILE IS UNDER THE AGPLv3+
|
<!-- THIS ENTIRE FILE IS UNDER THE AGPLv3+
|
||||||
https://www.gnu.org/licenses/agpl-3.0.html -->
|
https://www.gnu.org/licenses/agpl-3.0.html -->
|
||||||
|
|
||||||
<link rel="stylesheet" media="screen" href="https://fontlibrary.org/face/connection" type="text/css"/>
|
<link rel="stylesheet" media="screen"
|
||||||
<link rel="stylesheet" type="text/css" href="css/style.css">
|
href="https://fontlibrary.org/face/connection" type="text/css"/>
|
||||||
<link rel="shortcut icon" href="res/img/coin.ico">
|
<link rel="stylesheet" type="text/css" href="/res/css/style.css">
|
||||||
|
<link rel="shortcut icon" href="/res/img/coin.ico">
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<title><?php echo($site_name . ": " . $page_title); ?></title>
|
<title><?php echo($GLOBALS["site_name"] . ": " . $page_title); ?></title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
|
||||||
<div class="menu top-menu">
|
|
||||||
<h2><a href="."><?php echo($site_name); ?></a></h2>
|
|
||||||
<ul>
|
|
||||||
<li><a href="index.php">file-beamer</a></li>
|
|
||||||
<li><a href="url.php">url-shortener</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<p>Thanks for feeding me; it'll be in safe hands</p>
|
||||||
|
|
||||||
|
<p>Your <?php echo(strtolower($GLOBALS["url_aliasize_item"])); ?>'s
|
||||||
|
<a href="<?php echo($GLOBALS["mask_url"]); ?>">over here</a></p>
|
||||||
|
|
||||||
|
<p><b><?php echo($GLOBALS["mask_url"]); ?></b></p>
|
|
@ -0,0 +1,14 @@
|
||||||
|
<form action="private/create.php" method="post" enctype="multipart/form-data">
|
||||||
|
<p>
|
||||||
|
<input type="text" placeholder="URL"
|
||||||
|
name="url_target" class="basic-text">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<input type="text" placeholder="Alias (Shortened URL)"
|
||||||
|
name="url_alias" class="basic-text">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<input style="margin-top: 10px; margin-bottom: 10px" type="submit"
|
||||||
|
value="FORGE <?php echo(strtoupper($GLOBALS["url_aliasize_item"])); ?>" name="submit">
|
||||||
|
</form>
|
|
@ -0,0 +1,2 @@
|
||||||
|
<p>You didn't type in anything...</p>
|
||||||
|
<p>Come on, you can do better than that. :s</p>
|
|
@ -0,0 +1,2 @@
|
||||||
|
<p>Er, that <?php echo(strtolower($GLOBALS["url_aliasize_item"])); ?>
|
||||||
|
already exists, try a different alias.</p>
|
|
@ -0,0 +1,2 @@
|
||||||
|
<p>Now, mate, that wasn't an actual URL.</p>
|
||||||
|
<p>You had <i>one</i> job!...</p>
|
|
@ -0,0 +1,2 @@
|
||||||
|
<p>What the hell just happened? :o</p>
|
||||||
|
<p>I dunno, but maybe you should give it another go?</p>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<div class="menu top-menu">
|
||||||
|
<h2><a href="/"><?php echo($GLOBALS["site_name"]); ?></a></h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="/coin.php">file-beamer</a></li>
|
||||||
|
<li><a href="/mask.php">url-shortener</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|