isAuthenticated()) { // The user is not logged in so forward them to the login page. header ("Location: login.php"); } // Set updated variable to FALSE. $updated = FALSE; if ($common->postBack()) { // Flight notifications $notificationArray = explode(',', $_POST['notifications']); if ($settings::db_driver == "xml") { // XML $notifications = simplexml_load_file($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."flightNotifications.xml"); unset($notifications->flight); foreach ($notificationArray as $notification) { $newNotification = $notifications->addChild('flight', $notification); $dom = dom_import_simplexml($notifications)->ownerDocument; $dom->formatOutput = TRUE; file_put_contents($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."flightNotifications.xml", $dom->saveXML()); } } else { // PDO $dbh = $common->pdoOpen(); $sql = "SELECT * FROM ".$settings::db_prefix."flightNotifications"; $sth = $dbh->prepare($sql); $sth->execute(); $savedFlights = $sth->fetchAll(); $sth = NULL; $dbh = NULL; foreach ($savedFlights as $flight) { // Remove flight if not in list. if (!in_array($flight, $notificationArray)) { $dbh = $common->pdoOpen(); $sql = "DELETE FROM ".$settings::db_prefix."flightNotifications WHERE flight = :flight"; $sth = $dbh->prepare($sql); $sth->bindParam(':flight', $flight['flight'], PDO::PARAM_STR, 10); $sth->execute(); $sth = NULL; $dbh = NULL; } } foreach ($notificationArray as $flight) { // Add flight if not saved already. if (!in_array($flight, $savedFlights)) { $dbh = $common->pdoOpen(); $sql = "INSERT INTO ".$settings::db_prefix."flightNotifications (flight) VALUES (:flight)"; $sth = $dbh->prepare($sql); $sth->bindParam(':flight', $flight, PDO::PARAM_STR, 10); $sth->execute(); $sth = NULL; $dbh = NULL; } } } // Set TRUE or FALSE for checkbox items. $enableFlights = FALSE; if (isset($_POST['enableFlights']) && $_POST['enableFlights'] == "TRUE") $enableFlights = TRUE; $enableBlog = FALSE; if (isset($_POST['enableBlog']) && $_POST['enableBlog'] == "TRUE") $enableBlog = TRUE; $enableInfo = FALSE; if (isset($_POST['enableInfo']) && $_POST['enableInfo'] == "TRUE") $enableInfo = TRUE; $enableGraphs = FALSE; if (isset($_POST['enableGraphs']) && $_POST['enableGraphs'] == "TRUE") $enableGraphs = TRUE; $enableLinks = FALSE; if (isset($_POST['enableLinks']) && $_POST['enableLinks'] == "TRUE") $enableLinks = TRUE; $enableDump1090 = FALSE; if (isset($_POST['enableDump1090']) && $_POST['enableDump1090'] == "TRUE") $enableDump1090 = TRUE; $enableDump978 = FALSE; if (isset($_POST['enableDump978']) && $_POST['enableDump978'] == "TRUE") $enableDump978 = TRUE; $enablePfclient = FALSE; if (isset($_POST['enablePfclient']) && $_POST['enablePfclient'] == "TRUE") $enablePfclient = TRUE; $enableFlightAwareLink = FALSE; if (isset($_POST['enableFlightAwareLink']) && $_POST['enableFlightAwareLink'] == "TRUE") $enableFlightAwareLink = TRUE; $enablePlaneFinderLink = FALSE; if (isset($_POST['enablePlaneFinderLink']) && $_POST['enablePlaneFinderLink'] == "TRUE") $enablePlaneFinderLink = TRUE; $enableFlightRadar24Link = FALSE; if (isset($_POST['enableFlightRadar24Link']) && $_POST['enableFlightRadar24Link'] == "TRUE") $enableFlightRadar24Link = TRUE; $enableAdsbExchangeLink = FALSE; if (isset($_POST['enableAdsbExchangeLink']) && $_POST['enableAdsbExchangeLink'] == "TRUE") $enableAdsbExchangeLink = TRUE; $enableWebNotifications = FALSE; if (isset($_POST['enableWebNotifications']) && $_POST['enableWebNotifications'] == "TRUE") $enableWebNotifications = TRUE; // Update settings using those supplied by the form. $common->updateSetting("siteName", $_POST['siteName']); $common->updateSetting("template", $_POST['template']); $common->updateSetting("defaultPage", $_POST['defaultPage']); $common->updateSetting("dateFormat", $_POST['dateFormat']); $common->updateSetting("enableFlights", $enableFlights); $common->updateSetting("enableBlog", $enableBlog); $common->updateSetting("enableInfo", $enableInfo); $common->updateSetting("enableGraphs", $enableGraphs); $common->updateSetting("enableLinks", $enableLinks); $common->updateSetting("enableDump1090", $enableDump1090); $common->updateSetting("enableDump978", $enableDump978); $common->updateSetting("enablePfclient", $enablePfclient); $common->updateSetting("enableFlightAwareLink", $enableFlightAwareLink); $common->updateSetting("flightAwareLogin", $_POST['flightAwareLogin']); $common->updateSetting("flightAwareSite", $_POST['flightAwareSite']); $common->updateSetting("enablePlaneFinderLink", $enablePlaneFinderLink); $common->updateSetting("planeFinderReceiver", $_POST['planeFinderReceiver']); $common->updateSetting("enableFlightRadar24Link", $enableFlightRadar24Link); $common->updateSetting("flightRadar24Id", $_POST['flightRadar24Id']); $common->updateSetting("enableAdsbExchangeLink", $enableAdsbExchangeLink); $common->updateSetting("measurementRange", $_POST['measurementRange']); $common->updateSetting("measurementTemperature", $_POST['measurementTemperature']); $common->updateSetting("measurementBandwidth", $_POST['measurementBandwidth']); $common->updateSetting("networkInterface", $_POST['networkInterface']); $common->updateSetting("timeZone", $_POST['timeZone']); $common->updateSetting("enableWebNotifications", $enableWebNotifications); $common->updateSetting("googleMapsApiKey", $_POST['googleMapsApiKey']); // Purge older flight positions. if (isset($_POST['purgepositions'])) { $dbh = $common->pdoOpen(); $sql = "DELETE FROM ".$settings::db_prefix."positions WHERE time < :purgeDate"; $sth = $dbh->prepare($sql); $sth->bindParam(':purgeDate', $_POST['purgepositionspicker'], PDO::PARAM_STR, 100); $sth->execute(); $sth = NULL; $dbh = NULL; } // Set updated to TRUE since settings were updated. $updated = TRUE; } // Get notification settings. $notifications = NULL; $savedFlights = array(); if ($settings::db_driver == "xml") { // XML $savedFlights = simplexml_load_file($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."notifications.xml"); foreach ($savedFlights as $savedFlight) { $notifications = ltrim($notifications.",".$savedFlight->name, ','); } } else { //PDO $dbh = $common->pdoOpen(); $sql = "SELECT * FROM ".$settings::db_prefix."notifications"; $sth = $dbh->prepare($sql); $sth->execute(); $savedFlights = $sth->fetchAll(); $sth = NULL; $dbh = NULL; foreach ($savedFlights as $savedFlight) { $notifications = ltrim($notifications.",".$savedFlight['flight'], ','); } } $enableWebNotifications = $common->getSetting("enableWebNotifications"); // Get general settings from settings.xml. $siteName = $common->getSetting("siteName"); $currentTemplate = $common->getSetting("template"); $defaultPage = $common->getSetting("defaultPage"); $dateFormat = $common->getSetting("dateFormat"); $timeZone = $common->getSetting("timeZone"); $googleMapsApiKey = $common->getSetting("googleMapsApiKey"); // Get navigation settings from settings.xml. $enableFlights = $common->getSetting("enableFlights"); $enableBlog = $common->getSetting("enableBlog"); $enableInfo = $common->getSetting("enableInfo"); $enableGraphs = $common->getSetting("enableGraphs"); $enableLinks = $common->getSetting("enableLinks"); $enableDump1090 = $common->getSetting("enableDump1090"); $enableDump978 = $common->getSetting("enableDump978"); $enablePfclient = $common->getSetting("enablePfclient"); // Get aggregate site settings from settings.xml. $enableFlightAwareLink = $common->getSetting("enableFlightAwareLink"); $flightAwareLogin = $common->getSetting("flightAwareLogin"); $flightAwareSite = $common->getSetting("flightAwareSite"); $enablePlaneFinderLink = $common->getSetting("enablePlaneFinderLink"); $planeFinderReceiver = $common->getSetting("planeFinderReceiver"); $enableFlightRadar24Link = $common->getSetting("enableFlightRadar24Link"); $flightRadar24Id = $common->getSetting("flightRadar24Id"); $enableAdsbExchangeLink = $common->getSetting("enableAdsbExchangeLink"); // Get units of measurement setting from settings.xml. $measurementRange = $common->getSetting("measurementRange"); $measurementTemperature = $common->getSetting("measurementTemperature"); $measurementBandwidth = $common->getSetting("measurementBandwidth"); // Get the network interface from settings.xml. $networkInterface = $common->getSetting("networkInterface"); // Create an array of all directories in the template folder. $templates = array(); $path = "../templates/"; $directoryHandle = @opendir($path) or die('Unable to open directory "'.$path.'".'); while($templateDirectory = readdir($directoryHandle)) { if (is_dir($path."/".$templateDirectory)) { if ($templateDirectory != "." && $templateDirectory != "..") { array_push($templates, $templateDirectory); } } } closedir($directoryHandle); // Function used to format offsets of timezones. function formatOffset($offset) { return sprintf('%+03d:%02u', floor($offset / 3600), floor(abs($offset) % 3600 / 60)); } $utc = new DateTimeZone('UTC'); $dt = new DateTime('now', $utc); //////////////// // BEGIN HTML require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."admin".DIRECTORY_SEPARATOR."includes".DIRECTORY_SEPARATOR."header.inc.php"); // Display the updated message if settings were updated. if ($updated) { ?>
Site Layout
Time Format

Select one of the formats above or create your own. PHP date function documentation.

Flight Notifications
Unit of Measurement (Range)
Unit of Measurement (Temperature)
Unit of Measurement (Bandwidth)
Network Interface
Purge Positions

Current Database Size: getDatabaseSize("mb"); ?>MB


>