move www-dir to exampleAddOns

This commit is contained in:
JHCD 2015-07-14 21:40:56 +02:00
parent beb955567f
commit ad88f65d0b
70 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,12 @@
<?php
$dbhost = "localhost";
$dbuser = "root";
$dbpassword = "";
$database = "boswatch";
$tableFMS = "bos_fms";
$tableZVEI = "bos_zvei";
$tablePOC = "bos_pocsag";
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 B

View file

@ -0,0 +1,74 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<?php
require_once ("config.php");
require_once ("parser.php");
require_once ("mysql.class.php");
$db = new Database($dbhost, $dbuser, $dbpassword, $database, 1); //Show Error = 1!
?>
<html>
<head>
<title>BOSWatch</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div style="text-align: center; width: 1250px; margin: 0px auto;">
<img src="gfx/logo.png" alt="BOSWatch"><br>
<div id="navi">
<a href="index.php?overview">Overview</a> -
<a href="index.php?fms">FMS</a> -
<a href="index.php?zvei">ZVEI</a> -
<a href="index.php?pocsag">POCSAG</a> -
<a href="index.php?parser">Parser</a>
</div>
<br><br>
<?php
if(isset($_GET['overview']))
{
include("tpl/content.overview.php");
include("tpl/template.overview.php");
}
elseif(isset($_GET['fms']))
{
include("tpl/content.fms.php");
include("tpl/template.fms.php");
}
elseif(isset($_GET['zvei']))
{
include("tpl/content.zvei.php");
include("tpl/template.zvei.php");
}
elseif(isset($_GET['pocsag']))
{
include("tpl/content.pocsag.php");
include("tpl/template.pocsag.php");
}
elseif(isset($_GET['parser']))
{
include("tpl/content.parser.php");
include("tpl/template.parser.php");
}
else
{
include("tpl/content.overview.php");
include("tpl/template.overview.php");
}
?>
</div>
<div id="footer">
BOSWatch Webend | 04/2015 - <?php echo date("m/Y"); ?> | find us on <a href="https://github.com/Schrolli91/BOSWatch" target="_blank">GitHub</a><br>
Author Webend: <a href="https://github.com/Schrolli91" target="_blank">Bastian Schroll</a>
</div>
</body>
</html>

View file

@ -0,0 +1,134 @@
<?php class Database
/**
Simple Database Class (C) by Bastian Schroll
**/
{
//Variablen
private $conn = null;
private $result = null;
private $show_error = 1;
/**
* Database::__construct()
*
* Stellt eine Verbung mit der MySQL Datenbank fest
*
* @param mixed $host Hostname des Datenbank Server
* @param mixed $user Username des Datenbank Nutzers
* @param mixed $password Passwort des Datenbank Nutzers
* @param mixed $database Name der Datenbank
* @param integer $show_error Zeige Fehlermeldungen
* @return TRUE/FALSE
*/
function __construct($host, $user, $password, $database, $show_error = 1)
{
$this->show_error = $show_error;
@$this->conn = mysql_connect($host, $user, $password);
if ($this->conn == false)
{
$this->error("Keine Verbindung zum Datenbank Server!", mysql_error());
return false;
}
if (!@mysql_select_db($database, $this->conn))
{
$this->error("Datenbank nicht gefunden!", mysql_error());
return false;
}
return true;
}
/**
* Database::query()
*
* F<EFBFBD>hrt einen MySQL Query aus
*
* @param mixed $query Auszuf<EFBFBD>hrender Query
* @return Result-Handler/FALSE
*/
function query($query)
{
$this->result = @mysql_query($query, $this->conn);
if ($this->result == false)
{
$this->error("Fehlerhafte Datenbank Anfrage!", mysql_error());
return false;
}
return $this->result;
}
/**
* Database::fetchAssoc()
*
* Liefert alle gefundnen Datens<EFBFBD>tze als Assoc
*
* @param mixed $result Externer Result-Handler
* @return gefundene Datens<EFBFBD>tze als Assoc
*/
function fetchAssoc($result = null)
{
if ($result != null)
{
return @mysql_fetch_assoc($result);
} else
{
return @mysql_fetch_assoc($this->result);
}
}
/**
* Database::count()
*
* Z<EFBFBD>hlt alle gefundenen Datens<EFBFBD>tze
*
* @param mixed $result Externer Result-Handler
* @return Anzahl gefundener Datens<EFBFBD>tze
*/
function count($result = null)
{
if ($result != null)
{
return @mysql_num_rows($result);
} else
{
return @mysql_num_rows($this->result);
}
}
/**
* Database::closeConnection()
*
* Schlie<EFBFBD>t die bestehende MySQL Verbindung
*
* @return TRUE/FALSE
*/
function closeConnection()
{
if (!@mysql_close($this->conn))
{
$this->error("Verbindung zur Datenbank konnte nicht getrennt werden!", mysql_error());
return false;
}
return true;
}
/**
* Database::error()
*
* Gibt eine Interne Fehlermeldung aus
*
* @param mixed $error_msg Text der Fehlermeldung
* @param mixed $sql_err MySQL Fehlermeldung per mysql_error()
* @return NULL
*/
private function error($error_msg, $sql_err)
{
if ($this->show_error)
{
echo "<br><strong>MySQL Error: $error_msg</strong><br>$sql_err";
return true;
//exit();
}
}
} ?>

