added .gitattributes to specify line feed line endings for .sh and .sql files

This commit is contained in:
2026-04-17 15:49:21 +02:00
parent 19b038d4f5
commit 4f35ddeafe
10 changed files with 2143 additions and 2135 deletions

8
.gitattributes vendored Normal file
View File

@@ -0,0 +1,8 @@
# Specifies Line Feed (LF) Line Endings for Shell Scripts
*.sh text eol=lf
# # Specifies Line Feed (LF) Line Endings for SQL Files
*.sql text eol=lf
# Letd Git decide for other Files
* text=auto

View File

@@ -1,40 +1,40 @@
<?php <?php
// Reads Environment Configfile // Reads Environment Configfile
$envFile = __DIR__ . '/../.env'; $envFile = __DIR__ . '/../.env';
if (file_exists($envFile)) { if (file_exists($envFile)) {
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); $lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach ($lines as $line) { foreach ($lines as $line) {
if (strpos(trim($line), '#') === 0) continue; if (strpos(trim($line), '#') === 0) continue;
list($key, $value) = array_map('trim', explode('=', $line, 2)); list($key, $value) = array_map('trim', explode('=', $line, 2));
putenv("$key=$value"); putenv("$key=$value");
} }
} }
// Defines Environment Variables // Defines Environment Variables
$host = getenv('POSTGRES_HOST'); $host = getenv('POSTGRES_HOST');
$port = getenv('POSTGRES_PORT'); $port = getenv('POSTGRES_PORT');
$db = getenv('POSTGRES_DB'); $db = getenv('POSTGRES_DB');
$user = getenv('POSTGRES_USER'); $user = getenv('POSTGRES_USER');
$pass = getenv('POSTGRES_PASSWORD'); $pass = getenv('POSTGRES_PASSWORD');
// Output Buffering and Session Start // Output Buffering and Session Start
ob_start(); ob_start();
session_start(); session_start();
// Initializes Database Connection // Initializes Database Connection
try { try {
$opt = [ $opt = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false PDO::ATTR_EMULATE_PREPARES => false
]; ];
$dsn = "pgsql:host=$host;dbname=$db;port=$port"; $dsn = "pgsql:host=$host;dbname=$db;port=$port";
$pdo = new PDO($dsn, $user, $pass, $opt); $pdo = new PDO($dsn, $user, $pass, $opt);
// Creates Error Message // Creates Error Message
} catch(PDOException $e) { } catch(PDOException $e) {
echo "Error: ".$e->getMessage(); echo "Error: ".$e->getMessage();
} }
?> ?>

View File

@@ -1,48 +1,48 @@
<?php <?php
// ToDo's // ToDo's
// Whitelists oder Prepared Statements gegen SQL-Injection hinzufügen // Whitelists oder Prepared Statements gegen SQL-Injection hinzufügen
include 'init.php'; include 'init.php';
$request = htmlspecialchars($_POST['request'], ENT_QUOTES); $request = htmlspecialchars($_POST['request'], ENT_QUOTES);
if ($request=='buildings') { if ($request=='buildings') {
$webgis_id = htmlspecialchars($_POST['webgis_id'], ENT_QUOTES); $webgis_id = htmlspecialchars($_POST['webgis_id'], ENT_QUOTES);
try { try {
$pdo -> query("DELETE FROM buildings WHERE webgis_id = '$webgis_id'"); $pdo -> query("DELETE FROM buildings WHERE webgis_id = '$webgis_id'");
} catch (PDOException $e) { } catch (PDOException $e) {
echo "ERROR ".$e->getMessage(); echo "ERROR ".$e->getMessage();
} }
} }
if ($request == 'pipelines') { if ($request == 'pipelines') {
$webgis_id = htmlspecialchars($_POST['webgis_id'], ENT_QUOTES); $webgis_id = htmlspecialchars($_POST['webgis_id'], ENT_QUOTES);
try { try {
$pdo -> query("DELETE from pipelines where webgis_id= '$webgis_id' "); $pdo -> query("DELETE from pipelines where webgis_id= '$webgis_id' ");
} catch(PDOException $e) { } catch(PDOException $e) {
echo "ERROR ".$e->getMessage(); echo "ERROR ".$e->getMessage();
} }
} }
if ($request == 'valves') { if ($request == 'valves') {
$webgis_id = htmlspecialchars($_POST['webgis_id'], ENT_QUOTES); $webgis_id = htmlspecialchars($_POST['webgis_id'], ENT_QUOTES);
try { try {
$pdo -> query("DELETE from valves where webgis_id= '$webgis_id' "); $pdo -> query("DELETE from valves where webgis_id= '$webgis_id' ");
} catch(PDOException $e) { } catch(PDOException $e) {
echo "ERROR ".$e->getMessage(); echo "ERROR ".$e->getMessage();
} }
} }
?> ?>

