corrected autoupdate functions

This commit is contained in:
Manuel Weiser 2018-08-04 19:22:23 +02:00
parent 8cf053078a
commit a8f497f3c2
10 changed files with 40 additions and 239 deletions

View File

@ -67,7 +67,7 @@ $body_html
<!-- ENDE Navigation -->
<!-- START Messages und Unwettermeldungen -->
<!--
<tr>
<td height="1%" align="center" valign="top">
@ -93,7 +93,7 @@ $body_html
</td>
</tr>
-->
<!-- ENDE Messages und Unwettermeldungen -->
<!-- START Mittelteil -->

View File

@ -52,7 +52,7 @@ if( trim($row["funktion"]) != 'Klartext' && trim($row["funktion"]) != 'Info' &&
if ( $row_alarm_mail["ft_allow"] == 1 )
{
// Wenn FullText erlaubt
mail_alarm(get_date_long($row["zeit"]), get_time($row["zeit"]), $row_alarm_mail["a_mail"],$row["org"],$row["org_name"],$row["bezeichnung"],utf8_decode($row["text"]));
mail_alarm(get_date_long($row["zeit"]), get_time($row["zeit"]), $row_alarm_mail["a_mail"],$row["org"],$row["org_name"],$row["bezeichnung"],$row["text"]);
}
else
{

View File

@ -61,7 +61,8 @@ require('config.inc.php');
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);
@ -129,6 +130,7 @@ if( ($timestampnow - $row["u_lastcheck"]) > ($uw_checktime * 100) )
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);
?>

View File

