2016-02-02 21:22:53 +08:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @Author: prpr
|
|
|
|
* @Date: 2016-02-02 20:56:42
|
|
|
|
* @Last Modified by: prpr
|
2016-02-03 13:51:24 +08:00
|
|
|
* @Last Modified time: 2016-02-03 13:37:33
|
2016-02-02 21:22:53 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
$dir = dirname(__FILE__);
|
|
|
|
require "$dir/includes/autoload.inc.php";
|
2016-02-03 11:41:39 +08:00
|
|
|
require "$dir/config.php";
|
2016-02-02 21:22:53 +08:00
|
|
|
|
|
|
|
if (isset($_GET['type']) && isset($_GET['uname'])) {
|
|
|
|
$user = new user($_GET['uname']);
|
|
|
|
if (!$user->is_registered) utils::raise(1, 'Non-existent user.');
|
2016-02-02 21:34:07 +08:00
|
|
|
|
2016-02-03 13:27:13 +08:00
|
|
|
$if_modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) : null;
|
|
|
|
|
|
|
|
if ($_GET['type'] == "skin" || $_GET['type'] == "cape") {
|
|
|
|
if ($if_modified_since >= $user->getLastModified()) {
|
|
|
|
header('HTTP/1.0 304 Not Modified');
|
|
|
|
} else {
|
|
|
|
echo $user->getBinaryTexture($_GET['type']);
|
|
|
|
}
|
2016-02-02 21:34:07 +08:00
|
|
|
} else if ($_GET['type'] == "json") {
|
2016-02-02 21:22:53 +08:00
|
|
|
echo $user->getJsonProfile();
|
2016-02-02 21:34:07 +08:00
|
|
|
} else {
|
|
|
|
utils::raise(1, 'Illegal parameters.');
|
2016-02-02 21:22:53 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
utils::raise(1, 'Illegal parameters.');
|
|
|
|
}
|