*/ GalleryCoreApi::requireOnce('modules/core/DownloadItem.inc'); GalleryCoreApi::requireOnce('modules/download/lib/HTTP/Download.php'); /** * Support HTTP compression, partial downloads & resuming using PEAR HTTP_Download package * * This enables MP3 players like Winamp to skip back & forward without buffering an entire file - * http://www.oreillynet.com/pub/a/network/2005/01/07/primetime.html * * @package Download * @subpackage UserInterface */ class DownloadView extends DownloadItemView { function _sendFile($data) { global $gallery; $session =& $gallery->getSession(); /* Print services bypass security so they can get access to full size version of prints */ if (!$session->get('core.isPrintService')) { /* Make sure we have permission */ $permission = 'core.viewSource'; switch($data['derivativeType']) { case DERIVATIVE_TYPE_IMAGE_THUMBNAIL: $permission = 'core.view'; break; case DERIVATIVE_TYPE_IMAGE_RESIZE: $permission = 'core.viewResizes'; break; /* DERIVATIVE_TYPE_IMAGE_PREFERRED uses core.viewSource */ } $ret = GalleryCoreApi::assertHasItemPermission($data['parentId'], $permission); if ($ret) { return $ret; } } HTTP_Download::staticSend(array('file' => $data['derivativePath'], 'contenttype' => $data['mimeType'], 'contentdisposition' => "inline; filename='$data[pseudoFileName]'", 'expires' => GalleryUtilities::getHttpDate(time() + 31536000))); return null; } } ?>