| 
									
										
										
										
											2016-07-05 10:29:40 -06:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* | 
					
						
							|  |  |  |  *  This dashboard is being developed by the DVBrazil Team as a courtesy to | 
					
						
							|  |  |  |  *  the XLX Multiprotocol Gateway Reflector Server project. | 
					
						
							|  |  |  |  *  The dashboard is based of the Bootstrap dashboard template.  | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-27 18:09:08 -03:00
										 |  |  | if (file_exists("./pgs/functions.php")) { | 
					
						
							|  |  |  |     require_once("./pgs/functions.php"); | 
					
						
							|  |  |  | } else { | 
					
						
							|  |  |  |     die("functions.php does not exist."); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | if (file_exists("./pgs/config.inc.php")) { | 
					
						
							|  |  |  |     require_once("./pgs/config.inc.php"); | 
					
						
							|  |  |  | } else { | 
					
						
							|  |  |  |     die("config.inc.php does not exist."); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2016-07-05 10:29:40 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-27 18:09:08 -03:00
										 |  |  | if (!class_exists('ParseXML')) require_once("./pgs/class.parsexml.php"); | 
					
						
							|  |  |  | if (!class_exists('Node')) require_once("./pgs/class.node.php"); | 
					
						
							| 
									
										
										
										
											2016-07-05 10:29:40 -06:00
										 |  |  | if (!class_exists('xReflector')) require_once("./pgs/class.reflector.php"); | 
					
						
							| 
									
										
										
										
											2017-08-27 18:09:08 -03:00
										 |  |  | if (!class_exists('Station')) require_once("./pgs/class.station.php"); | 
					
						
							|  |  |  | if (!class_exists('Peer')) require_once("./pgs/class.peer.php"); | 
					
						
							|  |  |  | if (!class_exists('Interlink')) require_once("./pgs/class.interlink.php"); | 
					
						
							| 
									
										
										
										
											2016-07-05 10:29:40 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | $Reflector = new xReflector(); | 
					
						
							|  |  |  | $Reflector->SetFlagFile("./pgs/country.csv"); | 
					
						
							|  |  |  | $Reflector->SetPIDFile($Service['PIDFile']); | 
					
						
							|  |  |  | $Reflector->SetXMLFile($Service['XMLFile']); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | $Reflector->LoadXML(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-27 18:09:08 -03:00
										 |  |  | if ($CallingHome['Active']) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $CallHomeNow = false; | 
					
						
							|  |  |  |     if (!file_exists($CallingHome['HashFile'])) { | 
					
						
							|  |  |  |         $Hash = CreateCode(16); | 
					
						
							|  |  |  |         $LastSync = 0; | 
					
						
							|  |  |  |         $Ressource = @fopen($CallingHome['HashFile'], "w"); | 
					
						
							|  |  |  |         if ($Ressource) { | 
					
						
							| 
									
										
										
										
											2016-07-05 10:29:40 -06:00
										 |  |  |             @fwrite($Ressource, "<?php\n"); | 
					
						
							| 
									
										
										
										
											2017-08-27 18:09:08 -03:00
										 |  |  |             @fwrite($Ressource, "\n" . '$LastSync = 0;'); | 
					
						
							|  |  |  |             @fwrite($Ressource, "\n" . '$Hash     = "' . $Hash . '";'); | 
					
						
							|  |  |  |             @fwrite($Ressource, "\n\n" . '?>'); | 
					
						
							| 
									
										
										
										
											2016-07-05 10:29:40 -06:00
										 |  |  |             @fclose($Ressource); | 
					
						
							| 
									
										
										
										
											2017-08-27 18:09:08 -03:00
										 |  |  |             @exec("chmod 777 " . $CallingHome['HashFile']); | 
					
						
							|  |  |  |             $CallHomeNow = true; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         include($CallingHome['HashFile']); | 
					
						
							|  |  |  |         if ($LastSync < (time() - $CallingHome['PushDelay'])) { | 
					
						
							|  |  |  |             $Ressource = @fopen($CallingHome['HashFile'], "w"); | 
					
						
							|  |  |  |             if ($Ressource) { | 
					
						
							|  |  |  |                 @fwrite($Ressource, "<?php\n"); | 
					
						
							|  |  |  |                 @fwrite($Ressource, "\n" . '$LastSync = ' . time() . ';'); | 
					
						
							|  |  |  |                 @fwrite($Ressource, "\n" . '$Hash     = "' . $Hash . '";'); | 
					
						
							|  |  |  |                 @fwrite($Ressource, "\n\n" . '?>'); | 
					
						
							|  |  |  |                 @fclose($Ressource); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             $CallHomeNow = true; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if ($CallHomeNow || isset($_GET['callhome'])) { | 
					
						
							|  |  |  |         $Reflector->SetCallingHome($CallingHome, $Hash); | 
					
						
							|  |  |  |         $Reflector->ReadInterlinkFile(); | 
					
						
							|  |  |  |         $Reflector->PrepareInterlinkXML(); | 
					
						
							|  |  |  |         $Reflector->PrepareReflectorXML(); | 
					
						
							|  |  |  |         $Reflector->CallHome(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } else { | 
					
						
							|  |  |  |     $Hash = ""; | 
					
						
							| 
									
										
										
										
											2016-07-05 10:29:40 -06:00
										 |  |  | } | 
					
						
							|  |  |  | ?>
 | 
					
						
							|  |  |  | <!DOCTYPE html> | 
					
						
							|  |  |  | <html lang="en"> | 
					
						
							| 
									
										
										
										
											2017-08-27 18:09:08 -03:00
										 |  |  | <head> | 
					
						
							|  |  |  |     <meta charset="utf-8"> | 
					
						
							|  |  |  |     <meta http-equiv="X-UA-Compatible" content="IE=edge"> | 
					
						
							|  |  |  |     <meta name="viewport" content="width=device-width, initial-scale=1"> | 
					
						
							|  |  |  |     <meta name="description" content="<?php echo $PageOptions['MetaDescription']; ?>"/> | 
					
						
							|  |  |  |     <meta name="keywords" content="<?php echo $PageOptions['MetaKeywords']; ?>"/> | 
					
						
							|  |  |  |     <meta name="author" content="<?php echo $PageOptions['MetaAuthor']; ?>"/> | 
					
						
							|  |  |  |     <meta name="revisit" content="<?php echo $PageOptions['MetaRevisit']; ?>"/> | 
					
						
							|  |  |  |     <meta name="robots" content="<?php echo $PageOptions['MetaAuthor']; ?>"/> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     <meta http-equiv="content-type" content="text/html; charset=utf-8"/> | 
					
						
							|  |  |  |     <title><?php echo $Reflector->GetReflectorName(); ?> Reflector Dashboard</title>
 | 
					
						
							|  |  |  |     <link rel="icon" href="./favicon.ico" type="image/vnd.microsoft.icon"> | 
					
						
							|  |  |  |     <!-- Bootstrap core CSS --> | 
					
						
							|  |  |  |     <link href="css/bootstrap.min.css" rel="stylesheet"> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> | 
					
						
							|  |  |  |     <link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet"> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     <!-- Custom styles for this template --> | 
					
						
							|  |  |  |     <link href="css/dashboard.css" rel="stylesheet"> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> | 
					
						
							|  |  |  |     <!--[if lt IE 9]> | 
					
						
							|  |  |  |     <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> | 
					
						
							|  |  |  |     <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> | 
					
						
							|  |  |  |     <![endif]--> | 
					
						
							|  |  |  |     <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if ($PageOptions['PageRefreshActive']) { | 
					
						
							|  |  |  |         echo ' | 
					
						
							| 
									
										
										
										
											2016-07-05 10:29:40 -06:00
										 |  |  |    <script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       function ReloadPage() { | 
					
						
							|  |  |  |          document.location.href = "./index.php';
 | 
					
						
							| 
									
										
										
										
											2017-08-27 18:09:08 -03:00
										 |  |  |         if (isset($_GET['show'])) { | 
					
						
							|  |  |  |             echo '?show=' . $_GET['show']; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         echo '";
 | 
					
						
							| 
									
										
										
										
											2016-07-05 10:29:40 -06:00
										 |  |  |       }'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-27 18:09:08 -03:00
										 |  |  |         if (!isset($_GET['show']) || (($_GET['show'] != 'liveircddb') && ($_GET['show'] != 'reflectors') && ($_GET['show'] != 'interlinks'))) { | 
					
						
							|  |  |  |             echo ' | 
					
						
							|  |  |  |       setTimeout(ReloadPage, ' . $PageOptions['PageRefreshDelay'] . ');'; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         echo ' | 
					
						
							| 
									
										
										
										
											2016-07-05 10:29:40 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  |    </script>'; | 
					
						
							| 
									
										
										
										
											2017-08-27 18:09:08 -03:00
										 |  |  |     } | 
					
						
							|  |  |  |     if (!isset($_GET['show'])) $_GET['show'] = ""; | 
					
						
							|  |  |  |     ?>
 | 
					
						
							| 
									
										
										
										
											2016-07-05 10:29:40 -06:00
										 |  |  | </head> | 
					
						
							|  |  |  | <body> | 
					
						
							| 
									
										
										
										
											2017-08-27 18:09:08 -03:00
										 |  |  | <?php if (file_exists("./tracking.php")) { | 
					
						
							|  |  |  |     include_once("tracking.php"); | 
					
						
							|  |  |  | } ?>
 | 
					
						
							|  |  |  | <nav class="navbar navbar-inverse navbar-fixed-top"> | 
					
						
							|  |  |  |     <div class="container-fluid"> | 
					
						
							| 
									
										
										
										
											2016-07-05 10:29:40 -06:00
										 |  |  |         <div class="navbar-header"> | 
					
						
							| 
									
										
										
										
											2017-08-27 18:09:08 -03:00
										 |  |  |             <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" | 
					
						
							|  |  |  |                     aria-expanded="false" aria-controls="navbar"> | 
					
						
							|  |  |  |                 <span class="sr-only">Toggle navigation</span> | 
					
						
							|  |  |  |                 <span class="icon-bar"></span> | 
					
						
							|  |  |  |                 <span class="icon-bar"></span> | 
					
						
							|  |  |  |                 <span class="icon-bar"></span> | 
					
						
							|  |  |  |             </button> | 
					
						
							|  |  |  |             <span class="navbar-brand"><?php echo $Reflector->GetReflectorName(); ?> Multiprotocol Gateway</span>
 | 
					
						
							| 
									
										
										
										
											2016-07-05 10:29:40 -06:00
										 |  |  |         </div> | 
					
						
							|  |  |  |         <div id="navbar" class="navbar-collapse collapse"> | 
					
						
							| 
									
										
										
										
											2017-08-27 18:09:08 -03:00
										 |  |  |             <ul class="nav navbar-nav navbar-right"> | 
					
						
							|  |  |  |                 <li class="navbar-info"><?php echo $Reflector->GetVersion(); ?> - Dashboard
 | 
					
						
							|  |  |  |                     v<?php echo $PageOptions['DashboardVersion']; ?></li>
 | 
					
						
							|  |  |  |                 <li class="navbar-info">Service | 
					
						
							|  |  |  |                     uptime: <?php echo FormatSeconds($Reflector->GetServiceUptime()); ?></li>
 | 
					
						
							|  |  |  |             </ul> | 
					
						
							| 
									
										
										
										
											2016-07-05 10:29:40 -06:00
										 |  |  |         </div> | 
					
						
							| 
									
										
										
										
											2017-08-27 18:09:08 -03:00
										 |  |  |     </div> | 
					
						
							|  |  |  | </nav> | 
					
						
							| 
									
										
										
										
											2016-07-05 10:29:40 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-27 18:09:08 -03:00
										 |  |  | <div class="container-fluid"> | 
					
						
							|  |  |  |     <div class="row"> | 
					
						
							| 
									
										
										
										
											2016-07-05 10:29:40 -06:00
										 |  |  |         <div class="col-sm-3 col-md-2 sidebar"> | 
					
						
							| 
									
										
										
										
											2017-08-27 18:09:08 -03:00
										 |  |  |             <ul class="nav nav-sidebar"> | 
					
						
							|  |  |  |                 <li<?php echo (($_GET['show'] == "users") || ($_GET['show'] == "")) ? ' class="active"' : ''; ?>><a
 | 
					
						
							|  |  |  |                             href="./index.php">Users / Modules</a></li> | 
					
						
							|  |  |  |                 <li<?php echo ($_GET['show'] == "repeaters") ? ' class="active"' : ''; ?>><a
 | 
					
						
							|  |  |  |                             href="./index.php?show=repeaters">Repeaters / Nodes (<?php echo $Reflector->NodeCount(); ?>
 | 
					
						
							|  |  |  |                         )</a></li> | 
					
						
							|  |  |  |                 <li<?php echo ($_GET['show'] == "peers") ? ' class="active"' : ''; ?>><a href="./index.php?show=peers">Peers
 | 
					
						
							|  |  |  |                         (<?php echo $Reflector->PeerCount(); ?>)</a></li>
 | 
					
						
							|  |  |  |                 <li<?php echo ($_GET['show'] == "reflectors") ? ' class="active"' : ''; ?>><a
 | 
					
						
							|  |  |  |                             href="./index.php?show=reflectors">Reflectorlist</a></li> | 
					
						
							|  |  |  |                 <li<?php echo ($_GET['show'] == "liveircddb") ? ' class="active"' : ''; ?>><a
 | 
					
						
							|  |  |  |                             href="./index.php?show=liveircddb">D-Star live</a></li> | 
					
						
							|  |  |  |             </ul> | 
					
						
							| 
									
										
										
										
											2016-07-05 10:29:40 -06:00
										 |  |  |         </div> | 
					
						
							|  |  |  |         <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main"> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-27 18:09:08 -03:00
										 |  |  |             <?php | 
					
						
							|  |  |  |             if ($CallingHome['Active']) { | 
					
						
							|  |  |  |                 if (!is_readable($CallingHome['HashFile']) && (!is_writeable($CallingHome['HashFile']))) { | 
					
						
							|  |  |  |                     echo ' | 
					
						
							| 
									
										
										
										
											2016-07-05 10:29:40 -06:00
										 |  |  |          <div class="error"> | 
					
						
							| 
									
										
										
										
											2017-08-27 18:09:08 -03:00
										 |  |  |             your private hash in ' . $CallingHome['HashFile'] . ' could not be created, please check your config file and the permissions for the defined folder. | 
					
						
							| 
									
										
										
										
											2016-07-05 10:29:40 -06:00
										 |  |  |          </div>'; | 
					
						
							| 
									
										
										
										
											2017-08-27 18:09:08 -03:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             switch ($_GET['show']) { | 
					
						
							|  |  |  |                 case 'users'      : | 
					
						
							|  |  |  |                     require_once("./pgs/users.php"); | 
					
						
							|  |  |  |                     break; | 
					
						
							|  |  |  |                 case 'repeaters'  : | 
					
						
							|  |  |  |                     require_once("./pgs/repeaters.php"); | 
					
						
							|  |  |  |                     break; | 
					
						
							|  |  |  |                 case 'liveircddb' : | 
					
						
							|  |  |  |                     require_once("./pgs/liveircddb.php"); | 
					
						
							|  |  |  |                     break; | 
					
						
							|  |  |  |                 case 'peers'      : | 
					
						
							|  |  |  |                     require_once("./pgs/peers.php"); | 
					
						
							|  |  |  |                     break; | 
					
						
							|  |  |  |                 case 'reflectors' : | 
					
						
							|  |  |  |                     require_once("./pgs/reflectors.php"); | 
					
						
							|  |  |  |                     break; | 
					
						
							|  |  |  |                 default           : | 
					
						
							|  |  |  |                     require_once("./pgs/users.php"); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             ?>
 | 
					
						
							| 
									
										
										
										
											2016-07-05 10:29:40 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-27 18:09:08 -03:00
										 |  |  |         </div> | 
					
						
							| 
									
										
										
										
											2016-07-05 10:29:40 -06:00
										 |  |  |     </div> | 
					
						
							| 
									
										
										
										
											2017-08-27 18:09:08 -03:00
										 |  |  | </div> | 
					
						
							| 
									
										
										
										
											2016-07-05 10:29:40 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-27 18:09:08 -03:00
										 |  |  | <footer class="footer"> | 
					
						
							|  |  |  |     <div class="container"> | 
					
						
							|  |  |  |         <p><a href="mailto:<?php echo $PageOptions['ContactEmail']; ?>"><?php echo $PageOptions['ContactEmail']; ?></a>
 | 
					
						
							|  |  |  |         </p> | 
					
						
							|  |  |  |     </div> | 
					
						
							|  |  |  | </footer> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <!-- Bootstrap core JavaScript | 
					
						
							|  |  |  |  ================================================== --> | 
					
						
							|  |  |  | <!-- Placed at the end of the document so the pages load faster --> | 
					
						
							|  |  |  | <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> | 
					
						
							|  |  |  | <script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script> | 
					
						
							|  |  |  | <script src="js/bootstrap.min.js"></script> | 
					
						
							|  |  |  | <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> | 
					
						
							|  |  |  | <script src="js/ie10-viewport-bug-workaround.js"></script> | 
					
						
							| 
									
										
										
										
											2016-07-05 10:29:40 -06:00
										 |  |  | </body> | 
					
						
							|  |  |  | </html> |