diff --git a/.gitignore b/.gitignore deleted file mode 100644 index b406063..0000000 --- a/.gitignore +++ /dev/null @@ -1,100 +0,0 @@ -# Created by https://www.gitignore.io/api/composer,phpstorm+all -# Edit at https://www.gitignore.io/?templates=composer,phpstorm+all - -### Composer ### -composer.phar -/vendor/ - -# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control -# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file -# composer.lock - -### PhpStorm+all ### -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf - -# Generated files -.idea/**/contentModel.xml - -# Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml - -# Gradle -.idea/**/gradle.xml -.idea/**/libraries - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/modules.xml -# .idea/*.iml -# .idea/modules - -# CMake -cmake-build-*/ - -# Mongo Explorer plugin -.idea/**/mongoSettings.xml - -# File-based project format -*.iws - -# IntelliJ -out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Cursive Clojure plugin -.idea/replstate.xml - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties - -# Editor-based Rest Client -.idea/httpRequests - -# Android studio 3.1+ serialized cache file -.idea/caches/build_file_checksums.ser - -### PhpStorm+all Patch ### -# Ignores the whole .idea folder and all .iml files -# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 - -.idea/ - -# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 - -*.iml -modules.xml -.idea/misc.xml -*.ipr - -# Sonarlint plugin -.idea/sonarlint - -# End of https://www.gitignore.io/api/composer,phpstorm+all - -### NATTRAK Application ### -.env -pilots.json \ No newline at end of file diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 3514e01..0000000 --- a/Dockerfile +++ /dev/null @@ -1,60 +0,0 @@ -FROM alpine:latest - -# Set the locale -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US:en -ENV LC_ALL en_US.UTF-8 -WORKDIR /application -RUN apk --update add \ - php7 \ - php7-bcmath \ - php7-dom \ - php7-ctype \ - php7-curl \ - php7-fpm \ - php7-gd \ - php7-iconv \ - php7-intl \ - php7-json \ - php7-mbstring \ - php7-mcrypt \ - php7-fileinfo \ - php7-mysqlnd \ - php7-opcache \ - php7-openssl \ - php7-pdo \ - php7-pdo_mysql \ - php7-pdo_pgsql \ - php7-pdo_sqlite \ - php7-phar \ - php7-posix \ - php7-session \ - php7-soap \ - php7-xml \ - php7-zip \ - php7-tokenizer \ - php7-xmlwriter \ - git \ - php7-simplexml \ - curl \ - npm \ - nginx \ - supervisor \ - && rm -rf /var/cache/apk/* - -COPY . /application - -COPY docker_files/php.ini /etc/php7/conf.d/50-setting.ini -COPY docker_files/php-fpm.conf /etc/php7/php-fpm.conf -COPY docker_files/nginx.conf /etc/nginx/nginx.conf -COPY docker_files/.env /application/.env -COPY docker_files/start_nginx.sh /application/start_nginx.sh -COPY docker_files/supervisord.conf /etc/supervisor/conf.d/supervisord.conf - - - -RUN cd /application && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin -- --filename=composer && composer install && chown -R nobody:nobody /application && chmod +x /application/start_nginx.sh - -EXPOSE 80 - -CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] diff --git a/README.md b/README.md deleted file mode 100644 index 10e54d2..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# NAT-TRAK -Web application for VATSIM North Atlantic Air Traffic Management -

