This commit is contained in:
Walter Hupfeld 2024-03-11 23:06:15 +01:00
parent 4c2d55d699
commit d571968568
10 changed files with 66 additions and 46 deletions

View File

@ -4,7 +4,7 @@
* 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
* zuletzt geändert: 18.02.2024 * zuletzt geändert: 18.02.2024
******************************** */ ******************************** */

View File

@ -3,7 +3,7 @@
* 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
* zuletzt geändert: 18.02.2024 * zuletzt geändert: 18.02.2024
*/ */

View File

@ -72,12 +72,21 @@
$stmt->execute(); $stmt->execute();
} }
if (isset($_GET['approvalId'])) {
if($_GET['csrf'] !== $_SESSION['csrf_token']) {
die("Ungültiger Token");
}
$numApproval=(int)$_GET['approvalId'];
$stmt = $db->prepare("UPDATE location SET approval = not approval WHERE id= :id");
$stmt->bindValue(":id",$numApproval);
$stmt->execute();
}
// Bild löschen // Bild löschen
if (isset($_GET['delfid'])) { if (isset($_GET['delfid'])) {
if($_GET['csrf'] !== $_SESSION['csrf_token']) { if($_GET['csrf'] !== $_SESSION['csrf_token']) {
die("Ungültiger Token"); die("Ungültiger Token");
} }
$numDelete=(int)$_GET['delfid']; $numDelete=(int)$_GET['delfid'];
$stmt = $db->prepare("SELECT * FROM files where id = :id"); $stmt = $db->prepare("SELECT * FROM files where id = :id");
$stmt->bindParam(':id', $id); $stmt->bindParam(':id', $id);
@ -90,7 +99,6 @@
$stmt = $db->prepare("DELETE FROM files WHERE id= :id"); $stmt = $db->prepare("DELETE FROM files WHERE id= :id");
$stmt->bindValue(":id",$numDelete); $stmt->bindValue(":id",$numDelete);
$stmt->execute(); $stmt->execute();
} }
// Karte zeigen // Karte zeigen
@ -99,6 +107,7 @@
$boolShowmap=$numShowmap==1; $boolShowmap=$numShowmap==1;
} }
$arrTopic = array ( $arrTopic = array (
1 => "Fußverkehr", 1 => "Fußverkehr",
2 => "Radverkehr", 2 => "Radverkehr",
@ -114,6 +123,7 @@
4 => "<i class='fa fa-car'></i>", 4 => "<i class='fa fa-car'></i>",
5 => "<i class='fa fa-truck'></i>" 5 => "<i class='fa fa-truck'></i>"
); );
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="de"> <html lang="de">
@ -162,9 +172,7 @@
<li class="nav-item"> <li class="nav-item">
<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">
@ -191,6 +199,7 @@
<th>Bild</th> <th>Bild</th>
<th>lat/lng</th> <th>lat/lng</th>
<th>Datum</th> <th>Datum</th>
<?= ($boolApprove) ? "<th>Freigabe</th>" : "" ?>
<th>Aktion</th></tr> <th>Aktion</th></tr>
</thead> </thead>
<tbody> <tbody>
@ -253,6 +262,11 @@
echo "<td>".round($row['lat'],5)." ".round($row['lng'],5)."</td>"; echo "<td>".round($row['lat'],5)." ".round($row['lng'],5)."</td>";
} }
echo "<td>".$row['created_at']."</td>"; echo "<td>".$row['created_at']."</td>";
if ($boolApprove) {
$strApproved = ($row['approval']) ? "<i class='fa fa-check' style='color:green'></i>"
: "<i class='fa fa-circle' style='color:red'></i>" ;
echo "<td>".$strApproved." <a href='".$_SERVER['PHP_SELF']."?approvalId=".$id."&csrf=".$_SESSION['csrf_token']."'>change</td>";
}
echo "<td><a class='del' href='".$_SERVER['PHP_SELF']."?delid=".$id."&csrf=".$_SESSION['csrf_token']."'><i class='fa fa-trash'></i></a>&nbsp;"; echo "<td><a class='del' href='".$_SERVER['PHP_SELF']."?delid=".$id."&csrf=".$_SESSION['csrf_token']."'><i class='fa fa-trash'></i></a>&nbsp;";
echo "<a class='edit_defect' href='#' id='edit_".$id."' value='".$id."'><i class='fa fa-pencil'></i></a>"; echo "<a class='edit_defect' href='#' id='edit_".$id."' value='".$id."'><i class='fa fa-pencil'></i></a>";
echo "</td>"; echo "</td>";

