function init_server() { if (isset($_GET['key']) && isset($_GET['file'])) { $xsToken = new xsToken(); if ($xsToken->isValid($_GET['file'], $_GET['key'])) { $file = $_GET['file']; } else { $file = 'no_access.jpg'; } $config = array('file' => $file, 'file_path' => XS_FILES . '/protected_images/', 'force_download' => 0, 'burst_size' => 0, 'throttle' => 0, 'mime_types' => array('jpe' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', 'png' => 'image/png', 'svg' => 'image/svg+xml', 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'gif' => 'image/gif')); return $config; } else { return false; } }
function init_server() { if (isset($_GET['key']) && isset($_GET['media']) && isset($_GET['file'])) { $xsToken = new xsToken(); switch ($_GET['media']) { case 'download': $file_path = '/downloads/'; break; default: return false; break; } if ($xsToken->isValid($_GET['file'], $_GET['key'])) { $file = $_GET['file']; } else { return false; } $config = array('file' => $file, 'file_path' => XS_FILES . $file_path, 'force_download' => true, 'burst_size' => 0, 'throttle' => 500, 'mime_types' => array('swf' => 'application/x-shockwave-flash', 'flv' => 'video/x-flv', 'mp4' => 'video/mp4', 'f4v' => 'video/mp4', 'f4p' => 'video/mp4', 'asf' => 'video/x-ms-asf', 'asr' => 'video/x-ms-asf', 'asx' => 'video/x-ms-asf', 'avi' => 'video/x-msvideo', 'mpa' => 'video/mpeg', 'mpe' => 'video/mpeg', 'mpeg' => 'video/mpeg', 'mpg' => 'video/mpeg', 'mpv2' => 'video/mpeg', 'mov' => 'video/quicktime', 'movie' => 'video/x-sgi-movie', 'mp2' => 'video/mpeg', 'qt' => 'video/quicktime', 'mp3' => 'audio/mpeg', 'wav' => 'audio/x-wav', 'aif' => 'audio/x-aiff', 'aifc' => 'audio/x-aiff', 'aiff' => 'audio/x-aiff', 'jpe' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', 'png' => 'image/png', 'svg' => 'image/svg+xml', 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'gif' => 'image/gif', 'txt' => 'text/plain', 'xml' => 'text/xml', 'css' => 'text/css', 'htm' => 'text/html', 'html' => 'text/html', 'js' => 'application/x-javascript', 'pdf' => 'application/pdf', 'doc' => 'application/msword', 'vcf' => 'text/x-vcard', 'vrml' => 'x-world/x-vrml', 'zip' => 'application/zip')); return $config; } else { return false; } }