Fixes to admin addition.

pull/67/head
Joe Prochazka 2016-01-24 00:09:19 -05:00
rodzic 1990201696
commit 5c753695b0
5 zmienionych plików z 110 dodań i 114 usunięć

Wyświetl plik

@ -33,10 +33,6 @@
BUILDDIR=$PWD
# Assign the Lighthttpd document root directory to a variable.
RAWDOCUMENTROOT=`/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf -p | grep server.document-root`
DOCUMENTROOT=`sed 's/.*"\(.*\)"[^"]*$/\1/' <<< $RAWDOCUMENTROOT`
## MODIFY THE DUMP1090-MUTABILITY INIT SCRIPT TO MEASURE AND RETAIN NOISE DATA
echo -e "\033[33m"
@ -191,16 +187,6 @@ echo -e "\033[33mReloading collectd so the new configuration is used..."
echo -e "\033[37m"
sudo /etc/init.d/collectd force-reload
## PLACE HTML FILES IN LIGHTTPD'S WWW ROOT
echo -e "\033[33m"
echo "Placing performance graph HTML file in Lighttpd's www root directory..."
echo -e "\033[37m"
if [ ! -d "${DOCUMENTROOT}/graphs" ]; then
sudo mkdir ${DOCUMENTROOT}/graphs
fi
sudo cp -r $BUILDDIR/portal/graphs/html/* ${DOCUMENTROOT}/graphs/
## EDIT CRONTAB
echo -e "\033[33mAdding jobs to crontab..."
@ -209,7 +195,7 @@ if [ -f /etc/cron.d/adsb-feeder-performance-graphs ]; then
sudo rm -f /etc/cron.d/adsb-feeder-performance-graphs
fi
echo -e "\033[37m"
chmod 755 $BUILDDIR/portal/graphs/make-collectd-graphs.sh
chmod +x $BUILDDIR/portal/graphs/make-collectd-graphs.sh
sudo tee -a /etc/cron.d/adsb-feeder-performance-graphs > /dev/null <<EOF
# Updates the portal's performance graphs.
#
@ -224,8 +210,8 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
*/5 * * * * root bash ${BUILDDIR}/portal/graphs/make-collectd-graphs.sh 1h >/dev/null
*/10 * * * * root bash ${BUILDDIR}/portal/graphs/make-collectd-graphs.sh 6h >/dev/null
2,12,22,32,42,52 * * * * root bash ${BUILDDIR}/portal/graphs/make-collectd-graphs.sh 24h 180 >/dev/null
4,24,44 * * * * root bash ${BUILDDIR}/portal/graphs/make-collectd-graphs.sh 7d 1200 >/dev/null
6 * * * * root bash ${BUILDDIR}/portal/graphs/make-collectd-graphs.sh 30d 5400 >/dev/null
8 */12 * * * root bash ${BUILDDIR}/portal/graphs/make-collectd-graphs.sh 365d 86400 >/dev/null
2,12,22,32,42,52 * * * * root bash ${BUILDDIR}/portal/graphs/make-collectd-graphs.sh 24h >/dev/null
4,24,44 * * * * root bash ${BUILDDIR}/portal/graphs/make-collectd-graphs.sh 7d >/dev/null
6 * * * * root bash ${BUILDDIR}/portal/graphs/make-collectd-graphs.sh 30d >/dev/null
8 */12 * * * root bash ${BUILDDIR}/portal/graphs/make-collectd-graphs.sh 365d >/dev/null
EOF

Wyświetl plik

