commit db4d284234c9052d3089c13148b357fa8bd94b1f Author: root Date: Sun Dec 24 07:19:38 2023 +0000 first init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1dda020 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +!.gitignore +composer.phar +vendor diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..de34ae5 --- /dev/null +++ b/composer.json @@ -0,0 +1,50 @@ +{ + "name": "mirzaev/marina", + "description": "Discord chat-robot", + "readme": "README.md", + "keywords": [ + "discord", + "chat", + "robot" + ], + "type": "site", + "homepage": "https://git.mirzaev.sexy/mirzaev/marina", + "license": "WTFPL", + "authors": [ + { + "name": "Arsen Mirzaev Tatyano-Muradovich", + "email": "arsen@mirzaev.sexy", + "homepage": "https://mirzaev.sexy", + "role": "Programmer" + } + ], + "support": { + "email": "arsen@mirzaev.sexy", + "wiki": "https://git.mirzaev.sexy/mirzaev/marina/wiki", + "issues": "https://git.mirzaev.sexy/mirzaev/marina/issues" + }, + "funding": [ + { + "type": "funding", + "url": "https://fund.mirzaev.sexy" + } + ], + "require": { + "php": "~8.2", + "mirzaev/minimal": "^2.2", + "mirzaev/arangodb": "^1.3.0", + "triagens/arangodb": "~3.9.x-dev", + "guzzlehttp/guzzle": "^7.5", + "wohali/oauth2-discord-new": "^1.2" + }, + "autoload": { + "psr-4": { + "mirzaev\\marina\\": "mirzaev/marina/system" + } + }, + "autoload-dev": { + "psr-4": { + "mirzaev\\marina\\tests\\": "mirzaev/marina/tests" + } + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..ee90b4d --- /dev/null +++ b/composer.lock @@ -0,0 +1,958 @@ +{ + "_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": "b0b28e01189100f963205a827c33bc7c", + "packages": [ + { + "name": "guzzlehttp/guzzle", + "version": "7.8.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "41042bc7ab002487b876a0683fc8dce04ddce104" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/41042bc7ab002487b876a0683fc8dce04ddce104", + "reference": "41042bc7ab002487b876a0683fc8dce04ddce104", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.5.3 || ^2.0.1", + "guzzlehttp/psr7": "^1.9.1 || ^2.5.1", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "ext-curl": "*", + "php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", + "php-http/message-factory": "^1.1", + "phpunit/phpunit": "^8.5.36 || ^9.6.15", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "psr-18", + "psr-7", + "rest", + "web service" + ], + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/7.8.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "time": "2023-12-03T20:35:24+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/bbff78d96034045e58e13dedd6ad91b5d1253223", + "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.36 || ^9.6.15" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "time": "2023-12-03T20:19:20+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "2.6.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/45b30f99ac27b5ca93cb4831afe16285f57b8221", + "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 || ^2.0", + "ralouphie/getallheaders": "^3.0" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "http-interop/http-factory-tests": "^0.9", + "phpunit/phpunit": "^8.5.36 || ^9.6.15" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/2.6.2" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "time": "2023-12-03T20:05:35+00:00" + }, + { + "name": "league/oauth2-client", + "version": "2.7.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/oauth2-client.git", + "reference": "160d6274b03562ebeb55ed18399281d8118b76c8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/oauth2-client/zipball/160d6274b03562ebeb55ed18399281d8118b76c8", + "reference": "160d6274b03562ebeb55ed18399281d8118b76c8", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^6.0 || ^7.0", + "paragonie/random_compat": "^1 || ^2 || ^9.99", + "php": "^5.6 || ^7.0 || ^8.0" + }, + "require-dev": { + "mockery/mockery": "^1.3.5", + "php-parallel-lint/php-parallel-lint": "^1.3.1", + "phpunit/phpunit": "^5.7 || ^6.0 || ^9.5", + "squizlabs/php_codesniffer": "^2.3 || ^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-2.x": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "League\\OAuth2\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alex Bilbie", + "email": "hello@alexbilbie.com", + "homepage": "http://www.alexbilbie.com", + "role": "Developer" + }, + { + "name": "Woody Gilk", + "homepage": "https://github.com/shadowhand", + "role": "Contributor" + } + ], + "description": "OAuth 2.0 Client Library", + "keywords": [ + "Authentication", + "SSO", + "authorization", + "identity", + "idp", + "oauth", + "oauth2", + "single sign on" + ], + "support": { + "issues": "https://github.com/thephpleague/oauth2-client/issues", + "source": "https://github.com/thephpleague/oauth2-client/tree/2.7.0" + }, + "time": "2023-04-16T18:19:15+00:00" + }, + { + "name": "mirzaev/arangodb", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://git.mirzaev.sexy/mirzaev/arangodb", + "reference": "d0ce9e47af189821bb6a3b7f54e228fb8c129aa3" + }, + "require": { + "php": "^8.2", + "triagens/arangodb": "~3.8" + }, + "require-dev": { + "phpunit/phpunit": "^9.3.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "mirzaev\\arangodb\\": "mirzaev/arangodb/system" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "WTFPL" + ], + "authors": [ + { + "name": "Arsen Mirzaev Tatyano-Muradovich", + "email": "arsen@mirzaev.sexy", + "homepage": "https://mirzaev.sexy", + "role": "Developer" + } + ], + "description": "Simple PHP-framework for ArangoDB", + "homepage": "https://git.hood.su/mirzaev/arangodb", + "keywords": [ + "ArangoDb" + ], + "support": { + "email": "arsen@mirzaev.sexy", + "issues": "https://git.mirzaev.sexy/mirzaev/arangodb/issues", + "wiki": "https://git.mirzaev.sexy/mirzaev/arangodb/manual" + }, + "funding": [ + { + "url": "https://fund.mirzaev.sexy", + "type": "funding" + } + ], + "time": "2023-12-21T16:26:50+00:00" + }, + { + "name": "mirzaev/minimal", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://git.mirzaev.sexy/mirzaev/minimal", + "reference": "41bf8ab56a71f8df90ea0332469cf46acd6a762d" + }, + "require": { + "php": "~8.2" + }, + "type": "framework", + "autoload": { + "psr-4": { + "mirzaev\\minimal\\": "mirzaev/minimal/system" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "WTFPL" + ], + "authors": [ + { + "name": "Arsen Mirzaev Tatyano-Muradovich", + "email": "arsen@mirzaev.sexy", + "homepage": "https://mirzaev.sexy", + "role": "Developer" + } + ], + "description": "Lightweight MVC framework that manages only the basic mechanisms, leaving the development of the programmer and not overloading the project", + "homepage": "https://git.mirzaev.sexy/mirzaev/minimal", + "keywords": [ + "framework", + "lightweight", + "mvc" + ], + "support": { + "docs": "https://git.mirzaev.sexy/mirzaev/minimal/wiki", + "issues": "https://git.mirzaev.sexy/mirzaev/minimal/issues" + }, + "time": "2023-12-21T16:14:34+00:00" + }, + { + "name": "paragonie/random_compat", + "version": "v9.99.100", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", + "shasum": "" + }, + "require": { + "php": ">= 7" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*", + "vimeo/psalm": "^1" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "polyfill", + "pseudorandom", + "random" + ], + "support": { + "email": "info@paragonie.com", + "issues": "https://github.com/paragonie/random_compat/issues", + "source": "https://github.com/paragonie/random_compat" + }, + "time": "2020-10-15T08:29:30+00:00" + }, + { + "name": "psr/http-client", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "support": { + "source": "https://github.com/php-fig/http-client" + }, + "time": "2023-09-23T14:17:50+00:00" + }, + { + "name": "psr/http-factory", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "e616d01114759c4c489f93b099585439f795fe35" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", + "reference": "e616d01114759c4c489f93b099585439f795fe35", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "psr/http-message": "^1.0 || ^2.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": "https://www.php-fig.org/" + } + ], + "description": "Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory/tree/1.0.2" + }, + "time": "2023-04-10T20:10:41+00:00" + }, + { + "name": "psr/http-message", + "version": "2.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://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" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/2.0" + }, + "time": "2023-04-04T09:54:51+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, + "time": "2019-03-08T08:55:37+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.4-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "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": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.4.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": "2023-05-23T14:45:45+00:00" + }, + { + "name": "triagens/arangodb", + "version": "3.9.x-dev", + "source": { + "type": "git", + "url": "https://github.com/arangodb/arangodb-php.git", + "reference": "21c460dbbd75eb5c066f9abcc3a9adf4487d6e48" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/arangodb/arangodb-php/zipball/21c460dbbd75eb5c066f9abcc3a9adf4487d6e48", + "reference": "21c460dbbd75eb5c066f9abcc3a9adf4487d6e48", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "ArangoDBClient": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Jan Steemann", + "homepage": "https://github.com/arangodb/arangodb-php", + "role": "Developer" + }, + { + "name": "Frank Mayer", + "homepage": "https://github.com/arangodb/arangodb-php", + "role": "Developer" + }, + { + "name": "Contributors", + "homepage": "https://github.com/arangodb/arangodb-php/graphs/contributors" + } + ], + "description": "ArangoDB PHP client", + "homepage": "https://github.com/arangodb/arangodb-php", + "keywords": [ + "Arango", + "ArangoDb", + "database", + "distributed", + "document store", + "graph database", + "multi-model", + "nosql" + ], + "support": { + "issues": "https://github.com/arangodb/arangodb-php/issues", + "source": "https://github.com/arangodb/arangodb-php/tree/3.9" + }, + "time": "2022-10-21T15:30:53+00:00" + }, + { + "name": "wohali/oauth2-discord-new", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/wohali/oauth2-discord-new.git", + "reference": "2df4d2a882e04c749880797704e4bde8f00ea1d9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wohali/oauth2-discord-new/zipball/2df4d2a882e04c749880797704e4bde8f00ea1d9", + "reference": "2df4d2a882e04c749880797704e4bde8f00ea1d9", + "shasum": "" + }, + "require": { + "ext-json": "*", + "league/oauth2-client": "^2.0", + "php": "^7.2|^8.0" + }, + "conflict": { + "team-reflex/oauth2-discord": ">=1.0" + }, + "require-dev": { + "mockery/mockery": "~1.3.0", + "php-parallel-lint/php-parallel-lint": "~0.9", + "phpunit/phpunit": "~8.0", + "squizlabs/php_codesniffer": "^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Wohali\\OAuth2\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Joan Touzet", + "email": "code@atypical.net", + "homepage": "https://github.com/wohali" + } + ], + "description": "Discord OAuth 2.0 Client Provider for The PHP League OAuth2-Client", + "keywords": [ + "authorisation", + "authorization", + "client", + "discord", + "oauth", + "oauth2" + ], + "support": { + "issues": "https://github.com/wohali/oauth2-discord-new/issues", + "source": "https://github.com/wohali/oauth2-discord-new/tree/1.2.1" + }, + "time": "2022-12-29T18:45:10+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "triagens/arangodb": 20 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "~8.2" + }, + "platform-dev": [], + "plugin-api-version": "2.2.0" +} diff --git a/mirzaev/marina/system/controllers/core.php b/mirzaev/marina/system/controllers/core.php new file mode 100644 index 0000000..31b49c0 --- /dev/null +++ b/mirzaev/marina/system/controllers/core.php @@ -0,0 +1,74 @@ + + */ +class core extends controller +{ + /** + * Постфикс + */ + final public const POSTFIX = ''; + + /** + * Discord provider + */ + readonly public provider $provider; + + /** + * Реестр ошибок + */ + protected array $errors = []; + + /** + * Конструктор + * + * @param bool $initialize Инициализировать контроллер? + */ + public function __construct(bool $initialize = true) + { + parent::__construct($initialize); + + if ($initialize) { + // Запрошена инициализация + + // Инициализация ядра моделей (соединение с базой данных...) + new model(); + + // Initialize of discord provider + $this->provider = new provider(require '../settings/discord/robot.php'); + } + } + + /** + * Проверить инициализированность + * + * Проверяет инициализированность свойства в инстанции документа аккаунта из базы данных + * + * @param string $name Название + * + * @return bool Свойство инициализировано? + */ + public function __isset(string $name): bool + { + return match ($name) { + default => isset($this->{$name}) + }; + } +} diff --git a/mirzaev/marina/system/controllers/index.php b/mirzaev/marina/system/controllers/index.php new file mode 100644 index 0000000..a3ae7df --- /dev/null +++ b/mirzaev/marina/system/controllers/index.php @@ -0,0 +1,71 @@ + + */ +final class index extends core +{ + /** + * Главная страница + * + * @param array $parameters Параметры запроса + */ + public function index(array $parameters = []): ?string + { + if (!isset($parameters['code'])) { + + // Step 1. Get authorization code + $_SESSION['oauth2state'] = $this->provider->getState(); + header('Location: ' . $this->provider->getAuthorizationUrl()); + + // Check given state against previously stored one to mitigate CSRF attack + } elseif (empty($parameters['state']) || ($parameters['state'] !== $_SESSION['oauth2state'])) { + + unset($_SESSION['oauth2state']); + exit('Invalid state'); + } else { + + // Step 2. Get an access token using the provided authorization code + $token = $this->provider->getAccessToken('authorization_code', [ + 'code' => $parameters['code'] + ]); + + // Show some token details + echo '

Token details:

'; + echo 'Token: ' . $token->getToken() . "
"; + echo 'Refresh token: ' . $token->getRefreshToken() . "
"; + echo 'Expires: ' . $token->getExpires() . " - "; + echo ($token->hasExpired() ? 'expired' : 'not expired') . "
"; + + // Step 3. (Optional) Look up the user's profile with the provided token + try { + + $user = $this->provider->getResourceOwner($token); + + echo '

Resource owner details:

'; + printf('Hello %s#%s!

', $user->getUsername(), $user->getDiscriminator()); + var_export($user->toArray()); + } catch (exception $e) { + + // Failed to get user details + exit('fail'); + } + } + + // Возврат (провал) + return null; + } +} diff --git a/mirzaev/marina/system/models/core.php b/mirzaev/marina/system/models/core.php new file mode 100644 index 0000000..3904e53 --- /dev/null +++ b/mirzaev/marina/system/models/core.php @@ -0,0 +1,274 @@ + + */ +class core extends model +{ + /** + * Постфикс + */ + final public const POSTFIX = ''; + + /** + * Путь до файла с настройками подключения к базе данных ArangoDB + */ + final public const ARANGODB = '../settings/arangodb.php'; + + /** + * Соединение с базой данных ArangoDB + */ + protected static arangodb $arangodb; + + /** + * Коллекция + */ + public const COLLECTION = 'THIS_COLLECTION_SHOULD_NOT_EXIST'; + + /** + * Конструктор + * + * @param bool $initialize Инициализировать модель? + * @param ?arangodb $arangodb Инстанция соединения с базой данных ArangoDB + */ + public function __construct(bool $initialize = true, ?arangodb $arangodb = null) + { + parent::__construct($initialize); + + /* if ($initialize) { + // Запрошена инициализация + + if (isset($arangodb)) { + // Получена инстанция соединения с базой данных + + // Запись и инициализация соединения с базой данных + $this->__set('arangodb', $arangodb); + } else { + // Не получена инстанция соединения с базой данных + + // Инициализация соединения с базой данных по умолчанию + $this->__get('arangodb'); + } + } */ + } + + /** + * Read from ArangoDB + * + * @param string $filter Выражения для фильтрации на языке AQL + * @param string $sort Выражение для сортировки на языке AQL + * @param int $amount Количество документов для выборки + * @param int $page Страница + * @param string $return Выражение описываемое возвращаемые данные на языке AQL + * @param array &$errors Реестр ошибок + * + * @return _document|array|null Массив инстанций документов в базе данных, если найдены + */ + public static function read( + string $filter = '', + string $sort = 'd.created DESC, d._key DESC', + int $amount = 1, + int $page = 1, + string $return = 'd', + array &$errors = [] + ): _document|array|null { + try { + if (collection::init(static::$arangodb->session, static::COLLECTION)) { + // Инициализирована коллекция + + // Exit (success) + return collection::search( + static::$arangodb->session, + sprintf( + <<<'AQL' + FOR d IN %s + %s + %s + LIMIT %d, %d + RETURN %s + AQL, + static::COLLECTION, + empty($filter) ? '' : "FILTER $filter", + empty($sort) ? '' : "SORT $sort", + --$page <= 0 ? 0 : $amount * $page, + $amount, + $return + ) + ); + } else throw new exception('Не удалось инициализировать коллекцию'); + } catch (exception $e) { + // Запись в реестр ошибок + $errors[] = [ + 'text' => $e->getMessage(), + 'file' => $e->getFile(), + 'line' => $e->getLine(), + 'stack' => $e->getTrace() + ]; + } + + // Exit (fail) + return null; + } + + /** + * Delete in ArangoDB + * + * @param _document $instance Instance of the document in ArangoDB + * @param array &$errors Реестр ошибок + * + * @return bool Deleted without errors? + */ + public static function delete(_document $instance, array &$errors = []): bool + { + try { + if (collection::init(static::$arangodb->session, static::COLLECTION)) { + // Инициализирована коллекция + + return (new _document_handler(static::$arangodb->session))->remove($instance); + } else throw new exception('Не удалось инициализировать коллекцию'); + } catch (exception $e) { + // Запись в реестр ошибок + $errors[] = [ + 'text' => $e->getMessage(), + 'file' => $e->getFile(), + 'line' => $e->getLine(), + 'stack' => $e->getTrace() + ]; + } + + // Exit (fail) + return false; + } + + /** + * Update in ArangoDB + * + * @param _document $instance Инстанция документа ArangoDB + * + * @return bool Записано в базу данных? + */ + public static function update(_document $instance): bool + { + return document::update(static::$arangodb->session, $instance); + } + + /** + * Записать свойство + * + * @param string $name Название + * @param mixed $value Значение + */ + public function __set(string $name, mixed $value = null): void + { + match ($name) { + 'arangodb' => (function () use ($value) { + if ($this->__isset('arangodb')) { + // Свойство уже было инициализировано + + // Выброс исключения (неудача) + throw new exception('Запрещено реинициализировать соединение с базой данных ArangoDB ($this::$arangodb)', 500); + } else { + // Свойство ещё не было инициализировано + + if ($value instanceof arangodb) { + // Передано подходящее значение + + // Запись свойства (успех) + self::$arangodb = $value; + } else { + // Передано неподходящее значение + + // Выброс исключения (неудача) + throw new exception('Соединение с базой данных ArangoDB ($this::$arangodb) должно быть инстанцией mirzaev\arangodb\connection', 500); + } + } + })(), + default => parent::__set($name, $value) + }; + } + + /** + * Прочитать свойство + * + * @param string $name Название + * + * @return mixed Содержимое + */ + public function __get(string $name): mixed + { + return match ($name) { + 'arangodb' => (function () { + try { + if (!$this->__isset('arangodb')) { + // Свойство не инициализировано + + // Инициализация значения по умолчанию исходя из настроек + $this->__set('arangodb', new arangodb(require static::ARANGODB)); + } + + return self::$arangodb; + } catch (exception) { + return null; + } + })(), + default => parent::__get($name) + }; + } + + /** + * Проверить свойство на инициализированность + * + * @param string $name Название + */ + public function __isset(string $name): bool + { + return parent::__isset($name); + } + + /** + * Удалить свойство + * + * @param string $name Название + */ + public function __unset(string $name): void + { + parent::__unset($name); + } + + /** + * Статический вызов + * + * @param string $name Название + * @param array $arguments Параметры + */ + public static function __callStatic(string $name, array $arguments): mixed + { + match ($name) { + 'arangodb' => (new static)->__get('arangodb'), + default => throw new exception("Не найдено свойство или функция: $name", 500) + }; + } +} + diff --git a/mirzaev/marina/system/public/robot.php b/mirzaev/marina/system/public/robot.php new file mode 100644 index 0000000..a58539f --- /dev/null +++ b/mirzaev/marina/system/public/robot.php @@ -0,0 +1,44 @@ +write('/', 'index', 'index', 'GET'); + +// Инициализация ядра +$core = new core(namespace: __NAMESPACE__, router: $router, controller: new controller(false), model: new model(false)); + + +// Обработка запроса +echo $core->start(); + diff --git a/mirzaev/marina/system/settings/.gitignore b/mirzaev/marina/system/settings/.gitignore new file mode 100644 index 0000000..3ad8936 --- /dev/null +++ b/mirzaev/marina/system/settings/.gitignore @@ -0,0 +1,4 @@ +* +!.gitignore +!*.sample +!discord diff --git a/mirzaev/marina/system/settings/arangodb.php.sample b/mirzaev/marina/system/settings/arangodb.php.sample new file mode 100644 index 0000000..e9eb917 --- /dev/null +++ b/mirzaev/marina/system/settings/arangodb.php.sample @@ -0,0 +1,7 @@ + '', + 'clientSecret' => '', + 'redirectUri' => '' +]; diff --git a/mirzaev/marina/system/settings/discord/robot.php.sample b/mirzaev/marina/system/settings/discord/robot.php.sample new file mode 100644 index 0000000..fc1c2d1 --- /dev/null +++ b/mirzaev/marina/system/settings/discord/robot.php.sample @@ -0,0 +1,8 @@ + 'unix:///var/run/arangodb3/arango.sock', + 'database' => '', + 'name' => '', + 'password' => '' +]; diff --git a/mirzaev/marina/system/settings/discord/scope.php.sample b/mirzaev/marina/system/settings/discord/scope.php.sample new file mode 100644 index 0000000..fc1c2d1 --- /dev/null +++ b/mirzaev/marina/system/settings/discord/scope.php.sample @@ -0,0 +1,8 @@ + 'unix:///var/run/arangodb3/arango.sock', + 'database' => '', + 'name' => '', + 'password' => '' +];