diff --git a/composer.json b/composer.json index 8f2a9543..0dc4d333 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,8 @@ "description": "Facebook CTF platform", "license": "CC-BY-NC-4.0", "require": { - "facebook/xhp-lib": "2.x" + "facebook/xhp-lib": "2.x", + "google/apiclient": "^2.0" }, "require-dev": { "phpunit/dbunit": "^2.0", diff --git a/composer.lock b/composer.lock index 0fbb31b6..ce54b8ed 100644 --- a/composer.lock +++ b/composer.lock @@ -4,25 +4,26 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "656ff8f591fc9780c431c26a35cd0103", - "content-hash": "394a1faf46faeb1f3b28e7414ea9f45c", + "hash": "7fa4023de48d9c453ad8eaa93913ae96", + "content-hash": "a8b3ade722987ad56f29a0fc697a5c70", "packages": [ { "name": "facebook/xhp-lib", - "version": "2.3.0", + "version": "v2.3.2", "source": { "type": "git", "url": "https://github.com/facebook/xhp-lib.git", - "reference": "571674608bb099c2ce01952816f606e6781dd475" + "reference": "4d2e2640534f50debe04f6a398db064fa6b1bb72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/facebook/xhp-lib/zipball/571674608bb099c2ce01952816f606e6781dd475", - "reference": "571674608bb099c2ce01952816f606e6781dd475", + "url": "https://api.github.com/repos/facebook/xhp-lib/zipball/4d2e2640534f50debe04f6a398db064fa6b1bb72", + "reference": "4d2e2640534f50debe04f6a398db064fa6b1bb72", "shasum": "" }, "require": { - "hhvm": "~3.6" + "fredemmott/type-assert": "^0.2.0 || ^1.0", + "hhvm": "~3.12" }, "require-dev": { "91carriage/phpunit-hhi": "^5.1.0", @@ -51,7 +52,720 @@ "hhvm", "xhp" ], - "time": "2016-03-28 21:09:59" + "time": "2016-12-04 21:31:50" + }, + { + "name": "firebase/php-jwt", + "version": "v4.0.0", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "dccf163dc8ed7ed6a00afc06c51ee5186a428d35" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/dccf163dc8ed7ed6a00afc06c51ee5186a428d35", + "reference": "dccf163dc8ed7ed6a00afc06c51ee5186a428d35", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "time": "2016-07-18 04:51:16" + }, + { + "name": "fredemmott/type-assert", + "version": "v1.1", + "source": { + "type": "git", + "url": "https://github.com/fredemmott/type-assert.git", + "reference": "38460b438ca85701585abe471d944c678d242847" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fredemmott/type-assert/zipball/38460b438ca85701585abe471d944c678d242847", + "reference": "38460b438ca85701585abe471d944c678d242847", + "shasum": "" + }, + "require": { + "hhvm": "~3.12" + }, + "require-dev": { + "91carriage/phpunit-hhi": "~5.1", + "phpunit/phpunit": "~5.1" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "ISC" + ], + "description": "Convert untyped data to typed data", + "keywords": [ + "TypeAssert", + "hack" + ], + "time": "2017-02-15 02:26:23" + }, + { + "name": "google/apiclient", + "version": "v2.1.2", + "source": { + "type": "git", + "url": "https://github.com/google/google-api-php-client.git", + "reference": "360e656f48c3262a6f7fefc0207521efa66caedf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/google-api-php-client/zipball/360e656f48c3262a6f7fefc0207521efa66caedf", + "reference": "360e656f48c3262a6f7fefc0207521efa66caedf", + "shasum": "" + }, + "require": { + "firebase/php-jwt": "~2.0|~3.0|~4.0", + "google/apiclient-services": "^0.9", + "google/auth": "^0.11", + "guzzlehttp/guzzle": "~5.2|~6.0", + "guzzlehttp/psr7": "^1.2", + "monolog/monolog": "^1.17", + "php": ">=5.4", + "phpseclib/phpseclib": "~0.3.10|~2.0" + }, + "require-dev": { + "cache/filesystem-adapter": "^0.3.2", + "phpunit/phpunit": "~4", + "squizlabs/php_codesniffer": "~2.3", + "symfony/css-selector": "~2.1", + "symfony/dom-crawler": "~2.1" + }, + "suggest": { + "cache/filesystem-adapter": "For caching certs and tokens (using Google_Client::setCache)" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-0": { + "Google_": "src/" + }, + "classmap": [ + "src/Google/Service/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Client library for Google APIs", + "homepage": "http://developers.google.com/api-client-library/php", + "keywords": [ + "google" + ], + "time": "2017-01-11 19:44:46" + }, + { + "name": "google/apiclient-services", + "version": "v0.9", + "source": { + "type": "git", + "url": "https://github.com/google/google-api-php-client-services.git", + "reference": "c400c655d1b7ca412ad4dd344e569c6865e74a83" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/google-api-php-client-services/zipball/c400c655d1b7ca412ad4dd344e569c6865e74a83", + "reference": "c400c655d1b7ca412ad4dd344e569c6865e74a83", + "shasum": "" + }, + "require": { + "php": ">=5.4" + }, + "type": "library", + "autoload": { + "psr-0": { + "Google_Service_": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Client library for Google APIs", + "homepage": "http://developers.google.com/api-client-library/php", + "keywords": [ + "google" + ], + "time": "2017-01-11 18:53:21" + }, + { + "name": "google/auth", + "version": "v0.11.1", + "source": { + "type": "git", + "url": "https://github.com/google/google-auth-library-php.git", + "reference": "a240674b08a09949fd5597f7590b3ed83663a12d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/a240674b08a09949fd5597f7590b3ed83663a12d", + "reference": "a240674b08a09949fd5597f7590b3ed83663a12d", + "shasum": "" + }, + "require": { + "firebase/php-jwt": "~2.0|~3.0|~4.0", + "guzzlehttp/guzzle": "~5.3|~6.0", + "guzzlehttp/psr7": "~1.2", + "php": ">=5.4", + "psr/cache": "^1.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^1.11", + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ], + "psr-4": { + "Google\\Auth\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Google Auth Library for PHP", + "homepage": "http://github.com/google/google-auth-library-php", + "keywords": [ + "Authentication", + "google", + "oauth2" + ], + "time": "2016-11-02 14:59:14" + }, + { + "name": "guzzlehttp/guzzle", + "version": "6.2.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ebf29dee597f02f09f4d5bbecc68230ea9b08f60", + "reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.3.1", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.0", + "psr/log": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.2-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2016-10-08 15:01:37" + }, + { + "name": "guzzlehttp/promises", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-12-20 10:07:11" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.4.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "04a6d1a00ea5da0727ee94309a9f0d3dbaecb569" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/04a6d1a00ea5da0727ee94309a9f0d3dbaecb569", + "reference": "04a6d1a00ea5da0727ee94309a9f0d3dbaecb569", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2017-02-21 01:20:32" + }, + { + "name": "monolog/monolog", + "version": "1.22.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "bad29cb8d18ab0315e6c477751418a82c850d558" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bad29cb8d18ab0315e6c477751418a82c850d558", + "reference": "bad29cb8d18ab0315e6c477751418a82c850d558", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "ruflin/elastica": ">=0.90 <3.0", + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "~5.3" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "sentry/sentry": "Allow sending log messages to a Sentry server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2016-11-26 00:15:39" + }, + { + "name": "phpseclib/phpseclib", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/phpseclib/phpseclib.git", + "reference": "ab8028c93c03cc8d9c824efa75dc94f1db2369bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/ab8028c93c03cc8d9c824efa75dc94f1db2369bf", + "reference": "ab8028c93c03cc8d9c824efa75dc94f1db2369bf", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phing/phing": "~2.7", + "phpunit/phpunit": "~4.0", + "sami/sami": "~2.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "suggest": { + "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.", + "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.", + "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", + "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations." + }, + "type": "library", + "autoload": { + "files": [ + "phpseclib/bootstrap.php" + ], + "psr-4": { + "phpseclib\\": "phpseclib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jim Wigginton", + "email": "terrafrost@php.net", + "role": "Lead Developer" + }, + { + "name": "Patrick Monnerat", + "email": "pm@datasphere.ch", + "role": "Developer" + }, + { + "name": "Andreas Fischer", + "email": "bantu@phpbb.com", + "role": "Developer" + }, + { + "name": "Hans-Jürgen Petrich", + "email": "petrich@tronic-media.com", + "role": "Developer" + }, + { + "name": "Graham Campbell", + "email": "graham@alt-three.com", + "role": "Developer" + } + ], + "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.", + "homepage": "http://phpseclib.sourceforge.net", + "keywords": [ + "BigInteger", + "aes", + "asn.1", + "asn1", + "blowfish", + "crypto", + "cryptography", + "encryption", + "rsa", + "security", + "sftp", + "signature", + "signing", + "ssh", + "twofish", + "x.509", + "x509" + ], + "time": "2016-10-04 00:57:04" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "time": "2016-08-06 20:24:11" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06 14:39:51" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10 12:19:37" } ], "packages-dev": [ @@ -111,16 +825,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.5.1", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "a8773992b362b58498eed24bf85005f363c34771" + "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/a8773992b362b58498eed24bf85005f363c34771", - "reference": "a8773992b362b58498eed24bf85005f363c34771", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/5a5a9fc8025a08d8919be87d6884d5a92520cefe", + "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe", "shasum": "" }, "require": { @@ -149,41 +863,138 @@ "object", "object graph" ], - "time": "2015-11-20 12:04:31" + "time": "2017-01-26 22:05:40" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2015-12-27 11:43:31" }, { "name": "phpdocumentor/reflection-docblock", - "version": "2.0.4", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0@dev", + "phpdocumentor/type-resolver": "^0.2.0", + "webmozart/assert": "^1.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.4" }, - "suggest": { - "dflydev/markdown": "~1.0", - "erusev/parsedown": "~1.0" + "type": "library", + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2016-09-30 07:12:33" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.2.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", + "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { - "psr-0": { - "phpDocumentor": [ + "psr-4": { + "phpDocumentor\\Reflection\\": [ "src/" ] } @@ -195,39 +1006,40 @@ "authors": [ { "name": "Mike van Riel", - "email": "mike.vanriel@naenius.com" + "email": "me@mikevanriel.com" } ], - "time": "2015-02-03 12:10:50" + "time": "2016-11-25 06:54:22" }, { "name": "phpspec/prophecy", - "version": "v1.6.0", + "version": "v1.6.2", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "3c91bdf81797d725b14cb62906f9a4ce44235972" + "reference": "6c52c2722f8460122f96f86346600e1077ce22cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/3c91bdf81797d725b14cb62906f9a4ce44235972", - "reference": "3c91bdf81797d725b14cb62906f9a4ce44235972", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/6c52c2722f8460122f96f86346600e1077ce22cb", + "reference": "6c52c2722f8460122f96f86346600e1077ce22cb", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "~2.0", - "sebastian/comparator": "~1.1", - "sebastian/recursion-context": "~1.0" + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "sebastian/comparator": "^1.1", + "sebastian/recursion-context": "^1.0|^2.0" }, "require-dev": { - "phpspec/phpspec": "~2.0" + "phpspec/phpspec": "^2.0", + "phpunit/phpunit": "^4.8 || ^5.6.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5.x-dev" + "dev-master": "1.6.x-dev" } }, "autoload": { @@ -260,28 +1072,28 @@ "spy", "stub" ], - "time": "2016-02-15 07:46:21" + "time": "2016-11-21 14:58:47" }, { "name": "phpunit/dbunit", - "version": "2.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/dbunit.git", - "reference": "390cefcb101e07e1d6400dbdfc3b90ecf2c1279f" + "reference": "5c35d74549c21ba55d0ea74ba89d191a51f8cf25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/dbunit/zipball/390cefcb101e07e1d6400dbdfc3b90ecf2c1279f", - "reference": "390cefcb101e07e1d6400dbdfc3b90ecf2c1279f", + "url": "https://api.github.com/repos/sebastianbergmann/dbunit/zipball/5c35d74549c21ba55d0ea74ba89d191a51f8cf25", + "reference": "5c35d74549c21ba55d0ea74ba89d191a51f8cf25", "shasum": "" }, "require": { "ext-pdo": "*", "ext-simplexml": "*", - "php": ">=5.4", - "phpunit/phpunit": "~4|~5", - "symfony/yaml": "~2.1|~3.0" + "php": "^5.4 || ^7.0", + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0", + "symfony/yaml": "^2.1 || ^3.0" }, "bin": [ "dbunit" @@ -315,20 +1127,20 @@ "testing", "xunit" ], - "time": "2015-11-03 11:17:01" + "time": "2016-12-02 14:39:14" }, { "name": "phpunit/php-code-coverage", - "version": "3.3.1", + "version": "3.3.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2431befdd451fac43fbcde94d1a92fb3b8b68f86" + "reference": "44cd8e3930e431658d1a5de7d282d5cb37837fd5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2431befdd451fac43fbcde94d1a92fb3b8b68f86", - "reference": "2431befdd451fac43fbcde94d1a92fb3b8b68f86", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/44cd8e3930e431658d1a5de7d282d5cb37837fd5", + "reference": "44cd8e3930e431658d1a5de7d282d5cb37837fd5", "shasum": "" }, "require": { @@ -378,20 +1190,20 @@ "testing", "xunit" ], - "time": "2016-04-08 08:14:53" + "time": "2016-05-27 16:24:29" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.1", + "version": "1.4.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", "shasum": "" }, "require": { @@ -425,7 +1237,7 @@ "filesystem", "iterator" ], - "time": "2015-06-21 13:08:43" + "time": "2016-10-03 07:40:28" }, { "name": "phpunit/php-invoker", @@ -516,21 +1328,24 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.7", + "version": "1.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", "shasum": "" }, "require": { "php": ">=5.3.3" }, + "require-dev": { + "phpunit/phpunit": "~4|~5" + }, "type": "library", "autoload": { "classmap": [ @@ -553,20 +1368,20 @@ "keywords": [ "timer" ], - "time": "2015-06-21 08:01:12" + "time": "2016-05-12 18:03:57" }, { "name": "phpunit/php-token-stream", - "version": "1.4.8", + "version": "1.4.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" + "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3b402f65a4cc90abf6e1104e388b896ce209631b", + "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b", "shasum": "" }, "require": { @@ -602,20 +1417,20 @@ "keywords": [ "tokenizer" ], - "time": "2015-09-15 10:49:45" + "time": "2016-11-15 14:06:22" }, { "name": "phpunit/phpunit", - "version": "5.3.2", + "version": "5.3.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "2c6da3536035617bae3fe3db37283c9e0eb63ab3" + "reference": "08c513bfcab57f3dd72f5214c1c3940439fae7fe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2c6da3536035617bae3fe3db37283c9e0eb63ab3", - "reference": "2c6da3536035617bae3fe3db37283c9e0eb63ab3", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/08c513bfcab57f3dd72f5214c1c3940439fae7fe", + "reference": "08c513bfcab57f3dd72f5214c1c3940439fae7fe", "shasum": "" }, "require": { @@ -627,11 +1442,11 @@ "myclabs/deep-copy": "~1.3", "php": "^5.6 || ^7.0", "phpspec/prophecy": "^1.3.1", - "phpunit/php-code-coverage": "^3.3.0", + "phpunit/php-code-coverage": ">=3.3.0,<4.0.0", "phpunit/php-file-iterator": "~1.4", "phpunit/php-text-template": "~1.2", "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "^3.1", + "phpunit/phpunit-mock-objects": ">=3.1.0,<3.2.0", "sebastian/comparator": "~1.1", "sebastian/diff": "~1.2", "sebastian/environment": "~1.3", @@ -677,7 +1492,7 @@ "testing", "xunit" ], - "time": "2016-04-12 16:20:08" + "time": "2016-06-03 09:42:56" }, { "name": "phpunit/phpunit-mock-objects", @@ -782,22 +1597,22 @@ }, { "name": "sebastian/comparator", - "version": "1.2.0", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", "shasum": "" }, "require": { "php": ">=5.3.3", "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2" + "sebastian/exporter": "~1.2 || ~2.0" }, "require-dev": { "phpunit/phpunit": "~4.4" @@ -842,7 +1657,7 @@ "compare", "equality" ], - "time": "2015-07-26 15:48:44" + "time": "2017-01-29 09:50:25" }, { "name": "sebastian/diff", @@ -898,23 +1713,23 @@ }, { "name": "sebastian/environment", - "version": "1.3.6", + "version": "1.3.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "2292b116f43c272ff4328083096114f84ea46a56" + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/2292b116f43c272ff4328083096114f84ea46a56", - "reference": "2292b116f43c272ff4328083096114f84ea46a56", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^4.8 || ^5.0" }, "type": "library", "extra": { @@ -944,20 +1759,20 @@ "environment", "hhvm" ], - "time": "2016-05-04 07:59:13" + "time": "2016-08-18 05:49:44" }, { "name": "sebastian/exporter", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e" + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", "shasum": "" }, "require": { @@ -965,12 +1780,13 @@ "sebastian/recursion-context": "~1.0" }, "require-dev": { + "ext-mbstring": "*", "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -1010,7 +1826,7 @@ "export", "exporter" ], - "time": "2015-06-21 07:55:53" + "time": "2016-06-17 09:04:28" }, { "name": "sebastian/global-state", @@ -1206,16 +2022,16 @@ }, { "name": "sebastian/version", - "version": "2.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5" + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5", - "reference": "c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", "shasum": "" }, "require": { @@ -1245,29 +2061,35 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-02-04 12:56:52" + "time": "2016-10-03 07:35:21" }, { "name": "symfony/yaml", - "version": "v3.0.5", + "version": "v3.2.4", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "0047c8366744a16de7516622c5b7355336afae96" + "reference": "9724c684646fcb5387d579b4bfaa63ee0b0c64c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/0047c8366744a16de7516622c5b7355336afae96", - "reference": "0047c8366744a16de7516622c5b7355336afae96", + "url": "https://api.github.com/repos/symfony/yaml/zipball/9724c684646fcb5387d579b4bfaa63ee0b0c64c8", + "reference": "9724c684646fcb5387d579b4bfaa63ee0b0c64c8", "shasum": "" }, "require": { "php": ">=5.5.9" }, + "require-dev": { + "symfony/console": "~2.8|~3.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1294,7 +2116,57 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-03-04 07:55:57" + "time": "2017-02-16 22:46:52" + }, + { + "name": "webmozart/assert", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2016-11-23 20:04:58" } ], "aliases": [], diff --git a/database/schema.sql b/database/schema.sql index b12a299c..3b91182d 100644 --- a/database/schema.sql +++ b/database/schema.sql @@ -129,6 +129,23 @@ CREATE TABLE `teams` ( ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `livesync` +-- + +DROP TABLE IF EXISTS `livesync`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `livesync` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `type` text NOT NULL, + `team_id` int(11) NOT NULL, + `username` text NOT NULL, + `sync_key` text NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `teams_data` -- diff --git a/database/test_schema.sql b/database/test_schema.sql index 99dc922d..50d3b7e1 100644 --- a/database/test_schema.sql +++ b/database/test_schema.sql @@ -129,6 +129,23 @@ CREATE TABLE `teams` ( ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `livesync` +-- + +DROP TABLE IF EXISTS `livesync`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `livesync` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `type` text NOT NULL, + `team_id` int(11) NOT NULL, + `username` text NOT NULL, + `sync_key` text NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `teams_data` -- diff --git a/extra/settings.ini.example b/extra/settings.ini.example index ca671412..e8078b22 100644 --- a/extra/settings.ini.example +++ b/extra/settings.ini.example @@ -8,3 +8,5 @@ DB_PASSWORD = 'MYPWD' MC_HOST = '127.0.0.1' MC_PORT = '11211' + +GOOGLE_OAUTH_FILE = '' \ No newline at end of file diff --git a/src/controllers/GameboardController.php b/src/controllers/GameboardController.php index e194ca40..5f047a57 100644 --- a/src/controllers/GameboardController.php +++ b/src/controllers/GameboardController.php @@ -43,6 +43,9 @@ public function renderMainContent(): :xhp {
  • {tr('Tutorial')}
  • +
  • + {tr('Account')} +
  • {$admin_link}
  • diff --git a/src/controllers/ajax/GameAjaxController.php b/src/controllers/ajax/GameAjaxController.php index ae102186..35c8e9ea 100644 --- a/src/controllers/ajax/GameAjaxController.php +++ b/src/controllers/ajax/GameAjaxController.php @@ -8,6 +8,8 @@ protected function getFilters(): array { 'level_id' => FILTER_VALIDATE_INT, 'answer' => FILTER_UNSAFE_RAW, 'csrf_token' => FILTER_UNSAFE_RAW, + 'livesync_username' => FILTER_UNSAFE_RAW, + 'livesync_password' => FILTER_UNSAFE_RAW, 'action' => array( 'filter' => FILTER_VALIDATE_REGEXP, 'options' => array('regexp' => '/^[\w-]+$/'), @@ -87,6 +89,18 @@ protected function getActions(): array { } case 'open_level': return Utils::ok_response('Success', 'admin'); + case 'set_livesync_password': + $livesync_password_update = await Team::genSetLiveSyncPassword( + SessionUtils::sessionTeam(), + "fbctf", + must_have_string($params, 'livesync_username'), + must_have_string($params, 'livesync_password'), + ); + if ($livesync_password_update === true) { + return Utils::ok_response('Success', 'game'); + } else { + return Utils::error_response('Failed', 'game'); + } default: return Utils::error_response('Invalid action', 'game'); } diff --git a/src/controllers/modals/ActionModalController.php b/src/controllers/modals/ActionModalController.php index 92cbf43b..989eb9ab 100644 --- a/src/controllers/modals/ActionModalController.php +++ b/src/controllers/modals/ActionModalController.php @@ -239,6 +239,80 @@ class="fb-cta cta--yellow js-close-modal js-confirm-save"> ; return tuple($title, $content); + case 'account': + $title = +

    + {tr('account_')}{tr('Settings')} +

    ; + if (Configuration::genGoogleOAuthFileExists() === true) { + $google_oauth_content = +
    ; + } else { + $google_oauth_content = ''; + } + $content = +
    + {$google_oauth_content} +
    +

    + {tr( + 'Setup your FBCTF Live Sync credentials. These credentials must be the SAME on all other FBCTF instances that you are linking. DO NOT use your account password.', + )} +

    + + +
    ; + return tuple($title, $content); default: invariant(false, "Invalid modal name $modal"); } diff --git a/src/data/google_oauth.php b/src/data/google_oauth.php new file mode 100644 index 00000000..8a559e4f --- /dev/null +++ b/src/data/google_oauth.php @@ -0,0 +1,99 @@ +setAuthConfig($google_oauth_file); + $client->setAccessType('offline'); + $client->setScopes(['profile email']); + $client->setRedirectUri( + 'https://'.$_SERVER['HTTP_HOST'].'/data/google_oauth.php', + ); + + if (isset($_GET['code'])) { + $client->authenticate($_GET['code']); + $access_token = $client->getAccessToken(); + $oauth_client = new Google_Service_Oauth2($client); + $profile = $oauth_client->userinfo->get(); + $livesync_password_update = \HH\Asio\join( + Team::genSetLiveSyncPassword( + SessionUtils::sessionTeam(), + "google_oauth", + $profile->email, + $profile->id, + ), + ); + if ($livesync_password_update === true) { + $message = + tr('Your FBCTF account was successfully linked with Google.'); + $javascript_status = + 'window.opener.document.getElementsByClassName("google-link-response")[0].innerHTML = "'. + tr('Your FBCTF account was successfully linked with Google.'). + '"'; + } else { + $message = + tr( + 'There was an error connecting your account to Google, please try again later.', + ); + $javascript_status = + 'window.opener.document.getElementsByClassName("google-link-response")[0].innerHTML = "'. + tr( + 'There was an error connecting your account to Google, please try again later.', + ). + '"'; + } + $javascript_close = "window.open('', '_self', ''); window.close();"; + } else if (isset($_GET['error'])) { + $message = + tr( + 'There was an error connecting your account to Google, please try again later.', + ); + $javascript_status = + 'window.opener.document.getElementsByClassName("google-link-response")[0].innerHTML = "'. + tr( + 'There was an error connecting your account to Google, please try again later.', + ). + '"'; + $javascript_close = "window.open('', '_self', ''); window.close();"; + } else { + $auth_url = $client->createAuthUrl(); + header('Location: '.filter_var($auth_url, FILTER_SANITIZE_URL)); + exit; + } +} else { + $message = tr('Google OAuth is disabled.'); + $javascript_status = + 'window.opener.document.getElementsByClassName("google-link-response")[0].innerHTML = "'. + tr('Google OAuth is disabled.'). + '"'; + $javascript_close = "window.open('', '_self', ''); window.close();"; +} + +$output = +
    + + + + {$message} +
    + + + +
    ; + +print $output; diff --git a/src/data/livesync.php b/src/data/livesync.php new file mode 100644 index 00000000..9f564d01 --- /dev/null +++ b/src/data/livesync.php @@ -0,0 +1,93 @@ + { + $data = array(); + + $teams_array = array(); + $all_teams = await Team::genAllTeams(); + foreach ($all_teams as $team) { + $team_livesync_exists = + await Team::genLiveSyncExists($team->getId(), "fbctf"); + if ($team_livesync_exists === true) { + $team_livesync_key = + await Team::genGetLiveSyncKey($team->getId(), "fbctf"); + $teams_array[$team->getId()] = strval($team_livesync_key); + } + } + + $scores_array = array(); + $scored_teams = array(); + $all_scores = await ScoreLog::genAllScores(); + foreach ($all_scores as $score) { + if (in_array($score->getTeamId(), array_keys($teams_array)) === false) { + continue; + } + $scores_array[$score->getLevelId()][$teams_array[$score->getTeamId()]]['timestamp'] = + $score->getTs(); + $scores_array[$score->getLevelId()][$teams_array[$score->getTeamId()]]['capture'] = + true; + $scores_array[$score->getLevelId()][$teams_array[$score->getTeamId()]]['hint'] = + false; + $scored_teams[$score->getLevelId()][] = $score->getTeamId(); + } + $all_hints = await HintLog::genAllHints(); + foreach ($all_hints as $hint) { + if ($hint->getPenalty()) { + if (in_array($hint->getTeamId(), array_keys($teams_array)) === + false) { + continue; + } + $scores_array[$hint->getLevelId()][$teams_array[$hint->getTeamId()]]['hint'] = + true; + if (in_array( + $hint->getTeamId(), + $scored_teams[$hint->getLevelId()], + ) === + false) { + $scores_array[$hint->getLevelId()][$teams_array[$hint->getTeamId()]]['capture'] = + false; + $scores_array[$hint->getLevelId()][$teams_array[$hint->getTeamId()]]['timestamp'] = + $hint->getTs(); + } + } + } + + $levels_array = array(); + $all_levels = await Level::genAllLevels(); + foreach ($all_levels as $level) { + $entity = await Country::gen($level->getEntityId()); + $category = await Category::genSingleCategory($level->getCategoryId()); + if (array_key_exists($level->getId(), $scores_array)) { + $score_level_array = $scores_array[$level->getId()]; + } else { + $score_level_array = array(); + } + $one_level = array( + 'active' => $level->getActive(), + 'type' => $level->getType(), + 'title' => $level->getTitle(), + 'description' => $level->getDescription(), + 'entity_iso_code' => $entity->getIsoCode(), + 'category' => $category->getCategory(), + 'points' => $level->getPoints(), + 'bonus' => $level->getBonusFix(), + 'bonus_dec' => $level->getBonusDec(), + 'penalty' => $level->getPenalty(), + 'teams' => $score_level_array, + ); + $levels_array[] = $one_level; + } + + $data = $levels_array; + $this->jsonSend($data); + } + +} + +/* HH_IGNORE_ERROR[1002] */ +$syncData = new LiveSyncDataController(); +\HH\Asio\join($syncData->genGenerateData()); diff --git a/src/models/Configuration.php b/src/models/Configuration.php index 5af97b4a..7d1355db 100644 --- a/src/models/Configuration.php +++ b/src/models/Configuration.php @@ -102,4 +102,27 @@ private static function configurationFromRow( must_have_idx($row, 'description'), ); } + + public static function genGoogleOAuthFileExists(): bool { + $settings_file = '../../settings.ini'; + $config = parse_ini_file($settings_file); + + if ((array_key_exists('GOOGLE_OAUTH_FILE', $config) === true) && + (file_exists($config['GOOGLE_OAUTH_FILE']) === true)) { + return true; + } + return false; + } + + public static function genGoogleOAuthFile(): string { + $settings_file = '../../settings.ini'; + $config = parse_ini_file($settings_file); + + if ((array_key_exists('GOOGLE_OAUTH_FILE', $config) === true) && + (file_exists($config['GOOGLE_OAUTH_FILE']) === true)) { + return strval($config['GOOGLE_OAUTH_FILE']); + } + + return ''; + } } diff --git a/src/models/Level.php b/src/models/Level.php index c86d32dd..67176dba 100644 --- a/src/models/Level.php +++ b/src/models/Level.php @@ -1207,4 +1207,87 @@ public static function getBasesResponses( return false; } } + + public static async function getLevelIdByTypeTitleCountry( + string $type, + string $title, + string $entity_iso_code, + ): Awaitable { + $db = await self::genDb(); + + $result = + await $db->queryf( + 'SELECT id FROM levels WHERE type = %s AND title = %s AND entity_id IN (SELECT id FROM countries WHERE iso_code = %s)', + $type, + $title, + $entity_iso_code, + ); + + invariant($result->numRows() === 1, 'Expected exactly one result'); + return intval(must_have_idx($result->mapRows()[0], 'id')); + } + + public static async function genAlreadyExistUnknownCountry( + string $type, + string $title, + string $description, + int $points, + ): Awaitable { + $db = await self::genDb(); + + $result = + await $db->queryf( + 'SELECT COUNT(*) FROM levels WHERE type = %s AND title = %s AND description = %s AND points = %d', + $type, + $title, + $description, + $points, + ); + + if ($result->numRows() > 0) { + invariant($result->numRows() === 1, 'Expected exactly one result'); + return (intval(idx($result->mapRows()[0], 'COUNT(*)')) > 0); + } else { + return false; + } + } + + public static async function genLevelIdUnknownCountry( + string $type, + string $title, + string $description, + int $points, + ): Awaitable { + $db = await self::genDb(); + + $result = + await $db->queryf( + 'SELECT id FROM levels WHERE type = %s AND title = %s AND description = %s AND points = %d', + $type, + $title, + $description, + $points, + ); + + invariant($result->numRows() === 1, 'Expected exactly one result'); + return intval(must_have_idx($result->mapRows()[0], 'id')); + } + + public static async function genLevelUnknownCountry( + string $type, + string $title, + string $description, + int $points, + ): Awaitable { + + $level_id = await self::genLevelIdUnknownCountry( + $type, + $title, + $description, + $points, + ); + + $level = await self::gen($level_id); + return $level; + } } diff --git a/src/models/ScoreLog.php b/src/models/ScoreLog.php index 7c1cc7f4..2a68699f 100644 --- a/src/models/ScoreLog.php +++ b/src/models/ScoreLog.php @@ -225,4 +225,83 @@ private static function scorelogFromRow(Map $row): ScoreLog { MultiTeam::invalidateMCRecords('TEAMS_BY_LEVEL'); // Invalidate Memcached MultiTeam data. MultiTeam::invalidateMCRecords('TEAMS_FIRST_CAP'); // Invalidate Memcached MultiTeam data. } + + public static async function genScoreLogUpdate( + int $level_id, + int $team_id, + int $points, + string $type, + string $timestamp, + ): Awaitable { + $db = await self::genDb(); + await $db->queryf( + 'UPDATE scores_log SET ts = %s, level_id = %d, team_id = %d, points = %d, type = %s WHERE level_id = %d AND team_id = %d', + $timestamp, + $level_id, + $team_id, + $points, + $type, + $level_id, + $team_id, + ); + self::invalidateMCRecords(); // Invalidate Memcached ScoreLog data. + Control::invalidateMCRecords('ALL_ACTIVITY'); // Invalidate Memcached Control data. + MultiTeam::invalidateMCRecords('ALL_TEAMS'); // Invalidate Memcached MultiTeam data. + MultiTeam::invalidateMCRecords('POINTS_BY_TYPE'); // Invalidate Memcached MultiTeam data. + MultiTeam::invalidateMCRecords('LEADERBOARD'); // Invalidate Memcached MultiTeam data. + MultiTeam::invalidateMCRecords('TEAMS_BY_LEVEL'); // Invalidate Memcached MultiTeam data. + MultiTeam::invalidateMCRecords('TEAMS_FIRST_CAP'); // Invalidate Memcached MultiTeam data. + } + + public static async function genUpdateScoreLogBonus( + int $level_id, + int $team_id, + int $points, + ): Awaitable { + $db = await self::genDb(); + await $db->queryf( + 'UPDATE scores_log SET ts = ts, points = %d WHERE level_id = %d AND team_id = %d', + $points, + $level_id, + $team_id, + ); + self::invalidateMCRecords(); // Invalidate Memcached ScoreLog data. + Control::invalidateMCRecords('ALL_ACTIVITY'); // Invalidate Memcached Control data. + MultiTeam::invalidateMCRecords('ALL_TEAMS'); // Invalidate Memcached MultiTeam data. + MultiTeam::invalidateMCRecords('POINTS_BY_TYPE'); // Invalidate Memcached MultiTeam data. + MultiTeam::invalidateMCRecords('LEADERBOARD'); // Invalidate Memcached MultiTeam data. + MultiTeam::invalidateMCRecords('TEAMS_BY_LEVEL'); // Invalidate Memcached MultiTeam data. + MultiTeam::invalidateMCRecords('TEAMS_FIRST_CAP'); // Invalidate Memcached MultiTeam data. + } + + public static async function genLevelScores( + int $level_id, + ): Awaitable> { + $db = await self::genDb(); + $result = await $db->queryf( + 'SELECT * FROM scores_log WHERE level_id = %d ORDER BY ts ASC', + $level_id, + ); + + $scores = array(); + foreach ($result->mapRows() as $row) { + $scores[] = self::scorelogFromRow($row); + } + + return $scores; + } + + public static async function genLevelScoreByTeam( + int $team_id, + int $level_id, + ): Awaitable { + $db = await self::genDb(); + $result = await $db->queryf( + 'SELECT * FROM scores_log WHERE team_id = %d AND level_id = %d', + $team_id, + $level_id, + ); + + return self::scorelogFromRow($result->mapRows()[0]); + } } diff --git a/src/models/Team.php b/src/models/Team.php index bdf1ad74..696ad92d 100644 --- a/src/models/Team.php +++ b/src/models/Team.php @@ -665,4 +665,253 @@ public static function regenerateHash(string $password_hash): bool { return $rank; } + + public static async function genTeamUpdatePoints( + int $team_id, + int $points, + ): Awaitable { + $db = await self::genDb(); + await $db->queryf( + 'UPDATE teams SET last_score = last_score, points = %d WHERE id = %d', + $points, + $team_id, + ); + MultiTeam::invalidateMCRecords(); // Invalidate Memcached MultiTeam data. + Control::invalidateMCRecords('ALL_ACTIVITY'); // Invalidate Memcached Control data. + } + + public static async function genGetLiveSyncKey( + int $team_id, + string $type, + ): Awaitable { + $db = await self::genDb(); + $result = await $db->queryf( + 'SELECT * FROM livesync WHERE team_id = %d AND type = %s', + $team_id, + $type, + ); + invariant($result->numRows() === 1, 'Expected exactly one result'); + + $username = strval(must_have_idx($result->mapRows()[0], 'username')); + $key_from_db = strval(must_have_idx($result->mapRows()[0], 'sync_key')); + + switch ($type) { + case 'fbctf': + $key = self::generateHash($key_from_db); + break; + // FALLTHROUGH + default: + $key = $key_from_db; + break; + } + + return strval($type.":".$username.":".$key); + } + + public static async function genLiveSyncExists( + int $team_id, + string $type, + ): Awaitable { + $db = await self::genDb(); + $result = await $db->queryf( + 'SELECT id FROM livesync WHERE team_id = %d AND type = %s', + $team_id, + $type, + ); + if ($result->numRows() === 1) { + return true; + } + return false; + } + + public static async function genSetLiveSyncPassword( + int $team_id, + string $type, + string $username, + string $password, + ): Awaitable { + $db = await self::genDb(); + + if (($username === '') || ($password === '')) { + return false; + } + + switch ($type) { + case 'fbctf': + $key = hash("sha256", $password); + $team = await self::genTeam($team_id); + if (password_verify($password, $team->getPasswordHash())) { + return false; + } + break; + // FALLTHROUGH + default: + $key = $password; + break; + } + + $username_result = + await $db->queryf( + 'SELECT id FROM livesync WHERE username = %s AND type = %s AND team_id != %d', + $username, + $type, + $team_id, + ); + if ($username_result->numRows() > 0) { + return false; + } + + $current_id_result = await $db->queryf( + 'SELECT id FROM livesync WHERE team_id = %d AND type = %s', + $team_id, + $type, + ); + if ($current_id_result->numRows() === 1) { + $result = await $db->queryf( + 'UPDATE livesync SET username = %s, sync_key = %s WHERE id = %d', + $username, + $key, + intval(must_have_idx($current_id_result->mapRows()[0], 'id')), + ); + if ($result) { + return true; + } + } else { + $result = + await $db->queryf( + 'INSERT INTO livesync (type, team_id, username, sync_key) VALUES (%s, %d, %s, %s)', + $type, + $team_id, + $username, + $key, + ); + if ($result) { + return true; + } + } + return false; + } + + public static async function genLiveSyncKeyExists( + string $key, + ): Awaitable { + $db = await self::genDb(); + + if (strpos($key, ':') === false) { + return false; + } + list($type, $username, $key) = explode(':', $key); + + switch ($type) { + case 'fbctf': + $result = await $db->queryf( + 'SELECT * FROM livesync WHERE username = %s AND type = %s', + $username, + $type, + ); + break; + case 'google_oauth': + $result = await $db->queryf( + 'SELECT * FROM livesync WHERE sync_key = %s AND type = %s', + $key, + $type, + ); + break; + // FALLTHROUGH + default: + $result = await $db->queryf( + 'SELECT * FROM livesync WHERE sync_key = %s', + $key, + ); + break; + } + + if ($result->numRows() > 0) { + $team_id = 0; + foreach ($result->mapRows() as $row) { + $type = strval(must_have_idx($row, 'type')); + $username = strval(must_have_idx($row, 'username')); + $key_from_db = strval(must_have_idx($row, 'sync_key')); + + switch ($type) { + case 'fbctf': + if (password_verify($key_from_db, $key)) { + return true; + } + break; + // FALLTHROUGH + default: + if (strval($key) === strval($key_from_db)) { + return true; + } + break; + } + } + } + return false; + } + + public static async function genTeamFromLiveSyncKey( + string $key, + ): Awaitable { + $db = await self::genDb(); + + invariant(strpos($key, ':'), "Invalid live sync key"); + list($type, $username, $key) = explode(':', $key); + + switch ($type) { + case 'fbctf': + $result = await $db->queryf( + 'SELECT * FROM livesync WHERE username = %s AND type = %s', + $username, + $type, + ); + invariant($result->numRows() > 0, 'Expected at least one result'); + break; + case 'google_oauth': + $result = await $db->queryf( + 'SELECT * FROM livesync WHERE sync_key = %s AND type = %s', + $key, + $type, + ); + break; + // FALLTHROUGH + default: + $result = await $db->queryf( + 'SELECT * FROM livesync WHERE sync_key = %s', + $key, + ); + invariant($result->numRows() > 0, 'Expected at least one result'); + break; + } + + $team_id = 0; + foreach ($result->mapRows() as $row) { + $type = strval(must_have_idx($row, 'type')); + $username = strval(must_have_idx($row, 'username')); + $key_from_db = strval(must_have_idx($row, 'sync_key')); + + switch ($type) { + case 'fbctf': + if (password_verify($key_from_db, $key)) { + $team_id = intval(must_have_idx($row, 'team_id')); + $team = await self::genTeam($team_id); + return $team; + } + break; + // FALLTHROUGH + default: + if (strval($key) === strval($key_from_db)) { + $team_id = intval(must_have_idx($row, 'team_id')); + $team = await self::genTeam($team_id); + return $team; + } + break; + } + } + invariant($team_id !== 0, 'team_id not found'); + $team = await self::genTeam($team_id); + return $team; + } + } diff --git a/src/scripts/liveimport.php b/src/scripts/liveimport.php new file mode 100644 index 00000000..bf47d7ca --- /dev/null +++ b/src/scripts/liveimport.php @@ -0,0 +1,591 @@ + [Switched allowed multiple times. Optionally provide custom HTTP headers after URL, pipe delimited] \n". + " --sleep