notify user if texture file is deleted
This commit is contained in:
parent
3a9d1fc665
commit
4a862c6ecc
|
|
@ -96,7 +96,10 @@ class SkinlibController extends BaseController
|
||||||
{
|
{
|
||||||
if (!isset($_GET['tid'])) Http::abort(404, 'No specified tid.');
|
if (!isset($_GET['tid'])) Http::abort(404, 'No specified tid.');
|
||||||
$texture = Texture::find($_GET['tid']);
|
$texture = Texture::find($_GET['tid']);
|
||||||
if (!$texture) Http::abort(404, '请求的材质已经被删除');
|
|
||||||
|
if (!$texture || $texture && !\Storage::exist(BASE_DIR."/textures/".$texture->hash)) {
|
||||||
|
Http::abort(404, '请求的材质文件已经被删除,请联系管理员删除该条目');
|
||||||
|
}
|
||||||
|
|
||||||
if ($texture->public == "0") {
|
if ($texture->public == "0") {
|
||||||
if (is_null($this->user) || ($this->user->uid != $texture->uploader && !$this->user->is_admin))
|
if (is_null($this->user) || ($this->user->uid != $texture->uploader && !$this->user->is_admin))
|
||||||
|
|
|
||||||
|
|
@ -119,8 +119,14 @@ class TextureController extends BaseController
|
||||||
|
|
||||||
public function raw($tid) {
|
public function raw($tid) {
|
||||||
if ($t = Texture::find($tid)) {
|
if ($t = Texture::find($tid)) {
|
||||||
header('Content-Type: image/png');
|
$fname = BASE_DIR."/textures/".$t->hash;
|
||||||
echo \Storage::fread(BASE_DIR."/textures/".$t->hash);
|
|
||||||
|
if (\Storage::exist($fname)) {
|
||||||
|
header('Content-Type: image/png');
|
||||||
|
echo \Storage::fread($fname);
|
||||||
|
} else {
|
||||||
|
Http::abort(404, '请求的材质文件已经被删除');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Http::abort(404, '材质不存在');
|
Http::abort(404, '材质不存在');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user