diff --git a/app/Services/Utils.php b/app/Services/Utils.php
index 9ce07534..2c7f9d93 100644
--- a/app/Services/Utils.php
+++ b/app/Services/Utils.php
@@ -4,6 +4,7 @@ namespace App\Services;
use App\Exceptions\PrettyPageException;
use Storage;
+use Log;
class Utils
{
@@ -42,16 +43,24 @@ class Utils
$path = 'tmp'.time();
$absolute_path = BASE_DIR."/storage/textures/$path";
- if (false === move_uploaded_file($file['tmp_name'], $absolute_path)) {
- throw new App\Exceptions\E('Failed to remove uploaded files, please check the permission', 1);
- } else {
- $hash = hash_file('sha256', $absolute_path);
-
- if (!Storage::disk('textures')->has($hash)) {
- Storage::disk('textures')->move($path, $hash);
+ try {
+ if (false === move_uploaded_file($file['tmp_name'], $absolute_path)) {
+ throw new Exception('Failed to remove uploaded files, please check the permission', 1);
}
+ } catch (\Exception $e) {
+ Log::warning("Failed to move uploaded file, $e");
+ } finally {
+ if (file_exists($absolute_path)) {
+ $hash = hash_file('sha256', $absolute_path);
- return $hash;
+ if (!Storage::disk('textures')->has($hash)) {
+ Storage::disk('textures')->move($path, $hash);
+ }
+
+ return $hash;
+ } else {
+ Log::warning("Failed to upload file $path");
+ }
}
}
diff --git a/resources/lang/en/skinlib.yml b/resources/lang/en/skinlib.yml
index de8decfd..687197a0 100644
--- a/resources/lang/en/skinlib.yml
+++ b/resources/lang/en/skinlib.yml
@@ -1,67 +1,76 @@
-index:
- now-showing: Now showing
- any-model: (Any model)
- steve-model: Steve Model
- alex-model: Alex Model
- uploader: User ( :name ) uploaded
- newest-uploaded: Newestly uploaded
- most-likes: Most likes
- no-result: 'No result.'
-
-item:
- remove-from-closet: Remove from closet.
- add-to-closet: Add to closet.
- not-logged-in: Please login.
- private: Private
-
-master:
+general:
filter: Filter
- my-upload: My upload
- sort: Sorting
- search-textures: Search textures
- upload-new-skin: Upload new skin
-
-search:
- title: Result
- no-given-keywords: 'No keywords'
+ my-upload: My Uploaded
+ sort: Sort
+ search-textures: Search For Textures
+ upload-new-skin: Upload New Skin
no-result: No result.
-show:
- title: Details of texture
- login-before-using-closet: Please login before using closet.
- number-of-likes: Number of likes
- detail: Details
- name: Name
- modify-name: Modify name
- suitable-model: Suitable model
- download-raw: Right-click and choose SAVE AS then you can download raw skin file.
- size-of-file: Size of file
- uploader: Uploader
- upload-at: Date of upload
- delete-texture: Delete texture
- change-privacy: Change privacy
- message: 'Textures setted to be private or deleted will be removed from all collectors'' closets.'
- set-private: Be private
- set-public: Be public
- set-message: 'You can make this texture private or delete it, which will remove it from all collectors'' closets.'
- comment: Comments
- no-comment: We have not enabled comment service.
+filter:
+ now-showing: Now showing
+ skin: Skin
+ cape: Cape
+ any-model: (Any Model)
+ steve-model: (Steve Model)
+ alex-model: (Alex Model)
+ uploader: User (:name) Uploaded
- deleted: The requested texture file is already deleted.
- contact-admin: Please contact the admin to delete this texture.
- private: The requested texture is private and is only visible to uploader and admins.
+sort:
+ newest-uploaded: Newestly Uploaded
+ most-liked: Most Liked
+
+item:
+ steve: (Steve)
+ alex: (Alex)
+ cape: (Cape)
+ remove-from-closet: Remove from closet
+ add-to-closet: Add to closet
+ anonymous: Please login first
+ private: Private
+
+search:
+ title: 'Search Result: :query'
+ no-keywords: No keywords given
+
+show:
+ title: Texture Details
+ anonymous: You must login to use closets
+ likes: People who like this
+
+ detail: Details
+ name: Texture Name
+ edit-name: Edit Name
+ model: Applicable Model
+ download-raw: Click to download raw texture
+ size: File Size
+ uploader: Uploader
+ upload-at: Upload At
+
+ manage-panel: Manage Panel
+ delete-texture: Delete Texture
+
+ notice: The texture which was deleted or setted to private will be removed from the closet of everyone who had favorited it.
+ notice-admin: You are able to delete this texture or make it private. The operations will make it removed from the closet of everyone who had favorited it.
+
+ comment: Comment
+ comment-not-available: Comment is not available.
+
+ deleted: The requested texture was already deleted.
+ contact-admin: Please contact the admins to remove this entry.
+ private: The requested texture is private and only visible to the uploader and admins.
upload:
- title: Upload texture
+ title: Upload Texture
+
+ texture-name: Texture Name
+ name-rule: Less than 32 characters and must not contain any special one.
+ texture-type: Texture Type
+ select-file: Select File
+ private-score-notice: It will spend you more scores to set it as private. You will be charged :score scores for every KB storage.
+ privacy-notice: Prevent it from being visible at skin library.
+ set-as-private: Make it Private
+
button: Upload
- upload: Upload
- texture-name: Texture name
- name-message: Length of texture name should be less than 32 bytes and it cannot contain invaild character.
- texture-type: Texture type
- choose-file: Choose file
- storage-message: Private texture will cost more scores. Every KB costs :score scores
- privacy-message: Others cannot find it in skin library.
- set-private: Make it private.
type-error: Incorrect mime type of uploaded file.
invalid-size: Invalid :type file (Width :width, Height :height)
@@ -74,6 +83,9 @@ delete:
success: The texture was deleted successfully.
privacy:
+ change-privacy: Change Privacy
+ set-as-private: Set as Private
+ set-as-public: Set as Public
success: The texture was setted to :privacy successfully.
rename:
@@ -81,4 +93,3 @@ rename:
no-permission: You aren't the uploader of this texture.
non-existent: Non-existent texture.
-
diff --git a/resources/lang/zh-CN/skinlib.yml b/resources/lang/zh-CN/skinlib.yml
index df96c2be..35122300 100644
--- a/resources/lang/zh-CN/skinlib.yml
+++ b/resources/lang/zh-CN/skinlib.yml
@@ -1,51 +1,58 @@
-index:
- now-showing: 当前正显示
- any-model: (任意模型)
- steve-model: Steve 模型
- alex-model: Alex 模型
- uploader: 用户( :name )上传
- newest-uploaded: 最新上传
- most-likes: 最多收藏
- no-result: 无结果
-
-item:
- remove-from-closet: 从衣柜中移除
- add-to-closet: 添加至衣柜
- not-logged-in: 请先登录
- private: 私密
-
-master:
+general:
filter: 过滤器
my-upload: 我的上传
sort: 排序
search-textures: 搜索材质
upload-new-skin: 上传新皮肤
+ no-result: 无结果
+
+filter:
+ now-showing: 当前正显示
+ skin: 皮肤
+ cape: 披风
+ any-model: (任意模型)
+ steve-model: (Steve 模型)
+ alex-model: (Alex 模型)
+ uploader: 用户(:name)上传
+
+sort:
+ newest-uploaded: 最新上传
+ most-likes: 最多收藏
+
+item:
+ steve: (Steve)
+ alex: (Alex)
+ cape: (披风)
+ remove-from-closet: 从衣柜中移除
+ add-to-closet: 添加至衣柜
+ anonymous: 请先登录
+ private: 私密
search:
- title: 搜索结果
- no-given-keywords: 未指定关键字
- no-result: 无结果
+ title: 搜索结果::query
+ no-keywords: 未指定关键字
show:
title: 材质详情
- login-before-using-closet: 登录后才能使用衣柜哦
- number-of-likes: 收藏人数
+ anonymous: 登录后才能使用衣柜哦
+ likes: 收藏人数
+
detail: 详细信息
name: 名称
- modify-name: 修改名称
- suitable-model: 适用模型
+ edit-name: 修改名称
+ model: 适用模型
download-raw: 右键另存为即可下载原始皮肤文件
- size-of-file: 文件大小
+ size: 文件大小
uploader: 上传者
upload-at: 上传日期
+
+ manage-panel: 管理面板
delete-texture: 删除材质
- change-privacy: 设置隐私
- message: 材质设为隐私或被删除后将会从每一个收藏者的衣柜中移除。
- set-private: 设为隐私
- set-public: 设为公开
- set-message: 你可以将此材质设为隐私或删除。这将会使此材质从每一个收藏者的衣柜中移除。
+ notice: 材质设为隐私或被删除后将会从每一个收藏者的衣柜中移除。
+ notice-admin: 你可以将此材质设为隐私或删除。这将会使此材质从每一个收藏者的衣柜中移除。
+
comment: 评论区
- no-comment: 本站未开启评论服务
+ comment-not-available: 本站未开启评论服务
deleted: 请求的材质文件已经被删除
contact-admin: 请联系管理员删除该条目
@@ -53,15 +60,16 @@ show:
upload:
title: 上传材质
- button: 确认上传
- upload: 上传
+
texture-name: 材质名称
- name-message: 材质名称应该小于 32 个字节且不能包含奇怪的符号
+ name-rule: 材质名称应该小于 32 个字节且不能包含奇怪的符号
texture-type: 材质类型
- choose-file: 选择文件
- storage-message: 私密材质将会消耗更多的积分:每 KB 存储空间 :score 积分
- privacy-message: 其他人将不会在皮肤库中看到此材质
- set-private: 设置为私密材质
+ select-file: 选择文件
+ private-score-notice: 私密材质将会消耗更多的积分:每 KB 存储空间 :score 积分
+ privacy-notice: 其他人将不会在皮肤库中看到此材质
+ set-as-private: 设置为私密材质
+
+ button: 确认上传
type-error: 文件格式不对哦
invalid-size: 不是有效的 :type 文件(宽 :width,高 :height)
@@ -74,6 +82,9 @@ delete:
success: 材质已被成功删除
privacy:
+ change-privacy: 设置隐私
+ set-as-private: 设为隐私
+ set-as-public: 设为公开
success: 材质已被设为 :privacy
rename:
diff --git a/resources/views/skinlib/index.tpl b/resources/views/skinlib/index.tpl
index 31fd73e1..5c46c3ac 100644
--- a/resources/views/skinlib/index.tpl
+++ b/resources/views/skinlib/index.tpl
@@ -12,29 +12,7 @@
{{ trans('general.skinlib') }}
Skin Library
-
- - {{ trans('skinlib.index.now-showing') }}
- -
- @if ($filter == "skin")
- {{ trans('general.skin') }}{{ trans('skinlib.index.any-model') }}
- @elseif ($filter == "steve")
- {{ trans('skinlib.index.any-model') }}({{ trans('skinlib.index.steve-model') }})
- @elseif ($filter == "alex")
- {{ trans('general.skin') }}{{ trans('skinlib.index.alex-model') }}
- @elseif ($filter == "cape")
- {{ trans('general.cape') }}
- @elseif ($filter == "user")
- {{ trans('skinlib.index.uploader', ['name' => (new App\Models\User($_GET['uid']))->getNickName()]) }}
- @endif
-
- -
- @if ($sort == "time")
- {{ trans('skinlib.index.newest-uploaded') }}
- @elseif ($sort == "likes")
- {{ trans('skinlib.index.most-likes') }}
- @endif
-
-
+ @include('vendor.breadcrumb')
@@ -46,38 +24,12 @@
@include('skinlib.item')
@empty
- {{ trans('skinlib.index.no-result') }}
+ {{ trans('skinlib.general.no-result') }}
@endforelse
+
diff --git a/resources/views/skinlib/item.tpl b/resources/views/skinlib/item.tpl
index ce72b63f..d69d4593 100644
--- a/resources/views/skinlib/item.tpl
+++ b/resources/views/skinlib/item.tpl
@@ -1,14 +1,15 @@
-
 }})
+