/** * Caches the current page. It gets the page from the cache if available and outputs that instead. * @param $aux array additional keys that are used to cache this page */ function cacheCurrentPage($aux = array()) { global $cache; if (!empty($_POST)) { return; } insert_cache_headers(); $result = $cache->get(getGlobalCacheKey($aux)); if ($result != null) { header('X-MCStats-Cache: yes (redis)'); echo $result; exit; } // turn on output buffering ob_start(); register_shutdown_function('cacheFinalizePage'); }
<?php define('ROOT', './'); header('Access-Control-Allow-Origin: *'); require_once ROOT . '../private_html/config.php'; require_once ROOT . '../private_html/includes/database.php'; require_once ROOT . '../private_html/includes/func.php'; ini_set('display_errors', 0); insert_cache_headers(); define('HOURS', 168); // set the search path for fonts putenv('GDFONTPATH=' . realpath('../fonts/')); // The image's height define('IMAGE_HEIGHT', 124); // The image's width define('IMAGE_WIDTH', 478); // We will be outputting a PNG image! header('Content-type: image/png'); // image modifier $scale = isset($_GET['scale']) ? $_GET['scale'] : 1; if ($scale > 10 || $scale <= 0) { define('REAL_IMAGE_HEIGHT', IMAGE_HEIGHT); define('REAL_IMAGE_WIDTH', IMAGE_WIDTH); error_image('Invalid modifier'); } else { define('REAL_IMAGE_HEIGHT', IMAGE_HEIGHT * $scale); define('REAL_IMAGE_WIDTH', IMAGE_WIDTH * $scale); } if (!isset($_GET['plugin'])) { error_image('Error: No plugin provided'); }