Layout and settings page work.

pull/67/head
Joe Prochazka 2016-01-21 16:55:32 -05:00
rodzic d211e06ab9
commit 577c33eec8
12 zmienionych plików z 229 dodań i 22 usunięć

Wyświetl plik

@ -34,8 +34,8 @@
$didNotMatch = FALSE;
// Load the require PHP classes.
require_once('../classes/common.class.php');
require_once('../classes/account.class.php');
require_once('classes/common.class.php');
require_once('classes/account.class.php');
$common = new common();
$account = new account();

Wyświetl plik

@ -68,7 +68,7 @@
// Returns the value for the specified setting name.
function getSetting($name) {
$settings = simplexml_load_file("../data/setting.xml") or die("Error: Cannot create settings object");
$settings = simplexml_load_file("../data/settings.xml") or die("Error: Cannot create settings object");
foreach ($settings as $setting) {
if ($setting->name == $name) {
return $setting->value;

Wyświetl plik

@ -22,13 +22,14 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">ADS-B Feeder Administration</a>
<a class="navbar-brand" href="/admin">ADS-B Feeder Administration</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li id="logout-link"><a href="logout.php">Portal</a></li>
<li id="logout-link"><a href="logout.php">Account</a></li>
<li id="logout-link"><a href="/admin">Settings</a></li>
<li id="logout-link"><a href="account.php">Account</a></li>
<li id="logout-link"><a href="logout.php">Logout</a></li>
<li id="logout-link"><a href="/" target="_blank">Portal Home</a></li>
</ul>
</div>
</div>

Wyświetl plik

@ -31,8 +31,8 @@
session_start();
// Load the require PHP classes.
require_once('../classes/common.class.php');
require_once('../classes/account.class.php');
require_once('classes/common.class.php');
require_once('classes/account.class.php');
$common = new common();
$account = new account();
@ -43,6 +43,34 @@
header ("Location: login.php");
}
// Get general settings from settings.xml.
$siteName = $common->getSetting("siteName");
$currentTemplate = $common->getSetting("template");
$defaultPage = $common->getSetting("defaultPage");
// Get navigation settings from settings.xml.
$enableInfo = $common->getSetting("enableInfo");
$enableGraphs = $common->getSetting("enableGraphs");
$enableDump1090 = $common->getSetting("enableDump1090");
$enableDump978 = $common->getSetting("enableDump978");
$enablePfclient = $common->getSetting("enablePfclient");
// Get unit of measurement setting from settings.xml
$measurment = $common->getSetting("measurment");
// 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);
require_once('includes/header.inc.php')
?>
<form method="post" action="index.php">
@ -51,12 +79,25 @@
<div class="panel-body">
<div class="form-group">
<label for="siteName">Site Name</label>
<input type="text" class="form-control" id="siteName" name="siteName">
<input type="text" class="form-control" id="siteName" name="siteName" value="<?php echo $siteName; ?>">
</div>
<div class="form-group">
<label for="template">Template</label>
<select class="form-control" id="template" name="template">
<option value="default">default</option>
<?php
foreach ($templates as $template) {
echo ' <option value="'.$template.'"'.($template == $currentTemplate ? ' selected' : '').'>'.$template.'</option>'."\n";
}
?>
</select>
</div>
<div class="form-group">
<label for="template">Default Page</label>
<select class="form-control" id="template" name="template">
<option value="index.php"<?php ($defaultPage == "index.php" ? print ' selected' : ''); ?>>System Information</option>
<option value="graphs.php"<?php ($defaultPage == "graphs.php" ? print ' selected' : ''); ?>>Performance Graphs</option>
<option value="dump1090.php"<?php ($defaultPage == "dump1090.php" ? print ' selected' : ''); ?>>Live Dump1090 Map</option>
<option value="dump978.php"<?php ($defaultPage == "dump978.php" ? print ' selected' : ''); ?>>Live Dump978 Map</option>
</select>
</div>
</div>
@ -66,26 +107,45 @@
<div class="panel-body">
<div class="checkbox">
<label>
<input type="checkbox" name="enableGraphs" value="TRUE"> Enable dump1090 map link.
<input type="checkbox" name="enableInfo" value="TRUE"<?php ($enableInfo == "TRUE" ? print ' checked' : ''); ?>> Enable system information link.
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="enableDump1090" value="TRUE"> Enable dump1090 map link.
<input type="checkbox" name="enableGraphs" value="TRUE"<?php ($enableGraphs == "TRUE" ? print ' checked' : ''); ?>> Enable performance graphs link.
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="enableDump978" value="TRUE"> Enable dump978 map link.
<input type="checkbox" name="enableDump1090" value="TRUE"<?php ($enableDump1090 == "TRUE" ? print ' checked' : ''); ?>> Enable live dump1090 map link.
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="enablePfclient" value="TRUE"> Enable Planfinder ADS-B Client link.
<input type="checkbox" name="enableDump978" value="TRUE"<?php ($enableDump978 == "TRUE" ? print ' checked' : ''); ?>> Enable live dump978 map link.
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="enablePfclient" value="TRUE"<?php ($enablePfclient == "TRUE" ? print ' checked' : ''); ?>> Enable Planfinder ADS-B Client link.
</label>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">Unit of Measurment</div>
<div class="panel-body">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default active">
<input type="radio" name="options" id="imperial" autocomplete="off"<?php ($measurment == "imperial" ? print ' checked' : ''); ?>> Imperial
</label>
<label class="btn btn-default">
<input type="radio" name="options" id="metric" autocomplete="off"<?php ($measurment == "metric" ? print ' checked' : ''); ?>> Metric
</label>
</div>
</div>
</div>
<input type="submit" class="btn btn-default" value="Save Settings">
</form>
<?php
require_once('includes/footer.inc.php')

Wyświetl plik

@ -38,8 +38,8 @@
session_start();
// Load the require PHP classes.
require_once('../classes/common.class.php');
require_once('../classes/account.class.php');
require_once('classes/common.class.php');
require_once('classes/account.class.php');
$common = new common();
$account = new account();

Wyświetl plik

@ -0,0 +1,37 @@
<?php
/////////////////////////////////////////////////////////////////////////////////////
// ADS-B FEEDER PORTAL //
// =============================================================================== //
// Copyright and Licensing Information: //
// //
// The MIT License (MIT) //
// //
// Copyright (c) 2015 Joseph A. Prochazka //
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy //
// of this software and associated documentation files (the "Software"), to deal //
// in the Software without restriction, including without limitation the rights //
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell //
// copies of the Software, and to permit persons to whom the Software is //
// furnished to do so, subject to the following conditions: //
// //
// The above copyright notice and this permission notice shall be included in all //
// copies or substantial portions of the Software. //
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR //
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, //
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE //
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER //
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, //
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE //
// SOFTWARE. //
/////////////////////////////////////////////////////////////////////////////////////
session_start();
// Load the require PHP classes.
require_once('classes/account.class.php');
$account = new account();
$account->logout();
?>

Wyświetl plik

@ -0,0 +1,50 @@
<?php
/////////////////////////////////////////////////////////////////////////////////////
// ADS-B FEEDER PORTAL //
// =============================================================================== //
// Copyright and Licensing Information: //
// //
// The MIT License (MIT) //
// //
// Copyright (c) 2015 Joseph A. Prochazka //
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy //
// of this software and associated documentation files (the "Software"), to deal //
// in the Software without restriction, including without limitation the rights //
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell //
// copies of the Software, and to permit persons to whom the Software is //
// furnished to do so, subject to the following conditions: //
// //
// The above copyright notice and this permission notice shall be included in all //
// copies or substantial portions of the Software. //
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR //
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, //
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE //
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER //
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, //
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE //
// SOFTWARE. //
/////////////////////////////////////////////////////////////////////////////////////
class sysinfo {
function memoryUsage(){
$free = shell_exec('free');
$free = (string)trim($free);
$free_arr = explode("\n", $free);
$mem = explode(" ", $free_arr[1]);
$mem = array_filter($mem);
$mem = array_merge($mem);
$memory_usage = $mem[2]/$mem[1]*100;
return $memoryUsage;
}
function cpuUsage(){
$load = sys_getloadavg();
return $load[0];
}
}
?>

Wyświetl plik

@ -3,6 +3,6 @@
<administrator>
<login>admin</login>
<password>$2y$10$uDSOA6NhbgmtMAiNp.QAROD/PG6RUQE/m0xp6fRgo5/TBkMWxReBq</password>
<firstLogin>TRUE</firstLogin>
<firstLogin>FALSE</firstLogin>
</administrator>
</administrators>

Wyświetl plik

@ -8,20 +8,32 @@
<name>template</name>
<value>default</value>
</setting>
<setting>
<name>defaultPage</name>
<value>graphs.php</value>
</setting>
<setting>
<name>enableInfo</name>
<value>TRUE</value>
</setting>
<setting>
<name>enableGraphs</name>
<value>true</value>
<value>TRUE</value>
</setting>
<setting>
<name>enableDump1090</name>
<value>true</value>
<value>TRUE</value>
</setting>
<setting>
<name>enableDump978</name>
<value>true</value>
<value>TRUE</value>
</setting>
<setting>
<name>enablePfclient</name>
<value>true</value>
<value>TRUE</value>
</setting>
<setting>
<name>measurment</name>
<value>imperial</value>
</setting>
</settings>

Wyświetl plik

@ -31,8 +31,12 @@
// Start session
session_start();
// Load the common PHP classes.
require_once('classes/common.class.php');
$common = new common();
// Get the name of the template to use from the settings.
$template = getSetting("template");
$template = $common->getSetting("template");
// Include the index template.
require_once('templates/'.$template.'/dump978.tpl.php');

Wyświetl plik

@ -0,0 +1,43 @@
<?php
/////////////////////////////////////////////////////////////////////////////////////
// ADS-B FEEDER PORTAL //
// =============================================================================== //
// Copyright and Licensing Information: //
// //
// The MIT License (MIT) //
// //
// Copyright (c) 2015 Joseph A. Prochazka //
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy //
// of this software and associated documentation files (the "Software"), to deal //
// in the Software without restriction, including without limitation the rights //
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell //
// copies of the Software, and to permit persons to whom the Software is //
// furnished to do so, subject to the following conditions: //
// //
// The above copyright notice and this permission notice shall be included in all //
// copies or substantial portions of the Software. //
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR //
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, //
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE //
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER //
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, //
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE //
// SOFTWARE. //
/////////////////////////////////////////////////////////////////////////////////////
// Start session
session_start();
// Load the common PHP classes.
require_once('classes/common.class.php');
$common = new common();
// Get the default page from the settings.
$defaultPage = $common->getSetting("defaultPage");
// Forward the user to the default page defined in the settings.
header ("Location: ".$defaultPage);
?>