View File

@ -8,7 +8,7 @@ $db_name = "nrw_melder";
$cachetime = 0; $cachetime = 0;
$location_key=""; $location_key="";
$mapbox_key="pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw"; $mapbox_key="";
try { try {
$db = new PDO('mysql:host='.$db_server.';dbname='.$db_name.';charset=utf8mb4', $db_user, $db_passwd); $db = new PDO('mysql:host='.$db_server.';dbname='.$db_name.';charset=utf8mb4', $db_user, $db_passwd);

View File

@ -155,6 +155,7 @@ $arrAge = array (
); );
$arrDefect = array ( $arrDefect = array (
0 => "--Bitte wählen--",
1 => "Pfosten/Poller", 1 => "Pfosten/Poller",
2 => "Schranke", 2 => "Schranke",
3 => "Umlaufsperre/Drängelgitter", 3 => "Umlaufsperre/Drängelgitter",

View File

@ -94,7 +94,12 @@ i.wa {
display:none; display:none;
} }
.not_approved {
color:darkgray;
}
.jumbotron { .jumbotron {
background-color:orange; background-color:orange;
} }
a, a:active, a:visited, a:active {color:orange;} a, a:active, a:visited, a:active {color:orange;}

View File

@ -1,4 +1,3 @@
<div id="dialog_comment" class="card" title="Kommentar"> <div id="dialog_comment" class="card" title="Kommentar">
<div class="card-header">Ihr Kommentar <div class="card-header">Ihr Kommentar
<span id="close_comment" type="button" class="close right text-danger"> <span id="close_comment" type="button" class="close right text-danger">

View File

@ -1,11 +1,11 @@
<?php <?php
function print_username() { function print_username() {
echo <<<EOT echo <<<HEREDOC
<!-- Username ---------------------------------- --> <!-- Username ---------------------------------- -->
<label for="username"><strong>Ihr Name oder Pseudonym:</strong></label> <label for="username"><strong>Ihr Name oder Pseudonym:</strong></label>
<input type="text" name="username" maxlength="16" id="username" placeholder="Name" class="text" required="required"> <input type="text" name="username" maxlength="16" id="username" placeholder="Name" class="text" required="required">
<br> <br>
EOT; HEREDOC;
} }
function print_userinfo() { function print_userinfo() {
@ -57,23 +57,22 @@ function print_description(){
} }
function print_topics(){ function print_topics(){
global $arrTopic; global $arrTopic;
echo <<<HEREDOC echo <<<HEREDOC
<!-- Themenfelder ---------------------------------- --> <!-- Themenfelder ---------------------------------- -->
<strong>Wählen Sie ein Themenfeld aus:</strong></br> <strong>Wählen Sie ein Themenfeld aus:</strong></br>
<div class="row"> <div class="row">
HEREDOC; HEREDOC;
$first=true; $first=true;
foreach ($arrTopic as $keyTopic => $valTopic) { foreach ($arrTopic as $keyTopic => $valTopic) {
$checked = ($first) ? "checked=\"checked\"" : ""; $checked = ($first) ? "checked=\"checked\"" : "";
$first=false; $first=false;
echo '<div class="col-6-md col-6">
echo '<div class="col-6-md col-6"> <input type="radio" id="topic'.$keyTopic.'" name="topic" value="'.$keyTopic.'" $checked/>
<input type="radio" id="topic'.$keyTopic.'" name="topic" value="'.$keyTopic.'" $checked/> <label for="topic$keyTopic">'.$valTopic.'</label>
<label for="topic$keyTopic">'.$valTopic.'</label> </div>';
</div>'; };
}; echo "</div> <!-- row -->";
echo "</div> <!-- row -->";
} }
?> ?>
@ -87,17 +86,12 @@ echo "</div> <!-- row -->";
<div class="card-body"> <div class="card-body">
<form id="newobjectform" enctype="multipart/form-data" action="#" method="post" > <form id="newobjectform" enctype="multipart/form-data" action="#" method="post" >
<?php <?php
print_username(); print_username();
if ($boolUserinfo) print_userinfo(); if ($boolUserinfo) print_userinfo();
if ($boolDefect) print_category(); if ($boolDefect) print_category();
print_description(); print_description();
if ($boolTopics) { if ($boolTopics) print_topics();
print_topics();
} else {
echo "<input type='hidden' id='topic' name='topic' value='2' />";
}
?> ?>
<!-- Lokalisierung ---------------------------------- --> <!-- Lokalisierung ---------------------------------- -->

View File

@ -4,8 +4,8 @@
* 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: 11.03.2024
******************************** */ ******************************** */
@ -14,12 +14,14 @@ function generate_tooltip_description($row) {
global $boolComment; global $boolComment;
global $boolUpload; global $boolUpload;
global $boolDefect; global $boolDefect;
global $boolApprove;
global $uploaddir; global $uploaddir;
global $arrTopic; global $arrTopic;
global $arrDefect; global $arrDefect;
global $db; global $db;
$description = $row['description'];
$description = ($boolApprove && $row['approval']) ? $row['description'] : "Freigabe in Kürze";
$numUps = $row['thumb_ups']; $numUps = $row['thumb_ups'];
$numDowns = $row['thumb_downs']; $numDowns = $row['thumb_downs'];
$id = $row['id']; $id = $row['id'];
@ -29,7 +31,7 @@ function generate_tooltip_description($row) {
$strDescription = "<strong>Anmerkung zu ".$arrTopic[$topic]."</strong><br>"; $strDescription = "<strong>Anmerkung zu ".$arrTopic[$topic]."</strong><br>";
if ($boolUpload && isset($row['filename'])) { if ($boolUpload && isset($row['filename']) && ($boolApprove && $row['approval'])) {
$strDescription .= "<a href=\'images/".$row['filename']."\' data-lightbox=\'radweg".$id."\'>"; $strDescription .= "<a href=\'images/".$row['filename']."\' data-lightbox=\'radweg".$id."\'>";
$strDescription .= "<img src=\'images/".$row['filename']."\' style=\'width:200px;\' /></a><br>"; $strDescription .= "<img src=\'images/".$row['filename']."\' style=\'width:200px;\' /></a><br>";
} }

View File

@ -141,7 +141,11 @@
echo "<td>".$row['transport']."</td>"; echo "<td>".$row['transport']."</td>";
} }
echo "<td>".$arrIcon[$row['topic']]." ".$arrTopic[$row['topic']]."</td>"; echo "<td>".$arrIcon[$row['topic']]." ".$arrTopic[$row['topic']]."</td>";
echo "<td>" . nl2br(stripslashes($row['description']))."</td>"; if ($boolApprove && $row['approval']) {
echo "<td>" . nl2br(stripslashes($row['description']))."</td>";
} else {
echo "<td class='not_approved'>Freigabe erfolgt in Kürze.</td>";
}
if ($boolComment) { if ($boolComment) {
echo "<td>"; echo "<td>";
$strSQL = "SELECT username,comment,created_at FROM comment WHERE loc_id=".$id; $strSQL = "SELECT username,comment,created_at FROM comment WHERE loc_id=".$id;
@ -168,12 +172,14 @@
} }
echo "<td>".$datum."</td>"; echo "<td>".$datum."</td>";
if ($boolUpload) { if ($boolUpload) {
echo "<td>"; if ($boolApprove || $row['approval']) {
if (isset($row['filename'])) { echo "<td>";
echo "<a href='images/".$row['filename']."' data-lightbox='radweg".$id."'>"; if (isset($row['filename'])) {
echo "<img style='width:120px' src='images/".$row['filename']."'></a>"; echo "<a href='images/".$row['filename']."' data-lightbox='radweg".$id."'>";
echo "<img style='width:120px' src='images/".$row['filename']."'></a>";
}
echo "</td>";
} }
echo "</td>";
} }
echo "<td><a class='maplink' name='".$id."' href='#'>Karte</a><!--".round($row['lat'],4)." / ".round($row['lng'],4)."--></td>"; echo "<td><a class='maplink' name='".$id."' href='#'>Karte</a><!--".round($row['lat'],4)." / ".round($row['lng'],4)."--></td>";
echo "</tr>\n"; echo "</tr>\n";
@ -207,7 +213,6 @@ jQuery(document).ready(function(){
}); });
<?php <?php
echo " var points = [];\n"; echo " var points = [];\n";
foreach ($arrPoint as $point) { foreach ($arrPoint as $point) {