diff --git a/.gitignore b/.gitignore index ccfdfa4..47283ba 100755 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,5 @@ error.log /python/update.sh !/html/composer.json /html/composer.lock -/html/vendor/ .DS_STORE .env \ No newline at end of file diff --git a/html/api/mail.php b/html/api/mail.php deleted file mode 100755 index dc05804..0000000 --- a/html/api/mail.php +++ /dev/null @@ -1,47 +0,0 @@ -SMTPDebug = 0; // Prevents debugging - $mail->isSMTP(); // Enables SMTP - // Gets the smtp server data - $jsonInfo = file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/config.json"); - $jsonData = json_decode($jsonInfo, true); - $mail->Host = $jsonData["mail"]["server"]; // Specify SMTP server - $mail->SMTPAuth = true; // Enable SMTP authentication - $mail->Username = $jsonData["mail"]["username"]; // SMTP username - $mail->Password = $jsonData["mail"]["password"]; // SMTP password - $mail->SMTPSecure = 'tls';//PHPMailer::ENCRYPTION_STARTTLS; Enable TLS encryption, `PHPMailer::ENCRYPTION_SMTPS` also accepted - $mail->Port = $jsonData["mail"]["port"]; // TCP port to connect to - // Message content - $mail->isHTML(true); // Set email format to HTML - $mail->Subject = $OGPOST["subject"]; // The subject - $mail->Body = $OGPOST["body"]; // The body of the email - - // Recipients - if (array_key_exists("senderName", $OGPOST)) { // Who to send it from. This will check if a short name was given - $mail->setFrom($OGPOST["sender"], $OGPOST["senderName"]); - } else { - $mail->setFrom($OGPOST["sender"]); - } - $mail->addAddress($OGPOST["mail"]); // Add a recipient - $mail->send(); - echo "sent email"; - $sender = $_POST["sender"]; - $reciever = $_POST["mail"]; - writeLog(29, "Sent email from $sender to $reciever with user $USERNAME and ip $address"); - } catch (Exception $e) { // Used to make sure errors are reported - http_response_code(500); - echo $e->errorMessage(); - } -} else { - http_response_code(400); - echo "Invalid command"; -} \ No newline at end of file diff --git a/html/composer.json b/html/composer.json deleted file mode 100755 index 5696ee3..0000000 --- a/html/composer.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "require": { - "phpmailer/phpmailer": "6.8.*" - } -} diff --git a/html/email/index.js b/html/email/index.js deleted file mode 100755 index 1ae843e..0000000 --- a/html/email/index.js +++ /dev/null @@ -1,47 +0,0 @@ -function render() { - // Explanation of how this securly renders the untrusted html input. - // https://making.close.com/posts/rendering-untrusted-html-email-safely - - $("#render").attr("srcdoc", ` - - - - - - - - - - - ${$("#body").val()} - `); -} - -$(document).ready(function() { - $("#send").button() - render(); - $("#renderButton").click(render); - $("#send").click(function() { // Used to send an email. - const ajax = new XMLHttpRequest; - $("#send").text("Sending"); - $("#send").button("disable"); - ajax.onload = function() { - if (ajax.status != 200) { - JQerror(this.responseText); - $("#send").text("Failed To Send"); - } else { - $("#send").text("Sent"); - } - setTimeout(function() {$("#send").text("Send");$("#send").button("enable");}, 1000) - } - ajax.open("POST", `/api/mail.php`); - ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); - ajax.send(`mail=${encodeURI($("#reciever").val())}&senderName=${encodeURI($("#senderName").val())}&sender=${encodeURI($("#sender").val())}&subject=${encodeURI($("#subject").val())}&body=${encodeURI($("#body").val())}&key='${getCookie('user')}'`); - }); -}); \ No newline at end of file diff --git a/html/email/index.php b/html/email/index.php deleted file mode 100755 index 9f02c7a..0000000 --- a/html/email/index.php +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - Email - - - - - - "; - if (! $USERNAME) { - echo "

You are not logged in redirecting...

"; - header("Refresh:3; url=/login.php", true); - http_response_code(401); - } else if (! $PRIVILEGE["mail"]) { - http_response_code(403); - header("Refresh:3; url=/index.php", true); - echo "

Forbidden redirecting...

"; - } else { - ?> - -

Send Emails

- - - - -
- - -
- - -
-

Warning do not paste unsafe input into the textbox below

- -
- - -

HTML Render of Email

- -
- - - - - - \ No newline at end of file diff --git a/html/include/functions.php b/html/include/functions.php index 4afe981..a671cf4 100755 --- a/html/include/functions.php +++ b/html/include/functions.php @@ -1,5 +1,4 @@