monitor-frontend/index.php

320 lines
11 KiB
PHP
Raw Permalink Normal View History

2018-08-04 10:53:24 +02:00
<?php
require_once("config.inc.php");
// Filter Datum/Zeit erstellen
2018-08-04 15:49:43 +02:00
if( !isset($_GET["filter"]) && !isset($_SESSION["filter"]) )
2018-08-04 10:53:24 +02:00
{
$filter = 1;
}
2018-08-04 15:49:43 +02:00
elseif( !isset($_GET["filter"]) && isset($_SESSION["filter"]) )
2018-08-04 10:53:24 +02:00
{
$filter = $_SESSION["filter"];
}
2018-08-04 15:49:43 +02:00
elseif( isset($_GET["filter"]) )
2018-08-04 10:53:24 +02:00
{
$filter = $_GET["filter"];
$_SESSION["filter"] = $_GET["filter"];
}
// Filter organisation
2018-08-04 15:49:43 +02:00
if( !isset($_GET["org_filter"]) && !isset($_SESSION["org_filter"]) )
2018-08-04 10:53:24 +02:00
{
$org_filter = '';
}
2018-08-04 15:49:43 +02:00
elseif( !isset($_GET["org_filter"]) && isset($_SESSION["org_filter"]) )
2018-08-04 10:53:24 +02:00
{
if( $_SESSION["org_filter"] == 'AND (org = "BF" OR org = "FF")' )
{
$org_filter = 'ff';
}
else
{
$org_filter = $_SESSION["org_filter"];
}
}
2018-08-04 15:49:43 +02:00
elseif( isset($_GET["org_filter"]) && $_GET["org_filter"] != 'all' )
2018-08-04 10:53:24 +02:00
{
$org_filter = $_GET["org_filter"];
$_SESSION["org_filter"] = $_GET["org_filter"];
}
elseif( $_GET["org_filter"] == 'all' )
{
$org_filter = '';
$_SESSION["org_filter"] = '';
}
// Filter Status anzeigen
2018-08-04 19:22:23 +02:00
if( (!isset($_GET["stat"]) || $_GET["stat"] == "") && (!isset($_SESSION["stat"]) || $_SESSION["stat"] == "") )
2018-08-04 10:53:24 +02:00
{
2018-08-04 19:22:23 +02:00
$stat = '0';
2018-08-04 10:53:24 +02:00
}
2018-08-04 19:22:23 +02:00
elseif( (isset($_GET["stat"]) && $_GET["stat"] == '') && isset($_SESSION["stat"]) )
2018-08-04 10:53:24 +02:00
{
$stat = $_SESSION["stat"];
}
2018-08-04 19:22:23 +02:00
elseif( isset($_GET["stat"]) && $_GET["stat"] != "" )
2018-08-04 10:53:24 +02:00
{
$stat = $_GET["stat"];
$_SESSION["stat"] = $_GET["stat"];
}
2018-08-04 19:22:23 +02:00
else {
$stat = 0;
}
2018-08-04 10:53:24 +02:00
// Wenn Aktualisierung ohne Ausgabe
2018-08-04 19:22:23 +02:00
if( isset($_GET["nooutput"]) && $_GET["nooutput"] == 1 ) { $filter = 1; $stat = 1; }
2018-08-04 10:53:24 +02:00
$show_filter = filter_zeit($filter);
2018-08-04 19:22:23 +02:00
$show_filter = " WHERE a.zeit > '$show_filter' ";
2018-08-04 10:53:24 +02:00
$refresh = '
<input type=button name="refresh" value="Aktualisieren" onClick="history.go()">
';
$nav_org_filter = '
<select name="org_filter" onChange="MM_jumpMenu(\'parent\',this,0)">
2018-08-04 19:22:23 +02:00
<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>
2018-08-04 10:53:24 +02:00
</select>
';
$nav_filter = '
<select id="filter" name="filter" onChange="MM_jumpMenu(\'parent\',this,0)">
2018-08-04 15:49:43 +02:00
<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>
2018-08-04 10:53:24 +02:00
</select>
';
2018-08-04 15:49:43 +02:00
if (!isset($java_script)) $java_script = "";
2018-08-04 10:53:24 +02:00
$java_script .= "
<script type=\"text/javascript\" language=\"javascript\">
function trim(txt){
return txt.replace(/^\s+|\s+$/g,\"\");
}
function toggleindicator(status){
//Diese Variable definiert wie lange der Indicator mindestens da sein soll.
var timetowait = 2100;
if(status=='off') {
window.setTimeout(toggleindicator(\"dooff\"),2100);
}else if (status=='dooff'){
document.getElementById(\"loading-indicator\").style.display='none';
} 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();
}
}
var http_request = false;
var http_request2 = false;
function macheRequest(cleanCounter) {
var doreload = '5' // Realod in sek
var cleanIt = '600'; // Wann soll neu geladen werden in sek
autoclean = cleanIt / doreload;
doreload = doreload * 1000;
if( cleanCounter > 99999999) {
doreload = 5000;
}
if( cleanCounter >= autoclean ) {
var url = 'get.php?".$_SERVER['QUERY_STRING']."&clean=yes';
} else {
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);
if( cleanCounter >= autoclean ) {
http_request.onreadystatechange = alertInhaltClean;
var cleanCounter = 1;
} else {
http_request.onreadystatechange = alertInhalt;
var cleanCounter = cleanCounter + 1;
}
http_request.send(null);
if (document.getElementById(\"filter\").options[5].selected == true) {
window.setTimeout(function() {macheRequest(cleanCounter);},doreload);
}
}
function alertInhalt() {
if (http_request.readyState == 4) {
var answer = http_request.responseText;
var answer = answer.replace(\"<html>\", \"\");
var answer = answer.replace(\"</html>\", \"\");
if (answer != '') {
if(document.getElementById(\"inhalt\").innerHTML != answer){
document.getElementById(\"inhalt\").innerHTML = answer + document.getElementById(\"inhalt\").innerHTML;
}
}
if(document.getElementById(\"loading-indicator\").style.display=='')
{
toggleindicator(\"off\");
}
}
}
function alertInhaltClean() {
if (http_request.readyState == 4) {
var answer = http_request.responseText;
var answer = answer.replace(\"<html>\", \"\");
var answer = answer.replace(\"</html>\", \"\");
if (answer != '') {
if(document.getElementById(\"inhalt\").innerHTML != answer){
document.getElementById(\"inhalt\").innerHTML = answer;
}
}
if(document.getElementById(\"loading-indicator\").style.display=='')
{
toggleindicator(\"off\");
}
}
}
/// 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()\",5000);
}
function alertSecondaryInhalt() {
if (http_request2.readyState == 4) {
var answer = http_request2.responseText;
if (answer != '') {
var answer = answer.replace(\"<html>\", \"\");
var answer = answer.replace(\"</html>\", \"\");
var answerContents = answer.split(\"|\");
var answer_OnlUsers = trim(answerContents[0]);
var answer_Unwetter = trim(answerContents[1]);
var answer_Unwetter = answer_Unwetter.split(\"@\");
var answer_UserPM = trim(answerContents[2]);
if(document.getElementById(\"onlUsers\").innerHTML != answer_OnlUsers && answer_OnlUsers != \"\"){
document.getElementById(\"onlUsers\").innerHTML = answer_OnlUsers;
}
2018-08-04 19:22:23 +02:00
/*
2018-08-04 10:53:24 +02:00
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];
}
2018-08-04 19:22:23 +02:00
*/
2018-08-04 10:53:24 +02:00
if(document.getElementById(\"PrivateMessage\").innerHTML != answer_UserPM && answer_UserPM != \"\"){
document.getElementById(\"PrivateMessage\").innerHTML = answer_UserPM;
} else {
document.getElementById(\"PrivateMessage\").innerHTML = \"\";
}
} else {
document.getElementById(\"onlUsers\").innerHTML = \"\";
}
}
}
// SQL ausfuehren
function execSQL(url) {
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('POST', url, true);
// http_request2.onreadystatechange = alert(\"Geloescht, bitte kurz warten!\");
http_request2.send(null);
}
function doSQL(what, pk) {
if( what == \"deletepm\" ) {
url = \"pmfunctions.inc.php?pmdo=deletepm&msg_id=\"+pk;
// document.getElementById(\"PrivateMessage\").innerHTML = '<br>Wird gel&ouml;scht';
}
execSQL(url);
}
</script>
";
2018-08-04 15:49:43 +02:00
if (!isset($page_middle)) $page_middle = "";
2018-08-04 10:53:24 +02:00
eval ("dooutput(\"".gettemplate($template_dir."rahmen")."\");");