View File

@@ -1,52 +1,52 @@
<?php <?php
// ToDo's // ToDo's
// Whitelists oder Prepared Statements gegen SQL-Injection hinzufügen // Whitelists oder Prepared Statements gegen SQL-Injection hinzufügen
// PostgreSQL-Serververbindung // PostgreSQL-Serververbindung
include 'init.php'; include 'init.php';
// HTTP-POST-Methode für Formulardaten // HTTP-POST-Methode für Formulardaten
$table = htmlspecialchars($_POST['table'], ENT_QUOTES); $table = htmlspecialchars($_POST['table'], ENT_QUOTES);
$field = htmlspecialchars($_POST['field'], ENT_QUOTES); $field = htmlspecialchars($_POST['field'], ENT_QUOTES);
$value = htmlspecialchars($_POST['value'], ENT_QUOTES); $value = htmlspecialchars($_POST['value'], ENT_QUOTES);
try { try {
// Datenbankabfrage // Datenbankabfrage
$result = $pdo -> query("SELECT *, ST_AsGeoJSON(geom) as geojson FROM $table WHERE $field = '$value'"); $result = $pdo -> query("SELECT *, ST_AsGeoJSON(geom) as geojson FROM $table WHERE $field = '$value'");
$features = []; $features = [];
foreach($result as $row) { foreach($result as $row) {
// PHP-Objekt erstellen // PHP-Objekt erstellen
$geometry = json_decode($row['geojson']); $geometry = json_decode($row['geojson']);
// PHP-Objekt bereinigen // PHP-Objekt bereinigen
unset($row['geom']); unset($row['geom']);
unset($row['geojson']); unset($row['geojson']);
// JSON-Feature hinzufügen // JSON-Feature hinzufügen
$feature = [ $feature = [
"type"=>"Feature", "type"=>"Feature",
"geometry"=>$geometry, "geometry"=>$geometry,
"properties"=>$row "properties"=>$row
]; ];
array_push($features, $feature); array_push($features, $feature);
}; };
// Feature-Collection hinzufügen // Feature-Collection hinzufügen
$featureCollection = [ $featureCollection = [
"type"=>"FeatureCollection", "type"=>"FeatureCollection",
"features"=>$features "features"=>$features
]; ];
echo json_encode($featureCollection); echo json_encode($featureCollection);
// Fehlernachricht ausgeben // Fehlernachricht ausgeben
} catch(PDOException $e) { } catch(PDOException $e) {
echo "ERROR ".$e->getMessage(); echo "ERROR ".$e->getMessage();
} }
?> ?>

View File

