print nothing if no skin textures

This commit is contained in:
printempw 2016-03-13 09:31:33 +08:00
parent 7a93550064
commit df281252ab
2 changed files with 9 additions and 6 deletions

View File

@ -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);

View File

@ -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。');