137 lines
		
	
	
		
			5.6 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			137 lines
		
	
	
		
			5.6 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
<?php
 | 
						||
/*
 | 
						||
 *      PHP Frontend for pocsag monitor
 | 
						||
 *
 | 
						||
 *      Copyright (C) 2004-2005
 | 
						||
 *          Manuel Weiser (manuelw@fire-devils.org)
 | 
						||
 *
 | 
						||
 *      This program is free software; you can redistribute it and/or modify
 | 
						||
 *      it under the terms of the GNU General Public License as published by
 | 
						||
 *      the Free Software Foundation; either version 2 of the License, or
 | 
						||
 *      (at your option) any later version.
 | 
						||
 *
 | 
						||
 *      This program is distributed in the hope that it will be useful,
 | 
						||
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
						||
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
						||
 *      GNU General Public License for more details.
 | 
						||
 *
 | 
						||
 *      You should have received a copy of the GNU General Public License
 | 
						||
 *      along with this program; if not, write to the Free Software
 | 
						||
 *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 | 
						||
 */
 | 
						||
 | 
						||
require('config.inc.php');
 | 
						||
 | 
						||
	$show_filter = ' Where a.done = "0" ';
 | 
						||
 | 
						||
	$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 (mysqli_error($dbconn));
 | 
						||
	while($row = mysqli_fetch_array($result))
 | 
						||
	{
 | 
						||
 | 
						||
		if( $row["done"] == '0' )
 | 
						||
		{
 | 
						||
			require_once('alarmmail.inc.php');
 | 
						||
		}
 | 
						||
 | 
						||
		$bezeichnung	= $row["bezeichnung"];
 | 
						||
	
 | 
						||
		// Eintragen der Bezeichnung wenn Bezeichnung in monrc vorhanden und update 1
 | 
						||
		if( $update_adresse_monrc && !$bezeichnung )
 | 
						||
		{
 | 
						||
			// prfen ob die ric schon vorhanden ist, wenn nicht eintragen
 | 
						||
			$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 	= 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';
 | 
						||
		if( !$row["org_name"] ) $row["org_name"] = $row["adresse_neu"];
 | 
						||
	
 | 
						||
	}
 | 
						||
 | 
						||
/*
 | 
						||
// Unwetter Check
 | 
						||
$result	= mysqli_query($dbconn, "SELECT u_meldung, u_text, u_farbe, DATE_FORMAT(u_lastcheck, '%Y%m%d%H%i%s') AS u_lastcheck, DATE_FORMAT(u_lastchange, '%Y%m%d%H%i%s') AS u_lastchange FROM unwetter WHERE id = '1'") or die (mysqli_error($dbconn));
 | 
						||
$row = mysqli_fetch_array($result);
 | 
						||
 | 
						||
if( ($timestampnow - $row["u_lastcheck"]) > ($uw_checktime * 100) )
 | 
						||
{
 | 
						||
//	if( $lines = file('http://www.dwd.de/de/WundK/Warnungen/zeige.php?ID='.$uw_landkreis.'#O') )
 | 
						||
	if( $lines = file('http://www.dwd.de/dyn/app/ws/html/reports/'.$uw_landkreis.'_warning_de.html') )
 | 
						||
	{
 | 
						||
		// Durchgehen des Arrays und Anzeigen des HTML Source inkl. Zeilennummern
 | 
						||
		if( is_array($lines) )
 | 
						||
		{
 | 
						||
			foreach( $lines as $line_num => $line ) 
 | 
						||
			{
 | 
						||
				if( $line_num == 34 && htmlspecialchars(substr($line, 75, 6)) )
 | 
						||
				{
 | 
						||
					$unwetter_aktiv = 1;
 | 
						||
 | 
						||
					if(  htmlspecialchars(substr($line, 75, 6)) == "D90202" ) { $unwetter_status = "Warnung vor extremem Unwetter";	$unwetter_farbe = "#D90202"; }
 | 
						||
					if(  htmlspecialchars(substr($line, 75, 6)) == "FF0000" ) { $unwetter_status = "Unwetterwarnung";				$unwetter_farbe = "#FF6B39"; }
 | 
						||
					if(  htmlspecialchars(substr($line, 75, 6)) == "FFB599" ) { $unwetter_status = "Vorwarnung zur Unwetterwarnung";$unwetter_farbe = "#FFB599"; }
 | 
						||
					if(  htmlspecialchars(substr($line, 75, 6)) == "FA9600" ) { $unwetter_status = "Warnung vor markantem Wetter";	$unwetter_farbe = "#FFD553"; }
 | 
						||
					if(  htmlspecialchars(substr($line, 75, 6)) == "FFFF00" ) { $unwetter_status = "Wetterwarnung";					$unwetter_farbe = "#F0F805"; }
 | 
						||
					if(  htmlspecialchars(substr($line, 75, 6)) == "6F6FFF" ) { $unwetter_status = "Seewetterwarnung";				$unwetter_farbe = "#6F6FFF"; }
 | 
						||
				}
 | 
						||
				
 | 
						||
				if( $unwetter_aktiv == 1 && $line_num > 36 && $line_num < 56 )
 | 
						||
				{
 | 
						||
					$unwetter_meldung .= $line;
 | 
						||
				}
 | 
						||
				
 | 
						||
				// Zum Prüfen der Ausgabe deaktivieren
 | 
						||
				//echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br>\n";
 | 
						||
			}
 | 
						||
			
 | 
						||
			// Text von HTML Tags reinigen
 | 
						||
			$unwetter_meldung = htmlCode_message($unwetter_meldung);
 | 
						||
			//$unwetter_meldung = clean_htmlCode($unwetter_meldung);
 | 
						||
				//$unwetter_meldung = stripslashes($unwetter_meldung);
 | 
						||
				//$unwetter_meldung = strip_tags($unwetter_meldung, '<br>');
 | 
						||
				//echo '<br>--------------<br>msg: '.$unwetter_meldung;
 | 
						||
		}
 | 
						||
	}
 | 
						||
	
 | 
						||
	else
 | 
						||
	{
 | 
						||
		$unwetter_status 	 = 'keine Verbindung !!!';
 | 
						||
		$unwetter_farbe		 = '#FFFFFF';
 | 
						||
		$unwetter_meldung = 'Verbindung zu dwd.de nicht m<>glich !';
 | 
						||
	}
 | 
						||
	
 | 
						||
	// Wenn noch kein Eintrag in DB existiert
 | 
						||
	if( empty($row["u_lastcheck"]) )
 | 
						||
	{
 | 
						||
		mysqli_query($dbconn, "INSERT INTO unwetter (id, u_meldung, u_text, u_farbe, u_lastchange) VALUES ('1', '$unwetter_status', '$unwetter_meldung', '$unwetter_farbe', '$timestampnow')") or die(mysqli_error($dbconn));
 | 
						||
	}
 | 
						||
	
 | 
						||
	// Wenn bereits Eintrag vorhanden und Checktime erreicht
 | 
						||
	if( $unwetter_meldung == $row["u_text"] ) 
 | 
						||
	{ 
 | 
						||
		mysqli_query($dbconn, "UPDATE unwetter SET u_lastcheck='$timestampnow' WHERE id = '1'") or die(mysqli_error($dbconn));
 | 
						||
	}
 | 
						||
	else 
 | 
						||
	{ 
 | 
						||
		mysqli_query($dbconn, "UPDATE unwetter SET u_meldung='$unwetter_status', u_text='$unwetter_meldung', u_farbe='$unwetter_farbe', u_lastcheck='$timestampnow', u_lastchange='$timestampnow' WHERE id = '1'") or die(mysqli_error($dbconn));
 | 
						||
	}
 | 
						||
}
 | 
						||
*/
 | 
						||
 | 
						||
mysqli_close($dbconn);
 | 
						||
?>
 |