@ -27,7 +27,7 @@
// http://board.fire-devils.org oder manuelw@fire-devils.org
//
// Damit auch alles in die DB gespeichert wird sollte man
// "index.php?nooutput=1" in einen Cron aller Minute einbinden.
// "autoupdate.php?nooutput=1" in einen Cron aller Minute einbinden.
//
// Die Status müssen in der .monrc folgendermaßen
// definiert sein. Wichtig ist das KFZ: bzw LST: voran steht.
@ -96,13 +96,13 @@ $template_dir = '_html/';
$update_adresse_monrc = 1;
// IP Bereich fr auto Login
$ip_start = '192.168.1.82';
$ip_start = '192.168.1.2';
$ip_ende = '192.168.1.250';
// UserID für IP
$ip_users = array(
"192.168.1.82" => 1,
"192.168.1.21" => 1,
"192.168.1.81" => 1,
"192.168.1.80" => 1,
"192.168.1.38" => 1,
);
@ -309,12 +309,18 @@ $dbconn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname) or die (mysqli_erro
//
session_start();
if (!isset($_GET["nooutput"])) $_GET["nooutput"]="";
if ($_GET["nooutput"] == 1) {
$_SESSION["name"]="";
$_SESSION["admin"]="";
}
/////////////////
// Requires
/////////////////
require_once('functions.inc.php');
require_once('loginfunctions.inc.php');
//if( $pmenable == '1' && $_GET["nooutput"] != '1' && $_SESSION["pmallow"] == '1' ) require_once('pmfunctions.inc.php');
if ($_GET["nooutput"] != '1') require_once('loginfunctions.inc.php');
if( $pmenable == '1' && $_GET["nooutput"] != '1' && $_SESSION["pmallow"] == '1' ) require_once('pmfunctions.inc.php');
//if( $uw_checktime > 0 ) require_once('uw_check.inc.php');
///////////////////
@ -329,7 +335,7 @@ if( $_SESSION["name"] )
// Navigationsleiste
$nav_menu = '<a href="index.php">Home</a>&nbsp;|&nbsp;';
//$nav_menu .= '<a href="suche.php">Suche</a>&nbsp;|&nbsp;';
$nav_menu .= '<a href="suche.php">Suche</a>&nbsp;|&nbsp;';
//$nav_menu .= '<a href="kfz.php">Fahrzeuge</a>&nbsp;|&nbsp;';
$nav_menu .= '<a href="profile.php">Profil</a>&nbsp;|&nbsp;';
//$nav_menu .= '<a href="stats.php">Stats</a>&nbsp;|&nbsp;';

View File

@ -41,7 +41,7 @@ require('config.inc.php');
}
if (!isset($_SESSION["lastupdate"])) $_SESSION["lastupdate"];
if (!isset($show_filter)) $show_filter;
if (!isset($show_filter)) $show_filter="";
if( $show_filter == 1 && $_SESSION["lastupdate"] == "" && !isset($_GET["clean"]) ) {
$show_filter = filter_zeit(1);
@ -55,7 +55,7 @@ elseif( $show_filter == 1 && $_SESSION["lastupdate"] != "" && isset($_GET["clean
$show_filter = " WHERE a.zeit > '$show_filter' ";
}
else { //if( $show_filter != 1 ) {
$show_filter = filter_zeit((isset($filter) ? $filter : 1));
$show_filter = filter_zeit((isset($filter)) ? $filter : 1);
$show_filter = " WHERE a.zeit > '$show_filter' ";
}
@ -81,7 +81,7 @@ else { //if( $show_filter != 1 ) {
//
// Daten f¸r Formatierung holen und in array->session schreiben
if( !isset($_SESSION["formatierung"]) && !isset($_GET["nooutput"]) )
if( (!isset($_SESSION["formatierung"]) || $_SESSION["formatierung"]=="") && (!isset($_GET["nooutput"]) || $_GET["nooutput"] == "") )
{
$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))
@ -129,7 +129,7 @@ else { //if( $show_filter != 1 ) {
//$nextday = '
$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>
';
}

View File

@ -44,25 +44,28 @@ require_once("config.inc.php");
}
// Filter Status anzeigen
if( !isset($_GET["stat"]) && !isset($_SESSION["stat"]) )
if( (!isset($_GET["stat"]) || $_GET["stat"] == "") && (!isset($_SESSION["stat"]) || $_SESSION["stat"] == "") )
{
$stat = '0';
$stat = '0';
}
elseif( $_GET["stat"] == '' && isset($_SESSION["stat"]) )
elseif( (isset($_GET["stat"]) && $_GET["stat"] == '') && isset($_SESSION["stat"]) )
{
$stat = $_SESSION["stat"];
}
elseif( $_GET["stat"] != '' )
elseif( isset($_GET["stat"]) && $_GET["stat"] != "" )
{
$stat = $_GET["stat"];
$_SESSION["stat"] = $_GET["stat"];
}
else {
$stat = 0;
}
// Wenn Aktualisierung ohne Ausgabe
if( isset($_GET["nooutput"]) ) { $filter = 1; $stat = 1; }
if( isset($_GET["nooutput"]) && $_GET["nooutput"] == 1 ) { $filter = 1; $stat = 1; }
$show_filter = filter_zeit($filter);
$show_filter = " WHERE a.zeit > '$show_filter' ";
$show_filter = " WHERE a.zeit > '$show_filter' ";
$refresh = '
<input type=button name="refresh" value="Aktualisieren" onClick="history.go()">
@ -70,9 +73,9 @@ require_once("config.inc.php");
$nav_org_filter = '
<select name="org_filter" onChange="MM_jumpMenu(\'parent\',this,0)">
<option value="'.$_SERVER["PHP_SELF"].'?filter='.$filter.'&org_filter=ff&stat=0"'; if( $org_filter == 'ff' && $stat == '0' ) $nav_org_filter .= 'selected'; $nav_org_filter .= '>Feuerwehr</option>
<option value="'.$_SERVER["PHP_SELF"].'?filter='.$filter.'&org_filter=rd&stat=0"'; if( $org_filter == 'rd' && $stat == '0' ) $nav_org_filter .= 'selected'; $nav_org_filter .= '>Rettungsdienst</option>
<option value="'.$_SERVER["PHP_SELF"].'?filter='.$filter.'&org_filter=all&stat=0"'; if( !$org_filter && $stat == '0' ) $nav_org_filter .= 'selected'; $nav_org_filter .= '>FW und RD</option>
<option value="'.$_SERVER["PHP_SELF"].'?filter='.$filter.'&org_filter=ff&stat=0"'; if( $org_filter == 'ff') $nav_org_filter .= 'selected'; $nav_org_filter .= '>Feuerwehr</option>
<option value="'.$_SERVER["PHP_SELF"].'?filter='.$filter.'&org_filter=rd&stat=0"'; if( $org_filter == 'rd') $nav_org_filter .= 'selected'; $nav_org_filter .= '>Rettungsdienst</option>
<option value="'.$_SERVER["PHP_SELF"].'?filter='.$filter.'&org_filter=all&stat=0"'; if( $org_filter == "") $nav_org_filter .= 'selected'; $nav_org_filter .= '>FW und RD</option>
</select>
';
@ -87,7 +90,6 @@ require_once("config.inc.php");
</select>
';
if (!isset($java_script)) $java_script = "";
$java_script .= "
<script type=\"text/javascript\" language=\"javascript\">
@ -257,10 +259,12 @@ function toggleindicator(status){
document.getElementById(\"onlUsers\").innerHTML = answer_OnlUsers;
}
/*
if(document.getElementById(\"Unwetter\").innerHTML != answer_Unwetter[1] && answer_Unwetter[1] != \"\"){
document.getElementById(\"Unwetter\").innerHTML = answer_Unwetter[0];
document.getElementById(\"UnwetterContent\").innerHTML = answer_Unwetter[1];
}
*/
if(document.getElementById(\"PrivateMessage\").innerHTML != answer_UserPM && answer_UserPM != \"\"){
document.getElementById(\"PrivateMessage\").innerHTML = answer_UserPM;

View File

@ -1,211 +0,0 @@
<?php
require_once("config.inc.php");
// Filter Datum/Zeit erstellen
if( !$_GET["filter"] && !$_SESSION["filter"] )
{
$filter = 1;
}
elseif( !$_GET["filter"] && $_SESSION["filter"] )
{
$filter = $_SESSION["filter"];
}
elseif( $_GET["filter"] )
{
$filter = $_GET["filter"];
$_SESSION["filter"] = $_GET["filter"];
}
// Filter organisation
if( !$_GET["org_filter"] && !$_SESSION["org_filter"] )
{
$org_filter = '';
}
elseif( !$_GET["org_filter"] && $_SESSION["org_filter"] )
{
if( $_SESSION["org_filter"] == 'AND (org = "BF" OR org = "FF")' )
{
$org_filter = 'ff';
}
else
{
$org_filter = $_SESSION["org_filter"];
}
}
elseif( $_GET["org_filter"] && $_GET["org_filter"] != 'all' )
{
$org_filter = $_GET["org_filter"];
$_SESSION["org_filter"] = $_GET["org_filter"];
}
elseif( $_GET["org_filter"] == 'all' )
{
$org_filter = '';
$_SESSION["org_filter"] = '';
}
// Filter Status anzeigen
if( $_GET["stat"] == '' && !$_SESSION["stat"] )
{
$stat = '0';
}
elseif( $_GET["stat"] == '' && $_SESSION["stat"] )
{
$stat = $_SESSION["stat"];
}
elseif( $_GET["stat"] != '' )
{
$stat = $_GET["stat"];
$_SESSION["stat"] = $_GET["stat"];
}
// Wenn Aktualisierung ohne Ausgabe
if( $_GET["nooutput"] ) { $filter = 1; $stat = 1; }
$show_filter = filter_zeit($filter);
$show_filter = " WHERE a.zeit > '$show_filter' ";
$refresh = '
<input type=button name="refresh" value="Aktualisieren" onClick="history.go()">
';
$nav_org_filter = '
<select name="org_filter" onChange="MM_jumpMenu(\'parent\',this,0)">
<option value="'.$_SERVER["PHP_SELF"].'?filter='.$filter.'&org_filter=ff&stat=0"'; if( $org_filter == 'ff' && $stat == '0' ) $nav_org_filter .= 'selected'; $nav_org_filter .= '>Feuerwehr</option>
<option value="'.$_SERVER["PHP_SELF"].'?filter='.$filter.'&org_filter=rd&stat=0"'; if( $org_filter == 'rd' && $stat == '0' ) $nav_org_filter .= 'selected'; $nav_org_filter .= '>Rettungsdienst</option>
<option value="'.$_SERVER["PHP_SELF"].'?filter='.$filter.'&org_filter=all&stat=0"'; if( !$org_filter && $stat == '0' ) $nav_org_filter .= 'selected'; $nav_org_filter .= '>FW und RD</option>
</select>
';
$nav_filter = '
<select id="filter" name="filter" onChange="MM_jumpMenu(\'parent\',this,0)">
<option value="'.$_SERVER["PHP_SELF"].'?filter=48&org_filter='.$org_filter.'&stat='.$stat.'&aq='.$aq.'"'; if( $filter == 48 ) $nav_filter .= 'selected'; $nav_filter .= '>48</option>
<option value="'.$_SERVER["PHP_SELF"].'?filter=24&org_filter='.$org_filter.'&stat='.$stat.'&aq='.$aq.'"'; if( $filter == 24 ) $nav_filter .= 'selected'; $nav_filter .= '>24</option>
<option value="'.$_SERVER["PHP_SELF"].'?filter=10&org_filter='.$org_filter.'&stat='.$stat.'&aq='.$aq.'"'; if( $filter == 10 ) $nav_filter .= 'selected'; $nav_filter .= '>10</option>
<option value="'.$_SERVER["PHP_SELF"].'?filter=5&org_filter='.$org_filter.'&stat='.$stat.'&aq='.$aq.'"'; if( $filter == 5 ) $nav_filter .= 'selected'; $nav_filter .= '>5</option>
<option value="'.$_SERVER["PHP_SELF"].'?filter=2&org_filter='.$org_filter.'&stat='.$stat.'&aq='.$aq.'"'; if( $filter == 2 ) $nav_filter .= 'selected'; $nav_filter .= '>2</option>
<option value="'.$_SERVER["PHP_SELF"].'?filter=1&org_filter='.$org_filter.'&stat='.$stat.'&aq='.$aq.'"'; if( $filter == 1 ) $nav_filter .= 'selected'; $nav_filter .= '>1</option>
</select>
';
$java_script .= "
<script type=\"text/javascript\" language=\"javascript\">
var http_request = false;
var http_request2 = false;
function toggleindicator(status){
//Diese Variable definiert wie lange der Indicator mindestens da sein soll.
var timetowait = 2100;
if(status=='off') {
var vergangen = new Date().getTime() - time
if( vergangen >=timetowait) {
document.getElementById(\"loading-indicator\").style.display='none';
} else {
setTimeout(toggleindicator(\"off\"),timetowait - vergangen);
}
} else {
document.getElementById(\"loading-indicator\").style.display='';
document.getElementById(\"loading-indicator\").style.position='absolute';
document.getElementById(\"loading-indicator\").style.left='40%';
document.getElementById(\"loading-indicator\").style.top='100px';
time = new Date().getTime();
}
}
/// second Request
function macheSecondaryRequest() {
var url = 'get_other.php';
http_request2 = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request2 = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
try {
http_request2 = new ActiveXObject(\"Msxml2.XMLHTTP\");
} catch (e) {
try {
http_request2 = new ActiveXObject(\"Microsoft.XMLHTTP\");
} catch (e) {}
}
}
if (!http_request2) {
alert('Ende :( Kann keine XMLHTTP-Instanz erzeugen');
return false;
}
http_request2.open('GET', url, true);
http_request2.onreadystatechange = alertSecondaryInhalt;
http_request2.send(null);
window.setTimeout(\"macheSecondaryRequest()\",60000);
}
function alertSecondaryInhalt() {
if (http_request2.readyState == 4) {
var answer = http_request2.responseText;
if(document.getElementById(\"onlUsers\").innerHTML != answer){
document.getElementById(\"onlUsers\").innerHTML = answer;
}
else{
document.getElementById(\"onlUsers\").innerHTML = \"\";
}
}
}
function macheRequest() {
var url = 'get.php?".$_SERVER['QUERY_STRING']."';
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject(\"Msxml2.XMLHTTP\");
} catch (e) {
try {
http_request = new ActiveXObject(\"Microsoft.XMLHTTP\");
} catch (e) {}
}
}
if (!http_request) {
alert('Ende :( Kann keine XMLHTTP-Instanz erzeugen');
return false;
}
http_request.open('GET', url, true);
http_request.onreadystatechange = alertInhalt;
http_request.send(null);
if (document.getElementById(\"filter\").options[5].selected == true) {
window.setTimeout(\"macheRequest()\",10000);
}
}
function alertInhalt() {
if (http_request.readyState == 4) {
var answer = http_request.responseText;
if(document.getElementById(\"inhalt\").innerHTML != answer){
document.getElementById(\"inhalt\").innerHTML = answer;
}
else{
document.getElementById(\"inhalt\").innerHTML = \"\";
}
if(document.getElementById(\"loading-indicator\").style.display=='')
{
toggleindicator(\"off\");
}
}
}
</script>
";
eval ("dooutput(\"".gettemplate($template_dir."rahmen")."\");");
?>

View File

@ -59,7 +59,7 @@ elseif( isset($_GET["pmdo"]) && $_GET["pmdo"] == "write" )
</select>
';
if( isset($_GET["pmdo"]) && empty($can_pm) )
if( (!isset($can_pm) || $can_pm!=1) && isset($_GET["msg_to"]) )
{
// pm_allow ist auf 0
if (!isset($message_field)) $message_field="";

View File

@ -40,7 +40,7 @@ if( !isset($_GET["do"]) )
$wap_pass = $row["wap_pass"];
if( $row["a_alarmmail2sms"] == 1 ) $checked = 'checked';
( $row["a_alarmmail2sms"] == 1 ) ? $checked = 'checked' : $checked="";
$mailform_checkbox = '<input type="checkbox" name="mail2sms" value="1" '.$checked.'>';
$mailform_mail = '<input name="alarmmail" type="text" id="alarmmail" value="'.$row["a_alarmmail"].'">';

View File

@ -26,7 +26,7 @@ $row = mysqli_fetch_array($result);
if( ($timestampnow - $row["u_lastcheck"]) > ($uw_checktime * 100) && $_GET["nooutput"] == 1 )
{
// 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') )
if( $lines = file('https://www.dwd.de/DE/wetter/warnungen/warnWetter_node.html?ort=Leipzig') )
{
// Durchgehen des Arrays und Anzeigen des HTML Source inkl. Zeilennummern
if( is_array($lines) )