diff options
author | Mathias Mayrhofer <mtmayr@mtmayr.com> | 2020-02-23 13:24:06 +0100 |
---|---|---|
committer | Mathias Mayrhofer <mtmayr@mtmayr.com> | 2020-02-23 13:24:06 +0100 |
commit | 8ff6be8e3ccd9deb069eae63428e5347149d0839 (patch) | |
tree | e9e1377739ea815913ac5b1be8c4b3de12a0791b | |
parent | 6086c26404d0a534f2ce212b7e9c8e669754e8b0 (diff) | |
parent | 6752d4defb195739c66a7dec94570d41ea8d295a (diff) |
Merge branch 'master' into stable
-rw-r--r-- | kml/convert_xml_kml.xsl | 142 | ||||
-rw-r--r-- | kml/data.php | 456 | ||||
-rw-r--r-- | kml/dot_blue.png | bin | 0 -> 2781 bytes | |||
-rw-r--r-- | kml/dot_green.png | bin | 0 -> 2332 bytes | |||
-rw-r--r-- | kml/dot_red.png | bin | 0 -> 2000 bytes | |||
l--------- | kml/index.html | 1 | ||||
-rw-r--r-- | kml/index.kml | 21 |
7 files changed, 620 insertions, 0 deletions
diff --git a/kml/convert_xml_kml.xsl b/kml/convert_xml_kml.xsl new file mode 100644 index 0000000..3217143 --- /dev/null +++ b/kml/convert_xml_kml.xsl @@ -0,0 +1,142 @@ +<?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"> + <Document> + <name>Funkfeuer Graz</name> + <Style id="ffstyle_offline"> + <IconStyle id="myicon"> + <color>a0ffffff</color> + <scale>0.5</scale> + <Icon><href>https://juwelierkassa.at/dots/dot_red.png</href></Icon> + <hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/> + </IconStyle> + <LabelStyle id="mylab"> + <color>a000ffff</color> + <scale>0.8</scale> + </LabelStyle> + </Style> + <Style id="ffstyle_online"> + <IconStyle id="myicon"> + <color>f0ffffff</color> + <scale>0.5</scale> + <Icon><href>https://juwelierkassa.at/dots/dot_green.png</href></Icon> + <hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/> + </IconStyle> + <LabelStyle id="mylab"> + <color>f000ffff</color> + <scale>0.9</scale> + </LabelStyle> + </Style> + <Style id="ffstyle_link"> + <LabelStyle id="mylab_link"> + <color>f099ffff</color> + <scale>0.9</scale> + </LabelStyle> + <LineStyle> + <color>7099ff00</color> + <width>1</width> + </LineStyle> + <PolyStyle> + <color>70eeff00</color> + <colorMode>normal</colorMode> + <fill>1</fill> + </PolyStyle> + </Style> + <Style id="ffstyle_vpn"> + <LabelStyle id="mylab_vpn"> + <color>f0ff99ff</color> + <scale>0.9</scale> + </LabelStyle> + <LineStyle> + <color>709900ff</color> + <width>1</width> + </LineStyle> + <PolyStyle> + <color>70ee00ff</color> + <colorMode>normal</colorMode> + <fill>1</fill> + </PolyStyle> + </Style> + <xsl:apply-templates select="nodes"/> + <xsl:apply-templates select="links"/> + </Document> + </kml> +</xsl:template> + +<xsl:template match="nodes"> + <Folder> + <name>Online</name> + <visibility>1</visibility> + <xsl:apply-templates select="node" mode="online"/> + </Folder> + <Folder> + <name>Offline</name> + <visibility>0</visibility> + <xsl:apply-templates select="node" mode="offline"/> + </Folder> +</xsl:template> + +<xsl:template match="links"> + <Folder> + <name>Links</name> + <visibility>1</visibility> + <xsl:apply-templates select="link" mode="links"/> + </Folder> +</xsl:template> + +<xsl:template match="node" mode="online"> + <xsl:if test="@state='online' or @state='tunnel'"> + <Placemark id="{@id}"> + <name><xsl:value-of select="@name"/></name> + <description><br><xsl:value-of select="@gallery_link"/></br><br><xsl:value-of select="@router_links"/></br><br>#<xsl:value-of select="@id"/> = <xsl:value-of select="@state"/></br></description> + <styleUrl>#ffstyle_online</styleUrl> + <Point> + <extrude>1</extrude> + <altitudeMode>relativeToGround</altitudeMode> + <coordinates> + <xsl:value-of select="@lng"/>,<xsl:value-of select="@lat"/>,60 + </coordinates> + </Point> + </Placemark> + </xsl:if> +</xsl:template> + +<xsl:template match="node" mode="offline"> + <xsl:if test="@state='offline'"> + <Placemark id="{@id}"> + <name><xsl:value-of select="@name"/></name> + <description><br><xsl:value-of select="@gallery_link"/></br><br><xsl:value-of select="@router_links"/></br><br>#<xsl:value-of select="@id"/> = <xsl:value-of select="@state"/></br></description> + <visibility>0</visibility> + <styleUrl>#ffstyle_offline</styleUrl> + <Point> + <extrude>1</extrude> + <altitudeMode>relativeToGround</altitudeMode> + <coordinates> + <xsl:value-of select="@lng"/>,<xsl:value-of select="@lat"/>,60 + </coordinates> + </Point> + </Placemark> + </xsl:if> +</xsl:template> + +<xsl:template match="link" mode="links"> + <Placemark id="{@id}"> + <name><xsl:value-of select="@from"/> - <xsl:value-of select="@to"/> [<xsl:value-of select="@value"/>]</name> + <styleUrl> + <xsl:choose><xsl:when test="@value='-1'">#ffstyle_vpn</xsl:when><xsl:otherwise>#ffstyle_link</xsl:otherwise></xsl:choose> + </styleUrl> + <LineString> + <extrude>1</extrude> + <tessellate>1</tessellate> + <altitudeMode>relativeToGround</altitudeMode> + <coordinates> + <xsl:value-of select="@lngfrom"/>,<xsl:value-of select="@latfrom"/>,50 + <xsl:value-of select="@lngto"/>,<xsl:value-of select="@latto"/>,50 + </coordinates> + </LineString> + </Placemark> +</xsl:template> + +</xsl:stylesheet> diff --git a/kml/data.php b/kml/data.php new file mode 100644 index 0000000..0eef510 --- /dev/null +++ b/kml/data.php @@ -0,0 +1,456 @@ +<?php +//author mtmayr@mtmayr.com, changed from data.php +session_start(); +error_reporting(0); +require_once("../db.class.php"); +require_once("../ipmatch.php"); +require_once("../config.php"); + +header("Content-Type: application/vnd.google-earth.kml+xml"); +header("Cache-Control: no-cache, must-revalidate"); +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"); +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; +} + +//zum Test +//$conf['acl']['auth'] = true; + +$x_startpoint = 4080; +$lng_startpoint = 15.43844103813; +$dx_dLng = 50675.5176; +$y_startpoint = 4806; +$lat_startpoint= 47.07177327969; +$dy_dLat = 75505.521; + +$locations = array(); +$locids = array(); +$nodename = array(); +$locname = array(); +$ipname = array(); +$dnsnames = array(); +$ip = array(); +$nodelocnames = array(); +$ipnodelocnames = array(); +$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; + $nodename[$data->ip]= $data->nodename; + $locname[$data->ip]= $data->locname; + $ipname[$data->ip]= $data->ipname; + $dnsname = $data->ipname.'.'.$data->nodename.'.'.$data->locname; + $dnsnames[$data->locid][]=$dnsname; + $ip[$dnsname]=$data->ip; + $nodelocname = $data->nodename.'.'.$data->locname; + $nodelocnames[$data->locid][]=$nodelocname; + $ipnodelocnames[$nodelocname][]=$data->ipname; +} +if($conf['acl']['auth']) + $db->query("SELECT id as locid, name as locname, pixel_x, pixel_y, gallery_link, location.hastinc as hastinc FROM location ORDER BY name ASC"); +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; + + $data->lng = $lng_startpoint + ($data->pixel_x - $x_startpoint) / $dx_dLng; + $data->lat = $lat_startpoint + ($y_startpoint - $data->pixel_y) / $dy_dLat; + $data->state = "offline"; + if($conf['acl']['auth']){ + foreach($nodelocnames[$data->locid] as $nodelocname){ + while(strpos($data->dnsnames,$nodelocname)===false){ + foreach($ipnodelocnames[$nodelocname] as $ipnodelocname){ + $channel=""; + $frequency=""; + $dnsname=$ipnodelocname.".".$nodelocname; + if($routerhash[$ip[$dnsname]][4]!=""){ + $channel= $routerhash[$ip[$dnsname]][4]; + } + if ($routerhash[$ip[$dnsname]][5]!=""){ + $frequency = $routerhash[$ip[$dnsname]][5]; + } + if ($channel!="" or $frequency!=""){ + $data->dnsnames = $dnsname." (Kanal: ".$channel." / ".$frequency." GHz);".$data->dnsnames; + break 2; + } + } + $data->dnsnames = $dnsname.";".$data->dnsnames; + } + } + } + $locations[$data->locid] = $data; +} + +$regmatch = '#\"(.+)\" -> \"(.+)\"\[label=\"([0-9]+.[0-9]+)\"]#'; +$lines = file($conf['topo']['file']); + +$linecnt=0; +$i =0; +foreach ($lines as $num => $line) +{ + + $linecnt++; + if(preg_match($regmatch,$line,$matches)==0) + continue; + + list( , $ipfromLoc, $iptoLoc, $label) = $matches; + + if (empty($ipfromLoc) || empty($iptoLoc) || empty($label)) + continue; + + if (empty($locids[$ipfromLoc]) || empty($locids[$iptoLoc])) + continue; + + if(empty($locations[$locids[$ipfromLoc]]->locid) || empty($locations[$locids[$iptoLoc]]->locid)) + continue; + + if($locations[$locids[$ipfromLoc]]->locid == $locations[$locids[$iptoLoc]]->locid) + continue; + + + if(isset($already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid])&& + ($already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid]->used == true)) { + $jot = $already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid]->i; + if($links[$jot]->label != -1){ + if (($links[$jot]->$ipfromLoc==$iptoLoc) || ($links[$jot]->$iptoLoc==$ipfromLoc)){ + $links[$jot]->label = ($links[$jot]->label + $label)/2; + } else if ($links[$jot]->label > $label){ + $links[$jot]->label = $label; + } + } + if (array_key_exists($ipfromLoc,$routerhash)){ + if ($routerhash[$ipfromLoc][4]!==""){ + $links[$jot]->channel = $routerhash[$ipfromLoc][4]; + + } + if ($routerhash[$ipfromLoc][5]!==""){ + $links[$jot]->frequency = $routerhash[$ipfromLoc][5]; + } + + } else if (array_key_exists($iptoLoc,$routerhash)){ + if ($routerhash[$iptoLoc][4]!==""){ + $links[$jot]->channel = $routerhash[$iptoLoc][4]; + } + if ($routerhash[$iptoLoc][5]!==""){ + $links[$jot]->frequency = $routerhash[$iptoLoc][5]; + } + } else{ + $links[$jot]->channel ="undef"; + $links[$jot]->frequency ="undef"; + // echo "keine IP\n"; + } + if (array_key_exists($ipfromLoc,$routerhash)){ + if($conf['acl']['auth']){ + if (strpos($links[$jot]->dnsfrom ,$routerhash[$ipfromLoc][1])===false){ + + $links[$jot]->dnsfrom =($routerhash[$ipfromLoc][1].' (Kanal: '.$links[$jot]->channel.' / '.$links[$jot]->frequency.' GHz)'.';'.($links[$jot]->dnsfrom)); + } + + } + if ($routerhash[$ipfromLoc][3]==$iptoLoc){ + $links[$jot]->defaultroute = "1"; + } + } + if (array_key_exists($iptoLoc,$routerhash)){ + if($conf['acl']['auth']){ + if (strpos($links[$jot]->dnsto ,$routerhash[$iptoLoc][1])===false){ +// echo "B\n"; + $links[$jot]->dnsto =($routerhash[$iptoLoc][1].' (Kanal: '.$links[$jot]->channel.' / '.$links[$jot]->frequency.' GHz)'.';'.($links[$jot]->dnsto)); + } + } + if ($routerhash[$iptoLoc][3]==$ipfromLoc){ + $links[$jot]->defaultroute = "1"; + } + } + + } + elseif(isset($already[$locations[$locids[$iptoLoc]]->locid . '-' . $locations[$locids[$ipfromLoc]]->locid])&& + ($already[$locations[$locids[$iptoLoc]]->locid . '-' . $locations[$locids[$ipfromLoc]]->locid]->used == true)) { + $jot = $already[$locations[$locids[$iptoLoc]]->locid . '-' . $locations[$locids[$ipfromLoc]]->locid]->i; + if($links[$jot]->label != -1){ + if (($links[$jot]->$ipfromLoc==$iptoLoc) || ($links[$jot]->$iptoLoc==$ipfromLoc)){ + $links[$jot]->label = ($links[$jot]->label + $label)/2; + } else if ($links[$jot]->label > $label){ + $links[$jot]->label = $label; + } + } + if (array_key_exists($ipfromLoc,$routerhash)){ + if ($routerhash[$ipfromLoc][4]!==""){ + $links[$jot]->channel = $routerhash[$ipfromLoc][4]; + + } + if ($routerhash[$ipfromLoc][5]!==""){ + $links[$jot]->frequency = $routerhash[$ipfromLoc][5]; + } + + } else if (array_key_exists($iptoLoc,$routerhash)){ + if ($routerhash[$iptoLoc][4]!==""){ + $links[$jot]->channel = $routerhash[$iptoLoc][4]; + } + if ($routerhash[$iptoLoc][5]!==""){ + $links[$jot]->frequency = $routerhash[$iptoLoc][5]; + } + } else{ + $links[$jot]->channel ="undef"; + $links[$jot]->frequency ="undef"; + } + if (array_key_exists($ipfromLoc,$routerhash)){ + if($conf['acl']['auth']){ + if (strpos($links[$jot]->dnsto,$routerhash[$ipfromLoc][1])===false){ + $links[$jot]->dnsto =($routerhash[$ipfromLoc][1].' (Kanal: '.$links[$jot]->channel.' / '.$links[$jot]->frequency.' GHz)'.';'.($links[$jot]->dnsto)); + } + } + if ($routerhash[$ipfromLoc][3]==$iptoLoc){ + $links[$jot]->defaultroute = "1"; + } + } + if (array_key_exists($iptoLoc,$routerhash)){ + if($conf['acl']['auth']){ + if (strpos($links[$jot]->dnsfrom,$routerhash[$iptoLoc][1])===false){ + $links[$jot]->dnsfrom =($routerhash[$iptoLoc][1].' (Kanal: '.$links[$jot]->channel.' / '.$links[$jot]->frequency.' GHz)'.';'.($links[$jot]->dnsfrom)); + } + } + if ($routerhash[$iptoLoc][3]==$ipfromLoc){ + $links[$jot]->defaultroute = "1"; + } + } + + } + else { + $already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid]->used = true; + $already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid]->i = $i; + $links[$i]->ipfromLoc = $ipfromLoc; + $links[$i]->iptoLoc = $iptoLoc; + + if (array_key_exists($ipfromLoc,$routerhash)){ + if ($routerhash[$ipfromLoc][4]!==""){ + $links[$i]->channel = $routerhash[$ipfromLoc][4]; + + } + if ($routerhash[$ipfromLoc][5]!==""){ + $links[$i]->frequency = $routerhash[$ipfromLoc][5]; + } + + } else if (array_key_exists($iptoLoc,$routerhash)){ + if ($routerhash[$iptoLoc][4]!==""){ + $links[$i]->channel = $routerhash[$iptoLoc][4]; + } + if ($routerhash[$iptoLoc][5]!==""){ + $links[$i]->frequency = $routerhash[$iptoLoc][5]; + } + } else{ + $links[$i]->channel ="undef"; + $links[$i]->frequency ="undef"; + } + $links[$i]->defaultroute = "0"; + + if($conf['acl']['auth']){ + $links[$i]->dnsfrom =$ipname[$ipfromLoc].'.'.$nodename[$ipfromLoc].'.'.$locname[$ipfromLoc].' (Kanal: '.$links[$i]->channel.' / '.$links[$i]->frequency.' GHz )'; + $links[$i]->dnsto =$ipname[$iptoLoc].'.'.$nodename[$iptoLoc].'.'.$locname[$iptoLoc].' (Kanal: '.$links[$i]->channel.' / '.$links[$i]->frequency.' GHz)'; + } + + if (array_key_exists($ipfromLoc,$routerhash)){ + + if($conf['acl']['auth']){ + $links[$i]->dnsfrom =$routerhash[$ipfromLoc][1].' (Kanal: '.$links[$i]->channel.' / '.$links[$i]->frequency.' GHz)'; + } + if ($routerhash[$ipfromLoc][3]==$iptoLoc){ + $links[$i]->defaultroute = "1"; + } + } + if (array_key_exists($iptoLoc,$routerhash)){ + if($conf['acl']['auth']){ + $links[$i]->dnsto =$routerhash[$iptoLoc][1].' (Kanal: '.$links[$i]->channel.' / '.$links[$i]->frequency.' GHz)'; + } + + if ($routerhash[$iptoLoc][3]==$ipfromLoc){ + $links[$i]->defaultroute = "1"; + } + } + + + + if($links[$i]->label != -1){ + $links[$i]->label = $label; + if($locations[$locids[$ipfromLoc]]->state == "offline") + $locations[$locids[$ipfromLoc]]->state = "online"; + if($locations[$locids[$iptoLoc]]->state == "offline") + $locations[$locids[$iptoLoc]]->state = "online"; + } + if (($nodename[$ipfromLoc] == "tunnel" && $locations[$locids[$ipfromLoc]]->locname == "housing") || + ($nodename[$iptoLoc] == "tunnel" && $locations[$locids[$iptoLoc]]->locname == "housing") || + ($nodename[$ipfromLoc] == "viennagw" && $locations[$locids[$ipfromLoc]]->locname == "edis") || + ($nodename[$iptoLoc] == "viennagw" && $locations[$locids[$iptoLoc]]->locname == "edis") || + ($locations[$locids[$iptoLoc]]->hastinc && $locations[$locids[$ipfromLoc]]->hastinc)) { + $links[$i]->label = -1; + + $links[$i]->defaultroute ="1"; + $locations[$locids[$ipfromLoc]]->state = "tunnel"; + $locations[$locids[$iptoLoc]]->state = "tunnel"; + } + if (($nodename[$ipfromLoc] == "tunnel" && $locations[$locids[$ipfromLoc]]->locname=="housing") || + ($nodename[$iptoLoc] == "tunnel" && $locations[$locids[$iptoLoc]]->locname=="housing" )){ + $links[$i]->frequency ="LAN"; + $links[$i]->channel ="undef"; + } + + $i++; + } +} + +?> +<?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"> + <Document> + <name>Funkfeuer Graz</name> + <Style id="ffstyle_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"/> + </IconStyle> + <LabelStyle id="mylab"> + <color>a000ffff</color> + <scale>0.8</scale> + </LabelStyle> + </Style> + <Style id="ffstyle_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"/> + </IconStyle> + <LabelStyle id="mylab"> + <color>f000ffff</color> + <scale>0.9</scale> + </LabelStyle> + </Style> + <Style id="ffstyle_link"> + <LabelStyle id="mylab_link"> + <color>f099ffff</color> + <scale>0.9</scale> + </LabelStyle> + <LineStyle> + <color>7099ff00</color> + <width>1</width> + </LineStyle> + <PolyStyle> + <color>70eeff00</color> + <colorMode>normal</colorMode> + <fill>1</fill> + </PolyStyle> + </Style> + <Style id="ffstyle_vpn"> + <LabelStyle id="mylab_vpn"> + <color>f0ff99ff</color> + <scale>0.9</scale> + </LabelStyle> + <LineStyle> + <color>709900ff</color> + <width>1</width> + </LineStyle> + <PolyStyle> + <color>70ee00ff</color> + <colorMode>normal</colorMode> + <fill>1</fill> + </PolyStyle> + </Style> + <Folder> + <name>Online</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') { + 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" .' <Point>' . "\n"); + printf("\t" .' <extrude>1</extrude>' . "\n"); + printf("\t" .' <altitudeMode>relativeToGround</altitudeMode>' . "\n"); + printf("\t" .' <coordinates>' . "\n"); + printf("\t" .' %s,%s,60' . "\n", $data->lng, $data->lat); + printf("\t" .' </coordinates>' . "\n"); + printf("\t" .' </Point>' . "\n"); + printf("\t" .'</Placemark>' . "\n"); + } +} +?> + </Folder> + <Folder> + <name>Offline</name> + <visibility>0</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=='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_offline</styleUrl><visibility>0</visibility>' . "\n"); + printf("\t" .' <Point>' . "\n"); + printf("\t" .' <extrude>1</extrude>' . "\n"); + printf("\t" .' <altitudeMode>relativeToGround</altitudeMode>' . "\n"); + printf("\t" .' <coordinates>' . "\n"); + printf("\t" .' %s,%s,60' . "\n", $data->lng, $data->lat); + printf("\t" .' </coordinates>' . "\n"); + printf("\t" .' </Point>' . "\n"); + printf("\t" .'</Placemark>' . "\n"); + } +} +?> + </Folder> + <Folder> + <name>Links</name> + <visibility>1</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" .' <LineString>' . "\n"); + printf("\t" .' <extrude>1</extrude><tessellate>1</tessellate>' . "\n"); + printf("\t" .' <altitudeMode>relativeToGround</altitudeMode>' . "\n"); + printf("\t" .' <coordinates>' . "\n"); + printf("\t" .' %s,%s,60' . "\n", $data1->lng, $data1->lat); + printf("\t" .' %s,%s,60' . "\n", $data2->lng, $data2->lat); + printf("\t" .' </coordinates>' . "\n"); + printf("\t" .' </LineString>' . "\n"); + printf("\t" .'</Placemark>' . "\n"); +} +?> + </Folder> + </Document> +</kml> diff --git a/kml/dot_blue.png b/kml/dot_blue.png Binary files differnew file mode 100644 index 0000000..a1d91e5 --- /dev/null +++ b/kml/dot_blue.png diff --git a/kml/dot_green.png b/kml/dot_green.png Binary files differnew file mode 100644 index 0000000..69c5b9f --- /dev/null +++ b/kml/dot_green.png diff --git a/kml/dot_red.png b/kml/dot_red.png Binary files differnew file mode 100644 index 0000000..662098e --- /dev/null +++ b/kml/dot_red.png diff --git a/kml/index.html b/kml/index.html new file mode 120000 index 0000000..415d841 --- /dev/null +++ b/kml/index.html @@ -0,0 +1 @@ +index.kml
\ No newline at end of file diff --git a/kml/index.kml b/kml/index.kml new file mode 100644 index 0000000..8192058 --- /dev/null +++ b/kml/index.kml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom"> +<NetworkLink> + <name>Funkfeuer Graz</name> + <visibility>1</visibility> + <open>1</open> + <Style> + <ListStyle> + <listItemType>check</listItemType> + <bgColor>00ffffff</bgColor> + <maxSnippetLines>2</maxSnippetLines> + </ListStyle> + </Style> + <Url> + <href>https://karte.ffgraz.net/kml/0xff.php</href> + <refreshMode>onInterval</refreshMode> + <refreshInterval>3600</refreshInterval> + </Url> +</NetworkLink> +</kml> + |