From df281252abc3a9b6308741217aa62bd463e850b6 Mon Sep 17 00:00:00 2001 From: printempw Date: Sun, 13 Mar 2016 09:31:33 +0800 Subject: [PATCH] print nothing if no skin textures --- get.php | 5 +++-- includes/User.class.php | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/get.php b/get.php index f53fd3af..bb912d1b 100644 --- a/get.php +++ b/get.php @@ -3,7 +3,7 @@ * @Author: prpr * @Date: 2016-02-02 20:56:42 * @Last Modified by: printempw - * @Last Modified time: 2016-03-12 18:46:34 + * @Last Modified time: 2016-03-13 09:27:24 * * All textures requests of legacy link will be handle here. */ @@ -20,7 +20,7 @@ if (isset($_GET['type']) && isset($_GET['uname'])) { // Cache friendly $if_modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) : null; - + // Image bin data if ($_GET['type'] == "skin" || $_GET['type'] == "cape") { $model_preferrnce = ($user->getPreference() == "default") ? "steve" : "alex"; $model = (isset($_GET['model']) && $_GET['model'] == "") ? $model_preferrnce : $_GET['model']; @@ -34,6 +34,7 @@ if (isset($_GET['type']) && isset($_GET['uname'])) { echo $user->getBinaryTexture($model); } } + // JSON profile } else if ($_GET['type'] == "json") { if (isset($_GET['api'])) { echo $user->getJsonProfile(($_GET['api'] == 'csl') ? 0 : 1); diff --git a/includes/User.class.php b/includes/User.class.php index 983ea976..4535aed2 100644 --- a/includes/User.class.php +++ b/includes/User.class.php @@ -3,7 +3,7 @@ * @Author: printempw * @Date: 2016-01-16 23:01:33 * @Last Modified by: printempw - * @Last Modified time: 2016-03-12 18:46:22 + * @Last Modified time: 2016-03-13 09:30:07 */ class User @@ -161,9 +161,11 @@ class User $json['last_update'] = $this->getLastModified(); $json['model_preference'] = [$model, $sec_model]; } - // Skins dict order by preference model - $json['skins'][$model] = $this->getTexture($model == "default" ? "steve" : "alex"); - $json['skins'][$sec_model] = $this->getTexture($sec_model == "default" ? "steve" : "alex"); + if ($this->getTexture('steve') || $this->getTexture('alex')) { + // Skins dict order by preference model + $json['skins'][$model] = $this->getTexture($model == "default" ? "steve" : "alex"); + $json['skins'][$sec_model] = $this->getTexture($sec_model == "default" ? "steve" : "alex"); + } $json['cape'] = $this->getTexture('cape'); } else { Utils::showErrorPage(-1, '配置文件错误:不支持的 API_TYPE。');