Fixed tabs

This commit is contained in:
Jeroen De Meerleer 2018-09-14 12:25:10 +02:00
parent cd8f31f03a
commit 7807653e1e
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG Key ID: 28CCCB8F62BFADD6
1 changed files with 23 additions and 23 deletions

View File

@ -28,15 +28,15 @@ require_once "include/initialize.inc.php";
if ($_SERVER["REQUEST_METHOD"] == "GET") {
$message = "";
if (isset($_GET["message"])) {
switch ($_GET["message"]) {
case "edited":
$message = "The config has been edited"; break;
}
}
$error = "";
$message = "";
if (isset($_GET["message"])) {
switch ($_GET["message"]) {
case "edited":
$message = "The config has been edited"; break;
}
}
$error = "";
if (isset($_GET["error"])) {
switch ($_GET["error"]) {
case "emptyfields":
@ -45,28 +45,28 @@ if ($_SERVER["REQUEST_METHOD"] == "GET") {
}
$loader = new Twig_Loader_Filesystem('templates');
$twig = new Twig_Environment($loader, array('cache' => 'cache', "debug" => true));
$loader = new Twig_Loader_Filesystem('templates');
$twig = new Twig_Environment($loader, array('cache' => 'cache', "debug" => true));
$configs = load_config_categorized();
$configs = load_config_categorized();
$twig_vars = array('config' => $configs, "error" => $error, "message" => $message);
$twig_vars = array('config' => $configs, "error" => $error, "message" => $message);
echo $twig->render('config.html.twig', $twig_vars);
echo $twig->render('config.html.twig', $twig_vars);
}
elseif ($_SERVER["REQUEST_METHOD"] == "POST") {
foreach($_POST as $key => $value) {
if (empty($value)) {
header("location:config.php?error=emptyfields"); exit;
}
foreach($_POST as $key => $value) {
if (empty($value)) {
header("location:config.php?error=emptyfields"); exit;
}
$keydb = str_replace('_', '.', $key);
$stmt = $db->prepare("UPDATE config SET value = ? WHERE conf = ?");
$stmt->execute(array($value, $keydb));
}
$keydb = str_replace('_', '.', $key);
$stmt = $db->prepare("UPDATE config SET value = ? WHERE conf = ?");
$stmt->execute(array($value, $keydb));
}
header("location:config.php?message=edited");
header("location:config.php?message=edited");
exit;
}