diff --git a/airtime_mvc/application/cloud_storage/Amazon_S3StorageBackend.php b/airtime_mvc/application/cloud_storage/Amazon_S3StorageBackend.php index 0145f00af..c91d9f442 100644 --- a/airtime_mvc/application/cloud_storage/Amazon_S3StorageBackend.php +++ b/airtime_mvc/application/cloud_storage/Amazon_S3StorageBackend.php @@ -118,8 +118,14 @@ class Amazon_S3StorageBackend extends StorageBackend public function getFilePrefix() { - $hostingId = Billing::getClientInstanceId(); - $filePrefix = substr($hostingId, -2)."/".$hostingId; + $filePrefix = ''; + // only prefix files on S3 when billing is active since saas customers share a s3 bucket + // I'm not sure why the choice was made to put everything into one bucket + // We might refactor this to use a bucket per customer if we revisit S3 + if (LIBRETIME_ENABLE_BILLING === true) { + $hostingId = Billing::getClientInstanceId(); + $filePrefix = substr($hostingId, -2)."/".$hostingId; + } return $filePrefix; } } diff --git a/airtime_mvc/application/common/UsabilityHints.php b/airtime_mvc/application/common/UsabilityHints.php index 04022a1a7..7acf92446 100644 --- a/airtime_mvc/application/common/UsabilityHints.php +++ b/airtime_mvc/application/common/UsabilityHints.php @@ -103,7 +103,7 @@ class Application_Common_UsabilityHints "", ""); } - } else if ($userIsOnShowbuilderPage && $userIsSuperAdmin) { + } else if (LIBRETIME_ENABLE_BILLING === true && $userIsOnShowbuilderPage && $userIsSuperAdmin) { $unpaidInvoice = Billing::checkForUnpaidInvoice(); if ($unpaidInvoice != null) { $invoiceUrl = "/billing/invoice?invoiceid=" . $unpaidInvoice['id']; diff --git a/airtime_mvc/application/configs/constants.php b/airtime_mvc/application/configs/constants.php index af84e69cb..120b08b63 100644 --- a/airtime_mvc/application/configs/constants.php +++ b/airtime_mvc/application/configs/constants.php @@ -141,3 +141,6 @@ define('STATION_PODCAST_SERVICE_NAME', 'station_podcast'); //define('IMPORTED_PODCAST', 1); define('ITUNES_XML_NAMESPACE_URL', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); + +// Billing configuration +define('LIBRETIME_ENABLE_BILLING', false); diff --git a/airtime_mvc/application/configs/navigation.php b/airtime_mvc/application/configs/navigation.php index 2a12003f7..0851b0cf6 100644 --- a/airtime_mvc/application/configs/navigation.php +++ b/airtime_mvc/application/configs/navigation.php @@ -7,122 +7,123 @@ * Zend_Navigation_Page::factory() when constructing * the navigation container below. */ -$pages = array( - array( - 'label' => ""._('My Podcast'), - 'module' => 'default', - 'controller' => 'podcast', - 'action' => 'station', - 'resource' => 'podcast' - ), - array( - 'label' => ""._('Radio Page'), - 'uri' => '/', - 'resource' => '', - 'pages' => array( +$pages = array(); +$pages[] = array( + 'label' => ""._('My Podcast'), + 'module' => 'default', + 'controller' => 'podcast', + 'action' => 'station', + 'resource' => 'podcast' +); +$pages[] = array( + 'label' => ""._('Radio Page'), + 'uri' => '/', + 'resource' => '', + 'pages' => array( + ) +); +$pages[] = array( + 'label' => ""._('Calendar'), + 'module' => 'default', + 'controller' => 'schedule', + 'action' => 'index', + 'resource' => 'schedule' +); +$pages[] = array( + 'label' => ""._('Widgets'), + 'module' => 'default', + 'controller' => 'embeddablewidgets', + 'action' => 'player', + 'resource' => 'embeddablewidgets', + 'title' => 'Widgets', + 'pages' => array( + array( + 'label' => _('Player'), + 'module' => 'default', + 'controller' => 'embeddablewidgets', + 'action' => 'player', + ), + array( + 'label' => _('Weekly Schedule'), + 'module' => 'default', + 'controller' => 'embeddablewidgets', + 'action' => 'schedule', + ), + array( + 'label' => _('Facebook'), + 'module' => 'default', + 'controller' => 'embeddablewidgets', + 'action' => 'facebook', ) - ), - array( - 'label' => ""._('Calendar'), - 'module' => 'default', - 'controller' => 'schedule', - 'action' => 'index', - 'resource' => 'schedule' - ), - array( - 'label' => ""._('Widgets'), - 'module' => 'default', - 'controller' => 'embeddablewidgets', - 'action' => 'player', - 'resource' => 'embeddablewidgets', - 'title' => 'Widgets', - 'pages' => array( - array( - 'label' => _('Player'), - 'module' => 'default', - 'controller' => 'embeddablewidgets', - 'action' => 'player', - ), - array( - 'label' => _('Weekly Schedule'), - 'module' => 'default', - 'controller' => 'embeddablewidgets', - 'action' => 'schedule', - ), - array( - 'label' => _('Facebook'), - 'module' => 'default', - 'controller' => 'embeddablewidgets', - 'action' => 'facebook', - ) + ) +); +$pages[] = array( + 'label' => ""._("Settings"), + 'resource' => 'preference', + 'action' => 'index', + 'module' => 'default', + 'controller' => 'preference', + 'title' => 'Settings', + 'pages' => array( + array( + 'label' => _('General'), + 'module' => 'default', + 'controller' => 'preference' + ), + array( + 'label' => _('My Profile'), + 'controller' => 'user', + 'action' => 'edit-user', + 'resource' => 'user' + ), + array( + 'label' => _('Users'), + 'module' => 'default', + 'controller' => 'user', + 'action' => 'add-user', + 'resource' => 'user' + ), + array( + 'label' => _('Streams'), + 'module' => 'default', + 'controller' => 'preference', + 'action' => 'stream-setting' ) - ), - array( - 'label' => ""._("Settings"), - 'resource' => 'preference', - 'action' => 'index', - 'module' => 'default', - 'controller' => 'preference', - 'title' => 'Settings', - 'pages' => array( - array( - 'label' => _('General'), - 'module' => 'default', - 'controller' => 'preference' - ), - array( - 'label' => _('My Profile'), - 'controller' => 'user', - 'action' => 'edit-user', - 'resource' => 'user' - ), - array( - 'label' => _('Users'), - 'module' => 'default', - 'controller' => 'user', - 'action' => 'add-user', - 'resource' => 'user' - ), - array( - 'label' => _('Streams'), - 'module' => 'default', - 'controller' => 'preference', - 'action' => 'stream-setting' - ) - ) - ), - array( - 'label' => ""._("Analytics"), - 'module' => 'default', - 'controller' => 'playouthistory', - 'action' => 'index', - 'resource' => 'playouthistory', - 'title' => 'Analytics', - 'pages' => array( - array( - 'label' => _('Playout History'), - 'module' => 'default', - 'controller' => 'playouthistory', - 'action' => 'index', - 'resource' => 'playouthistory' - ), - array( - 'label' => _('History Templates'), - 'module' => 'default', - 'controller' => 'playouthistorytemplate', - 'action' => 'index', - 'resource' => 'playouthistorytemplate' - ), - array( - 'label' => _('Listener Stats'), - 'module' => 'default', - 'controller' => 'listenerstat', - 'action' => 'index', - 'resource' => 'listenerstat' - ), - ) - ), - array( + ) +); +$pages[] = array( + 'label' => ""._("Analytics"), + 'module' => 'default', + 'controller' => 'playouthistory', + 'action' => 'index', + 'resource' => 'playouthistory', + 'title' => 'Analytics', + 'pages' => array( + array( + 'label' => _('Playout History'), + 'module' => 'default', + 'controller' => 'playouthistory', + 'action' => 'index', + 'resource' => 'playouthistory' + ), + array( + 'label' => _('History Templates'), + 'module' => 'default', + 'controller' => 'playouthistorytemplate', + 'action' => 'index', + 'resource' => 'playouthistorytemplate' + ), + array( + 'label' => _('Listener Stats'), + 'module' => 'default', + 'controller' => 'listenerstat', + 'action' => 'index', + 'resource' => 'listenerstat' + ), + ) +); +if (LIBRETIME_ENABLE_BILLING === true) { + $pages[] = array( 'label' => (Application_Model_Preference::GetPlanLevel()=="trial") ? ""._('Upgrade')."" : ""._('Billing'), 'controller' => 'billing', 'action' => 'upgrade', @@ -151,48 +152,48 @@ $pages = array( 'resource' => 'billing' ) ) - ), - array( - 'label' => ""._('Help'), - 'controller' => 'dashboard', - 'action' => 'help', - 'resource' => 'dashboard', - 'title' => 'Help', - 'pages' => array( - array( - 'label' => _('Getting Started'), - 'module' => 'default', - 'controller' => 'dashboard', - 'action' => 'help', - 'resource' => 'dashboard' - ), - array( - 'label' => _('FAQ'), - 'uri' => FAQ_URL, - 'target' => "_blank" - ), - array( - 'label' => _('User Manual'), - 'uri' => USER_MANUAL_URL, - 'target' => "_blank" - ), - array( - 'label' => _('File a Support Ticket'), - 'uri' => SUPPORT_TICKET_URL, - 'target' => "_blank" - ), - array( - 'label' => _(sprintf("Help Translate %s", PRODUCT_NAME)), - 'uri' => AIRTIME_TRANSIFEX_URL, - 'target' => "_blank" - ), - array( - 'label' => _('What\'s New?'), - 'uri' => UI_REVAMP_YOUTUBE_URL, - 'target' => "_blank" - ) + ); +} +$pages[] = array( + 'label' => ""._('Help'), + 'controller' => 'dashboard', + 'action' => 'help', + 'resource' => 'dashboard', + 'title' => 'Help', + 'pages' => array( + array( + 'label' => _('Getting Started'), + 'module' => 'default', + 'controller' => 'dashboard', + 'action' => 'help', + 'resource' => 'dashboard' + ), + array( + 'label' => _('FAQ'), + 'uri' => FAQ_URL, + 'target' => "_blank" + ), + array( + 'label' => _('User Manual'), + 'uri' => USER_MANUAL_URL, + 'target' => "_blank" + ), + array( + 'label' => _('File a Support Ticket'), + 'uri' => SUPPORT_TICKET_URL, + 'target' => "_blank" + ), + array( + 'label' => _(sprintf("Help Translate %s", PRODUCT_NAME)), + 'uri' => AIRTIME_TRANSIFEX_URL, + 'target' => "_blank" + ), + array( + 'label' => _('What\'s New?'), + 'uri' => UI_REVAMP_YOUTUBE_URL, + 'target' => "_blank" ) - ), + ) ); diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php index d1f4c9604..e063ea263 100644 --- a/airtime_mvc/application/controllers/LibraryController.php +++ b/airtime_mvc/application/controllers/LibraryController.php @@ -443,7 +443,7 @@ class LibraryController extends Zend_Controller_Action $this->_helper->layout->disableLayout(); - if (!Billing::isStationPodcastAllowed()) { + if (LIBRETIME_ENABLE_BILLING === true && !Billing::isStationPodcastAllowed()) { $this->renderScript("podcast/featureupgrade-pane.phtml"); } diff --git a/airtime_mvc/application/controllers/PodcastController.php b/airtime_mvc/application/controllers/PodcastController.php index 6c1fd05c3..d826f666b 100644 --- a/airtime_mvc/application/controllers/PodcastController.php +++ b/airtime_mvc/application/controllers/PodcastController.php @@ -27,7 +27,7 @@ class PodcastController extends Zend_Controller_Action { */ public function stationAction() { - if (!Billing::isStationPodcastAllowed()) { + if (LIBRETIME_ENABLE_BILLING === true && !Billing::isStationPodcastAllowed()) { $this->render("featureupgrade-page"); return; } diff --git a/airtime_mvc/application/forms/EditUser.php b/airtime_mvc/application/forms/EditUser.php index e35a9ce5d..cfe6ca790 100644 --- a/airtime_mvc/application/forms/EditUser.php +++ b/airtime_mvc/application/forms/EditUser.php @@ -131,7 +131,7 @@ class Application_Form_EditUser extends Zend_Form $timezone->setDecorators(array('ViewHelper')); $this->addElement($timezone); - if (Application_Model_User::getCurrentUser()->isSuperAdmin()) { + if (LIBRETIME_ENABLE_BILLING === true && Application_Model_User::getCurrentUser()->isSuperAdmin()) { $elemsToDisable = array($password, $passwordVerify, $email, $firstName, $lastName, $cellPhone, $skype, $jabber); foreach ($elemsToDisable as $element) { diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index 3109e0b21..cdbab0500 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -1573,7 +1573,7 @@ class Application_Model_Preference * @return int either 0 (public) or 1 (private) */ public static function getStationPodcastPrivacy() { - if (!Billing::isStationPodcastAllowed()) { + if (LIBRETIME_ENABLE_BILLING === true && !Billing::isStationPodcastAllowed()) { // return private setting return 1; } diff --git a/airtime_mvc/application/views/scripts/form/edit-user.phtml b/airtime_mvc/application/views/scripts/form/edit-user.phtml index 1d4e1587e..cff096136 100644 --- a/airtime_mvc/application/views/scripts/form/edit-user.phtml +++ b/airtime_mvc/application/views/scripts/form/edit-user.phtml @@ -1,7 +1,7 @@
=sprintf(_("Note: Since you're the station owner, your account information can be edited in Billing Settings instead."), "/billing/client");?> diff --git a/airtime_mvc/application/views/scripts/form/preferences.phtml b/airtime_mvc/application/views/scripts/form/preferences.phtml index d2fa6494f..ad3aa1d6b 100644 --- a/airtime_mvc/application/views/scripts/form/preferences.phtml +++ b/airtime_mvc/application/views/scripts/form/preferences.phtml @@ -9,7 +9,7 @@