getExtensionById('tao')->getConfig('websource_' . $ap); common_Logger::singleton()->register(); $compiledPath = $config['options']['path']; $secretPassphrase = $config['options']['secret']; $ttl = $config['options']['ttl']; $correctToken = md5($timestamp . $subPath . $secretPassphrase); if (time() - $timestamp > $ttl || $token != $correctToken) { header('HTTP/1.0 403 Forbidden'); die(); } $path = []; foreach (explode('/', $subPath . $file) as $ele) { $path[] = rawurldecode($ele); } $filename = $compiledPath . implode(DIRECTORY_SEPARATOR, $path); if (strpos($filename, '?')) { // A query string is provided with the file to be retrieved - clean up! $parts = explode('?', $filename); $filename = $parts[0]; } $cacheTtl = $ttl ? $ttl : (30 * 60); //30 min default header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', $timestamp + $cacheTtl)); tao_helpers_Http::returnFile($filename); exit();