Merge branch 'saas-dev-publishing' of github.com:sourcefabric/Airtime into saas-dev-publishing

This commit is contained in:
Albert Santoni 2015-11-18 12:38:22 -05:00
commit ba832ffe3a
10 changed files with 52 additions and 16 deletions

View File

@ -536,13 +536,13 @@ class ApiController extends Zend_Controller_Action
$mime_type = finfo_buffer($f, $blob, FILEINFO_MIME_TYPE); $mime_type = finfo_buffer($f, $blob, FILEINFO_MIME_TYPE);
finfo_close($f); finfo_close($f);
header("Content-type: " . $mime_type); header("Content-Type: " . $mime_type);
echo $blob; echo $blob;
} else { } else {
header('HTTP/1.0 401 Unauthorized'); 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; exit;
} }
} }
public function scheduleAction() public function scheduleAction()

View File

@ -66,8 +66,10 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::setTuneinPartnerId($values["tunein_partner_id"]); Application_Model_Preference::setTuneinPartnerId($values["tunein_partner_id"]);
// SoundCloud Preferences // SoundCloud Preferences
Application_Model_Preference::setDefaultSoundCloudLicenseType($values["SoundCloudLicense"]); if (Billing::isStationPodcastAllowed()) {
Application_Model_Preference::setDefaultSoundCloudSharingType($values["SoundCloudSharing"]); Application_Model_Preference::setDefaultSoundCloudLicenseType($values["SoundCloudLicense"]);
Application_Model_Preference::setDefaultSoundCloudSharingType($values["SoundCloudSharing"]);
}
$this->view->statusMsg = "<div class='success'>". _("Preferences updated.")."</div>"; $this->view->statusMsg = "<div class='success'>". _("Preferences updated.")."</div>";
$form = new Application_Form_Preferences(); $form = new Application_Form_Preferences();

View File

@ -1573,6 +1573,11 @@ class Application_Model_Preference
} }
public static function getStationPodcastPrivacy() { public static function getStationPodcastPrivacy() {
if (!Billing::isStationPodcastAllowed()) {
// return private setting
return 1;
}
return self::getValue("station_podcast_privacy"); return self::getValue("station_podcast_privacy");
} }

View File

@ -31,8 +31,11 @@ class PodcastEpisodes extends BasePodcastEpisodes
$podcast = StationPodcastQuery::create()->findOneByDbPodcastId($podcastId); $podcast = StationPodcastQuery::create()->findOneByDbPodcastId($podcastId);
if ($podcast) { if ($podcast) {
$fileId = $this->getDbFileId(); $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(); $key = Application_Model_Preference::getStationPodcastDownloadKey();
return Application_Common_HTTPHelper::getStationUrl(false)."rest/media/$fileId/download/$key"; return Application_Common_HTTPHelper::getStationUrl()."rest/media/$fileId/download/$key.$ext";
} }
return parent::getDbDownloadUrl(); return parent::getDbDownloadUrl();
} }

View File

