admin improvements

This commit is contained in:
Walter Hupfeld 2024-03-12 17:40:20 +01:00
parent beba08d4ff
commit 7b6ea55d8d
8 changed files with 43 additions and 58 deletions

View File

@ -21,11 +21,4 @@ $db->exec("CREATE TABLE IF NOT EXISTS user(
created_at TEXT DEFAULT CURRENT_TIMESTAMP created_at TEXT DEFAULT CURRENT_TIMESTAMP
)"); )");
header("Location: configuration.php"); header("Location: configuration.php");
INSERT INTO user (username, passwordhash, district)
SELECT district, "$2y$10$W9CE8IOOfnfi3XTMEVByZeDIrZo1VPxCHz2CfCe.sOH87V/AdaUG2", district
FROM district;

View File

@ -5,14 +5,12 @@
if (!$boolLogin) { if (!$boolLogin) {
header("Location: login.php"); header("Location: login.php");
} }
if (isset($_SESSION['superadmin'])) { if (isset($_SESSION['superadmin'])) {
$boolSuperAdmin = $_SESSION['superadmin']==true; $boolSuperAdmin = (bool)$_SESSION['superadmin'];
} else {
$boolSuperAdmin=false;
} }
// Für lokale Administration keine Konfiguration
if (!$boolSuperAdmin) { header("Location: index.php"); }
$strDistrict = $_SESSION['district'];
require_once("../config.php"); require_once("../config.php");
$boolError=false; $boolError=false;
?> ?>
@ -27,10 +25,9 @@
<script src="../js/jquery.min.js"></script> <script src="../js/jquery.min.js"></script>
<title>Konfigruation</title> <title>Konfigruation</title>
<style> <style>
.leftlabel { width: 10em;} .leftlabel { width: 10em;}
input[type="text"] { width: 18em;} input[type="text"] { width: 18em;}
input.wide {width: 24em;} input.wide {width: 24em;}
</style> </style>
</head> </head>
<body> <body>
@ -59,7 +56,6 @@
<a class="nav-link" href="password.php">Passwort ändern </a> <a class="nav-link" href="password.php">Passwort ändern </a>
</li> </li>
</ul> </ul>
<div> <div>
<ul class="navbar-nav mr-auto right"> <ul class="navbar-nav mr-auto right">
<li class="nav-item"> <li class="nav-item">
@ -70,8 +66,6 @@
</nav> </nav>
<!-- Ende Navbar --> <!-- Ende Navbar -->
<div class="container" style="margin-top:5em;"> <div class="container" style="margin-top:5em;">
<h1>Konfiguration</h1> <h1>Konfiguration</h1>
<form method="post" id="myform" action="configuration_chk.php"> <form method="post" id="myform" action="configuration_chk.php">
@ -98,8 +92,6 @@
<label for="districtSelection">Auswahl Kreise in Navigation</label><br> <label for="districtSelection">Auswahl Kreise in Navigation</label><br>
<input type="checkbox" id="approve" name="approve" <?= ($boolApprove) ? "checked=\"checked\"" :"" ?> > <input type="checkbox" id="approve" name="approve" <?= ($boolApprove) ? "checked=\"checked\"" :"" ?> >
<label for="approve">Eingaben genehmigen</label> <label for="approve">Eingaben genehmigen</label>
<br> <br>
<label class="leftlabel">Uplaod-Pfad:</label> <label class="leftlabel">Uplaod-Pfad:</label>
<input type="text" class="wide" name="uploaddir" id="uploaddir" value="<?=$uploaddir?>"> <input type="text" class="wide" name="uploaddir" id="uploaddir" value="<?=$uploaddir?>">
@ -107,7 +99,6 @@
</div> </div>
<br> <br>
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<h3>Anbieterinformation</h3> <h3>Anbieterinformation</h3>
@ -120,7 +111,6 @@
<label class="leftlabel">Url-Text:</label><input type="text" class="wide" name="urlBez" id="urlBez" value="<?=$strUrlBez?>"><br> <label class="leftlabel">Url-Text:</label><input type="text" class="wide" name="urlBez" id="urlBez" value="<?=$strUrlBez?>"><br>
<label>Impressum: (HTML erlaubt)</label> <label>Impressum: (HTML erlaubt)</label>
<textarea id="impressum" name="impressum" rows="8" style="width:35em;"><?= stripslashes($strImpressum) ?></textarea> <textarea id="impressum" name="impressum" rows="8" style="width:35em;"><?= stripslashes($strImpressum) ?></textarea>
</div> </div>
</div> </div>
<br> <br>
@ -141,8 +131,9 @@
<input type="submit" class="btn btn-primary" value="Konfiguration ändern"> <input type="submit" class="btn btn-primary" value="Konfiguration ändern">
</form> </form>
<?php endif; ?> <?php endif; ?>
<br><br><br> <br><br><br>
<!-- Auswahl der Kreise -->
<h2>Auswahl Kreise und kreisfreie Städte</h2> <h2>Auswahl Kreise und kreisfreie Städte</h2>
<form method="post" id="districtform" action="district_chk.php"> <form method="post" id="districtform" action="district_chk.php">
<?php <?php

View File

@ -15,13 +15,12 @@
if (!$boolLogin) { if (!$boolLogin) {
header("Location: login.php"); header("Location: login.php");
} }
if (isset($_SESSION['superadmin'])) {
$boolSuperAdmin = (bool)$_SESSION['superadmin'];
}
$strDistrict=$_SESSION['district']; $strDistrict = $_SESSION['district'];
$sqlDistrict = ($boolSuperAdmin) ? "1" : "l.district='$strDistrict'"; $sqlDistrict = ($boolSuperAdmin) ? "1" : "l.district='$strDistrict'";
require ("../config.php"); require ("../config.php");
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@ -44,7 +43,7 @@
<body> <body>
<!-- Navbar --> <!-- Navbar -->
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top"> <nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
<a class="navbar-brand" href="#">Administration <?= $strTitle ?> <?=$strDistrictTitle?></a> <a class="navbar-brand" href="#">Administration <?= $strTitle ?></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbars" aria-controls="navbars" aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbars" aria-controls="navbars" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
@ -53,12 +52,14 @@
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="index.php">Liste <span class="sr-only">(current)</span></a> <a class="nav-link" href="index.php">Liste <span class="sr-only">(current)</span></a>
</li> </li>
<?php if ($boolSuperAdmin): ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="configuration.php">Konfiguration </a> <a class="nav-link" href="configuration.php">Konfiguration </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="geocoding.php">Addressen ermitteln </a> <a class="nav-link" href="geocoding.php">Addressen ermitteln </a>
</li> </li>
<?php endif; ?>
<li class="nav-item active"> <li class="nav-item active">
<a class="nav-link" href="export.php">Export </a> <a class="nav-link" href="export.php">Export </a>
</li> </li>
@ -66,7 +67,6 @@
<a class="nav-link" href="password.php">Passwort ändern </a> <a class="nav-link" href="password.php">Passwort ändern </a>
</li> </li>
</ul> </ul>
<div> <div>
<ul class="navbar-nav mr-auto right"> <ul class="navbar-nav mr-auto right">
<li class="nav-item"> <li class="nav-item">

View File

@ -14,6 +14,9 @@
if (!$boolLogin) { if (!$boolLogin) {
header("Location: login.php"); header("Location: login.php");
} }
if (isset($_SESSION['superadmin'])) {
$boolSuperAdmin = (bool)$_SESSION['superadmin'];
}
$strDistrict=$_SESSION['district']; $strDistrict=$_SESSION['district'];
require ("../config.php"); require ("../config.php");
require ("../lib/geocoding.php"); require ("../lib/geocoding.php");
@ -35,10 +38,9 @@
<script src="../js/jquery.min.js"></script> <script src="../js/jquery.min.js"></script>
<title>Konfigruation</title> <title>Konfigruation</title>
<style> <style>
.leftlabel { width: 10em;} .leftlabel { width: 10em;}
input[type="text"] { width: 18em;} input[type="text"] { width: 18em;}
input.wide {width: 24em;} input.wide {width: 24em;}
</style> </style>
</head> </head>
<body> <body>
@ -59,7 +61,6 @@
<li class="nav-item active"> <li class="nav-item active">
<a class="nav-link" href="geocoding.php">Addressen ermitteln </a> <a class="nav-link" href="geocoding.php">Addressen ermitteln </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="export.php">Export </a> <a class="nav-link" href="export.php">Export </a>
</li> </li>
@ -67,7 +68,6 @@
<a class="nav-link" href="password.php">Passwort ändern </a> <a class="nav-link" href="password.php">Passwort ändern </a>
</li> </li>
</ul> </ul>
<div> <div>
<ul class="navbar-nav mr-auto right"> <ul class="navbar-nav mr-auto right">
<li class="nav-item"> <li class="nav-item">

View File

@ -1,5 +1,4 @@
<?php <?php
/** ***************************** /** *****************************
* Ideenmelder * Ideenmelder
* Autor: Walter Hupfeld, Hamm * Autor: Walter Hupfeld, Hamm
@ -9,22 +8,18 @@
* zuletzte bearbeitet: 21.02.2024 * zuletzte bearbeitet: 21.02.2024
******************************** */ ******************************** */
session_start(); session_start();
$strLoginName=(isset($_SESSION['user'])) ? $_SESSION['user'] : "" ; $strLoginName=(isset($_SESSION['user'])) ? $_SESSION['user'] : "" ;
$boolLogin = (!empty($strLoginName)); $boolLogin = (!empty($strLoginName));
if (!$boolLogin) { if (!$boolLogin) {
header("Location: login.php"); header("Location: login.php");
} }
$strDistrict=$_SESSION['district'];
if (isset($_SESSION['superadmin'])) { if (isset($_SESSION['superadmin'])) {
$boolSuperAdmin = $_SESSION['superadmin']==true; $boolSuperAdmin = (bool)$_SESSION['superadmin'];
} else {
$boolSuperAdmin=false;
} }
$strDistrict = $_SESSION['district'];
$sqlDistrict = ($boolSuperAdmin) ? "1" : "l.district='$strDistrict'";
include("../config.php"); include("../config.php");
$boolShowmap=false; $boolShowmap=false;
@ -167,12 +162,14 @@
<li class="nav-item active"> <li class="nav-item active">
<a class="nav-link" href="index.php">Liste <span class="sr-only">(current)</span></a> <a class="nav-link" href="index.php">Liste <span class="sr-only">(current)</span></a>
</li> </li>
<?php if ($boolSuperAdmin): ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="configuration.php">Konfiguration </a> <a class="nav-link" href="configuration.php">Konfiguration </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="geocoding.php">Addressen ermitteln </a> <a class="nav-link" href="geocoding.php">Addressen ermitteln </a>
</li> </li>
<?php endif; ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="export.php">Export </a> <a class="nav-link" href="export.php">Export </a>
</li> </li>
@ -374,8 +371,6 @@ $( document ).ready(function() {
}); });
<?= $strScript ?> <?= $strScript ?>
}); });
</script> </script>
</body> </body>

View File

@ -4,15 +4,21 @@
* Ideenmelder * Ideenmelder
* Autor: Walter Hupfeld, Hamm * Autor: Walter Hupfeld, Hamm
* E-Mail: info@hupfeld-software.de * E-Mail: info@hupfeld-software.de
* Version: 1.0 * Version: 3.0
* Datum: 18.05.2021 * Datum: 18.05.2021
* letzte Änderung: 12.03.2024
******************************** */ ******************************** */
session_start(); session_start();
$dbFilename="../db/locations.db"; $strDistrict=$_SESSION['district'];
require ("../config.php");
$strLoginName=(isset($_SESSION['user'])) ? $_SESSION['user'] : "" ; $strLoginName=(isset($_SESSION['user'])) ? $_SESSION['user'] : "" ;
if (isset($_SESSION['superadmin'])) {
$boolSuperAdmin = $_SESSION['superadmin']==true;
} else {
$boolSuperAdmin=false;
}
require ("../config.php");
$boolLogin = (!empty($strLoginName)); $boolLogin = (!empty($strLoginName));
if (!$boolLogin) { if (!$boolLogin) {
header("Location: login.php"); header("Location: login.php");
@ -72,12 +78,14 @@
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="index.php">Liste <span class="sr-only">(current)</span></a> <a class="nav-link" href="index.php">Liste <span class="sr-only">(current)</span></a>
</li> </li>
<?php if ($boolSuperAdmin): ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="configuration.php">Konfiguration </a> <a class="nav-link" href="configuration.php">Konfiguration </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="geocoding.php">Addressen ermitteln </a> <a class="nav-link" href="geocoding.php">Addressen ermitteln </a>
</li> </li>
<? endif; ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="export.php">Export </a> <a class="nav-link" href="export.php">Export </a>
</li> </li>

View File

@ -9,9 +9,8 @@ $numDefect = (isset($_POST['defect'])) ? $_POST['defect'] : 0;
$id = (int) $_POST['loc_id']; $id = (int) $_POST['loc_id'];
$filename =""; $filename ="";
$boolUploadOk=false; $boolUploadOk=false;
if ($boolUpload && isset($_FILES['uploadfile'])) { if ($boolUpload && ($_FILES['uploadfile']['size']>0)) {
$uploadfile = $uploaddir . basename($_FILES['uploadfile']['name']); $uploadfile = $uploaddir . basename($_FILES['uploadfile']['name']);
$fileinfo = @getimagesize($_FILES["uploadfile"]["tmp_name"]); $fileinfo = @getimagesize($_FILES["uploadfile"]["tmp_name"]);
if (!empty($fileinfo)) { if (!empty($fileinfo)) {
@ -54,7 +53,7 @@ if ($boolUploadOk) {
$result = array( $result = array(
"id" => $id, "id" => $id,
"description" => stripshlashes(nl2br($strDescription)), "description" => stripslashes(nl2br($strDescription)),
"defect" => $arrDefect[$numDefect], "defect" => $arrDefect[$numDefect],
"filename" => $filename, "filename" => $filename,
); );

View File

@ -15,7 +15,6 @@
} }
</style> </style>
<div id="dialog_defect" class="card" title="Eintrag editieren"> <div id="dialog_defect" class="card" title="Eintrag editieren">
<div class="card-header">Eintrag editieren <div class="card-header">Eintrag editieren
<span id="hint"></span> <span id="hint"></span>