Merge pull request #192 from jprochazka/2.0.2

2.0.2
pull/212/head
Joe Prochazka 2016-05-10 23:48:12 -04:00
commit 9a606e414e
12 zmienionych plików z 316 dodań i 165 usunięć

Wyświetl plik

@ -4,13 +4,15 @@ The following is a history of the changes made to this project.
## v2.0.2 *(May 10th, 2016)*
* System information page now displays portal and patch versions.
* SQLite database permissions set properly so flight data can be recorded. *(advanced)*
* Adjusted the postback check function to possibly fix POST issues.
* Non MySQL root users with the proper permissions can be used during install. *(advanced)*
* Fixed bug where a malformed if statement was causing upgrade problems. *(advanced)*
* Links to aggregate site stats pages now open in a new web browser windows.
* The Postfix MTA package is now installed if not present.
* The bash scripts now detect Ubuntu 16.04 LTS and install the proper PHP packages.
* The cUrrent MySQL database size is displayed on the maintainance tab. *(advanced)*
* The current MySQL database size is displayed on the maintainance tab. *(advanced)*
## v2.0.1 *(April 29th, 2016)*

Wyświetl plik

@ -40,10 +40,10 @@ hard work and dedication this project would not have been possible.
* Dump978: https://github.com/mutability/dump978
* FlightAware's PiAware: http://flightaware.com
* Plane Finder ADS-B Client: https://planefinder.net
* Flightradar24 Client: https://www.flightradar24.com
* Dump1090-Tools: https://github.com/mutability/dump1090-tools
* Bootstrap: http://getbootstrap.com/
* jQuery: http://jquery.com/
* jQuery Steps: http://www.jquery-steps.com
* js-cookie: https://github.com/js-cookie/js-cookie/releases
* jquery-validation: https://github.com/jzaefferer/jquery-validation
* Bootstrap: http://getbootstrap.com/
* jQuery: http://jquery.com/
* jQuery Steps: http://www.jquery-steps.com
* js-cookie: https://github.com/js-cookie/js-cookie/releases
* jquery-validation: https://github.com/jzaefferer/jquery-validation

Wyświetl plik