@ -60,19 +60,33 @@ class Rest_Bootstrap extends Zend_Application_Module_Bootstrap
/** MediaController Routes **/ /** MediaController Routes **/
$downloadRoute = new Zend_Controller_Router_Route( $downloadRoute = new Zend_Controller_Router_Route(
'rest/media/:id/download/:download_key', 'rest/media/:id/download',
array( array(
'controller' => 'media', 'controller' => 'media',
'action' => 'download', 'action' => 'download',
'module' => 'rest' 'module' => 'rest'
), ),
array( array(
'id' => '\d+', 'id' => '\d+'
'download_key' => '\w*'
) )
); );
$router->addRoute('download', $downloadRoute); $router->addRoute('download', $downloadRoute);
$podcastEpisodeDownloadRoute = new Zend_Controller_Router_Route_Regex(
'rest/media/(?<id>\d+)/download/(?<download_key>.+)\.(?<file_ext>\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( $clearLibraryRoute = new Zend_Controller_Router_Route(
'rest/media/clear', 'rest/media/clear',
array( array(

View File

@ -193,7 +193,7 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir
*/ */
public function publish($fileId) { public function publish($fileId) {
$id = Application_Model_Preference::getStationPodcastId(); $id = Application_Model_Preference::getStationPodcastId();
$url = $guid = Application_Common_HTTPHelper::getStationUrl(false)."rest/media/$fileId/download"; $url = $guid = Application_Common_HTTPHelper::getStationUrl()."rest/media/$fileId/download";
if (!PodcastEpisodesQuery::create() if (!PodcastEpisodesQuery::create()
->filterByDbPodcastId($id) ->filterByDbPodcastId($id)
->findOneByDbFileId($fileId)) { // Don't allow duplicate episodes ->findOneByDbFileId($fileId)) { // Don't allow duplicate episodes

View File

@ -152,14 +152,14 @@ class Application_Service_PodcastService
public static function createStationPodcast() public static function createStationPodcast()
{ {
$podcast = new Podcast(); $podcast = new Podcast();
$podcast->setDbUrl(Application_Common_HTTPHelper::getStationUrl(false) . "feeds/station-rss"); $podcast->setDbUrl(Application_Common_HTTPHelper::getStationUrl() . "feeds/station-rss");
$title = Application_Model_Preference::GetStationName(); $title = Application_Model_Preference::GetStationName();
$title = empty($title) ? "My Station's Podcast" : $title; $title = empty($title) ? "My Station's Podcast" : $title;
$podcast->setDbTitle($title); $podcast->setDbTitle($title);
$podcast->setDbDescription(Application_Model_Preference::GetStationDescription()); $podcast->setDbDescription(Application_Model_Preference::GetStationDescription());
$podcast->setDbLink(Application_Common_HTTPHelper::getStationUrl(false)); $podcast->setDbLink(Application_Common_HTTPHelper::getStationUrl());
$podcast->setDbLanguage(explode('_', Application_Model_Preference::GetLocale())[0]); $podcast->setDbLanguage(explode('_', Application_Model_Preference::GetLocale())[0]);
$podcast->setDbCreator(Application_Model_Preference::GetStationName()); $podcast->setDbCreator(Application_Model_Preference::GetStationName());
$podcast->setDbOwner(self::getOwnerId()); $podcast->setDbOwner(self::getOwnerId());
@ -371,15 +371,15 @@ class Application_Service_PodcastService
$xml->addAttribute('xmlns:xmlns:atom', "http://www.w3.org/2005/Atom"); $xml->addAttribute('xmlns:xmlns:atom', "http://www.w3.org/2005/Atom");
$atomLink = $channel->addChild("xmlns:atom:link"); $atomLink = $channel->addChild("xmlns:atom:link");
$atomLink->addAttribute("href", Application_Common_HTTPHelper::getStationUrl(false) . "feeds/station-rss"); $atomLink->addAttribute("href", Application_Common_HTTPHelper::getStationUrl() . "feeds/station-rss");
$atomLink->addAttribute("rel", "self"); $atomLink->addAttribute("rel", "self");
$atomLink->addAttribute("type", "application/rss+xml"); $atomLink->addAttribute("type", "application/rss+xml");
$imageUrl = Application_Common_HTTPHelper::getStationUrl(false)."api/station-logo"; $imageUrl = Application_Common_HTTPHelper::getStationUrl()."api/station-logo";
$image = $channel->addChild("image"); $image = $channel->addChild("image");
$image->addChild("title", $podcast->getDbTitle()); $image->addChild("title", $podcast->getDbTitle());
self::addEscapedChild($image, "url", $imageUrl); self::addEscapedChild($image, "url", $imageUrl);
self::addEscapedChild($image, "link", Application_Common_HTTPHelper::getStationUrl(false)); self::addEscapedChild($image, "link", Application_Common_HTTPHelper::getStationUrl());
$xml->addAttribute('xmlns:xmlns:itunes', ITUNES_XML_NAMESPACE_URL); $xml->addAttribute('xmlns:xmlns:itunes', ITUNES_XML_NAMESPACE_URL);
self::addEscapedChild($channel, "xmlns:itunes:author", $podcast->getDbItunesAuthor()); self::addEscapedChild($channel, "xmlns:itunes:author", $podcast->getDbItunesAuthor());

View File

@ -8,10 +8,14 @@
<?php echo $this->element->getSubform('preferences_tunein') ?> <?php echo $this->element->getSubform('preferences_tunein') ?>
</div> </div>
<?php
if (Billing::isStationPodcastAllowed()) { ?>
<h3 class="collapsible-header" id="soundcloud-heading"><span class="arrow-icon"></span><?php echo _("SoundCloud Settings") ?></h3> <h3 class="collapsible-header" id="soundcloud-heading"><span class="arrow-icon"></span><?php echo _("SoundCloud Settings") ?></h3>
<div class="collapsible-content" id="soundcloud-settings"> <div class="collapsible-content" id="soundcloud-settings">
<?php echo $this->element->getSubform('preferences_soundcloud') ?> <?php echo $this->element->getSubform('preferences_soundcloud') ?>
</div> </div>
<?php } ?>
<!-- Hide the 'dangerous settings' by default --> <!-- Hide the 'dangerous settings' by default -->
<h3 class="collapsible-header closed" id="dangerous-heading"><span class="arrow-icon"></span><?php echo _("Dangerous Options") ?></h3> <h3 class="collapsible-header closed" id="dangerous-heading"><span class="arrow-icon"></span><?php echo _("Dangerous Options") ?></h3>

View File

@ -16,7 +16,7 @@
$logoImg = $this->element->getView()->logoImg; $logoImg = $this->element->getView()->logoImg;
$src = "data:image/png;base64,".$logoImg; $src = "data:image/png;base64,".$logoImg;
?> ?>
<img onError="this.onerror = '';this.style.visibility='hidden';$('#logo-remove-btn').hide();$('[id^=stationLogoRemove]').each(function(i,v){v.style.width=v.style.height=v.style.margin=v.style.padding='0px';});" id="logo-img" onload='resizeImg(this, 450, 450);' src="<?php echo $src ?>" /> <img onError="this.onerror = '';this.style.visibility='hidden';$('#logo-remove-btn').hide();$('[id^=stationLogoRemove]').each(function(i,v){v.style.width=v.style.height=v.style.margin=v.style.padding='0px';});" id="logo-img" onload='/*resizeImg(this, 450, 450);*/' src="<?php echo $src ?>" />
</div> </div>
<?php echo $this->element->getElement('locale')->render() ?> <?php echo $this->element->getElement('locale')->render() ?>

View File

@ -3590,6 +3590,14 @@ button.btn-icon-text > i.icon-white {
overflow: auto; overflow: auto;
} }
#media_type_nav > div:not(#nav) {
-webkit-flex: 0 1 auto;
-moz-flex: 0 1 auto;
-ms-flex: 0 1 auto;
-o-flex: 0 1 auto;
flex: 0 1 auto;
}
#media_type_nav .icon-white { #media_type_nav .icon-white {
opacity: 0.8; opacity: 0.8;
} }