This file is functional now

This commit is contained in:
Yiğit Kerem Oktay 2020-08-17 18:08:58 +03:00 committed by GitHub
parent dc1cf2691c
commit 6858223daf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,22 +15,42 @@ else{
require_once("../classes/db-class.php");
}
$db = new SSDB();
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"));
if(trim($db->getSetting($mysqli,"notifyUpdates")) == "yes"){
$notifyUpdates_status = true;
} else {
$notifyUpdates_status = false;
}
$set_post = false;
if(isset($_POST)){
$set_post = true;
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"));
}
Template::render_header(_("Options"), true);
?>
<div class="text-center">
<h2><?php if($set_post){ "Settings Saved"; } else { echo "Server Status Options"; } ?></h2>
<h2><?php if($set_post){ echo "Settings Saved"; } else { echo "Server Status Options"; } ?></h2>
</div>
<form method="post">
<?php Template::render_toggle("Toggle Title","togglename"); ?>
<button class="btn btn-primary pull-right" type="submit">Save Settings</button>
<?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>
</form>