From 30912fdf75a962b03a67e12a9bac38fbde8a8ddb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Mon, 9 Jun 2025 00:01:33 +0800 Subject: [PATCH 01/15] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=E5=88=B08.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 - composer.json | 35 +- composer.lock | 1325 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1348 insertions(+), 13 deletions(-) create mode 100644 composer.lock diff --git a/.gitignore b/.gitignore index 899bcde..3c2969d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,3 @@ /vendor *.log .env -/composer.lock diff --git a/composer.json b/composer.json index a9ee72f..f1e78b2 100644 --- a/composer.json +++ b/composer.json @@ -1,4 +1,5 @@ { + "$schema": "https://getcomposer.org/schema.json", "name": "netcccyun/dnsmgr", "description": "聚合DNS管理系统", "type": "project", @@ -31,10 +32,16 @@ "email": "admin@kuxi.tech", "homepage": "https://www.kuxi.tech", "role": "Project Developer" + }, + { + "name": "耗子", + "email": "haozi@loli.email", + "homepage": "https://hzbk.net", + "role": "Project Developer" } ], "require": { - "php": ">=7.4.0", + "php": ">=8.2.0", "ext-pdo": "*", "ext-gd": "*", "ext-curl": "*", @@ -43,28 +50,30 @@ "ext-mbstring": "*", "ext-ssh2": "*", "ext-ftp": "*", - "topthink/framework": "^6.0.0", - "topthink/think-orm": "^2.0", - "topthink/think-view": "^1.0", + "topthink/framework": "^8.1.0", + "topthink/think-orm": "^4.0", + "topthink/think-view": "^2.0", "cccyun/think-captcha": "^3.0", - "symfony/polyfill-intl-idn": "^1.31", - "symfony/polyfill-php80": "^1.31", + "symfony/polyfill-intl-idn": "^1.32", + "symfony/polyfill-mbstring": "^1.32", + "symfony/polyfill-php81": "^1.32", + "symfony/polyfill-php82": "^1.32", "cccyun/php-whois": "^1.0" }, "require-dev": { - "symfony/var-dumper": "^4.2", + "symfony/var-dumper": "^7.3", "topthink/think-trace":"^1.0", - "swoole/ide-helper": "^5.1" + "swoole/ide-helper": "^6.0" }, "autoload": { "psr-4": { "app\\": "app" - }, - "psr-0": { - "": "extend/" } }, "config": { + "optimize-autoloader": true, + "sort-packages": true, + "platform-check": false, "preferred-install": "dist" }, "scripts": { @@ -72,5 +81,7 @@ "@php think service:discover", "@php think vendor:publish" ] - } + }, + "minimum-stability": "stable", + "prefer-stable": true } diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..6c86cd8 --- /dev/null +++ b/composer.lock @@ -0,0 +1,1325 @@ +{ + "_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": "2bcaddab4080072a6f111b050f345d2d", + "packages": [ + { + "name": "cccyun/php-whois", + "version": "1.1", + "source": { + "type": "git", + "url": "https://github.com/netcccyun/php-whois.git", + "reference": "b5fe65c796c45973a8dcb14dc83ce8eeea2f906e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/netcccyun/php-whois/zipball/b5fe65c796c45973a8dcb14dc83ce8eeea2f906e", + "reference": "b5fe65c796c45973a8dcb14dc83ce8eeea2f906e", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "php": ">=7.2", + "symfony/polyfill-intl-idn": "^1.27" + }, + "require-dev": { + "phpunit/phpunit": "^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Iodev\\": "src/Iodev/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "caihong", + "email": "admin@cccyun.cn" + } + ], + "description": "PHP WHOIS provides parsed and raw whois lookup of domains and ASN routes. PHP 5.4+ and 7+ compatible ", + "homepage": "https://github.com/netcccyun/php-whois", + "keywords": [ + "asn", + "domain", + "info", + "lookup", + "parser", + "php", + "query", + "routes", + "tld", + "whois", + "црщшы" + ], + "support": { + "source": "https://github.com/netcccyun/php-whois/tree/1.1" + }, + "time": "2025-05-01T02:09:16+00:00" + }, + { + "name": "cccyun/think-captcha", + "version": "3.0.11", + "source": { + "type": "git", + "url": "https://github.com/netcccyun/think-captcha.git", + "reference": "40012811bf27b41011b1b60bcfadf16ad339931c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/netcccyun/think-captcha/zipball/40012811bf27b41011b1b60bcfadf16ad339931c", + "reference": "40012811bf27b41011b1b60bcfadf16ad339931c", + "shasum": "" + }, + "require": { + "topthink/framework": "^6.0|^8.0" + }, + "type": "library", + "extra": { + "think": { + "config": { + "captcha": "src/config.php" + }, + "services": [ + "think\\captcha\\CaptchaService" + ] + } + }, + "autoload": { + "files": [ + "src/helper.php" + ], + "psr-4": { + "think\\captcha\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "yunwuxin", + "email": "448901948@qq.com" + } + ], + "description": "captcha package for thinkphp", + "support": { + "source": "https://github.com/netcccyun/think-captcha/tree/3.0.11" + }, + "time": "2025-04-26T08:37:18+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "psr/http-message", + "version": "1.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba", + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.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" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/1.1" + }, + "time": "2023-04-04T09:50:52+00:00" + }, + { + "name": "psr/log", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.2" + }, + "time": "2024-09-11T13:17:53+00:00" + }, + { + "name": "psr/simple-cache", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/764e0b3939f5ca87cb904f570ef9be2d78a07865", + "reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "support": { + "source": "https://github.com/php-fig/simple-cache/tree/3.0.0" + }, + "time": "2021-10-29T13:26:27+00:00" + }, + { + "name": "symfony/polyfill-intl-idn", + "version": "v1.32.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-idn.git", + "reference": "9614ac4d8061dc257ecc64cba1b140873dce8ad3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/9614ac4d8061dc257ecc64cba1b140873dce8ad3", + "reference": "9614ac4d8061dc257ecc64cba1b140873dce8ad3", + "shasum": "" + }, + "require": { + "php": ">=7.2", + "symfony/polyfill-intl-normalizer": "^1.10" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Idn\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Laurent Bassin", + "email": "laurent@bassin.info" + }, + { + "name": "Trevor Rowbotham", + "email": "trevor.rowbotham@pm.me" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "idn", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.32.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": "2024-09-10T14:38:51+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.32.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "3833d7255cc303546435cb650316bff708a1c75c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", + "reference": "3833d7255cc303546435cb650316bff708a1c75c", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.32.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": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.32.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493", + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493", + "shasum": "" + }, + "require": { + "ext-iconv": "*", + "php": ">=7.2" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.32.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": "2024-12-23T08:48:59+00:00" + }, + { + "name": "symfony/polyfill-php81", + "version": "v1.32.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.32.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": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-php82", + "version": "v1.32.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php82.git", + "reference": "5d2ed36f7734637dacc025f179698031951b1692" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php82/zipball/5d2ed36f7734637dacc025f179698031951b1692", + "reference": "5d2ed36f7734637dacc025f179698031951b1692", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php82\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php82/tree/v1.32.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": "2024-09-09T11:45:10+00:00" + }, + { + "name": "topthink/framework", + "version": "v8.1.2", + "source": { + "type": "git", + "url": "https://github.com/top-think/framework.git", + "reference": "8faec5c9b7a7f2a66ca3140a57e81bd6cd37567c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/framework/zipball/8faec5c9b7a7f2a66ca3140a57e81bd6cd37567c", + "reference": "8faec5c9b7a7f2a66ca3140a57e81bd6cd37567c", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-json": "*", + "ext-mbstring": "*", + "php": ">=8.0.0", + "psr/http-message": "^1.0", + "psr/log": "^1.0|^2.0|^3.0", + "psr/simple-cache": "^1.0|^2.0|^3.0", + "topthink/think-container": "^3.0", + "topthink/think-helper": "^3.1", + "topthink/think-orm": "^3.0|^4.0", + "topthink/think-validate": "^3.0" + }, + "require-dev": { + "guzzlehttp/psr7": "^2.1.0", + "mikey179/vfsstream": "^1.6", + "mockery/mockery": "^1.2", + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "autoload": { + "files": [], + "psr-4": { + "think\\": "src/think/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + }, + { + "name": "yunwuxin", + "email": "448901948@qq.com" + } + ], + "description": "The ThinkPHP Framework.", + "homepage": "http://thinkphp.cn/", + "keywords": [ + "framework", + "orm", + "thinkphp" + ], + "support": { + "issues": "https://github.com/top-think/framework/issues", + "source": "https://github.com/top-think/framework/tree/v8.1.2" + }, + "time": "2025-01-14T08:04:03+00:00" + }, + { + "name": "topthink/think-container", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-container.git", + "reference": "b2df244be1e7399ad4c8be1ccc40ed57868f730a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-container/zipball/b2df244be1e7399ad4c8be1ccc40ed57868f730a", + "reference": "b2df244be1e7399ad4c8be1ccc40ed57868f730a", + "shasum": "" + }, + "require": { + "php": ">=8.0", + "psr/container": "^2.0", + "topthink/think-helper": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "autoload": { + "files": [], + "psr-4": { + "think\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + } + ], + "description": "PHP Container & Facade Manager", + "support": { + "issues": "https://github.com/top-think/think-container/issues", + "source": "https://github.com/top-think/think-container/tree/v3.0.2" + }, + "time": "2025-04-07T03:21:51+00:00" + }, + { + "name": "topthink/think-helper", + "version": "v3.1.11", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-helper.git", + "reference": "1d6ada9b9f3130046bf6922fe1bd159c8d88a33c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-helper/zipball/1d6ada9b9f3130046bf6922fe1bd159c8d88a33c", + "reference": "1d6ada9b9f3130046bf6922fe1bd159c8d88a33c", + "shasum": "" + }, + "require": { + "php": ">=7.1.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/helper.php" + ], + "psr-4": { + "think\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "yunwuxin", + "email": "448901948@qq.com" + } + ], + "description": "The ThinkPHP6 Helper Package", + "support": { + "issues": "https://github.com/top-think/think-helper/issues", + "source": "https://github.com/top-think/think-helper/tree/v3.1.11" + }, + "time": "2025-04-07T06:55:59+00:00" + }, + { + "name": "topthink/think-orm", + "version": "v4.0.41", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-orm.git", + "reference": "cb610268dadaa5fb98d2400030a25659e580bc75" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-orm/zipball/cb610268dadaa5fb98d2400030a25659e580bc75", + "reference": "cb610268dadaa5fb98d2400030a25659e580bc75", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-pdo": "*", + "php": ">=8.0.0", + "psr/log": ">=1.0", + "psr/simple-cache": ">=1.0", + "topthink/think-helper": "^3.1", + "topthink/think-validate": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.6|^10" + }, + "suggest": { + "ext-mongodb": "provide mongodb support" + }, + "type": "library", + "autoload": { + "files": [ + "src/helper.php", + "stubs/load_stubs.php" + ], + "psr-4": { + "think\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + } + ], + "description": "the PHP Database&ORM Framework", + "keywords": [ + "database", + "orm" + ], + "support": { + "issues": "https://github.com/top-think/think-orm/issues", + "source": "https://github.com/top-think/think-orm/tree/v4.0.41" + }, + "time": "2025-05-28T09:27:43+00:00" + }, + { + "name": "topthink/think-template", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-template.git", + "reference": "0b88bd449f0f7626dd75b05f557c8bc208c08b0c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-template/zipball/0b88bd449f0f7626dd75b05f557c8bc208c08b0c", + "reference": "0b88bd449f0f7626dd75b05f557c8bc208c08b0c", + "shasum": "" + }, + "require": { + "php": ">=8.0.0", + "psr/simple-cache": ">=1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "think\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + } + ], + "description": "the php template engine", + "support": { + "issues": "https://github.com/top-think/think-template/issues", + "source": "https://github.com/top-think/think-template/tree/v3.0.2" + }, + "time": "2024-10-16T03:41:06+00:00" + }, + { + "name": "topthink/think-validate", + "version": "v3.0.6", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-validate.git", + "reference": "c6a7704fc991d3689408299822dbc2ba4ee3f79a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-validate/zipball/c6a7704fc991d3689408299822dbc2ba4ee3f79a", + "reference": "c6a7704fc991d3689408299822dbc2ba4ee3f79a", + "shasum": "" + }, + "require": { + "php": ">=8.0", + "topthink/think-container": ">=3.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/helper.php" + ], + "psr-4": { + "think\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + } + ], + "description": "think validate", + "support": { + "issues": "https://github.com/top-think/think-validate/issues", + "source": "https://github.com/top-think/think-validate/tree/v3.0.6" + }, + "time": "2025-05-23T04:10:45+00:00" + }, + { + "name": "topthink/think-view", + "version": "v2.0.5", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-view.git", + "reference": "b42009b98199b5a3833d3d6fd18c8a55aa511fad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-view/zipball/b42009b98199b5a3833d3d6fd18c8a55aa511fad", + "reference": "b42009b98199b5a3833d3d6fd18c8a55aa511fad", + "shasum": "" + }, + "require": { + "php": ">=8.0.0", + "topthink/think-template": "^3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "think\\view\\driver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + } + ], + "description": "thinkphp template driver", + "support": { + "issues": "https://github.com/top-think/think-view/issues", + "source": "https://github.com/top-think/think-view/tree/v2.0.5" + }, + "time": "2025-03-19T07:04:19+00:00" + } + ], + "packages-dev": [ + { + "name": "swoole/ide-helper", + "version": "6.0.2", + "source": { + "type": "git", + "url": "https://github.com/swoole/ide-helper.git", + "reference": "6f12243dce071714c5febe059578d909698f9a52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/swoole/ide-helper/zipball/6f12243dce071714c5febe059578d909698f9a52", + "reference": "6f12243dce071714c5febe059578d909698f9a52", + "shasum": "" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Team Swoole", + "email": "team@swoole.com" + } + ], + "description": "IDE help files for Swoole.", + "support": { + "issues": "https://github.com/swoole/ide-helper/issues", + "source": "https://github.com/swoole/ide-helper/tree/6.0.2" + }, + "time": "2025-03-23T07:31:41+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.6-dev" + } + }, + "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.6.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": "2024-09-25T14:21:43+00:00" + }, + { + "name": "symfony/var-dumper", + "version": "v7.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "548f6760c54197b1084e1e5c71f6d9d523f2f78e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/548f6760c54197b1084e1e5c71f6d9d523f2f78e", + "reference": "548f6760c54197b1084e1e5c71f6d9d523f2f78e", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/console": "<6.4" + }, + "require-dev": { + "ext-iconv": "*", + "symfony/console": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/process": "^6.4|^7.0", + "symfony/uid": "^6.4|^7.0", + "twig/twig": "^3.12" + }, + "bin": [ + "Resources/bin/var-dump-server" + ], + "type": "library", + "autoload": { + "files": [ + "Resources/functions/dump.php" + ], + "psr-4": { + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "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": "Provides mechanisms for walking through any arbitrary PHP variable", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "support": { + "source": "https://github.com/symfony/var-dumper/tree/v7.3.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": "2025-04-27T18:39:23+00:00" + }, + { + "name": "topthink/think-trace", + "version": "v1.6", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-trace.git", + "reference": "136cd5d97e8bdb780e4b5c1637c588ed7ca3e142" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-trace/zipball/136cd5d97e8bdb780e4b5c1637c588ed7ca3e142", + "reference": "136cd5d97e8bdb780e4b5c1637c588ed7ca3e142", + "shasum": "" + }, + "require": { + "php": ">=7.1.0", + "topthink/framework": "^6.0|^8.0" + }, + "type": "library", + "extra": { + "think": { + "config": { + "trace": "src/config.php" + }, + "services": [ + "think\\trace\\Service" + ] + } + }, + "autoload": { + "psr-4": { + "think\\trace\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + } + ], + "description": "thinkphp debug trace", + "support": { + "issues": "https://github.com/top-think/think-trace/issues", + "source": "https://github.com/top-think/think-trace/tree/v1.6" + }, + "time": "2023-02-07T08:36:32+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": {}, + "prefer-stable": true, + "prefer-lowest": false, + "platform": { + "php": ">=8.2.0", + "ext-pdo": "*", + "ext-gd": "*", + "ext-curl": "*", + "ext-openssl": "*", + "ext-sockets": "*", + "ext-mbstring": "*", + "ext-ssh2": "*", + "ext-ftp": "*" + }, + "platform-dev": {}, + "plugin-api-version": "2.6.0" +} From 767aec5ebc9732418b1c15e5c59d122c9890c06d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Mon, 9 Jun 2025 00:09:48 +0800 Subject: [PATCH 02/15] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/Index.php | 4 +--- app/view/index/index.html | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controller/Index.php b/app/controller/Index.php index 237fdc9..e261358 100644 --- a/app/controller/Index.php +++ b/app/controller/Index.php @@ -7,8 +7,6 @@ use Exception; use think\facade\Db; use think\facade\View; use think\facade\Cache; -use app\lib\DnsHelper; -use app\utils\MsgNotice; class Index extends BaseController { @@ -63,7 +61,7 @@ class Index extends BaseController $tmp = 'version()'; $mysqlVersion = Db::query("select version()")[0][$tmp]; $info = [ - 'framework_version' => app()::VERSION, + 'framework_version' => app()->version(), 'php_version' => PHP_VERSION, 'mysql_version' => $mysqlVersion, 'software' => $_SERVER['SERVER_SOFTWARE'], diff --git a/app/view/index/index.html b/app/view/index/index.html index 917b9c7..ee93358 100644 --- a/app/view/index/index.html +++ b/app/view/index/index.html @@ -129,6 +129,10 @@ + + + + From 848610ffe0fe7d94489bae635200b4f0f8e57c0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Mon, 9 Jun 2025 00:51:50 +0800 Subject: [PATCH 03/15] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=83=A8=E5=88=86?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 11 ++++++---- app/controller/Index.php | 6 ++++-- app/view/index/index.html | 42 ++++++++++++++++++++++----------------- 3 files changed, 35 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index c36e8de..a0673cd 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ * 从[Release](https://github.com/netcccyun/dnsmgr/releases)页面下载安装包 -* 运行环境要求PHP7.4+,MySQL5.6+ +* 运行环境要求PHP8.0+,MySQL5.6+ * 设置网站运行目录为`public` @@ -52,10 +52,13 @@ * Nginx ``` +location ~* (runtime|application)/ { + return 403; +} location / { - if (!-e $request_filename){ - rewrite ^(.*)$ /index.php?s=$1 last; break; - } + if (!-e $request_filename) { + rewrite ^(.*)$ /index.php?s=$1 last; break; + } } ``` diff --git a/app/controller/Index.php b/app/controller/Index.php index e261358..a932622 100644 --- a/app/controller/Index.php +++ b/app/controller/Index.php @@ -26,7 +26,7 @@ class Index extends BaseController $stat['tasks'] = Db::name('dmtask')->count(); $stat['certs'] = Db::name('cert_order')->count(); $stat['deploys'] = Db::name('cert_deploy')->count(); - + $run_time = config_get('run_time', null, true); $run_state = $run_time ? (time() - strtotime($run_time) > 10 ? 0 : 1) : 0; $stat['dmonitor_state'] = $run_state; @@ -42,7 +42,7 @@ class Index extends BaseController $stat['certorder_status_5'] = Db::name('cert_order')->where('status', '<', 0)->count(); $stat['certorder_status_6'] = Db::name('cert_order')->where('expiretime', '<', date('Y-m-d H:i:s', time() + 86400 * 7))->where('expiretime', '>=', date('Y-m-d H:i:s'))->count(); $stat['certorder_status_7'] = Db::name('cert_order')->where('expiretime', '<', date('Y-m-d H:i:s'))->count(); - + $stat['certdeploy_status_0'] = Db::name('cert_deploy')->where('status', 0)->count(); $stat['certdeploy_status_1'] = Db::name('cert_deploy')->where('status', 1)->count(); $stat['certdeploy_status_2'] = Db::name('cert_deploy')->where('status', -1)->count(); @@ -67,6 +67,8 @@ class Index extends BaseController 'software' => $_SERVER['SERVER_SOFTWARE'], 'os' => php_uname(), 'date' => date("Y-m-d H:i:s"), + 'no_https' => ! $this->request->isSsl(), + 'old_browser' => str_contains($this->request->header('User-Agent'), 'Windows NT') && str_contains($this->request->header('User-Agent'), 'Trident'), ]; View::assign('info', $info); View::assign('checkupdate', '//auth.cccyun.cc/app/dnsmgr.php?ver=' . config('app.version')); diff --git a/app/view/index/index.html b/app/view/index/index.html index ee93358..5b9d0a1 100644 --- a/app/view/index/index.html +++ b/app/view/index/index.html @@ -72,7 +72,23 @@
-
+
+ {if $info.no_https} +
+
+ 当前正在使用HTTP访问,可能存在被窃取敏感信息风险,请使用HTTPS访问! +
+
+ {/if} + {if $info.old_browser} +
+
+ 当前浏览器是兼容模式,为确保后台功能正常使用,请切换到极速模式
+ 操作方法:点击浏览器地址栏右侧的IE符号→选择“极速模式” +
+
+ {/if} +
@@ -129,18 +145,22 @@
框架版本{$info.framework_version}
PHP版本 {$info.php_version}
- + - + - + + + + + @@ -220,18 +240,4 @@ function cleancache(){ }); } - {/block} \ No newline at end of file From 1021deb60dd095f0e4d99bbc97a94d335495b99a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Mon, 9 Jun 2025 01:43:58 +0800 Subject: [PATCH 04/15] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=83=A8=E5=88=86?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/command/Dmtask.php | 2 +- app/lib/NewDbManager.php | 4 ++-- app/utils/CheckUtils.php | 25 ++++++++++--------------- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/app/command/Dmtask.php b/app/command/Dmtask.php index f69eb53..d1f1aab 100644 --- a/app/command/Dmtask.php +++ b/app/command/Dmtask.php @@ -45,7 +45,7 @@ class Dmtask extends Command private function runtask() { - \Co::set(['hook_flags' => SWOOLE_HOOK_ALL]); + \Co::set(['hook_flags' => SWOOLE_HOOK_ALL ^ SWOOLE_HOOK_NATIVE_CURL]); \Co\run(function () { $date = date("Ymd"); $count = config_get('run_count', null, true) ?? 0; diff --git a/app/lib/NewDbManager.php b/app/lib/NewDbManager.php index eb568b9..6e2d578 100644 --- a/app/lib/NewDbManager.php +++ b/app/lib/NewDbManager.php @@ -10,11 +10,11 @@ class NewDbManager extends \think\Db /** * 创建数据库连接实例 * @access protected - * @param string|null $name 连接标识 + * @param string|array|null $name 连接标识 * @param bool $force 强制重新连接 * @return ConnectionInterface */ - protected function instance(string $name = null, bool $force = false): ConnectionInterface + protected function instance(string|array $name = null, bool $force = false): ConnectionInterface { if (empty($name)) { $name = $this->getConfig('default', 'mysql'); diff --git a/app/utils/CheckUtils.php b/app/utils/CheckUtils.php index aa684d8..523b378 100644 --- a/app/utils/CheckUtils.php +++ b/app/utils/CheckUtils.php @@ -12,17 +12,12 @@ class CheckUtils if (!$urlarr) { return ['status' => false, 'errmsg' => 'Invalid URL', 'usetime' => 0]; } - if (substr($urlarr['host'], 0, 1) == '[' && substr($urlarr['host'], -1) == ']') { - $urlarr['host'] = substr($urlarr['host'], 1, -1); - } - if (!empty($ip) && !filter_var($urlarr['host'], FILTER_VALIDATE_IP)) { - if (!filter_var($ip, FILTER_VALIDATE_IP)) { - $ip = gethostbyname($ip); - } - if (!empty($ip) && filter_var($ip, FILTER_VALIDATE_IP)) { - $port = isset($urlarr['port']) ? $urlarr['port'] : ($urlarr['scheme'] == 'https' ? 443 : 80); - $resolve = $urlarr['host'] . ':' . $port . ':' . $ip; - } + if (str_starts_with($urlarr['host'], '[') && str_ends_with($urlarr['host'], ']')) { + $urlarr['host'] = substr($urlarr['host'], 1, -1); + } + if (!empty($ip) && !filter_var($urlarr['host'], FILTER_VALIDATE_IP) && filter_var($ip, FILTER_VALIDATE_IP)) { + $port = $urlarr['port'] ?? ($urlarr['scheme'] == 'https' ? 443 : 80); + $resolve = $urlarr['host'] . ':' . $port . ':' . $ip; } $ch = curl_init(); if ($proxy) { @@ -83,12 +78,12 @@ class CheckUtils public static function tcp($target, $ip, $port, $timeout) { if (!empty($ip) && filter_var($ip, FILTER_VALIDATE_IP)) $target = $ip; - if (substr($target, -1) == '.') $target = substr($target, 0, -1); + if (str_ends_with($target, '.')) $target = substr($target, 0, -1); if (!filter_var($target, FILTER_VALIDATE_IP) && checkDomain($target)) { $target = gethostbyname($target); if (!$target) return ['status' => false, 'errmsg' => 'DNS resolve failed', 'usetime' => 0]; } - if (filter_var($target, FILTER_VALIDATE_IP) && strpos($target, ':') !== false) { + if (filter_var($target, FILTER_VALIDATE_IP) && str_contains($target, ':')) { $target = '['.$target.']'; } $starttime = getMillisecond(); @@ -108,7 +103,7 @@ class CheckUtils { if (!function_exists('exec')) return ['status' => false, 'errmsg' => 'exec函数不可用', 'usetime' => 0]; if (!empty($ip) && filter_var($ip, FILTER_VALIDATE_IP)) $target = $ip; - if (substr($target, -1) == '.') $target = substr($target, 0, -1); + if (str_ends_with($target, '.')) $target = substr($target, 0, -1); if (!filter_var($target, FILTER_VALIDATE_IP) && checkDomain($target)) { $target = gethostbyname($target); if (!$target) return ['status' => false, 'errmsg' => 'DNS resolve failed', 'usetime' => 0]; @@ -117,7 +112,7 @@ class CheckUtils return ['status' => false, 'errmsg' => 'Invalid IP address', 'usetime' => 0]; } $timeout = 1; - exec('ping -c 1 -w '.$timeout.' '.$target.'', $output, $return_var); + exec('ping -c 1 -w '.$timeout.' '.$target, $output, $return_var); $usetime = !empty($output[1]) ? round(getSubstr($output[1], 'time=', ' ms')) : 0; $errmsg = null; if ($return_var !== 0) { From 4a4cdd059cac6b94a2226c195ebf41f58f028659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Mon, 9 Jun 2025 01:47:53 +0800 Subject: [PATCH 05/15] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/Index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controller/Index.php b/app/controller/Index.php index a932622..af5b722 100644 --- a/app/controller/Index.php +++ b/app/controller/Index.php @@ -67,8 +67,8 @@ class Index extends BaseController 'software' => $_SERVER['SERVER_SOFTWARE'], 'os' => php_uname(), 'date' => date("Y-m-d H:i:s"), - 'no_https' => ! $this->request->isSsl(), - 'old_browser' => str_contains($this->request->header('User-Agent'), 'Windows NT') && str_contains($this->request->header('User-Agent'), 'Trident'), + 'no_https' => ! $this->request->isSsl(), + 'old_browser' => str_contains($this->request->header('User-Agent'), 'Windows NT') && str_contains($this->request->header('User-Agent'), 'Trident'), ]; View::assign('info', $info); View::assign('checkupdate', '//auth.cccyun.cc/app/dnsmgr.php?ver=' . config('app.version')); From 3587db2b53a345d6d4449cce10100481d03fa15f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Mon, 9 Jun 2025 01:53:04 +0800 Subject: [PATCH 06/15] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/utils/CheckUtils.php | 10 ++++----- app/view/index/index.html | 46 +++++++++++++++++++-------------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/app/utils/CheckUtils.php b/app/utils/CheckUtils.php index 523b378..fea5529 100644 --- a/app/utils/CheckUtils.php +++ b/app/utils/CheckUtils.php @@ -12,12 +12,12 @@ class CheckUtils if (!$urlarr) { return ['status' => false, 'errmsg' => 'Invalid URL', 'usetime' => 0]; } - if (str_starts_with($urlarr['host'], '[') && str_ends_with($urlarr['host'], ']')) { - $urlarr['host'] = substr($urlarr['host'], 1, -1); - } + if (str_starts_with($urlarr['host'], '[') && str_ends_with($urlarr['host'], ']')) { + $urlarr['host'] = substr($urlarr['host'], 1, -1); + } if (!empty($ip) && !filter_var($urlarr['host'], FILTER_VALIDATE_IP) && filter_var($ip, FILTER_VALIDATE_IP)) { - $port = $urlarr['port'] ?? ($urlarr['scheme'] == 'https' ? 443 : 80); - $resolve = $urlarr['host'] . ':' . $port . ':' . $ip; + $port = $urlarr['port'] ?? ($urlarr['scheme'] == 'https' ? 443 : 80); + $resolve = $urlarr['host'] . ':' . $port . ':' . $ip; } $ch = curl_init(); if ($proxy) { diff --git a/app/view/index/index.html b/app/view/index/index.html index 5b9d0a1..4621bb8 100644 --- a/app/view/index/index.html +++ b/app/view/index/index.html @@ -71,25 +71,25 @@
-
-
- {if $info.no_https} -
-
- 当前正在使用HTTP访问,可能存在被窃取敏感信息风险,请使用HTTPS访问! -
-
- {/if} - {if $info.old_browser} -
-
- 当前浏览器是兼容模式,为确保后台功能正常使用,请切换到极速模式
- 操作方法:点击浏览器地址栏右侧的IE符号→选择“极速模式” -
-
- {/if} -
-
+
+
+ {if $info.no_https} +
+
+ 当前正在使用HTTP访问,可能存在被窃取敏感信息风险,请使用HTTPS访问! +
+
+ {/if} + {if $info.old_browser} +
+
+ 当前浏览器是兼容模式,为确保后台功能正常使用,请切换到极速模式
+ 操作方法:点击浏览器地址栏右侧的IE符号→选择“极速模式” +
+
+ {/if} +
+
@@ -145,10 +145,10 @@
框架版本 {$info.framework_version}
PHP版本 {$info.php_version}
MySQL版本数据库版本 {$info.mysql_version}
Web服务器{$info.software}
服务器时间 {$info.date}
- + - + @@ -157,10 +157,10 @@ - + - + From 5add791ef1e573acd0aedab9826a8d07fc62cd6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Mon, 9 Jun 2025 05:04:06 +0800 Subject: [PATCH 07/15] =?UTF-8?q?=E9=87=8D=E6=9E=84=E4=BD=BF=E7=94=A8guzzl?= =?UTF-8?q?ehttp=E5=8F=91=E9=80=81=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common.php | 263 ++++++++------ app/lib/client/Ucloud.php | 2 +- app/lib/deploy/baishan.php | 2 +- app/lib/deploy/btwaf.php | 6 +- app/lib/deploy/cachefly.php | 4 +- app/lib/deploy/cdnfly.php | 4 +- app/lib/deploy/doge.php | 6 +- app/lib/deploy/gcore.php | 4 +- app/lib/deploy/goedge.php | 8 +- app/lib/deploy/kangle.php | 8 +- app/lib/deploy/kangleadmin.php | 4 +- app/lib/deploy/kuocai.php | 2 +- app/lib/deploy/lecdn.php | 6 +- app/lib/deploy/mwpanel.php | 4 +- app/lib/deploy/opanel.php | 8 +- app/lib/deploy/proxmox.php | 9 +- app/lib/deploy/ratpanel.php | 8 +- app/lib/deploy/safeline.php | 6 +- app/lib/deploy/upyun.php | 4 +- app/lib/deploy/wangsu.php | 26 +- app/lib/dns/powerdns.php | 5 +- app/service/OptimizeService.php | 2 +- app/utils/CheckUtils.php | 98 +++-- app/utils/DnsQueryUtils.php | 2 +- app/utils/MsgNotice.php | 10 +- composer.json | 21 +- composer.lock | 624 ++++++++++++++++++++++++++++---- 27 files changed, 822 insertions(+), 324 deletions(-) diff --git a/app/common.php b/app/common.php index 2719cd1..0f3bcc3 100644 --- a/app/common.php +++ b/app/common.php @@ -1,50 +1,52 @@ 10, + 'verify' => false, + 'headers' => [ + 'Content-Type' => 'application/x-www-form-urlencoded', + 'User-Agent' => $ua ?: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36' + ], + 'http_errors' => false // 不抛出异常 + ]; + + $options['headers'] = array_merge($options['headers'], $addheader); + if ($referer) { + $options['headers']['Referer'] = $referer; } if ($cookie) { - curl_setopt($ch, CURLOPT_COOKIE, $cookie); + $options['headers']['Cookie'] = $cookie; } - if ($referer) { - curl_setopt($ch, CURLOPT_REFERER, $referer); + + $method = 'GET'; + if ($post) { + $method = 'POST'; + if (is_array($post)) { + $options['form_params'] = $post; + } else { + $options['body'] = $post; + } } - if ($ua) { - curl_setopt($ch, CURLOPT_USERAGENT, $ua); - } else { - curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Linux; U; Android 4.0.4; es-mx; HTC_One_X Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0"); + + try { + $client = new Client(); + $response = $client->request($method, $url, $options); + + if ($nobody) { + return ''; + } + + return $response->getBody()->getContents(); + } catch (GuzzleException $e) { + return ''; } - if ($nobody) { - curl_setopt($ch, CURLOPT_NOBODY, 1); - } - curl_setopt($ch, CURLOPT_ENCODING, "gzip"); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - $ret = curl_exec($ch); - curl_close($ch); - return $ret; } function real_ip($type = 0) @@ -319,47 +321,41 @@ function getMainDomain($host) function check_proxy($url, $proxy_server, $proxy_port, $type, $proxy_user, $proxy_pwd) { - $ch = curl_init($url); - if ($type == 'https') { - $proxy_type = CURLPROXY_HTTPS; - } elseif ($type == 'sock4') { - $proxy_type = CURLPROXY_SOCKS4; - } elseif ($type == 'sock5') { - $proxy_type = CURLPROXY_SOCKS5; - } elseif ($type == 'sock5h') { - $proxy_type = CURLPROXY_SOCKS5_HOSTNAME; - } else { - $proxy_type = CURLPROXY_HTTP; - } - curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_BASIC); - curl_setopt($ch, CURLOPT_PROXY, $proxy_server); - curl_setopt($ch, CURLOPT_PROXYPORT, intval($proxy_port)); + match ($type) { + 'https' => $proxy_string = 'https://', + 'sock4' => $proxy_string = 'socks4://', + 'sock5' => $proxy_string = 'socks5://', + 'sock5h' => $proxy_string = 'socks5h://', + default => $proxy_string = 'http://', + }; + if (!empty($proxy_user) && !empty($proxy_pwd)) { - curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxy_user . ':' . $proxy_pwd); + $proxy_string .= $proxy_user . ':' . $proxy_pwd . '@'; } - curl_setopt($ch, CURLOPT_PROXYTYPE, $proxy_type); - $httpheader[] = "Accept: */*"; - $httpheader[] = "Accept-Language: zh-CN,zh;q=0.8"; - $httpheader[] = "Connection: close"; - curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36'); - curl_setopt($ch, CURLOPT_TIMEOUT, 3); - curl_exec($ch); - $errno = curl_errno($ch); - if ($errno) { - $errmsg = curl_error($ch); - curl_close($ch); - throw new Exception($errmsg); - } - $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); - curl_close($ch); - if ($httpCode >= 200 && $httpCode < 400) { - return true; - } else { - throw new Exception('HTTP状态码异常:' . $httpCode); + + $proxy_string .= $proxy_server . ':' . intval($proxy_port); + $options = [ + 'proxy' => $proxy_string, + 'timeout' => 3, + 'connect_timeout' => 3, + 'verify' => false, + 'headers' => [ + 'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36' + ] + ]; + + try { + $client = new Client(); + $response = $client->request('GET', $url, $options); + $httpCode = $response->getStatusCode(); + + if ($httpCode >= 200 && $httpCode < 400) { + return true; + } else { + throw new Exception('HTTP状态码异常:' . $httpCode); + } + } catch (GuzzleException $e) { + throw new Exception($e->getMessage()); } } @@ -394,59 +390,94 @@ function clearDirectory($dir): bool return true; } -function curl_client($url, $data = null, $referer = null, $cookie = null, $headers = null, $proxy = false, $method = null, $timeout = 5, $default_headers = true) +function curl_client($url, $data = null, $referer = null, $cookie = null, $headers = null, $proxy = false, $method = null, $timeout = 5) { - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - if ($default_headers === true) { - $httpheader[] = "Accept: */*"; - $httpheader[] = "Accept-Language: zh-CN,zh;q=0.8"; - $httpheader[] = "Connection: close"; - if ($headers) { - $httpheader = array_merge($headers, $httpheader); - } - } else { - $httpheader = $headers; + $options = [ + 'timeout' => $timeout, + 'connect_timeout' => $timeout, + 'allow_redirects' => false, + 'verify' => false, + 'headers' => [ + 'Content-Type' => 'application/x-www-form-urlencoded', + 'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36', + ], + 'http_errors' => false // 不抛出异常 + ]; + + // 默认请求方法 + if (!$method) { + $method = $data ? 'POST' : 'GET'; } - curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader); - curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.95 Safari/537.36"); - curl_setopt($ch, CURLOPT_HEADER, true); - if ($data) { - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, $data); + // 处理头部 + if (is_array($headers)) { + $options['headers'] = array_merge($options['headers'], $headers); } + // 处理Cookie if ($cookie) { - curl_setopt($ch, CURLOPT_COOKIE, $cookie); + $options['headers']['Cookie'] = $cookie; } + // 处理Referer if ($referer) { - curl_setopt($ch, CURLOPT_REFERER, $referer); + $options['headers']['Referer'] = $referer; } - if ($method) { - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); + // 处理数据 + if ($data) { + if ($method !== 'GET') { + $options['body'] = $data; + } else { + // 兼容已经存在查询字符串的情况 + if (!str_contains($url, '?')) { + $options['query'] = $data; + } + } } - + // 处理代理 if ($proxy) { - curl_set_proxy($ch); + $proxy_server = config_get('proxy_server'); + $proxy_port = intval(config_get('proxy_port')); + $proxy_userpwd = config_get('proxy_user').':'.config_get('proxy_pwd'); + $proxy_type = config_get('proxy_type'); + + if (empty($proxy_server) || empty($proxy_port)) { + throw new Exception('代理服务器或端口未配置'); + } + + match ($proxy_type) { + 'https' => $proxy_string = 'https://', + 'sock4' => $proxy_string = 'socks4://', + 'sock5' => $proxy_string = 'socks5://', + 'sock5h' => $proxy_string = 'socks5h://', + default => $proxy_string = 'http://', + }; + + if ($proxy_userpwd != ':') { + $proxy_string .= $proxy_userpwd . '@'; + } + + $proxy_string .= $proxy_server . ':' . $proxy_port; + $options['proxy'] = $proxy_string; } - $ret = curl_exec($ch); - $errno = curl_errno($ch); - if ($errno) { - $errmsg = curl_error($ch); - curl_close($ch); - throw new Exception('Curl error: ' . $errmsg); + try { + $client = new Client(); + $response = $client->request($method, $url, $options); + $code = $response->getStatusCode(); + + // 取重定向URL + $redirect_url = ''; + if ($code >= 300 && $code < 400) { + $redirect_url = $response->getHeaderLine('Location'); + } + + return [ + 'code' => $code, + 'redirect_url' => $redirect_url, + 'headers' => $response->getHeaders(), + 'body' => $response->getBody()->getContents() + ]; + } catch (GuzzleException $e) { + throw new Exception('请求失败: ' . $e->getMessage()); } - $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); - $headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE); - $redirect_url = curl_getinfo($ch, CURLINFO_REDIRECT_URL); - curl_close($ch); - $header = substr($ret, 0, $headerSize); - $body = substr($ret, $headerSize); - return ['code' => $httpCode, 'redirect_url' => $redirect_url, 'header' => $header, 'body' => $body]; } function curl_set_proxy(&$ch) diff --git a/app/lib/client/Ucloud.php b/app/lib/client/Ucloud.php index 4d1a9d7..23f0a1f 100644 --- a/app/lib/client/Ucloud.php +++ b/app/lib/client/Ucloud.php @@ -27,7 +27,7 @@ class Ucloud $param = array_merge($param, $params); $param['Signature'] = $this->ucloudSignature($param); $ua = sprintf("PHP/%s PHP-SDK/%s", phpversion(), self::VERSION); - $response = get_curl($this->ApiUrl, json_encode($param), 0, 0, 0, $ua, 0, ['Content-Type: application/json']); + $response = get_curl($this->ApiUrl, json_encode($param), 0, 0, $ua, 0, ['Content-Type: application/json']); $result = json_decode($response, true); if (isset($result['RetCode']) && $result['RetCode'] == 0) { return $result; diff --git a/app/lib/deploy/baishan.php b/app/lib/deploy/baishan.php index de94f51..3a4a262 100644 --- a/app/lib/deploy/baishan.php +++ b/app/lib/deploy/baishan.php @@ -56,7 +56,7 @@ class baishan implements DeployInterface $headers = []; $body = null; if ($params) { - $headers[] = 'Content-Type: application/json'; + $headers['Content-Type'] = 'application/json'; $body = json_encode($params); } $response = curl_client($url, $body, null, null, $headers, $this->proxy); diff --git a/app/lib/deploy/btwaf.php b/app/lib/deploy/btwaf.php index 402b54e..d01c67d 100644 --- a/app/lib/deploy/btwaf.php +++ b/app/lib/deploy/btwaf.php @@ -123,9 +123,9 @@ class btwaf implements DeployInterface $now_time = time(); $headers = [ - 'waf_request_time: ' . $now_time, - 'waf_request_token: ' . md5($now_time . md5($this->key)), - 'Content-Type: application/json', + 'waf_request_time' => $now_time, + 'waf_request_token' => md5($now_time . md5($this->key)), + 'Content-Type' => 'application/json', ]; $post = $params ? json_encode($params) : null; $response = curl_client($url, $post, null, null, $headers, $this->proxy, 'POST'); diff --git a/app/lib/deploy/cachefly.php b/app/lib/deploy/cachefly.php index a8ce28f..e8beeb8 100644 --- a/app/lib/deploy/cachefly.php +++ b/app/lib/deploy/cachefly.php @@ -37,10 +37,10 @@ class cachefly implements DeployInterface private function request($path, $params = null, $method = null) { $url = $this->url . $path; - $headers = ['x-cf-authorization: Bearer ' . $this->apikey]; + $headers = ['x-cf-authorization' => 'Bearer ' . $this->apikey]; $body = null; if ($params) { - $headers[] = 'Content-Type: application/json'; + $headers['Content-Type'] = 'application/json'; $body = json_encode($params); } $response = curl_client($url, $body, null, null, $headers, $this->proxy, $method); diff --git a/app/lib/deploy/cdnfly.php b/app/lib/deploy/cdnfly.php index 82a8f53..35fcf9f 100644 --- a/app/lib/deploy/cdnfly.php +++ b/app/lib/deploy/cdnfly.php @@ -44,10 +44,10 @@ class cdnfly implements DeployInterface private function request($path, $params = null, $method = null) { $url = $this->url . $path; - $headers = ['api-key: ' . $this->api_key, 'api-secret: ' . $this->api_secret]; + $headers = ['api-key' => $this->api_key, 'api-secret' => $this->api_secret]; $body = null; if ($params) { - $headers[] = 'Content-Type: application/json'; + $headers['Content-Type'] = 'application/json'; $body = json_encode($params); } $response = curl_client($url, $body, null, null, $headers, $this->proxy, $method); diff --git a/app/lib/deploy/doge.php b/app/lib/deploy/doge.php index 6c51392..597770c 100644 --- a/app/lib/deploy/doge.php +++ b/app/lib/deploy/doge.php @@ -95,13 +95,13 @@ class doge implements DeployInterface $signStr = $path . "\n" . $body; $sign = hash_hmac('sha1', $signStr, $this->SecretKey); $authorization = "TOKEN " . $this->AccessKey . ":" . $sign; - $headers = ['Authorization: ' . $authorization]; - if($body && $json) $headers[] = 'Content-Type: application/json'; + $headers = ['Authorization' => $authorization]; + if($body && $json) $headers['Content-Type'] = 'application/json'; $url = 'https://api.dogecloud.com'.$path; $response = curl_client($url, $body, null, null, $headers, $this->proxy); $result = json_decode($response['body'], true); if(isset($result['code']) && $result['code'] == 200){ - return isset($result['data']) ? $result['data'] : true; + return $result['data'] ?? true; }elseif(isset($result['msg'])){ throw new Exception($result['msg']); }else{ diff --git a/app/lib/deploy/gcore.php b/app/lib/deploy/gcore.php index c548a32..181ff63 100644 --- a/app/lib/deploy/gcore.php +++ b/app/lib/deploy/gcore.php @@ -42,10 +42,10 @@ class gcore implements DeployInterface private function request($path, $params = null, $method = null) { $url = $this->url . $path; - $headers = ['Authorization: APIKey ' . $this->apikey]; + $headers = ['Authorization' => 'APIKey ' . $this->apikey]; $body = null; if ($params) { - $headers[] = 'Content-Type: application/json'; + $headers['Content-Type'] = 'application/json'; $body = json_encode($params); } $response = curl_client($url, $body, null, null, $headers, $this->proxy, $method); diff --git a/app/lib/deploy/goedge.php b/app/lib/deploy/goedge.php index 4ef0559..e08f636 100644 --- a/app/lib/deploy/goedge.php +++ b/app/lib/deploy/goedge.php @@ -119,19 +119,19 @@ class goedge implements DeployInterface $body = null; if ($this->accessToken) { if ($this->systype == '1') { - $headers[] = 'X-Cloud-Access-Token: ' . $this->accessToken; + $headers['X-Cloud-Access-Token'] = $this->accessToken; } else { - $headers[] = 'X-Edge-Access-Token: ' . $this->accessToken; + $headers['X-Edge-Access-Token'] = $this->accessToken; } } if ($params) { - $headers[] = 'Content-Type: application/json'; + $headers['Content-Type'] = 'application/json'; $body = json_encode($params); } $response = curl_client($url, $body, null, null, $headers, $this->proxy); $result = json_decode($response['body'], true); if (isset($result['code']) && $result['code'] == 200) { - return isset($result['data']) ? $result['data'] : null; + return $result['data'] ?? null; } elseif (isset($result['message'])) { throw new Exception($result['message']); } else { diff --git a/app/lib/deploy/kangle.php b/app/lib/deploy/kangle.php index c8e15a8..89c8c5a 100644 --- a/app/lib/deploy/kangle.php +++ b/app/lib/deploy/kangle.php @@ -117,8 +117,8 @@ class kangle implements DeployInterface $response = curl_client($url, null, null, null, null, $this->proxy); if ($response['code'] == 302 && !empty($response['redirect_url'])) { $cookie = ''; - if (preg_match_all('/Set-Cookie: (.*);/iU', $response['header'], $matchs)) { - foreach ($matchs[1] as $val) { + if (isset($response['headers']['Set-Cookie'])) { + foreach ($response['headers']['Set-Cookie'] as $val) { $arr = explode('=', $val); if ($arr[1] == '' || $arr[1] == 'deleted') continue; $cookie .= $val . '; '; @@ -168,8 +168,8 @@ class kangle implements DeployInterface $response = curl_client($url, http_build_query($post), $referer, null, null, $this->proxy); if ($response['code'] == 302) { $cookie = ''; - if (preg_match_all('/Set-Cookie: (.*);/iU', $response['header'], $matchs)) { - foreach ($matchs[1] as $val) { + if (isset($response['headers']['Set-Cookie'])) { + foreach ($response['headers']['Set-Cookie'] as $val) { $arr = explode('=', $val); if ($arr[1] == '' || $arr[1] == 'deleted') continue; $cookie .= $val . '; '; diff --git a/app/lib/deploy/kangleadmin.php b/app/lib/deploy/kangleadmin.php index 35d223b..c3cb696 100644 --- a/app/lib/deploy/kangleadmin.php +++ b/app/lib/deploy/kangleadmin.php @@ -108,8 +108,8 @@ class kangleadmin implements DeployInterface $response = curl_client($url, null, null, null, null, $this->proxy); if ($response['code'] == 302 && !empty($response['redirect_url'])) { $cookie = ''; - if (preg_match_all('/Set-Cookie: (.*);/iU', $response['header'], $matchs)) { - foreach ($matchs[1] as $val) { + if (isset($response['headers']['Set-Cookie'])) { + foreach ($response['headers']['Set-Cookie'] as $val) { $arr = explode('=', $val); if ($arr[1] == '' || $arr[1] == 'deleted') continue; $cookie .= $val . '; '; diff --git a/app/lib/deploy/kuocai.php b/app/lib/deploy/kuocai.php index 7449d9e..e205d22 100644 --- a/app/lib/deploy/kuocai.php +++ b/app/lib/deploy/kuocai.php @@ -73,7 +73,7 @@ class kuocai implements DeployInterface $url = 'https://kuocai.cn' . $path; $body = $json ? json_encode($params) : $params; $headers = []; - if ($json) $headers[] = 'Content-Type: application/json'; + if ($json) $headers['Content-Type'] = 'application/json'; $response = curl_client( $url, $body, diff --git a/app/lib/deploy/lecdn.php b/app/lib/deploy/lecdn.php index 45cdc4f..f30dead 100644 --- a/app/lib/deploy/lecdn.php +++ b/app/lib/deploy/lecdn.php @@ -76,16 +76,16 @@ class lecdn implements DeployInterface $headers = []; $body = null; if ($this->accessToken) { - $headers[] = 'Authorization: Bearer ' . $this->accessToken; + $headers['Authorization'] = 'Bearer ' . $this->accessToken; } if ($params) { - $headers[] = 'Content-Type: application/json;charset=UTF-8'; + $headers['Content-Type'] = 'application/json;charset=UTF-8'; $body = json_encode($params); } $response = curl_client($url, $body, null, null, $headers, $this->proxy, $method); $result = json_decode($response['body'], true); if (isset($result['code']) && $result['code'] == 200) { - return isset($result['data']) ? $result['data'] : null; + return $result['data'] ?? null; } elseif (isset($result['message'])) { throw new Exception($result['message']); } else { diff --git a/app/lib/deploy/mwpanel.php b/app/lib/deploy/mwpanel.php index f3fdc6a..f536f57 100644 --- a/app/lib/deploy/mwpanel.php +++ b/app/lib/deploy/mwpanel.php @@ -118,8 +118,8 @@ class mwpanel implements DeployInterface $url = $this->url . $path; $headers = [ - 'app-id: '.$this->appid, - 'app-secret: '.$this->appsecret, + 'app-id' => $this->appid, + 'app-secret' => $this->appsecret, ]; $response = curl_client($url, $params ? http_build_query($params) : null, null, null, $headers, $this->proxy); return $response['body']; diff --git a/app/lib/deploy/opanel.php b/app/lib/deploy/opanel.php index 7082959..92cdc83 100644 --- a/app/lib/deploy/opanel.php +++ b/app/lib/deploy/opanel.php @@ -96,15 +96,15 @@ class opanel implements DeployInterface $timestamp = time() . ''; $token = md5('1panel' . $this->key . $timestamp); $headers = [ - '1Panel-Token: ' . $token, - '1Panel-Timestamp: ' . $timestamp + '1Panel-Token' => $token, + '1Panel-Timestamp' => $timestamp ]; $body = $params ? json_encode($params) : '{}'; - if ($body) $headers[] = 'Content-Type: application/json'; + if ($body) $headers['Content-Type'] = 'application/json'; $response = curl_client($url, $body, null, null, $headers, $this->proxy); $result = json_decode($response['body'], true); if (isset($result['code']) && $result['code'] == 200) { - return isset($result['data']) ? $result['data'] : null; + return $result['data'] ?? null; } elseif (isset($result['message'])) { throw new Exception($result['message']); } else { diff --git a/app/lib/deploy/proxmox.php b/app/lib/deploy/proxmox.php index c43f84b..f586afc 100644 --- a/app/lib/deploy/proxmox.php +++ b/app/lib/deploy/proxmox.php @@ -59,7 +59,7 @@ class proxmox implements DeployInterface private function send_request($path, $params = null) { $url = $this->url . $path; - $headers = ['Authorization: PVEAPIToken=' . $this->api_user . '=' . $this->api_key]; + $headers = ['Authorization' => 'PVEAPIToken=' . $this->api_user . '=' . $this->api_key]; $post = $params ? http_build_query($params) : null; $response = curl_client($url, $post, null, null, $headers, $this->proxy); if ($response['code'] == 200) { @@ -75,12 +75,7 @@ class proxmox implements DeployInterface throw new Exception('返回数据解析失败'); } } else { - $header = getSubstr($response['header'], ' ', "\r\n"); - if ($header) { - throw new Exception($header); - } else { - throw new Exception('请求失败(httpCode=' . $response['code'] . ')'); - } + throw new Exception('请求失败(httpCode=' . $response['code'] . ', body=' . $response['body'] . ')'); } } diff --git a/app/lib/deploy/ratpanel.php b/app/lib/deploy/ratpanel.php index 8e75477..4b272fb 100644 --- a/app/lib/deploy/ratpanel.php +++ b/app/lib/deploy/ratpanel.php @@ -114,9 +114,9 @@ class ratpanel implements DeployInterface $body = $method == 'GET' ? null : json_encode($params); $sign = $this->signRequest($method, $url, $body, $this->id, $this->token); $response = curl_client($url, $body, null, null, [ - 'Content-Type: application/json', - 'X-Timestamp: ' . $sign['timestamp'], - 'Authorization: HMAC-SHA256 Credential=' . $sign['id'] . ', Signature=' . $sign['signature'] + 'Content-Type' => 'application/json', + 'X-Timestamp' => $sign['timestamp'], + 'Authorization' => 'HMAC-SHA256 Credential=' . $sign['id'] . ', Signature=' . $sign['signature'] ], $this->proxy, $method); return $response['body']; } @@ -130,7 +130,7 @@ class ratpanel implements DeployInterface // 规范化路径 $canonicalPath = $path; - if (strpos($path, '/api') !== 0) { + if (!str_starts_with($path, '/api')) { $apiPos = strpos($path, '/api'); if ($apiPos !== false) { $canonicalPath = substr($path, $apiPos); diff --git a/app/lib/deploy/safeline.php b/app/lib/deploy/safeline.php index 569336f..e932033 100644 --- a/app/lib/deploy/safeline.php +++ b/app/lib/deploy/safeline.php @@ -83,16 +83,16 @@ class safeline implements DeployInterface private function request($path, $params = null) { $url = $this->url . $path; - $headers = ['X-SLCE-API-TOKEN: ' . $this->token]; + $headers = ['X-SLCE-API-TOKEN' => $this->token]; $body = null; if ($params) { - $heders[] = 'Content-Type: application/json'; + $headers['Content-Type'] = 'application/json'; $body = json_encode($params); } $response = curl_client($url, $body, null, null, $headers, $this->proxy); $result = json_decode($response['body'], true); if ($response['code'] == 200 && $result) { - return isset($result['data']) ? $result['data'] : null; + return $result['data'] ?? null; } else { throw new Exception(!empty($result['msg']) ? $result['msg'] : '请求失败(httpCode=' . $response['code'] . ')'); } diff --git a/app/lib/deploy/upyun.php b/app/lib/deploy/upyun.php index 9e9520e..c14e776 100644 --- a/app/lib/deploy/upyun.php +++ b/app/lib/deploy/upyun.php @@ -101,8 +101,8 @@ class upyun implements DeployInterface $result = json_decode($response['body'], true); if (isset($result['data']['result']) && $result['data']['result'] == true) { $cookie = ''; - if (preg_match_all('/Set-Cookie: (.*);/iU', $response['header'], $matchs)) { - foreach ($matchs[1] as $val) { + if (isset($response['headers']['Set-Cookie'])) { + foreach ($response['headers']['Set-Cookie'] as $val) { $arr = explode('=', $val); if ($arr[1] == '' || $arr[1] == 'deleted') continue; $cookie .= $val . '; '; diff --git a/app/lib/deploy/wangsu.php b/app/lib/deploy/wangsu.php index fa7e2b0..77657a3 100644 --- a/app/lib/deploy/wangsu.php +++ b/app/lib/deploy/wangsu.php @@ -273,7 +273,7 @@ class wangsu implements DeployInterface } elseif ($cert_name == $cert['name']) { $this->log('证书' . $cert_name . '已存在,但序列号(' . $cert['certificate-id'] . ')不匹配,准备重新上传'); try { - $this->request('/api/certificate/' . $cert['certificate-id'], [['name'] => $cert_name . '-bak'], true, null, 'PUT'); + $this->request('/api/certificate/' . $cert['certificate-id'], ['name' => $cert_name . '-bak'], true, null, 'PUT'); } catch (Exception $e) { throw new Exception('证书更名失败:' . $e->getMessage()); } @@ -416,29 +416,29 @@ class wangsu implements DeployInterface if (empty($headers)) { $headers = [ - 'Authorization: ' . $authorization, - 'Date: ' . $date, - 'Accept: application/json', - 'Connection: close', + 'Authorization' => $authorization, + 'Date' => $date, + 'Accept' => 'application/json', + 'Connection' => 'close', ]; } else { - $headers[] = 'Authorization: ' . $authorization; - $headers[] = 'Date: ' . $date; - $headers[] = 'Accept: application/json'; - $headers[] = 'Connection: close'; + $headers['Authorization'] = $authorization; + $headers['Date'] = $date; + $headers['Accept'] = 'application/json'; + $headers['Connection'] = 'close'; } if ($body && $json) { - $headers[] = 'Content-Type: application/json'; + $headers['Content-Type'] = 'application/json'; } $url = 'https://open.chinanetcenter.com' . $path; - $response = curl_client($url, $body, null, null, $headers, $this->proxy, $method, 30, false); + $response = curl_client($url, $body, null, null, $headers, $this->proxy, $method, 30); $result = json_decode($response['body'], true); if ((isset($response['code']) && $response['code'] == 201) || (isset($response['code']) && $response['code'] == 200 && $getLocation === true)) { - if (preg_match('/Location:\s*(.*)/i', $response['header'], $matches)) { - $location = trim($matches[1]); // 提取 Location 头部的值并去除多余空格 + if (isset($response['headers']['Location'])) { + $location = trim(array_shift($response['headers']['Location'])); // 提取 Location 头部的值并去除多余空格 if (!empty($location)) { return $location; } diff --git a/app/lib/dns/powerdns.php b/app/lib/dns/powerdns.php index d978d17..d03813e 100644 --- a/app/lib/dns/powerdns.php +++ b/app/lib/dns/powerdns.php @@ -369,7 +369,7 @@ class powerdns implements DnsInterface private function send_reuqest($method, $path, $params = null) { $url = $this->url . $path; - $headers[] = 'X-API-Key: ' . $this->apikey; + $headers['X-API-Key'] = $this->apikey; $body = null; if ($method == 'GET' || $method == 'DELETE') { if ($params) { @@ -377,7 +377,7 @@ class powerdns implements DnsInterface } } else { $body = json_encode($params); - $headers[] = 'Content-Type: application/json'; + $headers['Content-Type'] = 'application/json'; } try { $response = curl_client($url, $body, null, null, $headers, $this->proxy, $method); @@ -404,6 +404,5 @@ class powerdns implements DnsInterface private function setError($message) { $this->error = $message; - //file_put_contents('logs.txt',date('H:i:s').' '.$message."\r\n", FILE_APPEND); } } diff --git a/app/service/OptimizeService.php b/app/service/OptimizeService.php index 1e73777..ced2048 100644 --- a/app/service/OptimizeService.php +++ b/app/service/OptimizeService.php @@ -57,7 +57,7 @@ class OptimizeService 'key' => config_get('optimize_ip_key', 'o1zrmHAF'), 'type' => $ip_type, ]; - $response = get_curl($url, json_encode($params), 0, 0, 0, 0, 0, ['Content-Type: application/json; charset=UTF-8']); + $response = get_curl($url, json_encode($params), 0, 0, 0, 0, ['Content-Type: application/json; charset=UTF-8']); $arr = json_decode($response, true); if (isset($arr['code']) && $arr['code'] == 200) { return $arr['info']; diff --git a/app/utils/CheckUtils.php b/app/utils/CheckUtils.php index fea5529..192cb9e 100644 --- a/app/utils/CheckUtils.php +++ b/app/utils/CheckUtils.php @@ -2,76 +2,72 @@ namespace app\utils; +use GuzzleHttp\Client; +use GuzzleHttp\Exception\GuzzleException; + class CheckUtils { public static function curl($url, $timeout, $ip = null, $proxy = false) { $status = true; $errmsg = null; + $start = microtime(true); + $urlarr = parse_url($url); if (!$urlarr) { return ['status' => false, 'errmsg' => 'Invalid URL', 'usetime' => 0]; } - if (str_starts_with($urlarr['host'], '[') && str_ends_with($urlarr['host'], ']')) { - $urlarr['host'] = substr($urlarr['host'], 1, -1); - } - if (!empty($ip) && !filter_var($urlarr['host'], FILTER_VALIDATE_IP) && filter_var($ip, FILTER_VALIDATE_IP)) { - $port = $urlarr['port'] ?? ($urlarr['scheme'] == 'https' ? 443 : 80); - $resolve = $urlarr['host'] . ':' . $port . ':' . $ip; - } - $ch = curl_init(); + + $options = [ + 'timeout' => $timeout, + 'connect_timeout' => $timeout, + 'verify' => false, + 'headers' => [ + 'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36' + ], + 'http_errors' => false // 不抛出异常 + ]; + + // 处理代理 if ($proxy) { $proxy_server = config_get('proxy_server'); $proxy_port = intval(config_get('proxy_port')); $proxy_userpwd = config_get('proxy_user').':'.config_get('proxy_pwd'); $proxy_type = config_get('proxy_type'); - if ($proxy_type == 'https') { - $proxy_type = CURLPROXY_HTTPS; - } elseif ($proxy_type == 'sock4') { - $proxy_type = CURLPROXY_SOCKS4; - } elseif ($proxy_type == 'sock5') { - $proxy_type = CURLPROXY_SOCKS5; - } elseif ($proxy_type == 'sock5h') { - $proxy_type = CURLPROXY_SOCKS5_HOSTNAME; - } else { - $proxy_type = CURLPROXY_HTTP; + + if (!empty($proxy_server) && !empty($proxy_port)) { + match ($proxy_type) { + 'https' => $proxy_string = 'https://', + 'sock4' => $proxy_string = 'socks4://', + 'sock5' => $proxy_string = 'socks5://', + 'sock5h' => $proxy_string = 'socks5h://', + default => $proxy_string = 'http://', + }; + + if ($proxy_userpwd != ':') { + $proxy_string .= $proxy_userpwd . '@'; + } + + $proxy_string .= $proxy_server . ':' . $proxy_port; + $options['proxy'] = $proxy_string; } - curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_BASIC); - curl_setopt($ch, CURLOPT_PROXY, $proxy_server); - curl_setopt($ch, CURLOPT_PROXYPORT, $proxy_port); - if ($proxy_userpwd != ':') { - curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxy_userpwd); + } + + try { + $client = new Client(); + $response = $client->request('GET', $url, $options); + $httpcode = $response->getStatusCode(); + + if ($httpcode < 200 || $httpcode >= 400) { + $status = false; + $errmsg = 'http_code=' . $httpcode; } - curl_setopt($ch, CURLOPT_PROXYTYPE, $proxy_type); - } - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); - $httpheader[] = "Accept: */*"; - $httpheader[] = "Accept-Language: zh-CN,zh;q=0.8"; - $httpheader[] = "Connection: close"; - curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader); - curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); - curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); - if (!empty($resolve)) { - curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, false); - curl_setopt($ch, CURLOPT_RESOLVE, [$resolve]); - } - curl_exec($ch); - $errno = curl_errno($ch); - if ($errno) { + } catch (GuzzleException $e) { $status = false; - $errmsg = curl_error($ch); + $errmsg = $e->getMessage(); } - $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); - if ($status && ($httpcode < 200 || $httpcode >= 400)) { - $status = false; - $errmsg = 'http_code='.$httpcode; - } - $usetime = round(curl_getinfo($ch, CURLINFO_TOTAL_TIME) * 1000); - curl_close($ch); + + $usetime = round((microtime(true) - $start) * 1000); return ['status' => $status, 'errmsg' => $errmsg, 'usetime' => $usetime]; } diff --git a/app/utils/DnsQueryUtils.php b/app/utils/DnsQueryUtils.php index e5a9591..74f9fb9 100644 --- a/app/utils/DnsQueryUtils.php +++ b/app/utils/DnsQueryUtils.php @@ -44,7 +44,7 @@ class DnsQueryUtils $data = get_curl($url); $arr = json_decode($data, true); if (!$arr) { - unset($doh_servers[$id]); + unset(self::$doh_servers[$id]); $id = array_rand(self::$doh_servers); $url = self::$doh_servers[$id].'?name='.urlencode($domain).'&type='.$dns_type[$type]; $data = get_curl($url); diff --git a/app/utils/MsgNotice.php b/app/utils/MsgNotice.php index 937eb35..6e251fe 100644 --- a/app/utils/MsgNotice.php +++ b/app/utils/MsgNotice.php @@ -220,12 +220,12 @@ class MsgNotice if (!$wechat_apptoken || !$wechat_appuid) return false; $url = 'https://wxpusher.zjiecode.com/api/send/message'; $post = ['appToken' => $wechat_apptoken, 'content' => $content, 'summary' => $title, 'contentType' => 3, 'uids' => [$wechat_appuid]]; - $result = get_curl($url, json_encode($post), 0, 0, 0, 0, 0, ['Content-Type: application/json; charset=UTF-8']); + $result = get_curl($url, json_encode($post), 0, 0, 0, 0, ['Content-Type: application/json; charset=UTF-8']); $arr = json_decode($result, true); if (isset($arr['success']) && $arr['success'] == true) { return true; } else { - return isset($arr['msg']) ? $arr['msg'] : '请求失败'; + return $arr['msg'] ?? '请求失败'; } } @@ -248,7 +248,7 @@ class MsgNotice if (isset($arr['ok']) && $arr['ok'] == true) { return true; } else { - return isset($arr['description']) ? $arr['description'] : '请求失败'; + return $arr['description'] ?? '请求失败'; } } @@ -284,12 +284,12 @@ class MsgNotice } else { return '不支持的Webhook地址'; } - $result = get_curl($url, json_encode($post), 0, 0, 0, 0, 0, ['Content-Type: application/json; charset=UTF-8']); + $result = get_curl($url, json_encode($post), 0, 0, 0, 0, ['Content-Type: application/json; charset=UTF-8']); $arr = json_decode($result, true); if (isset($arr['errcode']) && $arr['errcode'] == 0 || isset($arr['code']) && $arr['code'] == 0) { return true; } else { - return isset($arr['errmsg']) ? $arr['errmsg'] : (isset($arr['msg']) ? $arr['msg'] : '请求失败'); + return $arr['errmsg'] ?? (isset($arr['msg']) ? $arr['msg'] : '请求失败'); } } diff --git a/composer.json b/composer.json index f1e78b2..87f8329 100644 --- a/composer.json +++ b/composer.json @@ -42,23 +42,24 @@ ], "require": { "php": ">=8.2.0", - "ext-pdo": "*", - "ext-gd": "*", "ext-curl": "*", - "ext-openssl": "*", - "ext-sockets": "*", - "ext-mbstring": "*", - "ext-ssh2": "*", "ext-ftp": "*", - "topthink/framework": "^8.1.0", - "topthink/think-orm": "^4.0", - "topthink/think-view": "^2.0", + "ext-gd": "*", + "ext-mbstring": "*", + "ext-openssl": "*", + "ext-pdo": "*", + "ext-sockets": "*", + "ext-ssh2": "*", + "cccyun/php-whois": "^1.0", "cccyun/think-captcha": "^3.0", + "guzzlehttp/guzzle": "^7.0", "symfony/polyfill-intl-idn": "^1.32", "symfony/polyfill-mbstring": "^1.32", "symfony/polyfill-php81": "^1.32", "symfony/polyfill-php82": "^1.32", - "cccyun/php-whois": "^1.0" + "topthink/framework": "^8.1.0", + "topthink/think-orm": "^4.0", + "topthink/think-view": "^2.0" }, "require-dev": { "symfony/var-dumper": "^7.3", diff --git a/composer.lock b/composer.lock index 6c86cd8..08fc4b3 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": "2bcaddab4080072a6f111b050f345d2d", + "content-hash": "d3743583cd5551b93f41500ff9dc998b", "packages": [ { "name": "cccyun/php-whois", @@ -118,6 +118,331 @@ }, "time": "2025-04-26T08:37:18+00:00" }, + { + "name": "guzzlehttp/guzzle", + "version": "7.9.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", + "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.5.3 || ^2.0.3", + "guzzlehttp/psr7": "^2.7.0", + "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": "*", + "guzzle/client-integration-tests": "3.0.2", + "php-http/message-factory": "^1.1", + "phpunit/phpunit": "^8.5.39 || ^9.6.20", + "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.9.3" + }, + "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": "2025-03-27T13:37:11+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c", + "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" + }, + "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.2.0" + }, + "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": "2025-03-27T13:27:01+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "2.7.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/c2270caaabe631b3b44c85f99e5a04bbb8060d16", + "reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16", + "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.0", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" + }, + "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.7.1" + }, + "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": "2025-03-27T12:30:47+00:00" + }, { "name": "psr/container", "version": "2.0.2", @@ -171,6 +496,113 @@ }, "time": "2021-11-05T16:47:00+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.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "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": "PSR-17: 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" + }, + "time": "2024-04-15T12:06:14+00:00" + }, { "name": "psr/http-message", "version": "1.1", @@ -325,6 +757,117 @@ }, "time": "2021-10-29T13:26:27+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.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.6-dev" + } + }, + "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.6.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": "2024-09-25T14:21:43+00:00" + }, { "name": "symfony/polyfill-intl-idn", "version": "v1.32.0", @@ -1101,73 +1644,6 @@ }, "time": "2025-03-23T07:31:41+00:00" }, - { - "name": "symfony/deprecation-contracts", - "version": "v3.6.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", - "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/contracts", - "name": "symfony/contracts" - }, - "branch-alias": { - "dev-main": "3.6-dev" - } - }, - "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.6.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": "2024-09-25T14:21:43+00:00" - }, { "name": "symfony/var-dumper", "version": "v7.3.0", @@ -1311,14 +1787,14 @@ "prefer-lowest": false, "platform": { "php": ">=8.2.0", - "ext-pdo": "*", - "ext-gd": "*", "ext-curl": "*", - "ext-openssl": "*", - "ext-sockets": "*", + "ext-ftp": "*", + "ext-gd": "*", "ext-mbstring": "*", - "ext-ssh2": "*", - "ext-ftp": "*" + "ext-openssl": "*", + "ext-pdo": "*", + "ext-sockets": "*", + "ext-ssh2": "*" }, "platform-dev": {}, "plugin-api-version": "2.6.0" From 904c3ceb5b489b4039621db6e7f21c907631c52f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Mon, 9 Jun 2025 05:08:47 +0800 Subject: [PATCH 08/15] =?UTF-8?q?=E5=9B=9E=E6=BB=9Aswoole=E6=9B=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/command/Dmtask.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/command/Dmtask.php b/app/command/Dmtask.php index d1f1aab..f69eb53 100644 --- a/app/command/Dmtask.php +++ b/app/command/Dmtask.php @@ -45,7 +45,7 @@ class Dmtask extends Command private function runtask() { - \Co::set(['hook_flags' => SWOOLE_HOOK_ALL ^ SWOOLE_HOOK_NATIVE_CURL]); + \Co::set(['hook_flags' => SWOOLE_HOOK_ALL]); \Co\run(function () { $date = date("Ymd"); $count = config_get('run_count', null, true) ?? 0; From 8193ade02db9b8b141c2cf0d03d1a5027daa0d31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Mon, 9 Jun 2025 05:12:06 +0800 Subject: [PATCH 09/15] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dget=5Fcurl=E6=96=B9?= =?UTF-8?q?=E6=B3=95header=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/lib/client/Ucloud.php | 2 +- app/service/OptimizeService.php | 2 +- app/utils/MsgNotice.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/lib/client/Ucloud.php b/app/lib/client/Ucloud.php index 23f0a1f..b2bf886 100644 --- a/app/lib/client/Ucloud.php +++ b/app/lib/client/Ucloud.php @@ -27,7 +27,7 @@ class Ucloud $param = array_merge($param, $params); $param['Signature'] = $this->ucloudSignature($param); $ua = sprintf("PHP/%s PHP-SDK/%s", phpversion(), self::VERSION); - $response = get_curl($this->ApiUrl, json_encode($param), 0, 0, $ua, 0, ['Content-Type: application/json']); + $response = get_curl($this->ApiUrl, json_encode($param), 0, 0, $ua, 0, ['Content-Type' => 'application/json']); $result = json_decode($response, true); if (isset($result['RetCode']) && $result['RetCode'] == 0) { return $result; diff --git a/app/service/OptimizeService.php b/app/service/OptimizeService.php index ced2048..27dabda 100644 --- a/app/service/OptimizeService.php +++ b/app/service/OptimizeService.php @@ -57,7 +57,7 @@ class OptimizeService 'key' => config_get('optimize_ip_key', 'o1zrmHAF'), 'type' => $ip_type, ]; - $response = get_curl($url, json_encode($params), 0, 0, 0, 0, ['Content-Type: application/json; charset=UTF-8']); + $response = get_curl($url, json_encode($params), 0, 0, 0, 0, ['Content-Type' => 'application/json; charset=UTF-8']); $arr = json_decode($response, true); if (isset($arr['code']) && $arr['code'] == 200) { return $arr['info']; diff --git a/app/utils/MsgNotice.php b/app/utils/MsgNotice.php index 6e251fe..8d86f78 100644 --- a/app/utils/MsgNotice.php +++ b/app/utils/MsgNotice.php @@ -220,7 +220,7 @@ class MsgNotice if (!$wechat_apptoken || !$wechat_appuid) return false; $url = 'https://wxpusher.zjiecode.com/api/send/message'; $post = ['appToken' => $wechat_apptoken, 'content' => $content, 'summary' => $title, 'contentType' => 3, 'uids' => [$wechat_appuid]]; - $result = get_curl($url, json_encode($post), 0, 0, 0, 0, ['Content-Type: application/json; charset=UTF-8']); + $result = get_curl($url, json_encode($post), 0, 0, 0, 0, ['Content-Type' => 'application/json; charset=UTF-8']); $arr = json_decode($result, true); if (isset($arr['success']) && $arr['success'] == true) { return true; @@ -284,7 +284,7 @@ class MsgNotice } else { return '不支持的Webhook地址'; } - $result = get_curl($url, json_encode($post), 0, 0, 0, 0, ['Content-Type: application/json; charset=UTF-8']); + $result = get_curl($url, json_encode($post), 0, 0, 0, 0, ['Content-Type' => 'application/json; charset=UTF-8']); $arr = json_decode($result, true); if (isset($arr['errcode']) && $arr['errcode'] == 0 || isset($arr['code']) && $arr['code'] == 0) { return true; From bb35ee337835342a5ef720af2bcf6c35c861d7bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Mon, 9 Jun 2025 05:17:15 +0800 Subject: [PATCH 10/15] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=BB=98=E8=AE=A4Conte?= =?UTF-8?q?nt-Type=E5=80=BC=E5=8F=8A=E5=87=BD=E6=95=B0=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common.php | 10 +++++++--- app/lib/cert/google.php | 2 +- app/lib/cert/tencent.php | 2 +- app/lib/cert/zerossl.php | 2 +- app/lib/deploy/baishan.php | 2 +- app/lib/deploy/btpanel.php | 2 +- app/lib/deploy/btwaf.php | 2 +- app/lib/deploy/cachefly.php | 2 +- app/lib/deploy/cdnfly.php | 2 +- app/lib/deploy/doge.php | 2 +- app/lib/deploy/gcore.php | 2 +- app/lib/deploy/goedge.php | 2 +- app/lib/deploy/kangle.php | 12 ++++++------ app/lib/deploy/kangleadmin.php | 12 ++++++------ app/lib/deploy/kuocai.php | 2 +- app/lib/deploy/lecdn.php | 2 +- app/lib/deploy/mwpanel.php | 2 +- app/lib/deploy/opanel.php | 2 +- app/lib/deploy/proxmox.php | 2 +- app/lib/deploy/ratpanel.php | 2 +- app/lib/deploy/safeline.php | 2 +- app/lib/deploy/synology.php | 6 +++--- app/lib/deploy/upyun.php | 8 ++++---- app/lib/deploy/wangsu.php | 2 +- app/lib/deploy/west.php | 2 +- app/lib/dns/namesilo.php | 2 +- app/lib/dns/powerdns.php | 2 +- app/lib/dns/west.php | 2 +- 28 files changed, 49 insertions(+), 45 deletions(-) diff --git a/app/common.php b/app/common.php index 0f3bcc3..f367fc1 100644 --- a/app/common.php +++ b/app/common.php @@ -11,7 +11,6 @@ function get_curl($url, $post = 0, $referer = 0, $cookie = 0, $ua = 0, $nobody = 'timeout' => 10, 'verify' => false, 'headers' => [ - 'Content-Type' => 'application/x-www-form-urlencoded', 'User-Agent' => $ua ?: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36' ], 'http_errors' => false // 不抛出异常 @@ -28,6 +27,9 @@ function get_curl($url, $post = 0, $referer = 0, $cookie = 0, $ua = 0, $nobody = $method = 'GET'; if ($post) { $method = 'POST'; + if (!isset($options['headers']['Content-Type'])) { + $options['headers']['Content-Type'] = 'application/x-www-form-urlencoded'; + } if (is_array($post)) { $options['form_params'] = $post; } else { @@ -390,7 +392,7 @@ function clearDirectory($dir): bool return true; } -function curl_client($url, $data = null, $referer = null, $cookie = null, $headers = null, $proxy = false, $method = null, $timeout = 5) +function http_request($url, $data = null, $referer = null, $cookie = null, $headers = null, $proxy = false, $method = null, $timeout = 5) { $options = [ 'timeout' => $timeout, @@ -398,7 +400,6 @@ function curl_client($url, $data = null, $referer = null, $cookie = null, $heade 'allow_redirects' => false, 'verify' => false, 'headers' => [ - 'Content-Type' => 'application/x-www-form-urlencoded', 'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36', ], 'http_errors' => false // 不抛出异常 @@ -423,6 +424,9 @@ function curl_client($url, $data = null, $referer = null, $cookie = null, $heade // 处理数据 if ($data) { if ($method !== 'GET') { + if (!isset($options['headers']['Content-Type'])) { + $options['headers']['Content-Type'] = 'application/x-www-form-urlencoded'; + } $options['body'] = $data; } else { // 兼容已经存在查询字符串的情况 diff --git a/app/lib/cert/google.php b/app/lib/cert/google.php index 253f21e..2f67bc5 100644 --- a/app/lib/cert/google.php +++ b/app/lib/cert/google.php @@ -128,7 +128,7 @@ class google implements CertInterface private function getEAB() { $api = "https://gts.rat.dev/eab"; - $response = curl_client($api, null, null, null, null, $this->config['proxy'] == 1, 'GET', 10); + $response = http_request($api, null, null, null, null, $this->config['proxy'] == 1, 'GET', 10); $result = json_decode($response['body'], true); if (!isset($result['msg'])) { throw new Exception('解析返回数据失败:' . $response['body']); diff --git a/app/lib/cert/tencent.php b/app/lib/cert/tencent.php index 46dda34..8260aa3 100644 --- a/app/lib/cert/tencent.php +++ b/app/lib/cert/tencent.php @@ -110,7 +110,7 @@ class tencent implements CertInterface 'ServiceType' => 'nginx', ]; $data = $this->request('DescribeDownloadCertificateUrl', $param); - $file_data = curl_client($data['DownloadCertificateUrl'], null, null, null, null, $this->proxy); + $file_data = http_request($data['DownloadCertificateUrl'], null, null, null, null, $this->proxy); $file_data = $file_data['body'] ?? null; if (empty($file_data)) throw new Exception('下载证书失败'); $file_path = app()->getRuntimePath() . 'cert/' . $data['DownloadFilename']; diff --git a/app/lib/cert/zerossl.php b/app/lib/cert/zerossl.php index 08c7228..ebdbbfc 100644 --- a/app/lib/cert/zerossl.php +++ b/app/lib/cert/zerossl.php @@ -120,7 +120,7 @@ class zerossl implements CertInterface private function getEAB($email) { $api = "https://api.zerossl.com/acme/eab-credentials-email"; - $response = curl_client($api, http_build_query(['email' => $email]), null, null, null, $this->config['proxy'] == 1); + $response = http_request($api, http_build_query(['email' => $email]), null, null, null, $this->config['proxy'] == 1); $result = json_decode($response['body'], true); if (!isset($result['success'])) { throw new Exception('获取EAB失败:' . $response['body']); diff --git a/app/lib/deploy/baishan.php b/app/lib/deploy/baishan.php index 3a4a262..61915e3 100644 --- a/app/lib/deploy/baishan.php +++ b/app/lib/deploy/baishan.php @@ -59,7 +59,7 @@ class baishan implements DeployInterface $headers['Content-Type'] = 'application/json'; $body = json_encode($params); } - $response = curl_client($url, $body, null, null, $headers, $this->proxy); + $response = http_request($url, $body, null, null, $headers, $this->proxy); $result = json_decode($response['body'], true); if (isset($result['code']) && $result['code'] == 0) { return $result; diff --git a/app/lib/deploy/btpanel.php b/app/lib/deploy/btpanel.php index 94b2686..f7d2bb7 100644 --- a/app/lib/deploy/btpanel.php +++ b/app/lib/deploy/btpanel.php @@ -179,7 +179,7 @@ class btpanel implements DeployInterface 'request_time' => $now_time ]; $post_data = array_merge($post_data, $params); - $response = curl_client($url, $post_data, null, null, null, $this->proxy); + $response = http_request($url, $post_data, null, null, null, $this->proxy); return $response['body']; } } diff --git a/app/lib/deploy/btwaf.php b/app/lib/deploy/btwaf.php index d01c67d..a0ac74d 100644 --- a/app/lib/deploy/btwaf.php +++ b/app/lib/deploy/btwaf.php @@ -128,7 +128,7 @@ class btwaf implements DeployInterface 'Content-Type' => 'application/json', ]; $post = $params ? json_encode($params) : null; - $response = curl_client($url, $post, null, null, $headers, $this->proxy, 'POST'); + $response = http_request($url, $post, null, null, $headers, $this->proxy, 'POST'); return $response['body']; } } diff --git a/app/lib/deploy/cachefly.php b/app/lib/deploy/cachefly.php index e8beeb8..0c03996 100644 --- a/app/lib/deploy/cachefly.php +++ b/app/lib/deploy/cachefly.php @@ -43,7 +43,7 @@ class cachefly implements DeployInterface $headers['Content-Type'] = 'application/json'; $body = json_encode($params); } - $response = curl_client($url, $body, null, null, $headers, $this->proxy, $method); + $response = http_request($url, $body, null, null, $headers, $this->proxy, $method); $result = json_decode($response['body'], true); if ($response['code'] >= 200 && $response['code'] < 300) { return $result; diff --git a/app/lib/deploy/cdnfly.php b/app/lib/deploy/cdnfly.php index 35fcf9f..80e59e5 100644 --- a/app/lib/deploy/cdnfly.php +++ b/app/lib/deploy/cdnfly.php @@ -50,7 +50,7 @@ class cdnfly implements DeployInterface $headers['Content-Type'] = 'application/json'; $body = json_encode($params); } - $response = curl_client($url, $body, null, null, $headers, $this->proxy, $method); + $response = http_request($url, $body, null, null, $headers, $this->proxy, $method); $result = json_decode($response['body'], true); if (isset($result['code']) && $result['code'] == 0) { return isset($result['data']) ? $result['data'] : null; diff --git a/app/lib/deploy/doge.php b/app/lib/deploy/doge.php index 597770c..06e2d76 100644 --- a/app/lib/deploy/doge.php +++ b/app/lib/deploy/doge.php @@ -98,7 +98,7 @@ class doge implements DeployInterface $headers = ['Authorization' => $authorization]; if($body && $json) $headers['Content-Type'] = 'application/json'; $url = 'https://api.dogecloud.com'.$path; - $response = curl_client($url, $body, null, null, $headers, $this->proxy); + $response = http_request($url, $body, null, null, $headers, $this->proxy); $result = json_decode($response['body'], true); if(isset($result['code']) && $result['code'] == 200){ return $result['data'] ?? true; diff --git a/app/lib/deploy/gcore.php b/app/lib/deploy/gcore.php index 181ff63..a779d56 100644 --- a/app/lib/deploy/gcore.php +++ b/app/lib/deploy/gcore.php @@ -48,7 +48,7 @@ class gcore implements DeployInterface $headers['Content-Type'] = 'application/json'; $body = json_encode($params); } - $response = curl_client($url, $body, null, null, $headers, $this->proxy, $method); + $response = http_request($url, $body, null, null, $headers, $this->proxy, $method); $result = json_decode($response['body'], true); if ($response['code'] >= 200 && $response['code'] < 300) { return $result; diff --git a/app/lib/deploy/goedge.php b/app/lib/deploy/goedge.php index e08f636..0bbcdcd 100644 --- a/app/lib/deploy/goedge.php +++ b/app/lib/deploy/goedge.php @@ -128,7 +128,7 @@ class goedge implements DeployInterface $headers['Content-Type'] = 'application/json'; $body = json_encode($params); } - $response = curl_client($url, $body, null, null, $headers, $this->proxy); + $response = http_request($url, $body, null, null, $headers, $this->proxy); $result = json_decode($response['body'], true); if (isset($result['code']) && $result['code'] == 200) { return $result['data'] ?? null; diff --git a/app/lib/deploy/kangle.php b/app/lib/deploy/kangle.php index 89c8c5a..707490a 100644 --- a/app/lib/deploy/kangle.php +++ b/app/lib/deploy/kangle.php @@ -71,7 +71,7 @@ class kangle implements DeployInterface 'certificate' => $fullchain, 'certificate_key' => $privatekey, ]; - $response = curl_client($this->url . $path, http_build_query($post), null, $this->cookie, null, $this->proxy); + $response = http_request($this->url . $path, http_build_query($post), null, $this->cookie, null, $this->proxy); if (strpos($response['body'], '成功')) { return true; } elseif (preg_match('/alert\(\'(.*?)\'\)/i', $response['body'], $match)) { @@ -90,7 +90,7 @@ class kangle implements DeployInterface 'certificate' => $fullchain, 'certificate_key' => $privatekey, ]; - $response = curl_client($this->url . $path, http_build_query($post), null, $this->cookie, null, $this->proxy); + $response = http_request($this->url . $path, http_build_query($post), null, $this->cookie, null, $this->proxy); if (strpos($response['body'], '成功')) { return true; } elseif (preg_match('/alert\(\'(.*?)\'\)/i', $response['body'], $match)) { @@ -114,7 +114,7 @@ class kangle implements DeployInterface private function loginBySkey() { $url = $this->url . '/vhost/index.php?c=sso&a=hello&url=' . urlencode($this->url . '/index.php?'); - $response = curl_client($url, null, null, null, null, $this->proxy); + $response = http_request($url, null, null, null, null, $this->proxy); if ($response['code'] == 302 && !empty($response['redirect_url'])) { $cookie = ''; if (isset($response['headers']['Set-Cookie'])) { @@ -147,7 +147,7 @@ class kangle implements DeployInterface { $s = md5($sess_key . $this->username . $sess_key . $this->skey); $url = $this->url . '/vhost/index.php?c=sso&a=login&name=' . $this->username . '&r=' . $sess_key . '&s=' . $s; - $response = curl_client($url, null, null, $cookie, null, $this->proxy); + $response = http_request($url, null, null, $cookie, null, $this->proxy); if ($response['code'] == 302) { return true; } elseif (strlen($response['body']) > 3 && strlen($response['body']) < 50) { @@ -165,7 +165,7 @@ class kangle implements DeployInterface 'username' => $this->username, 'passwd' => $this->password, ]; - $response = curl_client($url, http_build_query($post), $referer, null, null, $this->proxy); + $response = http_request($url, http_build_query($post), $referer, null, null, $this->proxy); if ($response['code'] == 302) { $cookie = ''; if (isset($response['headers']['Set-Cookie'])) { @@ -191,7 +191,7 @@ class kangle implements DeployInterface private function getMain() { $path = '/vhost/'; - curl_client($this->url . $path, null, null, $this->cookie, null, $this->proxy); + http_request($this->url . $path, null, null, $this->cookie, null, $this->proxy); } public function setLogger($func) diff --git a/app/lib/deploy/kangleadmin.php b/app/lib/deploy/kangleadmin.php index c3cb696..6da0a57 100644 --- a/app/lib/deploy/kangleadmin.php +++ b/app/lib/deploy/kangleadmin.php @@ -71,7 +71,7 @@ class kangleadmin implements DeployInterface 'certificate' => $fullchain, 'certificate_key' => $privatekey, ]; - $response = curl_client($this->url . $path, http_build_query($post), null, $this->cookie, null, $this->proxy); + $response = http_request($this->url . $path, http_build_query($post), null, $this->cookie, null, $this->proxy); if (strpos($response['body'], '成功')) { return true; } elseif (preg_match('/alert\(\'(.*?)\'\)/i', $response['body'], $match)) { @@ -90,7 +90,7 @@ class kangleadmin implements DeployInterface 'certificate' => $fullchain, 'certificate_key' => $privatekey, ]; - $response = curl_client($this->url . $path, http_build_query($post), null, $this->cookie, null, $this->proxy); + $response = http_request($this->url . $path, http_build_query($post), null, $this->cookie, null, $this->proxy); if (strpos($response['body'], '成功')) { return true; } elseif (preg_match('/alert\(\'(.*?)\'\)/i', $response['body'], $match)) { @@ -105,7 +105,7 @@ class kangleadmin implements DeployInterface private function login() { $url = $this->url . $this->path . '/index.php?c=sso&a=hello&url=' . urlencode($this->url . $this->path . '/index.php?'); - $response = curl_client($url, null, null, null, null, $this->proxy); + $response = http_request($url, null, null, null, null, $this->proxy); if ($response['code'] == 302 && !empty($response['redirect_url'])) { $cookie = ''; if (isset($response['headers']['Set-Cookie'])) { @@ -138,7 +138,7 @@ class kangleadmin implements DeployInterface { $s = md5($sess_key . $this->username . $sess_key . $this->skey); $url = $this->url . $this->path . '/index.php?c=sso&a=login&name=' . $this->username . '&r=' . $sess_key . '&s=' . $s; - $response = curl_client($url, null, null, $cookie, null, $this->proxy); + $response = http_request($url, null, null, $cookie, null, $this->proxy); if ($response['code'] == 302) { return true; } elseif (strlen($response['body']) > 3 && strlen($response['body']) < 50) { @@ -151,9 +151,9 @@ class kangleadmin implements DeployInterface private function loginVhost($name) { $url = $this->url . $this->path . '/index.php?c=vhost&a=impLogin&name=' . $name; - $response = curl_client($url, null, null, $this->cookie, null, $this->proxy); + $response = http_request($url, null, null, $this->cookie, null, $this->proxy); if ($response['code'] == 302) { - curl_client($this->url . '/vhost/', null, null, $this->cookie, null, $this->proxy); + http_request($this->url . '/vhost/', null, null, $this->cookie, null, $this->proxy); } else { throw new Exception('用户面板登录失败 (httpCode=' . $response['code'] . ')'); } diff --git a/app/lib/deploy/kuocai.php b/app/lib/deploy/kuocai.php index e205d22..4d2d1e6 100644 --- a/app/lib/deploy/kuocai.php +++ b/app/lib/deploy/kuocai.php @@ -74,7 +74,7 @@ class kuocai implements DeployInterface $body = $json ? json_encode($params) : $params; $headers = []; if ($json) $headers['Content-Type'] = 'application/json'; - $response = curl_client( + $response = http_request( $url, $body, null, diff --git a/app/lib/deploy/lecdn.php b/app/lib/deploy/lecdn.php index f30dead..6e55940 100644 --- a/app/lib/deploy/lecdn.php +++ b/app/lib/deploy/lecdn.php @@ -82,7 +82,7 @@ class lecdn implements DeployInterface $headers['Content-Type'] = 'application/json;charset=UTF-8'; $body = json_encode($params); } - $response = curl_client($url, $body, null, null, $headers, $this->proxy, $method); + $response = http_request($url, $body, null, null, $headers, $this->proxy, $method); $result = json_decode($response['body'], true); if (isset($result['code']) && $result['code'] == 200) { return $result['data'] ?? null; diff --git a/app/lib/deploy/mwpanel.php b/app/lib/deploy/mwpanel.php index f536f57..ed79c89 100644 --- a/app/lib/deploy/mwpanel.php +++ b/app/lib/deploy/mwpanel.php @@ -121,7 +121,7 @@ class mwpanel implements DeployInterface 'app-id' => $this->appid, 'app-secret' => $this->appsecret, ]; - $response = curl_client($url, $params ? http_build_query($params) : null, null, null, $headers, $this->proxy); + $response = http_request($url, $params ? http_build_query($params) : null, null, null, $headers, $this->proxy); return $response['body']; } } diff --git a/app/lib/deploy/opanel.php b/app/lib/deploy/opanel.php index 92cdc83..19f4ee6 100644 --- a/app/lib/deploy/opanel.php +++ b/app/lib/deploy/opanel.php @@ -101,7 +101,7 @@ class opanel implements DeployInterface ]; $body = $params ? json_encode($params) : '{}'; if ($body) $headers['Content-Type'] = 'application/json'; - $response = curl_client($url, $body, null, null, $headers, $this->proxy); + $response = http_request($url, $body, null, null, $headers, $this->proxy); $result = json_decode($response['body'], true); if (isset($result['code']) && $result['code'] == 200) { return $result['data'] ?? null; diff --git a/app/lib/deploy/proxmox.php b/app/lib/deploy/proxmox.php index f586afc..80ae5cc 100644 --- a/app/lib/deploy/proxmox.php +++ b/app/lib/deploy/proxmox.php @@ -61,7 +61,7 @@ class proxmox implements DeployInterface $url = $this->url . $path; $headers = ['Authorization' => 'PVEAPIToken=' . $this->api_user . '=' . $this->api_key]; $post = $params ? http_build_query($params) : null; - $response = curl_client($url, $post, null, null, $headers, $this->proxy); + $response = http_request($url, $post, null, null, $headers, $this->proxy); if ($response['code'] == 200) { $result = json_decode($response['body'], true); if (isset($result['data'])) { diff --git a/app/lib/deploy/ratpanel.php b/app/lib/deploy/ratpanel.php index 4b272fb..0038e08 100644 --- a/app/lib/deploy/ratpanel.php +++ b/app/lib/deploy/ratpanel.php @@ -113,7 +113,7 @@ class ratpanel implements DeployInterface $url = $this->url . '/api' . $path; $body = $method == 'GET' ? null : json_encode($params); $sign = $this->signRequest($method, $url, $body, $this->id, $this->token); - $response = curl_client($url, $body, null, null, [ + $response = http_request($url, $body, null, null, [ 'Content-Type' => 'application/json', 'X-Timestamp' => $sign['timestamp'], 'Authorization' => 'HMAC-SHA256 Credential=' . $sign['id'] . ', Signature=' . $sign['signature'] diff --git a/app/lib/deploy/safeline.php b/app/lib/deploy/safeline.php index e932033..59698b7 100644 --- a/app/lib/deploy/safeline.php +++ b/app/lib/deploy/safeline.php @@ -89,7 +89,7 @@ class safeline implements DeployInterface $headers['Content-Type'] = 'application/json'; $body = json_encode($params); } - $response = curl_client($url, $body, null, null, $headers, $this->proxy); + $response = http_request($url, $body, null, null, $headers, $this->proxy); $result = json_decode($response['body'], true); if ($response['code'] == 200 && $result) { return $result['data'] ?? null; diff --git a/app/lib/deploy/synology.php b/app/lib/deploy/synology.php index 8a79426..2d2ee63 100644 --- a/app/lib/deploy/synology.php +++ b/app/lib/deploy/synology.php @@ -43,7 +43,7 @@ class synology implements DeployInterface 'format' => 'sid', 'enable_syno_token' => 'yes', ]; - $response = curl_client($url, http_build_query($params), null, null, null, $this->proxy); + $response = http_request($url, http_build_query($params), null, null, null, $this->proxy); $result = json_decode($response['body'], true); if (isset($result['success']) && $result['success']) { $this->token = $result['data']; @@ -69,7 +69,7 @@ class synology implements DeployInterface '_sid' => $this->token['sid'], 'SynoToken' => $this->token['synotoken'], ]; - $response = curl_client($url . '?' . http_build_query($params), null, null, $this->proxy); + $response = http_request($url . '?' . http_build_query($params), null, null, $this->proxy); $result = json_decode($response['body'], true); if (isset($result['success']) && $result['success']) { $this->log('获取证书列表成功'); @@ -119,7 +119,7 @@ class synology implements DeployInterface 'id' => $id, 'desc' => $config['desc'], ]; - $response = curl_client($url . '?' . http_build_query($params), $post, null, null, null, $this->proxy, null, 15); + $response = http_request($url . '?' . http_build_query($params), $post, null, null, null, $this->proxy, null, 15); unlink($privatekey_file); unlink($fullchain_file); $result = json_decode($response['body'], true); diff --git a/app/lib/deploy/upyun.php b/app/lib/deploy/upyun.php index c14e776..fd4b994 100644 --- a/app/lib/deploy/upyun.php +++ b/app/lib/deploy/upyun.php @@ -35,7 +35,7 @@ class upyun implements DeployInterface 'certificate' => $fullchain, 'private_key' => $privatekey, ]; - $response = curl_client($url, http_build_query($params), null, $this->cookie, null, $this->proxy); + $response = http_request($url, http_build_query($params), null, $this->cookie, null, $this->proxy); $result = json_decode($response['body'], true); if ($result['data']['status'] === 0) { $common_name = $result['data']['result']['commonName']; @@ -52,7 +52,7 @@ class upyun implements DeployInterface 'limit' => 100, 'domain' => $common_name, ]; - $response = curl_client($url . '?' . http_build_query($params), null, null, $this->cookie, null, $this->proxy); + $response = http_request($url . '?' . http_build_query($params), null, null, $this->cookie, null, $this->proxy); $result = json_decode($response['body'], true); if (isset($result['data']['result']) && is_array($result['data']['result'])) { $cert_list = $result['data']['result']; @@ -73,7 +73,7 @@ class upyun implements DeployInterface 'new_crt_id' => $certificate_id, 'old_crt_id' => $crt_id, ]; - $response = curl_client($url, http_build_query($params), null, $this->cookie, null, $this->proxy); + $response = http_request($url, http_build_query($params), null, $this->cookie, null, $this->proxy); $result = json_decode($response['body'], true); if (isset($result['data']['result']) && $result['data']['result'] == true) { $i++; @@ -97,7 +97,7 @@ class upyun implements DeployInterface 'username' => $this->username, 'password' => $this->password, ]; - $response = curl_client($url, http_build_query($params), null, null, null, $this->proxy); + $response = http_request($url, http_build_query($params), null, null, null, $this->proxy); $result = json_decode($response['body'], true); if (isset($result['data']['result']) && $result['data']['result'] == true) { $cookie = ''; diff --git a/app/lib/deploy/wangsu.php b/app/lib/deploy/wangsu.php index 77657a3..f9cd555 100644 --- a/app/lib/deploy/wangsu.php +++ b/app/lib/deploy/wangsu.php @@ -433,7 +433,7 @@ class wangsu implements DeployInterface } $url = 'https://open.chinanetcenter.com' . $path; - $response = curl_client($url, $body, null, null, $headers, $this->proxy, $method, 30); + $response = http_request($url, $body, null, null, $headers, $this->proxy, $method, 30); $result = json_decode($response['body'], true); if ((isset($response['code']) && $response['code'] == 201) || (isset($response['code']) && $response['code'] == 200 && $getLocation === true)) { diff --git a/app/lib/deploy/west.php b/app/lib/deploy/west.php index c96b223..ac357d0 100644 --- a/app/lib/deploy/west.php +++ b/app/lib/deploy/west.php @@ -103,7 +103,7 @@ class west implements DeployInterface $params['username'] = $this->username; $params['time'] = getMillisecond(); $params['token'] = md5($this->username . $this->api_password . $params['time']); - $response = curl_client($this->baseUrl . $path, str_replace('+', '%20', http_build_query($params)), null, null, null, $this->proxy); + $response = http_request($this->baseUrl . $path, str_replace('+', '%20', http_build_query($params)), null, null, null, $this->proxy); $response = mb_convert_encoding($response['body'], 'UTF-8', 'GBK'); $arr = json_decode($response, true); if ($arr) { diff --git a/app/lib/dns/namesilo.php b/app/lib/dns/namesilo.php index b5ae946..4450980 100644 --- a/app/lib/dns/namesilo.php +++ b/app/lib/dns/namesilo.php @@ -197,7 +197,7 @@ class namesilo implements DnsInterface $url .= '?' . http_build_query($params); try{ - $response = curl_client($url, null, null, null, null, $this->proxy); + $response = http_request($url, null, null, null, null, $this->proxy); }catch(Exception $e){ $this->setError($e->getMessage()); return false; diff --git a/app/lib/dns/powerdns.php b/app/lib/dns/powerdns.php index d03813e..78913ae 100644 --- a/app/lib/dns/powerdns.php +++ b/app/lib/dns/powerdns.php @@ -380,7 +380,7 @@ class powerdns implements DnsInterface $headers['Content-Type'] = 'application/json'; } try { - $response = curl_client($url, $body, null, null, $headers, $this->proxy, $method); + $response = http_request($url, $body, null, null, $headers, $this->proxy, $method); } catch (Exception $e) { $this->setError($e->getMessage()); return false; diff --git a/app/lib/dns/west.php b/app/lib/dns/west.php index f2c139d..ea0e323 100644 --- a/app/lib/dns/west.php +++ b/app/lib/dns/west.php @@ -182,7 +182,7 @@ class west implements DnsInterface $params['time'] = getMillisecond(); $params['token'] = md5($this->username.$this->api_password.$params['time']); try{ - $response = curl_client($this->baseUrl . $path, http_build_query($params), null, null, null, $this->proxy); + $response = http_request($this->baseUrl . $path, http_build_query($params), null, null, null, $this->proxy); }catch(\Exception $e){ $this->setError($e->getMessage()); return false; From a99d0320df7a805b3a0565786195ff56bcfedbb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Mon, 9 Jun 2025 05:36:57 +0800 Subject: [PATCH 11/15] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E7=AD=BE=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common.php | 47 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/app/common.php b/app/common.php index f367fc1..885c014 100644 --- a/app/common.php +++ b/app/common.php @@ -392,7 +392,21 @@ function clearDirectory($dir): bool return true; } -function http_request($url, $data = null, $referer = null, $cookie = null, $headers = null, $proxy = false, $method = null, $timeout = 5) +/** + * 发送 HTTP 请求 + * + * @param string $url 请求URL + * @param mixed $data 请求数据,可以是字符串或数组,数组将自动序列化 + * @param string|null $referer 请求的Referer头部 + * @param array|null $cookie 请求的Cookie头部 + * @param array|null $headers 其他自定义请求头部 + * @param bool $proxy 是否使用代理 + * @param string|null $method 请求方法,默认为GET或POST(如果$data不为空) + * @param int $timeout 请求超时时间,默认为10秒 + * @return array 包含HTTP状态码、重定向URL、响应头和响应体的数组 + * @throws Exception + */ +function http_request($url, $data = null, $referer = null, $cookie = null, $headers = null, $proxy = false, $method = null, $timeout = 10) { $options = [ 'timeout' => $timeout, @@ -424,10 +438,35 @@ function http_request($url, $data = null, $referer = null, $cookie = null, $head // 处理数据 if ($data) { if ($method !== 'GET') { - if (!isset($options['headers']['Content-Type'])) { - $options['headers']['Content-Type'] = 'application/x-www-form-urlencoded'; + if (is_string($data)) { + $options['body'] = $data; + if (!isset($options['headers']['Content-Type'])) { + if (json_validate($data)) { + // json + $options['headers']['Content-Type'] = 'application/json'; + } elseif (str_contains($data, '=') || str_contains($data, '&')) { + // 表单 + $options['headers']['Content-Type'] = 'application/x-www-form-urlencoded'; + } + } + } else if (is_array($data) || is_object($data)) { + if (!isset($options['headers']['Content-Type'])) { + // 默认为表单 + $options['headers']['Content-Type'] = 'application/x-www-form-urlencoded'; + } + if ($options['headers']['Content-Type'] == 'application/x-www-form-urlencoded') { + // 表单 + $options['form_params'] = $data; + } else if ($options['headers']['Content-Type'] == 'application/json') { + // json + $options['json'] = $data; + } else { + // 其他 + $options['body'] = http_build_query($data); + } + } else { + $options['body'] = $data; } - $options['body'] = $data; } else { // 兼容已经存在查询字符串的情况 if (!str_contains($url, '?')) { From 5f0e97377066ba04fee6d22cb1a627ab00dd013b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Mon, 9 Jun 2025 05:38:52 +0800 Subject: [PATCH 12/15] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E7=AD=BE=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/common.php b/app/common.php index 885c014..44557ee 100644 --- a/app/common.php +++ b/app/common.php @@ -396,14 +396,14 @@ function clearDirectory($dir): bool * 发送 HTTP 请求 * * @param string $url 请求URL - * @param mixed $data 请求数据,可以是字符串或数组,数组将自动序列化 - * @param string|null $referer 请求的Referer头部 - * @param array|null $cookie 请求的Cookie头部 + * @param mixed $data 请求数据,可以是字符串或数组,数组将自动根据请求方法及传入的 Content-Type 序列化 + * @param string|null $referer 请求的 Referer 头部 + * @param array|null $cookie 请求的 Cookie 头部 * @param array|null $headers 其他自定义请求头部 * @param bool $proxy 是否使用代理 - * @param string|null $method 请求方法,默认为GET或POST(如果$data不为空) - * @param int $timeout 请求超时时间,默认为10秒 - * @return array 包含HTTP状态码、重定向URL、响应头和响应体的数组 + * @param string|null $method 请求方法,默认为 GET 或 POST(如果存在请求数据) + * @param int $timeout 请求超时时间,默认为 10 秒 + * @return array 包含 HTTP 状态码、重定向 URL、响应头和响应体的数组 * @throws Exception */ function http_request($url, $data = null, $referer = null, $cookie = null, $headers = null, $proxy = false, $method = null, $timeout = 10) From a4698d67c654bd102b1d1b0e96f0395246633cee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Mon, 9 Jun 2025 05:40:42 +0800 Subject: [PATCH 13/15] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E7=AD=BE=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/common.php b/app/common.php index 44557ee..10d3960 100644 --- a/app/common.php +++ b/app/common.php @@ -396,17 +396,17 @@ function clearDirectory($dir): bool * 发送 HTTP 请求 * * @param string $url 请求URL - * @param mixed $data 请求数据,可以是字符串或数组,数组将自动根据请求方法及传入的 Content-Type 序列化 - * @param string|null $referer 请求的 Referer 头部 - * @param array|null $cookie 请求的 Cookie 头部 - * @param array|null $headers 其他自定义请求头部 + * @param mixed $data 请求数据,可以是字符串或数组,数组将自动根据请求方法及传入的 Content-Type 头序列化 + * @param string|null $referer 请求的 Referer 头 + * @param array|null $cookie 请求的 Cookie 头 + * @param array|null $headers 其他自定义请求头 * @param bool $proxy 是否使用代理 * @param string|null $method 请求方法,默认为 GET 或 POST(如果存在请求数据) * @param int $timeout 请求超时时间,默认为 10 秒 * @return array 包含 HTTP 状态码、重定向 URL、响应头和响应体的数组 * @throws Exception */ -function http_request($url, $data = null, $referer = null, $cookie = null, $headers = null, $proxy = false, $method = null, $timeout = 10) +function http_request($url, $data = null, $referer = null, $cookie = null, $headers = null, $proxy = false, $method = null, $timeout = 10): array { $options = [ 'timeout' => $timeout, From 8c7c568e5c9cfe373c04cb228acf1fbb629221c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Mon, 9 Jun 2025 14:21:42 +0800 Subject: [PATCH 14/15] =?UTF-8?q?=E6=92=A4=E9=94=80=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/Index.php | 2 -- app/view/index/index.html | 32 ++++++++++++++++---------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/app/controller/Index.php b/app/controller/Index.php index af5b722..9e56da8 100644 --- a/app/controller/Index.php +++ b/app/controller/Index.php @@ -67,8 +67,6 @@ class Index extends BaseController 'software' => $_SERVER['SERVER_SOFTWARE'], 'os' => php_uname(), 'date' => date("Y-m-d H:i:s"), - 'no_https' => ! $this->request->isSsl(), - 'old_browser' => str_contains($this->request->header('User-Agent'), 'Windows NT') && str_contains($this->request->header('User-Agent'), 'Trident'), ]; View::assign('info', $info); View::assign('checkupdate', '//auth.cccyun.cc/app/dnsmgr.php?ver=' . config('app.version')); diff --git a/app/view/index/index.html b/app/view/index/index.html index 4621bb8..f28e0b8 100644 --- a/app/view/index/index.html +++ b/app/view/index/index.html @@ -72,22 +72,8 @@
-
- {if $info.no_https} -
-
- 当前正在使用HTTP访问,可能存在被窃取敏感信息风险,请使用HTTPS访问! -
-
- {/if} - {if $info.old_browser} -
-
- 当前浏览器是兼容模式,为确保后台功能正常使用,请切换到极速模式
- 操作方法:点击浏览器地址栏右侧的IE符号→选择“极速模式” -
-
- {/if} +
+
@@ -240,4 +226,18 @@ function cleancache(){ }); } + {/block} \ No newline at end of file From ff676b7be1fec707bb375f937e7b142a20197469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Mon, 9 Jun 2025 14:23:17 +0800 Subject: [PATCH 15/15] =?UTF-8?q?=E6=92=A4=E9=94=80=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/view/index/index.html | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/app/view/index/index.html b/app/view/index/index.html index f28e0b8..3d0a7e6 100644 --- a/app/view/index/index.html +++ b/app/view/index/index.html @@ -72,9 +72,7 @@
-
-
-
+
@@ -227,17 +225,16 @@ function cleancache(){ } {/block} \ No newline at end of file
框架版本 {$info.framework_version}
PHP版本 {$info.php_version}数据库版本 {$info.mysql_version}
Web服务器 {$info.software}
服务器时间 {$info.date}