@@ -1,73 +1,73 @@
<?php <?php
// ToDo's // ToDo's
// Whitelists oder Prepared Statements gegen SQL-Injection hinzufügen // Whitelists oder Prepared Statements gegen SQL-Injection hinzufügen
// PostgreSQL-Serververbindung // PostgreSQL-Serververbindung
include 'init.php'; include 'init.php';
$request = htmlspecialchars($_POST['request'], ENT_QUOTES); $request = htmlspecialchars($_POST['request'], ENT_QUOTES);
if ($request == 'valves') { if ($request == 'valves') {
$valve_id = htmlspecialchars($_POST['valve_id'], ENT_QUOTES); $valve_id = htmlspecialchars($_POST['valve_id'], ENT_QUOTES);
$valve_type = htmlspecialchars($_POST['valve_type'], ENT_QUOTES); $valve_type = htmlspecialchars($_POST['valve_type'], ENT_QUOTES);
$valve_dma_id = htmlspecialchars($_POST['valve_dma_id'], ENT_QUOTES); $valve_dma_id = htmlspecialchars($_POST['valve_dma_id'], ENT_QUOTES);
$valve_diameter = htmlspecialchars($_POST['valve_diameter'], ENT_QUOTES); $valve_diameter = htmlspecialchars($_POST['valve_diameter'], ENT_QUOTES);
$valve_visibility = htmlspecialchars($_POST['valve_visibility'], ENT_QUOTES); $valve_visibility = htmlspecialchars($_POST['valve_visibility'], ENT_QUOTES);
$valve_location = htmlspecialchars($_POST['valve_location'], ENT_QUOTES); $valve_location = htmlspecialchars($_POST['valve_location'], ENT_QUOTES);
$valve_geometry = $_POST['valve_geometry']; $valve_geometry = $_POST['valve_geometry'];
$result = $pdo -> query("SELECT * FROM valves WHERE valve_id = '$valve_id'"); $result = $pdo -> query("SELECT * FROM valves WHERE valve_id = '$valve_id'");
if ($result->rowCount()>0) { if ($result->rowCount()>0) {
echo "ERROR: Valve ID already exists. Please type in another ID!"; echo "ERROR: Valve ID already exists. Please type in another ID!";
} else { } else {
// Datenbankabfrage // Datenbankabfrage
$result = $pdo -> query("INSERT INTO valves(valve_id, valve_type, valve_dma_id, valve_diameter, valve_location, valve_visibility, geom) VALUES ('$valve_id', '$valve_type', '$valve_dma_id', '$valve_diameter', '$valve_location', '$valve_visibility', ST_SetSRID(ST_GeomFromGeoJSON('$valve_geometry'), 4326))"); $result = $pdo -> query("INSERT INTO valves(valve_id, valve_type, valve_dma_id, valve_diameter, valve_location, valve_visibility, geom) VALUES ('$valve_id', '$valve_type', '$valve_dma_id', '$valve_diameter', '$valve_location', '$valve_visibility', ST_SetSRID(ST_GeomFromGeoJSON('$valve_geometry'), 4326))");
} }
} }
if ($request == 'pipelines') { if ($request == 'pipelines') {
$pipeline_id = htmlspecialchars($_POST['pipeline_id'], ENT_QUOTES); $pipeline_id = htmlspecialchars($_POST['pipeline_id'], ENT_QUOTES);
$pipeline_category = htmlspecialchars($_POST['pipeline_category'], ENT_QUOTES); $pipeline_category = htmlspecialchars($_POST['pipeline_category'], ENT_QUOTES);
$pipeline_dma_id = htmlspecialchars($_POST['pipeline_dma_id'], ENT_QUOTES); $pipeline_dma_id = htmlspecialchars($_POST['pipeline_dma_id'], ENT_QUOTES);
$pipeline_diameter = htmlspecialchars($_POST['pipeline_diameter'], ENT_QUOTES); $pipeline_diameter = htmlspecialchars($_POST['pipeline_diameter'], ENT_QUOTES);
$pipeline_method = htmlspecialchars($_POST['pipeline_method'], ENT_QUOTES); $pipeline_method = htmlspecialchars($_POST['pipeline_method'], ENT_QUOTES);
$pipeline_location = htmlspecialchars($_POST['pipeline_location'], ENT_QUOTES); $pipeline_location = htmlspecialchars($_POST['pipeline_location'], ENT_QUOTES);
$pipeline_geometry = $_POST['pipeline_geometry']; $pipeline_geometry = $_POST['pipeline_geometry'];
$result = $pdo -> query("SELECT * FROM pipelines WHERE pipeline_id = '$pipeline_id'"); $result = $pdo -> query("SELECT * FROM pipelines WHERE pipeline_id = '$pipeline_id'");
if ($result->rowCount()>0) { if ($result->rowCount()>0) {
echo "ERROR: Pipeline ID already exists. Please type in another ID!"; echo "ERROR: Pipeline ID already exists. Please type in another ID!";
} else { } else {
// Datenbankabfrage // Datenbankabfrage
$result = $pdo -> query("INSERT INTO pipelines(pipeline_id, pipeline_category, pipeline_dma_id, pipeline_diameter, pipeline_method, pipeline_location, geom) VALUES ('$pipeline_id', '$pipeline_category', '$pipeline_dma_id', '$pipeline_diameter', '$pipeline_method', '$pipeline_location', ST_SetSRID(ST_GeomFromGeoJSON('$pipeline_geometry'), 4326))"); $result = $pdo -> query("INSERT INTO pipelines(pipeline_id, pipeline_category, pipeline_dma_id, pipeline_diameter, pipeline_method, pipeline_location, geom) VALUES ('$pipeline_id', '$pipeline_category', '$pipeline_dma_id', '$pipeline_diameter', '$pipeline_method', '$pipeline_location', ST_SetSRID(ST_GeomFromGeoJSON('$pipeline_geometry'), 4326))");
} }
} }
if ($request == 'buildings') { if ($request == 'buildings') {
$account_no = htmlspecialchars($_POST['account_no'], ENT_QUOTES); $account_no = htmlspecialchars($_POST['account_no'], ENT_QUOTES);
$building_category = htmlspecialchars($_POST['building_category'], ENT_QUOTES); $building_category = htmlspecialchars($_POST['building_category'], ENT_QUOTES);
$building_dma_id = htmlspecialchars($_POST['building_dma_id'], ENT_QUOTES); $building_dma_id = htmlspecialchars($_POST['building_dma_id'], ENT_QUOTES);
$building_storey = htmlspecialchars($_POST['building_storey'], ENT_QUOTES); $building_storey = htmlspecialchars($_POST['building_storey'], ENT_QUOTES);
$building_population = htmlspecialchars($_POST['building_population'], ENT_QUOTES); $building_population = htmlspecialchars($_POST['building_population'], ENT_QUOTES);
$building_location = htmlspecialchars($_POST['building_location'], ENT_QUOTES); $building_location = htmlspecialchars($_POST['building_location'], ENT_QUOTES);
$building_geometry = $_POST['building_geometry']; $building_geometry = $_POST['building_geometry'];
$result = $pdo -> query("SELECT *from buildings where account_no= '$account_no'"); $result = $pdo -> query("SELECT *from buildings where account_no= '$account_no'");
if ($result->rowCount()>0) { if ($result->rowCount()>0) {
echo "ERROR: Building ID already exists. Please type in another ID!"; echo "ERROR: Building ID already exists. Please type in another ID!";
} else { } else {
$sql = $pdo -> query("INSERT INTO buildings(account_no, building_category, building_dma_id, building_storey, building_population, building_location, geom) VALUES ('$account_no', '$building_category', '$building_dma_id', '$building_storey', '$building_population', '$building_location', ST_Force3DZ(ST_SetSRID(ST_GeomFromGeoJSON('$building_geometry'), 4326)))"); $sql = $pdo -> query("INSERT INTO buildings(account_no, building_category, building_dma_id, building_storey, building_population, building_location, geom) VALUES ('$account_no', '$building_category', '$building_dma_id', '$building_storey', '$building_population', '$building_location', ST_Force3DZ(ST_SetSRID(ST_GeomFromGeoJSON('$building_geometry'), 4326)))");
} }
} }
?> ?>

