diff --git a/app/Controllers/SkinlibController.php b/app/Controllers/SkinlibController.php index 6a6e80fb..8962df89 100644 --- a/app/Controllers/SkinlibController.php +++ b/app/Controllers/SkinlibController.php @@ -96,7 +96,7 @@ class SkinlibController extends BaseController { if (!isset($_GET['tid'])) Http::abort(404, 'No specified tid.'); $texture = Texture::find($_GET['tid']); -/* + if (!$texture || $texture && !\Storage::exist(BASE_DIR."/textures/".$texture->hash)) { if (Option::get('auto_del_invalid_texture') == "1") { if ($texture) $texture->delete(); @@ -104,7 +104,7 @@ class SkinlibController extends BaseController } Http::abort(404, '请求的材质文件已经被删除,请联系管理员删除该条目'); } -*/ + if ($texture->public == "0") { if (is_null($this->user) || ($this->user->uid != $texture->uploader && !$this->user->is_admin)) Http::abort(404, '请求的材质已经设为隐私,仅上传者和管理员可查看'); diff --git a/app/Services/Storage.php b/app/Services/Storage.php index 4f980ce2..906d1cec 100644 --- a/app/Services/Storage.php +++ b/app/Services/Storage.php @@ -37,6 +37,15 @@ class Storage return $new_fname; } + public static function size($filename) + { + if (self::exist($filename)) { + return filesize($filename); + } else { + return 0; + } + } + /** * Remove a file * diff --git a/resources/views/setup/migrations/import-v2-both.tpl b/resources/views/setup/migrations/import-v2-both.tpl new file mode 100644 index 00000000..efee3228 --- /dev/null +++ b/resources/views/setup/migrations/import-v2-both.tpl @@ -0,0 +1,97 @@ +@extends('setup.migrations.master') + +@section('content') + + + +{{-- Step 1: --}} + +@if ($step == '1') +
将同时导入用户数据以及材质,逻辑比单独导入更加完善。
+导入后材质的上传者将被设置为 v2 的原用户,上传时间将被设置为 v2 用户的最后修改时间。导入后的材质会被自动添加至原上传者的衣柜中,并应用至其所属角色。
+注意: 请先将 v2 的 users 表改名导入到当前 v3 的同一数据库中
+ +已导入 {{ $result['user']['imported'] }} 个用户,{{ $result['user']['duplicated'] }} 个用户因重复而未导入。
+已导入 {{ $result['texture']['imported'] }} 个材质到皮肤库,{{ $result['texture']['duplicated'] }} 个材质因重复而未导入。
+ ++导入完成 +
+ +@endif + +@endsection diff --git a/resources/views/setup/migrations/import-v2-textures.tpl b/resources/views/setup/migrations/import-v2-textures.tpl index 48de5db2..192dbd5e 100644 --- a/resources/views/setup/migrations/import-v2-textures.tpl +++ b/resources/views/setup/migrations/import-v2-textures.tpl @@ -10,7 +10,7 @@本功能用于导入 v2 用户皮肤至 v3 的皮肤库
-请先将 v2 的 users 表改名导入到当前 v3 的同一数据库中
+注意:请先将 v2 的 users 表改名导入到当前 v3 的同一数据库中