diff --git a/admin.php b/admin.php deleted file mode 100644 index 5df17b7..0000000 --- a/admin.php +++ /dev/null @@ -1,215 +0,0 @@ -prepare('DELETE FROM controllers WHERE id = ?'); - $stmt->execute([$id]); - } catch (Exception $e) { - } -} - -if (isset($_POST['edit'])) { - try { - $level = $_POST['level']; - $id = $_POST['id']; - $sql = 'UPDATE controllers SET permission=? WHERE id=?'; - $pdo->prepare($sql)->execute([$level, $id]); - } catch (Exception $e) { - } -} - -if (isset($_POST['add'])) { - try { - $controller_cid = $_POST['controller_cid']; - $controller_name = $_POST['controller_name']; - $level = $_POST['level']; - - $sql = 'INSERT INTO controllers (cid, name, permission) VALUES (?,?,?)'; - $pdo->prepare($sql)->execute([$controller_cid, $controller_name, $level]); - } catch (Exception $e) { - } -} - -if (hasPerm($cid) >= "3") { -?> - - - -
-
- - -

- Manage Users -


- - - - - - - - - - - - - - - - - - query('SELECT * FROM controllers'); - while ($row = $stmt->fetch()) { - ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CIDNamePermission Level
- 3) { } else { - ?> - - - - 3) { - } else { - ?> -
- - -
- -
- -
- - - - - - -
-
- - - - diff --git a/clearance_data.php b/clearance_data.php deleted file mode 100644 index e6fb7db..0000000 --- a/clearance_data.php +++ /dev/null @@ -1,48 +0,0 @@ -prepare("SELECT * FROM clearances"); - $stmt->execute(); -} else if($nat == 'All' && $status != 'all') { - $stmt = $pdo->prepare("SELECT * FROM clearances WHERE rep_status = ?"); - $stmt->execute([$status]); -} else if($nat != 'All' && $status == 'all') { - $stmt = $pdo->prepare("SELECT * FROM clearances WHERE nat = ?"); - $stmt->execute([$nat]); -} else { - $stmt = $pdo->prepare("SELECT * FROM clearances WHERE rep_status = ? and nat = ?"); - $stmt->execute([$status, $nat]); -} -while ($row = $stmt->fetch()) -{ -?> - - - - - - - - - - - - - - - - - diff --git a/composer.json b/composer.json deleted file mode 100644 index 1424820..0000000 --- a/composer.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "require": { - "vlucas/phpdotenv": "^5.4" - }, - "require-dev": { - "symfony/dotenv": "^4.2" - } -} diff --git a/composer.lock b/composer.lock deleted file mode 100644 index 4468d30..0000000 --- a/composer.lock +++ /dev/null @@ -1,550 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "3834e88df05a23a99ff685cb22ecfaa2", - "packages": [ - { - "name": "graham-campbell/result-type", - "version": "v1.0.4", - "source": { - "type": "git", - "url": "https://github.com/GrahamCampbell/Result-Type.git", - "reference": "0690bde05318336c7221785f2a932467f98b64ca" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/0690bde05318336c7221785f2a932467f98b64ca", - "reference": "0690bde05318336c7221785f2a932467f98b64ca", - "shasum": "" - }, - "require": { - "php": "^7.0 || ^8.0", - "phpoption/phpoption": "^1.8" - }, - "require-dev": { - "phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8" - }, - "type": "library", - "autoload": { - "psr-4": { - "GrahamCampbell\\ResultType\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - } - ], - "description": "An Implementation Of The Result Type", - "keywords": [ - "Graham Campbell", - "GrahamCampbell", - "Result Type", - "Result-Type", - "result" - ], - "support": { - "issues": "https://github.com/GrahamCampbell/Result-Type/issues", - "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.0.4" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type", - "type": "tidelift" - } - ], - "time": "2021-11-21T21:41:47+00:00" - }, - { - "name": "phpoption/phpoption", - "version": "1.8.1", - "source": { - "type": "git", - "url": "https://github.com/schmittjoh/php-option.git", - "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", - "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", - "shasum": "" - }, - "require": { - "php": "^7.0 || ^8.0" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", - "phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.8-dev" - } - }, - "autoload": { - "psr-4": { - "PhpOption\\": "src/PhpOption/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Johannes M. Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh" - }, - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - } - ], - "description": "Option Type for PHP", - "keywords": [ - "language", - "option", - "php", - "type" - ], - "support": { - "issues": "https://github.com/schmittjoh/php-option/issues", - "source": "https://github.com/schmittjoh/php-option/tree/1.8.1" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", - "type": "tidelift" - } - ], - "time": "2021-12-04T23:24:31+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.24.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "30885182c981ab175d4d034db0f6f469898070ab" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", - "reference": "30885182c981ab175d4d034db0f6f469898070ab", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-10-20T20:35:02+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.24.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", - "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-mbstring": "*" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.24.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-11-30T18:21:41+00:00" - }, - { - "name": "symfony/polyfill-php80", - "version": "v1.24.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/57b712b08eddb97c762a8caa32c84e037892d2e9", - "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.24.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-09-13T13:58:33+00:00" - }, - { - "name": "vlucas/phpdotenv", - "version": "v5.4.1", - "source": { - "type": "git", - "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "264dce589e7ce37a7ba99cb901eed8249fbec92f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/264dce589e7ce37a7ba99cb901eed8249fbec92f", - "reference": "264dce589e7ce37a7ba99cb901eed8249fbec92f", - "shasum": "" - }, - "require": { - "ext-pcre": "*", - "graham-campbell/result-type": "^1.0.2", - "php": "^7.1.3 || ^8.0", - "phpoption/phpoption": "^1.8", - "symfony/polyfill-ctype": "^1.23", - "symfony/polyfill-mbstring": "^1.23.1", - "symfony/polyfill-php80": "^1.23.1" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", - "ext-filter": "*", - "phpunit/phpunit": "^7.5.20 || ^8.5.21 || ^9.5.10" - }, - "suggest": { - "ext-filter": "Required to use the boolean validator." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.4-dev" - } - }, - "autoload": { - "psr-4": { - "Dotenv\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Vance Lucas", - "email": "vance@vancelucas.com", - "homepage": "https://github.com/vlucas" - } - ], - "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", - "keywords": [ - "dotenv", - "env", - "environment" - ], - "support": { - "issues": "https://github.com/vlucas/phpdotenv/issues", - "source": "https://github.com/vlucas/phpdotenv/tree/v5.4.1" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv", - "type": "tidelift" - } - ], - "time": "2021-12-12T23:22:04+00:00" - } - ], - "packages-dev": [ - { - "name": "symfony/dotenv", - "version": "v4.4.37", - "source": { - "type": "git", - "url": "https://github.com/symfony/dotenv.git", - "reference": "fcedd6d382b3afc3e1e786aa4e4fc4cf06f564cf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/dotenv/zipball/fcedd6d382b3afc3e1e786aa4e4fc4cf06f564cf", - "reference": "fcedd6d382b3afc3e1e786aa4e4fc4cf06f564cf", - "shasum": "" - }, - "require": { - "php": ">=7.1.3" - }, - "require-dev": { - "symfony/process": "^3.4.2|^4.0|^5.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Dotenv\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Registers environment variables from a .env file", - "homepage": "https://symfony.com", - "keywords": [ - "dotenv", - "env", - "environment" - ], - "support": { - "source": "https://github.com/symfony/dotenv/tree/v4.4.37" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-01-02T09:41:36+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [], - "plugin-api-version": "2.2.0" -} diff --git a/cron/clearance_delete.php b/cron/clearance_delete.php deleted file mode 100644 index 8838081..0000000 --- a/cron/clearance_delete.php +++ /dev/null @@ -1,6 +0,0 @@ -prepare('DELETE FROM `clearances` WHERE request_time < NOW() - INTERVAL 2 HOUR'); -$stmt->execute([]); diff --git a/cron/getnats.php b/cron/getnats.php deleted file mode 100644 index bd7a895..0000000 --- a/cron/getnats.php +++ /dev/null @@ -1,60 +0,0 @@ -'; -} - -// Copy new nats file -if (!copy($src, $nats)) { - echo 'Failed to copy'; -} else { - echo 'Copy successful'; -} - -// Now we handle the database - -require __DIR__ . '/../includes/connection.php'; - -/////////////////////////////////////////////////////// - -// Empty the current table -$sql = 'TRUNCATE TABLE `nats`'; -$statement = $pdo->prepare($sql); -$statement->execute(); - -/////////////////////////////////////////////////////// - -// sort the JSON -$json = file_get_contents('../nats.json'); -$decoded = json_decode($json); - -foreach ($decoded as $nat) { - - $route = ''; - foreach($nat->route->nodes as $node) { - $route .= $node->ident . ' '; - } - - $route = trim($route); - - $validFrom = strtotime($nat->validFrom); - $validFrom = date('Y-m-d H:i:s', $validFrom); - - $validTo = strtotime($nat->validTo); - $validTo = date('Y-m-d H:i:s', $validTo); - - // Insert into dB - $sql = 'INSERT INTO nats (identifier, validFrom, validTo, route) VALUES (?,?,?,?)'; - $pdo->prepare($sql)->execute([$nat->ident, $validFrom, $validTo, $route]); -} - -/////////////////////////////////////////////////////// diff --git a/cron/posrep_delete.php b/cron/posrep_delete.php deleted file mode 100644 index dd4a27c..0000000 --- a/cron/posrep_delete.php +++ /dev/null @@ -1,6 +0,0 @@ -prepare('DELETE FROM `position_reports` WHERE report_time < NOW() - INTERVAL 8 HOUR'); -$stmt->execute([]); diff --git a/cron/report.php b/cron/report.php deleted file mode 100644 index 97f5c45..0000000 --- a/cron/report.php +++ /dev/null @@ -1,6 +0,0 @@ -prepare('DELETE FROM `sessions` WHERE logintime < NOW() - INTERVAL 12 HOUR'); -$stmt->execute([]); diff --git a/cron/session.php b/cron/session.php deleted file mode 100644 index 3b513a8..0000000 --- a/cron/session.php +++ /dev/null @@ -1,6 +0,0 @@ -prepare('DELETE FROM `sessions` WHERE logintime < NOW() - INTERVAL 24 HOUR'); -$stmt->execute([]); diff --git a/cron/users.php b/cron/users.php deleted file mode 100644 index 378e886..0000000 --- a/cron/users.php +++ /dev/null @@ -1,48 +0,0 @@ -prepare('DELETE FROM `controllers` WHERE `permission` < 3'); -$stmt->execute([]); - -$insert_sql = 'INSERT INTO controllers (name, cid, permission) VALUES (?,?,?)'; - -/////////// Shanwick Cron /////////// -$json = file_get_contents('https://www.vatsim.uk/api/validations?position=EGGX'); -$decoded = json_decode($json); - -foreach ($decoded->validated_members as $validated_member) { - - $stmt = $pdo->prepare('SELECT count(*) FROM controllers WHERE cid = ?'); - $stmt->execute([$validated_member->id]); - $count = $stmt->fetchColumn(); - - if ($count == '0') { - $pdo->prepare($insert_sql)->execute([$validated_member->name, $validated_member->id, '2']); - } -} - -/////////// Gander Cron /////////// -$json = file_get_contents('https://ganderoceanic.com/api/roster'); -$decoded = json_decode($json, true); - -// loop thru the data -foreach ($decoded as $member) { - - if($member['certification'] == 'certified') { - - $stmt = $pdo->prepare('SELECT count(*) FROM controllers WHERE cid = ?'); - $stmt->execute([$member['cid']]); - $count = $stmt->fetchColumn(); - if ($count == '0') { - - $api_json = file_get_contents('https://api.vatsim.net/api/ratings/' . (string)$member['cid']); - $api_decoded = json_decode($api_json, true); - - $name = $api_decoded['name_first'] . ' ' . $api_decoded['name_last']; - - $pdo->prepare($insert_sql)->execute([$name, $member['cid'], '2']); - } - } -} diff --git a/css/nattrak.css b/css/nattrak.css deleted file mode 100644 index b063c78..0000000 --- a/css/nattrak.css +++ /dev/null @@ -1,62 +0,0 @@ -body { - font-family: 'Open Sans', sans-serif; - font-size: 14px; - background-color: #06163a; - background-image: url('../img/oceanic_bg.png'); - background-repeat: no-repeat; - background-position: top; - background-size: cover; - margin-left: 0; - margin-right: 0; - margin-top: 0; - margin-bottom: 0; - color: #fff; -} - -.clouds { - position: relative; - z-index: -1; - background-image: url('../img/cloudsbg.png'); - background-repeat: no-repeat; - background-size: cover; - height: 370px; -} - -.gradient { - position: relative; - z-index: -2; - background-image: url('../img/gradient.png'); - background-repeat: no-repeat; - background-size: cover; - height: 450px; -} - -.logo { - padding-left: 100px; - padding-top: 100px; -} - -.menu { - color: #06163a; - text-transform: uppercase; - font-size: 14px; -} - -.inline { - display: inline; -} - -.feather { - width: 17px; - height: 17px; - padding-bottom: 3px; -} - -.inside { - color: #000; -} - -.header { - font-size: 30px; - font-weight: 300; -} diff --git a/datafile.php b/datafile.php deleted file mode 100644 index f1ff0fd..0000000 --- a/datafile.php +++ /dev/null @@ -1,24 +0,0 @@ - "; - // echo $callsign . "
"; - // echo $type . "
"; - // echo $altitude . "
"; - // echo $speed . "
"; - // echo $arrival . "


"; - } - - echo $callsign; - -?> \ No newline at end of file diff --git a/deleteclearance.php b/deleteclearance.php deleted file mode 100644 index 139d191..0000000 --- a/deleteclearance.php +++ /dev/null @@ -1,22 +0,0 @@ -= "2") { - -if (isset($_GET['id'])) { - $report_id = $_GET['id']; - - if (hasPerm($cid) >= 2) { - try { - $stmt = $pdo->prepare('DELETE FROM clearances WHERE id = ?'); - $stmt->execute([$report_id]); - - header('Location: delivery.php'); - } catch (Exception $e) { - echo 'Something went wrong.'; - } - } -} - -} diff --git a/deletereport.php b/deletereport.php deleted file mode 100644 index 8a66252..0000000 --- a/deletereport.php +++ /dev/null @@ -1,22 +0,0 @@ -= "2") { - -if (isset($_GET['id'])) { - $report_id = $_GET['id']; - - if (hasPerm($cid) >= 2) { - try { - $stmt = $pdo->prepare('DELETE FROM position_reports WHERE id = ?'); - $stmt->execute([$report_id]); - - header('Location: reports.php'); - } catch (Exception $e) { - echo 'Something went wrong.'; - } - } -} - -} diff --git a/delivery.php b/delivery.php deleted file mode 100644 index 5771734..0000000 --- a/delivery.php +++ /dev/null @@ -1,135 +0,0 @@ -= "3") { - -?> - - - -
-
- - -

- Oceanic Clearance Delivery -


- -
-
- - -
- -
-
- -
- -
- -
- - -
-
- -

- Clearances -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 AircraftNAT/Route 
StatusCallsignTrackRouteEntry PointETAFLMachTMIRequest Time
- - - - - - -
-
- - - - diff --git a/docker_files/nginx.conf b/docker_files/nginx.conf deleted file mode 100644 index 41a7fa6..0000000 --- a/docker_files/nginx.conf +++ /dev/null @@ -1,35 +0,0 @@ -worker_processes 4; - -events { - worker_connections 1024; -} -http { - include /etc/nginx/mime.types; - default_type application/octet-stream; - access_log /var/log/nginx/access.log; - charset utf-8; - keepalive_timeout 65; - server_tokens off; - tcp_nopush on; - tcp_nodelay on; - server { - listen 80; - root /application/; - index index.php index.html index.htm; - location / { - try_files $uri $uri/ /index.php?q=$uri&$args; - } - - location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ { - access_log on; - log_not_found on; - } - - location ~ ^/.+\.php(/|$) { - fastcgi_pass unix:/var/run/php7-fpm.sock; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - } - } -} - diff --git a/docker_files/php-fpm.conf b/docker_files/php-fpm.conf deleted file mode 100644 index 2a4394c..0000000 --- a/docker_files/php-fpm.conf +++ /dev/null @@ -1,16 +0,0 @@ -[www] -user = nobody -group = nobody -listen.owner = nginx -listen.group = nginx -listen.mode = 0660 -listen = /var/run/php7-fpm.sock -chdir = /application -pm = dynamic -pm.max_children = 100 -pm.start_servers = 10 -pm.min_spare_servers = 10 -pm.max_spare_servers = 15 -pm.max_requests = 500 -clear_env = No -catch_workers_output = Yes diff --git a/docker_files/php.ini b/docker_files/php.ini deleted file mode 100644 index c12a4b7..0000000 --- a/docker_files/php.ini +++ /dev/null @@ -1,3 +0,0 @@ -date.timezone = "UTC" -short_open_tag = On -session.auto_start = Off diff --git a/docker_files/start_nginx.sh b/docker_files/start_nginx.sh deleted file mode 100644 index 39f39b4..0000000 --- a/docker_files/start_nginx.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -mkdir /var/run/nginx -nginx -g 'daemon off;' diff --git a/docker_files/supervisord.conf b/docker_files/supervisord.conf deleted file mode 100644 index 4ec3188..0000000 --- a/docker_files/supervisord.conf +++ /dev/null @@ -1,23 +0,0 @@ -[supervisord] -nodaemon=true -logfile=/dev/null -logfile_maxbytes=0 -pidfile=/run/supervisord.pid - -[program:php-fpm] -command=php-fpm7 -F -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 -autorestart=false -startretries=0 - -[program:nginx] -command=/application/start_nginx.sh -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 -autorestart=false -startretries=0 diff --git a/edit_clearance.php b/edit_clearance.php deleted file mode 100644 index fc68f79..0000000 --- a/edit_clearance.php +++ /dev/null @@ -1,319 +0,0 @@ -= "3") { - - if (isset($_GET['id'])) { - $report_id = $_GET['id']; - - if (isset($_POST['submit'])) { - $time = date('Y-m-d H:i:s'); - $via = "$cid"; - $rep_status ="cleared"; - - $callsign = oceanicCallsign($cid); - if($callsign = '') { - $callsign = 'EGGX'; - } - - try { - $sql = 'UPDATE clearances SET flight_level=?, mach=?, nat=?, random_route=?, entry_fix=?, estimating_time=?, tmi=?, rep_status=?, controller=?, controller_cid=?, clearance_time=?, freestyle=? WHERE id=?'; - $pdo->prepare($sql)->execute([$_POST['flight_level'], $_POST['mach'], $_POST['nat'], $_POST['random_route'], $_POST['entry_fix'], $_POST['estimating_time'], $_POST['tmi'], $rep_status, $callsign, $via, $time, $_POST['freestyle'], $report_id]); ?> - -
-
- - - -
-
- - - -
-
- - - -
-
- - - - -
-
- - -

- Manage Clearance -


- - prepare('SELECT * FROM clearances WHERE id = ?'); - $stmt->execute([$report_id]); - while ($row = $stmt->fetch()) { - ?> - -
- -

- Clearance Data -

- - -
- -
- -
- Looks good! -
-
- - -
- - - -
- Select NAT Track -
-
- Looks good! -
- -
- -
- -
- Looks good! -
-
- -
- - -
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- - - - - -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- - -
- -
- Looks good! -
-
- -
- - -
- -
- -
- Looks good! -
-
- - -
- -
- - -
- -

- - prepare('SELECT * FROM clearances WHERE id = ?'); - $stmt->execute([$report_id]); - while ($row = $stmt->fetch()) { ?> - - - - .msg clears you to via Random Routing; . From maintain Flight Level , Mach . - - .msg clears you to via Track , from maintain Flight Level , Mach . - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - prepare("SELECT * FROM clearances WHERE id != ? AND nat = ? order by estimating_time asc"); - $stmt->execute([$report_id, $nat]); - while ($row = $stmt->fetch()) { - - ?> - - - - - - - - - - - - - - - - - - - - - -
 AircraftNAT/Route 
StatusCallsignTrackRouteEntry PointETAFLMachTMIRequest Time
- - - - - - - - - - - - - - - - - - -
-
- - - - diff --git a/edit_report.php b/edit_report.php deleted file mode 100644 index 826a0b1..0000000 --- a/edit_report.php +++ /dev/null @@ -1,291 +0,0 @@ -= "3") { - - if (isset($_GET['id'])) { - $report_id = $_GET['id']; - - if (isset($_POST['submit'])) { - $time = date('Hi e'); - $via = "Controller - $cid"; - - try { - $sql = 'UPDATE position_reports SET track=?, selcal=?, type=?, nat_reporting_fix=?, nat_reporting_at_time=?, nat_reporting_at_fl=?, nat_reporting_at_mach=?, nat_next_fix=?, nat_next_at_time=?, nat_next_thereafter=?, destination=?, request_mach=?, request_fl=?, controller_restriction=?, other=?, amendment_time=?, via=?, `read`=false WHERE id=?'; - $pdo->prepare($sql)->execute([$_POST['track'], $_POST['selcal'], $_POST['type'], $_POST['nat_reporting_fix'], $_POST['nat_reporting_at_time'], $_POST['nat_reporting_at_fl'], $_POST['nat_reporting_at_mach'], $_POST['nat_next_fix'], $_POST['nat_next_at_time'], $_POST['nat_next_thereafter'], $_POST['destination'], $_POST['request_mach'], $_POST['request_fl'], $_POST['controller_restriction'], $_POST['other'], $time, $via, $report_id]); - ?> - -
-
- - - -
-
- - - -
-
- - - -
-
- - - - - - -
-
- - -

- Edit Report -


- - prepare('SELECT * FROM position_reports WHERE id = ?'); - $stmt->execute([$report_id]); - while ($row = $stmt->fetch()) { - ?> - -
- -

- Aircraft Data -

-
- -
- - - -
- Select your NAT Track -
-
- Looks good! -
- -
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
-
- -

- NAT Entry -

-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
-
- - -

- NAT Reporting -

-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -

- NAT Next Fix Estimation -

-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -

- Destination & Requests -

-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -

- Controller Added Restrictions and Comments -

-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -
- - -
- - - - - - - - -
-
- - - - diff --git a/environment.php b/environment.php deleted file mode 100644 index 76e1621..0000000 --- a/environment.php +++ /dev/null @@ -1,7 +0,0 @@ -load(__DIR__.'/.env'); diff --git a/footer.php b/footer.php deleted file mode 100644 index eb03778..0000000 --- a/footer.php +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - diff --git a/header.php b/header.php deleted file mode 100644 index a8cd071..0000000 --- a/header.php +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - natTRAK :: Welcome - - - - - -
-
- -
-
- -
-
-
- -
-
-
- - - -
-
diff --git a/img/cloudsbg.png b/img/cloudsbg.png deleted file mode 100644 index 11cc777..0000000 Binary files a/img/cloudsbg.png and /dev/null differ diff --git a/img/gradient.png b/img/gradient.png deleted file mode 100644 index e0c94ec..0000000 Binary files a/img/gradient.png and /dev/null differ diff --git a/img/logo.png b/img/logo.png deleted file mode 100644 index 2f6f677..0000000 Binary files a/img/logo.png and /dev/null differ diff --git a/img/newsandnotams.png b/img/newsandnotams.png deleted file mode 100644 index 52c1816..0000000 Binary files a/img/newsandnotams.png and /dev/null differ diff --git a/img/oceanic_bg.png b/img/oceanic_bg.png deleted file mode 100644 index a2fda50..0000000 Binary files a/img/oceanic_bg.png and /dev/null differ diff --git a/includes/connection.php b/includes/connection.php deleted file mode 100644 index b2b8935..0000000 --- a/includes/connection.php +++ /dev/null @@ -1,19 +0,0 @@ -load(); - -$host = $_ENV['MYSQL_HOST']; -$db = $_ENV['MYSQL_DB']; -$username = $_ENV['MYSQL_USER']; -$pass = $_ENV['MYSQL_PASS']; - -$dsn = "mysql:host=$host;dbname=$db"; -$opt = [ - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, - PDO::ATTR_EMULATE_PREPARES => false, -]; -$pdo = new PDO($dsn, $username, $pass, $opt); -?> \ No newline at end of file diff --git a/includes/functions.php b/includes/functions.php deleted file mode 100644 index 334aad8..0000000 --- a/includes/functions.php +++ /dev/null @@ -1,200 +0,0 @@ -prepare('SELECT * FROM controllers WHERE cid = ?'); - $stmt->execute([$cid]); - $row = $stmt->fetch(); - - return $row['permission']; -} - -function getNAT() -{ - - $cookie_name = 'nattrak'; - if (isset($_COOKIE[$cookie_name])) { - require 'connection.php'; - - $sid = $_COOKIE[$cookie_name]; - - $stmt = $pdo->prepare('SELECT * FROM sessions WHERE sid = ?'); - $stmt->execute([$sid]); - $row = $stmt->fetch(); - - return $row['nat']; - } - -} - -function setStatus($status,$cid,$track) -{ - - require 'connection.php'; - - $sql = 'UPDATE sessions SET rep_status=?,nat=? WHERE cid=?'; - $pdo->prepare($sql)->execute([$status, $track, $cid]); -} - - -function getStatus() -{ - - $cookie_name = 'nattrak'; - if (isset($_COOKIE[$cookie_name])) { - require 'connection.php'; - - $sid = $_COOKIE[$cookie_name]; - - $stmt = $pdo->prepare('SELECT * FROM sessions WHERE sid = ?'); - $stmt->execute([$sid]); - $row = $stmt->fetch(); - - return $row['rep_status']; - } - -} - -function setNAT($nat, $cid) -{ - require 'connection.php'; - - $sql = 'UPDATE sessions SET nat=? WHERE cid=?'; - $pdo->prepare($sql)->execute([$nat, $cid]); -} - -function setCID($cid) -{ - require 'connection.php'; - - // Set the data into the dB - - $sql = 'INSERT INTO sessions (cid) VALUES (?)'; - $pdo->prepare($sql)->execute([$cid]); -} - -function setSession($cid, $name, $sessionid, $logintime) -{ - require 'connection.php'; - - // Set the Cookie with the Session ID - $cookie_name = 'nattrak'; - setcookie($cookie_name, $sessionid, time() + 86400, '/'); // 86400 = 1 day - - // Set the data into the dB - - $sql = 'INSERT INTO sessions (cid, name, sid, logintime) VALUES (?,?,?,?)'; - $pdo->prepare($sql)->execute([$cid, $name, $sessionid, $logintime]); -} - -function getSession() -{ - $cookie_name = 'nattrak'; - if (isset($_COOKIE[$cookie_name])) { - require 'connection.php'; - - $sid = $_COOKIE[$cookie_name]; - $stmt = $pdo->prepare('SELECT * FROM sessions WHERE sid = ?'); - $stmt->execute([$sid]); - $row = $stmt->fetch(); - - return $row['sid']; - } -} - -function getCID($sid) -{ - require 'connection.php'; - - $stmt = $pdo->prepare('SELECT * FROM sessions WHERE sid = ?'); - $stmt->execute([$sid]); - $row = $stmt->fetch(); - - return $row['cid']; -} - -function getUser($cid) -{ - require 'connection.php'; - - $stmt = $pdo->prepare('SELECT * FROM controllers WHERE cid = ?'); - $stmt->execute([$cid]); - $row = $stmt->fetch(); - - return $row['name']; -} - -function destroySes($sid) -{ - require 'connection.php'; - - setcookie('NatTrak', '', time() - 86400); - - $stmt = $pdo->prepare('DELETE FROM sessions WHERE sid = ?'); - $stmt->execute([$sid]); -} - -function isLoggedIn($sid) -{ - require 'connection.php'; - - $stmt = $pdo->prepare("SELECT count(*) FROM sessions WHERE sid = ?"); - $stmt->execute([$sid]); - $count = $stmt->fetchColumn(); - if ($count == '1') { - - $stmt = $pdo->prepare('SELECT * FROM sessions WHERE sid = ?'); - $stmt->execute([$sid]); - $row = $stmt->fetch(); - - // $cid = $row['cid']; - return $cid; - - } -} - -function isPilotConnectedToVATSIM($cid) -{ - - $json = file_get_contents('https://data.vatsim.net/v3/vatsim-data.json'); - $decoded = json_decode($json); - - foreach ($decoded->pilots as $user) { - if ($user->cid == $cid) { - return true; - } - } -} - - -function isControllerOceanic($cid) -{ - - $json = file_get_contents('https://data.vatsim.net/v3/vatsim-data.json'); - $decoded = json_decode($json); - - foreach ($decoded->controllers as $user) { - if ($user->cid == $cid && (substr($user->callsign, 0, 4) == "EGGX" || substr($user->callsign, 0, 4) == "CZQX" || substr($user->callsign, 0, 4) == "CZQM" || substr($user->callsign, 0, 4) == "CZQO" || substr($user->callsign, 0, 4) == "NAT_")) { - return true; - } - } - return false; -} - - - -function oceanicCallsign($cid) -{ - $json = file_get_contents('https://data.vatsim.net/v3/vatsim-data.json'); - $decoded = json_decode($json); - - foreach ($decoded->controllers as $user) { - if ($user->cid == $cid) { - return substr($user->callsign, 0, 4); - } - } - - return ''; -} diff --git a/index.php b/index.php deleted file mode 100644 index c2ff414..0000000 --- a/index.php +++ /dev/null @@ -1,24 +0,0 @@ - - - - -query('SELECT * FROM newsnotams ORDER BY date DESC'); -while ($row = $stmt->fetch()) { - $date = new DateTime($row['date']); ?> - -

-

- - -

- - Posted format('F jS, Y'); ?> by -
-
- - - - diff --git a/logout.php b/logout.php deleted file mode 100644 index 949271d..0000000 --- a/logout.php +++ /dev/null @@ -1,15 +0,0 @@ -prepare('DELETE FROM sessions WHERE sid = ?'); -$stmt->execute([$sid]); - -setcookie('nattrak', '', 1); -unset($_COOKIE['nattrak']); - -header('Location: index.php'); diff --git a/manual_report.php b/manual_report.php deleted file mode 100644 index d9d823b..0000000 --- a/manual_report.php +++ /dev/null @@ -1,279 +0,0 @@ -= "3") { - - -if (isset($_POST['submit'])) { - $time = date('Hi e'); - $via = 'Controller'; - - try { - $sql = 'INSERT INTO position_reports (track, cid, callsign, selcal, type, nat_entry, nat_entry_eta, nat_reporting_fix, nat_reporting_at_time, nat_reporting_at_fl, nat_reporting_at_mach, nat_next_fix, nat_next_at_time, nat_next_thereafter, destination, request_mach, request_fl, controller_restriction, other, report_time, via) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'; - $pdo->prepare($sql)->execute([$_POST['track'], $cid, $_POST['callsign'], $_POST['selcal'], $_POST['type'], $_POST['nat_entry'], $_POST['nat_entry_eta'], $_POST['nat_reporting_fix'], $_POST['nat_reporting_at_time'], $_POST['nat_reporting_at_fl'], $_POST['nat_reporting_at_mach'], $_POST['nat_next_fix'], $_POST['nat_next_at_time'], $_POST['nat_next_thereafter'], $_POST['destination'], $_POST['request_mach'], $_POST['request_fl'], $_POST['controller_restriction'], $_POST['other'], $time, $via]); - ?> - -
-
- - - -
-
- - - -
-
- - - -
-
- - - - - -
-
- - -

- Submit Manual Report -


- -
- -

- Aircraft Data -

-
- -
- - - -
- Select your NAT Track -
-
- Looks good! -
- -
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
-
- - -

- NAT Entry -

-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
-
- - -

- NAT Reporting -

-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -

- NAT Next Fix Estimation -

-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -

- Destination & Requests -

-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -

- Controller Added Restrictions and Comments -

-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -
- - -
- - - -
-
- - - - diff --git a/markread.php b/markread.php deleted file mode 100644 index 1739b4d..0000000 --- a/markread.php +++ /dev/null @@ -1,16 +0,0 @@ -= 2) { - try { - $stmt = $pdo->prepare('UPDATE `position_reports` SET `read`=true WHERE `id`=?'); - $stmt->execute([$report_id]); - } catch (Exception $e) { - echo 'Something went wrong.'; - } - } -} diff --git a/nats.json b/nats.json deleted file mode 100644 index 31b6f16..0000000 --- a/nats.json +++ /dev/null @@ -1 +0,0 @@ -[{"ident":"A","route":{"nodes":[{"id":5479547,"ident":"DINIM","type":"FIX","lat":51,"lon":-15},{"id":243783,"ident":"51/20","type":"LATLON","lat":51,"lon":-20},{"id":243750,"ident":"51/30","type":"LATLON","lat":51,"lon":-30},{"id":243743,"ident":"51/40","type":"LATLON","lat":51,"lon":-40},{"id":243742,"ident":"49/50","type":"LATLON","lat":49,"lon":-50},{"id":5443934,"ident":"JOOPY","type":"FIX","lat":48.5,"lon":-52}],"eastLevels":[],"westLevels":["330","340","350","360","370","380","390"]},"validFrom":"2020-04-02T11:30:00.000Z","validTo":"2020-04-02T19:00:00.000Z"},{"ident":"A","route":{"nodes":[{"id":5479547,"ident":"DINIM","type":"FIX","lat":51,"lon":-15},{"id":243783,"ident":"51/20","type":"LATLON","lat":51,"lon":-20},{"id":243810,"ident":"50/30","type":"LATLON","lat":50,"lon":-30},{"id":243749,"ident":"50/40","type":"LATLON","lat":50,"lon":-40},{"id":243748,"ident":"48/50","type":"LATLON","lat":48,"lon":-50},{"id":5444358,"ident":"NICSO","type":"FIX","lat":47.5,"lon":-52}],"eastLevels":[],"westLevels":["350","360","370","380","390"]},"validFrom":"2020-04-03T11:30:00.000Z","validTo":"2020-04-03T19:00:00.000Z"},{"ident":"Z","route":{"nodes":[{"id":5443770,"ident":"HOIST","type":"FIX","lat":55.0333,"lon":-57},{"id":243573,"ident":"57/50","type":"LATLON","lat":57,"lon":-50},{"id":243781,"ident":"59/40","type":"LATLON","lat":59,"lon":-40},{"id":243776,"ident":"60/30","type":"LATLON","lat":60,"lon":-30},{"id":243729,"ident":"58/20","type":"LATLON","lat":58,"lon":-20},{"id":5484667,"ident":"PIKIL","type":"FIX","lat":56,"lon":-15},{"id":5485864,"ident":"SOVED","type":"FIX","lat":56,"lon":-14}],"eastLevels":["320","340","360","370","380","390","400"],"westLevels":[]},"validFrom":"2020-04-02T01:00:00.000Z","validTo":"2020-04-02T08:00:00.000Z"},{"ident":"Z","route":{"nodes":[{"id":5444348,"ident":"NEEKO","type":"FIX","lat":52.4,"lon":-55.8333},{"id":243801,"ident":"54/50","type":"LATLON","lat":54,"lon":-50},{"id":244186,"ident":"56/40","type":"LATLON","lat":56,"lon":-40},{"id":243830,"ident":"57/30","type":"LATLON","lat":57,"lon":-30},{"id":243779,"ident":"57/20","type":"LATLON","lat":57,"lon":-20},{"id":5484667,"ident":"PIKIL","type":"FIX","lat":56,"lon":-15},{"id":5485864,"ident":"SOVED","type":"FIX","lat":56,"lon":-14}],"eastLevels":["320","330","340","350","360","370","380","390","400"],"westLevels":[]},"validFrom":"2020-04-03T01:00:00.000Z","validTo":"2020-04-03T08:00:00.000Z"}] \ No newline at end of file diff --git a/news.php b/news.php deleted file mode 100644 index 7f454ca..0000000 --- a/news.php +++ /dev/null @@ -1,199 +0,0 @@ -prepare('DELETE FROM newsnotams WHERE id = ?'); - $stmt->execute([$id]); - } catch (Exception $e) { - } -} - -if (isset($_POST['edit'])) { - try { - $title = $_POST['title']; - $body = $_POST['body']; - $id = $_POST['id']; - $sql = 'UPDATE newsnotams SET title=?, body=? WHERE id=?'; - $pdo->prepare($sql)->execute([$title, $body, $id]); - } catch (Exception $e) { - } -} - -if (isset($_POST['add'])) { - try { - $title = $_POST['title']; - $body = $_POST['body']; - $time = date("Y-m-d H:i:s"); - $user = getUser($cid); - $type = "news"; - - $sql = 'INSERT INTO newsnotams (type, title, body, user, date) VALUES (?,?,?,?,?)'; - $pdo->prepare($sql)->execute([$type, $title, $body, $user, $time]); - } catch (Exception $e) { - } -} - - -if (hasPerm($cid) > "3") { -?> - - - - - - - -
-
- - -

- Manage News -


- - - - - - - - - - - - - - - - - - query('SELECT * FROM newsnotams'); - while ($row = $stmt->fetch()) { - ?> - - - - - - - - - - - - - - - - - - - - - - -
ArticlePublish DatePublished By
- - - -
- - -
- -
- -
- - - - - -
- -
- - - - -
-
- - - - diff --git a/oceanic_clearance.php b/oceanic_clearance.php deleted file mode 100644 index a1bd286..0000000 --- a/oceanic_clearance.php +++ /dev/null @@ -1,341 +0,0 @@ -prepare('SELECT count(*) FROM clearances WHERE cid = ?'); - $stmt->execute([$cid]); - $count = $stmt->fetchColumn(); - - // $count = "0"; - - if ($count == '0') { - $request_time = date('Y-m-d H:i:s'); - $status = "pending"; - - $timepost = $_POST['estimating_time']; - $timeformat = substr_replace($timepost, ':', 2, 0); - - $nat = $_POST['nat']; - if (! $nat) { - $nat = 'RR'; - } - - try { - $sql = 'INSERT INTO clearances (cid, callsign, flight_level, mach, nat, random_route, entry_fix, estimating_time, tmi, rep_status, request_time, destination) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)'; - $pdo->prepare($sql)->execute([$cid, $_POST['callsign'], $_POST['flight_level'], $_POST['mach'], $nat, strtoupper($_POST['random_route']), strtoupper($_POST['entry_fix']), $timeformat, $_POST['tmi'], $status, $request_time, strtoupper($_POST['destination'])]); - ?> - -
-
- - - -
-
- - - -
-
- - - -
-
- - - - -
-
- - - -
-
- - - - - - - -
-
- - -

- Oceanic Clearance -


- - prepare('SELECT * FROM clearances WHERE cid = ? '); -$stmt->execute([$cid]); -$row = $stmt->fetch(); -//$count = $stmt->fetchColumn(); - -// $count = "0"; - -//if ($count == '0') { -if ($row['rep_status'] == '') { - - - - - $json = file_get_contents('https://data.vatsim.net/v3/vatsim-data.json'); - $decoded = json_decode($json,); - - foreach ($decoded->pilots as $user) { - - // $cid = $user['member']['cid']; - // $callsign = $user['callsign']; - // $type = $user['plan']['aircraft']; - // $altitude = $user['altitude']; - // $speed = $user['speed']; - // $arrival = $user['plan']['arrival']; - // - // echo $cid . "
"; - // echo $callsign . "
"; - // echo $type . "
"; - // echo $altitude . "
"; - // echo $speed . "
"; - // echo $arrival . "


"; - - - // $decoded[$callsign]['CID']; - - - - - - - if ($user->cid == $cid) { - // echo $objects['Callsign'];?> - -
- -

- Aircraft Data -

-
- - -
- -
- Looks good! -
-
-
- - -

- Routing -

-
- -
- - - -
- Select your NAT Track -
-
- Looks good! -
- -
- -
-
- - - - -
- -
- Looks good! -
-
- - -
-
-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- - -
- -
- Looks good! -
-
- - - -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- - - -
- -
- -
- - - - - - - - - - - - -

- We've received your clearance request! Standby for your clearance! -

- - - - - - - -
- -

- clears you to via Random Routing; . From maintain Flight Level , Mach . -

- -

- clears you to via Track . From , maintain Flight Level , Mach . -

- - - - - - - -
-
- - diff --git a/pilot_report.php b/pilot_report.php deleted file mode 100644 index 8a9521a..0000000 --- a/pilot_report.php +++ /dev/null @@ -1,368 +0,0 @@ -prepare('SELECT count(*) FROM position_reports WHERE cid = ?'); - $stmt->execute([$cid]); - $count = $stmt->fetchColumn(); - - // $count = "0"; - - if ($count == '0') { - $time = date('Hi e'); - $via = 'Pilot'; - - try { - $sql = 'INSERT INTO position_reports (track, cid, callsign, selcal, type, nat_entry, nat_entry_eta, destination, request_mach, request_fl, report_time, via) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)'; - $pdo->prepare($sql)->execute([$_POST['track'], $cid, $_POST['callsign'], $_POST['selcal'], $_POST['type'], $_POST['nat_entry'], $_POST['nat_entry_eta'], $_POST['destination'], $_POST['request_mach'], $_POST['request_fl'], $time, $via]); - ?> - -
-
- - - -
-
- - - -
-
- - - -
-
- - prepare($sql)->execute([$_POST['track'], $_POST['selcal'], $_POST['type'], $_POST['nat_reporting_fix'], $_POST['nat_reporting_at_time'], $_POST['nat_reporting_at_fl'], $_POST['nat_reporting_at_mach'], $_POST['nat_next_fix'], $_POST['nat_next_at_time'], $_POST['nat_next_thereafter'], $_POST['destination'], $_POST['request_mach'], $_POST['request_fl'], $time, $via, $cid]); - ?> - -
-
- - - -
-
- - - -
-
- - - -
-
- - - - - -
-
- - -

- Submit Pilot Report -


- - "; - // echo $callsign . "
"; - // echo $type . "
"; - // echo $altitude . "
"; - // echo $speed . "
"; - // echo $arrival . "


"; - - - // $decoded[$callsign]['CID']; - - - - - - - if ($user['cid'] == $cid) { - // echo $objects['Callsign'];?> - -
- -

- Aircraft Data -

-
- -
- - - -
- Select your NAT Track -
-
- Looks good! -
- -
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
-
- - - prepare('SELECT count(*) FROM position_reports WHERE cid = ?'); - $stmt->execute([$cid]); - $count = $stmt->fetchColumn(); - - // $count = "0"; - - if ($count == '0') { - ?> - -

- NAT Entry -

-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
-
- - = '1') { - ?> - -

- NAT Reporting -

-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -

- NAT Next Fix Estimation -

-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- - - - - -

- Destination & Requests -

-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -
- Looks good! -
-
- -
- -
- - -
- - - - - - - - - - -
-
- - diff --git a/pluginapi.php b/pluginapi.php deleted file mode 100644 index 52304de..0000000 --- a/pluginapi.php +++ /dev/null @@ -1,44 +0,0 @@ -prepare("SELECT * FROM clearances WHERE rep_status = ?"); -$stmt->execute(['cleared']); - -while ($row = $stmt->fetch()) -{ - $clearances[] = [ - 'callsign' => $row['callsign'], - 'status' => 'CLEARED', - 'nat' => $row['nat'], - 'fix' => $row['entry_fix'], - 'level' => $row['flight_level'], - 'mach' => $row['mach'], - 'estimating_time' => $row['estimating_time'], - 'clearance_issued' => $row['clearance_time'], - 'extra_info' => $row['freestyle'], - ]; -} - -$stmt = $pdo->prepare("SELECT * FROM clearances WHERE rep_status = ?"); -$stmt->execute(['pending']); - -while ($row = $stmt->fetch()) -{ - $clearances[] = [ - 'callsign' => $row['callsign'], - 'status' => 'PENDING', - 'nat' => $row['nat'], - 'fix' => $row['entry_fix'], - 'level' => $row['flight_level'], - 'mach' => $row['mach'], - 'estimating_time' => $row['estimating_time'], - 'clearance_issued' => null, - 'extra_info' => null, - ]; -} - -header("Content-Type: application/json"); -echo json_encode($clearances); diff --git a/reports.php b/reports.php deleted file mode 100644 index 0249870..0000000 --- a/reports.php +++ /dev/null @@ -1,122 +0,0 @@ -= "3") { - -?> - - - -
-
- - -

- NAT Position Reports -


- -
-
- - -
- -
- -
- -
- - -
-
- -

- NAT Track: NAT -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 AircraftNAT EntryReportingEstimatingNextRequestComments 
TrackCallsignSELCALTypePointETARestrictPointAtFLMachPointETAPointFLMachOther DetailsDestinationRead
- - - -
-
- - - - diff --git a/reports_data.php b/reports_data.php deleted file mode 100644 index af0623f..0000000 --- a/reports_data.php +++ /dev/null @@ -1,65 +0,0 @@ -prepare("SELECT * FROM position_reports WHERE track = ? ORDER BY `nat_reporting_at_fl`"); -$stmt->execute([$nat]); -while ($row = $stmt->fetch()) -{ -?> - - - - - - - - - - - - - - - - - - - - - - - /> - - - - - - - diff --git a/sso/OAuth.php b/sso/OAuth.php deleted file mode 100644 index 14582cb..0000000 --- a/sso/OAuth.php +++ /dev/null @@ -1,587 +0,0 @@ -key = $key; - $this->secret = $secret; - $this->callback_url = $callback_url; - } - - public function __toString() - { - return "OAuthConsumer[key=$this->key,secret=$this->secret]"; - } -} - -class OAuthToken -{ - // access tokens and request tokens - public $key; - public $secret; - - /** - * key = the token - * secret = the token secret. - */ - public function __construct($key, $secret) - { - $this->key = $key; - $this->secret = $secret; - } - - /** - * generates the basic string serialization of a token that a server - * would respond to request_token and access_token calls with. - */ - public function to_string() - { - return 'oauth_token='. - OAuthUtil::urlencode_rfc3986($this->key). - '&oauth_token_secret='. - OAuthUtil::urlencode_rfc3986($this->secret); - } - - public function __toString() - { - return $this->to_string(); - } -} - -class OAuthRequest -{ - protected $parameters; - protected $http_method; - protected $http_url; - // for debug purposes - public $base_string; - public static $version = '1.0'; - public static $POST_INPUT = 'php://input'; - - public function __construct($http_method, $http_url, $parameters = null) - { - $parameters = ($parameters) ? $parameters : []; - $parameters = array_merge(OAuthUtil::parse_parameters(parse_url($http_url, PHP_URL_QUERY)), $parameters); - $this->parameters = $parameters; - $this->http_method = $http_method; - $this->http_url = $http_url; - } - - /** - * pretty much a helper function to set up the request. - */ - public static function from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters = null) - { - $parameters = ($parameters) ? $parameters : []; - $defaults = ['oauth_version' => self::$version, - 'oauth_nonce' => self::generate_nonce(), - 'oauth_timestamp' => self::generate_timestamp(), - 'oauth_consumer_key' => $consumer->key, ]; - if ($token) { - $defaults['oauth_token'] = $token->key; - } - - $parameters = array_merge($defaults, $parameters); - - return new self($http_method, $http_url, $parameters); - } - - public function set_parameter($name, $value, $allow_duplicates = true) - { - if ($allow_duplicates && isset($this->parameters[$name])) { - // We have already added parameter(s) with this name, so add to the list - if (is_scalar($this->parameters[$name])) { - // This is the first duplicate, so transform scalar (string) - // into an array so we can add the duplicates - $this->parameters[$name] = [$this->parameters[$name]]; - } - - $this->parameters[$name][] = $value; - } else { - $this->parameters[$name] = $value; - } - } - - public function get_parameter($name) - { - return isset($this->parameters[$name]) ? $this->parameters[$name] : null; - } - - public function get_parameters() - { - return $this->parameters; - } - - public function unset_parameter($name) - { - unset($this->parameters[$name]); - } - - /** - * The request parameters, sorted and concatenated into a normalized string. - * - * @return string - */ - public function get_signable_parameters() - { - // Grab all parameters - $params = $this->parameters; - - // Remove oauth_signature if present - // Ref: Spec: 9.1.1 ("The oauth_signature parameter MUST be excluded.") - if (isset($params['oauth_signature'])) { - unset($params['oauth_signature']); - } - - return OAuthUtil::build_http_query($params); - } - - /** - * Returns the base string of this request. - * - * The base string defined as the method, the url - * and the parameters (normalized), each urlencoded - * and the concated with &. - */ - public function get_signature_base_string() - { - $parts = [ - $this->get_normalized_http_method(), - $this->get_normalized_http_url(), - $this->get_signable_parameters(), - ]; - - $parts = OAuthUtil::urlencode_rfc3986($parts); - - return implode('&', $parts); - } - - /** - * just uppercases the http method. - */ - public function get_normalized_http_method() - { - return strtoupper($this->http_method); - } - - /** - * parses the url and rebuilds it to be - * scheme://host/path. - */ - public function get_normalized_http_url() - { - $parts = parse_url($this->http_url); - - $scheme = (isset($parts['scheme'])) ? $parts['scheme'] : 'http'; - $port = (isset($parts['port'])) ? $parts['port'] : (($scheme == 'https') ? '443' : '80'); - $host = (isset($parts['host'])) ? strtolower($parts['host']) : ''; - $path = (isset($parts['path'])) ? $parts['path'] : ''; - - if (($scheme == 'https' && $port != '443') - || ($scheme == 'http' && $port != '80')) { - $host = "$host:$port"; - } - - return "$scheme://$host$path"; - } - - /** - * builds a url usable for a GET request. - */ - public function to_url() - { - $post_data = $this->to_postdata(); - $out = $this->get_normalized_http_url(); - if ($post_data) { - $out .= '?'.$post_data; - } - - return $out; - } - - /** - * builds the data one would send in a POST request. - */ - public function to_postdata($array = false) - { - return OAuthUtil::build_http_query($this->parameters, $array); - } - - /** - * builds the Authorization: header. - */ - public function to_header($realm = null) - { - $first = true; - if ($realm) { - $out = 'Authorization: OAuth realm="'.OAuthUtil::urlencode_rfc3986($realm).'"'; - $first = false; - } else { - $out = 'Authorization: OAuth'; - } - - $total = []; - foreach ($this->parameters as $k => $v) { - if (substr($k, 0, 5) != 'oauth') { - continue; - } - if (is_array($v)) { - throw new OAuthException('Arrays not supported in headers'); - } - $out .= ($first) ? ' ' : ','; - $out .= OAuthUtil::urlencode_rfc3986($k). - '="'. - OAuthUtil::urlencode_rfc3986($v). - '"'; - $first = false; - } - - return $out; - } - - public function __toString() - { - return $this->to_url(); - } - - public function sign_request($signature_method, $consumer, $token) - { - $this->set_parameter( - 'oauth_signature_method', - $signature_method->get_name(), - false - ); - $signature = $this->build_signature($signature_method, $consumer, $token); - $this->set_parameter('oauth_signature', $signature, false); - } - - public function build_signature($signature_method, $consumer, $token) - { - $signature = $signature_method->build_signature($this, $consumer, $token); - - return $signature; - } - - /** - * util function: current timestamp. - */ - private static function generate_timestamp() - { - return time(); - } - - /** - * util function: current nonce. - */ - private static function generate_nonce() - { - $mt = microtime(); - $rand = mt_rand(); - - return md5($mt.$rand); // md5s look nicer than numbers - } -} - -class OAuthUtil -{ - public static function urlencode_rfc3986($input) - { - if (is_array($input)) { - return array_map(['OAuthUtil', 'urlencode_rfc3986'], $input); - } elseif (is_scalar($input)) { - return str_replace( - '+', - ' ', - str_replace('%7E', '~', rawurlencode($input)) - ); - } else { - return ''; - } - } - - // This decode function isn't taking into consideration the above - // modifications to the encoding process. However, this method doesn't - // seem to be used anywhere so leaving it as is. - public static function urldecode_rfc3986($string) - { - return urldecode($string); - } - - // Utility function for turning the Authorization: header into - // parameters, has to do some unescaping - // Can filter out any non-oauth parameters if needed (default behaviour) - // May 28th, 2010 - method updated to tjerk.meesters for a speed improvement. - // see http://code.google.com/p/oauth/issues/detail?id=163 - public static function split_header($header, $only_allow_oauth_parameters = true) - { - $params = []; - if (preg_match_all('/('.($only_allow_oauth_parameters ? 'oauth_' : '').'[a-z_-]*)=(:?"([^"]*)"|([^,]*))/', $header, $matches)) { - foreach ($matches[1] as $i => $h) { - $params[$h] = self::urldecode_rfc3986(empty($matches[3][$i]) ? $matches[4][$i] : $matches[3][$i]); - } - if (isset($params['realm'])) { - unset($params['realm']); - } - } - - return $params; - } - - // helper to try to sort out headers for people who aren't running apache - public static function get_headers() - { - if (function_exists('apache_request_headers')) { - // we need this to get the actual Authorization: header - // because apache tends to tell us it doesn't exist - $headers = apache_request_headers(); - - // sanitize the output of apache_request_headers because - // we always want the keys to be Cased-Like-This and arh() - // returns the headers in the same case as they are in the - // request - $out = []; - foreach ($headers as $key => $value) { - $key = str_replace( - ' ', - '-', - ucwords(strtolower(str_replace('-', ' ', $key))) - ); - $out[$key] = $value; - } - } else { - // otherwise we don't have apache and are just going to have to hope - // that $_SERVER actually contains what we need - $out = []; - if (isset($_SERVER['CONTENT_TYPE'])) { - $out['Content-Type'] = $_SERVER['CONTENT_TYPE']; - } - if (isset($_ENV['CONTENT_TYPE'])) { - $out['Content-Type'] = $_ENV['CONTENT_TYPE']; - } - - foreach ($_SERVER as $key => $value) { - if (substr($key, 0, 5) == 'HTTP_') { - // this is chaos, basically it is just there to capitalize the first - // letter of every word that is not an initial HTTP and strip HTTP - // code from przemek - $key = str_replace( - ' ', - '-', - ucwords(strtolower(str_replace('_', ' ', substr($key, 5)))) - ); - $out[$key] = $value; - } - } - } - - return $out; - } - - // This function takes a input like a=b&a=c&d=e and returns the parsed - // parameters like this - // array('a' => array('b','c'), 'd' => 'e') - public static function parse_parameters($input) - { - if (!isset($input) || !$input) { - return []; - } - - $pairs = explode('&', $input); - - $parsed_parameters = []; - foreach ($pairs as $pair) { - $split = explode('=', $pair, 2); - - // Addition - KH - // only accept parameters prefixed with 'oauth', this allows additional GET parameters to be used by the script - if (!preg_match('/^oauth_/i', $split[0])) { - continue; - } - - $parameter = self::urldecode_rfc3986($split[0]); - $value = isset($split[1]) ? self::urldecode_rfc3986($split[1]) : ''; - - if (isset($parsed_parameters[$parameter])) { - // We have already recieved parameter(s) with this name, so add to the list - // of parameters with this name - - if (is_scalar($parsed_parameters[$parameter])) { - // This is the first duplicate, so transform scalar (string) into an array - // so we can add the duplicates - $parsed_parameters[$parameter] = [$parsed_parameters[$parameter]]; - } - - $parsed_parameters[$parameter][] = $value; - } else { - $parsed_parameters[$parameter] = $value; - } - } - - return $parsed_parameters; - } - - public static function build_http_query($params) - { - if (!$params) { - return ''; - } - - // Urlencode both keys and values - $keys = self::urlencode_rfc3986(array_keys($params)); - $values = self::urlencode_rfc3986(array_values($params)); - $params = array_combine($keys, $values); - - // Parameters are sorted by name, using lexicographical byte value ordering. - // Ref: Spec: 9.1.1 (1) - uksort($params, 'strcmp'); - - $pairs = []; - foreach ($params as $parameter => $value) { - if (is_array($value)) { - // If two or more parameters share the same name, they are sorted by their value - // Ref: Spec: 9.1.1 (1) - // June 12th, 2010 - changed to sort because of issue 164 by hidetaka - sort($value, SORT_STRING); - foreach ($value as $duplicate_value) { - $pairs[] = $parameter.'='.$duplicate_value; - } - } else { - $pairs[] = $parameter.'='.$value; - } - } - - // For each parameter, the name is separated from the corresponding value by an '=' character (ASCII code 61) - // Each name-value pair is separated by an '&' character (ASCII code 38) - return implode('&', $pairs); - } -} - -/** - * A class for implementing a Signature Method - * See section 9 ("Signing Requests") in the spec. - */ -abstract class OAuthSignatureMethod -{ - /** - * Needs to return the name of the Signature Method (ie HMAC-SHA1). - * - * @return string - */ - abstract public function get_name(); - - /** - * Build up the signature - * NOTE: The output of this function MUST NOT be urlencoded. - * the encoding is handled in OAuthRequest when the final - * request is serialized. - * - * @param OAuthRequest $request - * @param OAuthConsumer $consumer - * @param OAuthToken $token - * - * @return string - */ - abstract public function build_signature($request, $consumer, $token); -} - -/** - * The HMAC-SHA1 signature method uses the HMAC-SHA1 signature algorithm as defined in [RFC2104] - * where the Signature Base String is the text and the key is the concatenated values (each first - * encoded per Parameter Encoding) of the Consumer Secret and Token Secret, separated by an '&' - * character (ASCII code 38) even if empty. - * - Chapter 9.2 ("HMAC-SHA1"). - */ -class OAuthSignatureMethod_HMAC_SHA1 extends OAuthSignatureMethod -{ - public function __construct($cert = false) - { - } - - public function get_name() - { - return 'HMAC-SHA1'; - } - - public function build_signature($request, $consumer, $token) - { - $base_string = $request->get_signature_base_string(); - $request->base_string = $base_string; - - $key_parts = [ - $consumer->secret, - ($token) ? $token->secret : '', - ]; - - $key_parts = OAuthUtil::urlencode_rfc3986($key_parts); - $key = implode('&', $key_parts); - - return base64_encode(hash_hmac('sha1', $base_string, $key, true)); - } -} - -/** - * The RSA-SHA1 signature method uses the RSASSA-PKCS1-v1_5 signature algorithm as defined in - * [RFC3447] section 8.2 (more simply known as PKCS#1), using SHA-1 as the hash function for - * EMSA-PKCS1-v1_5. It is assumed that the Consumer has provided its RSA public key in a - * verified way to the Service Provider, in a manner which is beyond the scope of this - * specification. - * - Chapter 9.3 ("RSA-SHA1"). - */ -abstract class OAuthSignatureMethod_RSA_SHA1 extends OAuthSignatureMethod -{ - public function get_name() - { - return 'RSA-SHA1'; - } - - // Up to the SP to implement this lookup of keys. Possible ideas are: - // (1) do a lookup in a table of trusted certs keyed off of consumer - // - // Either way should return a string representation of the certificate - abstract protected function fetch_private_cert(&$request); - - public function build_signature($request, $consumer, $token) - { - $base_string = $request->get_signature_base_string(); - $request->base_string = $base_string; - - // Fetch the private key cert based on the request - $cert = $this->fetch_private_cert($request); - - // Pull the private key ID from the certificate - $privatekeyid = openssl_get_privatekey($cert); - - // Sign using the key - $ok = openssl_sign($base_string, $signature, $privatekeyid); - - // Release the key resource - openssl_free_key($privatekeyid); - - return base64_encode($signature); - } -} - -class SSO_OAuthSignatureMethod_RSA_SHA1 extends OAuthSignatureMethod_RSA_SHA1 -{ - private $cert = false; - - public function __construct($cert) - { - $this->cert = $cert; - } - - public function fetch_private_cert(&$request) - { - return $this->cert; - } -} diff --git a/sso/SSO.class.php b/sso/SSO.class.php deleted file mode 100644 index 0a65b02..0000000 --- a/sso/SSO.class.php +++ /dev/null @@ -1,382 +0,0 @@ - false, - 'message'=> false, - 'code' => false, - ]; - - /* - * The signing method being used to encrypt your request signature. - * Set the 'signature' method - */ - private $signature = false; - - /* - * A request token genereted by (or saved to) the class - */ - private $token = false; - - /* - * Consumer credentials, instance of OAuthConsumer - */ - private $consumer = false; - - /** - * Configures the SSO class with consumer/organisation credentials. - * - * @param type $key Organisation key - * @param type $secret Secret key corresponding to this organisation (only required if using HMAC) - * @param string $signature RSA|HMAC - * @param string $private_key openssl RSA private key (only required if using RSA) - */ - public function __construct($base, $key, $secret = false, $signature = false, $private_key = false) - { - $this->base = $base; - - // Store consumer credentials - $this->consumer = new OAuthConsumer($key, $secret); - - // if signature method is defined, set the signature method now (can be set or changed later) - if ($signature) { - $this->signature($signature, $private_key); - } - } - - /** - * Return or change the output format (returned by VATSIM). - * - * @param string $change json|xml - * - * @return string current format or bool false (unable to set format) - */ - public function format($change = false) - { - - // lower case values only - $change = strtolower($change); - - // if set, attempt to change format - if ($change) { - switch ($change) { - // allowed formats, change to new format - case 'xml': - case 'json': - $this->format = $change; - break; - // other formats now allowed/recognised - default: - return false; - break; - } - - // return the new format (string) - return $this->format; - } else { - // get and return the current format - return $this->format; - } - } - - /** - * Set the signing method to be used to encrypt request signature. - * - * @param string $signature Signature encryption method: RSA|HMAC - * @param string $private_key openssl RSA private key (only needed if using RSA) - * - * @return bool true if able to use this signing type - */ - public function signature($signature, $private_key = false) - { - $signature = strtoupper($signature); - - // RSA-SHA1 public key/private key encryption - if ($signature == 'RSA' || $signature == 'RSA-SHA1') { - - // private key must be provided - if (!$private_key) { - return false; - } - - // signature method set to RSA-SHA1 using this private key (interacts with OAuth class) - $this->signature = new SSO_OAuthSignatureMethod_RSA_SHA1($private_key); - - return true; - } elseif ($signature == 'HMAC' || $signature == 'HMAC-SHA1') { - - // signature method set to HMAC-SHA1 - no private key - $this->signature = new OAuthSignatureMethod_HMAC_SHA1(); - - return true; - } else { - // signature method was not recognised - return false; - } - } - - /** - * Request a login token from VATSIM (required to send someone for an SSO login). - * - * @param string $return_url URL for VATSIM to return memers to after login - * @param bool $allow_sus true to allow suspended VATSIM accounts to log in - * @param bool $allow_ina true to allow inactive VATSIM accounts to log in - * - * @return object|bool - */ - public function requestToken($return_url = false, $allow_sus = false, $allow_ina = false) - { - - // signature method must have been set - if (!$this->signature) { - return false; - } - - // if the return URL isn't specified, assume this file (though don't consider GET data) - if (!$return_url) { - // using https or http? - $http = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']) ? 'https://' : 'http://'; - // the current URL - $return_url = $http.$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']; - } - - $tokenUrl = $this->base.$this->loc_api.$this->loc_token.$this->format.'/'; - - // generate a token request from the consumer details - $req = OAuthRequest::from_consumer_and_token($this->consumer, false, 'POST', $tokenUrl, [ - 'oauth_callback' => $return_url, - 'oauth_allow_suspended' => ($allow_sus) ? true : false, - 'oauth_allow_inactive' => ($allow_ina) ? true : false, - ]); - - // sign the request using the specified signature/encryption method (set in this class) - $req->sign_request($this->signature, $this->consumer, false); - - $response = $this->curlRequest($tokenUrl, $req->to_postdata()); - - if ($response) { - // convert using our response format (depending upon user preference) - $sso = $this->responseFormat($response); - - // did VATSIM return a successful result? - if ($sso->request->result == 'success') { - - // this parameter is required by 1.0a spec - if ($sso->token->oauth_callback_confirmed == 'true') { - // store the token data saved - $this->token = new OAuthConsumer($sso->token->oauth_token, $sso->token->oauth_token_secret); - - // return the full object to the user - return $sso; - } else { - // no callback_confirmed parameter - $this->error = [ - 'type' => 'callback_confirm', - 'code' => false, - 'message' => 'Callback confirm flag missing - protocol mismatch', - ]; - - return false; - } - } else { - - // oauth returned a failed request, store the error details - $this->error = [ - 'type' => 'oauth_response', - 'code' => false, - 'message' => $sso->request->message, - ]; - - return false; - } - } else { - // cURL response failed - return false; - } - } - - /** - * Redirect the user to VATSIM to log in/confirm login. - * - * @return bool false if failed - */ - public function sendToVatsim() - { - - // a token must have been returned to redirect this user - if (!$this->token) { - return false; - } - - // redirect to the SSO login location, appending the token - header('Location: '.$this->base.$this->loc_login.$this->token->key); - die(); - } - - /** - * Obtains a user's login details from a token key and secret. - * - * @param string $tokenKey The token key provided by VATSIM - * @param secret $tokenSecret The secret associated with the token - * - * @return object|false false if error, otherwise returns user details - */ - public function checkLogin($tokenKey, $tokenSecret, $tokenVerifier) - { - $this->token = new OAuthConsumer($tokenKey, $tokenSecret); - - // the location to send a cURL request to to obtain this user's details - $returnUrl = $this->base.$this->loc_api.$this->loc_return.$this->format.'/'; - - // generate a token request call using post data - $req = OAuthRequest::from_consumer_and_token($this->consumer, $this->token, 'POST', $returnUrl, [ - 'oauth_token' => $tokenKey, - 'oauth_verifier' => $tokenVerifier, - ]); - - // sign the request using the specified signature/encryption method (set in this class) - $req->sign_request($this->signature, $this->consumer, $this->token); - - // post the details to VATSIM and obtain the result - $response = $this->curlRequest($returnUrl, $req->to_postdata()); - - if ($response) { - // convert using our response format (depending upon user preference) - $sso = $this->responseFormat($response); - - // did VATSIM return a successful result? - if ($sso->request->result == 'success') { - - // one time use of tokens only, token no longer valid - $this->token = false; - - // return the full object to the user - return $sso; - } else { - - // oauth returned a failed request, store the error details - $this->error = [ - 'type' => 'oauth_response', - 'code' => false, - 'message' => $sso->request->message, - ]; - - return false; - } - } else { - // cURL response failed - return false; - } - } - - /** - * Perform a (post) cURL request. - * - * @param type $url Destination of request - * @param type $requestString Query string of data to be posted - * - * @return bool true if able to make request - */ - private function curlRequest($url, $requestString) - { - - // using cURL to post the request to VATSIM - $ch = curl_init(); - - // configure the post request to VATSIM - curl_setopt_array($ch, [ - CURLOPT_URL => $url, // the url to make the request to - CURLOPT_RETURNTRANSFER => 1, // do not output the returned data to the user - CURLOPT_TIMEOUT => $this->timeout, // time out the request after this number of seconds - CURLOPT_POST => 1, // we are sending this via post - CURLOPT_POSTFIELDS => $requestString, // a query string to be posted (key1=value1&key2=value2) - ]); - - // perform the request - $response = curl_exec($ch); - - // request failed? - if (!$response) { - $this->error = [ - 'type' => 'curl_response', - 'code' => curl_errno($ch), - 'message' => curl_error($ch), - ]; - - return false; - } else { - return $response; - } - } - - /** - * Convert the response into a usable format. - * - * @param string $response json|xml - * - * @return object Format processed into an object (Simple XML Element or json_decode) - */ - private function responseFormat($response) - { - if ($this->format == 'xml') { - return new SimpleXMLElement($response); - } else { - return json_decode($response); - } - } - - /** - * Obtain the last generated error from this class. - * - * @return array Array of the latest error - */ - public function error() - { - return $this->error; - } -} diff --git a/sso/config.php b/sso/config.php deleted file mode 100644 index d3cf4b3..0000000 --- a/sso/config.php +++ /dev/null @@ -1,61 +0,0 @@ -Return
'; - if (@$_GET['oauth_token'] != $_SESSION[SSO_SESSION]['key']) { - echo '

Returned token does not match

'; - die(); - } - if (@!isset($_GET['oauth_verifier'])) { - echo '

No verification code provided

'; - die(); - } - // obtain the details of this user from VATSIM - $user = $SSO->checkLogin($_SESSION[SSO_SESSION]['key'], $_SESSION[SSO_SESSION]['secret'], @$_GET['oauth_verifier']); - if ($user) { - // One-time use of tokens, token no longer valid - unset($_SESSION[SSO_SESSION]); - // Output this user's details - echo '

Login Success

'; - echo '
';
-            /*
-             * NOTE: In a live environment, save these details and then redirect the user
-             */
-            print_r($user->user);
-            echo '
'; - // Start of NATTrak Login - require '../includes/functions.php'; - $cid = $user->user->id; - $name = $user->user->name_first.' '.$user->user->name_last; - $time = time(); - $logintime = date('Y-m-d H:i:s', time()); - $sessionid = $cid.$time; - - setSession($cid, $name, $sessionid, $logintime); - - header('Location: http://nattrak.vatsim.net/'); - // do not proceed to send the user back to VATSIM - die(); - } else { - // OAuth or cURL errors have occurred, output here - echo '

An error occurred

'; - $error = $SSO->error(); - if ($error['code']) { - echo '

Error code: '.$error['code'].'

'; - } - echo '

Error message: '.$error['message'].'

'; - // do not proceed to send the user back to VATSIM - die(); - } - } - // the user cancelled their login and were sent back -} elseif (isset($_GET['return']) && isset($_GET['oauth_cancel'])) { - echo 'Start Again
'; - echo '

You cancelled your login.

'; - die(); -} -// create a request token for this login. Provides return URL and suspended/inactive settings -$token = $SSO->requestToken($sso_return, false, false); -if ($token) { - // store the token information in the session so that we can retrieve it when the user returns - $_SESSION[SSO_SESSION] = [ - 'key' => (string) $token->token->oauth_token, // identifying string for this token - 'secret' => (string) $token->token->oauth_token_secret, // secret (password) for this token. Keep server-side, do not make visible to the user - ]; - // redirect the member to VATSIM - $SSO->sendToVatsim(); -} else { - echo '

An error occurred

'; - $error = $SSO->error(); - if ($error['code']) { - echo '

Error code: '.$error['code'].'

'; - } - echo '

Error message: '.$error['message'].'

'; -} diff --git a/sso/index.php b/sso/index.php deleted file mode 100644 index 534854c..0000000 --- a/sso/index.php +++ /dev/null @@ -1,99 +0,0 @@ - urlencode(getenv('CONNECT_CLIENT_ID')), - 'client_secret' => urlencode(getenv('CONNECT_CLIENT_SECRET')), - 'grant_type' => urlencode('authorization_code'), - 'redirect_uri' => urlencode(getenv('CONNECT_REDIRECT_URI')), - 'code' => urlencode($_GET['code']), - ); - $fields_string = ""; - foreach ($fields as $key => $value) { - $fields_string .= $key.'='.$value.'&'; - } - rtrim($fields_string, '&'); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, getenv('CONNECT_OAUTH_TOKEN')); - curl_setopt($ch, CURLOPT_POST, count($fields)); - curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - $result = curl_exec($ch); - $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); - $data = json_decode($result); - curl_close($ch); - if ($httpcode != 200) { - echo('Error. Cannot get VATSIM access_token'); - die(); - } - - - /** - * Utilise the Access Token to make a request to the VATSIM Connect API to get the users information. - */ - $ch = curl_init(getenv('CONNECT_USER_API')); - $authorization = "Authorization: Bearer ".$data->access_token; - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json', $authorization)); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); - $result = curl_exec($ch); - $result = json_decode($result); - curl_close($ch); - - if ($httpcode != 200) { - echo('Error. Cannot get VATSIM User Information'); - die(); - } - /** - * Verify that the required information has been returned. - * Set the session of the user and redirect them to the NATTRAK index page. - */ - try { - if (!isset($result->data->cid, $result->data->personal->name_first, $result->data->personal->name_last)) { - echo('Please ensure that you allow NATTRAK access to your full name when authorising at VATSIM.
Login Again'); - die(); - } - $cid = $result->data->cid; - $name = $result->data->personal->name_first.' '.$result->data->personal->name_last; - $time = time(); - $logintime = date('Y-m-d H:i:s', time()); - $sessionid = $cid.$time; - - setSession($cid, $name, $sessionid, $logintime); - } catch (Exception $e) { - echo('Error: Cannot set session'); - } - - header('Location: ' . getenv('BASE_URL') . '/index.php'); -} /** - * Compile the required information that VATSIM Connect required and redirect the user there. - */ -else { - $query = http_build_query([ - 'client_id' => getenv('CONNECT_CLIENT_ID'), - 'redirect_uri' => getenv('CONNECT_REDIRECT_URI'), - 'response_type' => 'code', - 'scope' => getenv('CONNECT_SCOPE'), - ]); - - header("Location: ".getenv('CONNECT_AUTH')."?".$query); -} diff --git a/unmarkread.php b/unmarkread.php deleted file mode 100644 index 31438a1..0000000 --- a/unmarkread.php +++ /dev/null @@ -1,16 +0,0 @@ -= 2) { - try { - $stmt = $pdo->prepare('UPDATE `position_reports` SET `read`=false WHERE `id`=?'); - $stmt->execute([$report_id]); - } catch (Exception $e) { - echo 'Something went wrong.'; - } - } -}