This commit is contained in:
printempw 2016-02-06 22:07:47 +08:00
commit eaed7ba3d9
2 changed files with 5 additions and 3 deletions

View File

@ -3,7 +3,7 @@
* @Author: prpr
* @Date: 2016-02-02 20:56:42
* @Last Modified by: prpr
* @Last Modified time: 2016-02-05 14:51:26
* @Last Modified time: 2016-02-06 21:51:19
*
* All textures requests of legacy link will be handle here.
*/
@ -18,7 +18,8 @@ if (isset($_GET['type']) && isset($_GET['uname'])) {
$if_modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) : null;
if ($_GET['type'] == "skin" || $_GET['type'] == "cape") {
$model = (isset($_GET['model']) && $_GET['model'] == "steve") ? "steve" : "alex";
$model_preferrnce = ($user->getPreference() == "default") ? "steve" : "alex";
$model = (isset($_GET['model']) && $_GET['model'] == "") ? $model_preferrnce : $_GET['model'];
if ($if_modified_since >= $user->getLastModified()) {
header('HTTP/1.0 304 Not Modified');
} else {

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-01-16 23:01:33
* @Last Modified by: prpr
* @Last Modified time: 2016-02-05 21:58:57
* @Last Modified time: 2016-02-06 21:34:21
*/
class user
@ -95,6 +95,7 @@ class user
header('Content-Type: image/png');
// Cache friendly
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $this->getLastModified()).' GMT');
header('Content-Length: '.filesize($filename));
return utils::fread($filename);
} else {
utils::raise(-1, 'Texture no longer exists.');