pull/270/head
Joe Prochazka 2016-11-28 12:18:15 -05:00
commit 5558108a8e
32 zmienionych plików z 480 dodań i 205 usunięć

Wyświetl plik

@ -4,11 +4,18 @@ The following is a history of the changes made to this project.
## v2.5.0
* Twitter and email flight notifications ready for testing. *(lite)*
* Added script to automate the portal backup process.
* Added ability to specify the latitude and longitude of the receiver for dump978.
* Administrators can now specify custom links to be displayed within the portal.
* The loading speed for the flights page has been dramatically reduced. *(advanced)*
* When upgrading dump1090 the user is once again asked for the LAT and LON settings.
* Portal related python scripts are now localed in the folder named python.
* A Google Maps API key can now be specified for use with portal maps.
* Portal upgrade scripts have been split into multiple files.
* The path to the SQLite database is no longer hard coded in the portal PHP files.
* Pagination links now show first and last page links properly.
* When no patch is applied N\A is given for the patch version on the system page.
## v2.4.0 *(September 27th, 2016)*

Wyświetl plik

@ -145,6 +145,20 @@ fi
## DUMP1090-FA POST INSTALLATION CONFIGURATION
# Ask for a Bing Maps API key.
BINGMAPSKEY=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Bing Maps API Key" --nocancel --inputbox "\nProvide a Bing Maps API key here to enable the Bing imagery layer.\nYou can obtain a free key at https://www.bingmapsportal.com/\n\nProviding a Bing Maps API key is not required to continue." 11 78 `GetConfig "BingMapsAPIKey" "/usr/share/dump1090-mutability/html/config.js"` 3>&1 1>&2 2>&3)
if [[ ! -z $BINGMAPSKEY ]]; then
echo -e "\e[94m Setting the Bing Maps API Key to $BINGMAPSKEY...\e[97m"
ChangeConfig "BingMapsAPIKey" "$BINGMAPSKEY" "/usr/share/dump1090-fa/html/config.js"
fi
# Ask for a Mapzen API key.
MAPZENKEY=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Mapzen API Key" --nocancel --inputbox "\nProvide a Mapzen API key here to enable the Mapzen vector tile layer within the dump1090-mutability map. You can obtain a free key at https://mapzen.com/developers/\n\nProviding a Mapzen API key is not required to continue." 13 78 `GetConfig "MapzenAPIKey" "/usr/share/dump1090-mutability/html/config.js"` 3>&1 1>&2 2>&3)
if [[ ! -z $MAPZENKEY ]]; then
echo -e "\e[94m Setting the Mapzen API Key to $MAPZENKEY...\e[97m"
ChangeConfig "MapzenAPIKey" "$MAPZENKEY" "/usr/share/dump1090-fa/html/config.js"
fi
# Download Heywhatsthat.com maximum range rings.
if [ ! -f /usr/share/dump1090-fa/html/upintheair.json ] && (whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Heywhaststhat.com Maimum Range Rings" --yesno "Maximum range rings can be added to dump1090-fa usings data obtained from Heywhatsthat.com. In order to add these rings to your dump1090-fa map you will first need to visit http://www.heywhatsthat.com and generate a new panarama centered on the location of your receiver. Once your panarama has been generated a link to the panarama will be displayed in the up left hand portion of the page. You will need the view id which is the series of letters and/or numbers after \"?view=\" in this URL.\n\nWould you like to add heywatsthat.com maximum range rings to your map?" 16 78); then
HEYWHATSTHATID_TITLE="Heywhatsthat.com Panarama ID"

Wyświetl plik

@ -151,18 +151,38 @@ echo ""
whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Receiver Latitude and Longitude" --msgbox "Your receivers latitude and longitude are required for certain features to function properly. You will now be asked to supply the latitude and longitude for your receiver. If you do not have this information you get it by using the web based \"Geocode by Address\" utility hosted on another of my websites.\n\n https://www.swiftbyte.com/toolbox/geocode" 13 78
RECEIVERLATITUDE_TITLE="Receiver Latitude"
while [[ -z $RECEIVERLATITUDE ]]; do
RECEIVERLATITUDE=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$RECEIVERLATITUDE_TITLE" --nocancel --inputbox "\nEnter your receiver's latitude.\n(Example: XX.XXXXXXX)" 9 78 `GetConfig "LAT" "/etc/default/dump1090-mutability"` 3>&1 1>&2 2>&3)
RECEIVERLATITUDE=`GetConfig "LAT" "/etc/default/dump1090-mutability"`
RECEIVERLATITUDE=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$RECEIVERLATITUDE_TITLE" --nocancel --inputbox "\nEnter your receiver's latitude.\n(Example: XX.XXXXXXX)" 9 78 " $RECEIVERLATITUDE" 3>&1 1>&2 2>&3)
RECEIVERLATITUDE_TITLE="Receiver Latitude (REQUIRED)"
done
RECEIVERLONGITUDE_TITLE="Receiver Longitude"
while [[ -z $RECEIVERLONGITUDE ]]; do
RECEIVERLONGITUDE=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$RECEIVERLONGITUDE_TITLE" --nocancel --inputbox "\nEnter your receeiver's longitude.\n(Example: XX.XXXXXXX)" 9 78 `GetConfig "LON" "/etc/default/dump1090-mutability"` 3>&1 1>&2 2>&3)
RECEIVERLONGITUDE=`GetConfig "LON" "/etc/default/dump1090-mutability"`
RECEIVERLONGITUDE=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$RECEIVERLONGITUDE_TITLE" --nocancel --inputbox "\nEnter your receeiver's longitude.\n(Example: XX.XXXXXXX)" 9 78 " $RECEIVERLONGITUDE" 3>&1 1>&2 2>&3)
RECEIVERLONGITUDE_TITLE="Receiver Longitude (REQUIRED)"
done
echo -e "\e[94m Setting the receiver's latitude to $RECEIVERLATITUDE...\e[97m"
ChangeConfig "LAT" $RECEIVERLATITUDE "/etc/default/dump1090-mutability"
ChangeConfig "LAT" "$(sed -e 's/[[:space:]]*$//' <<<${RECEIVERLATITUDE})" "/etc/default/dump1090-mutability"
echo -e "\e[94m Setting the receiver's longitude to $RECEIVERLONGITUDE...\e[97m"
ChangeConfig "LON" $RECEIVERLONGITUDE "/etc/default/dump1090-mutability"
ChangeConfig "LON" "$(sed -e 's/[[:space:]]*$//' <<<${RECEIVERLONGITUDE})" "/etc/default/dump1090-mutability"
# Ask for a Bing Maps API key.
BINGMAPSKEY=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Bing Maps API Key" --nocancel --inputbox "\nProvide a Bing Maps API key here to enable the Bing imagery layer.\nYou can obtain a free key at https://www.bingmapsportal.com/\n\nProviding a Bing Maps API key is not required to continue." 11 78 `GetConfig "BingMapsAPIKey" "/usr/share/dump1090-mutability/html/config.js"` 3>&1 1>&2 2>&3)
if [[ ! -z $BINGMAPSKEY ]]; then
echo -e "\e[94m Setting the Bing Maps API Key to $BINGMAPSKEY...\e[97m"
ChangeConfig "BingMapsAPIKey" "$BINGMAPSKEY" "/usr/share/dump1090-mutability/html/config.js"
fi
# Ask for a Mapzen API key.
MAPZENKEY=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Mapzen API Key" --nocancel --inputbox "\nProvide a Mapzen API key here to enable the Mapzen vector tile layer within the dump1090-mutability map. You can obtain a free key at https://mapzen.com/developers/\n\nProviding a Mapzen API key is not required to continue." 13 78 `GetConfig "MapzenAPIKey" "/usr/share/dump1090-mutability/html/config.js"` 3>&1 1>&2 2>&3)
if [[ ! -z $MAPZENKEY ]]; then
echo -e "\e[94m Setting the Mapzen API Key to $MAPZENKEY...\e[97m"
ChangeConfig "MapzenAPIKey" "$MAPZENKEY" "/usr/share/dump1090-mutability/html/config.js"
fi
exit 0
# Ask if dump1090-mutability should bind on all IP addresses.
if (whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Bind Dump1090-mutability To All IP Addresses" --defaultno --yesno "By default dump1090-mutability is bound only to the local loopback IP address(s) for security reasons. However some people wish to make dump1090-mutability's data accessable externally by other devices. To allow this dump1090-mutability can be configured to listen on all IP addresses bound to this device. It is recommended that unless you plan to access this device from an external source that dump1090-mutability remain bound only to the local loopback IP address(s).\n\nWould you like dump1090-mutability to listen on all IP addesses?" 15 78) then

Wyświetl plik

@ -173,6 +173,12 @@ if [ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "o
echo ""
sudo /etc/init.d/dump1090-mutability restart
echo ""
# Get the latitude and longitude set in the dump1090-mutability configuration file to be used later.
echo -e "\e[94m Retrieving the receiver's latitude from /etc/default/dump1090-mutability...\e[97m"
RECEIVERLATITUDE=`GetConfig "LAT" "/etc/default/dump1090-mutability"`
echo -e "\e[94m Retrieving the receiver's longitude from /etc/default/dump1090-mutability...\e[97m"
RECIEVERLONGITUDE=`GetConfig "LON" "/etc/default/dump1090-mutability"`
fi
# If a device has not yet been assigned to dump978 assign the first available.
@ -181,10 +187,29 @@ if [ -z $DUMP978DEVICE ]; then
DUMP978DEVICE="0"
fi
# Create the dump978 JSON directory in Lighttpd's document root.
# Declare the LIGHTTPDDOCUMENTROOTDIRECTORY variable.
echo -e "\e[94m Getting the path to Lighttpd's document root...\e[97m"
LIGHTTPDDOCUMENTROOTSETTING=`/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf -p | grep server.document-root`
LIGHTTPDDOCUMENTROOTDIRECTORY=`sed 's/.*"\(.*\)"[^"]*$/\1/' <<< $LIGHTTPDDOCUMENTROOTSETTING`
# Set the receivers latitude and longitude.
if [ -z $RECEIVERLATITUDE ] && [ -z $RECEIVERLONGITUDE ]; then
# If dump1090-mutability is not installed ask for the latitude and longitude of this receiver.
RECEIVERLATITUDE=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "Receiver Latitude (OPTIONAL)" --nocancel --inputbox "\nEnter your receiver's latitude.\n(Example: XX.XXXXXXX)\n\nLeave blank and select <Ok> to skip." 12 78 3>&1 1>&2 2>&3)
RECEIVERLONGITUDE_TITLE="Receiver Longitude"
while [[ -z $RECEIVERLONGITUDE ]]; do
RECEIVERLONGITUDE=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --title "$RECEIVERLONGITUDE_TITLE" --nocancel --inputbox "\nEnter your receeiver's longitude.\n(Example: XX.XXXXXXX)" 9 78 3>&1 1>&2 2>&3)
RECEIVERLONGITUDE_TITLE="Receiver Longitude (REQUIRED)"
done
fi
if [ ! -z $RECEIVERLATITUDE ] && [ ! -z $RECEIVERLONGITUDE ]; then
echo -e "\e[94m Setting the receiver's latitude to $RECEIVERLATITUDE...\e[97m"
ChangeConfig "SiteLat" "$RECEIVERLATITUDE" "$LIGHTTPDDOCUMENTROOTDIRECTORY/dump978/config.js"
echo -e "\e[94m Setting the receiver's longitude to $RECEIVERLONGITUDE...\e[97m"
ChangeConfig "SiteLon" "$RECEIVERLONGITUDE" "$LIGHTTPDDOCUMENTROOTDIRECTORY/dump978/config.js"
fi
# Create the dump978 JSON directory in Lighttpd's document root.
echo -e "\e[94m Creating the dump978 JSON data directory within Lighttpd's document root...\e[97m"
sudo mkdir -p $LIGHTTPDDOCUMENTROOTDIRECTORY/dump978/data
echo -e "\e[94m Setting permissions for the dump978 JSON data directory within Lighttpd's document root...\e[97m"

Wyświetl plik

@ -163,7 +163,11 @@ echo -e "\e[95m Creating maintenance for both the mlat-client and netcat feeds.
echo ""
# Ask the user for the user name for this receiver.
RECEIVERNAME=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --backtitle "$BACKTITLETEXT" --title "Receiver Name" --nocancel --inputbox "\nPlease enter a name for this receiver. (NOT REQUIRED)\n\nIf you have more than one receiver, this name should be unique.\nExample: \"username-01\", \"username-02\", etc." 12 78 3>&1 1>&2 2>&3)
RECEIVERNAME_TITLE="Receiver Name"
while [[ -z $RECEIVERNAME ]]; do
RECEIVERNAME=$(whiptail --backtitle "$ADSB_PROJECTTITLE" --backtitle "$BACKTITLETEXT" --title "$RECEIVERNAME_TITLE" --nocancel --inputbox "\nPlease enter a name for this receiver.\n\nIf you have more than one receiver, this name should be unique.\nExample: \"username-01\", \"username-02\", etc." 12 78 3>&1 1>&2 2>&3)
RECEIVERNAME_TITLE="Receiver Name (REQUIRED)"
done
# Get the altitude of the receiver from the Google Maps API using the latitude and longitude assigned dump1090-mutability.
RECEIVERLATITUDE=`GetConfig "LAT" "/etc/default/dump1090-mutability"`

