From cc9f1ea6d06f9c468c1833284865425ac088c062 Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Wed, 28 Oct 2015 10:58:22 -0400 Subject: [PATCH] * Wrap station podcast feed contents on radio page in displayRssTab check * Test fix for automatic ingest bug * Move disable layout code in feeds controller to avoid error case --- airtime_mvc/application/common/PodcastManager.php | 5 ++--- airtime_mvc/application/controllers/FeedsController.php | 5 +++-- airtime_mvc/application/controllers/IndexController.php | 1 + airtime_mvc/application/views/scripts/index/index.phtml | 6 ++++++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/airtime_mvc/application/common/PodcastManager.php b/airtime_mvc/application/common/PodcastManager.php index ec076e5c7..2af85f97c 100644 --- a/airtime_mvc/application/common/PodcastManager.php +++ b/airtime_mvc/application/common/PodcastManager.php @@ -51,12 +51,11 @@ class PodcastManager { $episodeList = $podcastArray["episodes"]; $episodes = array(); // Sort the episodes by publication date to get the most recent - usort($episodeList, array(static::class, "_sortByEpisodePubDate")); + // usort($episodeList, array(static::class, "_sortByEpisodePubDate")); for ($i = 0; $i < sizeof($episodeList); $i++) { $episodeData = $episodeList[$i]; // If the publication date of this episode is before the ingest timestamp, we don't need to ingest it - // Since we're sorting by publication date, we can break - if (strtotime($episodeData["pub_date"]) < strtotime($podcast->getDbAutoIngestTimestamp())) break; + if (strtotime($episodeData["pub_date"]) < strtotime($podcast->getDbAutoIngestTimestamp())) continue; $episode = PodcastEpisodesQuery::create()->findOneByDbEpisodeGuid($episodeData["guid"]); // Make sure there's no existing episode placeholder or import, and that the data is non-empty if (empty($episode) && !empty($episodeData)) { diff --git a/airtime_mvc/application/controllers/FeedsController.php b/airtime_mvc/application/controllers/FeedsController.php index 4c538fa48..49d25ab36 100644 --- a/airtime_mvc/application/controllers/FeedsController.php +++ b/airtime_mvc/application/controllers/FeedsController.php @@ -4,14 +4,15 @@ class FeedsController extends Zend_Controller_Action { public function stationRssAction() { + $this->view->layout()->disableLayout(); + $this->_helper->viewRenderer->setNoRender(true); + if (Application_Model_Preference::getStationPodcastPrivacy() && $this->getRequest()->getParam("sharing_token") != Application_Model_Preference::getStationPodcastDownloadKey()) { $this->getResponse() ->setHttpResponseCode(401); return; } - $this->view->layout()->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); header('Content-Type: text/xml'); diff --git a/airtime_mvc/application/controllers/IndexController.php b/airtime_mvc/application/controllers/IndexController.php index 0ed845a63..8586ec9de 100644 --- a/airtime_mvc/application/controllers/IndexController.php +++ b/airtime_mvc/application/controllers/IndexController.php @@ -46,6 +46,7 @@ class IndexController extends Zend_Controller_Action $episodes = $podcastEpisodesService->getPodcastEpisodes($stationPodcastId); $this->view->episodes = json_encode($episodes); + $this->view->displayRssTab = (!Application_Model_Preference::getStationPodcastPrivacy()); } public function mainAction() diff --git a/airtime_mvc/application/views/scripts/index/index.phtml b/airtime_mvc/application/views/scripts/index/index.phtml index 69db9b65a..b5caf3c11 100644 --- a/airtime_mvc/application/views/scripts/index/index.phtml +++ b/airtime_mvc/application/views/scripts/index/index.phtml @@ -52,6 +52,8 @@ document.getElementById(id).width= (newwidth) + "px"; + displayRssTab) {?>
+ @@ -79,6 +84,7 @@ document.getElementById(id).width= (newwidth) + "px"; $(document).ready(function(){ $("#player_iframe").load(function () { + // FIXME: Should we hide this somehow when the station is set to private? $("#player_iframe").contents().find('.bottom_bar').append("
"); $("#player_iframe").contents().find('.bottom_bar').append("
"); $("#player_iframe").contents().find('.bottom_bar').append("
");