2019-07-13 11:01:11 -04:00
|
|
|
<?php
|
|
|
|
|
include "../config.php";
|
2019-07-13 17:34:43 +00:00
|
|
|
// This code is licensed under the AGPL 3 or later by ubergeek (https://tildegit.org/ubergeek)
|
2019-07-13 11:01:11 -04:00
|
|
|
|
2026-01-21 09:58:53 -07:00
|
|
|
// Optional: keep the terminal UI flow inside /terminal/ without changing the classic site.
|
|
|
|
|
//
|
|
|
|
|
// Prefer an explicit flag (terminal=1). As a fallback, detect a terminal embed
|
|
|
|
|
// by referrer so the classic site behavior stays unchanged.
|
|
|
|
|
$terminalMode = (isset($_REQUEST['terminal']) && (string) $_REQUEST['terminal'] === '1')
|
|
|
|
|
|| (isset($_SERVER['HTTP_REFERER']) && strpos((string) $_SERVER['HTTP_REFERER'], '/terminal/') !== false);
|
2019-07-13 11:01:11 -04:00
|
|
|
$name = $_GET['contact_name'];
|
2022-03-08 18:31:21 +01:00
|
|
|
$return_addr = $_GET['email_address'];
|
2019-07-13 12:16:20 -04:00
|
|
|
$type = $_GET['type'];
|
2019-07-13 11:01:11 -04:00
|
|
|
$body = $_GET['message'];
|
|
|
|
|
|
|
|
|
|
$tv = $_GET['tv'];
|
|
|
|
|
|
2019-07-14 00:04:51 +00:00
|
|
|
$destination_addr = "root@thunix.net";
|
2019-07-13 11:01:11 -04:00
|
|
|
$subject = "Contact Form";
|
|
|
|
|
$mailbody = "The following submission via the contact form was recieved:
|
|
|
|
|
|
|
|
|
|
Real Name: $name
|
2019-07-13 12:16:20 -04:00
|
|
|
Type: $type
|
2019-07-13 11:51:48 -04:00
|
|
|
Message: $body";
|
2019-07-13 11:01:11 -04:00
|
|
|
|
|
|
|
|
if ( $tv != "tildeverse" ) {
|
|
|
|
|
print "Spam attempt";
|
2026-01-21 09:58:53 -07:00
|
|
|
$redirect = $terminalMode
|
|
|
|
|
? $site_root . "/terminal/view.php?page=success1"
|
|
|
|
|
: $site_root . "/?page=success1";
|
|
|
|
|
header("Location: $redirect");
|
2019-07-13 11:01:11 -04:00
|
|
|
die();
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-08 18:31:21 +01:00
|
|
|
shell_exec("echo '$mailbody' | /usr/bin/mail -s '$subject' -r '$return_addr' $destination_addr ");
|
2019-07-13 11:01:11 -04:00
|
|
|
|
|
|
|
|
// In the future, here, we *should* be able to build a process that
|
2019-07-13 12:25:00 -04:00
|
|
|
// auto opens an issue in the tildegit project
|
2019-07-13 11:01:11 -04:00
|
|
|
|
2026-01-21 09:58:53 -07:00
|
|
|
$redirect = $terminalMode
|
|
|
|
|
? $site_root . "/terminal/view.php?page=success2"
|
|
|
|
|
: $site_root . "/?page=success2";
|
|
|
|
|
header("Location: $redirect");
|
2019-07-13 11:01:11 -04:00
|
|
|
die()
|
|
|
|
|
|
2019-07-13 17:24:36 +00:00
|
|
|
?>
|