diff --git a/campcaster/src/modules/htmlUI/var/ui_browser.class.php b/campcaster/src/modules/htmlUI/var/ui_browser.class.php index c9eaef6e9..08bc9a79a 100644 --- a/campcaster/src/modules/htmlUI/var/ui_browser.class.php +++ b/campcaster/src/modules/htmlUI/var/ui_browser.class.php @@ -448,15 +448,12 @@ class uiBrowser extends uiBase { $id = BasicStor::IdFromGunid($clipid); $type = Greenbox::getFileType($id); - if (strtolower($type) === strtolower(UI_FILETYPE_AUDIOCLIP)) { - $m3u = "http://{$_SERVER['SERVER_NAME']}".$CC_CONFIG['accessRawAudioUrl']."?sessid={$this->sessid}&id=$clipid\n"; + if (1) { + header("Location: http://{$_SERVER['SERVER_NAME']}".$CC_CONFIG['accessRawAudioUrl']."?sessid={$this->sessid}&id=$clipid\n"); } else { $m3u = $this->getMetadataValue($id, UI_MDATA_KEY_URL); } - touch(UI_TESTSTREAM_MU3_TMP); - $handle = fopen(UI_TESTSTREAM_MU3_TMP, "w"); - fwrite($handle, $m3u); - fclose($handle); + } // fn listen2Audio } // class uiBrowser diff --git a/campcaster/src/modules/storageServer/var/xmlrpc/simpleGet.php b/campcaster/src/modules/storageServer/var/xmlrpc/simpleGet.php index 1933e7f9e..6bb95a20b 100644 --- a/campcaster/src/modules/storageServer/var/xmlrpc/simpleGet.php +++ b/campcaster/src/modules/storageServer/var/xmlrpc/simpleGet.php @@ -30,6 +30,7 @@ require_once(dirname(__FILE__).'/../conf.php'); require_once('DB.php'); require_once(dirname(__FILE__).'/../LocStor.php'); +require_once(dirname(__FILE__).'/../MetaData.php'); $CC_DBC = DB::connect($CC_CONFIG['dsn'], TRUE); $CC_DBC->setErrorHandling(PEAR_ERROR_RETURN); @@ -45,6 +46,21 @@ function http_error($code, $err) exit; } +/** + * This function encodes an filename to + * be transferred via HTTP header. + * + * @param string $p_string utf8 filename + * @return string HTTP header encoded filename + */ +function sg_2hexstring($p_string) +{ + for ($x=0; $x < strlen($p_string); $x++) { + $return .= '%' . bin2hex($p_string[$x]); + } + return $return; +} + // parameter checking: if (preg_match("|^[0-9a-fA-F]{32}$|", $_REQUEST['sessid'])) { $sessid = $_REQUEST['sessid']; @@ -85,8 +101,11 @@ switch ($ftype) { case "audioclip": $realFname = $ac->getRealFileName(); $mime = $ac->getMime(); + $md = new MetaData($ac->getGunId(), null); + $fileName = $md->getMetadataValue('dc:title').'.'.$ac->getFileExtension(); header("Content-type: $mime"); header("Content-length: ".filesize($realFname)); + header("Content-Disposition: attachment; filename*=".sg_2hexstring($fileName).";"); readfile($realFname); break; case "webstream":