diff --git a/CHANGELOG.md b/CHANGELOG.md index e4f577b..ec809da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ - **Auth/Login:** Fix user can't login after commit `6009dc8` (d509127) - **Component:** Fix parent::onRequest{Before,After} miss (200926f) - **Search:** Search keywords in NPHP ways (ccde9c0) +- **Torrent/Comment:** Fix user can't see anonymous uploader's comment (bd2d821) - **User:** Fix User Class miss in string format (3680444) ### Perf diff --git a/framework/Base/Application.php b/Framework/Base/Application.php similarity index 100% rename from framework/Base/Application.php rename to Framework/Base/Application.php diff --git a/framework/Base/BaseObject.php b/Framework/Base/BaseObject.php similarity index 100% rename from framework/Base/BaseObject.php rename to Framework/Base/BaseObject.php diff --git a/framework/Base/Component.php b/Framework/Base/Component.php similarity index 100% rename from framework/Base/Component.php rename to Framework/Base/Component.php diff --git a/framework/Base/ComponentInterface.php b/Framework/Base/ComponentInterface.php similarity index 100% rename from framework/Base/ComponentInterface.php rename to Framework/Base/ComponentInterface.php diff --git a/framework/Base/ComponentTrait.php b/Framework/Base/ComponentTrait.php similarity index 100% rename from framework/Base/ComponentTrait.php rename to Framework/Base/ComponentTrait.php diff --git a/framework/Base/Error.php b/Framework/Base/Error.php similarity index 100% rename from framework/Base/Error.php rename to Framework/Base/Error.php diff --git a/framework/Base/Process.php b/Framework/Base/Process.php similarity index 100% rename from framework/Base/Process.php rename to Framework/Base/Process.php diff --git a/framework/Base/StaticInstanceInterface.php b/Framework/Base/StaticInstanceInterface.php similarity index 100% rename from framework/Base/StaticInstanceInterface.php rename to Framework/Base/StaticInstanceInterface.php diff --git a/framework/Base/StaticInstanceTrait.php b/Framework/Base/StaticInstanceTrait.php similarity index 100% rename from framework/Base/StaticInstanceTrait.php rename to Framework/Base/StaticInstanceTrait.php diff --git a/framework/Base/Timer.php b/Framework/Base/Timer.php similarity index 100% rename from framework/Base/Timer.php rename to Framework/Base/Timer.php diff --git a/framework/Bencode/Bencode.php b/Framework/Bencode/Bencode.php similarity index 100% rename from framework/Bencode/Bencode.php rename to Framework/Bencode/Bencode.php diff --git a/framework/Bencode/ParseErrorException.php b/Framework/Bencode/ParseErrorException.php similarity index 100% rename from framework/Bencode/ParseErrorException.php rename to Framework/Bencode/ParseErrorException.php diff --git a/framework/Component/Config.php b/Framework/Component/Config.php similarity index 100% rename from framework/Component/Config.php rename to Framework/Component/Config.php diff --git a/framework/Component/I18n.php b/Framework/Component/I18n.php similarity index 100% rename from framework/Component/I18n.php rename to Framework/Component/I18n.php diff --git a/framework/Component/Log.php b/Framework/Component/Log.php similarity index 100% rename from framework/Component/Log.php rename to Framework/Component/Log.php diff --git a/framework/Console/Application.php b/Framework/Console/Application.php similarity index 100% rename from framework/Console/Application.php rename to Framework/Console/Application.php diff --git a/framework/Console/Command.php b/Framework/Console/Command.php similarity index 100% rename from framework/Console/Command.php rename to Framework/Console/Command.php diff --git a/framework/Console/Error.php b/Framework/Console/Error.php similarity index 100% rename from framework/Console/Error.php rename to Framework/Console/Error.php diff --git a/framework/Console/ExitCode.php b/Framework/Console/ExitCode.php similarity index 100% rename from framework/Console/ExitCode.php rename to Framework/Console/ExitCode.php diff --git a/framework/Console/Input.php b/Framework/Console/Input.php similarity index 100% rename from framework/Console/Input.php rename to Framework/Console/Input.php diff --git a/framework/Database/BasePDOConnection.php b/Framework/Database/BasePDOConnection.php similarity index 100% rename from framework/Database/BasePDOConnection.php rename to Framework/Database/BasePDOConnection.php diff --git a/framework/Database/MasterSlave/BasePDOConnection.php b/Framework/Database/MasterSlave/BasePDOConnection.php similarity index 100% rename from framework/Database/MasterSlave/BasePDOConnection.php rename to Framework/Database/MasterSlave/BasePDOConnection.php diff --git a/framework/Database/MasterSlave/PDOConnection.php b/Framework/Database/MasterSlave/PDOConnection.php similarity index 100% rename from framework/Database/MasterSlave/PDOConnection.php rename to Framework/Database/MasterSlave/PDOConnection.php diff --git a/framework/Database/PDOConnection.php b/Framework/Database/PDOConnection.php similarity index 100% rename from framework/Database/PDOConnection.php rename to Framework/Database/PDOConnection.php diff --git a/framework/Database/Persistent/BasePDOConnection.php b/Framework/Database/Persistent/BasePDOConnection.php similarity index 100% rename from framework/Database/Persistent/BasePDOConnection.php rename to Framework/Database/Persistent/BasePDOConnection.php diff --git a/framework/Database/Persistent/PDOConnection.php b/Framework/Database/Persistent/PDOConnection.php similarity index 100% rename from framework/Database/Persistent/PDOConnection.php rename to Framework/Database/Persistent/PDOConnection.php diff --git a/framework/Exceptions/ComponentException.php b/Framework/Exceptions/ComponentException.php similarity index 100% rename from framework/Exceptions/ComponentException.php rename to Framework/Exceptions/ComponentException.php diff --git a/framework/Exceptions/ConfigException.php b/Framework/Exceptions/ConfigException.php similarity index 100% rename from framework/Exceptions/ConfigException.php rename to Framework/Exceptions/ConfigException.php diff --git a/framework/Exceptions/ConnectionException.php b/Framework/Exceptions/ConnectionException.php similarity index 100% rename from framework/Exceptions/ConnectionException.php rename to Framework/Exceptions/ConnectionException.php diff --git a/framework/Exceptions/DebugException.php b/Framework/Exceptions/DebugException.php similarity index 100% rename from framework/Exceptions/DebugException.php rename to Framework/Exceptions/DebugException.php diff --git a/framework/Exceptions/EndException.php b/Framework/Exceptions/EndException.php similarity index 100% rename from framework/Exceptions/EndException.php rename to Framework/Exceptions/EndException.php diff --git a/framework/Exceptions/EnvException.php b/Framework/Exceptions/EnvException.php similarity index 100% rename from framework/Exceptions/EnvException.php rename to Framework/Exceptions/EnvException.php diff --git a/framework/Exceptions/ErrorException.php b/Framework/Exceptions/ErrorException.php similarity index 100% rename from framework/Exceptions/ErrorException.php rename to Framework/Exceptions/ErrorException.php diff --git a/framework/Exceptions/NotFoundException.php b/Framework/Exceptions/NotFoundException.php similarity index 100% rename from framework/Exceptions/NotFoundException.php rename to Framework/Exceptions/NotFoundException.php diff --git a/framework/Exceptions/RouteException.php b/Framework/Exceptions/RouteException.php similarity index 100% rename from framework/Exceptions/RouteException.php rename to Framework/Exceptions/RouteException.php diff --git a/framework/Exceptions/ValidatorException.php b/Framework/Exceptions/ValidatorException.php similarity index 100% rename from framework/Exceptions/ValidatorException.php rename to Framework/Exceptions/ValidatorException.php diff --git a/framework/Exceptions/ViewException.php b/Framework/Exceptions/ViewException.php similarity index 100% rename from framework/Exceptions/ViewException.php rename to Framework/Exceptions/ViewException.php diff --git a/framework/Helpers/FileSystemHelper.php b/Framework/Helpers/FileSystemHelper.php similarity index 100% rename from framework/Helpers/FileSystemHelper.php rename to Framework/Helpers/FileSystemHelper.php diff --git a/framework/Helpers/JWTHelper.php b/Framework/Helpers/JWTHelper.php similarity index 100% rename from framework/Helpers/JWTHelper.php rename to Framework/Helpers/JWTHelper.php diff --git a/framework/Helpers/NameHelper.php b/Framework/Helpers/NameHelper.php similarity index 100% rename from framework/Helpers/NameHelper.php rename to Framework/Helpers/NameHelper.php diff --git a/framework/Helpers/ProcessHelper.php b/Framework/Helpers/ProcessHelper.php similarity index 100% rename from framework/Helpers/ProcessHelper.php rename to Framework/Helpers/ProcessHelper.php diff --git a/framework/Helpers/StringHelper.php b/Framework/Helpers/StringHelper.php similarity index 100% rename from framework/Helpers/StringHelper.php rename to Framework/Helpers/StringHelper.php diff --git a/framework/Helpers/SystemInfoHelper.php b/Framework/Helpers/SystemInfoHelper.php similarity index 100% rename from framework/Helpers/SystemInfoHelper.php rename to Framework/Helpers/SystemInfoHelper.php diff --git a/framework/Http/Application.php b/Framework/Http/Application.php similarity index 100% rename from framework/Http/Application.php rename to Framework/Http/Application.php diff --git a/framework/Http/BaseRequest.php b/Framework/Http/BaseRequest.php similarity index 100% rename from framework/Http/BaseRequest.php rename to Framework/Http/BaseRequest.php diff --git a/framework/Http/BaseResponse.php b/Framework/Http/BaseResponse.php similarity index 100% rename from framework/Http/BaseResponse.php rename to Framework/Http/BaseResponse.php diff --git a/framework/Http/Captcha.php b/Framework/Http/Captcha.php similarity index 100% rename from framework/Http/Captcha.php rename to Framework/Http/Captcha.php diff --git a/framework/Http/Controller.php b/Framework/Http/Controller.php similarity index 100% rename from framework/Http/Controller.php rename to Framework/Http/Controller.php diff --git a/framework/Http/Cookie.php b/Framework/Http/Cookie.php similarity index 100% rename from framework/Http/Cookie.php rename to Framework/Http/Cookie.php diff --git a/framework/Http/Error.php b/Framework/Http/Error.php similarity index 100% rename from framework/Http/Error.php rename to Framework/Http/Error.php diff --git a/framework/Http/HttpServer.php b/Framework/Http/HttpServer.php similarity index 100% rename from framework/Http/HttpServer.php rename to Framework/Http/HttpServer.php diff --git a/framework/Http/Image.php b/Framework/Http/Image.php similarity index 100% rename from framework/Http/Image.php rename to Framework/Http/Image.php diff --git a/framework/Http/Request.php b/Framework/Http/Request.php similarity index 100% rename from framework/Http/Request.php rename to Framework/Http/Request.php diff --git a/framework/Http/Response.php b/Framework/Http/Response.php similarity index 100% rename from framework/Http/Response.php rename to Framework/Http/Response.php diff --git a/framework/Http/Route.php b/Framework/Http/Route.php similarity index 100% rename from framework/Http/Route.php rename to Framework/Http/Route.php diff --git a/framework/Http/Session.php b/Framework/Http/Session.php similarity index 100% rename from framework/Http/Session.php rename to Framework/Http/Session.php diff --git a/framework/Http/UploadFile.php b/Framework/Http/UploadFile.php similarity index 100% rename from framework/Http/UploadFile.php rename to Framework/Http/UploadFile.php diff --git a/framework/Http/View.php b/Framework/Http/View.php similarity index 100% rename from framework/Http/View.php rename to Framework/Http/View.php diff --git a/framework/Redis/BaseRedisConnection.php b/Framework/Redis/BaseRedisConnection.php similarity index 100% rename from framework/Redis/BaseRedisConnection.php rename to Framework/Redis/BaseRedisConnection.php diff --git a/framework/Redis/Persistent/BaseRedisConnection.php b/Framework/Redis/Persistent/BaseRedisConnection.php similarity index 100% rename from framework/Redis/Persistent/BaseRedisConnection.php rename to Framework/Redis/Persistent/BaseRedisConnection.php diff --git a/framework/Redis/Persistent/RedisConnection.php b/Framework/Redis/Persistent/RedisConnection.php similarity index 100% rename from framework/Redis/Persistent/RedisConnection.php rename to Framework/Redis/Persistent/RedisConnection.php diff --git a/framework/Redis/RedisConnection.php b/Framework/Redis/RedisConnection.php similarity index 100% rename from framework/Redis/RedisConnection.php rename to Framework/Redis/RedisConnection.php diff --git a/framework/Rid.php b/Framework/Rid.php similarity index 100% rename from framework/Rid.php rename to Framework/Rid.php diff --git a/framework/Utils/AttributesImportUtils.php b/Framework/Utils/AttributesImportUtils.php similarity index 100% rename from framework/Utils/AttributesImportUtils.php rename to Framework/Utils/AttributesImportUtils.php diff --git a/framework/Utils/ClassValueCacheUtils.php b/Framework/Utils/ClassValueCacheUtils.php similarity index 100% rename from framework/Utils/ClassValueCacheUtils.php rename to Framework/Utils/ClassValueCacheUtils.php diff --git a/framework/Utils/HeaderUtils.php b/Framework/Utils/HeaderUtils.php similarity index 100% rename from framework/Utils/HeaderUtils.php rename to Framework/Utils/HeaderUtils.php diff --git a/framework/Utils/IpUtils.php b/Framework/Utils/IpUtils.php similarity index 100% rename from framework/Utils/IpUtils.php rename to Framework/Utils/IpUtils.php diff --git a/framework/Validators/CaptchaTrait.php b/Framework/Validators/CaptchaTrait.php similarity index 100% rename from framework/Validators/CaptchaTrait.php rename to Framework/Validators/CaptchaTrait.php diff --git a/framework/Validators/CsrfTrait.php b/Framework/Validators/CsrfTrait.php similarity index 100% rename from framework/Validators/CsrfTrait.php rename to Framework/Validators/CsrfTrait.php diff --git a/framework/Validators/Pagination.php b/Framework/Validators/Pagination.php similarity index 100% rename from framework/Validators/Pagination.php rename to Framework/Validators/Pagination.php diff --git a/framework/Validators/PaginationTrait.php b/Framework/Validators/PaginationTrait.php similarity index 100% rename from framework/Validators/PaginationTrait.php rename to Framework/Validators/PaginationTrait.php diff --git a/framework/Validators/Validator.php b/Framework/Validators/Validator.php similarity index 100% rename from framework/Validators/Validator.php rename to Framework/Validators/Validator.php diff --git a/framework/View/Conversion.php b/Framework/View/Conversion.php similarity index 100% rename from framework/View/Conversion.php rename to Framework/View/Conversion.php diff --git a/framework/functions.php b/Framework/functions.php similarity index 98% rename from framework/functions.php rename to Framework/functions.php index 764a2df..5ca0e11 100644 --- a/framework/functions.php +++ b/Framework/functions.php @@ -23,7 +23,7 @@ function app($prefix = null) */ function env($name = null, $default = '') { - return \Rid\Base\Env::get($name, $default); + return getenv($name) ?? $default; } } diff --git a/README.md b/README.md index 0c61cf1..4e72d68 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ edit in Admin Panel. 5. Run Test by `php bin/rid-httpd service start -u` , And Congratulation If you see those output **without error throwout**. ```bash - root@ridpt:/data/wwwroot/ridpt.rhilip.info# php bin/rid-httpd service start + root@ridpt:/data/wwwroot/ridpt.rhilip.info# php rid-httpd service start ____ __ ____ ______ /\ _`\ __ /\ \/\ _`\ /\__ _\ \ \ \L\ \/\_\ \_\ \ \ \L\ \/_/\ \/ @@ -169,6 +169,7 @@ Or you can join our chat group on Telegram -- [@ridpt](https://t.me/ridpt) | Library | Used As | Docs | |:--|:--:|:--| | [MixPHP](https://github.com/mix-php/mix-framework/tree/v1) | Framework | ( Chinese Version ) | +| [vlucas/phpdotenv](https://github.com/vlucas/phpdotenv) | phpdotenv | | | [siriusphp/validation](https://github.com/siriusphp/validation) | Validator | | | [league/plates](https://github.com/thephpleague/plates) | Template system | | | [firebase/php-jwt](https://github.com/firebase/php-jwt) | JWT | , | diff --git a/bin/rid-httpd b/bin/rid-httpd deleted file mode 100644 index 50d88df..0000000 --- a/bin/rid-httpd +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env php -run(); -exit($exitCode); diff --git a/composer.json b/composer.json index a5c0605..1e85097 100644 --- a/composer.json +++ b/composer.json @@ -30,6 +30,7 @@ "ext-openssl": "*", "ext-mbstring": "*", "psr/log": "^1.1", + "vlucas/phpdotenv": "^3.5", "league/plates": "^3.3", "mjohnson/decoda": "^6.12", "phpmailer/phpmailer": "^6.0", @@ -40,12 +41,12 @@ }, "autoload": { "psr-4": { - "Rid\\": "framework/", + "Rid\\": "Framework/", "apps\\": "apps/" }, "files": [ - "framework/Rid.php", - "framework/functions.php" + "Framework/Rid.php", + "Framework/functions.php" ] }, "repositories": { diff --git a/composer.lock b/composer.lock index 7ad8d54..eeb280a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "161772be41e2eddc3783c36c034a7638", + "content-hash": "11463ea508aa9f6111a967d0e905fb4c", "packages": [ { "name": "firebase/php-jwt", @@ -251,6 +251,62 @@ "description": "PHPMailer is a full-featured email creation and transfer class for PHP", "time": "2019-02-01T15:04:28+00:00" }, + { + "name": "phpoption/phpoption", + "version": "1.5.0", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/php-option.git", + "reference": "94e644f7d2051a5f0fcf77d81605f152eecff0ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/94e644f7d2051a5f0fcf77d81605f152eecff0ed", + "reference": "94e644f7d2051a5f0fcf77d81605f152eecff0ed", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "4.7.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-0": { + "PhpOption\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache2" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Option Type for PHP", + "keywords": [ + "language", + "option", + "php", + "type" + ], + "time": "2015-07-25T16:39:46+00:00" + }, { "name": "psr/log", "version": "1.1.0", @@ -468,6 +524,133 @@ "text" ], "time": "2019-02-15T01:44:54+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.12.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "550ebaac289296ce228a706d0867afc34687e3f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/550ebaac289296ce228a706d0867afc34687e3f4", + "reference": "550ebaac289296ce228a706d0867afc34687e3f4", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.12-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2019-08-06T08:03:45+00:00" + }, + { + "name": "vlucas/phpdotenv", + "version": "v3.5.0", + "source": { + "type": "git", + "url": "https://github.com/vlucas/phpdotenv.git", + "reference": "95cb0fa6c025f7f0db7fc60f81e9fb231eb2d222" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/95cb0fa6c025f7f0db7fc60f81e9fb231eb2d222", + "reference": "95cb0fa6c025f7f0db7fc60f81e9fb231eb2d222", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^5.4 || ^7.0", + "phpoption/phpoption": "^1.5", + "symfony/polyfill-ctype": "^1.9" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.0 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.5-dev" + } + }, + "autoload": { + "psr-4": { + "Dotenv\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "graham@alt-three.com", + "homepage": "https://gjcampbell.co.uk/" + }, + { + "name": "Vance Lucas", + "email": "vance@vancelucas.com", + "homepage": "https://vancelucas.com/" + } + ], + "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", + "keywords": [ + "dotenv", + "env", + "environment" + ], + "time": "2019-08-27T17:00:38+00:00" } ], "packages-dev": [ diff --git a/framework/Base/Env.php b/framework/Base/Env.php deleted file mode 100644 index 213e4f4..0000000 --- a/framework/Base/Env.php +++ /dev/null @@ -1,42 +0,0 @@ - + */ + +define('RIDPT_START', microtime(true)); + +/* + * -------------------------------------------------------------------------- + * Register The Auto Loader + * -------------------------------------------------------------------------- + * + * Composer provides a convenient, automatically generated class loader for + * our application. We just need to utilize it! We'll simply require it + * into the script here so that we don't have to worry about manual + * loading any of our classes later on. It feels great to relax. + * +*/ +require __DIR__ . '/vendor/autoload.php'; + +/* + * -------------------------------------------------------------------------- + * Check Environment of PHP + * -------------------------------------------------------------------------- + */ +if (!PHP_SAPI === 'cli') + exit('Run in cli like: `php rid-httpd service start`.'); + +/* + * -------------------------------------------------------------------------- + * Load Environment variables + * -------------------------------------------------------------------------- + */ +$dotenv = Dotenv\Dotenv::create(__DIR__); +$dotenv->load(); + +/* + * -------------------------------------------------------------------------- + * Start Swoole Server + * -------------------------------------------------------------------------- + */ +$config = require __DIR__ . '/apps/config/httpd.php'; +$exitCode = (new Rid\Console\Application($config))->run(); +exit($exitCode);