@ -50,6 +50,25 @@ echo "https://github.com/mutability/dump1090"
echo -e "\033[37m"
read -p "Press enter to continue..." CONTINUE
## ASK WHICH WEB SERVER TO INSTALL
# Commented out temporarily until choice has been added to
# the portal installations scipt as well.
#echo -e "\033[31m"
#echo "Select Web Server"
#echo -e "\033[33m"
#echo "Select the web server you wish to use."
#echo "Currently Lighttpd is the recommended web server."
#echo ""
#echo " 1) Lighttpd"
#echo " 2) Nginx"
#echo -e "\033[37m"
#read -p "Which web server do you wish to use? [1] " WEBSERVER
# For now we will force Lighttpd as the web server chosen.
WEBSERVER=1
## CHECK FOR PREREQUISITE PACKAGES
echo -e "\033[33m"
@ -64,7 +83,13 @@ CheckPackage rtl-sdr
CheckPackage librtlsdr-dev
CheckPackage libusb-1.0-0-dev
CheckPackage pkg-config
CheckPackage lighttpd
if [[ $WEBSERVER != "2" ]]; then
CheckPackage lighttpd
else
CheckPackage nginx
fi
CheckPackage fakeroot
## DOWNLOAD OR UPDATE THE DUMP1090-MUTABILITY SOURCE
@ -118,13 +143,22 @@ if [ $(dpkg-query -W -f='${STATUS}' dump1090-mutability 2>/dev/null | grep -c "o
kill -9 `ps --pid $$ -oppid=`; exit
fi
## CONFIGURE LIGHTTPD
## CONFIGURE THE WEB SERVER
echo -e "\033[33m"
echo "Configuring lighttpd..."
echo -e "\033[37m"
sudo lighty-enable-mod dump1090
sudo /etc/init.d/lighttpd force-reload
if [[ $WEBSERVER != "2" ]]; then
echo -e "\033[33m"
echo "Configuring lighttpd..."
echo -e "\033[37m"
sudo lighty-enable-mod dump1090
sudo /etc/init.d/lighttpd force-reload
else
echo -e "\033[33m"
echo "Configuring nginx..."
echo -e "\033[37m"
sudo rm /etc/nginx/sites-enabled/default
sudo ln -s /etc/nginx/sites-available/dump1090-mutability /etc/nginx/sites-enabled/dump1090-mutability
sudo /etc/init.d/nginx force-reload
fi
## DUMP1090-MUTABILITY POST INSTALLATION CONFIGURATION

Wyświetl plik

@ -109,17 +109,15 @@ sudo chmod a+s rtlsdr-ogn
# Check if kernel v4.1 or higher is being used.
################################################
# ADD A WAY TO CHECK KERNEL #
# THIS WILL NOT WORK AND IS ONLY A PLACEHOLDER #
################################################
KERNEL=`uname -r`
VERSION="`echo $KERNEL | cut -d \. -f 1`.`echo $KERNEL | cut -d \. -f 2`"
if [[ `uname -r` == $SOMETHING ]]; then
# Kernel is version 4.1 or newer.
sudo mknod gpu_dev c 249 0
else
if [[ $VERSION < 4.1 ]]; then
# Kernel is older than version 4.1.
sudo mknod gpu_dev c 100 0
else
# Kernel is version 4.1 or newer.
sudo mknod gpu_dev c 249 0
fi
## CREATE THE CONFIGURATION FILE

Wyświetl plik

@ -88,7 +88,7 @@ if [ -f $DOCUMENTROOT/classes/settings.class.php ]; then
DATABASEENGINE=1
fi
if [ $HOST != "localhost" || $HOST != "127.0.0.1" ]; then
if [ $HOST != "localhost" ] || [ $HOST != "127.0.0.1" ]; then
LOCALDATABASE=1
else
LOCALDATABASE=2
@ -121,7 +121,7 @@ else
echo " 1) MySQL"
echo " 2) SQLLite"
echo -e "\033[37m"
read -p "Use portal with advanced features? [1] " DATABASEENGINE
read -p "Which database engine will be used? [1] " DATABASEENGINE
# Check if the user is using a remote MySQL database.
if [[ $DATABASEENGINE != 2 ]]; then
@ -131,7 +131,7 @@ else
echo " 1) Locally"
echo " 2) Remotely"
echo -e "\033[37m"
read -p "Use portal with advanced features? [1] " LOCALDATABASE
read -p "Where will the database hosted? [1] " LOCALDATABASE
fi
fi
fi
@ -144,22 +144,61 @@ echo -e "\033[37m"
CheckPackage cron
CheckPackage collectd-core
CheckPackage rrdtool
CheckPackage lighttpd
CheckPackage php5-cgi
CheckPackage postfix
CheckPackage lighttpd
# Check if this is Ubuntu 16.04 LTS.
# This needs optimized and made to recognize releases made after 16.04 as well.
if [ -f /etc/lsb-release ]; then
. /etc/lsb-release
if [ $DISTRIB_ID == "Ubuntu" ] && [ $DISTRIB_RELEASE == "16.04" ]; then
CheckPackage php7.0-cgi
else
CheckPackage php5-cgi
fi
else
CheckPackage php5-cgi
fi
CheckPackage libpython2.7
if [[ $ADVANCED =~ ^[yY]$ ]]; then
if [[ $DATABASEENGINE == 2 ]]; then
CheckPackage sqlite3
CheckPackage php5-sqlite
CheckPackage sqlite3
# Check if this is Ubuntu 16.04 LTS.
# This needs optimized and made to recognize releases made after 16.04 as well.
if [ -f /etc/lsb-release ]; then
. /etc/lsb-release
if [ $DISTRIB_ID == "Ubuntu" ] && [ $DISTRIB_RELEASE == "16.04" ]; then
CheckPackage php7.0-sqlite
else
CheckPackage php5-sqlite
fi
else
CheckPackage php5-sqlite
fi
else
if [[ $LOCALDATABASE != 2 ]]; then
# Install MySQL locally.
CheckPackage mysql-server
fi
CheckPackage mysql-client
CheckPackage php5-mysql
CheckPackage python-mysqldb
# Check if this is Ubuntu 16.04 LTS.
# This needs optimized and made to recognize releases made after 16.04 as well.
if [ -f /etc/lsb-release ]; then
. /etc/lsb-release
if [ $DISTRIB_ID == "Ubuntu" ] && [ $DISTRIB_RELEASE == "16.04" ]; then
CheckPackage php7.0-mysql
else
CheckPackage php5-mysql
fi
else
CheckPackage php5-mysql
fi
fi
fi
@ -184,13 +223,21 @@ if [[ $INSTALLED == "n" ]]; then
# Ask for remote MySQL address if the database is hosted remotely.
read -p "Remote MySQL Server Address: " DATABASEHOST
fi
read -p "Password for MySQL root user: " MYSQLROOTPASSWORD
read -p "MySQL user login: [root] " MYSQLUSER
read -p "Password for MySQL user: " MYSQLPASSWORD
if [[ $LOCALDATABASE == "" ]]; then
MYSQLUSER="root"
fi
# Check that the supplied password is correct.
while ! mysql -u root -p$MYSQLROOTPASSWORD -h $DATABASEHOST -e ";" ; do
while ! mysql -u$MYSQLUSER -p$MYSQLPASSWORD -h $DATABASEHOST -e ";" ; do
echo -e "\033[31m"
echo -e "Unable to connect to the MySQL server using the supplied password.\033[37m"
read -p "Password for MySQL root user: " MYSQLROOTPASSWORD
echo -e "Unable to connect to the MySQL server using the supplied login and password.\033[37m"
read -p "MySQL user login: [root] " MYSQLUSER
read -p "Password for MySQL user: " MYSQLPASSWORD
if [[ $LOCALDATABASE == "" ]]; then
MYSQLUSER="root"
fi
done
read -p "New Database Name: " DATABASENAME
@ -201,10 +248,10 @@ if [[ $INSTALLED == "n" ]]; then
if [[ $DATABASEENGINE == 1 ]] || [[ $DATABASEENGINE == "" ]]; then
echo -e "\033[33m"
echo -e "Creating MySQL database and user...\033[37m"
mysql -uroot -p${MYSQLROOTPASSWORD} -h $DATABASEHOST -e "CREATE DATABASE ${DATABASENAME};"
mysql -uroot -p${MYSQLROOTPASSWORD} -h $DATABASEHOST -e "CREATE USER '${DATABASEUSER}'@'localhost' IDENTIFIED BY \"${DATABASEPASSWORD}\";";
mysql -uroot -p${MYSQLROOTPASSWORD} -h $DATABASEHOST -e "GRANT ALL PRIVILEGES ON ${DATABASENAME}.* TO '${DATABASEUSER}'@'localhost';"
mysql -uroot -p${MYSQLROOTPASSWORD} -h $DATABASEHOST -e "FLUSH PRIVILEGES;"
mysql -u$MYSQLUSER -p${MYSQLROOTPASSWORD} -h $DATABASEHOST -e "CREATE DATABASE ${DATABASENAME};"
mysql -u$MYSQLUSER -p${MYSQLROOTPASSWORD} -h $DATABASEHOST -e "CREATE USER '${DATABASEUSER}'@'localhost' IDENTIFIED BY \"${DATABASEPASSWORD}\";";
mysql -u$MYSQLUSER -p${MYSQLROOTPASSWORD} -h $DATABASEHOST -e "GRANT ALL PRIVILEGES ON ${DATABASENAME}.* TO '${DATABASEUSER}'@'localhost';"
mysql -u$MYSQLUSER -p${MYSQLROOTPASSWORD} -h $DATABASEHOST -e "FLUSH PRIVILEGES;"
fi
echo -e "\033[31m"
@ -409,6 +456,8 @@ echo "Please look over the output generated to be sure no errors were encountere
echo -e "\033[37m"
read -p "Press enter to continue..." CONTINUE
clear
# Display further portal setup instructions.
echo -e "\033[31m"
echo "PORTAL SETUP IS NOT YET COMPLETE"

Wyświetl plik

@ -523,6 +523,7 @@
<div class="panel panel-default">
<div class="panel-heading">Purge Positions</div>
<div class="panel-body">
<p>Current Database Size: <?php echo $common->getDatabaseSize("mb"); ?>MB</p>
<div class="form-group">
<label for="purgepositionspicker">Purge flight positions old than...</label><br />
<input type="text" class="form-control" id="purgepositionspicker" name="purgepositionspicker" autocomplete="off" <?php ($settings::db_driver == "xml" ? print ' disabled' : ''); ?>>

Wyświetl plik

@ -144,11 +144,11 @@
$dbh = NULL;
}
}
function deleteSetting($name) {
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."settings.class.php");
$settings = new settings();
if ($settings::db_driver == "xml") {
$xmlSettings = simplexml_load_file($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."settings.xml");
foreach($xmlSettings as $xmlSetting) {
@ -162,7 +162,7 @@
// PDO
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."common.class.php");
$common = new common();
$dbh = $common->pdoOpen();
$sql = "DELETE FROM ".$settings::db_prefix."settings WHERE name = :name";
$sth = $dbh->prepare($sql);
@ -205,13 +205,7 @@
// Check if page load is a post back.
function postBack() {
if (empty($_SERVER['HTTP_REFERER'])) {
return FALSE;
}
$methodUsed = strtoupper($_SERVER['REQUEST_METHOD']);
$referer = strtolower(preg_replace('/\?.*/', '', basename($_SERVER['HTTP_REFERER'])));
$thisScript = strtolower(basename($_SERVER['SCRIPT_NAME']));
if ($methodUsed == 'POST' && $referer == $thisScript) {
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
return TRUE;
}
return FALSE;
@ -291,5 +285,33 @@
'X-Mailer: PHP/'.phpversion();
return mail($to, $subject, $message, $headers);
}
// Get the size of the database.
function getDatabaseSize($measurment = "") {
$databaseSize = 0;
$dbh = $this->pdoOpen();
$sql = "SHOW TABLE STATUS";
$sth = $dbh->prepare($sql);
$sth->execute();
$databaseSize = $sth->fetch(PDO::FETCH_ASSOC)["Data_length"];
$sth = NULL;
$dbh = NULL;
switch ($measurment) {
case "kb":
return round($databaseSize / 1024, 2);
break;
case "mb":
return round($databaseSize / 1024 / 1024, 2);
break;
case "gb":
return round($databaseSize / 1024 / 1024 /1024, 2);
break;
case "tb":
return round($databaseSize / 1024 /1024 /1024 /1024, 2);
break;
default:
return $databaseSize;
}
}
}
?>

