diff --git a/app/Controllers/SkinlibController.php b/app/Controllers/SkinlibController.php index e0d19e8a..17739dd5 100644 --- a/app/Controllers/SkinlibController.php +++ b/app/Controllers/SkinlibController.php @@ -33,22 +33,30 @@ class SkinlibController extends BaseController $query->where('public', '=', '1') ->where('type', '=', 'steve') ->orWhere('type', '=', 'alex'); - })->orderBy($sort_by, 'desc')->skip(($page - 1) * 20)->take(20)->get(); + })->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; if ($uid == $this->user->uid) { // show private textures when show uploaded textures of current user - $textures = Texture::where('uploader', $uid)->orderBy($sort_by, 'desc')->skip(($page - 1) * 20)->take(20)->get(); + $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')->skip(($page - 1) * 20)->take(20)->get(); + $textures = Texture::where('uploader', $uid)->where('public', '1')->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')->skip(($page - 1) * 20)->take(20)->get(); + $textures = Texture::where('type', $filter)->where('public', '1')->orderBy($sort_by, 'desc'); + $total_pages = ceil($textures->count() / 20); + $textures = $textures->skip(($page - 1) * 20)->take(20)->get(); } - $total_pages = ceil(count($textures) / 20); + echo View::make('skinlib.index')->with('user', $this->user) ->with('sort', $sort) diff --git a/app/Models/User.php b/app/Models/User.php index eb17c449..aa42a51d 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -94,7 +94,11 @@ class User public function getNickName() { - return ($this->eloquent_model->nickname == "") ? $this->email : $this->eloquent_model->nickname; + if (!$this->is_registered) { + return "不存在的用户"; + } else { + return ($this->eloquent_model->nickname == "") ? $this->email : $this->eloquent_model->nickname; + } } public function setNickName($new_nickname) diff --git a/resources/views/skinlib/show.tpl b/resources/views/skinlib/show.tpl index 5a35c052..e7af3cda 100644 --- a/resources/views/skinlib/show.tpl +++ b/resources/views/skinlib/show.tpl @@ -106,6 +106,23 @@ 删除材质 + @elseif ($user->is_admin) +
+
+

管理员面板

+
+
+

你可以将此材质设为隐私或删除。这将会使此材质从每一个收藏者的衣柜中移除。

+
+ +
@endif