Пример #1
0
    $plt_ext_id = $plt_id;
}
if (!$pilot->exists()) {
    errorPic('That pilot doesnt exist.');
}
$corp = $pilot->getCorp();
$alliance = $corp->getAlliance();
// we dont generate pictures for non-members
if (array_search($alliance->getID(), config::get('cfg_allianceid')) === false && !array_search($corp->getID(), config::get('cfg_corpid')) === false && !array_search($pilot->getID(), config::get('cfg_pilotid')) === false) {
    errorPic('Invalid pilot');
}
$id = abs(crc32($sig_name));
// check for cached version
if (file_exists(CacheHandler::exists("{$plt_ext_id}_sig_{$id}.jpg", 'img'))) {
    // cache files for 120 minutes
    if (time() - CacheHandler::age("{$plt_ext_id}_sig_{$id}.jpg", 'img') < 120 * 60 || lastKill($plt_id) > 120 * 60) {
        if (isset($_SERVER['HTTP_IF_NONE_MATCH']) || isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
            header($_SERVER["SERVER_PROTOCOL"] . " 304 Not Modified");
            die;
        } else {
            header('Content-Type: image/jpeg');
            readfile(CacheHandler::get("{$plt_ext_id}_sig_{$id}.jpg", 'img'));
            die;
        }
    }
}
$pid = $pilot->getExternalID();
$cachePath = $pilot->getPortraitPath(256);
$thumb = new thumb($pid, 256);
if (!$thumb->isCached()) {
    $thumb->genCache();