summaryrefslogtreecommitdiff
path: root/kml/data.php
diff options
context:
space:
mode:
Diffstat (limited to 'kml/data.php')
-rw-r--r--kml/data.php99
1 files changed, 68 insertions, 31 deletions
diff --git a/kml/data.php b/kml/data.php
index 0eef510..d50b1ad 100644
--- a/kml/data.php
+++ b/kml/data.php
@@ -1,6 +1,6 @@
<?php
-//author mtmayr@mtmayr.com, changed from data.php
-session_start();
+//author mtmayr@mtmayr.com, copy&changed from /data.php
+//session_start();
error_reporting(0);
require_once("../db.class.php");
require_once("../ipmatch.php");
@@ -12,20 +12,20 @@ header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
$db = new DB($conf['db']['user'], $conf['db']['password'], $conf['db']['host'], $conf['db']['database']);
$conf['acl']['auth'] = match_network($conf['acl']['range'],$_SERVER["REMOTE_ADDR"]);
-$handle = fopen ($conf['router']['file'],"r");
+$handle = fopen ('../'.$conf['router']['file'],"r");
while ( ($data = fgetcsv ($handle, 1000, ",")) !== FALSE ) { // Daten werden aus der Datei
$routerhash[$data[0]]=$data;
}
fclose ($handle);
-if(!$conf['acl']['auth'] )
-{
- if (isset($_SESSION['logged_in']) && $_SESSION['logged_in'])
- $conf['acl']['auth'] = true;
-}
+#if(!$conf['acl']['auth'] )
+#{
+# if (isset($_SESSION['logged_in']) && $_SESSION['logged_in'])
+# $conf['acl']['auth'] = true;
+#}
//zum Test
-//$conf['acl']['auth'] = true;
+$conf['acl']['auth'] = false;
$x_startpoint = 4080;
$lng_startpoint = 15.43844103813;
@@ -47,6 +47,7 @@ $links = array();
$already = array();
$count = array();
+
$db->query("SELECT ip, ip.name as ipname,location.id as locid,location.name as locname, node.name as nodename FROM ip, node, location WHERE ip.node_id = node.id and node.location_id=location.id");
while ($data = $db->getNextObject()) {
$locids[$data->ip]= $data->locid;
@@ -65,6 +66,7 @@ if($conf['acl']['auth'])
else
$db->query("SELECT id as locid, name as locname, pixel_x, pixel_y, gallery_link, location.hastinc as hastinc FROM location WHERE location.hidden = 0 ORDER BY name ASC");
+
while ($data = $db->getNextObject()) {
if ($data->pixel_x == "0")
continue;
@@ -97,8 +99,10 @@ while ($data = $db->getNextObject()) {
$locations[$data->locid] = $data;
}
+
+
$regmatch = '#\"(.+)\" -> \"(.+)\"\[label=\"([0-9]+.[0-9]+)\"]#';
-$lines = file($conf['topo']['file']);
+$lines = file('../'.$conf['topo']['file']);
$linecnt=0;
$i =0;
@@ -314,39 +318,50 @@ foreach ($lines as $num => $line)
}
}
-?>
-<?xml version='1.0' encoding='UTF-8'?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-<xsl:template match="root">
- <kml xmlns="http://www.opengis.net/kml/2.2">
+
+echo "<?xml version='1.0' encoding='UTF-8'?>\n";
+?>
+<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>Funkfeuer Graz</name>
- <Style id="ffstyle_offline">
+ <Style id="0xff_node_offline">
<IconStyle id="myicon">
<color>a0ffffff</color>
<scale>0.5</scale>
<Icon><href>dot_red.png</href></Icon>
- <hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
+ <hotSpot x="0.6" y="0.4" xunits="fraction" yunits="fraction"/>
</IconStyle>
<LabelStyle id="mylab">
<color>a000ffff</color>
<scale>0.8</scale>
</LabelStyle>
</Style>
- <Style id="ffstyle_online">
+ <Style id="0xff_node_online">
<IconStyle id="myicon">
<color>f0ffffff</color>
<scale>0.5</scale>
<Icon><href>dot_green.png</href></Icon>
- <hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
+ <hotSpot x="0.6" y="0.4" xunits="fraction" yunits="fraction"/>
</IconStyle>
<LabelStyle id="mylab">
<color>f000ffff</color>
<scale>0.9</scale>
</LabelStyle>
</Style>
- <Style id="ffstyle_link">
+ <Style id="0xff_node_tunnel">
+ <IconStyle id="myicon">
+ <color>f0ffffff</color>
+ <scale>0.5</scale>
+ <Icon><href>dot_yellow.png</href></Icon>
+ <hotSpot x="0.6" y="0.4" xunits="fraction" yunits="fraction"/>
+ </IconStyle>
+ <LabelStyle id="mylab">
+ <color>f000ffff</color>
+ <scale>0.9</scale>
+ </LabelStyle>
+ </Style>
+ <Style id="0xff_link_air">
<LabelStyle id="mylab_link">
<color>f099ffff</color>
<scale>0.9</scale>
@@ -361,7 +376,7 @@ foreach ($lines as $num => $line)
<fill>1</fill>
</PolyStyle>
</Style>
- <Style id="ffstyle_vpn">
+ <Style id="0xff_link_vpn">
<LabelStyle id="mylab_vpn">
<color>f0ff99ff</color>
<scale>0.9</scale>
@@ -377,18 +392,18 @@ foreach ($lines as $num => $line)
</PolyStyle>
</Style>
<Folder>
- <name>Online</name>
+ <name>Online Knoten</name>
<visibility>1</visibility>
<?php
foreach ($locations as $location) {
$data = $locations[$location->locid];
//printf("\t" . '<node id="%s" name="%s" lat="%s" lng="%s" pixel_x="%s" pixel_y="%s" state="%s" gallery_link="%s" router_links="%s"/>' . "\n",
// $data->locid, $data->locname, $data->lat, $data->lng, $data->pixel_x, $data->pixel_y, $data->state, $data->gallery_link, $data->dnsnames);
- if ($data->state=='online') {
+ if ($data->state!='offline') {
printf("\t" .'<Placemark id="%s">' . "\n", $data->locid);
printf("\t" .' <name>%s</name>' . "\n", $data->locname);
printf("\t" .' <description><br>%s</br><br>%s</br><br>#%s, %s</br></description>' . "\n", $data->gallery_link, $data->dnsnames, $data->locid, $data->state);
- printf("\t" .' <styleUrl>#ffstyle_online</styleUrl>' . "\n");
+ printf("\t" .' <styleUrl>#0xff_node_online</styleUrl>' . "\n");
printf("\t" .' <Point>' . "\n");
printf("\t" .' <extrude>1</extrude>' . "\n");
printf("\t" .' <altitudeMode>relativeToGround</altitudeMode>' . "\n");
@@ -402,7 +417,7 @@ foreach ($locations as $location) {
?>
</Folder>
<Folder>
- <name>Offline</name>
+ <name>Offline Knoten</name>
<visibility>0</visibility>
<?php
foreach ($locations as $location) {
@@ -413,7 +428,7 @@ foreach ($locations as $location) {
printf("\t" .'<Placemark id="%s">' . "\n", $data->locid);
printf("\t" .' <name>%s</name>' . "\n", $data->locname);
printf("\t" .' <description><br>%s</br><br>%s</br><br>#%s, %s</br></description>' . "\n", $data->gallery_link, $data->dnsnames, $data->locid, $data->state);
- printf("\t" .' <styleUrl>#ffstyle_offline</styleUrl><visibility>0</visibility>' . "\n");
+ printf("\t" .' <styleUrl>#0xff_node_offline</styleUrl><visibility>0</visibility>' . "\n");
printf("\t" .' <Point>' . "\n");
printf("\t" .' <extrude>1</extrude>' . "\n");
printf("\t" .' <altitudeMode>relativeToGround</altitudeMode>' . "\n");
@@ -427,19 +442,17 @@ foreach ($locations as $location) {
?>
</Folder>
<Folder>
- <name>Links</name>
- <visibility>1</visibility>
+ <name>Boden Links</name>
+ <visibility>0</visibility>
<?php
foreach ($links as $link) {
$data1 = $locations[$locids[$link->ipfromLoc]];
$data2 = $locations[$locids[$link->iptoLoc]];
- $count[$data1->locid]=true;
- $count[$data2->locid]=true;
//printf("\t" . '<link fromid="%s" from="%s" latfrom="%s" lngfrom="%s" toid="%s" to="%s" latto="%s" lngto="%s" value="%s" channel="%s" defaultroute="%s" frequency="%s" dnsfrom="%s" dnsto="%s"/>' . "\n",
// $data1->locid, $data1->locname, $data1->lat,$data1->lng,$data2->locid, $data2->locname, $data2->lat, $data2->lng, $link->label, $link->channel, $link->defaultroute, $link->frequency, $link->dnsfrom,$link->dnsto);
printf("\t" .'<Placemark id="%s_%s">' . "\n", $data1->locid, $data2->locid);
printf("\t" .' <name>%s - %s</name>' . "\n", $data1->locname, $data2->locname);
- printf("\t" .' <styleUrl>%s</styleUrl>' . "\n", ($link->label=='-1' ? '#ffstyle_vpn' : '#ffstyle_link'));
+ printf("\t" .' <styleUrl>%s</styleUrl><visibility>0</visibility>' . "\n", ($link->label=='-1' ? '#0xff_link_vpn' : '#0xff_link_air'));
printf("\t" .' <LineString>' . "\n");
printf("\t" .' <extrude>1</extrude><tessellate>1</tessellate>' . "\n");
printf("\t" .' <altitudeMode>relativeToGround</altitudeMode>' . "\n");
@@ -452,5 +465,29 @@ foreach ($links as $link) {
}
?>
</Folder>
+ <Folder>
+ <name>Linien Links</name>
+ <visibility>1</visibility>
+<?php
+foreach ($links as $link) {
+ $data1 = $locations[$locids[$link->ipfromLoc]];
+ $data2 = $locations[$locids[$link->iptoLoc]];
+ //printf("\t" . '<link fromid="%s" from="%s" latfrom="%s" lngfrom="%s" toid="%s" to="%s" latto="%s" lngto="%s" value="%s" channel="%s" defaultroute="%s" frequency="%s" dnsfrom="%s" dnsto="%s"/>' . "\n",
+ // $data1->locid, $data1->locname, $data1->lat,$data1->lng,$data2->locid, $data2->locname, $data2->lat, $data2->lng, $link->label, $link->channel, $link->defaultroute, $link->frequency, $link->dnsfrom,$link->dnsto);
+ printf("\t" .'<Placemark id="%s_%s">' . "\n", $data1->locid, $data2->locid);
+ printf("\t" .' <name>%s - %s</name>' . "\n", $data1->locname, $data2->locname);
+ printf("\t" .' <styleUrl>%s</styleUrl>' . "\n", ($link->label=='-1' ? '#0xff_link_vpn' : '#0xff_link_air'));
+ printf("\t" .' <LineString>' . "\n");
+ printf("\t" .' <tessellate>1</tessellate>' . "\n");
+ printf("\t" .' <altitudeMode>clampedToGround</altitudeMode>' . "\n");
+ printf("\t" .' <coordinates>' . "\n");
+ printf("\t" .' %s,%s' . "\n", $data1->lng, $data1->lat);
+ printf("\t" .' %s,%s' . "\n", $data2->lng, $data2->lat);
+ printf("\t" .' </coordinates>' . "\n");
+ printf("\t" .' </LineString>' . "\n");
+ printf("\t" .'</Placemark>' . "\n");
+}
+?>
+ </Folder>
</Document>
</kml>