Compare commits
19 Commits
b55a7f9bc9
...
ideenmelde
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4a8cef3f8 | ||
|
|
34af6b6f75 | ||
|
|
824aa44fe2 | ||
|
|
bb53850c3e | ||
|
|
7c658e28f9 | ||
|
|
c2f8c93ef3 | ||
|
|
8b6632d36f | ||
|
|
f8b8feee5b | ||
|
|
f695c98fc3 | ||
|
|
29496004dc | ||
|
|
0a7db03af1 | ||
|
|
c1c4151300 | ||
|
|
11575edc75 | ||
|
|
1f44c21d69 | ||
|
|
d918e97203 | ||
|
|
1fec7c7710 | ||
|
|
b8671a54a8 | ||
|
|
b746e13d3a | ||
|
|
183c570444 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,3 +3,5 @@
|
||||
/admin/shape/
|
||||
/images/
|
||||
config.db.php
|
||||
.DS_Store
|
||||
|
||||
|
||||
@@ -23,6 +23,10 @@ Folgende Funktionalitäten können an- bzw. abgeschaltet werden:
|
||||
* Hochladen von Bildern (erlaubt jpg/gif/png)
|
||||
* Kommentare
|
||||
|
||||
### Karten
|
||||
|
||||
Als Tile-Server für die Karten wird Mapbox (https://mapbox.com) verwendet. Hierfür ist eine Api-Key notwendig. Bis zu 200.000 Tile können pro Monate kostenlos benutzt werden.
|
||||
|
||||
### Reverse Georeferenzierung
|
||||
|
||||
Aus den übermittelten Geodaten wird die Adresse ermittelt. Dazu wird der Dienst https://locationiq.com verwendet. Die Adressen werden nur im Backend angezeigt, um die Auswertung der Daten zu erleichtern.
|
||||
@@ -32,6 +36,10 @@ Für locationiq.com muss ein Api-Key beantragt werden. Dieser ist in der Datei /
|
||||
|
||||
## Versionen
|
||||
|
||||
### Version 3.0
|
||||
|
||||
* Erweiterung auf NRW-Kreise und kreisfreie Städte
|
||||
|
||||
### Version 2.2
|
||||
|
||||
* Behandlung der Eingaben mit Zeilenumbruch, Anführungszeichen und Hochkommas
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?php
|
||||
exit();
|
||||
// ist veraltet, muss noch angepasst werden.
|
||||
session_start();
|
||||
$strLoginName=(isset($_SESSION['user'])) ? $_SESSION['user'] : "" ;
|
||||
$boolLogin = (!empty($strLoginName));
|
||||
@@ -7,8 +9,6 @@
|
||||
}
|
||||
|
||||
date_default_timezone_set('UTC');
|
||||
const DB_FILENAME = "../db/locations.db";
|
||||
$db = new SQLite3(DB_FILENAME);
|
||||
|
||||
$strSQL="ALTER TABLE location ADD COLUMN defect INTEGER";
|
||||
$db->exec($strSQL);
|
||||
@@ -22,3 +22,10 @@ $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;
|
||||
|
||||
|
||||
@@ -6,7 +6,13 @@
|
||||
header("Location: login.php");
|
||||
}
|
||||
|
||||
$dbFilename = "../db/locations.db";
|
||||
if (isset($_SESSION['superadmin'])) {
|
||||
$boolSuperAdmin = $_SESSION['superadmin']==true;
|
||||
} else {
|
||||
$boolSuperAdmin=false;
|
||||
}
|
||||
|
||||
|
||||
require_once("../config.php");
|
||||
$boolError=false;
|
||||
?>
|
||||
@@ -72,7 +78,7 @@
|
||||
<div class="row">
|
||||
<div class="col-md-7 col-lg-7">
|
||||
|
||||
|
||||
<?php if ($boolSuperAdmin): ?>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3>Konfiguration</h3>
|
||||
@@ -87,7 +93,9 @@
|
||||
<input type="checkbox" id="defect" name="defect" <?= ($boolDefect) ? "checked=\"checked\"" :"" ?> >
|
||||
<label for="defect">Mängelkategrien einblenden</label><br>
|
||||
<input type="checkbox" id="userinfo" name="userinfo" <?= ($boolUserinfo) ? "checked=\"checked\"" :"" ?> >
|
||||
<label for="userinfo">Nutzerinformation (Alter/Verkehrsmittel)</label>
|
||||
<label for="userinfo">Nutzerinformation (Alter/Verkehrsmittel)</label><br>
|
||||
<input type="checkbox" id="districtSelection" name="districtSelection" <?= ($boolDistrictSelection) ? "checked=\"checked\"" :"" ?> >
|
||||
<label for="districtSelection">Auswahl Kreise in Navigation</label>
|
||||
<br>
|
||||
<label class="leftlabel">Uplaod-Pfad:</label>
|
||||
<input type="text" class="wide" name="uploaddir" id="uploaddir" value="<?=$uploaddir?>">
|
||||
@@ -128,7 +136,26 @@
|
||||
<input type="hidden" name="csrf" value="<?=$_SESSION['csrf_token']?>">
|
||||
<input type="submit" class="btn btn-primary" value="Konfiguration ändern">
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<br><br><br>
|
||||
|
||||
<h2>Auswahl Kreise und kreisfreie Städte</h2>
|
||||
<form method="post" id="districtform" action="district_chk.php">
|
||||
<?php
|
||||
$strSQL="select * from district order by district";
|
||||
$result = $db->query($strSQL);
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$strChecked= ($row['active']==1) ? "checked='checked'" : "";
|
||||
$strValue=$row['active'];
|
||||
$strDistrict=$row['district'];
|
||||
echo "<input type='checkbox' $strChecked id='$strDistrict' name='$strDistrict' value='$strValue'> ";
|
||||
echo "<label for='$strDistrict'>".$row['title']."</label><br>\n";
|
||||
}
|
||||
?>
|
||||
<br>
|
||||
<input type="hidden" name="csrf" value="<?=$_SESSION['csrf_token']?>">
|
||||
<input type="submit" class="btn btn-primary" value="Auswahl ändern">
|
||||
</form>
|
||||
</div>
|
||||
</div> <!-- row -->
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
if (!$boolLogin) {
|
||||
header("Location: login.php");
|
||||
}
|
||||
$dbFilename="../db/locations.db";
|
||||
require("../config.php");
|
||||
|
||||
if($_POST['csrf'] !== $_SESSION['csrf_token']) {
|
||||
@@ -16,6 +15,7 @@
|
||||
$boolUpload = (isset($_POST['fileupload'])) ? "1" : "0";
|
||||
$boolUserinfo = (isset($_POST['userinfo'])) ? "1" : "0";
|
||||
$boolDefect = (isset($_POST['defect'])) ? "1" : "0";
|
||||
$boolDistrictSelection = (isset($_POST['districtSelection'])) ? "1" : "0";
|
||||
|
||||
|
||||
$strUploaddir = $_POST['uploaddir'];
|
||||
@@ -43,7 +43,7 @@
|
||||
$db->query("UPDATE `config` SET `value`= '$boolUserinfo' WHERE `key`='boolUserinfo'");
|
||||
$db->query("UPDATE `config` SET `value`= '$boolDefect' WHERE `key`='boolDefect'");
|
||||
$db->query("UPDATE `config` SET `value`= '$boolUpload' WHERE `key`='boolUpload'");
|
||||
|
||||
$db->query("UPDATE `config` SET `value`= '$boolDistrictSelection' WHERE `key`='boolDistrictSelection'");
|
||||
header("Location: configuration.php");
|
||||
|
||||
|
||||
|
||||
29
admin/district_chk.php
Normal file
29
admin/district_chk.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
session_start();
|
||||
$strLoginName=(isset($_SESSION['user'])) ? $_SESSION['user'] : "" ;
|
||||
$boolLogin = (!empty($strLoginName));
|
||||
if (!$boolLogin) {
|
||||
header("Location: login.php");
|
||||
}
|
||||
require("../config.php");
|
||||
|
||||
if($_POST['csrf'] !== $_SESSION['csrf_token']) {
|
||||
die("Ungültiger Token");
|
||||
}
|
||||
|
||||
$strSQL="SELECT * FROM district";
|
||||
$result = $db->query($strSQL);
|
||||
$numCounter=1;
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$strDistrict=$row['district'];
|
||||
if (isset($_POST[$strDistrict])) {
|
||||
$db->query("UPDATE `district` SET `active`= '1' WHERE `district`='$strDistrict'");
|
||||
} else {
|
||||
$db->query("UPDATE `district` SET `active`= '0' WHERE `district`='$strDistrict'");
|
||||
}
|
||||
}
|
||||
header("Location: configuration.php");
|
||||
//print_r($_POST);
|
||||
|
||||
|
||||
?>
|
||||
@@ -15,8 +15,14 @@
|
||||
if (!$boolLogin) {
|
||||
header("Location: login.php");
|
||||
}
|
||||
$strDistrict=$_SESSION['district'];
|
||||
if (isset($_SESSION['superadmin'])) {
|
||||
$boolSuperAdmin = $_SESSION['superadmin']==true;
|
||||
} else {
|
||||
$boolSuperAdmin=false;
|
||||
}
|
||||
$sqlDistrict = ($boolSuperAdmin) ? "1" : "l.district='$strDistrict'";
|
||||
|
||||
require("../config.db.php");
|
||||
require ("../config.php");
|
||||
|
||||
// Set headers to make the browser download the results as a csv file
|
||||
@@ -28,7 +34,9 @@
|
||||
// Query
|
||||
|
||||
$strSQL="SELECT l.id as lid,l.*,adr.*
|
||||
FROM location l LEFT JOIN address adr ON l.id=adr.loc_id ORDER BY created_at ASC";
|
||||
FROM location l LEFT JOIN address adr ON l.id=adr.loc_id
|
||||
WHERE $sqlDistrict
|
||||
ORDER BY created_at ASC";
|
||||
$query = $db->query($strSQL);
|
||||
|
||||
// Fetch the first row
|
||||
|
||||
@@ -15,6 +15,13 @@
|
||||
if (!$boolLogin) {
|
||||
header("Location: login.php");
|
||||
}
|
||||
|
||||
|
||||
|
||||
$strDistrict=$_SESSION['district'];
|
||||
$sqlDistrict = ($boolSuperAdmin) ? "1" : "l.district='$strDistrict'";
|
||||
|
||||
|
||||
require ("../config.php");
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
@@ -37,7 +44,7 @@
|
||||
<body>
|
||||
<!-- Navbar -->
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
<a class="navbar-brand" href="#">Administration <?= $strTitle ?></a>
|
||||
<a class="navbar-brand" href="#">Administration <?= $strTitle ?> <?=$strDistrictTitle?></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>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
if (!$boolLogin) {
|
||||
header("Location: login.php");
|
||||
}
|
||||
require_once("../config.db.php");
|
||||
$strDistrict=$_SESSION['district'];
|
||||
require ("../config.php");
|
||||
require ("../lib/geocoding.php");
|
||||
$boolRefresh = (isset($_GET['refresh']) & $_GET['refresh']==1);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* E-Mail: info@hupfeld-software.de
|
||||
* Version: 1.0
|
||||
* Datum: 18.05.2021
|
||||
* zuletzte bearbeitet: 21.02.2024
|
||||
******************************** */
|
||||
|
||||
|
||||
@@ -15,19 +16,31 @@
|
||||
if (!$boolLogin) {
|
||||
header("Location: login.php");
|
||||
}
|
||||
$strDistrict=$_SESSION['district'];
|
||||
|
||||
|
||||
if (isset($_SESSION['superadmin'])) {
|
||||
$boolSuperAdmin = $_SESSION['superadmin']==true;
|
||||
} else {
|
||||
$boolSuperAdmin=false;
|
||||
}
|
||||
|
||||
$dbFilename = "../db/locations.db";
|
||||
include("../config.php");
|
||||
$boolShowmap=false;
|
||||
|
||||
$sqlDistrict = ($boolSuperAdmin) ? "1" : "l.district='$strDistrict'";
|
||||
|
||||
// Eintag löschen
|
||||
if (isset($_GET['delid'])) {
|
||||
if($_GET['csrf'] !== $_SESSION['csrf_token']) {
|
||||
die("Ungültiger Token");
|
||||
}
|
||||
$numDelete = (int)$_GET['delid'];
|
||||
|
||||
$stmt = $db->prepare("DELETE FROM location WHERE id = :id");
|
||||
|
||||
$stmt = $db->prepare("DELETE FROM location WHERE id = :id AND district=:district");
|
||||
$stmt->bindValue(":id",$numDelete);
|
||||
$stmt->bindValue(":district",$strDistrict);
|
||||
$stmt->execute();
|
||||
|
||||
$stmt = $db->prepare("DELETE FROM comment WHERE loc_id= :loc_id");
|
||||
@@ -48,6 +61,7 @@
|
||||
$stmt->execute();
|
||||
}
|
||||
|
||||
// Kommentar löschen
|
||||
if (isset($_GET['delcid'])) {
|
||||
if($_GET['csrf'] !== $_SESSION['csrf_token']) {
|
||||
die("Ungültiger Token");
|
||||
@@ -58,7 +72,7 @@
|
||||
$stmt->execute();
|
||||
}
|
||||
|
||||
|
||||
// Bild löschen
|
||||
if (isset($_GET['delfid'])) {
|
||||
if($_GET['csrf'] !== $_SESSION['csrf_token']) {
|
||||
die("Ungültiger Token");
|
||||
@@ -79,6 +93,7 @@
|
||||
|
||||
}
|
||||
|
||||
// Karte zeigen
|
||||
if (isset($_GET['showmap'])) {
|
||||
$numShowmap=(int)$_GET['showmap'];
|
||||
$boolShowmap=$numShowmap==1;
|
||||
@@ -126,7 +141,7 @@
|
||||
|
||||
<!-- Navbar -->
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
<a class="navbar-brand" href="#">Administration NRW Meldeportal</a>
|
||||
<a class="navbar-brand" href="#">Administration <?=$strTitle?> <?=$strDistrictTitle?></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>
|
||||
@@ -163,7 +178,9 @@
|
||||
<div class="container-fluid" style="margin-top:5em;">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr><th>id</th><th>Username</th>
|
||||
<tr><th>id</th>
|
||||
<?= ($boolSuperAdmin) ? "<th>Kreis</th>" : "" ?>
|
||||
<th>Username</th>
|
||||
<?= ($boolUserinfo) ? "<th>Alter</th><th>Transport</th>" : "" ?>
|
||||
<th>Topic</th>
|
||||
<th>Beschreibung</th>
|
||||
@@ -181,12 +198,16 @@
|
||||
<?php
|
||||
$strScript="";
|
||||
//$strSQL="SELECT * FROM location ORDER BY created_at DESC";
|
||||
$strSQL="SELECT l.id as lid,l.*,adr.* FROM location l LEFT JOIN address adr ON l.id=adr.loc_id ORDER BY created_at ASC";
|
||||
$strSQL="SELECT l.id as lid,l.*,adr.*
|
||||
FROM location l LEFT JOIN address adr ON l.id=adr.loc_id
|
||||
WHERE $sqlDistrict
|
||||
ORDER BY created_at ASC";
|
||||
$result = $db->query($strSQL);
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$id = $row['lid'];
|
||||
echo "<tr>";
|
||||
echo "<td>".$id."</td>";
|
||||
echo ($boolSuperAdmin) ? "<td>".$row['district']."</td>" : "";
|
||||
echo "<td>". stripslashes($row['username']) ."</td>";
|
||||
echo ($boolUserinfo) ? "<td>".$row['age']."</td><td>".$row['transport']."</td>" : "";
|
||||
echo "<td>".$arrIcon[$row['topic']]." ".$arrTopic[$row['topic']]."</td>";
|
||||
|
||||
@@ -6,11 +6,17 @@
|
||||
* E-Mail: info@hupfeld-software.de
|
||||
* Version: 1.0
|
||||
* Datum: 18.05.2021
|
||||
* zuletzt bearbeitet: 21.02.2024
|
||||
******************************** */
|
||||
|
||||
|
||||
|
||||
$dbFilename = "../db/locations.db";
|
||||
// Starte die Session
|
||||
session_start();
|
||||
if (isset($_SESSION['district'])) {
|
||||
$strDistrict=$_SESSION['district'];
|
||||
}
|
||||
else {
|
||||
$strDistrict="";
|
||||
}
|
||||
require_once("../config.php");
|
||||
$boolLogin=true;
|
||||
|
||||
@@ -18,13 +24,15 @@ $boolLogin=true;
|
||||
if (isset($_POST['login']) && isset($_POST['password'])) {
|
||||
$strUser = trim($_POST['login']);
|
||||
$strPassword = trim($_POST['password']);
|
||||
$strSQL = "SELECT username,passwordhash FROM user WHERE username='$strUser'";
|
||||
$strSQL = "SELECT username,passwordhash,district,role FROM user WHERE username='$strUser'";
|
||||
$result = $db->query($strSQL);
|
||||
if ($row=$result->fetch(PDO::FETCH_ASSOC)) {
|
||||
if (password_verify($strPassword,$row['passwordhash'])) {
|
||||
session_start();
|
||||
$boolOk = $strDistrict==$row['district'] || $row['role']=="admin";
|
||||
if (password_verify($strPassword,$row['passwordhash']) && $boolOk) {
|
||||
$_SESSION['user']=$strUser;
|
||||
$_SESSION['csrf_token'] = uniqid('', true);
|
||||
$_SESSION['superadmin'] = $row['role']=="admin";
|
||||
$db->query("UPDATE `user` SET `lastlogin`= NOW() WHERE `username`='$strUser'");
|
||||
header ("Location: index.php");
|
||||
} else {
|
||||
$boolLogin=false;
|
||||
@@ -34,8 +42,6 @@ $boolLogin=true;
|
||||
$boolLogin=false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
@@ -51,7 +57,7 @@ $boolLogin=true;
|
||||
|
||||
<!-- Navbar -->
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
<a class="navbar-brand" href="#">ADFC Meldeportal</a>
|
||||
<a class="navbar-brand" href="#"><?=$strTitle?> <?=$strDistrictTitle?></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>
|
||||
@@ -60,6 +66,9 @@ $boolLogin=true;
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../index.php?ref=1">Karte</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../liste.php">Liste</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -75,7 +84,6 @@ $boolLogin=true;
|
||||
</div> <br>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h2>Login</h2>
|
||||
@@ -89,6 +97,7 @@ $boolLogin=true;
|
||||
<div class="form-group">
|
||||
<label for="password">Password</label>
|
||||
<input type="password" name="password" class="form-control" id="password" placeholder="Passwort" required>
|
||||
<input type="hidden" name="district" value="<?=$strDistrict?>">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Absenden</button>
|
||||
</form>
|
||||
@@ -97,12 +106,9 @@ $boolLogin=true;
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="margin-top:5em;">
|
||||
<a class="btn btn-primary text-white" href="../index.php?ref=1">zurück</a>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +1,11 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
if (isset($_SESSION['district'])) {
|
||||
$strDistrict=$_SESSION['district'];
|
||||
}
|
||||
session_destroy();
|
||||
session_start();
|
||||
$_SESSION['district']=$strDistrict;
|
||||
|
||||
header ("Location: ../index.php");
|
||||
@@ -6,27 +6,16 @@
|
||||
if (!$boolLogin) {
|
||||
header("Location: login.php");
|
||||
}
|
||||
|
||||
$dbFilename = "../db/locations.db";
|
||||
$strDistrict=$_SESSION['district'];
|
||||
if (isset($_SESSION['superadmin'])) {
|
||||
$boolSuperAdmin = $_SESSION['superadmin']==true;
|
||||
} else {
|
||||
$boolSuperAdmin=false;
|
||||
}
|
||||
include("../config.php");
|
||||
$sqlDistrict = ($boolSuperAdmin) ? "1" : "l.district='$strDistrict'";
|
||||
|
||||
|
||||
|
||||
$arrTopic = array (
|
||||
1 => "Fußverkehr",
|
||||
2 => "Radverkehr",
|
||||
3 => "Bus und Bahn",
|
||||
4 => "Pkw-Verkehr",
|
||||
5 => "Lkw-Verkehr"
|
||||
);
|
||||
|
||||
$arrIcon = array (
|
||||
1 => "<i class='fa fa-male'></i>",
|
||||
2 => "<i class='fa fa-bicycle'></i>",
|
||||
3 => "<i class='fa fa-train'></i>",
|
||||
4 => "<i class='fa fa-car'></i>",
|
||||
5 => "<i class='fa fa-truck'></i>"
|
||||
);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
@@ -50,12 +39,11 @@
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="container-fluid">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr><th>id</th><th>Username</th>
|
||||
<tr><th>id</th>
|
||||
<th>Username</th>
|
||||
<?= ($boolUserinfo) ? "<th>Alter</th><th>Transport</th>" : ""; ?>
|
||||
<th>Topic</th>
|
||||
<th>Beschreibung</th>
|
||||
@@ -70,7 +58,10 @@
|
||||
|
||||
<?php
|
||||
$strScript="";
|
||||
$strSQL="SELECT l.id as lid,l.*,adr.* FROM location l LEFT JOIN address adr ON l.id=adr.loc_id ORDER BY city,postcode,suburb,hamlet,road ASC";
|
||||
$strSQL="SELECT l.id as lid,l.*,adr.*
|
||||
FROM location l LEFT JOIN address adr ON l.id=adr.loc_id
|
||||
WHERE $sqlDistrict
|
||||
ORDER BY city,postcode,suburb,hamlet,road ASC";
|
||||
$result = $db->query($strSQL);
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$id = $row['lid'];
|
||||
@@ -114,7 +105,6 @@
|
||||
$strScript.="var mymap_".$id." = L.map(map_".$id.").setView([".$row['lat'].", ".$row['lng']."], 16);\n";
|
||||
$strScript.="L.tileLayer(url, {maxZoom: 18,minZoom:12,attribution: attribution,id: 'mapbox/streets-v11',tileSize: 512,zoomOffset: -1}).addTo(mymap_".$id.")\n";
|
||||
$strScript.="L.marker([".$row['lat'].", ".$row['lng']."], { icon: infoMarker } ).addTo(mymap_".$id.")\n\n";
|
||||
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
@@ -122,17 +112,15 @@
|
||||
<a class="btn btn-primary" href="../index.php?ref=1">zurück</a>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<script>
|
||||
$( document ).ready(function() {
|
||||
|
||||
|
||||
var url = 'https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=<?=$mapbox_key?>';
|
||||
var attribution = 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
|
||||
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
|
||||
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>';
|
||||
var infoMarker = L.AwesomeMarkers.icon({icon: 'info', prefix: 'fa', markerColor: 'orange'});
|
||||
|
||||
|
||||
<?= $strScript ?>
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
$dbFilename="../db/locations.db";
|
||||
|
||||
require ("../config.php");
|
||||
|
||||
if ($boolComment){
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
$dbFilename="../db/locations.db";
|
||||
|
||||
require_once("../config.php");
|
||||
|
||||
$mode = trim($_POST['mode']);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
$dbFilename="../db/locations.db";
|
||||
require_once("../config.php");
|
||||
require_once("../lib/functions.php");
|
||||
|
||||
|
||||
21
config.php
21
config.php
@@ -20,21 +20,9 @@ while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
case "uploaddir" :
|
||||
$uploaddir=$row['value'];
|
||||
break;
|
||||
case "stadt" :
|
||||
$strStadt=$row['value'];
|
||||
break;
|
||||
case "title" :
|
||||
$strTitle=$row['value'];
|
||||
break;
|
||||
case "fileGeojson":
|
||||
$fileGeojson=$row['value'];
|
||||
break;
|
||||
case "InfoLat":
|
||||
$numInfoLat=$row['value'];
|
||||
break;
|
||||
case "InfoLng":
|
||||
$numInfoLng=$row['value'];
|
||||
break;
|
||||
case "logo":
|
||||
$strLogo=$row['value'];
|
||||
break;
|
||||
@@ -68,7 +56,9 @@ while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
case "boolUserinfo":
|
||||
$boolUserinfo = ($row['value']=="1");
|
||||
break;
|
||||
|
||||
case "boolDistrictSelection":
|
||||
$boolDistrictSelection = ($row['value']=="1");
|
||||
break;
|
||||
default: ;
|
||||
//echo "Fehler bei ".$row['key'];
|
||||
// Ende Lokalisierung
|
||||
@@ -82,7 +72,10 @@ $result= $db->prepare("SELECT count(*) FROM district WHERE district=:district");
|
||||
$result->bindParam(":district",$strDistrict);
|
||||
$result->execute();
|
||||
if ($row=$result->fetch(PDO::FETCH_NUM)) {
|
||||
if ($row[0]==0) $strDistrict=""; //default setzten
|
||||
if ($row[0]==0) {
|
||||
$strDistrict="unkown"; //default setzten
|
||||
$strDistrictTitle="Unbekannt";
|
||||
}
|
||||
}
|
||||
|
||||
// Spezifische Konfiguration für Districtt
|
||||
|
||||
@@ -93,3 +93,8 @@ i.wa {
|
||||
z-index: 1000;
|
||||
display:none;
|
||||
}
|
||||
|
||||
.jumbotron {
|
||||
background-color:orange;
|
||||
}
|
||||
a, a:active, a:visited, a:active {color:orange;}
|
||||
@@ -1,6 +1,9 @@
|
||||
<?php
|
||||
session_start();
|
||||
require ("config.php")
|
||||
if (!isset($_SESSION['district'])) { header("Location: start.php");}
|
||||
$strDistrict=$_SESSION['district'];
|
||||
require("config.php");
|
||||
if ($strDistict=="unkown") { header("Location: start.php");}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
@@ -18,7 +21,7 @@
|
||||
|
||||
<!-- Navbar -->
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
<a class="navbar-brand" href="#"><?=$strTitle?></a>
|
||||
<a class="navbar-brand" href="#"><?=$strTitle?> <?=$strDistrictTitle?></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>
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
dev-unfallkarte:
|
||||
dev-ideenmelder:
|
||||
image: php81:v1
|
||||
container_name: dev-unfallkarte
|
||||
container_name: dev-ideenmelder
|
||||
volumes:
|
||||
- ./:/var/www/html
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.dev-unfallkarte.entrypoints=https"
|
||||
- "traefik.http.routers.dev-unfallkarte.rule=Host(`unfallkarte.hpadm.de`)"
|
||||
- "traefik.http.routers.dev-unfallkarte.tls=true"
|
||||
- "traefik.http.routers.dev-unfallkarte.tls.certresolver=http"
|
||||
- "traefik.http.routers.dev-unfallkarte.middlewares=default@file"
|
||||
- "traefik.http.routers.dev-unfallkarte.service=dev-unfallkarte"
|
||||
- "traefik.http.services.dev-unfallkarte.loadbalancer.server.port=80"
|
||||
- "traefik.http.routers.dev-ideenmelder.entrypoints=https"
|
||||
- "traefik.http.routers.dev-ideenmelder.rule=Host(`nrw-ideenmelder.hpadm.de`)"
|
||||
- "traefik.http.routers.dev-ideenmelder.tls=true"
|
||||
- "traefik.http.routers.dev-ideenmelder.tls.certresolver=http"
|
||||
- "traefik.http.routers.dev-ideenmelder.middlewares=default@file"
|
||||
- "traefik.http.routers.dev-ideenmelder.service=dev-ideenmelder"
|
||||
- "traefik.http.services.dev-ideenmelder.loadbalancer.server.port=80"
|
||||
- "traefik.docker.network=proxy"
|
||||
networks:
|
||||
- default
|
||||
- proxy
|
||||
restart: always
|
||||
|
||||
dev-unfallkarte-db:
|
||||
dev-ideenmelder-db:
|
||||
image: mariadb
|
||||
container_name: dev-unfallkarte-db
|
||||
container_name: dev-ideenmelder-db
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=geheim #SQL root Passwort eingeben
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once("config.php");
|
||||
if (!isset($_SESSION['district'])) { header("Location: start.php");}
|
||||
$strDistrict=$_SESSION['district'];
|
||||
require("config.php");
|
||||
if ($strDistict=="unkown") { header("Location: start.php");}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
@@ -18,7 +21,7 @@
|
||||
|
||||
<!-- Navbar -->
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
<a class="navbar-brand" href="#"><?=$strTitle?></a>
|
||||
<a class="navbar-brand" href="#"><?=$strTitle?> <?=$strDistrictTitle?></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>
|
||||
|
||||
33
index.php
33
index.php
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
/** *****************************
|
||||
/*******************************
|
||||
* Ideenmelder
|
||||
* Autor: Walter Hupfeld, Hamm
|
||||
* E-Mail: info@hupfeld-software.de
|
||||
@@ -8,11 +7,6 @@
|
||||
* Datum: 16.02.2024
|
||||
******************************** */
|
||||
|
||||
/*
|
||||
if (!file_exists("db/locations.db")) {
|
||||
header("Location: setup.php");
|
||||
}
|
||||
*/
|
||||
// Starte die Session
|
||||
session_start();
|
||||
if (isset($_GET['d'])) {
|
||||
@@ -24,8 +18,8 @@
|
||||
else {
|
||||
header("Location: start.php");
|
||||
}
|
||||
|
||||
require("config.php");
|
||||
if ($strDistrict=="unkown") { header("Location: start.php");}
|
||||
require_once("lib/functions.php");
|
||||
|
||||
$ref=(isset($_GET['ref']) && ($_GET['ref']==1));
|
||||
@@ -33,17 +27,16 @@
|
||||
$strIntro ="<h4>".$strTitle."</h4>";
|
||||
$strIntro .= nl2br2($strIntroText);
|
||||
|
||||
|
||||
$strSQL="SELECT loc.*,f.filename
|
||||
$result= $db->prepare("SELECT loc.*,f.filename
|
||||
FROM location loc LEFT JOIN files f ON loc.id=f.loc_id
|
||||
WHERE loc.district='$strDistrict'";
|
||||
|
||||
WHERE loc.district=:district");
|
||||
$result->bindParam(":district",$strDistrict);
|
||||
$result->execute();
|
||||
/* Für die Auswertung nur bestimmte Kategorien anzeigen
|
||||
$numDefect="(6,8,21)";
|
||||
$strSQL="SELECT loc.*,f.filename FROM location loc LEFT JOIN files f ON loc.id=f.loc_id WHERE defect in ".$numDefect;
|
||||
*/
|
||||
|
||||
$result = $db->query($strSQL);
|
||||
$arrMarker = array();
|
||||
$arrDescription = array();
|
||||
$id=0;
|
||||
@@ -91,14 +84,14 @@
|
||||
<link rel="stylesheet" href="css/style.css" />
|
||||
<link rel="stylesheet" href="css/lightbox.css" />
|
||||
|
||||
<title>Ideenmelder</title>
|
||||
<title><?=$strTitle?></title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!-- Navbar -->
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
<a class="navbar-brand" href="#"><?= $strTitle ?></a>
|
||||
<a class="navbar-brand" href="#"><?= $strTitle ?> <?=$strDistrictTitle?></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>
|
||||
@@ -111,6 +104,7 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="liste.php">Liste</a>
|
||||
</li>
|
||||
<?php if ($boolDistrictSelection): ?>
|
||||
<!-- District -->
|
||||
<form method="GET" action="index.php">
|
||||
<select name="d" style="float:left;margin-top:0.5em;margin-right:0.5em;" onchange="this.form.submit()">
|
||||
@@ -120,6 +114,7 @@
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -132,7 +127,7 @@
|
||||
<a class="nav-link" href="datenschutz.php">Datenschutzerklärung</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="admin/login.php?d=".$strDistrict>Login</a>
|
||||
<a class="nav-link" href="admin/login.php">Login</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -142,10 +137,9 @@
|
||||
|
||||
<div class="container-fluid" style="margin-top: 4em;">
|
||||
<div class="row">
|
||||
|
||||
<nav class="col-md-2 d-none d-md-block bg-light sidebar">
|
||||
<div class="sidebar-sticky">
|
||||
<img class="logo" src="<?=$strLogo?>" alt="Logo" >
|
||||
<a href="start.php"><img class="logo" src="<?=$strLogo?>" alt="Logo" ></a>
|
||||
<ul class="nav flex-column">
|
||||
<?php
|
||||
foreach ($arrTopic as $key=>$topic) {
|
||||
@@ -177,8 +171,6 @@
|
||||
?>
|
||||
<div id="loader"><img src="css/images/ajax-loader.gif"></div>
|
||||
<script>
|
||||
|
||||
|
||||
// Map ----------------------------------------------------------------------
|
||||
|
||||
var mymap = L.map('mapid').setView([<?=$numInfoLat ?>, <?=$numInfoLng ?>], <?=$numZoom ?>);
|
||||
@@ -489,7 +481,6 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -109,7 +109,7 @@ function fillAddressTable($db,$limit=20) {
|
||||
}
|
||||
$strTable .= "</tr>";
|
||||
|
||||
sleep(0.5); //api restriction
|
||||
sleep(1); //api restriction
|
||||
writeAddress($db,$id,$data);
|
||||
}
|
||||
}
|
||||
|
||||
17
liste.php
17
liste.php
@@ -9,18 +9,11 @@
|
||||
******************************** */
|
||||
|
||||
session_start();
|
||||
if (isset($_GET['d'])) {
|
||||
$strDistrict=$_GET['d'];
|
||||
$_SESSION['district'] = $strDistrict;
|
||||
} else if (isset($_SESSION['district']))
|
||||
{
|
||||
if (!isset($_SESSION['district'])) { header("Location: start.php");}
|
||||
$strDistrict=$_SESSION['district'];
|
||||
}
|
||||
else {
|
||||
header("Location: start.php");
|
||||
}
|
||||
echo $strDistrict;
|
||||
require("config.php");
|
||||
if ($strDistrict=="unkown") { header("Location: start.php");}
|
||||
?>
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
@@ -65,7 +58,7 @@
|
||||
<body>
|
||||
<!-- Navbar -->
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
<a class="navbar-brand" href="#"><?= $strTitle ?></a>
|
||||
<a class="navbar-brand" href="#"><?= $strTitle ?> <?=$strDistrictTitle?></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>
|
||||
@@ -78,6 +71,7 @@
|
||||
<a class="nav-link" href="liste.php">Liste <span class="sr-only">(current)</span></a>
|
||||
</li>
|
||||
<!-- District -->
|
||||
<?php if ($boolDistrictSelection): ?>
|
||||
<form method="GET" action="index.php">
|
||||
<select name="d" style="float:left;margin-top:0.5em;margin-right:0.5em;" onchange="this.form.submit()">
|
||||
<?php foreach ($arrDistrict as $key => $strMTitle):
|
||||
@@ -86,6 +80,7 @@
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
FROM php:8.1-apache
|
||||
RUN apt-get update && docker-php-ext-install pdo_mysql calendar mysqli
|
||||
RUN apt-get update && docker-php-ext-install pdo_mysql calendar mysqli zip
|
||||
|
||||
RUN a2enmod rewrite headers
|
||||
|
||||
|
||||
51
setup.php
51
setup.php
@@ -8,18 +8,12 @@
|
||||
* Datum: 18.05.2021
|
||||
******************************** */
|
||||
|
||||
|
||||
$dbFilename = "db/locations.db";
|
||||
exit();
|
||||
// noch nicht vollständig angepasst
|
||||
require("config.db.php");
|
||||
$boolError=false;
|
||||
|
||||
|
||||
|
||||
if (file_exists("db/locations.php")) {
|
||||
die ("Datenbank existiert bereits.");
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
@@ -32,7 +26,6 @@
|
||||
.leftlabel { width: 10em;}
|
||||
input[type="text"] { width: 18em;}
|
||||
input.wide {width: 24em;}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -79,9 +72,9 @@
|
||||
* Datenbank anlegen
|
||||
*
|
||||
************************************************** */
|
||||
|
||||
$boolError=true;
|
||||
echo "Datenbank anlegen: ";
|
||||
if (!$boolError && !file_exists("db/locations.db")) {
|
||||
if (!$boolError) {
|
||||
require("admin/create_database.php");
|
||||
echo "Datenbank angelegt";
|
||||
} else {
|
||||
@@ -108,7 +101,7 @@ require("config.php");
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<!--
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3>Dateneingabe aktivieren</h3>
|
||||
@@ -119,7 +112,7 @@ require("config.php");
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
-->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3>Konfiguration</h3>
|
||||
@@ -142,35 +135,6 @@ require("config.php");
|
||||
</div>
|
||||
<br>
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3>Karteninfo</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h4>Stadt oder Kreis</h4>
|
||||
<label class="leftlabel">Stadt/Kreis: </label>
|
||||
<input type="text" name="district" id="district" value="<?=$strStadt?>" required >
|
||||
<h4>Kartenzentrum</h4>
|
||||
<div class="small">Hier liegt das Zentrum der Karte und es erscheint der Info-Marker.</div>
|
||||
<label class="leftlabel">Latitude:</label><input type="text" name="lat" id="lat" value="<?=$numInfoLat?>" required><br>
|
||||
<label class="leftlabel">Longitude:</label><input type="text" name="lng" id="lng" value="<?=$numInfoLng?>" required><br>
|
||||
<div class="small">Zoom-Faktor beim Start der Karte.</div>
|
||||
<label class="leftlabel">Startzoom:</label><input type="text" name="zoom" id="zoom" value="<?=$numZoom?>" required>
|
||||
|
||||
|
||||
<h4>GeoJson</h4>
|
||||
<p>Die Datei kann man von folgender Adresse laden und ins Vezeichnis /geojson kopieren:
|
||||
<a href="https://public.opendatasoft.com/explore/dataset/landkreise-in-germany/export/">public.opendatasoft.com</a>
|
||||
</p>
|
||||
<label class="leftlabel">GeoJson-Datei: </label><input type="text" name="geojson" id="geojson" value="<?=$fileGeojson?>" required>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3>Anbieterinformation</h3>
|
||||
@@ -226,4 +190,3 @@ require("config.php");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* Datum: 18.05.2021
|
||||
******************************** */
|
||||
|
||||
|
||||
exit();
|
||||
require("config.db.php");
|
||||
|
||||
$db->query("TRUNCATE config");
|
||||
|
||||
24
start.php
24
start.php
@@ -14,17 +14,8 @@
|
||||
|
||||
<link rel="stylesheet" href="css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="css/style.css" />
|
||||
<link rel="stylesheet" href="vendor/DataTables/datatable.min.css">
|
||||
<link rel="stylesheet" href="vendor/DataTables/DataTables-1.10.21/css/dataTables.bootstrap4.min.css">
|
||||
|
||||
|
||||
<title><?=$strTitle?></title>
|
||||
<script src="js/jquery.min.js"></script>
|
||||
<script src="vendor/DataTables/datatables.js"></script>
|
||||
<script src="vendor/DataTables/DataTables-1.10.21/js/dataTables.bootstrap4.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@@ -47,13 +38,22 @@
|
||||
</form>
|
||||
</div>
|
||||
<p style="clear:both";>
|
||||
<h3>Kreise und kreisfreie Städte</h3>
|
||||
<div>
|
||||
<h3>Teilnehmende Kreise und kreisfreie Städte</h3>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<?php
|
||||
$i=0;
|
||||
foreach ($arrDistrict as $key => $strTitle):?>
|
||||
<a href="<?php echo "./".$key ?>"><?=$strTitle?></a><br>
|
||||
<?php endforeach; ?>
|
||||
<?php
|
||||
$i++;
|
||||
if ($i%20==0) echo "</div><div class='col-4'>";
|
||||
endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
© ADFC NRW
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user