Problem: Billing is always on
Solution: Make billing configurable through LIBRETIME_ENABLE_BILLING and deactivate it This should catch all the changes needed to deactive billing in LibreTime. * [x] only call billing when it is enabled * [x] let super admins edit their info * [x] dont link to billing if it is disabled
This commit is contained in:
parent
4557395a86
commit
6e03863fa1
11 changed files with 176 additions and 164 deletions
|
@ -118,8 +118,14 @@ class Amazon_S3StorageBackend extends StorageBackend
|
||||||
|
|
||||||
public function getFilePrefix()
|
public function getFilePrefix()
|
||||||
{
|
{
|
||||||
$hostingId = Billing::getClientInstanceId();
|
$filePrefix = '';
|
||||||
$filePrefix = substr($hostingId, -2)."/".$hostingId;
|
// 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;
|
return $filePrefix;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ class Application_Common_UsabilityHints
|
||||||
"<a href=\"/schedule\">",
|
"<a href=\"/schedule\">",
|
||||||
"</a>");
|
"</a>");
|
||||||
}
|
}
|
||||||
} else if ($userIsOnShowbuilderPage && $userIsSuperAdmin) {
|
} else if (LIBRETIME_ENABLE_BILLING === true && $userIsOnShowbuilderPage && $userIsSuperAdmin) {
|
||||||
$unpaidInvoice = Billing::checkForUnpaidInvoice();
|
$unpaidInvoice = Billing::checkForUnpaidInvoice();
|
||||||
if ($unpaidInvoice != null) {
|
if ($unpaidInvoice != null) {
|
||||||
$invoiceUrl = "/billing/invoice?invoiceid=" . $unpaidInvoice['id'];
|
$invoiceUrl = "/billing/invoice?invoiceid=" . $unpaidInvoice['id'];
|
||||||
|
|
|
@ -141,3 +141,6 @@ define('STATION_PODCAST_SERVICE_NAME', 'station_podcast');
|
||||||
//define('IMPORTED_PODCAST', 1);
|
//define('IMPORTED_PODCAST', 1);
|
||||||
|
|
||||||
define('ITUNES_XML_NAMESPACE_URL', 'http://www.itunes.com/dtds/podcast-1.0.dtd');
|
define('ITUNES_XML_NAMESPACE_URL', 'http://www.itunes.com/dtds/podcast-1.0.dtd');
|
||||||
|
|
||||||
|
// Billing configuration
|
||||||
|
define('LIBRETIME_ENABLE_BILLING', false);
|
||||||
|
|
|
@ -7,122 +7,123 @@
|
||||||
* Zend_Navigation_Page::factory() when constructing
|
* Zend_Navigation_Page::factory() when constructing
|
||||||
* the navigation container below.
|
* the navigation container below.
|
||||||
*/
|
*/
|
||||||
$pages = array(
|
$pages = array();
|
||||||
array(
|
$pages[] = array(
|
||||||
'label' => "<i class='icon-music icon-white'></i>"._('My Podcast'),
|
'label' => "<i class='icon-music icon-white'></i>"._('My Podcast'),
|
||||||
'module' => 'default',
|
'module' => 'default',
|
||||||
'controller' => 'podcast',
|
'controller' => 'podcast',
|
||||||
'action' => 'station',
|
'action' => 'station',
|
||||||
'resource' => 'podcast'
|
'resource' => 'podcast'
|
||||||
),
|
);
|
||||||
array(
|
$pages[] = array(
|
||||||
'label' => "<i class='icon-globe icon-white'></i>"._('Radio Page'),
|
'label' => "<i class='icon-globe icon-white'></i>"._('Radio Page'),
|
||||||
'uri' => '/',
|
'uri' => '/',
|
||||||
'resource' => '',
|
'resource' => '',
|
||||||
'pages' => array(
|
'pages' => array(
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$pages[] = array(
|
||||||
|
'label' => "<i class='icon-calendar icon-white'></i>"._('Calendar'),
|
||||||
|
'module' => 'default',
|
||||||
|
'controller' => 'schedule',
|
||||||
|
'action' => 'index',
|
||||||
|
'resource' => 'schedule'
|
||||||
|
);
|
||||||
|
$pages[] = array(
|
||||||
|
'label' => "<i class='icon-wrench icon-white'></i>"._('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' => "<i class='icon-calendar icon-white'></i>"._('Calendar'),
|
$pages[] = array(
|
||||||
'module' => 'default',
|
'label' => "<i class='icon-cog icon-white'></i>"._("Settings"),
|
||||||
'controller' => 'schedule',
|
'resource' => 'preference',
|
||||||
'action' => 'index',
|
'action' => 'index',
|
||||||
'resource' => 'schedule'
|
'module' => 'default',
|
||||||
),
|
'controller' => 'preference',
|
||||||
array(
|
'title' => 'Settings',
|
||||||
'label' => "<i class='icon-wrench icon-white'></i>"._('Widgets'),
|
'pages' => array(
|
||||||
'module' => 'default',
|
array(
|
||||||
'controller' => 'embeddablewidgets',
|
'label' => _('General'),
|
||||||
'action' => 'player',
|
'module' => 'default',
|
||||||
'resource' => 'embeddablewidgets',
|
'controller' => 'preference'
|
||||||
'title' => 'Widgets',
|
),
|
||||||
'pages' => array(
|
array(
|
||||||
array(
|
'label' => _('My Profile'),
|
||||||
'label' => _('Player'),
|
'controller' => 'user',
|
||||||
'module' => 'default',
|
'action' => 'edit-user',
|
||||||
'controller' => 'embeddablewidgets',
|
'resource' => 'user'
|
||||||
'action' => 'player',
|
),
|
||||||
),
|
array(
|
||||||
array(
|
'label' => _('Users'),
|
||||||
'label' => _('Weekly Schedule'),
|
'module' => 'default',
|
||||||
'module' => 'default',
|
'controller' => 'user',
|
||||||
'controller' => 'embeddablewidgets',
|
'action' => 'add-user',
|
||||||
'action' => 'schedule',
|
'resource' => 'user'
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'label' => _('Facebook'),
|
'label' => _('Streams'),
|
||||||
'module' => 'default',
|
'module' => 'default',
|
||||||
'controller' => 'embeddablewidgets',
|
'controller' => 'preference',
|
||||||
'action' => 'facebook',
|
'action' => 'stream-setting'
|
||||||
)
|
|
||||||
)
|
)
|
||||||
),
|
)
|
||||||
array(
|
);
|
||||||
'label' => "<i class='icon-cog icon-white'></i>"._("Settings"),
|
$pages[] = array(
|
||||||
'resource' => 'preference',
|
'label' => "<i class='icon-signal icon-white'></i>"._("Analytics"),
|
||||||
'action' => 'index',
|
'module' => 'default',
|
||||||
'module' => 'default',
|
'controller' => 'playouthistory',
|
||||||
'controller' => 'preference',
|
'action' => 'index',
|
||||||
'title' => 'Settings',
|
'resource' => 'playouthistory',
|
||||||
'pages' => array(
|
'title' => 'Analytics',
|
||||||
array(
|
'pages' => array(
|
||||||
'label' => _('General'),
|
array(
|
||||||
'module' => 'default',
|
'label' => _('Playout History'),
|
||||||
'controller' => 'preference'
|
'module' => 'default',
|
||||||
),
|
'controller' => 'playouthistory',
|
||||||
array(
|
'action' => 'index',
|
||||||
'label' => _('My Profile'),
|
'resource' => 'playouthistory'
|
||||||
'controller' => 'user',
|
),
|
||||||
'action' => 'edit-user',
|
array(
|
||||||
'resource' => 'user'
|
'label' => _('History Templates'),
|
||||||
),
|
'module' => 'default',
|
||||||
array(
|
'controller' => 'playouthistorytemplate',
|
||||||
'label' => _('Users'),
|
'action' => 'index',
|
||||||
'module' => 'default',
|
'resource' => 'playouthistorytemplate'
|
||||||
'controller' => 'user',
|
),
|
||||||
'action' => 'add-user',
|
array(
|
||||||
'resource' => 'user'
|
'label' => _('Listener Stats'),
|
||||||
),
|
'module' => 'default',
|
||||||
array(
|
'controller' => 'listenerstat',
|
||||||
'label' => _('Streams'),
|
'action' => 'index',
|
||||||
'module' => 'default',
|
'resource' => 'listenerstat'
|
||||||
'controller' => 'preference',
|
),
|
||||||
'action' => 'stream-setting'
|
)
|
||||||
)
|
);
|
||||||
)
|
if (LIBRETIME_ENABLE_BILLING === true) {
|
||||||
),
|
$pages[] = array(
|
||||||
array(
|
|
||||||
'label' => "<i class='icon-signal icon-white'></i>"._("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(
|
|
||||||
'label' => (Application_Model_Preference::GetPlanLevel()=="trial") ? "<i class='icon-star icon-orange'></i><span style='color: #ff5d1a'>"._('Upgrade')."</span>" : "<i class='icon-briefcase icon-white'></i>"._('Billing'),
|
'label' => (Application_Model_Preference::GetPlanLevel()=="trial") ? "<i class='icon-star icon-orange'></i><span style='color: #ff5d1a'>"._('Upgrade')."</span>" : "<i class='icon-briefcase icon-white'></i>"._('Billing'),
|
||||||
'controller' => 'billing',
|
'controller' => 'billing',
|
||||||
'action' => 'upgrade',
|
'action' => 'upgrade',
|
||||||
|
@ -151,48 +152,48 @@ $pages = array(
|
||||||
'resource' => 'billing'
|
'resource' => 'billing'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
);
|
||||||
array(
|
}
|
||||||
'label' => "<i class='icon-question-sign icon-white'></i>"._('Help'),
|
$pages[] = array(
|
||||||
'controller' => 'dashboard',
|
'label' => "<i class='icon-question-sign icon-white'></i>"._('Help'),
|
||||||
'action' => 'help',
|
'controller' => 'dashboard',
|
||||||
'resource' => 'dashboard',
|
'action' => 'help',
|
||||||
'title' => 'Help',
|
'resource' => 'dashboard',
|
||||||
'pages' => array(
|
'title' => 'Help',
|
||||||
array(
|
'pages' => array(
|
||||||
'label' => _('Getting Started'),
|
array(
|
||||||
'module' => 'default',
|
'label' => _('Getting Started'),
|
||||||
'controller' => 'dashboard',
|
'module' => 'default',
|
||||||
'action' => 'help',
|
'controller' => 'dashboard',
|
||||||
'resource' => 'dashboard'
|
'action' => 'help',
|
||||||
),
|
'resource' => 'dashboard'
|
||||||
array(
|
),
|
||||||
'label' => _('FAQ'),
|
array(
|
||||||
'uri' => FAQ_URL,
|
'label' => _('FAQ'),
|
||||||
'target' => "_blank"
|
'uri' => FAQ_URL,
|
||||||
),
|
'target' => "_blank"
|
||||||
array(
|
),
|
||||||
'label' => _('User Manual'),
|
array(
|
||||||
'uri' => USER_MANUAL_URL,
|
'label' => _('User Manual'),
|
||||||
'target' => "_blank"
|
'uri' => USER_MANUAL_URL,
|
||||||
),
|
'target' => "_blank"
|
||||||
array(
|
),
|
||||||
'label' => _('File a Support Ticket'),
|
array(
|
||||||
'uri' => SUPPORT_TICKET_URL,
|
'label' => _('File a Support Ticket'),
|
||||||
'target' => "_blank"
|
'uri' => SUPPORT_TICKET_URL,
|
||||||
),
|
'target' => "_blank"
|
||||||
array(
|
),
|
||||||
'label' => _(sprintf("Help Translate %s", PRODUCT_NAME)),
|
array(
|
||||||
'uri' => AIRTIME_TRANSIFEX_URL,
|
'label' => _(sprintf("Help Translate %s", PRODUCT_NAME)),
|
||||||
'target' => "_blank"
|
'uri' => AIRTIME_TRANSIFEX_URL,
|
||||||
),
|
'target' => "_blank"
|
||||||
array(
|
),
|
||||||
'label' => _('What\'s New?'),
|
array(
|
||||||
'uri' => UI_REVAMP_YOUTUBE_URL,
|
'label' => _('What\'s New?'),
|
||||||
'target' => "_blank"
|
'uri' => UI_REVAMP_YOUTUBE_URL,
|
||||||
)
|
'target' => "_blank"
|
||||||
)
|
)
|
||||||
),
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -443,7 +443,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
$this->_helper->layout->disableLayout();
|
$this->_helper->layout->disableLayout();
|
||||||
|
|
||||||
|
|
||||||
if (!Billing::isStationPodcastAllowed()) {
|
if (LIBRETIME_ENABLE_BILLING === true && !Billing::isStationPodcastAllowed()) {
|
||||||
$this->renderScript("podcast/featureupgrade-pane.phtml");
|
$this->renderScript("podcast/featureupgrade-pane.phtml");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ class PodcastController extends Zend_Controller_Action {
|
||||||
*/
|
*/
|
||||||
public function stationAction() {
|
public function stationAction() {
|
||||||
|
|
||||||
if (!Billing::isStationPodcastAllowed()) {
|
if (LIBRETIME_ENABLE_BILLING === true && !Billing::isStationPodcastAllowed()) {
|
||||||
$this->render("featureupgrade-page");
|
$this->render("featureupgrade-page");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ class Application_Form_EditUser extends Zend_Form
|
||||||
$timezone->setDecorators(array('ViewHelper'));
|
$timezone->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($timezone);
|
$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,
|
$elemsToDisable = array($password, $passwordVerify, $email, $firstName, $lastName,
|
||||||
$cellPhone, $skype, $jabber);
|
$cellPhone, $skype, $jabber);
|
||||||
foreach ($elemsToDisable as $element) {
|
foreach ($elemsToDisable as $element) {
|
||||||
|
|
|
@ -1573,7 +1573,7 @@ class Application_Model_Preference
|
||||||
* @return int either 0 (public) or 1 (private)
|
* @return int either 0 (public) or 1 (private)
|
||||||
*/
|
*/
|
||||||
public static function getStationPodcastPrivacy() {
|
public static function getStationPodcastPrivacy() {
|
||||||
if (!Billing::isStationPodcastAllowed()) {
|
if (LIBRETIME_ENABLE_BILLING === true && !Billing::isStationPodcastAllowed()) {
|
||||||
// return private setting
|
// return private setting
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<h2><?php echo _("My Profile") ?></h2>
|
<h2><?php echo _("My Profile") ?></h2>
|
||||||
<div id="current-user-container">
|
<div id="current-user-container">
|
||||||
|
|
||||||
<?php if(Application_Model_User::getCurrentUser()->isSuperAdmin()) : ?>
|
<?php if(LIBRETIME_ENABLE_BILLING === true && Application_Model_User::getCurrentUser()->isSuperAdmin()) : ?>
|
||||||
<div id="user_details_superadmin_message">
|
<div id="user_details_superadmin_message">
|
||||||
<p class="alert alert-error">
|
<p class="alert alert-error">
|
||||||
<?=sprintf(_("<b>Note:</b> Since you're the station owner, your account information can be edited in <a href=\"%s\">Billing Settings</a> instead."), "/billing/client");?>
|
<?=sprintf(_("<b>Note:</b> Since you're the station owner, your account information can be edited in <a href=\"%s\">Billing Settings</a> instead."), "/billing/client");?>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (Billing::isStationPodcastAllowed()) { ?>
|
if (LIBRETIME_ENABLE_BILLING === true && 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') ?>
|
||||||
|
|
|
@ -26,9 +26,11 @@
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<?php if (LIBRETIME_ENABLE_BILLING === true) { ?>
|
||||||
<div class="user-data" id="user_details_superadmin_message" style="display: none; margin-top: 105px; text-align: center;">
|
<div class="user-data" id="user_details_superadmin_message" style="display: none; margin-top: 105px; text-align: center;">
|
||||||
<?=sprintf(_("Super Admin details can be changed in your <a href=\"%s\">Billing Settings</a>."), "/billing/client");?>
|
<?=sprintf(_("Super Admin details can be changed in your <a href=\"%s\">Billing Settings</a>."), "/billing/client");?>
|
||||||
</div>
|
</div>
|
||||||
|
<?php } ?>
|
||||||
<div class="user-data simple-formblock" id="user_details">
|
<div class="user-data simple-formblock" id="user_details">
|
||||||
<?php echo $this->successMessage ?>
|
<?php echo $this->successMessage ?>
|
||||||
<fieldset class="padded">
|
<fieldset class="padded">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue