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

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

View File

@ -15,13 +15,12 @@
if (!$boolLogin) {
header("Location: login.php");
}
$strDistrict=$_SESSION['district'];
if (isset($_SESSION['superadmin'])) {
$boolSuperAdmin = (bool)$_SESSION['superadmin'];
}
$strDistrict = $_SESSION['district'];
$sqlDistrict = ($boolSuperAdmin) ? "1" : "l.district='$strDistrict'";
require ("../config.php");
?>
<!DOCTYPE html>
@ -44,7 +43,7 @@
<body>
<!-- Navbar -->
<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">
<span class="navbar-toggler-icon"></span>
</button>
@ -53,12 +52,14 @@
<li class="nav-item">
<a class="nav-link" href="index.php">Liste <span class="sr-only">(current)</span></a>
</li>
<?php if ($boolSuperAdmin): ?>
<li class="nav-item">
<a class="nav-link" href="configuration.php">Konfiguration </a>
</li>
<li class="nav-item">
<a class="nav-link" href="geocoding.php">Addressen ermitteln </a>
</li>
<?php endif; ?>
<li class="nav-item active">
<a class="nav-link" href="export.php">Export </a>
</li>
@ -66,7 +67,6 @@
<a class="nav-link" href="password.php">Passwort ändern </a>
</li>
</ul>
<div>
<ul class="navbar-nav mr-auto right">
<li class="nav-item">

View File

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

View File

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

View File

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

View File

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

View File

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