View File

@@ -1,63 +1,63 @@
<?php <?php
// ToDo's // ToDo's
// Whitelists oder Prepared Statements gegen SQL-Injection hinzufügen // Whitelists oder Prepared Statements gegen SQL-Injection hinzufügen
// PostgreSQL-Serververbindung // PostgreSQL-Serververbindung
include 'init.php'; include 'init.php';
// HTTP-POST-Methode für Formulardaten // HTTP-POST-Methode für Formulardaten
$table = htmlspecialchars($_POST['table'], ENT_QUOTES); $table = htmlspecialchars($_POST['table'], ENT_QUOTES);
$dma_id = htmlspecialchars($_POST['dma_id'], ENT_QUOTES); $dma_id = htmlspecialchars($_POST['dma_id'], ENT_QUOTES);
if($table == 'valves') { if($table == 'valves') {
$dma_id_field = "valve_dma_id"; $dma_id_field = "valve_dma_id";
} }
if($table == 'buildings') { if($table == 'buildings') {
$dma_id_field = "building_dma_id"; $dma_id_field = "building_dma_id";
} }
if($table == 'pipelines') { if($table == 'pipelines') {
$dma_id_field = "pipeline_dma_id"; $dma_id_field = "pipeline_dma_id";
} }
try { try {
// Datenbankabfrage // Datenbankabfrage
$result = $pdo -> query("SELECT *, ST_AsGeoJSON(geom) as geojson FROM $table WHERE $dma_id_field = '$dma_id'"); $result = $pdo -> query("SELECT *, ST_AsGeoJSON(geom) as geojson FROM $table WHERE $dma_id_field = '$dma_id'");
$features = []; $features = [];
foreach($result as $row) { foreach($result as $row) {
// PHP-Objekt erstellen // PHP-Objekt erstellen
$geometry = json_decode($row['geojson']); $geometry = json_decode($row['geojson']);
// PHP-Objekt bereinigen // PHP-Objekt bereinigen
unset($row['geom']); unset($row['geom']);
unset($row['geojson']); unset($row['geojson']);
// JSON-Feature hinzufügen // JSON-Feature hinzufügen
$feature = [ $feature = [
"type"=>"Feature", "type"=>"Feature",
"geometry"=>$geometry, "geometry"=>$geometry,
"properties"=>$row "properties"=>$row
]; ];
array_push($features, $feature); array_push($features, $feature);
}; };
// Feature-Collection hinzufügen // Feature-Collection hinzufügen
$featureCollection = [ $featureCollection = [
"type"=>"FeatureCollection", "type"=>"FeatureCollection",
"features"=>$features "features"=>$features
]; ];
echo json_encode($featureCollection); echo json_encode($featureCollection);
// Fehlernachricht ausgeben // Fehlernachricht ausgeben
} catch(PDOException $e) { } catch(PDOException $e) {
echo "ERROR ".$e->getMessage(); echo "ERROR ".$e->getMessage();
} }
?> ?>

View File

