Reorganize app

This commit is contained in:
Sky Johnson 2024-06-29 07:47:23 -05:00
parent 9e8d5b74e0
commit 5269bf5539
147 changed files with 95 additions and 163 deletions

View File

@ -1,17 +0,0 @@
<?php
if(!defined('SAFE')) {
$page = <<<CANTTOUCH
<html>
<head>
</head>
<body style="padding:0px; margin:0px; background-color: #425b5c;">
<center><img src="../../Images/General/CantTouchThis.png" /></center>
</body>
</html>
CANTTOUCH;
die($page);
}
?>

View File

@ -1,20 +1,4 @@
<?php
if(!defined('SAFE')) {
$page = <<<CANTTOUCH
<html>
<head>
</head>
<body style="padding:0px; margin:0px; background-color: #425b5c;">
<center><img src="../../Images/General/CantTouchThis.png" /></center>
</body>
</html>
CANTTOUCH;
die($page);
}
/*
///
// Author: Skylear Johnson Co-Author: None
@ -26,29 +10,6 @@ CANTTOUCH;
ini_set('display_errors', 'On');
error_reporting(E_ALL | E_STRICT);
/* This entire block here is a method to rid POST, GET and COOKIE of unwanted slashes.
// I have to give some thanks to Atli from Dream.In.Code for helping me come up with this.
// However, this should never really be used. If magic_slashes is a problem, it's time to switch servers; ASAP. */
if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
function undo_magic_quotes_gpc(&$array) {
foreach($array as &$value) {
if(is_array($value)) {
undo_magic_quotes_gpc($value);
} else {
$value = stripslashes($value);
}
}
}
undo_magic_quotes_gpc($_POST);
undo_magic_quotes_gpc($_GET);
undo_magic_quotes_gpc($_COOKIE);
}
// ---------------------------------------------------------------------------- //
// ---------------------------------------------------------------------------- //
/// Includes, so we can use them elsewhere without having to call them each time.
@ -135,56 +96,15 @@ CANTTOUCH;
return $HashedPass;
}
function generateSalt($max = 15) {
$characterList = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*?";
$i = 0;
$salt = "";
while ($i < $max) {
$salt .= $characterList{mt_rand(0, (strlen($characterList) - 1))};
$i++;
}
return $salt;
function generateSalt(int $length = 15): string
{
return bin2hex(random_bytes($length));
}
// Validate the email address inputted!
function checkEmail($email) {
$isValid = true;
$atIndex = strrpos($email, "@");
if(is_bool($atIndex) && !$atIndex) {
$isValid = false;
} else {
$domain = substr($email, $atIndex + 1);
$local = substr($email, 0, $atIndex);
$localLen = strlen($local);
$domainLen = strlen($domain);
if($localLen < 1 || $localLen > 64) {
$isValid = false;
} elseif($domainLen < 1 || $domainLen > 255) {
$isValid = false;
} elseif($local[0] == '.' || $local[$localLen - 1] == '.') {
$isValid = false;
} elseif(preg_match('/\\.\\./', $local)) {
$isValid = false;
} elseif(!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)) {
$isValid = false;
} elseif(preg_match('/\\.\\./', $domain)) {
$isValid = false;
} elseif(!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/', str_replace("\\\\", "", $local))) {
if (!preg_match('/^"(\\\\"|[^"])+"$/', str_replace("\\\\", "", $local))) {
$isValid = false;
}
}
if ($isValid && !(checkdnsrr($domain, "MX") || checkdnsrr($domain, "A"))) {
$isValid = false;
}
}
return $isValid;
function checkEmail($email): bool
{
return filter_var($email, FILTER_VALIDATE_EMAIL) ? true : false;
}
// Simple BBCode parse function.
@ -333,4 +253,25 @@ EDITOR;
return $template;
}
/**
* Return the path to the given template.
*/
function template(string $name): string
{
return "../app/templates/$name.php";
}
/**
* Render a template. Pass data to it - uses an output buffer to have PHP process the template instead of using
* a template engine. If you're including partials in the page, call render('partial', $data), as $data will still
* be available.
*/
function render(string $baseView, array $data = []): string
{
ob_start();
extract($data);
include template($baseView);
return ob_get_clean();
}
?>

View File

@ -1,17 +0,0 @@
<?php
if(!defined('SAFE')) {
$page = <<<CANTTOUCH
<html>
<head>
</head>
<body style="padding:0px; margin:0px; background-color: #425b5c;">
<center><img src="../../Images/General/CantTouchThis.png" /></center>
</body>
</html>
CANTTOUCH;
die($page);
}
?>

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 88 KiB

View File

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 143 KiB

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View File

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 110 KiB

View File

Before

Width:  |  Height:  |  Size: 333 B

After

Width:  |  Height:  |  Size: 333 B

View File

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

View File

Before

Width:  |  Height:  |  Size: 179 KiB

After

Width:  |  Height:  |  Size: 179 KiB

View File

Before

Width:  |  Height:  |  Size: 149 KiB

After

Width:  |  Height:  |  Size: 149 KiB

View File

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View File

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

View File

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 124 KiB

View File

Before

Width:  |  Height:  |  Size: 168 KiB

After

Width:  |  Height:  |  Size: 168 KiB

View File

Before

Width:  |  Height:  |  Size: 203 KiB

After

Width:  |  Height:  |  Size: 203 KiB

View File

Before

Width:  |  Height:  |  Size: 194 KiB

After

Width:  |  Height:  |  Size: 194 KiB

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

View File

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 104 KiB

View File

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 148 KiB

After

Width:  |  Height:  |  Size: 148 KiB

View File

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View File

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB

View File

Before

Width:  |  Height:  |  Size: 983 B

After

Width:  |  Height:  |  Size: 983 B

View File

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

Before

Width:  |  Height:  |  Size: 207 B

After

Width:  |  Height:  |  Size: 207 B

View File

Before

Width:  |  Height:  |  Size: 227 B

After

Width:  |  Height:  |  Size: 227 B

View File

Before

Width:  |  Height:  |  Size: 638 B

After

Width:  |  Height:  |  Size: 638 B

Some files were not shown because too many files have changed in this diff Show More