//get time mimetype and set the headers | //get time mimetype and set the headers | ||||
$mimetype = OC_Filesystem::getMimeType($source); | $mimetype = OC_Filesystem::getMimeType($source); | ||||
header("Content-Transfer-Encoding: binary"); | header("Content-Transfer-Encoding: binary"); | ||||
header("Expires: 0"); | |||||
header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); | |||||
header("Pragma: public"); | |||||
OC_Response::disableCaching(); | |||||
header('Content-Disposition: filename="'.basename($source).'"'); | header('Content-Disposition: filename="'.basename($source).'"'); | ||||
header("Content-Type: " . $mimetype); | header("Content-Type: " . $mimetype); | ||||
header("Content-Length: " . OC_Filesystem::filesize($source)); | header("Content-Length: " . OC_Filesystem::filesize($source)); |
OC_MEDIA_COLLECTION::registerPlay($songId); | OC_MEDIA_COLLECTION::registerPlay($songId); | ||||
header('Content-Type:'.$ftype); | header('Content-Type:'.$ftype); | ||||
// calc an offset of 24 hours | |||||
$offset = 3600 * 24; | |||||
// calc the string in GMT not localtime and add the offset | |||||
$expire = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT"; | |||||
//output the HTTP header | |||||
header($expire); | |||||
header('Cache-Control: max-age=3600, must-revalidate'); | |||||
header('Pragma: public'); | |||||
OC_Response::enableCaching(3600 * 24); // 24 hour | |||||
header('Accept-Ranges: bytes'); | header('Accept-Ranges: bytes'); | ||||
header('Content-Length: '.OC_Filesystem::filesize($arguments['path'])); | header('Content-Length: '.OC_Filesystem::filesize($arguments['path'])); | ||||
$gmt_mtime = gmdate('D, d M Y H:i:s', OC_Filesystem::filemtime($arguments['path']) ) . ' GMT'; | |||||
header("Last-Modified: " . $gmt_mtime ); | |||||
$mtime = OC_Filesystem::filemtime($arguments['path']); | |||||
OC_Response::setLastModifiedHeader($mtime); | |||||
OC_Filesystem::readfile($arguments['path']); | OC_Filesystem::readfile($arguments['path']); | ||||
exit; | exit; |
$song=OC_MEDIA_COLLECTION::getSong($_POST['song']); | $song=OC_MEDIA_COLLECTION::getSong($_POST['song']); | ||||
$ftype=OC_Filesystem::getMimeType( $song['song_path'] ); | $ftype=OC_Filesystem::getMimeType( $song['song_path'] ); | ||||
header('Content-Type:'.$ftype); | header('Content-Type:'.$ftype); | ||||
header('Expires: 0'); | |||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); | |||||
header('Pragma: public'); | |||||
OC_Response::disableCaching(); | |||||
header('Content-Length: '.OC_Filesystem::filesize($song['song_path'])); | header('Content-Length: '.OC_Filesystem::filesize($song['song_path'])); | ||||
OC_Filesystem::readfile($song['song_path']); | OC_Filesystem::readfile($song['song_path']); |
header('Content-Type:'.$ftype); | header('Content-Type:'.$ftype); | ||||
header('Content-Disposition: attachment; filename="'.basename($filename).'"'); | header('Content-Disposition: attachment; filename="'.basename($filename).'"'); | ||||
header('Expires: 0'); | |||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); | |||||
header('Pragma: public'); | |||||
OC_Response::disableCaching(); | |||||
header('Content-Length: '.OC_Filesystem::filesize($filename)); | header('Content-Length: '.OC_Filesystem::filesize($filename)); | ||||
@ob_end_clean(); | @ob_end_clean(); |
if($zip or OC_Filesystem::is_readable($filename)){ | if($zip or OC_Filesystem::is_readable($filename)){ | ||||
header('Content-Disposition: attachment; filename="'.basename($filename).'"'); | header('Content-Disposition: attachment; filename="'.basename($filename).'"'); | ||||
header('Content-Transfer-Encoding: binary'); | header('Content-Transfer-Encoding: binary'); | ||||
header('Expires: 0'); | |||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); | |||||
header('Pragma: public'); | |||||
OC_Response::disableCaching(); | |||||
if($zip){ | if($zip){ | ||||
header('Content-Type: application/zip'); | header('Content-Type: application/zip'); | ||||
header('Content-Length: ' . filesize($filename)); | header('Content-Length: ' . filesize($filename)); |
} | } | ||||
} | } | ||||
static public function disableCaching() { | |||||
self::enableCaching(0); | |||||
} | |||||
static public function setStatus($status) { | static public function setStatus($status) { | ||||
$protocol = $_SERVER['SERVER_PROTOCOL']; | $protocol = $_SERVER['SERVER_PROTOCOL']; |