diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index deac3f998..daba2e524 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -535,13 +535,13 @@ class ApiController extends Zend_Controller_Action $mime_type = finfo_buffer($f, $blob, FILEINFO_MIME_TYPE); finfo_close($f); - header("Content-type: " . $mime_type); + header("Content-Type: " . $mime_type); echo $blob; } else { header('HTTP/1.0 401 Unauthorized'); - print _('You are not allowed to access this resource. '); + print _('You are not allowed to access this resource.'); exit; - } + } } public function scheduleAction() diff --git a/airtime_mvc/application/models/airtime/PodcastEpisodes.php b/airtime_mvc/application/models/airtime/PodcastEpisodes.php index eea1f7311..6f47b6e48 100644 --- a/airtime_mvc/application/models/airtime/PodcastEpisodes.php +++ b/airtime_mvc/application/models/airtime/PodcastEpisodes.php @@ -31,8 +31,11 @@ class PodcastEpisodes extends BasePodcastEpisodes $podcast = StationPodcastQuery::create()->findOneByDbPodcastId($podcastId); if ($podcast) { $fileId = $this->getDbFileId(); + // FIXME: this is an interim solution until we can do better... + $file = CcFilesQuery::create()->findPk($fileId); + $ext = FileDataHelper::getAudioMimeTypeArray()[$file->getDbMime()]; $key = Application_Model_Preference::getStationPodcastDownloadKey(); - return Application_Common_HTTPHelper::getStationUrl(false)."rest/media/$fileId/download/$key"; + return Application_Common_HTTPHelper::getStationUrl(false)."rest/media/$fileId/download/$key.$ext"; } return parent::getDbDownloadUrl(); } diff --git a/airtime_mvc/application/modules/rest/Bootstrap.php b/airtime_mvc/application/modules/rest/Bootstrap.php index 11a9b2fae..016c94017 100644 --- a/airtime_mvc/application/modules/rest/Bootstrap.php +++ b/airtime_mvc/application/modules/rest/Bootstrap.php @@ -60,19 +60,33 @@ class Rest_Bootstrap extends Zend_Application_Module_Bootstrap /** MediaController Routes **/ $downloadRoute = new Zend_Controller_Router_Route( - 'rest/media/:id/download/:download_key', + 'rest/media/:id/download', array( 'controller' => 'media', 'action' => 'download', 'module' => 'rest' ), array( - 'id' => '\d+', - 'download_key' => '\w*' + 'id' => '\d+' ) ); $router->addRoute('download', $downloadRoute); + $podcastEpisodeDownloadRoute = new Zend_Controller_Router_Route_Regex( + 'rest/media/(?\d+)/download/(?.+)\.(?\w+)', + array( + 'controller' => 'media', + 'action' => 'download', + 'module' => 'rest' + ), + array( + 1 => "id", + 2 => "download_key", + 3 => "file_ext" + ) + ); + $router->addRoute('podcast-episode-download', $podcastEpisodeDownloadRoute); + $clearLibraryRoute = new Zend_Controller_Router_Route( 'rest/media/clear', array( diff --git a/airtime_mvc/application/views/scripts/form/preferences_general.phtml b/airtime_mvc/application/views/scripts/form/preferences_general.phtml index 4ef93aaa5..205d6d65a 100644 --- a/airtime_mvc/application/views/scripts/form/preferences_general.phtml +++ b/airtime_mvc/application/views/scripts/form/preferences_general.phtml @@ -16,7 +16,7 @@ $logoImg = $this->element->getView()->logoImg; $src = "data:image/png;base64,".$logoImg; ?> - + element->getElement('locale')->render() ?>