Wyświetl plik

@ -38,7 +38,7 @@
// Check if the portal is installed or needs upgraded.
if (!file_exists($_SERVER['DOCUMENT_ROOT']."/classes/settings.class.php")) {
header ("Location: /install/install.php");
} elseif ($common->getSetting("version") != "2.0.1"){
} elseif ($common->getSetting("version") != "2.0.2"){
header ("Location: /install/upgrade.php");
}

Wyświetl plik

@ -32,11 +32,17 @@
$common = new common();
// The most current stable release.
$thisVersion = "2.0.1";
$thisVersion = "2.0.2";
// Begin the upgrade process if this release is newer than what is installed.
if (file_exists("../classes/settings.class.php")) {
header ("Location: /install/upgrade.php");
if ($common-> getSetting("version") < $thisVersion) {
// THis is an older version so forward the user to upgrade.php
header ("Location: /install/upgrade.php");
} else {
// It would appear the this is a current version so forward the user to the index page.
header ("Location: /");
}
}
// BEGIN FRESH INSTALLATION
@ -348,6 +354,11 @@ EOF;
$dbh = NULL;
}
// Set permissions on SQLite file.
if ($_POST['driver'] == "sqlite") {
chmod($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."portal.sqlite", 0666);
}
// Add settings.
$common->addSetting('version', $thisVersion);
$common->addSetting('patch', '');

