update config

This commit is contained in:
2018-10-01 12:12:24 +02:00
parent 0f09a883f4
commit b0a6f832aa
26 changed files with 1148 additions and 598 deletions

108
get.php
View File

@ -22,6 +22,7 @@
require('config.inc.php');
if (!isset($_SESSION["querystring"])) $_SESSION["querystring"] = "";
if( $_SERVER['QUERY_STRING'] != $_SESSION["querystring"] )
{
//$_SESSION["lastupdate"] = "";
@ -30,7 +31,7 @@ require('config.inc.php');
}
// Filter Datum/Zeit erstellen
if( !$_GET["filter"] || $_GET["filter"] == 1 )
if( !isset($_GET["filter"]) || $_GET["filter"] == 1 )
{
$show_filter = 1;
}
@ -39,27 +40,28 @@ require('config.inc.php');
$filter = $_GET["filter"];
}
if( $show_filter == 1 && $_SESSION["lastupdate"] == "" && !$_GET["clean"] ) {
$show_filter = filter_zeit(1);
if (!isset($_SESSION["lastupdate"])) $_SESSION["lastupdate"]="";
if (!isset($show_filter)) $show_filter="";
if( $show_filter == 1 && $_SESSION["lastupdate"] == "" && !isset($_GET["clean"]) ) {
$show_filter = filter_zeit(1);
$show_filter = " WHERE a.zeit > '$show_filter' ";
}
elseif( $show_filter == 1 && $_SESSION["lastupdate"] != "" && !$_GET["clean"] )
{
elseif( $show_filter == 1 && $_SESSION["lastupdate"] != "" && !isset($_GET["clean"]) ) {
$show_filter = " WHERE a.num > ".$_SESSION["lastupdate"];
}
elseif( $show_filter == 1 && $_GET["clean"] == "yes" )
{
$show_filter = filter_zeit(1);
}
elseif( $show_filter == 1 && $_SESSION["lastupdate"] != "" && isset($_GET["clean"]) && $_GET["clean"] == "yes" ) {
$show_filter = filter_zeit(1);
$show_filter = " WHERE a.zeit > '$show_filter' ";
}
elseif( $show_filter != 1 )
{
$show_filter = filter_zeit($filter);
else { //if( $show_filter != 1 ) {
$show_filter = filter_zeit((isset($filter)) ? $filter : 1);
$show_filter = " WHERE a.zeit > '$show_filter' ";
}
/////////
if (!isset($_GET["org_filter"])) $_GET["org_filter"] = "";
if( $_GET["org_filter"] == 'ff' )
{
$sql_org_filter = 'AND (org = "BF" OR org = "FF" OR org = "THW")';
@ -79,10 +81,10 @@ elseif( $show_filter != 1 )
//
// Daten f¸r Formatierung holen und in array->session schreiben
if( !$_SESSION["formatierung"] && !$_GET["nooutput"] )
if( (!isset($_SESSION["formatierung"]) || $_SESSION["formatierung"]=="") && (!isset($_GET["nooutput"]) || $_GET["nooutput"] == "") )
{
$result = mysql_query("SELECT id, bg_farbe, text_farbe, text_format, text_groesse, text_groesse_text FROM formatierung ORDER BY id ASC") or die (mysql_error());
while($row = mysql_fetch_array($result))
$result = mysqli_query($dbconn, "SELECT id, bg_farbe, text_farbe, text_format, text_groesse, text_groesse_text FROM formatierung ORDER BY id ASC") or die (mysqli_error($dbconn));
while($row = mysqli_fetch_array($result))
{
$formatierung[$row["id"]] = array(
"bg_farbe" => $row["bg_farbe"],
@ -101,18 +103,18 @@ elseif( $show_filter != 1 )
//
// Auslesen pocsag
//
$result = mysql_query("SELECT a.num, a.adresse AS adresse_neu, a.bezeichnung AS bezeichnung_neu, a.text, DATE_FORMAT(a.zeit, '%Y%m%d%H%i%s') AS zeit, a.funktion, a.REC_TYP, a.done,
$result = mysqli_query($dbconn, "SELECT a.num, a.adresse AS adresse_neu, a.bezeichnung AS bezeichnung_neu, a.text, DATE_FORMAT(a.zeit, '%Y%m%d%H%i%s') AS zeit, a.funktion, a.REC_TYP, a.done,
b.adresse, b.formatierung_id, b.bezeichnung,
d.id AS org_id, d.org_name, d.org, d.alarm_count, d.last_alarm
FROM dme a
LEFT JOIN ric_zvei b ON b.adresse = a.adresse
LEFT JOIN organisation d ON d.id = b.org_id
$show_filter
ORDER BY a.zeit DESC") or die (mysql_error());
while($row = mysql_fetch_array($result))
ORDER BY a.zeit DESC") or die (mysqli_error($dbconn));
while($row = mysqli_fetch_array($result))
{
if( !$_GET["filter"] || $_GET["filter"] == 1 || $_GET["clean"] == "yes" )
//echo "<br>-----------";
if( !isset($_GET["filter"]) || $_GET["filter"] == 1 || (isset($_GET["clean"]) && $_GET["clean"] == "yes") )
{
if( $row["num"] > $_SESSION["lastupdate"] ) $_SESSION["lastupdate"] = $row["num"];
}
@ -120,14 +122,14 @@ elseif( $show_filter != 1 )
$bezeichnung = $row["bezeichnung"];
// Tageswechsel ausgeben
if( get_date($row["zeit"]) != $lastday && $lastday )
if( isset($lastday) && get_date($row["zeit"]) != $lastday )
{
$tageswechsel = get_timestamp(str_replace("-","",date_dbformat($lastday))."000000");
//$nextday = '
$show[$tageswechsel] .= '
$show[$tageswechsel] = '
<tr>
<td colspan="5" bgcolor="black"><span style="color:white;font-size:16;font-weight:bold">&nbsp;Tageswechsel: '.get_date_long($row["zeit"]).'</span></td>
<td colspan="5" bgcolor="black"><span style="color:white;font-size:16px;font-weight:bold">&nbsp;Tageswechsel: ' . get_date_long($row["zeit"]) . '</span></td>
</tr>
';
}
@ -141,38 +143,58 @@ elseif( $show_filter != 1 )
if( $update_adresse_monrc && !$bezeichnung )
{
// prfen ob die ric schon vorhanden ist, wenn nicht eintragen
$result_check = mysql_query("SELECT id FROM ric_zvei WHERE adresse=".$row["adresse_neu"]);
$row_check = mysql_fetch_array($result_check);
$result_check = mysqli_query($dbconn, "SELECT id FROM ric_zvei WHERE adresse=".$row["adresse_neu"]);
$row_check = mysqli_fetch_array($result_check);
if( !$row_check["id"] )
{
$result_check = mysql_query("INSERT INTO ric_zvei (adresse, bezeichnung, rec_typ, formatierung_id) VALUES ('$row[adresse_neu]', '$row[bezeichnung_neu]', '$row[REC_TYP]', '0')") or die(mysql_error());
$result_check = mysqli_query($dbconn, "INSERT INTO ric_zvei (adresse, bezeichnung, rec_typ, formatierung_id) VALUES ('$row[adresse_neu]', '$row[bezeichnung_neu]', '$row[REC_TYP]', '0')") or die(mysqli_error($dbconn));
$bezeichnung = $row["bezeichnung_neu"];
}
}
// Wenn unbekannte Ric Wert setzen
if( !$bezeichnung && !$row["org_name"] ) $bezeichnung = 'Unbekannt';
$isNew = false;
if( empty($row["org_name"]) ) {
$check_imp = mysqli_query($dbconn, "SELECT id, i_org, i_ort, i_zusatz FROM import_ric WHERE i_ric=".$row["adresse_neu"]);
$imp = mysqli_fetch_array($check_imp);
if( !empty($imp["id"])) {
$bezeichnung = $row["adresse_neu"];
$row["org_name"] = $imp["i_org"]." ".$imp["i_ort"]." ".$imp["i_zusatz"];
$isNew = true;
}
else {
$bezeichnung = 'Unbekannt';
}
}
if( !$row["org_name"] ) $row["org_name"] = $row["adresse_neu"];
// Wenn ZVEI
if( $row["REC_TYP"] == 'ZVEI' ) $row["funktion"] = $row["text"];
$row["bg_farbe"] = $formatierung[$row["formatierung_id"]]["bg_farbe"];
$row["text_farbe"] = $formatierung[$row["formatierung_id"]]["text_farbe"];
$row["text_farbe_text"] = $formatierung[$row["formatierung_id"]]["text_farbe_text"];
$row["bg_farbe_text"] = $formatierung[$row["formatierung_id"]]["bg_farbe_text"];
$row["text_groesse"] = $formatierung[$row["formatierung_id"]]["text_groesse"];
$row["text_groesse_text"] = $formatierung[$row["formatierung_id"]]["text_groesse_text"];
$row["text_format"] = $formatierung[$row["formatierung_id"]]["text_format"];
if (isset($formatierung[$row["formatierung_id"]]["bg_farbe"])) $row["bg_farbe"] = $formatierung[$row["formatierung_id"]]["bg_farbe"];
if (isset($formatierung[$row["formatierung_id"]]["text_farbe"])) $row["text_farbe"] = $formatierung[$row["formatierung_id"]]["text_farbe"];
if (isset($formatierung[$row["formatierung_id"]]["text_farbe_text"])) $row["text_farbe_text"] = $formatierung[$row["formatierung_id"]]["text_farbe_text"];
if (isset($formatierung[$row["formatierung_id"]]["bg_farbe_text"])) $row["bg_farbe_text"] = $formatierung[$row["formatierung_id"]]["bg_farbe_text"];
if (isset($formatierung[$row["formatierung_id"]]["text_groesse"])) $row["text_groesse"] = $formatierung[$row["formatierung_id"]]["text_groesse"];
if (isset($formatierung[$row["formatierung_id"]]["text_groesse_text"])) $row["text_groesse_text"] = $formatierung[$row["formatierung_id"]]["text_groesse_text"];
if (isset($formatierung[$row["formatierung_id"]]["text_format"])) $row["text_format"] = $formatierung[$row["formatierung_id"]]["text_format"];
// default Farben bestimmen
if( !$row["bg_farbe"] ) $row["bg_farbe"] = 'white';
if( !$row["text_farbe"] ) $row["text_farbe"] = 'black';
if( !$row["text_farbe_text"] ) $row["text_farbe_text"] = 'black';
if( !$row["bg_farbe_text"] ) $row["bg_farbe_text"] = '#CCCCCC';
if( !$row["text_groesse"] ) $row["text_groesse"] = '13';
if( !$row["text_groesse_text"] ) $row["text_groesse_text"] = '12';
if( !isset($row["bg_farbe"]) && $isNew == false ) {
$row["bg_farbe"] = '#FFFFFF';
}
elseif( !isset($row["bg_farbe"]) && $isNew == true ) {
$row["bg_farbe"] = '#E8C700';
}
//if( !isset($row["bg_farbe"]) ) $row["bg_farbe"] = 'white';
if( !isset($row["text_farbe"]) ) $row["text_farbe"] = 'black';
if( !isset($row["text_farbe_text"]) ) $row["text_farbe_text"] = 'black';
if( !isset($row["bg_farbe_text"]) ) $row["bg_farbe_text"] = '#CCCCCC';
if( !isset($row["text_groesse"]) ) $row["text_groesse"] = '13';
if( !isset($row["text_groesse_text"]) ) $row["text_groesse_text"] = '12';
if( !isset($row["text_format"]) ) $row["text_format"] = '1';
// pocsag in Array schreiben
//$thisday = $nextday.'
@ -201,7 +223,7 @@ elseif( $show_filter != 1 )
// Falls sich Zeit letzter Status mit pocsag berschneiden um eins erhÔøΩen
$show_time = get_timestamp($row["zeit"]);
if( $show )
if( isset($show) )
{
while( array_key_exists($show_time, $show) )
{
@ -215,7 +237,7 @@ elseif( $show_filter != 1 )
/**************************/
// Datenbank schliessen
//
mysql_close($dbconn);
mysqli_close($dbconn);
// Ausgabe für Ajax
echo "
@ -224,7 +246,7 @@ echo "
//if ($new_unwetter == 1) echo '<meta http-equiv="refresh" content="1">';
if ( $show )
if ( isset($show) )
{
echo '<table width="98%" border="0" cellspacing="1" cellpadding="0" bgcolor="#000000" valign="top">';
foreach ( $show as $item )