View file

@ -0,0 +1,111 @@
<?php
// TRBOS-FMS http://www.lfs-bw.de/Fachthemen/Digitalfunk-Funk/Documents/Pruefstelle/TRBOS-FMS.pdf
// FMS Bayern https://www.stmi.bayern.de/assets/stmi/sus/feuerwehr/id2_17a_03_02_fms_kenng_fw_anl1_20020523.pdf
function parse($mode, $data)
{
//Data for Service Parsing
$service = array(
"0" => "Unbekannt",
"1" => "Polizei",
"2" => "Bundesgrenzschutz",
"3" => "Bundeskriminalamt",
"4" => "Katastrophenschutz",
"5" => "Zoll",
"6" => "Feuerwehr",
"7" => "Technisches Hilfswerk",
"8" => "Arbeiter-Samariter-Bund",
"9" => "Deutsches Rotes Kreuz",
"a" => "Johanniter-Unfall-Hilfe",
"b" => "Malteser-Hilfsdienst",
"c" => "Deutsche Lebensrettungsgesellschaft",
"d" => "Rettungsdienst",
"e" => "Zivilschutz",
"f" => "Fernwirktelegramm",
);
//Data for Country Parsing
$country = array(
"0" => "Sachsen",
"1" => "Bund",
"2" => "Baden-Württemberg",
"3" => "Bayern I",
"4" => "Berlin",
"5" => "Bremen",
"6" => "Hamburg",
"7" => "Hessen",
"8" => "Niedersachsen",
"9" => "Nordrhein-Westfalen",
"a" => "Rheinland-Pflaz",
"b" => "Schleswig-Holstein",
"c" => "Saarland",
"d" => "Bayern II",
"e" => "Meck-Pom/Sachsen-Anhalt",
"f" => "Brandenburg/Thüringen",
);
//Data for ZVEI Parsing
$zvei = array(
"12345" => "testZvei",
"23456" => "testZvei",
"34567" => "testZvei",
);
switch ($mode) {
//Parse Service
case "service":
$data = substr($data,0,1);
if (array_key_exists($data, $service))
{
return $service[$data];
}else
{
return $data;
}
break;
//Parse Country
case "country":
$data = substr($data,1,1);
if (array_key_exists($data, $country))
{
return $country[$data];
}else
{
return $data;
}
break;
//Parse direction
case "direction":
if (substr($data,9,1) == 1)
{
return "L->F";
}elseif (substr($data,9,1) == 0)
{
return "F->L";
}else
{
return "ERR!";
}
break;
//Parse Zvei
case "zvei":
if (array_key_exists($data, $zvei))
{
return $data ." - ". $zvei[$data];
}else
{
return $data;
}
break;
default:
return "Parser: mode error!";
}
}
?>

View file

@ -0,0 +1,48 @@
/*navigation*/
#navi{
width: 400px;
margin: auto;
border: 1px solid black;
padding: 5px;
font-weight: bold;
}
#navi a:link { color: red; text-decoration: none;}
#navi a:visited { color: red; }
#navi a:hover { color: black; }
#navi a:active { color: black; }
/*table center and border in*/
table { margin: auto; border-collapse: collapse; }
/*Tabellen mit Rahmen*/
table, th, td { border: 1px solid black; }
/*alternating line color in table*/
/*without first line (header)*/
tr:nth-child(2n+2) { background: white; }
tr:nth-child(2n+3) { background: lightgray; }
/*table head*/
.tableHead{
color: white;
background-color: #BE2F01;
font-weight: bold;
}
.highlight {
color: #BE2F01;
font-weight: bold;
border: 2px solid #BE2F01;
}
/*footer*/
#footer{
margin-top: 50px;
margin-bottom: 25px;
text-align: center;
color: gray;
}
#footer a{ color: gray; font-weight: bold;}

View file

@ -0,0 +1,10 @@
<?php
//read FMS
$db->query("SELECT id, time, fms, status, direction, directionText, tsi, description FROM ".$tableFMS." ORDER BY id DESC");
$Rows = array();
while ($daten = $db->fetchAssoc())
{
$Rows[] = $daten;
}
$tpl['fms'] = $Rows;
?>

View file

@ -0,0 +1,11 @@
<?php
//read all
$db->query("SELECT id, time, concat(fms, ' Stat:', status, ' (', directionText, ')') as data, description, 'fms' AS typ FROM ".$tableFMS." UNION ALL SELECT id, time, zvei as data, description, 'zvei' AS typ FROM ".$tableZVEI." UNION ALL SELECT id, time, concat(ric, ' ', functionChar) as data, description, 'pocsag' AS typ FROM ".$tablePOC." ORDER BY time DESC LIMIT 25");
$Rows = array();
while ($daten = $db->fetchAssoc())
{
$Rows[] = $daten;
}
$tpl['lastAla'] = $Rows;