@ -71,12 +71,6 @@ CheckPackage php5-cgi
## SETUP THE PORTAL WEBSITE
echo -e "\033[33m"
echo "Setting up performance graphs..."
echo -e "\033[37m"
chmod +x $BASHDIR/portal/graphs.sh
$BASHDIR/portal/graphs.sh
if [ $(dpkg-query -W -f='${STATUS}' pfclient 2>/dev/null | grep -c "ok installed") -eq 1 ]; then
echo -e "\033[33m"
echo -e "Inserting the Planefinder ADS-B Client links...\033[37m"
@ -91,6 +85,16 @@ echo -e "\033[33m"
echo -e "Placing portal files in Lighttpd's root directory...\033[37m"
sudo cp -R ${HTMLDIR}/* ${DOCUMENTROOT}
echo -e "\033[33m"
echo "Setting permissions on graphs folder...\033[37m"
chmod +w ${DOCUMENTROOT}/graphs/
echo -e "\033[33m"
echo "Setting up performance graphs..."
echo -e "\033[37m"
chmod +x $BASHDIR/portal/graphs.sh
$BASHDIR/portal/graphs.sh
## CHECK IF DUMP978 HAS BEEN BUILT
if [ -f $BUILDDIR/dump978/dump978 ] && [ -f $BUILDDIR/dump978/uat2text ] && [ -f $BUILDDIR/dump978/uat2esnt ] && [ -f $BUILDDIR/dump978/uat2json ]; then
@ -156,21 +160,25 @@ sudo chmod +w ${DOCUMENTROOT}/data/*.xml
echo -e "\033[33m"
echo -e "Removing conflicting redirect from the Lighttpd dump1090.conf file...\033[37m"
# Remove this line completely.
sudo sed "/$(echo ' "^/dump1090$" => "/dump1090/gmap.html"' | sed -e 's/\\/\\\\/g' -e 's/\//\\\//g' -e 's/&/\\\&/g')/d" /etc/lighttpd/conf-available/89-dump1090.conf
sudo sed -i "/$(echo ' "^/dump1090$" => "/dump1090/gmap.html"' | sed -e 's/\\/\\\\/g' -e 's/\//\\\//g' -e 's/&/\\\&/g')/d" /etc/lighttpd/conf-available/89-dump1090.conf
# Remove the trailing coma from this line.
sudo sed "s/$(echo '"^/dump1090/$" => "/dump1090/gmap.html",' | sed -e 's/\\/\\\\/g' -e 's/\//\\\//g' -e 's/&/\\\&/g')/$(echo '"^/dump1090/$" => "/dump1090/gmap.html"' | sed -e 's/\\/\\\\/g' -e 's/\//\\\//g' -e 's/&/\\\&/g')/g" /etc/lighttpd/conf-available/89-dump1090.conf
sudo sed -i "s/$(echo '"^/dump1090/$" => "/dump1090/gmap.html",' | sed -e 's/\\/\\\\/g' -e 's/\//\\\//g' -e 's/&/\\\&/g')/$(echo '"^/dump1090/$" => "/dump1090/gmap.html"' | sed -e 's/\\/\\\\/g' -e 's/\//\\\//g' -e 's/&/\\\&/g')/g" /etc/lighttpd/conf-available/89-dump1090.conf
echo -e "\033[33m"
echo -e "Configuring Lighttpd...\033[37m"
sudo tee -a /etc/lighttpd/conf-available/89-adsb-portal.conf > /dev/null <<EOF
# Block all access to the data directory accept for local requests.
$HTTP["remoteip"] !~ "127.0.0.1" {
$HTTP["url"] =~ "^/data/" {
\$HTTP["remoteip"] !~ "127.0.0.1" {
\$HTTP["url"] =~ "^/data/" {
url.access-deny = ( "" )
}
}
EOF
echo -e "\033[33m"
echo -e "Enabling Lighttpd portal configuration...\033[37m"
sudo ln -s /etc/lighttpd/conf-available/89-adsb-portal.conf /etc/lighttpd/conf-enabled/89-adsb-portal.conf
echo -e "\033[33m"
echo -e "Enabling the Lighttpd fastcgi-php module...\033[37m"
sudo lighty-enable-mod fastcgi-php
@ -178,9 +186,11 @@ sudo lighty-enable-mod fastcgi-php
echo -e "\033[33m"
if pgrep "lighttpd" > /dev/null; then
echo "Reloading Lighttpd..."
echo -e "\033[37m"
sudo /etc/init.d/lighttpd force-reload
else
echo "Starting Lighttpd..."
echo -e "\033[37m"
sudo /etc/init.d/lighttpd start
fi

Wyświetl plik

@ -1,9 +1,9 @@
<?php
/////////////////////////////////////////////////////////////////////////////////////
// ADS-B FEEDER PORTAL //
// =============================================================================== //
// Copyright and Licensing Information: //
/////////////////////////////////////////////////////////////////////////////////////
// ADS-B FEEDER PORTAL //
// =============================================================================== //
// Copyright and Licensing Information: //
// //
// The MIT License (MIT) //
// //
@ -25,7 +25,7 @@
// 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. //
// SOFTWARE. //
/////////////////////////////////////////////////////////////////////////////////////
session_start();
@ -103,16 +103,16 @@
$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);
}
}
}
$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);
////////////////
@ -143,10 +143,10 @@
<div class="form-group">
<label for="template">Template</label>
<select class="form-control" id="template" name="template">
<?php
foreach ($templates as $template) {
echo ' <option value="'.$template.'"'.($template == $currentTemplate ? ' selected' : '').'>'.$template.'</option>'."\n";
}
<?php
foreach ($templates as $template) {
echo ' <option value="'.$template.'"'.($template == $currentTemplate ? ' selected' : '').'>'.$template.'</option>'."\n";
}
?>
</select>
</div>
@ -166,27 +166,27 @@
<div class="panel-body">
<div class="checkbox">
<label>
<input type="checkbox" name="enableInfo" value="TRUE"<?php ($enableInfo == TRUE ? print ' checked' : ''); ?>> Enable system information link.
<input type="checkbox" name="enableInfo" value="TRUE"<?php ($enableInfo == 1 ? print ' checked' : ''); ?>> Enable system information link.
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="enableGraphs" value="TRUE"<?php ($enableGraphs == TRUE ? print ' checked' : ''); ?>> Enable performance graphs link.
<input type="checkbox" name="enableGraphs" value="TRUE"<?php ($enableGraphs == 1 ? print ' checked' : ''); ?>> Enable performance graphs link.
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="enableDump1090" value="TRUE"<?php ($enableDump1090 == TRUE ? print ' checked' : ''); ?>> Enable live dump1090 map link.
<input type="checkbox" name="enableDump1090" value="TRUE"<?php ($enableDump1090 == 1 ? print ' checked' : ''); ?>> Enable live dump1090 map link.
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="enableDump978" value="TRUE"<?php ($enableDump978 == TRUE ? print ' checked' : ''); ?>> Enable live dump978 map link.
<input type="checkbox" name="enableDump978" value="TRUE"<?php ($enableDump978 == 1 ? 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.
<input type="checkbox" name="enablePfclient" value="TRUE"<?php ($enablePfclient == 1 ? print ' checked' : ''); ?>> Enable Planfinder ADS-B Client link.
</label>
</div>
</div>
@ -221,4 +221,4 @@
</form>
<?php
require_once('includes/footer.inc.php')
?>
?>

Wyświetl plik

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

Wyświetl plik

@ -11,71 +11,71 @@
// Website: https://www.swiftbyte.com //
// ========================================================================== //
// Copyright and Licensing Information: //
// //
// Copyright (c) 2015 Joseph A. Prochazka //
// //
// This template set is licensed under The MIT License (MIT) //
// //
// Copyright (c) 2015 Joseph A. Prochazka //
// //
// This template set is licensed under The MIT License (MIT) //
// A copy of the license can be found package along with these files. //
////////////////////////////////////////////////////////////////////////////////
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><?php echo $siteName ?>: <?php echo $pageTitle; ?></title>
<meta http-equiv="cache-control" content="no-cache" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="templates/<?php echo $template; ?>/assets/css/portal.css">
////////////////////////////////////////////////////////////////////////////////
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><?php echo $siteName ?>: <?php echo $pageTitle; ?></title>
<meta http-equiv="cache-control" content="no-cache" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="templates/<?php echo $template; ?>/assets/css/portal.css">
<?php
headContent();
?>
</head>
<body>
<div id="wrapper">
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/"><?php echo $siteName; ?></title></a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<?php ($enableInfo ? print '<li id="system-link"><a href="/system.php">System Information</a></li>' : ''); ?>
<?php ($enableGraphs ? print '<li id="graphs-link"><a href="/graphs.php">Performance Graphs</a></li>' : ''); ?>
<?php ($enableDump1090 ? print '<li id="dump1090-link"><a href="/dump1090.php">Live Dump1090 Map</a></li>' : ''); ?>
<?php ($enableDump978 ? print '<li id="dump978-link"><a href="/dump978.php">Live Dump978 Map</a></li>' : ''); ?>
<?php ($enablePfclient ? print '<!-- Plane Finder ADS-B Client Link Placeholder -->' : ''); ?>
</ul>
</div>
</div>
</nav>
?>
</head>
<body>
<div id="wrapper">
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/"><?php echo $siteName; ?></title></a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<?php ($enableInfo == 1 ? print '<li id="system-link"><a href="/system.php">System Information</a></li>' : ''); ?>
<?php ($enableGraphs == 1 ? print '<li id="graphs-link"><a href="/graphs.php">Performance Graphs</a></li>' : ''); ?>
<?php ($enableDump1090 == 1 ? print '<li id="dump1090-link"><a href="/dump1090.php">Live Dump1090 Map</a></li>' : ''); ?>
<?php ($enableDump978 == 1 ? print '<li id="dump978-link"><a href="/dump978.php">Live Dump978 Map</a></li>' : ''); ?>
<?php ($enablePfclient == 1 ? print '<!-- Plane Finder ADS-B Client Link Placeholder -->' : ''); ?>
</ul>
</div>
</div>
</nav>
<?php
pageContent();
?>
<div id="push"></div>
</div>
<footer id="footer">
<div class="container">
<p class="muted credits">
<a href="https://github.com/jprochazka/adsb-feeder">The ADS-B Feeder Project</a>
</p>
</div>
</footer>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="http://code.jquery.com/jquery-2.2.0.min.js"></script>
?>
<div id="push"></div>
</div>
<footer id="footer">
<div class="container">
<p class="muted credits">
<a href="https://github.com/jprochazka/adsb-feeder">The ADS-B Feeder Project</a>
</p>
</div>
</footer>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="http://code.jquery.com/jquery-2.2.0.min.js"></script>
<script type="text/javascript">
$('#<?php echo $linkId ?>').addClass("active");
</script>
</script>
<?php
scriptContent();
?>
</body>
</html>
?>
</body>
</html>