diff --git a/webadmin/EN/change_domain.html b/webadmin/EN/change_domain.html new file mode 100644 index 0000000000000000000000000000000000000000..c36fab70ce3a9aaf298290b74d1de9d9f4a607e1 --- /dev/null +++ b/webadmin/EN/change_domain.html @@ -0,0 +1,133 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <style> + body { + margin: 0; + font-family: Arial; + background-color: white; + color: black; + } + + #headerpic { + width: 60%; + height: auto; + margin-right : auto; + margin-left : auto; + min-width : 220px; + } + + #domainicon { + width: 20%; + height: auto; + margin-right : auto; + margin-left : auto; + min-width : 100px; + } + + .header { + text-align: center; + padding: 32px; + } + + #iconpic { + width: 20%; + height: auto; + margin-right : auto; + margin-left : auto; + min-width : 120px; + } + + .card { + box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); + max-width: 600px; + margin: auto; + text-align: center; + font-family: arial; + clear: both; + } + + .card input[type=text] { + width: 90%; + clear: both; + text-align: center; + color: black; + background-color: lightblue; + } + + .appurl { + color: grey; + font-size: 100%; + } + + .welcomeheader { + font-size: 200%; + font-weight: bold; + } + + .domaintext { + font-size: 90%; + } + + button { + border: none; + outline: 0; + display: inline-block; + padding: 8px; + color: white; + background-color: #000; + text-align: center; + cursor: pointer; + width: 100%; + font-size: 18px; + } + + a { + text-decoration: none; + } + + button:hover, a:hover { + opacity: 0.7; + } + + .chip { + display: inline-block; + padding: 0 25px; + height: 50px; + font-size: 70%; + line-height: 50px; + border-radius: 25px; + background-color: #f1f1f1; + } + + .chip img { + float: left; + margin: 0 10px 0 -25px; + height: 50px; + width: 50px; + border-radius: 50%; + } + </style> + </head> + <body> + <div class="card"> + <div class="header"> + <img id="headerpic" class="img-responsive" src="images/logo.png" alt="Freedombone"><br> + <br> + <img id="domainicon" class="img-responsive" src="images/setupdomain.png" alt="Setup domain icon"> + <p class="domaintext" translate="yes">Change your default domain name</p> + + <form action="changedomain.php" method="post"> + <p><input type="text" name="default_domain_name"></p> + <br> + <input type="submit" name="changedomaincancel" translate="yes" value="Cancel"> + <input type="submit" name="changedomain" translate="yes" value="Continue"> + </form> + + <br><br> + + </div> + </div> + </body> +</html> diff --git a/webadmin/EN/change_domain_confirm_template.html b/webadmin/EN/change_domain_confirm_template.html new file mode 100644 index 0000000000000000000000000000000000000000..be01926baee778f035336084e3d168c8d281f094 --- /dev/null +++ b/webadmin/EN/change_domain_confirm_template.html @@ -0,0 +1,147 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta http-equiv="Refresh" content="30" charset="utf-8"> + <style> + body { + margin: 0; + font-family: Arial; + background-color: white; + color: black; + } + + #headerpic { + width: 60%; + height: auto; + margin-right : auto; + margin-left : auto; + min-width : 220px; + } + + #welcomeicon { + width: 20%; + height: auto; + margin-right : auto; + margin-left : auto; + min-width : 100px; + } + + .header { + text-align: center; + padding: 32px; + } + + #iconpic { + width: 20%; + height: auto; + margin-right : auto; + margin-left : auto; + min-width : 120px; + } + + .card { + box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); + max-width: 600px; + margin: auto; + text-align: center; + font-family: arial; + clear: both; + } + + .card input[type=text] { + width: 90%; + clear: both; + text-align: center; + color: black; + background-color: lightblue; + } + .card input[type=radio] { + width: 8%; + height: 15em; + font-size: 10%; + margin-top: 5em; + vertical-align: middle; + } + + .appurl { + color: grey; + font-size: 100%; + } + + .welcomeheader { + font-size: 200%; + font-weight: bold; + } + + .welcometext { + font-size: 90%; + } + + .logintext { + font-size: 90%; + font-weight: bold; + color: #981737; + } + + button { + border: none; + outline: 0; + display: inline-block; + padding: 8px; + color: white; + background-color: #000; + text-align: center; + cursor: pointer; + width: 100%; + font-size: 18px; + } + + a { + text-decoration: none; + } + + button:hover, a:hover { + opacity: 0.7; + } + + .chip { + display: inline-block; + padding: 0 25px; + height: 50px; + font-size: 70%; + line-height: 50px; + border-radius: 25px; + background-color: #f1f1f1; + } + + .chip img { + float: left; + margin: 0 10px 0 -25px; + height: 50px; + width: 50px; + border-radius: 50%; + } + </style> + </head> + <body> + <div class="card"> + <div class="header"> + <img id="headerpic" class="img-responsive" src="images/logo.png" alt="Freedombone"><br> + <br> + <p class="welcometext" translate="yes">Do you want to change your default domain name to:</p> + + <p class="logintext" translate="no">NEW_DEFAULT_DOMAIN_NAME</p> + + <br> + + <form action="changedomain.php" method="post"> + <p><input type="radio" name="changedomainconfirm" value="0" checked><label translate="yes">No</label> + <input type="radio" name="changedomainconfirm" value="1"><label translate="yes">Yes</label></p><br> + <input type="submit" name="changedomainconfirmsubmit" translate="yes" value="Continue" /> + </form> + + <br> + </div> + </div> + </body> +</html> diff --git a/webadmin/EN/dynamicdns_template.html b/webadmin/EN/dynamicdns_template.html index ed67082ff2545dbae9189c11d8e35c6ee6ec4422..606cb886cc08db12ba48a05a9b68a74415371252 100644 --- a/webadmin/EN/dynamicdns_template.html +++ b/webadmin/EN/dynamicdns_template.html @@ -173,6 +173,7 @@ <label translate="yes">Authentication Token</label>: <input type="text" name="ddnscode" value="DDNS_CODE"><br><br> <br> <input type="submit" name="submitddnscancel" translate="yes" value="Cancel"> + <input type="submit" name="submitddnsdomain" translate="yes" value="Domain"> <input type="submit" name="submitddnshelp" translate="yes" value="Help"> <input type="submit" name="submitddns" translate="yes" value="Continue"> </form> diff --git a/webadmin/EN/setup_domain.html b/webadmin/EN/setup_domain.html index ef32fefe9e66548fd1fc3095eeeda74b1badf1bb..10ad53605781c1ae740b2b9e394ac6c3bbffebaa 100644 --- a/webadmin/EN/setup_domain.html +++ b/webadmin/EN/setup_domain.html @@ -118,7 +118,7 @@ <img id="domainicon" class="img-responsive" src="images/setupdomain.png" alt="Setup domain icon"> <p class="domaintext" translate="yes">Optionally you can specify a domain name which will be used for your email or XMPP address.</p> - <p class="domaintext" translate="yes">If you don't have a domain then just select <i>Continue</i></p> + <p class="domaintext" translate="yes">If you don't have a domain then just select Continue</p> <form action="setupdomain.php" method="post"> <p><input type="text" name="default_domain_name"></p> diff --git a/webadmin/changedomain.php b/webadmin/changedomain.php new file mode 100755 index 0000000000000000000000000000000000000000..0fb9d3c37aa71044ad59e7fa6fa51798b4bed9ae --- /dev/null +++ b/webadmin/changedomain.php @@ -0,0 +1,62 @@ +<?php + +// _____ _ _ +// | __|___ ___ ___ _| |___ _____| |_ ___ ___ ___ +// | __| _| -_| -_| . | . | | . | . | | -_| +// |__| |_| |___|___|___|___|_|_|_|___|___|_|_|___| +// +// Freedom in the Cloud +// +// Change the default clearnet domain +// +// License +// ======= +// +// Copyright (C) 2018-2019 Bob Mottram <bob@freedombone.net> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +$output_filename = "dynamicdns.html"; + +if (isset($_POST['changedomain'])) { + $change_domain = htmlspecialchars($_POST['default_domain_name']); + + if (preg_match('/^[a-z\d_\.\-]{4,128}$/i', $change_domain)) { + $domain_file = fopen(".default_domain_temp.txt", "w") or die("Unable to write to default_domain file"); + fwrite($domain_file, $change_domain); + fclose($domain_file); + + exec('cp change_domain_confirm_template.html change_domain_confirm.html'); + exec('sed -i "s|NEW_DEFAULT_DOMAIN_NAME|'.$change_domain.'|g" change_domain_confirm.html'); + + $output_filename = "change_domain_confirm.html"; + } +} + +if (isset($_POST['changedomainconfirmsubmit'])) { + $confirm = htmlspecialchars($_POST['changedomainconfirm']); + + if($confirm == "1") { + exec('mv .default_domain_temp.txt .default_domain.txt'); + } + else { + exec('rm .default_domain_temp.txt'); + } +} + +$htmlfile = fopen("$output_filename", "r") or die("Unable to open $output_filename"); +echo fread($htmlfile,filesize("$output_filename")); +fclose($htmlfile); + +?> diff --git a/webadmin/dynamicdns.php b/webadmin/dynamicdns.php index 16e0eeb8ef181ac72797e2febb41e7f58c87f04b..df33be8c74ac57f3e663511a3cb794d20a0c1925 100755 --- a/webadmin/dynamicdns.php +++ b/webadmin/dynamicdns.php @@ -12,7 +12,7 @@ // License // ======= // -// Copyright (C) 2018 Bob Mottram <bob@freedombone.net> +// Copyright (C) 2018-2019 Bob Mottram <bob@freedombone.net> // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by @@ -33,6 +33,10 @@ if (isset($_POST['submitddnshelp'])) { $output_filename = "help_dynamicdns.html"; } +if (isset($_POST['submitddnsdomain'])) { + $output_filename = "change_domain.html"; +} + if (isset($_POST['submitddns'])) { $ddns = htmlspecialchars($_POST['dynamicdns']); $ddns_username = htmlspecialchars($_POST['ddns_username']);