@@ -1,97 +1,97 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title> <title>Document</title>
<!-- jQuery UI --> <!-- jQuery UI -->
<link rel="stylesheet" href="source/jquery-ui.min.css"> <link rel="stylesheet" href="source/jquery-ui.min.css">
<script src="source/jquery-ui.min.js"></script> <script src="source/jquery-ui.min.js"></script>
<!-- Bootstrap Stylesheet & Skript --> <!-- Bootstrap Stylesheet & Skript -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="styles.css"> <link rel="stylesheet" href="styles.css">
<!-- Sidebar Plugin --> <!-- Sidebar Plugin -->
<link rel="stylesheet" href="plugins/sidebar/leaflet-sidebar.css"> <link rel="stylesheet" href="plugins/sidebar/leaflet-sidebar.css">
<script src="plugins/sidebar/leaflet-sidebar.js"></script> <script src="plugins/sidebar/leaflet-sidebar.js"></script>
<!-- Button Plugin --> <!-- Button Plugin -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet-easybutton@2/src/easy-button.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet-easybutton@2/src/easy-button.css">
<script src="https://cdn.jsdelivr.net/npm/leaflet-easybutton@2/src/easy-button.js"></script> <script src="https://cdn.jsdelivr.net/npm/leaflet-easybutton@2/src/easy-button.js"></script>
<!-- Font Plugin --> <!-- Font Plugin -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.0.1/css/all.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.0.1/css/all.min.css">
<!-- PolylineMeasure Plugin --> <!-- PolylineMeasure Plugin -->
<link rel="stylesheet" href="https://ppete2.github.io/Leaflet.PolylineMeasure/Leaflet.PolylineMeasure.css"> <link rel="stylesheet" href="https://ppete2.github.io/Leaflet.PolylineMeasure/Leaflet.PolylineMeasure.css">
<script src="https://ppete2.github.io/Leaflet.PolylineMeasure/Leaflet.PolylineMeasure.js"></script> <script src="https://ppete2.github.io/Leaflet.PolylineMeasure/Leaflet.PolylineMeasure.js"></script>
<!-- MousePosition Plugin --> <!-- MousePosition Plugin -->
<link rel="stylesheet" href="plugins/mouseposition/L.Control.MousePosition.css"> <link rel="stylesheet" href="plugins/mouseposition/L.Control.MousePosition.css">
<script src="plugins/mouseposition/L.Control.MousePosition.js"></script> <script src="plugins/mouseposition/L.Control.MousePosition.js"></script>
<!-- Geoman Plugin --> <!-- Geoman Plugin -->
<link rel="stylesheet" href="https://unpkg.com/@geoman-io/leaflet-geoman-free@latest/dist/leaflet-geoman.css"> <link rel="stylesheet" href="https://unpkg.com/@geoman-io/leaflet-geoman-free@latest/dist/leaflet-geoman.css">
<script src="https://unpkg.com/@geoman-io/leaflet-geoman-free@latest/dist/leaflet-geoman.js"></script> <script src="https://unpkg.com/@geoman-io/leaflet-geoman-free@latest/dist/leaflet-geoman.js"></script>
<!-- Minimap Plugin --> <!-- Minimap Plugin -->
<link rel="stylesheet" href="plugins/minimap/Control.MiniMap.min.css"> <link rel="stylesheet" href="plugins/minimap/Control.MiniMap.min.css">
<script src="plugins/minimap/Control.MiniMap.min.js"></script> <script src="plugins/minimap/Control.MiniMap.min.js"></script>
<!-- ajax Plugin --> <!-- ajax Plugin -->
<script src="plugins/ajax/leaflet.ajax.js"></script> <script src="plugins/ajax/leaflet.ajax.js"></script>
</head> </head>
<body> <body>
<div class="popup-container"> <div class="popup-container">
<input type="hidden" name="building_database_id" class="updateBuilding" value="something"> <input type="hidden" name="building_database_id" class="updateBuilding" value="something">
<input type="hidden" name="account_no_old" class="updateBuilding" value="something"> <input type="hidden" name="account_no_old" class="updateBuilding" value="something">
<div class="popup-form-group"> <div class="popup-form-group">
<label class="control-label popup-label">Building ID</label> <label class="control-label popup-label">Building ID</label>
<input type="text" class="form-control popup-input text-center updateBuilding" value="something" name="account_no"> <input type="text" class="form-control popup-input text-center updateBuilding" value="something" name="account_no">
</div> </div>
<div class="popup-form-group"> <div class="popup-form-group">
<label class="control-label popup-label">Category</label> <label class="control-label popup-label">Category</label>
<input type="text" class="form-control popup-input text-center updateBuilding" value="something" name="building_category"> <input type="text" class="form-control popup-input text-center updateBuilding" value="something" name="building_category">
</div> </div>
<div class="popup-form-group"> <div class="popup-form-group">
<label class="control-label popup-label">Storey</label> <label class="control-label popup-label">Storey</label>
<input type="number" class="form-control popup-input text-center updateBuilding" value="something" name="building_storey"> <input type="number" class="form-control popup-input text-center updateBuilding" value="something" name="building_storey">
</div> </div>
<div class="popup-form-group"> <div class="popup-form-group">
<label class="control-label popup-label">Population</label> <label class="control-label popup-label">Population</label>
<input type="number" class="form-control popup-input text-center updateBuilding" value="something" name="building_population"> <input type="number" class="form-control popup-input text-center updateBuilding" value="something" name="building_population">
</div> </div>
<div class="popup-form-group"> <div class="popup-form-group">
<label class="control-label popup-label">Location</label> <label class="control-label popup-label">Location</label>
<input type="text" class="form-control popup-input text-center updateBuilding" value="something" name="building_locationn"> <input type="text" class="form-control popup-input text-center updateBuilding" value="something" name="building_locationn">
</div> </div>
<div class="popup-button-group"> <div class="popup-button-group">
<button type="submit" class="btn btn-success popup-button">Update</button> <button type="submit" class="btn btn-success popup-button">Update</button>
<button type="submit" class="btn btn-danger popup-button">Delete</button> <button type="submit" class="btn btn-danger popup-button">Delete</button>
</div> </div>
</div> </div>
</body> </body>
</html> </html>

