FreeSTAR-Status-Engine/admin/options.php

57 lines
2.0 KiB
PHP
Raw Normal View History

2020-08-17 09:52:20 -04:00
<?php
if (!file_exists("../config.php"))
{
header("Location: ../");
}
else{
require_once("../config.php");
require_once("../classes/constellation.php");
require_once("../classes/mailer.php");
require_once("../classes/notification.php");
require_once("../template.php");
require_once("../libs/parsedown/Parsedown.php");
require_once("../classes/queue.php");
require_once("../classes/db-class.php");
2020-08-17 10:23:58 -04:00
}
2020-08-17 09:52:20 -04:00
$db = new SSDB();
2020-08-17 11:08:58 -04:00
if(trim($db->getSetting($mysqli,"notifyUpdates")) == "yes"){
$notifyUpdates_status = true;
} else {
$notifyUpdates_status = false;
}
2020-08-17 10:39:39 -04:00
$set_post = false;
2020-08-17 11:08:58 -04:00
if(!empty($_POST)){
if($_POST["nu_toggle"] == "on"){ $nu_toggle = "yes"; } else { $nu_toggle = "no"; }
$db->deleteSetting($mysqli,"notifyUpdates");
$db->setSetting($mysqli,"notifyUpdates",$nu_toggle);
$db->deleteSetting($mysqli,"name");
$db->setSetting($mysqli,"name",$_POST["sitename"]);
$set_post = true;
if($nu_toggle == "yes"){
$notifyUpdates_status = true;
} else {
$notifyUpdates_status = false;
}
define("NAME", $db->getSetting($mysqli,"name"));
define("TITLE", $db->getSetting($mysqli,"title"));
define("WEB_URL", $db->getSetting($mysqli,"url"));
define("MAILER_NAME", $db->getSetting($mysqli,"mailer"));
define("MAILER_ADDRESS", $db->getSetting($mysqli,"mailer_email"));
2020-08-17 10:39:39 -04:00
}
2020-08-17 09:52:20 -04:00
Template::render_header(_("Options"), true);
?>
<div class="text-center">
2020-08-17 11:08:58 -04:00
<h2><?php if($set_post){ echo "Settings Saved"; } else { echo "Server Status Options"; } ?></h2>
2020-08-17 09:52:20 -04:00
</div>
2020-08-17 10:39:39 -04:00
<form method="post">
2020-08-17 11:08:58 -04:00
<?php Template::render_toggle("Notify Updates","nu_toggle",$notifyUpdates_status); ?>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">Site Name</span>
</div>
<input type="text" class="form-control" placeholder="" aria-label="Username" aria-describedby="basic-addon1" name="sitename" value="<?php echo NAME; ?>">
</div>
<button class="btn btn-primary pull-right" type="submit">Save Settings</button>
2020-08-17 10:39:39 -04:00
</form>