View file

@ -0,0 +1,3 @@
<?php
?>

View file

@ -0,0 +1,10 @@
<?php
//read POCSAG
$db->query("SELECT id, time, ric, function, functionChar, bitrate, msg, description FROM ".$tablePOC." ORDER BY id DESC");
$Rows = array();
while ($daten = $db->fetchAssoc())
{
$Rows[] = $daten;
}
$tpl['poc'] = $Rows;
?>

View file

@ -0,0 +1,10 @@
<?php
//read ZVEI
$db->query("SELECT id, time, zvei, description FROM ".$tableZVEI." ORDER BY id DESC");
$Rows = array();
while ($daten = $db->fetchAssoc())
{
$Rows[] = $daten;
}
$tpl['zvei'] = $Rows;
?>

View file

@ -0,0 +1,35 @@
<b>Last FMS data</b>
<table style="width: 1000px;">
<tr class="tableHead">
<td>ID</td>
<td>Datum - Zeit</td>
<td>FMS</td>
<td>Stat.</td>
<td>Richt.</td>
<td>TKI</td>
<td>Beschreibung</td>
</tr>
<?php
foreach ($tpl['fms'] as $fms)
{
$time = strtotime($fms['time']);
$time = date("d.m.Y H:i:s", $time);
if(!empty($_GET['id']) && $_GET['id'] == $fms['id']){
echo "<tr class='highlight'>";
}
else{
echo "<tr>";
}
echo "<td>". $fms['id'] . "</td>";
echo "<td>". $time . "</td>";
echo "<td>". $fms['fms'] . "</td>";
echo "<td>". $fms['status'] . "</td>";
echo "<td>". $fms['direction'] . " = " . $fms['directionText'] . "</td>";
echo "<td>". $fms['tsi'] . "</td>";
echo "<td>". $fms['description'] . "</td>";
echo "</tr>";
}
?>
</table>

View file

@ -0,0 +1,30 @@
<div>
<b>Last data (max. 25)</b>
<table style="width: 800px;">
<tr class="tableHead">
<td>ID</td>
<td>Datum - Zeit</td>
<td>Typ</td>
<td>Daten</td>
<td>Beschreibung</td>
<td></td>
</tr>
<?php
foreach ($tpl['lastAla'] as $lastAla)
{
$time = strtotime($lastAla['time']);
$time = date("d.m.Y H:i:s", $time);
echo "<tr>";
echo "<td>". $lastAla['id'] . "</td>";
echo "<td>". $time . "</td>";
echo "<td>". $lastAla['typ'] . "</td>";
echo "<td>". $lastAla['data'] . "</td>";
echo "<td>". $lastAla['description'] . "</td>";
echo "<td><a href='index.php?" . $lastAla['typ'] . "&id=" . $lastAla['id'] . "'><img src='gfx/lupe.png' alt='show'></a></td>";
echo "</tr>";
}
?>
</table>
</div>

View file

@ -0,0 +1 @@
no function yet!

View file

@ -0,0 +1,35 @@
<b>Last POCSAG data</b>
<table style="width: 1000px;">
<tr class="tableHead">
<td>ID</td>
<td>Datum - Zeit</td>
<td>RIC</td>
<td>Funktion</td>
<td>Bitrate</td>
<td>Nachricht</td>
<td>Beschreibung</td>
</tr>
<?php
foreach ($tpl['poc'] as $poc)
{
$time = strtotime($poc['time']);
$time = date("d.m.Y H:i:s", $time);
if(!empty($_GET['id']) && $_GET['id'] == $poc['id']){
echo "<tr class='highlight'>";
}
else{
echo "<tr>";
}
echo "<td>". $poc['id'] . "</td>";
echo "<td>". $time . "</td>";
echo "<td>". $poc['ric'] . "</td>";
echo "<td>". $poc['function'] . " = " . $poc['functionChar'] . "</td>";
echo "<td>". $poc['bitrate'] . "</td>";
echo "<td>". $poc['msg'] . "</td>";
echo "<td>". $poc['description'] . "</td>";
echo "</tr>";
}
?>
</table>

View file

@ -0,0 +1,29 @@
<b>Last ZVEI data</b>
<table style="width: 600px;">
<tr class="tableHead">
<td>ID</td>
<td>Datum - Zeit</td>
<td>Schleife</td>
<td>Beschreibung</td>
</tr>
<?php
foreach ($tpl['zvei'] as $zvei)
{
$time = strtotime($zvei['time']);
$time = date("d.m.Y H:i:s", $time);
if(!empty($_GET['id']) && $_GET['id'] == $zvei['id']){
echo "<tr class='highlight'>";
}
else{
echo "<tr>";
}
echo "<td>". $zvei['id'] . "</td>";
echo "<td>". $time . "</td>";
echo "<td>". $zvei['zvei'] . "</td>";
echo "<td>". $zvei['description'] . "</td>";
echo "</tr>";
}
?>
</table>