function display(&$pageData) { $common = new common($this); // Check if the portal is installed or needs upgraded. $thisVersion = "2.5.0"; if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/classes/settings.class.php")) { header("Location: /install/install.php"); } elseif ($common->getSetting("version") != $thisVersion) { header("Location: /install/upgrade.php"); } // The Base URL of this page (needed for Plane Finder client link) $pageData['baseurl'] = $common->getBaseUrl(); // Load the master template along with required data for the master template.. $master = $this->readTemplate('master.tpl'); require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "links.class.php"; $links = new links(); $pageData['links'] = $links->getAllLinks(); // Load the template for the requested page. $page = $this->readTemplate($common->removeExtension($_SERVER["SCRIPT_NAME"]) . '.tpl'); $output = $this->mergeAreas($master, $page); $output = $this->mergeSettings($output); $output = $this->mergePageData($output, $pageData); $output = $this->processIfs($output, $pageData); $output = $this->processForeach($output, $pageData); $output = $this->processFors($output, $pageData); $output = $this->processWhiles($output, $pageData); $output = $this->removeComments($output); // Insert page ID mainly used to mark an active navigation link when using Bootstrap. $output = str_replace("{template:pageId}", $common->removeExtension($_SERVER["SCRIPT_NAME"]) . "-link", $output); echo $output; }
function getByPosition() { require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "settings.class.php"; require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "common.class.php"; $settings = new settings(); $common = new common(); // $flightData = array(); // PDO $dbh = $common->pdoOpen(); $sql = "SELECT flight, aircraft FROM " . $settings::db_prefix . "positions WHERE id = :id"; $sth = $dbh->prepare($sql); $sth->bindParam(':id', $_GET['position'], PDO::PARAM_INT); $sth->execute(); $position = $sth->fetch(); $sth = NULL; $dbh = NULL; $dbh = $common->pdoOpen(); $sql = "SELECT flight, firstSeen, lastSeen FROM " . $settings::db_prefix . "flights WHERE id = :id"; $sth = $dbh->prepare($sql); $sth->bindParam(':id', $position['flight'], PDO::PARAM_INT); $sth->execute(); $flight = $sth->fetch(); $sth = NULL; $dbh = NULL; $dbh = $common->pdoOpen(); $sql = "SELECT icao, firstSeen, lastSeen FROM " . $settings::db_prefix . "aircraft WHERE id = :id"; $sth = $dbh->prepare($sql); $sth->bindParam(':id', $position['flight'], PDO::PARAM_INT); $sth->execute(); $aircraft = $sth->fetch(); $sth = NULL; $dbh = NULL; $flightData['icao'] = $aircraft['icao']; $flightData['flight'] = $flight['flight']; $date = new DateTime($aircraft['firstSeen'], new DateTimeZone('UTC')); $date->setTimezone(new DateTimeZone($common->getSetting('timeZone'))); $flightData['afs'] = $date->format($common->getSetting('dateFormat')); $date = new DateTime($aircraft['lastSeen'], new DateTimeZone('UTC')); $date->setTimezone(new DateTimeZone($common->getSetting('timeZone'))); $flightData['als'] = $date->format($common->getSetting('dateFormat')); $date = new DateTime($flight['firstSeen'], new DateTimeZone('UTC')); $date->setTimezone(new DateTimeZone($common->getSetting('timeZone'))); $flightData['ffs'] = $date->format($common->getSetting('dateFormat')); $date = new DateTime($flight['lastSeen'], new DateTimeZone('UTC')); $date->setTimezone(new DateTimeZone($common->getSetting('timeZone'))); $flightData['fls'] = $date->format($common->getSetting('dateFormat')); return $flightData; }
<td><a href="edit.php?title=<?php echo urlencode($post['title']); ?> ">edit</a> <a href="delete.php?title=<?php echo urlencode($post['title']); ?> ">delete</a></td> <td><?php echo $post['title']; ?> </td> <td> <?php // Properly format the date and convert to slected time zone. $date = new DateTime($post['date'], new DateTimeZone('UTC')); $date->setTimezone(new DateTimeZone($common->getSetting('timeZone'))); echo $date->format($common->getSetting('dateFormat')); ?> </td> </tr> <?php } ?> </table> </div> <?php $count = 0; foreach ($allPosts as $post) { $count++; } $pageLinks = $count / $itemsPerPage;
$dbh = $common->pdoOpen(); $sql = "SELECT COUNT(*) FROM " . $settings::db_prefix . "flights WHERE flight LIKE :like ORDER BY lastSeen DESC, flight"; $sth = $dbh->prepare($sql); $sth->bindValue(':like', "%" . $searchString . "%", PDO::PARAM_STR); $sth->execute(); $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; // Change dates to the proper timezone and format. foreach ($flights as &$flight) { $date = new DateTime($flight['firstSeen'], new DateTimeZone('UTC')); $date->setTimezone(new DateTimeZone($common->getSetting('timeZone'))); $flight['firstSeen'] = $date->format($common->getSetting('dateFormat')); $date = new DateTime($flight['lastSeen'], new DateTimeZone('UTC')); $date->setTimezone(new DateTimeZone($common->getSetting('timeZone'))); $flight['lastSeen'] = $date->format($common->getSetting('dateFormat')); } $pageData['flights'] = $flights; // Calculate the number of pagination links to show. $pageData['pageLinks'] = ceil($totalFlights / $itemsPerPage); $template->display($pageData);
// Redirect the authenticated visitor to their original destination. header("Location: " . urldecode($_REQUEST['origin'])); } else { // Redirect the user to the administration homepage. header("Location: index.php"); } } if ($common->postBack()) { // Check that a vailid login was supplied. $validLogin = $account->loginExists($_POST['login']); $emailSent = FALSE; if ($validLogin) { // Set a new token for the user. $token = $account->setToken($_POST['login']); // Create and send the email. $subject = $common->getSetting("siteName") . " Password Reset Request"; $message = "A password reset request has been received by your ADS-B portal.\r\n"; $message .= "\r\n"; $message .= "If you did not request this password reset simply disregard this email.\r\n"; $message .= "If in fact you did request a password reset follow the link below to do so.\r\n"; $message .= "\r\n"; $message .= "http://" . $_SERVER['HTTP_HOST'] . "/admin/reset.php?token=" . $token . "\r\n"; $message .= "\r\n"; $message .= "Your password reset token is: " . $token; $emailSent = $common->sendEmail($account->getEmail($_POST['login']), $subject, $message); } } ///////////////////// // BEGIN HTML BODY // ?> <!DOCTYPE html>
$flightNotifications = ltrim($flightNotifications . "," . $savedFlight, ','); } } else { //PDO $dbh = $common->pdoOpen(); $sql = "SELECT * FROM " . $settings::db_prefix . "flightNotifications"; $sth = $dbh->prepare($sql); $sth->execute(); $savedFlights = $sth->fetchAll(); $sth = NULL; $dbh = NULL; foreach ($savedFlights as $savedFlight) { $flightNotifications = ltrim($flightNotifications . "," . $savedFlight['flight'], ','); } } $enableFlightNotifications = $common->getSetting("enableFlightNotifications"); // Get general settings from settings.xml. $siteName = $common->getSetting("siteName"); $currentTemplate = $common->getSetting("template"); $defaultPage = $common->getSetting("defaultPage"); $dateFormat = $common->getSetting("dateFormat"); // Get navigation settings from settings.xml. $enableFlights = $common->getSetting("enableFlights"); $enableBlog = $common->getSetting("enableBlog"); $enableInfo = $common->getSetting("enableInfo"); $enableGraphs = $common->getSetting("enableGraphs"); $enableDump1090 = $common->getSetting("enableDump1090"); $enableDump978 = $common->getSetting("enableDump978"); $enablePfclient = $common->getSetting("enablePfclient"); // Get aggregate site settings from settings.xml. $enableFlightAwareLink = $common->getSetting("enableFlightAwareLink");
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // // SOFTWARE. // ///////////////////////////////////////////////////////////////////////////////////// // Start session session_start(); // Load the common PHP classes. require_once 'classes/common.class.php'; require_once 'classes/template.class.php'; require_once 'classes/blog.class.php'; $common = new common(); $template = new template(); $blog = new blog(); $pageData = array(); // Get the requested blog post. $post = $blog->getPostByTitle(urldecode($_GET['title'])); // The title of this page. $pageData['title'] = $post['title']; // Add blog post data to the $pageData array. $pageData['postTitle'] = $post['title']; $pageData['postAuthor'] = $common->getAdminstratorName($post['author']); $pageData['postContents'] = $post['contents']; // Properly format the date and convert to slected time zone. $date = new DateTime($post['date'], new DateTimeZone('UTC')); $date->setTimezone(new DateTimeZone($common->getSetting('timeZone'))); $pageData['postDate'] = $date->format($common->getSetting('dateFormat')); $template->display($pageData);
// // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // // SOFTWARE. // ///////////////////////////////////////////////////////////////////////////////////// // Start session session_start(); // Load the common PHP classes. require_once 'classes/common.class.php'; $common = new common(); // The title and navigation link ID of this page. $pageTitle = "System Information"; // Get the name of the template to use from the settings. $siteName = $common->getSetting("siteName"); $template = $common->getSetting("template"); // Enable/disable navigation links. $enableBlog = $common->getSetting("enableBlog"); $enableInfo = $common->getSetting("enableInfo"); $enableGraphs = $common->getSetting("enableGraphs"); $enableDump1090 = $common->getSetting("enableDump1090"); $enableDump978 = $common->getSetting("enableDump978"); $enablePfclient = $common->getSetting("enablePfclient"); $linkId = $common->removeExtension($_SERVER["SCRIPT_NAME"]) . "-link"; // Include the index template. require_once 'templates/' . $template . '/system.tpl.php'; // Include the master template. require_once 'templates/' . $template . '/master.tpl.php';
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 { 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)); } if ($settings::db_driver == "mysql") { $dbh = $common->pdoOpen(); // 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 <?php ///////////////////////////////////////////////////////////////////////////////////// // ADS-B RECEIVER PORTAL // // =============================================================================== // // Copyright and Licensing Information: // // // // The MIT License (MIT) // // // // Copyright (c) 2015-2016 Joseph A. Prochazka // // // // Permission is hereby granted, free of charge, to any person obtaining a copy // // of this software and associated documentation files (the "Software"), to deal // // in the Software without restriction, including without limitation the rights // // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // // copies of the Software, and to permit persons to whom the Software is // // furnished to do so, subject to the following conditions: // // // // The above copyright notice and this permission notice shall be included in all // // copies or substantial portions of the Software. // // // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // // SOFTWARE. // ///////////////////////////////////////////////////////////////////////////////////// class settings { // Database Settings const db_driver = 'sqlite'; const db_database = ''; const db_username = ''; const db_password = ''; const db_host = '/var/www/html/data/portal.sqlite'; const db_prefix = 'adsb_'; // Security Settings const sec_length = 6; // PDO Settings const pdo_debug = TRUE; } ?> EOF; file_put_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "settings.class.php", $content); // Open a connection to the database. $dbh = $common->pdoOpen(); // Add the links table. $sql = "CREATE TABLE " . $settings::db_prefix . "links(INTEGER PRIMARY KEY, name TEXT NOT NULL, address TEXT NOT NULL);"; $sth = $dbh->prepare($sql); $sth->execute(); $sth = NULL; $dbh = NULL; } // Rename the enableFlightNotifications to enableWebNotifications. $enableWebNotifications = $common->getSetting('enableFlightNotifications'); $common->addSetting('enableWebNotifications', $enableWebNotifications); $common->deleteSetting('enableFlightNotifications'); // Add Google Maps API Key setting. $common->addSetting('googleMapsApiKey', ''); // Add enable custom links setting. $common->addSetting('enableLinks', FALSE); // Update the version and patch settings.. $common->updateSetting("version", "2.5.0"); $common->updateSetting("patch", ""); // The upgrade process completed successfully. $results['success'] = TRUE; $results['message'] = "Upgrade to v2.5.0 successful."; return $results; } catch (Exception $e) { // Something went wrong during this upgrade process. $results['success'] = FALSE; $results['message'] = $e->getMessage(); return $results; } }
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // // SOFTWARE. // ///////////////////////////////////////////////////////////////////////////////////// // Start session session_start(); // Load the common PHP classes. require_once 'classes/common.class.php'; $common = new common(); // The title and navigation link ID of this page. $pageTitle = "Performance Graphs"; // Get the name of the template to use from the settings. $siteName = $common->getSetting("siteName"); $template = $common->getSetting("template"); // Enable/disable navigation links. $enableBlog = $common->getSetting("enableBlog"); $enableInfo = $common->getSetting("enableInfo"); $enableGraphs = $common->getSetting("enableGraphs"); $enableDump1090 = $common->getSetting("enableDump1090"); $enableDump978 = $common->getSetting("enableDump978"); $enablePfclient = $common->getSetting("enablePfclient"); // Measurement type to use. $measurementRange = $common->getSetting("measurementRange"); $measurementTemperature = $common->getSetting("measurementTemperature"); // Get the network interface being used. $networkInterface = $common->getSetting("networkInterface"); $linkId = $common->removeExtension($_SERVER["SCRIPT_NAME"]) . "-link"; // Include the index template.
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // // SOFTWARE. // ///////////////////////////////////////////////////////////////////////////////////// // Start session session_start(); // Load the common PHP classes. require_once 'classes/common.class.php'; require_once 'classes/template.class.php'; $common = new common(); $template = new template(); $pageData = array(); // The title of this page. $pageData['title'] = "System Information"; // create aggregate site statistics page links. $pageData['flightAwareLink'] = "http://flightaware.com/adsb/stats/user/" . $common->getSetting('flightAwareLogin') . "#stats-" . $common->getSetting('flightAwareSite'); $pageData['planeFinderLink'] = "https://planefinder.net/sharing/receiver/" . $common->getSetting('planeFinderReceiver'); $pageData['flightRadar24Link'] = "https://www.flightradar24.com/account/feed-stats/?id=" . $common->getSetting('flightRadar24Id'); $pageData['adsbExchangeLink'] = "http://www.adsbexchange.com"; // Get the current system uptime. $json = file_get_contents("http://localhost/api/system.php?action=getUptimeInformation"); $uptimeData = json_decode($json, TRUE); $pageData['uptimeInSeconds'] = $uptimeData['inSeconds']; $pageData['uptimeHours'] = $uptimeData['hours']; $pageData['uptimeMinutes'] = $uptimeData['minutes']; $pageData['uptimeSeconds'] = $uptimeData['seconds']; // Get operating system information. $json = file_get_contents("http://localhost/api/system.php?action=getOsInformation"); $osData = json_decode($json, TRUE); $pageData['osKernelRelease'] = $osData['kernelRelease']; $pageData['osNodeName'] = $osData['nodeName'];
// SOFTWARE. // ///////////////////////////////////////////////////////////////////////////////////// // Start session session_start(); // Load the common PHP classes. require_once 'classes/common.class.php'; require_once 'classes/template.class.php'; require_once 'classes/blog.class.php'; $common = new common(); $template = new template(); $blog = new blog(); $pageData = array(); // The title of this page. $pageData['title'] = "Blog"; // Get all blog posts from the XML file storing them. $allPosts = $blog->getAllPosts(); // Format the post dates according to the related setting. foreach ($allPosts as &$post) { if (strpos($post['contents'], '{more}') !== false) { $post['contents'] = substr($post['contents'], 0, strpos($post['contents'], '{more}')); } $post['author'] = $common->getAdminstratorName($post['author']); $post['date'] = date_format(date_create($post['date']), $common->getSetting('dateFormat')); } // Pagination. $itemsPerPage = 5; $page = isset($_GET['page']) ? $_GET['page'] : 1; $pageData['blogPosts'] = $common->paginateArray($allPosts, $page, $itemsPerPage - 1); // Calculate the number of pagination links to show. $pageData['pageLinks'] = count($allPosts) / $itemsPerPage; $template->display($pageData);
// The MIT License (MIT) // // // // Copyright (c) 2015-2016 Joseph A. Prochazka // // // // Permission is hereby granted, free of charge, to any person obtaining a copy // // of this software and associated documentation files (the "Software"), to deal // // in the Software without restriction, including without limitation the rights // // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // // copies of the Software, and to permit persons to whom the Software is // // furnished to do so, subject to the following conditions: // // // // The above copyright notice and this permission notice shall be included in all // // copies or substantial portions of the Software. // // // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // // SOFTWARE. // ///////////////////////////////////////////////////////////////////////////////////// // Start session session_start(); // Load the common PHP classes. require_once 'classes/common.class.php'; $common = new common(); // Get the default page from the settings. $defaultPage = $common->getSetting("defaultPage"); // Forward the user to the default page defined in the settings. header("Location: " . $defaultPage);
function getNetworkInformation() { require_once "../classes/common.class.php"; $common = new common(); $firstLookRx = trim(file_get_contents("/sys/class/net/" . $common->getSetting("networkInterface") . "/statistics/rx_bytes")); $firstLookTx = trim(file_get_contents("/sys/class/net/" . $common->getSetting("networkInterface") . "/statistics/tx_bytes")); sleep(5); $secondLookRx = trim(file_get_contents("/sys/class/net/" . $common->getSetting("networkInterface") . "/statistics/rx_bytes")); $secondLookTx = trim(file_get_contents("/sys/class/net/" . $common->getSetting("networkInterface") . "/statistics/tx_bytes")); $networkInformation['rxBytes'] = $secondLookRx - $firstLookRx; $networkInformation['txBytes'] = $secondLookTx - $firstLookTx; $networkInformation['rxKbps'] = round(($secondLookRx - $firstLookRx) / 1024, 0); $networkInformation['txKbps'] = round(($secondLookTx - $firstLookTx) / 1024, 0); $networkInformation['rxMbps'] = round(($secondLookRx - $firstLookRx) / 1024 / 1024, 0); $networkInformation['txMbps'] = round(($secondLookTx - $firstLookTx) / 1024 / 1024, 0); return $networkInformation; }
// 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. // ///////////////////////////////////////////////////////////////////////////////////// require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "common.class.php"; $common = new common(); // The most current stable release. $thisVersion = "2.5.0"; // Begin the upgrade process if this release is newer than what is installed. if ($common->getSetting("version") == $thisVersion) { header("Location: /"); } $success = TRUE; // UPGRADE TO V2.0.1 if ($common->getSetting("version") == "2.0.0" && $success) { $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"; } // UPGRADE TO V2.0.2 if ($common->getSetting("version") == "2.0.1" && $success) { $json = file_get_contents("http://localhost/install/upgrade-v2.0.2.php"); $results = json_decode($json, TRUE);
// // // 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. // ///////////////////////////////////////////////////////////////////////////////////// // The most current stable release. $thisVersion = "2.5.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")) { require $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "common.class.php"; $common = new common(); 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 $installed = FALSE; //if ($common->postBack()) { if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') { require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "account.class.php"; $account = new account(); // Validate the submited form. $passwordsMatch = FALSE;