Wyświetl plik

@ -35,7 +35,7 @@
$settings = new settings();
// The most current stable release.
$thisVersion = "2.0.1";
$thisVersion = "2.0.2";
// Begin the upgrade process if this release is newer than what is installed.
if ($common->getSetting("version") == $thisVersion) {
@ -45,146 +45,172 @@
$error = FALSE;
#errorMessage = "No error message returned.";
try {
// Change tables containing datetime data to datetime.
if ($settings::db_driver != "xml") {
///////////////////////
// UPGRADE TO V2.0.1
///////////////////////
// ALter MySQL tables.
if ($settings::db_driver != "mysql") {
if ($common->getSetting("version") == "2.0.0") {
try {
// Change tables containing datetime data to datetime.
if ($settings::db_driver != "xml") {
// ALter MySQL tables.
if ($settings::db_driver != "mysql") {
$dbh = $common->pdoOpen();
$sql = "ALTER TABLE ".$settings::db_prefix."aircraft MODIFY firstSeen DATETIME NOT NULL";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
$sql = "ALTER TABLE adsb_aircraft MODIFY lastSeen DATETIME NOT NULL";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
$sql = "ALTER TABLE adsb_blogPosts MODIFY date DATETIME NOT NULL";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
$sql = "ALTER TABLE adsb_flights MODIFY firstSeen DATETIME NOT NULL";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
$sql = "ALTER TABLE adsb_flights MODIFY firstSeen DATETIME NOT NULL";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
$sql = "ALTER TABLE adsb_positions MODIFY time DATETIME NOT NULL";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
$dbh = NULL;
}
// Convert times to GMT.
// You may wish to uncomment this block of code in order to convert existing times
// stored in the database to UTC/GMT time. Before doing so it is recommended that
// you set the setting max_execution_time setting to a large amount of time in your
// php.ini file. Depending on the amount of flight data logged this may take quite
// some time for this upgrade script to complete so be patient and let it run it's
// course. Afterwards set the max_execution_time back to it previous setting.
/*
$dbh = $common->pdoOpen();
$sql = "ALTER TABLE ".$settings::db_prefix."aircraft MODIFY firstSeen DATETIME NOT NULL";
$sql = "SELECT id, firstSeen, lastSeen FROM ".$settings::db_prefix."aircraft";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
$sql = "ALTER TABLE adsb_aircraft MODIFY lastSeen DATETIME NOT NULL";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
$sql = "ALTER TABLE adsb_blogPosts MODIFY date DATETIME NOT NULL";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
$sql = "ALTER TABLE adsb_flights MODIFY firstSeen DATETIME NOT NULL";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
$sql = "ALTER TABLE adsb_flights MODIFY firstSeen DATETIME NOT NULL";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
$sql = "ALTER TABLE adsb_positions MODIFY time DATETIME NOT NULL";
$sth = $dbh->prepare($sql);
$sth->execute();
$sth = NULL;
$dbh = NULL;
}
// Convert times to GMT.
// You may wish to uncomment this block of code in order to convert existing times
// stored in the database to UTC/GMT time. Before doing so it is recommended that
// you set the setting max_execution_time setting to a large amount of time in your
// php.ini file. Depending on the amount of flight data logged this may take quite
// some time for this upgrade script to complete so be patient and let it run it's
// course. Afterwards set the max_execution_time back to it previous setting.
/*
$dbh = $common->pdoOpen();
$sql = "SELECT id, firstSeen, lastSeen FROM ".$settings::db_prefix."aircraft";
$sth = $dbh->prepare($sql);
$sth->execute();
$aircraft = $sth->fetchAll();
$sth = NULL;
$dbh = NULL;
foreach ($aircraft as $airframe) {
$dbh = $common->pdoOpen();
$sql = "UPDATE ".$settings::db_prefix."aircraft SET firstSeen = :firstSeen, lastSeen = :lastSeen WHERE id = :id";
$sth = $dbh->prepare($sql);
$sth->bindParam(':firstSeen', gmdate("Y-m-d H:i:s", $airframe["firstSeen"]), PDO::PARAM_STR);
$sth->bindParam(':lastSeen', gmdate("Y-m-d H:i:s", $airframe["lastSeen"]), PDO::PARAM_STR);
$sth->bindParam(':id', $airframe["id"], PDO::PARAM_INT);
$sth->execute();
$aircraft = $sth->fetchAll();
$sth = NULL;
$dbh = NULL;
}
$dbh = $common->pdoOpen();
$sql = "SELECT id, date FROM ".$settings::db_prefix."blogPosts";
$sth = $dbh->prepare($sql);
$sth->execute();
$blogPosts = $sth->fetchAll();
$sth = NULL;
$dbh = NULL;
foreach ($aircraft as $airframe) {
$dbh = $common->pdoOpen();
$sql = "UPDATE ".$settings::db_prefix."aircraft SET firstSeen = :firstSeen, lastSeen = :lastSeen WHERE id = :id";
$sth = $dbh->prepare($sql);
$sth->bindParam(':firstSeen', gmdate("Y-m-d H:i:s", $airframe["firstSeen"]), PDO::PARAM_STR);
$sth->bindParam(':lastSeen', gmdate("Y-m-d H:i:s", $airframe["lastSeen"]), PDO::PARAM_STR);
$sth->bindParam(':id', $airframe["id"], PDO::PARAM_INT);
$sth->execute();
$sth = NULL;
$dbh = NULL;
}
foreach ($blogPosts as $post) {
$dbh = $common->pdoOpen();
$sql = "UPDATE ".$settings::db_prefix."blogPosts SET date = :date WHERE id = :id";
$sql = "SELECT id, date FROM ".$settings::db_prefix."blogPosts";
$sth = $dbh->prepare($sql);
$sth->bindParam(':date', gmdate("Y-m-d H:i:s", $post["date"]), PDO::PARAM_STR);
$sth->bindParam(':id', $post["id"], PDO::PARAM_INT);
$sth->execute();
$blogPosts = $sth->fetchAll();
$sth = NULL;
$dbh = NULL;
}
$dbh = $common->pdoOpen();
$sql = "SELECT id, firstSeen, lastSeen FROM ".$settings::db_prefix."flights";
$sth = $dbh->prepare($sql);
$sth->execute();
$flights = $sth->fetchAll();
$sth = NULL;
$dbh = NULL;
foreach ($blogPosts as $post) {
$dbh = $common->pdoOpen();
$sql = "UPDATE ".$settings::db_prefix."blogPosts SET date = :date WHERE id = :id";
$sth = $dbh->prepare($sql);
$sth->bindParam(':date', gmdate("Y-m-d H:i:s", $post["date"]), PDO::PARAM_STR);
$sth->bindParam(':id', $post["id"], PDO::PARAM_INT);
$sth->execute();
$sth = NULL;
$dbh = NULL;
}
foreach ($flights as $flight) {
$dbh = $common->pdoOpen();
$sql = "UPDATE ".$settings::db_prefix."flights SET firstSeen = :firstSeen, lastSeen = lastSeen WHERE id = :id";
$sql = "SELECT id, firstSeen, lastSeen FROM ".$settings::db_prefix."flights";
$sth = $dbh->prepare($sql);
$sth->bindParam(':firstSeen', gmdate("Y-m-d H:i:s", $flight["firstSeen"]), PDO::PARAM_STR);
$sth->bindParam(':lastSeen', gmdate("Y-m-d H:i:s", $flight["lastSeen"]), PDO::PARAM_STR);
$sth->bindParam(':id', $flight["id"], PDO::PARAM_INT);
$sth->execute();
$flights = $sth->fetchAll();
$sth = NULL;
$dbh = NULL;
}
$dbh = $common->pdoOpen();
$sql = "SELECT id, time FROM ".$settings::db_prefix."positions";
$sth = $dbh->prepare($sql);
$sth->execute();
$positionss = $sth->fetchAll();
$sth = NULL;
$dbh = NULL;
foreach ($flights as $flight) {
$dbh = $common->pdoOpen();
$sql = "UPDATE ".$settings::db_prefix."flights SET firstSeen = :firstSeen, lastSeen = lastSeen WHERE id = :id";
$sth = $dbh->prepare($sql);
$sth->bindParam(':firstSeen', gmdate("Y-m-d H:i:s", $flight["firstSeen"]), PDO::PARAM_STR);
$sth->bindParam(':lastSeen', gmdate("Y-m-d H:i:s", $flight["lastSeen"]), PDO::PARAM_STR);
$sth->bindParam(':id', $flight["id"], PDO::PARAM_INT);
$sth->execute();
$sth = NULL;
$dbh = NULL;
}
foreach ($positions as $position) {
$dbh = $common->pdoOpen();
$sql = "UPDATE ".$settings::db_prefix."positions SET time = :time WHERE id = :id";
$sql = "SELECT id, time FROM ".$settings::db_prefix."positions";
$sth = $dbh->prepare($sql);
$sth->bindParam(':time', gmdate("Y-m-d H:i:s", $position["time"]), PDO::PARAM_STR);
$sth->bindParam(':id', $position["id"], PDO::PARAM_INT);
$sth->execute();
$positionss = $sth->fetchAll();
$sth = NULL;
$dbh = NULL;
foreach ($positions as $position) {
$dbh = $common->pdoOpen();
$sql = "UPDATE ".$settings::db_prefix."positions SET time = :time WHERE id = :id";
$sth = $dbh->prepare($sql);
$sth->bindParam(':time', gmdate("Y-m-d H:i:s", $position["time"]), PDO::PARAM_STR);
$sth->bindParam(':id', $position["id"], PDO::PARAM_INT);
$sth->execute();
$sth = NULL;
$dbh = NULL;
}
*/
}
*/
// Add timezone setting.
$common->addSetting("timeZone", date_default_timezone_get());
// update version and patch settings.
$common->updateSetting("version", "2.0.1");
$common->updateSetting("patch", "");
} catch(Exception $e) {
$error = TRUE;
$errorMessage = $e->getMessage();
}
}
// Add timezone setting.
$common->addSetting("timeZone", date_default_timezone_get());
///////////////////////
// UPGRADE RO V2.0.2
///////////////////////
// update version and patch settings.
$common->updateSetting("version", $thisVersion);
$common->updateSetting("patch", "");
} catch(Exception $e) {
$error = TRUE;
$errorMessage = $e->getMessage();
if ($common->getSetting("version") == "2.0.1") {
try {
// Set proper permissions on the SQLite file.
if ($settings::db_driver == "sqlite") {
chmod($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."portal.sqlite", 0666);
}
$common->updateSetting("version", $thisVersion);
$common->updateSetting("patch", "");
} catch(Exception $e) {
$error = TRUE;
$errorMessage = $e->getMessage();
}
}
require_once('../admin/includes/header.inc.php');

Wyświetl plik

@ -49,6 +49,10 @@
$pageData['flightRadar24Link'] = "https://www.flightradar24.com/account/feed-stats/?id=".$common->getSetting('flightRadar24Id');
$pageData['adsbExchangeLink'] = "http://www.adsbexchange.com";
// Get software information.
$pageData['portalVersion'] = $common->getSetting('version');
$pageData['portalPatch'] = $common->getSetting('patch');
// Get the current system uptime.
$json = file_get_contents("http://localhost/api/system.php?action=getUptimeInformation");
$uptimeData = json_decode($json, TRUE);

Wyświetl plik

@ -25,10 +25,10 @@
<h1>System Information</h1>
<h2>Aggregate Sites Statistics</h2>
<ul>
{if setting:enableFlightAwareLink eq TRUE}<li><a href="{page:flightAwareLink}">FlightAware Stats</a></li>{/if}
{if setting:enablePlaneFinderLink eq TRUE}<li><a href="{page:planeFinderLink}">Planefinder Stats</a></li>{/if}
{if setting:enableFlightRadar24Link eq TRUE}<li><a href="{page:flightRadar24Link}">Flightradar24 Stats</a></li>{/if}
{if setting:enableAdsbExchangeLink eq TRUE}<li><a href="{page:adsbExchangeLink}">ADS-B Exchange</a></li>{/if}
{if setting:enableFlightAwareLink eq TRUE}<li><a href="{page:flightAwareLink}" target="_blank">FlightAware Stats</a></li>{/if}
{if setting:enablePlaneFinderLink eq TRUE}<li><a href="{page:planeFinderLink}" target="_blank">Planefinder Stats</a></li>{/if}
{if setting:enableFlightRadar24Link eq TRUE}<li><a href="{page:flightRadar24Link}" target="_blank">Flightradar24 Stats</a></li>{/if}
{if setting:enableAdsbExchangeLink eq TRUE}<li><a href="{page:adsbExchangeLink}" target="_blank">ADS-B Exchange</a></li>{/if}
</ul>
<h2>System Charts</h2>
<div id="chart_div" style="width: 400px; height: 120px;"></div>
@ -36,6 +36,10 @@
<strong>Uptime:</strong> <span id="uptime">{page:uptimeInSeconds}</span>
</div>
<h2>System Information</h2>
<ul>
<li><strong>Portal Version:</strong> {page:portalVersion}</li>
<li><strong>Patch Version:</strong> {page:portalPatch}</li>
</ul>
<ul>
<li><strong>Name:</strong> {page:osNodeName}</li>
<li><strong>Kernel:</strong> {page:osKernelRelease}</li>