View File

@@ -1,98 +1,98 @@
<?php <?php
include 'init.php'; include 'init.php';
$request = htmlspecialchars($_POST['request'], ENT_QUOTES); $request = htmlspecialchars($_POST['request'], ENT_QUOTES);
if ($request=='buildings') { if ($request=='buildings') {
$webgis_id = htmlspecialchars($_POST['webgis_id'], ENT_QUOTES); $webgis_id = htmlspecialchars($_POST['webgis_id'], ENT_QUOTES);
$account_no_old = htmlspecialchars($_POST['account_no_old'], ENT_QUOTES); $account_no_old = htmlspecialchars($_POST['account_no_old'], ENT_QUOTES);
$account_no = htmlspecialchars($_POST['account_no'], ENT_QUOTES); $account_no = htmlspecialchars($_POST['account_no'], ENT_QUOTES);
$building_category = htmlspecialchars($_POST['building_category'], ENT_QUOTES); $building_category = htmlspecialchars($_POST['building_category'], ENT_QUOTES);
$building_storey = htmlspecialchars($_POST['building_storey'], ENT_QUOTES); $building_storey = htmlspecialchars($_POST['building_storey'], ENT_QUOTES);
$building_population = htmlspecialchars($_POST['building_population'], ENT_QUOTES); $building_population = htmlspecialchars($_POST['building_population'], ENT_QUOTES);
$building_location = htmlspecialchars($_POST['building_location'], ENT_QUOTES); $building_location = htmlspecialchars($_POST['building_location'], ENT_QUOTES);
$building_dma_id = htmlspecialchars($_POST['building_dma_id'], ENT_QUOTES); $building_dma_id = htmlspecialchars($_POST['building_dma_id'], ENT_QUOTES);
try { try {
if ($account_no_old != $account_no) { if ($account_no_old != $account_no) {
$result = $pdo -> query("SELECT * FROM buildings WHERE account_no = '$account_no'"); $result = $pdo -> query("SELECT * FROM buildings WHERE account_no = '$account_no'");
if ($result -> rowCount()>0) { if ($result -> rowCount()>0) {
echo "ERROR: Account Number already exists. Pleas type in another Account Number!"; echo "ERROR: Account Number already exists. Pleas type in another Account Number!";
} else { } else {
$pdo -> query("UPDATE buildings SET account_no = '$account_no', building_category = '$building_category', building_storey = '$building_storey', building_population = '$building_population', building_location = '$building_location', building_dma_id = '$building_dma_id' WHERE webgis_id = '$webgis_id'"); $pdo -> query("UPDATE buildings SET account_no = '$account_no', building_category = '$building_category', building_storey = '$building_storey', building_population = '$building_population', building_location = '$building_location', building_dma_id = '$building_dma_id' WHERE webgis_id = '$webgis_id'");
} }
} else { $pdo -> query("UPDATE buildings SET account_no = '$account_no', building_category = '$building_category', building_storey = '$building_storey', building_population = '$building_population', building_location = '$building_location', building_dma_id = '$building_dma_id' WHERE webgis_id = '$webgis_id'"); } else { $pdo -> query("UPDATE buildings SET account_no = '$account_no', building_category = '$building_category', building_storey = '$building_storey', building_population = '$building_population', building_location = '$building_location', building_dma_id = '$building_dma_id' WHERE webgis_id = '$webgis_id'");
} }
} catch (PDOException $e) { } catch (PDOException $e) {
echo "ERROR ".$e->getMessage(); echo "ERROR ".$e->getMessage();
} }
} }
if ($request == 'pipelines') { if ($request == 'pipelines') {
$webgis_id = htmlspecialchars($_POST['webgis_id'], ENT_QUOTES); $webgis_id = htmlspecialchars($_POST['webgis_id'], ENT_QUOTES);
$pipeline_id_old = htmlspecialchars($_POST['pipeline_id_old'], ENT_QUOTES); $pipeline_id_old = htmlspecialchars($_POST['pipeline_id_old'], ENT_QUOTES);
$pipeline_id = htmlspecialchars($_POST['pipeline_id'], ENT_QUOTES); $pipeline_id = htmlspecialchars($_POST['pipeline_id'], ENT_QUOTES);
$pipeline_dma_id = htmlspecialchars($_POST['pipeline_dma_id'], ENT_QUOTES); $pipeline_dma_id = htmlspecialchars($_POST['pipeline_dma_id'], ENT_QUOTES);
$pipeline_diameter = htmlspecialchars($_POST['pipeline_diameter'], ENT_QUOTES); $pipeline_diameter = htmlspecialchars($_POST['pipeline_diameter'], ENT_QUOTES);
$pipeline_location = htmlspecialchars($_POST['pipeline_location'], ENT_QUOTES); $pipeline_location = htmlspecialchars($_POST['pipeline_location'], ENT_QUOTES);
$pipeline_category = htmlspecialchars($_POST['pipeline_category'], ENT_QUOTES); $pipeline_category = htmlspecialchars($_POST['pipeline_category'], ENT_QUOTES);
$pipeline_length = htmlspecialchars($_POST['pipeline_length'], ENT_QUOTES); $pipeline_length = htmlspecialchars($_POST['pipeline_length'], ENT_QUOTES);
try { try {
if ($pipeline_id_old != $pipeline_id) { if ($pipeline_id_old != $pipeline_id) {
$result = $pdo -> query("SELECT *from pipelines where pipeline_id = '$pipeline_id' "); $result = $pdo -> query("SELECT *from pipelines where pipeline_id = '$pipeline_id' ");
if ($result -> rowCount()>0) { if ($result -> rowCount()>0) {
echo "ERROR: Pipeline ID already exists. Please choose a new ID"; echo "ERROR: Pipeline ID already exists. Please choose a new ID";
} else { } else {
$pdo -> query("UPDATE pipelines set pipeline_id = '$pipeline_id', pipeline_dma_id = '$pipeline_dma_id', pipeline_diameter = '$pipeline_diameter', pipeline_location = '$pipeline_location', pipeline_category='$pipeline_category', pipeline_length='$pipeline_length' where webgis_id = '$webgis_id'"); $pdo -> query("UPDATE pipelines set pipeline_id = '$pipeline_id', pipeline_dma_id = '$pipeline_dma_id', pipeline_diameter = '$pipeline_diameter', pipeline_location = '$pipeline_location', pipeline_category='$pipeline_category', pipeline_length='$pipeline_length' where webgis_id = '$webgis_id'");
} }
} else { } else {
$pdo -> query("UPDATE pipelines set pipeline_id = '$pipeline_id', pipeline_dma_id = '$pipeline_dma_id', pipeline_diameter = '$pipeline_diameter', pipeline_location = '$pipeline_location', pipeline_category='$pipeline_category', pipeline_length='$pipeline_length' where webgis_id = '$webgis_id'"); $pdo -> query("UPDATE pipelines set pipeline_id = '$pipeline_id', pipeline_dma_id = '$pipeline_dma_id', pipeline_diameter = '$pipeline_diameter', pipeline_location = '$pipeline_location', pipeline_category='$pipeline_category', pipeline_length='$pipeline_length' where webgis_id = '$webgis_id'");
} }
} catch(PDOException $e) { } catch(PDOException $e) {
echo "ERROR ".$e->getMessage(); echo "ERROR ".$e->getMessage();
} }
} }
if ($request == 'valves') { if ($request == 'valves') {
$webgis_id = htmlspecialchars($_POST['webgis_id'], ENT_QUOTES); $webgis_id = htmlspecialchars($_POST['webgis_id'], ENT_QUOTES);
$valve_id_old = htmlspecialchars($_POST['valve_id_old'], ENT_QUOTES); $valve_id_old = htmlspecialchars($_POST['valve_id_old'], ENT_QUOTES);
$valve_id = htmlspecialchars($_POST['valve_id'], ENT_QUOTES); $valve_id = htmlspecialchars($_POST['valve_id'], ENT_QUOTES);
$valve_dma_id = htmlspecialchars($_POST['valve_dma_id'], ENT_QUOTES); $valve_dma_id = htmlspecialchars($_POST['valve_dma_id'], ENT_QUOTES);
$valve_type = htmlspecialchars($_POST['valve_type'], ENT_QUOTES); $valve_type = htmlspecialchars($_POST['valve_type'], ENT_QUOTES);
$valve_diameter = htmlspecialchars($_POST['valve_diameter'], ENT_QUOTES); $valve_diameter = htmlspecialchars($_POST['valve_diameter'], ENT_QUOTES);
$valve_location = htmlspecialchars($_POST['valve_location'], ENT_QUOTES); $valve_location = htmlspecialchars($_POST['valve_location'], ENT_QUOTES);
$valve_visibility = htmlspecialchars($_POST['valve_visibility'], ENT_QUOTES); $valve_visibility = htmlspecialchars($_POST['valve_visibility'], ENT_QUOTES);
try { try {
if ($valve_id_old != $valve_id) { if ($valve_id_old != $valve_id) {
$result = $pdo -> query("SELECT *from valves where valve_id = '$valve_id' "); $result = $pdo -> query("SELECT *from valves where valve_id = '$valve_id' ");
if ($result -> rowCount()>0) { if ($result -> rowCount()>0) {
echo "ERROR: Valve ID already exists. Please choose a new ID"; echo "ERROR: Valve ID already exists. Please choose a new ID";
} else { } else {
$pdo -> query("UPDATE valves set valve_id = '$valve_id', valve_dma_id = '$valve_dma_id', valve_type = '$valve_type', valve_diameter = '$valve_diameter', valve_location = '$valve_location', valve_visibility = '$valve_visibility' where webgis_id = '$webgis_id' "); $pdo -> query("UPDATE valves set valve_id = '$valve_id', valve_dma_id = '$valve_dma_id', valve_type = '$valve_type', valve_diameter = '$valve_diameter', valve_location = '$valve_location', valve_visibility = '$valve_visibility' where webgis_id = '$webgis_id' ");
} }
} else { } else {
$pdo -> query("UPDATE valves set valve_id = '$valve_id', valve_dma_id = '$valve_dma_id', valve_type = '$valve_type', valve_diameter = '$valve_diameter', valve_location = '$valve_location', valve_visibility = '$valve_visibility' where webgis_id = '$webgis_id' "); $pdo -> query("UPDATE valves set valve_id = '$valve_id', valve_dma_id = '$valve_dma_id', valve_type = '$valve_type', valve_diameter = '$valve_diameter', valve_location = '$valve_location', valve_visibility = '$valve_visibility' where webgis_id = '$webgis_id' ");
} }
} catch(PDOException $e) { } catch(PDOException $e) {
echo "ERROR ".$e->getMessage(); echo "ERROR ".$e->getMessage();
} }
} }
?> ?>

