.
******/
/* Historical Notes ( colapsed )
* early march 2017
* -----------------
* sorted "Linked to:" popup list by distance and cost
* this was easiest by putting the distance info into the database.
* see the scripts for more info
* Can now tell the difference between "real" DTD links and those that are linked in some other way (mostly)
* Additionally, This page is becoming more and more modified to do things based on which "host" it is running on
* At SBARC we currently have 3 different "versions" of this page, plus my system I use for testing
* I was starting to lose track of what was where so it has all become one now.
* if you are running on a different host then things will default to "normal".
*
* early feb 2017
* -----------------
* changed to use only free (as in beer) maps
* OSM, openTopo, Stamen maps, etc.
* early jan 2017
* -----------------
* migrated to use mysqli
* also added the mapbox "topographic" maps (which suck)
* mid dec 2016
* -----------------
* yet another update (due to request)
* added distance and bearing info to the linked node listing in the station popup
* more updates dec 2016
* -----------------
* added lat, lon to the popup info
* added channel and bandwidth info to the station popups
* out of date (and maybe beta) firmware now shows up as red text in the station popups
* changed the bottom "attributions" section a bit, formatted it differently and added in the number of stations and links shown. :)
* v.03 early December 2016
* -----------------
* added fullscreen control.(mid november 2016).
* the basemap layers are now able to be switched.
* there is differentiation between the different bands.
* now more info in the stations popup.
* you can now filter out different bands and different types of links on the map.
* the node's name now shows up if you hover over the marker.
* I think I'm now able to pick out the tunnels vs. any other type of link... maybe
*
* v.02 early Nov 2016
* -----------------
* new "radio" icons
* "two way" link lines
* legend overlay
*
* v.01 inital map Oct 2016
* -----------------
*/
//Increase PHP memory limit to 128M (you may need more if you are connected to a "Mega Mesh" :) )
ini_set('memory_limit', '128M');
/******
* You should not need to change much below here
******/
$INCLUDE_DIR = "..";
//check for users user-settings.ini file and use it if it exists
//use the default one if it does not
global $USER_SETTINGS;
if (file_exists("$INCLUDE_DIR . /scripts/user-settings.ini")) {
$USER_SETTINGS = parse_ini_file($INCLUDE_DIR . "/scripts/user-settings.ini");
}else {
echo "You must copy the user-settings.ini-default file to user-settings.ini and edit it!\n";
//$USER_SETTINGS = parse_ini_file($INCLUDE_DIR . "/scripts/user-settings.ini-default");
}
global $MESH_SETTINGS;
//check for users user-settings.ini file and use it if it exists
//use the default one if it does not
if (file_exists("$INCLUDE_DIR . /scripts/meshmap-settings.ini")) {
$MESH_SETTINGS = parse_ini_file($INCLUDE_DIR . "/scripts/meshmap-settings.ini");
}else {
$MESH_SETTINGS = parse_ini_file($INCLUDE_DIR . "/scripts/meshmap-settings.ini-default");
}
require $INCLUDE_DIR . "/scripts/wxc_functions.inc";
require $INCLUDE_DIR . "/scripts/map_functions.inc";
date_default_timezone_set($USER_SETTINGS['localTimeZone']);
/*
* This section will try to tell if the client has internet access or not
* If we are being called from the mesh, without internet access,
* we use the offline copies of the add-on scripts and try to load maps locally
* If there is internet access, set it up so everything is fetched from the internet
*/
global $inetAccess;
global $mesh;
if (isset($_POST['inetAccess'])) {
$inetAccess = $_POST['inetAccess'];
if ($inetAccess == "1") {
$mesh = "0";
}elseif ($inetAccess == "0") {
$mesh = "1";
}
}else {
$inetAccess = "0";
$mesh = "1";
}
@include $INCLUDE_DIR . "/custom.inc";
if (!isset($GLOBALS['internet_only'])) {
function testForInet() {
$page = <<< EOD
meshmap internet check page
Just a quick check for internet access so we can load the appropriate maps, etc...
Please be patient, this should only take a moment.
EOD;
echo $page;
//return;
exit("
reloading...");
}
}
if (!isset($GLOBALS['internet_only'])) {
if (!isset($_POST['inetAccess'])) {
testForInet();
}
}
/*
* SQL Connection
*/
wxc_connectToMySQL();
/*
* Node Table Query
*/
global $useNodes;
global $useMarkers;
global $useLinks;
$NodeList = load_Nodes();
$MarkerList = load_Markers();
$TopoList = load_Topology();
// Get the last time we updated the link info
$filetime = wxc_scriptGetLastDateTime("LINKINFO", "topology");
if ($filetime)
{
$filetime = date_format($filetime, 'F d Y H:i:s');
}
global $STABLE_MESH_VERSION;
$STABLE_MESH_VERSION = $USER_SETTINGS['current_stable_fw_version'];
$page_header = <<< EOD
EOD;
echo $page_header . "\n";
echo "" . $USER_SETTINGS['pageTitle'] . "\n";
/*
* check for the users meshmap.css file and use it if it exists...
* if not, use the "-default" file (meshmap.css-default)
*/
if (file_exists ("./css/meshmap.css")) {
echo "\n";
}else {
echo "\n";
}
/*
* If the client has internet access load everything from there
* if not, use the local resources.
*/
if (!$mesh) {
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
}else {
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
}
echo "\n";
echo "\n";
echo "\n";
/*
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
*/
echo "\n";
echo "\n";
echo "\n";
// If this page *is* called from an Internet enabled site:
// Remove the top logo and make the map a bit smaller
// so that it fits in the nice little iFrame page
// Otherwise render a normal map page.
//GSE: [Removed] if ($_SERVER['HTTP_HOST'] == $USER_SETTINGS['meshServerHostName'] || $_SERVER['HTTP_HOST'] ==
// "kg6wxc-host.local.mesh"
//)
if (isset($USER_SETTINGS['map_iFrame_Enabled']) && ($USER_SETTINGS['map_iFrame_Enabled']))
{
echo "
\n"; // Closing tag at end of primary routine
echo "
\n";
echo "
\n";
}
else
{
echo "
\n"; // Closing tag at end of primary routine
if (isset($USER_SETTINGS['pageLogo']))
{
echo "";
// echo "";
echo "";
echo "\n";
}
if (isset($USER_SETTINGS['logoHeaderText']))
{
echo "";
echo $USER_SETTINGS['logoHeaderText'];
echo "\n";
echo " ";
}
if (isset($USER_SETTINGS['welcomeMessage']))
{
echo "";
echo $USER_SETTINGS['welcomeMessage'];
//echo " ";
echo " ";
echo "\n";
}
if (isset($USER_SETTINGS['otherTopOfMapMsg'])) {
echo "";
echo $USER_SETTINGS['otherTopOfMapMsg'];
echo "\n";
echo " ";
}
if (isset($USER_SETTINGS['meshWarning']) && $mesh)
{
echo "";
echo $USER_SETTINGS['meshWarning'];
echo "";
echo " ";
}
}
/*
if (isset($GLOBALS['no_req_msg'])) {
if ($GLOBALS['no_req_msg'] == "1") {
//output nothing!!
}
}else {
echo "Where the heck is my node??\n";
}
*/
if (isset($GLOBALS['hide_admin'])) {
if ($GLOBALS['hide_admin'] == "1") {
//output nothing!!
}
}else {
echo "The \"Admin\" type page\n";
}
echo "
\n";
echo "
\n";
//$numNodes = count($NodeList); // WXC change: this was giving the wrong number.
//should not count nodes that have no location info, they are not on the map...
//just using this for now.
//it is still giving the wrong number WXC -april 2018
$numNodes = wxc_getMySql("SELECT COUNT(*) as nodesWithLocations FROM node_info where (lat is not null or 0 or '') and (lon is not null or 0 or '')");
$numNodes = $numNodes['nodesWithLocations'];
$numNodesTotal = count($NodeList);
//WXC comment: looks like this was for something else maybe?...
$numMarkers = count($MarkerList);
//$numLinks = count($TopoList); // WXC change: probably the same thing going on here too
//just using this for now
//same here, probably still giving the wrong number WXC - april 2018
$numLinks = wxc_getMySql("SELECT COUNT(*) as linksWithLocations FROM topology WHERE (nodelat is not null or 0 or '' or '0') and (nodelon is not null or 0 or '' or '0') or (linklat is not null or 0 or '' or '0') and (linklon is not null or 0 or '' or '0')");
$numLinks = $numLinks['linksWithLocations'];
$numLinksTotal = count($TopoList);
$Content = "";
$filetime = 'Today';
//$Content .= "