fix privacy bug of skinlib

This commit is contained in:
printempw 2016-07-26 13:36:24 +08:00
parent 64082f187d
commit 7f8f882458
2 changed files with 10 additions and 10 deletions

View File

@ -30,12 +30,12 @@ class SkinlibController extends BaseController
if ($filter == "skin") {
$textures = Texture::where(function($query) {
$query->where('public', '=', '1')
->where('type', '=', 'steve')
$query->where('type', '=', 'steve')
->orWhere('type', '=', 'alex');
})->orderBy($sort_by, 'desc');
$total_pages = ceil($textures->count() / 20);
$textures = $textures->skip(($page - 1) * 20)->take(20)->get();
} elseif ($filter == "user") {
$uid = isset($_GET['uid']) ? $_GET['uid'] : 0;
@ -43,20 +43,20 @@ class SkinlibController extends BaseController
// show private textures when show uploaded textures of current user
$textures = Texture::where('uploader', $uid)->orderBy($sort_by, 'desc');
$total_pages = ceil($textures->count() / 20);
$textures = $textures->skip(($page - 1) * 20)->take(20)->get();
} else {
$textures = Texture::where('uploader', $uid)->where('public', '1')->orderBy($sort_by, 'desc');
$textures = Texture::where('uploader', $uid)->orderBy($sort_by, 'desc');
$total_pages = ceil($textures->count() / 20);
$textures = $textures->skip(($page - 1) * 20)->take(20)->get();
}
} else {
$textures = Texture::where('type', $filter)->where('public', '1')->orderBy($sort_by, 'desc');
$textures = Texture::where('type', $filter)->orderBy($sort_by, 'desc');
$total_pages = ceil($textures->count() / 20);
$textures = $textures->skip(($page - 1) * 20)->take(20)->get();
}
if (is_null($this->user) || (!is_null($this->user) && !$this->user->is_admin))
$textures = $textures->where('public', '1');
$textures = $textures->skip(($page - 1) * 20)->take(20)->get();
echo View::make('skinlib.index')->with('user', $this->user)
->with('sort', $sort)

View File

@ -2,7 +2,7 @@
* @Author: prpr
* @Date: 2016-07-19 10:46:38
* @Last Modified by: printempw
* @Last Modified time: 2016-07-26 09:32:30
* @Last Modified time: 2016-07-26 10:28:00
*/
'use strict';
@ -161,7 +161,7 @@ function upload() {
} else if ($('#type').val() == "") {
toastr.info('请选择材质的类型');
$('#type').focus();
} else if ($('#file').prop('files')[0].type === "image/png") {
} else if ($('#file').prop('files')[0].type !== "image/png") {
toastr.warning('请选择 PNG 格式的图片');
$('#file').focus();
} else {