File diff suppressed because it is too large Load Diff

View File

@@ -1,41 +1,41 @@
#mapdiv { #mapdiv {
height: 100vh; height: 100vh;
} }
.popup-container { .popup-container {
width: 80vw; /* 80% of the viewport width */ width: 80vw; /* 80% of the viewport width */
max-width: 300px; /* Maximum width */ max-width: 300px; /* Maximum width */
height: 60vh; /* 60% of the viewport height */ height: 60vh; /* 60% of the viewport height */
max-height: 350px; /* Maximum height */ max-height: 350px; /* Maximum height */
padding: 10px; /* Add some padding */ padding: 10px; /* Add some padding */
box-sizing: border-box; /* Ensure padding is included in width/height */ box-sizing: border-box; /* Ensure padding is included in width/height */
} }
.popup-form-group { .popup-form-group {
display: flex; /* popup-label und popup-input nebeneinander statt untereinander */ display: flex; /* popup-label und popup-input nebeneinander statt untereinander */
align-items: center; align-items: center;
margin-bottom: 15px; margin-bottom: 15px;
} }
.popup-label { .popup-label {
flex: 1; flex: 1;
margin-right: 10px; margin-right: 10px;
} }
.popup-input { .popup-input {
flex: 2; flex: 2;
} }
.popup-button-group { .popup-button-group {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.popup-button { .popup-button {
flex: 1; flex: 1;
margin-right: 10px; margin-right: 10px;
} }
.popup-button:last-child { .popup-button:last-child {
margin-right: 0; margin-right: 0;
} }