Skip to content

Commit

Permalink
Admins can now specify historical plot map center.
Browse files Browse the repository at this point in the history
  • Loading branch information
jprochazka committed Jun 26, 2018
1 parent 5fb758c commit 53c3cca
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 4 deletions.
6 changes: 6 additions & 0 deletions bash/portal/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,12 @@ if [ "${DATABASEENGINE}" = "MySQL" ]; then
export ADSB_DATABASENAME=${DATABASENAME}
elif [ "${DATABASEENGINE}" = "SQLite" ]; then
if [ -z "${DATABASENAME}" ] ; then
if [ ! -f ${LIGHTTPD_DOCUMENT_ROOT}/data/portal.sqlite ]; then
echo -e "\e[94m Creating an empty SQLite database file...\e[97m"
sudo touch ${LIGHTTPD_DOCUMENT_ROOT}/data/portal.sqlite
echo -e "\e[94m Setting write permissions on the empty SQLite database file...\e[97m"
sudo chmod 666 ${LIGHTTPD_DOCUMENT_ROOT}/data/portal.sqlite
fi
DATABASENAME="${LIGHTTPD_DOCUMENT_ROOT}/data/portal.sqlite"
fi
export ADSB_DATABASEENGINE=${DATABASEENGINE}
Expand Down
2 changes: 1 addition & 1 deletion build/portal/html/classes/template.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function display(&$pageData) {

// Check if the portal is installed or needs upgraded.

$thisVersion = "2.6.3";
$thisVersion = "2.7.0";

if (!file_exists($_SERVER['DOCUMENT_ROOT']."/classes/settings.class.php")) {
header ("Location: /install/install.php");
Expand Down
2 changes: 1 addition & 1 deletion build/portal/html/install/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
/////////////////////////////////////////////////////////////////////////////////////

// The most current stable release.
$thisVersion = "2.6.3";
$thisVersion = "2.7.0";

// Begin the upgrade process if this release is newer than what is installed.
if (file_exists($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."settings.class.php")) {
Expand Down
1 change: 1 addition & 0 deletions build/portal/html/install/upgrade-v2.6.3.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

// ------------------------------------------------------------------------------------------
// Updates the version setting to 2.6.3.
// Added setting to toggle navbar and footer hiding.
// ------------------------------------------------------------------------------------------

$results = upgrade();
Expand Down
72 changes: 72 additions & 0 deletions build/portal/html/install/upgrade-v2.7.0.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

/////////////////////////////////////////////////////////////////////////////////////
// ADS-B RECEIVER PORTAL //
// =============================================================================== //
// Copyright and Licensing Information: //
// //
// The MIT License (MIT) //
// //
// Copyright (c) 2015-2017 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. //
/////////////////////////////////////////////////////////////////////////////////////

///////////////////////
// UPGRADE TO V2.7.0
///////////////////////

// ------------------------------------------------------------------------------------------
// Updates the version setting to 2.7.0.
// Added options to set the default latitude and longitude for the advanced features map.
// ------------------------------------------------------------------------------------------

$results = upgrade();
exit(json_encode($results));

function upgrade() {
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."common.class.php");
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."settings.class.php");

$common = new common();
$settings = new settings();

try {
// Add portal navigation and footer autohide option.
$common->addSetting("advancedMapCenterLatitude", "41.3683798");
$common->addSetting("advancedMapCenterLongitude", "-82.1076486");

// Update the version and patch settings..
$common->updateSetting("version", "2.7.0");
$common->updateSetting("patch", "");

// The upgrade process completed successfully.
$results['success'] = TRUE;
$results['message'] = "Upgrade to v2.7.0 successful.";
return $results;

} catch(Exception $e) {
// Something went wrong during this upgrade process.
$results['success'] = FALSE;
$results['message'] = $e->getMessage();
return $results;
}
}
?>

11 changes: 10 additions & 1 deletion build/portal/html/install/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
$common = new common();

// The most current stable release.
$thisVersion = "2.6.2";
$thisVersion = "2.7.0";

// Begin the upgrade process if this release is newer than what is installed.
if ($common->getSetting("version") == $thisVersion) {
Expand Down Expand Up @@ -150,6 +150,15 @@
$version = "2.6.3";
}

// UPGRADE TO V2.7.0
if ($common->getSetting("version") == "2.6.3" && $success) {
$json = file_get_contents("https://localhost/install/upgrade-v2.7.0.php");
$results = json_decode($json, TRUE);
$success = $results['success'];
$message = $results['message'];
$version = "2.7.0";
}

require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."admin".DIRECTORY_SEPARATOR."includes".DIRECTORY_SEPARATOR."header.inc.php");

// Display the instalation wizard.
Expand Down
2 changes: 1 addition & 1 deletion build/portal/html/templates/default/plot.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 7,
center: {lat: 41.379857, lng: -82.082877},
center: {lat: {setting:advancedMapCenterLatitude}, lng: {setting:advancedMapCenterLongitude}},
mapTypeId: google.maps.MapTypeId.TERRAIN
});
Expand Down

0 comments on commit 53c3cca

Please sign in to comment.