Wyświetl plik

@ -103,7 +103,6 @@ else
echo -e "\e[94m Cloning the piaware_builder git repository locally...\e[97m"
echo ""
git clone https://github.com/flightaware/piaware_builder.git
echo ""
fi
## BUILD AND INSTALL THE PIAWARE PACKAGE

Wyświetl plik

@ -94,8 +94,7 @@ function ChangeConfig {
function GetConfig {
# Use sed to locate the "KEY" then read the "VALUE", the portion after the equals sign, in the specified "FILE".
# This function should work with any configuration file with settings formated as KEY="VALUE".
sudo sed -n '/^$1=\(.*\)$/s//\1/p' $2
echo `sed -n "/^$1=\"\(.*\)\"$/s//\1/p" $2`
echo `sed -n "/^$1 *= *\"\(.*\)\"$/s//\1/p" $2`
}
function CommentConfig {

Wyświetl plik

@ -72,7 +72,7 @@ echo -e "\e[94m Making the maintenance maintenance script executable...\e[97m"
chmod +x $PORTALPYTHONDIRECTORY/maintenance-maint.sh
#Remove old flights-maint.sh start up line from /etc/rc.local.
sed -i '/build\/portal\/logging\/flights-maint.sh/d' /etc/rc.local
sudo sed -i '/build\/portal\/logging\/flights-maint.sh/d' /etc/rc.local
# Add flight logging maintenance script to rc.local.
if ! grep -Fxq "$PORTALPYTHONDIRECTORY/flights-maint.sh &" /etc/rc.local; then
@ -82,7 +82,7 @@ if ! grep -Fxq "$PORTALPYTHONDIRECTORY/flights-maint.sh &" /etc/rc.local; then
fi
# Remove old maintenance-maint.sh start up line from /etc/rc.local.
sed -i '/build\/portal\/logging\/maintenance-maint.sh/d' /etc/rc.local
sudo sed -i '/build\/portal\/logging\/maintenance-maint.sh/d' /etc/rc.local
# Add maintenance maintenance script to rc.local.
if ! grep -Fxq "$PORTALPYTHONDIRECTORY/maintenance-maint.sh &" /etc/rc.local; then

Wyświetl plik

@ -0,0 +1,166 @@
#!/bin/bash
#####################################################################################
# ADS-B RECEIVER #
#####################################################################################
# #
# A set of scripts created to automate the process of installing the software #
# needed to setup a Mode S decoder as well as feeders which are capable of #
# sharing your ADS-B results with many of the most popular ADS-B aggregate sites. #
# #
# Project Hosted On GitHub: https://github.com/jprochazka/adsb-feeder #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# 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. #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
## VARIABLES
BACKUPDATE=$(date +"%Y-%m-%d-%H%M%S")
PROJECTROOTDIRECTORY="$PWD"
BACKUPSDIRECTORY="$PROJECTROOTDIRECTORY/backups"
TEMPORARYDIRECTORY="$PROJECTROOTDIRECTORY/backup_$BACKUPDATE"
RAWDOCUMENTROOT=`/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf -p | grep server.document-root`
LIGHTTPDDOCUMENTROOT=`sed 's/.*"\(.*\)"[^"]*$/\1/' <<< $RAWDOCUMENTROOT`
## BEGIN THE BACKUP PROCESS
clear
echo -e "\n\e[91m ADSB Reciever Project Maintenance"
echo ""
echo -e "\e[92m Backing up portal data..."
echo -e "\e[93m----------------------------------------------------------------------------------------------------\e[97m"
echo ""
echo -e "\e[95m Backing up current portal data...\e[97m"
echo ""
## PREPARE TO BEGIN CREATING BACKUPS
# Get the database type used.
echo -e "\e[94m Declare the database engine being used...\e[97m"
DATABASEENGINE=`grep 'db_driver' $LIGHTTPDDOCUMENTROOT/classes/settings.class.php | tail -n1 | cut -d\' -f2`
echo -e "\e[94m Declare whether or not the advnaced portal features were installed...\e[97m"
# Decide if the advanced portal features were installed or not.
echo -e "\e[94m Declare whether or not the advnaced portal features were installed...\e[97m"
if [ $DATABASEENGINE = "xml" ]; then
ADVANCED=FALSE
else
ADVANCED=TRUE
fi
# Get the path to the SQLite database if SQLite is used for the database.
if [ $DATABASEENGINE = "sqlite" ]; then
DATABASEPATH=`grep 'db_host' $LIGHTTPDDOCUMENTROOT/classes/settings.class.php | tail -n1 | cut -d\' -f2`
fi
# Assign the MySQL login credentials to variables if a MySQL database is being used.
if [ $DATABASEENGINE = "mysql" ]; then
MYSQLDATABASE=`grep 'db_database' $LIGHTTPDDOCUMENTROOT/classes/settings.class.php | tail -n1 | cut -d\' -f2`
MYSQLUSERNAME=`grep 'db_username' $LIGHTTPDDOCUMENTROOT/classes/settings.class.php | tail -n1 | cut -d\' -f2`
MYSQLPASSWORD=`grep 'db_password' $LIGHTTPDDOCUMENTROOT/classes/settings.class.php | tail -n1 | cut -d\' -f2`
fi
# Check that the backup directory exists.
echo -e "\e[94m Checking that the directory $BACKUPSDIRECTORY exists...\e[97m"
if [ ! -d "$BACKUPSDIRECTORY" ]; then
# Create the backups directory.
echo -e "\e[94m Creating the directory $BACKUPSDIRECTORY...\e[97m"
mkdir -p $BACKUPSDIRECTORY
fi
# Check that the temporary directory exists.
echo -e "\e[94m Checking that the directory $TEMPORARYDIRECTORY exists...\e[97m"
if [ ! -d "$TEMPORARYDIRECTORY" ]; then
# Create the tmp directory.
echo -e "\e[94m Creating the directory $TEMPORARYDIRECTORY...\e[97m"
mkdir -p $TEMPORARYDIRECTORY
fi
## BACKUP THE FILES COMMON TO ALL PORTAL INSTALLATION SCENARIOS
# Copy the collectd round robin database files to the temporary directory.
echo -e "\e[94m Checking that the directory $TEMPORARYDIRECTORY/var/lib/collectd/rrd/ exists...\e[97m"
if [ ! -d "$TEMPORARYDIRECTORY/var/lib/collectd/rrd/" ]; then
mkdir -p $TEMPORARYDIRECTORY/var/lib/collectd/rrd/
fi
echo -e "\e[94m Backing up the directory /var/lib/collectd/rrd/...\e[97m"
sudo cp -R /var/lib/collectd/rrd/ $TEMPORARYDIRECTORY/var/lib/collectd/rrd/
## BACKUP PORTAL USING LITE FEATURES AND XML FILES
if [ ADVANCED = "FALSE" ]; then
# Copy the portal XML data files to the temporary directory.
echo -e "\e[94m Checking that the directory $TEMPORARYDIRECTORY/var/www/html/data/ exists...\e[97m"
if [ ! -d "$TEMPORARYDIRECTORY/var/www/html/data/" ]; then
mkdir -p $TEMPORARYDIRECTORY/var/www/html/data/
fi
echo -e "\e[94m Backing up all XML data files to $TEMPORARYDIRECTORY/var/www/html/data/...\e[97m"
sudo cp -R /var/www/html/data/*.xml $TEMPORARYDIRECTORY/var/www/html/data/
else
## BACKUP PORTAL USING ADVANCED FEATURES AND A SQLITE DATABASE
if [ $DATABASEENGINE = "sqlite" ]; then
# Copy the portal SQLite database file to the temporary directory.
echo -e "\e[94m Backing up the SQLite database file to $TEMPORARYDIRECTORY/var/www/html/data/portal.sqlite...\e[97m"
sudo cp -R $DATABASEPATH $TEMPORARYDIRECTORY/var/www/html/data/portal.sqlite
fi
## BACKUP PORTAL USING ADVANCED FEATURES AND A MYSQL DATABASE
if [ $DATABASEENGINE = "mysql" ]; then
# Dump the current MySQL database to a .sql text file.
echo -e "\e[94m Dumping the MySQL database $MYSQLDATABASE to the file $TEMPORARYDIRECTORY/$MYSQLDATABASE.sql...\e[97m"
mysqldump -u$MYSQLUSERNAME -p$MYSQLPASSWORD $MYSQLDATABASE > $TEMPORARYDIRECTORY/$MYSQLDATABASE.sql
fi
fi
## COMPRESS AND DATE THE BACKUP ARCHIVE
# Create the backup archive.
echo -e "\e[94m Compressing the backed up files...\e[97m"
echo ""
tar -zcvf $BACKUPSDIRECTORY/adsb-receiver_data_$BACKUPDATE.tar.gz $TEMPORARYDIRECTORY
echo ""
# Remove the temporary directory.
echo -e "\e[94m Removing the temporary backup directory...\e[97m"
sudo rm -rf $TEMPORARYDIRECTORY
## BACKUP PROCESS COMPLETE
echo -e "\e[32m"
echo -e " BACKUP PROCESS COMPLETE\e[93m"
echo ""
echo -e " An archive containing the data just backed up can be found at:"
echo -e " $TEMPORARYDIRECTORY/adsb-receiver_data_$BACKUPDATE.tar.gz\e[97m"
echo ""
echo -e "\e[93m----------------------------------------------------------------------------------------------------"
echo -e "\e[92m Finished backing up portal data.\e[39m"
echo ""
read -p "Press enter to exit..." CONTINUE
exit 0

Wyświetl plik

@ -37,11 +37,12 @@
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li id="logout-link"><a href="/admin">Settings</a></li>
<li id="logout-link"><a href="/admin/blog">Blog</a></li>
<li id="logout-link"><a href="/admin/account.php">Account</a></li>
<li id="settings-link"><a href="/admin">Settings</a></li>
<li id="blog-link"><a href="/admin/blog">Blog</a></li>
<li id="links-link"><a href="/admin/links">Links</a></li>
<li id="account-link"><a href="/admin/account.php">Account</a></li>
<li id="logout-link"><a href="/admin/logout.php">Logout</a></li>
<li id="logout-link"><a href="/" target="_blank">Portal Home</a></li>
<li id="portal-link"><a href="/" target="_blank">Portal Home</a></li>
</ul>
</div>
</div>

Wyświetl plik

@ -93,7 +93,7 @@
$sql = "INSERT INTO ".$settings::db_prefix."notifications (flight, lastMessageCount) VALUES (:flight, :lastMessageCount)";
$sth = $dbh->prepare($sql);
$sth->bindParam(':flight', $flight, PDO::PARAM_STR, 10);
$sth->bindParam(':lastMessageCount', 0, PDO::PARAM_INT);
$sth->bindParam(':lastMessageCount', $a = 0, PDO::PARAM_INT);
$sth->execute();
$sth = NULL;
$dbh = NULL;
@ -239,6 +239,7 @@
$enableWebNotifications = $common->getSetting("enableWebNotifications");
$enableEmailNotifications = $common->getSetting("enableEmailNotifications");
$enableTwitterNotifications = $common->getSetting("enableTwitterNotifications");
$emailNotificationAddresses = $common->getSetting("emailNotificationAddresses");
$twitterUserName = $common->getSetting("twitterUserName");
$twitterConsumerKey = $common->getSetting("twitterConsumerKey");
$twitterConsumerSecret = $common->getSetting("twitterConsumerSecret ");
@ -358,21 +359,14 @@
</select>
</div>
<div class="form-group">
<label for="defaultPage">Date Format</label>
<div class="radio">
<label><input type="radio" name="dateFormatSlelection" value="F jS, Y g:i A"<?php ($dateFormat == "F jS, Y g:i A" ? print ' checked' : ''); ?>>October 16, 2015 12:00 PM</label>
</div>
<div class="radio">
<label><input type="radio" name="dateFormatSlelection" value="Y-m-d g:i A"<?php ($dateFormat == "Y-m-d g:i A" ? print ' checked' : ''); ?>>2015-10-16 12:00 PM</label>
</div>
<div class="radio">
<label><input type="radio" name="dateFormatSlelection" value="m/d/Y g:i A"<?php ($dateFormat == "m/d/Y g:i A" ? print ' checked' : ''); ?>>16/10/2015 12:00 PM</label>
</div>
<div class="radio">
<label><input type="radio" name="dateFormatSlelection" value="d/m/Y g:i A"<?php ($dateFormat == "d/m/Y g:i A" ? print ' checked' : ''); ?>>10/16/2015 12:00 PM</label>
</div>
<input type="text" class="form-control" id="dateFormat" name="dateFormat" value="<?php echo $dateFormat; ?>">
<label for="googleMapsApiKey">Google Maps API Key</label>
<input type="text" class="form-control" id="googleMapsApiKey" name="googleMapsApiKey" value="<?php echo $googleMapsApiKey; ?>">
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">Time Format</div>
<div class="panel-body">
<div class="form-group">
<label for="timeZone">Time Zone</label>
<select class="form-control" id="timeZone" name="timeZone">
@ -390,8 +384,35 @@
</select>
</div>
<div class="form-group">
<label for="googleMapsApiKey">Google Maps API Key</label>
<input type="text" class="form-control" id="googleMapsApiKey" name="googleMapsApiKey" value="<?php echo $googleMapsApiKey; ?>">
<label for="defaultPage">Date Format - 12 Hour Format</label>
<div class="radio">
<label><input type="radio" name="dateFormatSlelection" value="F jS, Y g:i A"<?php ($dateFormat == "F jS, Y g:i A" ? print ' checked' : ''); ?>>October 16, 2015 5:00 PM</label>
</div>
<div class="radio">
<label><input type="radio" name="dateFormatSlelection" value="Y-m-d g:i A"<?php ($dateFormat == "Y-m-d g:i A" ? print ' checked' : ''); ?>>2015-10-16 5:00 PM</label>
</div>
<div class="radio">
<label><input type="radio" name="dateFormatSlelection" value="m/d/Y g:i A"<?php ($dateFormat == "m/d/Y g:i A" ? print ' checked' : ''); ?>>16/10/2015 5:00 PM</label>
</div>
<div class="radio">
<label><input type="radio" name="dateFormatSlelection" value="d/m/Y g:i A"<?php ($dateFormat == "d/m/Y g:i A" ? print ' checked' : ''); ?>>10/16/2015 5:00 PM</label>
</div>
<label for="defaultPage">Date Format - 24 Hour Format</label>
<div class="radio">
<label><input type="radio" name="dateFormatSlelection" value="F jS, Y G:i"<?php ($dateFormat == "F jS, Y G:i" ? print ' checked' : ''); ?>>October 16, 2015 17:00</label>
</div>
<div class="radio">
<label><input type="radio" name="dateFormatSlelection" value="Y-m-d G:i"<?php ($dateFormat == "Y-m-d G:i" ? print ' checked' : ''); ?>>2015-10-16 17:00</label>
</div>
<div class="radio">
<label><input type="radio" name="dateFormatSlelection" value="m/d/Y G:i"<?php ($dateFormat == "m/d/Y G:i" ? print ' checked' : ''); ?>>16/10/2015 17:00</label>
</div>
<div class="radio">
<label><input type="radio" name="dateFormatSlelection" value="d/m/Y G:i"<?php ($dateFormat == "d/m/Y G:i" ? print ' checked' : ''); ?>>10/16/2015 17:00</label>
</div>
<label for="dateFormat">Date Format</label>
<input type="text" class="form-control" id="dateFormat" name="dateFormat" value="<?php echo $dateFormat; ?>">
<p><i>Select one of the formats above or create your own. <a href="http://php.net/manual/en/function.date.php" target="_blank">PHP date function documentation.</a></i></p>
</div>
</div>
</div>
@ -415,8 +436,8 @@
</label>
</div>
<div class="form-group">
<label for="notificationEmailAddresses"">Email addresses to be notified. (coma delimited)</label>
<input type="text" class="form-control" id="notificationEmailAddresses" name="notificationEmailAddresses" value="<?php echo $notificationEmailAddresses; ?>">
<label for="emailNotificationAddresses"">Email addresses to be notified. (coma delimited)</label>
<input type="text" class="form-control" id="emailNotificationAddresses" name="emailNotificationAddresses" value="<?php echo $emailNotificationAddresses; ?>">
</div>
<div class="checkbox">
<label>
@ -447,6 +468,41 @@
</div>
</div>
<div role="tabpanel" class="tab-pane fade" id="navigation">
<div class="panel panel-default">
<div class="panel-heading">API Key</div>
<div class="panel-body">
<div class="form-group">
<label for="BingMapsAPI">Bing Maps API Key</label>
<input type="text" class="form-control" id="bingMapAPIKey" name="bingMapAPIKey"
value="<?php if(!empty($_POST['bingMapAPIKey'])){
$apikey = $_POST['bingMapAPIKey'];
$path_to_file = '/usr/share/dump1090-mutability/html/config.js';
$file_contents = file_get_contents($path_to_file);
$file_contents = preg_replace('/BingMapsAPIKey = ([a-zA-Z0-9"]+)/', "BingMapsAPIKey = '" . $_POST['bingMapAPIKey'] . "'" , $file_contents);
file_put_contents($path_to_file,$file_contents);
}
else {
echo file_get_contents('/usr/share/dump1090-mutability/html/config.js');
}
?>">
</div>
<div class="form-group">
<label for="mapzenAPIKey">Mapzen Maps API Key</label>
<input type="text" class="form-control" id="mapzenAPIKey" name="mapzenAPIKey"
value="<?php if(!empty($_POST['mapzenAPIKey'])){
$apikey = $_POST['mapzenAPIKey'];
$path_to_file = '/usr/share/dump1090-mutability/html/config.js';
$file_contents = file_get_contents($path_to_file);
$file_contents = preg_replace('/MapzenAPIKey = ([a-zA-Z0-9"]+)/', "MapzenAPIKey = '" . $_POST['mapzenAPIKey'] . "'" , $file_contents);
file_put_contents($path_to_file,$file_contents);
}
else {
echo file_get_contents('/usr/share/dump1090-mutability/html/config.js');
}
?>">
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">Enable/Disable Navigation Links</div>
<div class="panel-body">

Wyświetl plik

@ -52,7 +52,7 @@
if (!$nameExists) {
// Add this link..
$links->addLink($_SESSION['name'], $_POST['address']);
$links->addLink($_POST['name'], $_POST['address']);
// Forward the user to the link management index page.
header ("Location: /admin/links/");
@ -88,6 +88,8 @@
<label for="address">Address</label>
<input type="text" id="address" name="address" class="form-control"<?php echo (isset($_POST['address']) ? ' value="'.$_POST['address'].'"' : '')?> required>
</div>
<input type="submit" class="btn btn-default" value="Add">
</form>
<?php
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."admin".DIRECTORY_SEPARATOR."includes".DIRECTORY_SEPARATOR."footer.inc.php");
?>

Wyświetl plik

@ -65,7 +65,7 @@
<hr />
<h2>Delete Link</h2>
<h3><?php echo $link['name']; ?></h3>
<p>With the address of <strong><?php echo $link['address']); ?></strong>.</p>
<p>With the address of <strong><?php echo $link['address']; ?></strong>.</p>
<div class="alert alert-danger" role="alert">
<p>
<strong>Confirm Delete</strong><br />

Wyświetl plik

@ -60,18 +60,6 @@
// 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) {
?>
<div id="contents-saved" class="alert alert-success fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
Link has been updated.
</div>
<?php
}
?>
<h1>Links Management</h1>
<hr />
@ -80,11 +68,11 @@
<form id="edit-link" method="post" action="edit.php">
<div class="form-group">
<label for="name">Name</label>
<input type="text" id="name" name="name" class="form-control"<?php echo $link['name']; ?> required>
<input type="text" id="name" name="name" class="form-control" value="<?php echo $link['name']; ?>" required>
</div>
<div class="form-group">
<label for="address">Address</label>
<input type="text" id="address" name="address" class="form-control"<?php echo $link['address']; ?> required>
<input type="text" id="address" name="address" class="form-control" value="<?php echo $link['address']; ?>" required>
</div>
<input type="hidden" name="originalName" value="<?php echo $link['name']; ?>">
<input type="submit" class="btn btn-default" value="Commit Changes">
@ -92,3 +80,4 @@
<?php
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."admin".DIRECTORY_SEPARATOR."includes".DIRECTORY_SEPARATOR."footer.inc.php");
?>

Wyświetl plik

@ -46,7 +46,7 @@
}
// Get all links.
$allLinks = $links->getAllLinks();
$links = $links->getAllLinks();
////////////////
// BEGIN HTML
@ -69,7 +69,7 @@
foreach ($links as $link) {
?>
<tr>
<td><a href="edit.php?name=<?php echo urlencode($link['name']); ?>">edit</a> <a href="delete.php?title=<?php echo urlencode($link['name']); ?>">delete</a></td>
<td><a href="edit.php?name=<?php echo urlencode($link['name']); ?>">edit</a> <a href="delete.php?name=<?php echo urlencode($link['name']); ?>">delete</a></td>
<td><?php echo $link['name']; ?></td>
<td><a href="<?php echo $link['address']; ?>" target="_blank"><?php echo $link['address']; ?></a></td>
</tr>

Wyświetl plik

@ -67,7 +67,7 @@
$pageData['blogPosts'] = $common->paginateArray($allPosts, $page, $itemsPerPage - 1);
// Calculate the number of pagination links to show.
$pageData['pageLinks'] = count($allPosts) / $itemsPerPage;
$pageData['pageLinks'] = ceil(count($allPosts) / $itemsPerPage);
$template->display($pageData);
?>

Wyświetl plik

@ -60,7 +60,7 @@
$sql = "SELECT * FROM ".$settings::db_prefix."blogPosts ORDER BY date ".$orderBy;
$sth = $dbh->prepare($sql);
$sth->execute();
$posts = $sth->fetchAll();
$posts = $sth->fetchAll(PDO::FETCH_ASSOC);
$sth = NULL;
$dbh = NULL;
return $posts;
@ -90,7 +90,7 @@
$sth = $dbh->prepare($sql);
$sth->bindParam(':title', $title, PDO::PARAM_STR, 100);
$sth->execute();
$blogPost = $sth->fetch();
$blogPost = $sth->fetch(PDO::FETCH_ASSOC);
$sth = NULL;
$dbh = NULL;
return $blogPost;

Wyświetl plik

@ -50,7 +50,7 @@
$sql = "SELECT name, address FROM ".$settings::db_prefix."links ORDER BY name";
$sth = $dbh->prepare($sql);
$sth->execute();
$links = $sth->fetchAll();
$links = $sth->fetchAll(PDO::FETCH_ASSOC);
$sth = NULL;
$dbh = NULL;
}
@ -79,7 +79,7 @@
$sth = $dbh->prepare($sql);
$sth->bindParam(':name', $name, PDO::PARAM_STR, 100);
$sth->execute();
$link = $sth->fetch();
$link = $sth->fetch(PDO::FETCH_ASSOC);
$sth = NULL;
$dbh = NULL;
return $link;
@ -92,7 +92,7 @@
if ($settings::db_driver == "xml") {
// XML
$links = simplexml_load_file($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."links.xml")
$links = simplexml_load_file($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."links.xml");
foreach ($links as $link) {
if ($link->name == $name) {
return TRUE;
@ -140,8 +140,8 @@
$dbh = $common->pdoOpen();
$sql = "INSERT INTO ".$settings::db_prefix."links (name, address) VALUES (:name, :address)";
$sth = $dbh->prepare($sql);
$sth->bindParam(':name', $title, PDO::PARAM_STR, 100);
$sth->bindParam(':address', $author, PDO::PARAM_STR, 250);
$sth->bindParam(':name', $name, PDO::PARAM_STR, 100);
$sth->bindParam(':address', $address, PDO::PARAM_STR, 250);
$sth->execute();
$sth = NULL;
$dbh = NULL;

Wyświetl plik

@ -53,7 +53,7 @@
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."links.class.php");
$links = new links();
$pageData['links'] = $links->getAllLinks();
$pageData['customLinks'] = $links->getAllLinks();
// Load the template for the requested page.
$page = $this->readTemplate($common->removeExtension($_SERVER["SCRIPT_NAME"]).'.tpl');
@ -218,7 +218,6 @@
$pattern = '/\{foreach(.*?)\{\/foreach\}/s';
preg_match_all($pattern, $output, $foreach, PREG_PATTERN_ORDER);
foreach ($foreach[0] as $element) {
// Loop through $pageData.
if (strpos($element, 'page:') !== false) {
$variable = $common->extractString($element, "{foreach page:", " ");
@ -226,12 +225,9 @@
$contents = $common->extractString($element, "{foreach page:".$variable." as ".$itemName."}", "{/foreach}");
$thisIteration = $contents;
foreach ($pageData as $keys => $values) {
if ($keys == $variable) {
foreach ($values as $item) {
foreach ($item as $key => $value) {
$pattern = '/\{'.$itemName.'->(.*?)\}/';
preg_match_all($pattern, $thisIteration, $placeholders, PREG_PATTERN_ORDER);
foreach ($placeholders as $placeholder) {
@ -246,8 +242,8 @@
}
}
$output = str_replace($element, $html, $output);
$html = NULL;
}
}
return $output;
}

Wyświetl plik

@ -42,6 +42,9 @@
$pageData = array();
// Items per page.
$itemsPerPage = 25;
// The title of this page.
$pageData['title'] = "Flights Seen";
@ -51,12 +54,30 @@
} else {
$searchString = "";
}
// Set the start stop positions to be used in the query.
$start = 1;
if (isset($_GET['page'])) {
$start = $_GET['page'] * $itemsPerPage;
}
$dbh = $common->pdoOpen();
$sql = "SELECT * FROM ".$settings::db_prefix."flights WHERE flight LIKE ? ORDER BY lastSeen DESC, flight";
$sql = "SELECT COUNT(*) FROM ".$settings::db_prefix."flights WHERE flight LIKE :like ORDER BY lastSeen DESC, flight";
$sth = $dbh->prepare($sql);
$sth->bindValue(1, "%".$searchString."%", PDO::PARAM_STR);
$sth->bindValue(':like', "%".$searchString."%", PDO::PARAM_STR);
$sth->execute();
$flights = $sth->fetchAll();
$totalFlights = $sth->fetchColumn();
$sth = NULL;
$dbh = NULL;
$dbh = $common->pdoOpen();
$sql = "SELECT * FROM ".$settings::db_prefix."flights WHERE flight LIKE :like ORDER BY lastSeen DESC, flight LIMIT :start, :items";
$sth = $dbh->prepare($sql);
$sth->bindValue(':like', "%".$searchString."%", PDO::PARAM_STR);
$sth->bindValue(':start', $start, PDO::PARAM_INT);
$sth->bindValue(':items', $itemsPerPage, PDO::PARAM_INT);
$sth->execute();
$flights = $sth->fetchAll(PDO::FETCH_ASSOC);
$sth = NULL;
$dbh = NULL;
@ -71,13 +92,10 @@
$flight['lastSeen'] = $date->format($common->getSetting('dateFormat'));
}
// Pagination.
$itemsPerPage = 25;
$page = (isset($_GET['page']) ? $_GET['page'] : 1);
$pageData['flights'] = $common->paginateArray($flights, $page, $itemsPerPage - 1);
$pageData['flights'] = $flights;
// Calculate the number of pagination links to show.
$pageData['pageLinks'] = count($flights) / $itemsPerPage;
$pageData['pageLinks'] = ceil($totalFlights / $itemsPerPage);
$template->display($pageData);
?>

Wyświetl plik

@ -39,12 +39,8 @@
// Removes and current patch version from the patch setting.
// ------------------------------------------------------------
if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
$results = upgrade();
exit(json_encode($results));
} else {
http_response_code(404);
}
$results = upgrade();
exit(json_encode($results));
function upgrade() {
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."common.class.php");
@ -100,7 +96,7 @@
// The upgrade process completed successfully.
$results['success'] = TRUE;
$results['message'] = "Upgrade to v2.0.1 successful."
$results['message'] = "Upgrade to v2.0.1 successful.";
return $results;
} catch(Exception $e) {

Wyświetl plik

@ -38,12 +38,8 @@
// Removes and current patch version from the patch setting.
// ---------------------------------------------------------
if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
$results = upgrade();
exit(json_encode($results));
} else {
http_response_code(404);
}
$results = upgrade();
exit(json_encode($results));
function upgrade() {
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."common.class.php");
@ -64,7 +60,7 @@
// The upgrade process completed successfully.
$results['success'] = TRUE;
$results['message'] = "Upgrade to v2.0.2 successful."
$results['message'] = "Upgrade to v2.0.2 successful.";
return $results;
} catch(Exception $e) {

Wyświetl plik

@ -37,12 +37,8 @@
// Removes and current patch version from the patch setting.
// ---------------------------------------------------------
if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
$results = upgrade();
exit(json_encode($results));
} else {
http_response_code(404);
}
$results = upgrade();
exit(json_encode($results));
function upgrade() {
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."common.class.php");
@ -56,7 +52,7 @@
// The upgrade process completed successfully.
$results['success'] = TRUE;
$results['message'] = "Upgrade to v2.0.3 successful."
$results['message'] = "Upgrade to v2.0.3 successful.";
return $results;
} catch(Exception $e) {

Wyświetl plik

@ -38,12 +38,8 @@
// Removes and current patch version from the patch setting.
// ---------------------------------------------------------
if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
$results = upgrade();
exit(json_encode($results));
} else {
http_response_code(404);
}
$results = upgrade();
exit(json_encode($results));
function upgrade() {
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."common.class.php");
@ -93,7 +89,7 @@
// The upgrade process completed successfully.
$results['success'] = TRUE;
$results['message'] = "Upgrade to v2.1.0 successful."
$results['message'] = "Upgrade to v2.1.0 successful.";
return $results;
} catch(Exception $e) {

Wyświetl plik

@ -38,12 +38,8 @@
// Removes and current patch version from the patch setting.
// ---------------------------------------------------------
if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
$results = upgrade();
exit(json_encode($results));
} else {
http_response_code(404);
}
$results = upgrade();
exit(json_encode($results));
function upgrade() {
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."common.class.php");
@ -60,7 +56,7 @@
// The upgrade process completed successfully.
$results['success'] = TRUE;
$results['message'] = "Upgrade to v2.2.0 successful."
$results['message'] = "Upgrade to v2.2.0 successful.";
return $results;
} catch(Exception $e) {

Wyświetl plik

@ -37,12 +37,8 @@
// Removes and current patch version from the patch setting.
// ---------------------------------------------------------
if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
$results = upgrade();
exit(json_encode($results));
} else {
http_response_code(404);
}
$results = upgrade();
exit(json_encode($results));
function upgrade() {
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."common.class.php");
@ -56,7 +52,7 @@
// The upgrade process completed successfully.
$results['success'] = TRUE;
$results['message'] = "Upgrade to v2.3.0 successful."
$results['message'] = "Upgrade to v2.3.0 successful.";
return $results;
} catch(Exception $e) {

Wyświetl plik

@ -38,12 +38,8 @@
// Removes and current patch version from the patch setting.
// ---------------------------------------------------------------
if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
$results = upgrade();
exit(json_encode($results));
} else {
http_response_code(404);
}
$results = upgrade();
exit(json_encode($results));
function upgrade() {
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."common.class.php");
@ -60,7 +56,7 @@
// The upgrade process completed successfully.
$results['success'] = TRUE;
$results['message'] = "Upgrade to v2.4.0 successful."
$results['message'] = "Upgrade to v2.4.0 successful.";
return $results;
} catch(Exception $e) {
@ -70,4 +66,4 @@
return $results;
}
}
?>
?>

Wyświetl plik

@ -29,7 +29,7 @@
/////////////////////////////////////////////////////////////////////////////////////
///////////////////////
// UPGRADE TO V2.4.0
// UPGRADE TO V2.5.0
///////////////////////
// ------------------------------------------------------------------------------------------
@ -43,12 +43,8 @@
// Removes and current patch version from the patch setting.
// ------------------------------------------------------------------------------------------
if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
$results = upgrade();
exit(json_encode($results));
} else {
http_response_code(404);
}
$results = upgrade();
exit(json_encode($results));
function upgrade() {
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."common.class.php");
@ -58,9 +54,47 @@
$settings = new settings();
try {
if ($settings::db_driver == "xml") {
// Rename the file flightNotifications.xml to notifications.xml
rename($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."flightNotifications.xml", $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."notifications.xml");
// Create XML files used to store links data.
$xml = new XMLWriter();
$xml->openMemory();
$xml->setIndent(true);
$xml->startDocument('1.0','UTF-8');
$xml->startElement("links");
$xml->endElement();
file_put_contents($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."links.xml", $xml->flush(true));
}
if ($settings::db_driver == "mysql") {
$dbh = $common->pdoOpen();
// Rename the flightNotifications table to notifications.
$sql = "RENAME TABLE ".$settings::db_prefix."flightNotifications TO ".$settings::db_prefix."notifications";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
// Add the lastMessageCount column to the flightNotifications table.
$sql = "ALTER TABLE ".$settings::db_prefix."notifications ADD COLUMN lastMessageCount INT";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
// Add the links table.
$sql = "CREATE TABLE ".$settings::db_prefix."links(id INT(11) AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100) NOT NULL, address VARCHAR(250) NOT NULL);";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
$dbh = NULL;
}
if ($settings::db_driver == "sqlite") {
// Create a new settings.class.php file adding the path to the SQLite database as the value for the db_host constant.
$content = <<<EOF
$content = <<<EOF
<?php
/////////////////////////////////////////////////////////////////////////////////////
@ -97,7 +131,7 @@
const db_database = '';
const db_username = '';
const db_password = '';
const db_host = '$_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."portal.sqlite"';
const db_host = '/var/www/html/portal.sqlite';
const db_prefix = 'adsb_';
// Security Settings
@ -110,52 +144,25 @@
?>
EOF;
file_put_contents($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."settings.class.php", $content);
}
// Rename the file flightNotifications.xml to notifications.xml
rename($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."flightNotifications.xml", $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."notifications.xml");
if ($settings::db_driver == "mysql") {
// Open a connection to the database.
$dbh = $common->pdoOpen();
// Rename the flightNotifications table to notifications.
$sql = "RENAME TABLE ".$settings::db_prefix."flightNotifications TO ".$settings::db_prefix."notifications";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
// Add the lastMessageCount column to the notifications table.
$sql = "ALTER TABLE ".$settings::db_prefix."flightNotifications ADD COLUMN lastMessageCount DATETIME";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
// Add the links table.
$linksSql = 'CREATE TABLE '.$dbPrefix.'links(id INT(11) AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100) NOT NULL, address VARCHAR(250) NOT NULL);';
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
$dbh = NULL;
}
if ($settings::db_driver == "sqlite") {
$dbh = $common->pdoOpen();
// Rename the flightNotifications table to notifications.
$sql = "ALTER TABLE ".$settings::db_prefix."flightNotifications RENAME TO ".$settings::db_prefix."notifications";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
// Add the lastMessageCount column to the notifications table.
$sql = "ALTER TABLE ".$settings::db_prefix."flightNotifications ADD COLUMN lastMessageCount DATETIME";
$sql = "ALTER TABLE ".$settings::db_prefix."notifications ADD COLUMN lastMessageCount DATETIME";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
// Add the links table.
$linksSql = 'CREATE TABLE '.$dbPrefix.'links(id INT(11) AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100) NOT NULL, address VARCHAR(250) NOT NULL);';
$sql = "CREATE TABLE ".$dbPrefix."links(id INT(11) AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100) NOT NULL, address VARCHAR(250) NOT NULL);";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
@ -163,20 +170,8 @@ EOF;
$dbh = NULL;
}
if ($settings::db_driver == "xml") {
// Create XML files used to store links data.
$xml = new XMLWriter();
$xml->openMemory();
$xml->setIndent(true);
$xml->startDocument('1.0','UTF-8');
$xml->startElement("links");
$xml->endElement();
file_put_contents($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."links.xml", $xml->flush(true));
}
// Rename the enableFlightNotifications to enableWebNotifications.
$enableWebNotifications = $common->getSetting('enableFlightNotifications')
$enableWebNotifications = $common->getSetting('enableFlightNotifications');
$common->addSetting('enableWebNotifications', $enableWebNotifications);
$common->deleteSetting('enableFlightNotifications');
@ -190,13 +185,13 @@ EOF;
$common->addSetting('twitterConsumerKey', '');
$common->addSetting('twitterConsumerSecret', '');
$common->addSetting('twitterAccessToken', '');
$common->addSetting('twitterAccessTokenSecret', '')
$common->addSetting('twitterAccessTokenSecret', '');
// Add Google Maps API Key setting.
$common->addSetting('googleMapsApiKey', '');
// Add enable custom links setting.
$common->addSetting('eableLinks', FALSE);
$common->addSetting('enableLinks', FALSE);
// Update the version and patch settings..
$common->updateSetting("version", "2.5.0");
@ -204,7 +199,7 @@ EOF;
// The upgrade process completed successfully.
$results['success'] = TRUE;
$results['message'] = "Upgrade to v2.5.0 successful."
$results['message'] = "Upgrade to v2.5.0 successful.";
return $results;
} catch(Exception $e) {

Wyświetl plik

@ -44,66 +44,76 @@
// UPGRADE TO V2.0.1
if ($common->getSetting("version") == "2.0.0" && $success) {
$json = file_get_contents("http://localhost/install/upgrade-2.0.1.php");
$json = file_get_contents("http://localhost/install/upgrade-v2.0.1.php");
$results = json_decode($json, TRUE);
$success = $results['success'];
$message = $results['message'];
$version = "2.0.1"
$version = "2.0.1";
}
// UPGRADE TO V2.0.2
if ($common->getSetting("version") == "2.0.1" && $success) {
$json = file_get_contents("http://localhost/install/upgrade-2.0.2.php");
$json = file_get_contents("http://localhost/install/upgrade-v2.0.2.php");
$results = json_decode($json, TRUE);
$success = $results['success'];
$message = $results['message'];
$version = "2.0.2"
$version = "2.0.2";
}
// UPGRADE RO V2.0.3
if ($common->getSetting("version") == "2.0.2" && $success) {
$json = file_get_contents("http://localhost/install/upgrade-2.0.3.php");
$json = file_get_contents("http://localhost/install/upgrade-v2.0.3.php");
$results = json_decode($json, TRUE);
$success = $results['success'];
$message = $results['message'];
$version = "2.0.3"
$version = "2.0.3";
}
// UPGRADE TO V2.1.0
if ($common->getSetting("version") == "2.0.3" && $success) {
$json = file_get_contents("http://localhost/install/upgrade-2.1.0.php");
$json = file_get_contents("http://localhost/install/upgrade-v2.1.0.php");
$results = json_decode($json, TRUE);
$success = $results['success'];
$message = $results['message'];
$version = "2.1.0"
$version = "2.1.0";
}
// UPGRADE TO V2.2.0
if ($common->getSetting("version") == "2.1.0" && $success) {
$json = file_get_contents("http://localhost/install/upgrade-2.2.0.php");
$json = file_get_contents("http://localhost/install/upgrade-v2.2.0.php");
$results = json_decode($json, TRUE);
$success = $results['success'];
$message = $results['message'];
$version = "2.2.0"
$version = "2.2.0";
}
// UPGRADE TO V2.3.0
if ($common->getSetting("version") == "2.2.0" && $success) {
$json = file_get_contents("http://localhost/install/upgrade-2.3.0.php");
$json = file_get_contents("http://localhost/install/upgrade-v2.3.0.php");
$results = json_decode($json, TRUE);
$success = $results['success'];
$message = $results['message'];
$version = "2.3.0"
$version = "2.3.0";
}
// UPGRADE TO V2.4.0
if ($common->getSetting("version") == "2.3.0" && $success) {
$json = file_get_contents("http://localhost/install/upgrade-2.4.0.php");
$json = file_get_contents("http://localhost/install/upgrade-v2.4.0.php");
$results = json_decode($json, TRUE);
$success = $results['success'];
$message = $results['message'];
$version = "2.4.0"
$version = "2.4.0";
}
// UPGRADE TO V2.5.0
if ($common->getSetting("version") == "2.4.0" && $success) {
$json = file_get_contents("http://localhost/install/upgrade-v2.5.0.php");
$results = json_decode($json, TRUE);
$success = $results['success'];
$message = $results['message'];
$version = "2.5.0";
}
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."admin".DIRECTORY_SEPARATOR."includes".DIRECTORY_SEPARATOR."header.inc.php");
// Display the instalation wizard.

Wyświetl plik

@ -51,7 +51,10 @@
// Get software information.
$pageData['portalVersion'] = $common->getSetting('version');
$pageData['portalPatch'] = $common->getSetting('patch');
$pageData['portalPatch'] = "N/A";
if ($common->getSetting('patch') != '') {
$pageData['portalPatch'] = $common->getSetting('patch');
}
// Get the current system uptime.
$json = file_get_contents("http://localhost/api/system.php?action=getUptimeInformation");

Wyświetl plik

@ -36,4 +36,4 @@
</ul>
</div>
{/area}
{area:scripts/}
{area:scripts/}

Wyświetl plik

@ -52,29 +52,27 @@
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">System <span class="caret"></span></a>
<ul class="dropdown-menu">
{if setting:enableDump1090 eq TRUE}<li id="dump1090-link"><a href="/dump1090.php">Live Dump1090 Map</a></li>{/if}
{if setting:enableDump978 eq TRUE}<li id="dump978-link"><a href="/dump978.php">Live Dump978 Map</a></li>{/if}
{if setting:enablePfclient eq TRUE}<li id="planefinder-link"><a href="{page:baseurl}:30053" target="_blank">Plane Finder Client</a></li>{/if}
{if setting:enableGraphs eq TRUE}<li id="graphs-link"><a href="/graphs.php">Performance Graphs</a></li>{/if}
{if setting:enableInfo eq TRUE}<li id="system-link"><a href="/system.php">System Information</a></li>{/if}
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Maps <span class="caret"></span></a>
<ul class="dropdown-menu">
{if setting:enableGraphs eq TRUE}<li id="graphs-link"><a href="/graphs.php">Performance Graphs</a></li>{/if}
{if setting:enableInfo eq TRUE}<li id="system-link"><a href="/system.php">System Information</a></li>{/if}
{if setting:enableDump1090 eq TRUE}<li id="dump1090-link"><a href="/dump1090.php">Live Dump1090 Map</a></li>{/if}
{if setting:enableDump978 eq TRUE}<li id="dump978-link"><a href="/dump978.php">Live Dump978 Map</a></li>{/if}
{if setting:enablePfclient eq TRUE}<li id="planefinder-link"><a href="{page:baseurl}:30053" target="_blank">Plane Finder Client</a></li>{/if}
</ul>
</li>
{if setting:enableLinks eq TRUE}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Links <span class="caret"></span></a>
<ul class="dropdown-menu">
{foreach page:links as link}
<li><a href="{link->address}">{link->name}</a></li>
{/foreach}
{foreach page:links as link}<li><a href="{link->address}">{link->name}</a></li>{/foreach}
</ul>
</li>
{/if}
</nav>
</ul>
{if setting:dataStorage neq xml}
<form name="search" method="post" action="flights.php" class="navbar-form navbar-right">
<div class="form-group">
@ -126,3 +124,4 @@
{area:scripts}
</body>
</html>