From cd50418e62ebd753e7ab5ac5eb29b91ddd6e86d7 Mon Sep 17 00:00:00 2001 From: tao Date: Thu, 30 Dec 2021 16:36:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=90=8E=E5=8F=B0=E7=99=BB?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +- app/admin/controller/Login.php | 8 +-- app/admin/controller/Upgrade.php | 7 ++- app/common/lib/Zip.php | 55 +++++++++++++++++++ composer.lock | 12 ++-- vendor/composer/autoload_files.php | 2 +- vendor/composer/autoload_static.php | 2 +- vendor/composer/installed.json | 14 ++--- vendor/composer/installed.php | 10 ++-- vendor/services.php | 2 +- .../var-dumper/Caster/ReflectionCaster.php | 20 ++++--- 11 files changed, 95 insertions(+), 41 deletions(-) create mode 100644 app/common/lib/Zip.php diff --git a/README.md b/README.md index c9aac95..92d839f 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ > TaoLer是一个简单迅捷的轻论坛系统,适用于个人或组织区域型信息交流发布平台。 * 官网:https://www.aieok.com - * 版本:TaoLer 1.8.17 - * 日期:2021.12.25 + * 版本:TaoLer 1.8.18 + * 日期:2021.12.30 webman版新架构已适配90% diff --git a/app/admin/controller/Login.php b/app/admin/controller/Login.php index e4ca85e..4a9b055 100644 --- a/app/admin/controller/Login.php +++ b/app/admin/controller/Login.php @@ -28,13 +28,7 @@ class Login extends AdminController $user = new \app\admin\model\Admin(); $result = $user->login($data); - if ($result == 1) { - $res = ['code'=>0,'msg'=>'登陆成功', 'url'=>(string) url('index/index')]; - //$res['data']['access_token'] = $data['__token__']; - } else { - $res = ['code'=>-1,'msg'=>$result,'url'=>(string) url('admin/login')]; - } - return json($res); + return $result; } return View::fetch('login'); } diff --git a/app/admin/controller/Upgrade.php b/app/admin/controller/Upgrade.php index 428c32f..e1aeb88 100644 --- a/app/admin/controller/Upgrade.php +++ b/app/admin/controller/Upgrade.php @@ -26,6 +26,7 @@ use think\facade\Log; use app\common\lib\ZipFile; use app\common\lib\SetConf; use app\common\lib\SqlFile; +use app\common\lib\Zip; class Upgrade extends AdminController { @@ -237,10 +238,12 @@ class Upgrade extends AdminController private function execute_update(string $package_file) { //解压 zip文件有密码的话需要解密 - $uzip = new ZipFile(); + //$uzip = new ZipFile(); + $zip = new Zip; $zipDir = strstr($package_file, '.zip',true); //返回文件名后缀前的字符串 $zipPath = Files::getDirPath($zipDir); //转换为带/的路径 压缩文件解压到的路径 - $unzip_res = $uzip->unzip($package_file,$zipPath,true); + //$unzip_res = $uzip->unzip($package_file,$zipPath,true); + $unzip_res = $zip->unzip($package_file,$zipPath); if(!$unzip_res) { diff --git a/app/common/lib/Zip.php b/app/common/lib/Zip.php new file mode 100644 index 0000000..f2872be --- /dev/null +++ b/app/common/lib/Zip.php @@ -0,0 +1,55 @@ +open($filePath, ZipArchive::CREATE); + foreach ($files as $key => $file) { + //检查文件是否存在 + if (!file_exists($file)) { + return false; + } + $zip->addFile($file, basename($file)); + } + $zip->close(); + + return true; + } + + /** + * zip解压方法 + * @param string $filePath 压缩包所在地址 【绝对文件地址】d:/test/123.zip + * @param string $path 解压路径 【绝对文件目录路径】d:/test + * @return bool + */ + function unzip($filePath, $path) { + if (empty($path) || empty($filePath)) { + return false; + } + + $zip = new \ZipArchive(); + + if ($zip->open($filePath) === true) { + $zip->extractTo($path); + $zip->close(); + return true; + } else { + return false; + } + } +} +?> \ No newline at end of file diff --git a/composer.lock b/composer.lock index d37c43a..228497d 100644 --- a/composer.lock +++ b/composer.lock @@ -1465,16 +1465,16 @@ }, { "name": "symfony/var-dumper", - "version": "v4.4.34", + "version": "v4.4.36", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "2d0c056b2faaa3d785bdbd5adecc593a5be9c16e" + "reference": "02685c62fcbc4262235cc72a54fbd45ab719ce3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/2d0c056b2faaa3d785bdbd5adecc593a5be9c16e", - "reference": "2d0c056b2faaa3d785bdbd5adecc593a5be9c16e", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/02685c62fcbc4262235cc72a54fbd45ab719ce3c", + "reference": "02685c62fcbc4262235cc72a54fbd45ab719ce3c", "shasum": "", "mirrors": [ { @@ -1540,7 +1540,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v4.4.34" + "source": "https://github.com/symfony/var-dumper/tree/v4.4.36" }, "funding": [ { @@ -1556,7 +1556,7 @@ "type": "tidelift" } ], - "time": "2021-11-12T10:50:54+00:00" + "time": "2021-12-29T09:28:53+00:00" }, { "name": "topthink/think-trace", diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php index 4062436..bf855c7 100644 --- a/vendor/composer/autoload_files.php +++ b/vendor/composer/autoload_files.php @@ -11,8 +11,8 @@ return array( '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', '25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php', 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php', - '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php', '223fa6f9b46fbe5d6b44c5ff847bfceb' => $vendorDir . '/taoser/think-addons/src/helper.php', '1cfd2761b63b0a29ed23657ea394cb2d' => $vendorDir . '/topthink/think-captcha/src/helper.php', + '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php', 'd421242fd42b2ea6cd13f802bcf18a6e' => $baseDir . '/extend/taoler/com/form.php', ); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 3454110..c6fd617 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -12,9 +12,9 @@ class ComposerStaticInit1b32198725235c8d6500c87262ef30c2 '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', '25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php', 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', - '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php', '223fa6f9b46fbe5d6b44c5ff847bfceb' => __DIR__ . '/..' . '/taoser/think-addons/src/helper.php', '1cfd2761b63b0a29ed23657ea394cb2d' => __DIR__ . '/..' . '/topthink/think-captcha/src/helper.php', + '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php', 'd421242fd42b2ea6cd13f802bcf18a6e' => __DIR__ . '/../..' . '/extend/taoler/com/form.php', ); diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 30ebe8d..4939606 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -926,17 +926,17 @@ }, { "name": "symfony/var-dumper", - "version": "v4.4.34", - "version_normalized": "4.4.34.0", + "version": "v4.4.36", + "version_normalized": "4.4.36.0", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "2d0c056b2faaa3d785bdbd5adecc593a5be9c16e" + "reference": "02685c62fcbc4262235cc72a54fbd45ab719ce3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/2d0c056b2faaa3d785bdbd5adecc593a5be9c16e", - "reference": "2d0c056b2faaa3d785bdbd5adecc593a5be9c16e", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/02685c62fcbc4262235cc72a54fbd45ab719ce3c", + "reference": "02685c62fcbc4262235cc72a54fbd45ab719ce3c", "shasum": "", "mirrors": [ { @@ -966,7 +966,7 @@ "ext-intl": "To show region name in time zone dump", "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" }, - "time": "2021-11-12T10:50:54+00:00", + "time": "2021-12-29T09:28:53+00:00", "bin": [ "Resources/bin/var-dump-server" ], @@ -1004,7 +1004,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v4.4.34" + "source": "https://github.com/symfony/var-dumper/tree/v4.4.36" }, "funding": [ { diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index eb7bff8..dce2203 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -5,7 +5,7 @@ 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => 'b6eb893a4cc88c8d03d8d6fdcbf1663ccc8b1cc6', + 'reference' => '13037f7440f2dcce2cd78297df9d6a675744ecad', 'name' => 'taoser/taoler', 'dev' => true, ), @@ -128,12 +128,12 @@ 'dev_requirement' => true, ), 'symfony/var-dumper' => array( - 'pretty_version' => 'v4.4.34', - 'version' => '4.4.34.0', + 'pretty_version' => 'v4.4.36', + 'version' => '4.4.36.0', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/var-dumper', 'aliases' => array(), - 'reference' => '2d0c056b2faaa3d785bdbd5adecc593a5be9c16e', + 'reference' => '02685c62fcbc4262235cc72a54fbd45ab719ce3c', 'dev_requirement' => true, ), 'taoser/taoler' => array( @@ -142,7 +142,7 @@ 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => 'b6eb893a4cc88c8d03d8d6fdcbf1663ccc8b1cc6', + 'reference' => '13037f7440f2dcce2cd78297df9d6a675744ecad', 'dev_requirement' => false, ), 'taoser/think-addons' => array( diff --git a/vendor/services.php b/vendor/services.php index 5e74b66..2bc1318 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'taoser\\addons\\Service', diff --git a/vendor/symfony/var-dumper/Caster/ReflectionCaster.php b/vendor/symfony/var-dumper/Caster/ReflectionCaster.php index 819a618..2a74b25 100644 --- a/vendor/symfony/var-dumper/Caster/ReflectionCaster.php +++ b/vendor/symfony/var-dumper/Caster/ReflectionCaster.php @@ -134,7 +134,7 @@ class ReflectionCaster array_unshift($trace, [ 'function' => 'yield', 'file' => $function->getExecutingFile(), - 'line' => $function->getExecutingLine() - 1, + 'line' => $function->getExecutingLine() - (int) (\PHP_VERSION_ID < 80100), ]); $trace[] = $frame; $a[$prefix.'trace'] = new TraceStub($trace, false, 0, -1, -1); @@ -263,15 +263,17 @@ class ReflectionCaster unset($a[$prefix.'allowsNull']); } - try { - $a[$prefix.'default'] = $v = $c->getDefaultValue(); - if ($c->isDefaultValueConstant()) { - $a[$prefix.'default'] = new ConstStub($c->getDefaultValueConstantName(), $v); + if ($c->isOptional()) { + try { + $a[$prefix.'default'] = $v = $c->getDefaultValue(); + if ($c->isDefaultValueConstant()) { + $a[$prefix.'default'] = new ConstStub($c->getDefaultValueConstantName(), $v); + } + if (null === $v) { + unset($a[$prefix.'allowsNull']); + } + } catch (\ReflectionException $e) { } - if (null === $v) { - unset($a[$prefix.'allowsNull']); - } - } catch (\ReflectionException $e) { } return $a;