Merge branch 'saas-dev' into saas-showbuilder

This commit is contained in:
Duncan Sommerville 2015-08-05 15:32:04 -04:00
commit 36f2e1844f
32 changed files with 489 additions and 493 deletions

View File

@ -11,6 +11,7 @@ class ProvisioningHelper
private $dbuser, $dbpass, $dbname, $dbhost, $dbowner, $apikey;
private $instanceId;
private $stationName, $description;
private $defaultIcecastPassword;
public function __construct($apikey)
{
@ -118,6 +119,9 @@ class ProvisioningHelper
if (isset($_POST['description'])) {
$this->description = $_POST['description'];
}
if (isset($_POST['icecast_pass'])) {
$this->defaultIcecastPassword = $_POST['icecast_pass'];
}
}
/**
@ -208,6 +212,9 @@ class ProvisioningHelper
if ($this->description) {
Application_Model_Preference::SetStationDescription($this->description);
}
if (isset($this->defaultIcecastPassword)) {
Application_Model_Preference::setDefaultIcecastPassword($this->defaultIcecastPassword);
}
}
}

View File

@ -43,7 +43,8 @@ $ccAcl->add(new Zend_Acl_Resource('library'))
->add(new Zend_Acl_Resource('provisioning'))
->add(new Zend_Acl_Resource('player'))
->add(new Zend_Acl_Resource('soundcloud'))
->add(new Zend_Acl_Resource('embeddablewidgets'));
->add(new Zend_Acl_Resource('embeddablewidgets'))
->add(new Zend_Acl_Resource('setup'));
/** Creating permissions */
$ccAcl->allow('G', 'index')
@ -65,6 +66,7 @@ $ccAcl->allow('G', 'index')
->allow('G', 'downgrade')
->allow('G', 'rest:show-image', 'get')
->allow('G', 'rest:media', 'get')
->allow('G', 'setup')
->allow('H', 'soundcloud')
->allow('H', 'rest:show-image')
->allow('H', 'rest:media')

View File

@ -17,6 +17,7 @@ define('TERMS_AND_CONDITIONS_URL' , 'http://www.sourcefabric.org/en/about/poli
define('PRIVACY_POLICY_URL' , 'http://www.sourcefabric.org/en/about/policy/');
define('USER_MANUAL_URL' , 'http://sourcefabric.booktype.pro/airtime-pro-for-broadcasters');
define('AIRTIME_TRANSIFEX_URL' , 'https://www.transifex.com/projects/p/airtime/');
define('WHMCS_PASSWORD_RESET_URL' , 'https://account.sourcefabric.com/pwreset.php');
define('LICENSE_VERSION' , 'GNU AGPL v.3');
define('LICENSE_URL' , 'http://www.gnu.org/licenses/agpl-3.0-standalone.html');
@ -32,6 +33,8 @@ define('DEFAULT_LOGO_PLACEHOLDER', 1);
define('DEFAULT_LOGO_FILE', 'images/airtime_logo.png');
define('DEFAULT_TIMESTAMP_FORMAT', 'Y-m-d H:i:s');
define('DEFAULT_MICROTIME_FORMAT', 'Y-m-d H:i:s.u');
define('DEFAULT_ICECAST_PORT', 8000);
define('DEFAULT_ICECAST_PASS', 'hackme');
// Metadata Keys for files
define('MDATA_KEY_FILEPATH' , 'filepath');

View File

@ -171,8 +171,7 @@ class LocaleController extends Zend_Controller_Action
"Check this box to automatically switch on Master/Show source upon source connection." => _("Check this box to automatically switch on Master/Show source upon source connection."),
"If your Icecast server expects a username of 'source', this field can be left blank." => _("If your Icecast server expects a username of 'source', this field can be left blank."),
"If your live streaming client does not ask for a username, this field should be 'source'." => _("If your live streaming client does not ask for a username, this field should be 'source'."),
"If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings). If Airtime is recording, and if the change causes a playout engine restart, the recording will be interrupted."
=> _("If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings). If Airtime is recording, and if the change causes a playout engine restart, the recording will be interrupted."),
"WARNING: This will restart your stream and may cause a short dropout for your listeners!" => _("WARNING: This will restart your stream and may cause a short dropout for your listeners!"),
"This is the admin username and password for Icecast/SHOUTcast to get listener statistics." => _("This is the admin username and password for Icecast/SHOUTcast to get listener statistics."),
//preferences/support-setting.js
"Image must be one of jpg, jpeg, png, or gif" => _("Image must be one of jpg, jpeg, png, or gif"),

View File

@ -140,26 +140,23 @@ class LoginController extends Zend_Controller_Action
Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', $stationLocale));
if (!Application_Model_Preference::GetEnableSystemEmail()) {
$this->_redirect('login');
} else {
//uses separate layout without a navigation.
$this->_helper->layout->setLayout('login');
//uses separate layout without a navigation.
$this->_helper->layout->setLayout('login');
$form = new Application_Form_PasswordRestore();
$form = new Application_Form_PasswordRestore();
$request = $this->getRequest();
if ($request->isPost() && $form->isValid($request->getPost())) {
if (is_null($form->username->getValue()) || $form->username->getValue() == '') {
$user = CcSubjsQuery::create()
->filterByDbEmail($form->email->getValue())
->findOne();
} else {
$user = CcSubjsQuery::create()
->filterByDbEmail($form->email->getValue())
->filterByDbLogin($form->username->getValue())
->findOne();
}
$request = $this->getRequest();
if ($request->isPost() && $form->isValid($request->getPost())) {
$query = CcSubjsQuery::create();
if (empty($form->username->getValue())) {
$query->filterByDbEmail($form->email->getValue());
} else if (empty($form->email->getValue())) {
$query->filterByDbLogin($form->username->getValue());
} else {
$query->filterByDbEmail($form->email->getValue())
->filterByDbLogin($form->username->getValue());
}
$user = $query->findOne();
if (!empty($user)) {
$auth = new Application_Model_Auth();
@ -171,12 +168,13 @@ class LoginController extends Zend_Controller_Action
$form->email->addError($this->view->translate(_("Email could not be sent. Check your mail server settings and ensure it has been configured properly.")));
}
} else {
$form->email->addError($this->view->translate(_("Given email not found.")));
$form->email->addError($this->view->translate(_("There was a problem sending the recovery email.")));
}
} else {
$form->email->addError($this->view->translate(_("We couldn't find the email you entered - you can also try <a href='".WHMCS_PASSWORD_RESET_URL."'>here</a>.")));
}
$this->view->form = $form;
}
$this->view->form = $form;
}
public function passwordRestoreAfterAction()

View File

@ -149,9 +149,6 @@ class PreferenceController extends Zend_Controller_Action
session_start(); //Open session for writing.
// get current settings
$setting = Application_Model_StreamSetting::getStreamSetting();
$name_map = array(
'ogg' => 'Ogg Vorbis',
'fdkaac' => 'AAC+',
@ -160,55 +157,14 @@ class PreferenceController extends Zend_Controller_Action
'mp3' => 'MP3',
);
// get predefined type and bitrate from pref table
$temp_types = Application_Model_Preference::GetStreamType();
$stream_types = array();
foreach ($temp_types as $type) {
$type = strtolower(trim($type));
if (isset($name_map[$type])) {
$name = $name_map[$type];
} else {
$name = $type;
}
$stream_types[$type] = $name;
}
$temp_bitrate = Application_Model_Preference::GetStreamBitrate();
$max_bitrate = intval(Application_Model_Preference::GetMaxBitrate());
$stream_bitrates = array();
foreach ($temp_bitrate as $type) {
if (intval($type) <= $max_bitrate) {
$stream_bitrates[trim($type)] = strtoupper(trim($type))." kbit/s";
}
}
$num_of_stream = intval(Application_Model_Preference::GetNumOfStreams());
$form = new Application_Form_StreamSetting();
// $form->addElement('hash', 'csrf', array(
// 'salt' => 'unique'
// ));
$csrf_namespace = new Zend_Session_Namespace('csrf_namespace');
$csrf_element = new Zend_Form_Element_Hidden('csrf');
$csrf_element->setValue($csrf_namespace->authtoken)->setRequired('true')->removeDecorator('HtmlTag')->removeDecorator('Label');
$form->addElement($csrf_element);
$form->setSetting($setting);
$form->startFrom();
$live_stream_subform = new Application_Form_LiveStreamingPreferences();
$form->addSubForm($live_stream_subform, "live_stream_subform");
for ($i=1; $i<=$num_of_stream; $i++) {
$subform = new Application_Form_StreamSettingSubForm();
$subform->setPrefix($i);
$subform->setSetting($setting);
$subform->setStreamTypes($stream_types);
$subform->setStreamBitrates($stream_bitrates);
$subform->startForm();
$form->addSubForm($subform, "s".$i."_subform");
}
if ($request->isPost()) {
$params = $request->getPost();
/* Parse through post data and put in format
@ -246,7 +202,6 @@ class PreferenceController extends Zend_Controller_Action
$values["s3_data"] = $s3_data;
$values["s4_data"] = $s4_data;
$error = false;
if ($form->isValid($values)) {
$values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata');
@ -263,13 +218,8 @@ class PreferenceController extends Zend_Controller_Action
$s4_set_admin_pass = !empty($values["s4_data"]["admin_pass"]);
// this goes into cc_pref table
Application_Model_Preference::SetStreamLabelFormat($values['streamFormat']);
Application_Model_Preference::SetLiveStreamMasterUsername($values["master_username"]);
Application_Model_Preference::SetLiveStreamMasterPassword($values["master_password"]);
Application_Model_Preference::SetDefaultTransitionFade($values["transition_fade"]);
Application_Model_Preference::SetAutoTransition($values["auto_transition"]);
Application_Model_Preference::SetAutoSwitch($values["auto_switch"]);
$this->setStreamPreferences($values);
// compare new values with current value
$changeRGenabled = Application_Model_Preference::GetEnableReplayGain() != $values["enableReplayGain"];
$changeRGmodifier = Application_Model_Preference::getReplayGainModifier() != $values["replayGainModifier"];
@ -294,34 +244,86 @@ class PreferenceController extends Zend_Controller_Action
}
Application_Model_RabbitMq::SendMessageToPypo("update_stream_setting", $data);
$live_stream_subform->updateVariables();
$this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf();
$this->view->form = $form;
$this->view->num_stream = $num_of_stream;
$this->view->statusMsg = "<div class='success'>"._("Stream Setting Updated.")."</div>";
$this->_helper->json->sendJson(array(
"valid"=>"true",
"html"=>$this->view->render('preference/stream-setting.phtml'),
"s1_set_admin_pass"=>$s1_set_admin_pass,
"s2_set_admin_pass"=>$s2_set_admin_pass,
"s3_set_admin_pass"=>$s3_set_admin_pass,
"s4_set_admin_pass"=>$s4_set_admin_pass,
));
} else {
$live_stream_subform->updateVariables();
$this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf();
$this->view->form = $form;
$this->view->num_stream = $num_of_stream;
$this->_helper->json->sendJson(array("valid"=>"false", "html"=>$this->view->render('preference/stream-setting.phtml')));
}
}
// get predefined type and bitrate from pref table
$temp_types = Application_Model_Preference::GetStreamType();
$stream_types = array();
foreach ($temp_types as $type) {
$type = strtolower(trim($type));
if (isset($name_map[$type])) {
$name = $name_map[$type];
} else {
$name = $type;
}
$stream_types[$type] = $name;
}
$temp_bitrate = Application_Model_Preference::GetStreamBitrate();
$max_bitrate = intval(Application_Model_Preference::GetMaxBitrate());
$stream_bitrates = array();
foreach ($temp_bitrate as $type) {
if (intval($type) <= $max_bitrate) {
$stream_bitrates[trim($type)] = strtoupper(trim($type))." kbit/s";
}
}
// get current settings
$setting = Application_Model_StreamSetting::getStreamSetting();
$form->setSetting($setting);
$form->startFrom();
$live_stream_subform = new Application_Form_LiveStreamingPreferences();
$form->addSubForm($live_stream_subform, "live_stream_subform");
for ($i=1; $i<=$num_of_stream; $i++) {
$subform = new Application_Form_StreamSettingSubForm();
$subform->setPrefix($i);
$subform->setSetting($setting);
$subform->setStreamTypes($stream_types);
$subform->setStreamBitrates($stream_bitrates);
$subform->startForm();
$subform->toggleState();
$form->addSubForm($subform, "s".$i."_subform");
}
$live_stream_subform->updateVariables();
$this->view->num_stream = $num_of_stream;
$this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf();
$this->view->form = $form;
if ($request->isPost()) {
if ($form->isValid($values)) {
$this->_helper->json->sendJson(array(
"valid" => "true",
"html" => $this->view->render('preference/stream-setting.phtml'),
"s1_set_admin_pass" => $s1_set_admin_pass,
"s2_set_admin_pass" => $s2_set_admin_pass,
"s3_set_admin_pass" => $s3_set_admin_pass,
"s4_set_admin_pass" => $s4_set_admin_pass,
));
} else {
$this->_helper->json->sendJson(array("valid" => "false", "html" => $this->view->render('preference/stream-setting.phtml')));
}
}
}
/**
* Set stream settings preferences
*
* @param array $values stream setting preference values
*/
private function setStreamPreferences($values) {
Application_Model_Preference::setUsingCustomStreamSettings($values['customStreamSettings']);
Application_Model_Preference::SetStreamLabelFormat($values['streamFormat']);
Application_Model_Preference::SetLiveStreamMasterUsername($values["master_username"]);
Application_Model_Preference::SetLiveStreamMasterPassword($values["master_password"]);
Application_Model_Preference::SetDefaultTransitionFade($values["transition_fade"]);
Application_Model_Preference::SetAutoTransition($values["auto_transition"]);
Application_Model_Preference::SetAutoSwitch($values["auto_switch"]);
}
public function serverBrowseAction()

View File

@ -41,6 +41,9 @@ class ProvisioningController extends Zend_Controller_Action
if (isset($_POST['provisioning_status'])) {
Application_Model_Preference::setProvisioningStatus($_POST['provisioning_status']);
}
if (isset($_POST['icecast_pass'])) {
Application_Model_Preference::setDefaultIcecastPassword($_POST['icecast_pass']);
}
} catch (Exception $e) {
$this->getResponse()
->setHttpResponseCode(400)

View File

@ -0,0 +1,43 @@
<?php
/** This class displays the Language and Timezone setup popup dialog that you see on first run. */
class SetupController extends Zend_Controller_Action
{
public function init()
{
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('setup-language-timezone', 'json');
}
public function setupLanguageTimezoneAction()
{
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest();
$form = new Application_Form_SetupLanguageTimezone();
if ($request->isPost()) {
$formData = $request->getPost();
if ($form->isValid($formData)) {
$userService = new Application_Service_UserService();
$currentUser = $userService->getCurrentUser();
$currentUserId = $currentUser->getDbId();
Application_Model_Preference::SetUserTimezone($formData["setup_timezone"], $currentUserId);
Application_Model_Preference::SetDefaultTimezone($formData["setup_timezone"]);
Application_Model_Preference::SetUserLocale($formData["setup_language"], $currentUserId);
Application_Model_Preference::SetDefaultLocale($formData["setup_language"]);
Application_Model_Preference::setLangTimezoneSetupComplete(true);
$this->_redirect('/Showbuilder');
}
}
$this->_redirect('/Showbuilder');
}
}

View File

@ -45,6 +45,7 @@ class ShowbuilderController extends Zend_Controller_Action
//$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/js-timezone-detect/jstz-1.0.4.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
@ -55,66 +56,8 @@ class ShowbuilderController extends Zend_Controller_Action
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']);
$refer_sses = new Zend_Session_Namespace('referrer');
if ($request->isPost()) {
$form = new Application_Form_RegisterAirtime();
$values = $request->getPost();
if ($values["Publicise"] != 1 && $form->isValid($values)) {
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
if (isset($values["Privacy"])) {
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
}
session_start(); //open session for writing again
// unset referrer
Zend_Session::namespaceUnset('referrer');
} elseif ($values["Publicise"] == '1' && $form->isValid($values)) {
Application_Model_Preference::SetHeadTitle($values["stnName"], $this->view);
Application_Model_Preference::SetPhone($values["Phone"]);
Application_Model_Preference::SetEmail($values["Email"]);
Application_Model_Preference::SetStationWebSite($values["StationWebSite"]);
Application_Model_Preference::SetPublicise($values["Publicise"]);
$form->Logo->receive();
$imagePath = $form->Logo->getFileName();
Application_Model_Preference::SetStationCountry($values["Country"]);
Application_Model_Preference::SetStationCity($values["City"]);
Application_Model_Preference::SetStationDescription($values["Description"]);
Application_Model_Preference::SetStationLogo($imagePath);
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
if (isset($values["Privacy"])) {
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
}
session_start(); //open session for writing again
// unset referrer
Zend_Session::namespaceUnset('referrer');
} else {
$logo = Application_Model_Preference::GetStationLogo();
if ($logo) {
$this->view->logoImg = $logo;
}
$this->view->dialog = $form;
$this->view->headScript()->appendFile($baseUrl.'js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
}
}
//popup if previous page was login
if ($refer_sses->referrer == 'login' && Application_Model_Preference::ShouldShowPopUp()
&& !Application_Model_Preference::GetSupportFeedback() && $user->isAdmin()){
$form = new Application_Form_RegisterAirtime();
$logo = Application_Model_Preference::GetStationLogo();
if ($logo) {
$this->view->logoImg = $logo;
}
$this->view->dialog = $form;
$this->view->headScript()->appendFile($baseUrl.'js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
}
//Show the timezone and language setup popup, if needed.
$this->checkAndShowSetupPopup($request);
//determine whether to remove/hide/display the library.
$showLib = false;
@ -186,6 +129,26 @@ class ShowbuilderController extends Zend_Controller_Action
$this->view->headLink()->appendStylesheet($baseUrl.'css/showbuilder.css?'.$CC_CONFIG['airtime_version']);
}
/** Check if we need to show the timezone/language setup popup and display it. (eg. on first run) */
public function checkAndShowSetupPopup($request)
{
$CC_CONFIG = Config::getConfig();
$baseUrl = Application_Common_OsPath::getBaseDir();
$setupComplete = Application_Model_Preference::getLangTimezoneSetupComplete();
$previousPage = $request->getHeader('Referer');
$userService = new Application_Service_UserService();
$currentUser = $userService->getCurrentUser();
$previousPageWasLoginScreen = strpos(strtolower($previousPage), 'login') !== false;
// If current user is Super Admin, and they came from the login page,
// and they have not seen the setup popup before
if ($currentUser->isSuperAdmin() && $previousPageWasLoginScreen && empty($setupComplete)) {
$lang_tz_popup_form = new Application_Form_SetupLanguageTimezone();
$this->view->lang_tz_popup_form = $lang_tz_popup_form;
$this->view->headScript()->appendFile($baseUrl.'js/airtime/nowplaying/lang-timezone-setup.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
}
}
public function contextMenuAction()
{
$baseUrl = Application_Common_OsPath::getBaseDir();

View File

@ -1,106 +0,0 @@
<?php
require_once 'customvalidators/ConditionalNotEmpty.php';
class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
{
public function init()
{
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/preferences_email_server.phtml'))
));
// Enable system emails
$this->addElement('checkbox', 'enableSystemEmail', array(
'label' => _('Enable System Emails (Password Reset)'),
'required' => false,
'value' => Application_Model_Preference::GetEnableSystemEmail(),
'decorators' => array(
'ViewHelper'
)
));
$this->addElement('text', 'systemEmail', array(
'class' => 'input_text',
'label' => _("Reset Password 'From' Email"),
'value' => Application_Model_Preference::GetSystemEmail(),
'readonly' => true,
'decorators' => array('viewHelper')
));
$this->addElement('checkbox', 'configureMailServer', array(
'label' => _('Configure Mail Server'),
'required' => false,
'value' => Application_Model_Preference::GetMailServerConfigured(),
'decorators' => array (
'viewHelper'
)
));
$this->addElement('checkbox', 'msRequiresAuth', array(
'label' => _('Requires Authentication'),
'required' => false,
'value' => Application_Model_Preference::GetMailServerRequiresAuth(),
'decorators' => array(
'viewHelper'
)
));
$this->addElement('text', 'mailServer', array(
'class' => 'input_text',
'label' => _('Mail Server'),
'value' => Application_Model_Preference::GetMailServer(),
'readonly' => true,
'decorators' => array('viewHelper'),
'allowEmpty' => false,
'validators' => array(
new ConditionalNotEmpty(array(
'configureMailServer' => '1'
))
)
));
$this->addElement('text', 'email', array(
'class' => 'input_text',
'label' => _('Email Address'),
'value' => Application_Model_Preference::GetMailServerEmailAddress(),
'readonly' => true,
'decorators' => array('viewHelper'),
'allowEmpty' => false,
'validators' => array(
new ConditionalNotEmpty(array(
'configureMailServer' => '1',
'msRequiresAuth' => '1'
))
)
));
$this->addElement('password', 'ms_password', array(
'class' => 'input_text',
'label' => _('Password'),
'value' => Application_Model_Preference::GetMailServerPassword(),
'readonly' => true,
'decorators' => array('viewHelper'),
'allowEmpty' => false,
'validators' => array(
new ConditionalNotEmpty(array(
'configureMailServer' => '1',
'msRequiresAuth' => '1'
))
),
'renderPassword' => true
));
$port = new Zend_Form_Element_Text('port');
$port->class = 'input_text';
$port->setRequired(false)
->setValue(Application_Model_Preference::GetMailServerPort())
->setLabel(_('Port'))
->setAttrib('readonly', true)
->setDecorators(array('viewHelper'));
$this->addElement($port);
}
}

View File

@ -7,7 +7,6 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
{
$CC_CONFIG = Config::getConfig();
$isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1;
$isStreamConfigable = Application_Model_Preference::GetEnableStreamConf() == "true";
$defaultFade = Application_Model_Preference::GetDefaultTransitionFade();
@ -103,7 +102,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
$this->addElement($showSourceMount);
// demo only code
if (!$isStreamConfigable) {
if ($isDemo) {
$elements = $this->getElements();
foreach ($elements as $element) {
if ($element->getType() != 'Zend_Form_Element_Hidden') {

View File

@ -11,7 +11,7 @@ class Application_Form_PasswordRestore extends Zend_Form
));
$this->addElement('text', 'email', array(
'label' => _('E-mail'),
'label' => _('Email'),
'required' => true,
'filters' => array(
'stringTrim',
@ -43,7 +43,7 @@ class Application_Form_PasswordRestore extends Zend_Form
$cancel = new Zend_Form_Element_Button("cancel");
$cancel->class = 'ui-button ui-widget ui-state-default ui-button-text-only center';
$cancel->setLabel(_("Cancel"))
$cancel->setLabel(_("Return to login"))
->setIgnore(True)
->setAttrib('onclick', 'redirectToLogin();')
->setDecorators(array('ViewHelper'));

View File

@ -0,0 +1,28 @@
<?php
class Application_Form_SetupLanguageTimezone extends Zend_Form_SubForm
{
public function init()
{
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/setup-lang-timezone.phtml'))));
$csrf_namespace = new Zend_Session_Namespace('csrf_namespace');
$csrf_element = new Zend_Form_Element_Hidden('csrf');
$csrf_element->setValue($csrf_namespace->authtoken)->setRequired('true')->removeDecorator('HtmlTag')->removeDecorator('Label');
$this->addElement($csrf_element);
$language = new Zend_Form_Element_Select('setup_language');
$language->setLabel(_("Station Language"));
$language->setMultiOptions(Application_Model_Locale::getLocales());
$this->addElement($language);
$timezone = new Zend_Form_Element_Select('setup_timezone');
$timezone->setLabel(_("Station Timezone"));
$timezone->setMultiOptions(Application_Common_Timezone::getTimezones());
$this->addElement($timezone);
}
}

View File

@ -16,6 +16,10 @@ class Application_Form_StreamSetting extends Zend_Form
public function startFrom()
{
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'preference/stream-setting.phtml'))
));
$setting = $this->setting;
$icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata');
@ -55,6 +59,13 @@ class Application_Form_StreamSetting extends Zend_Form
->setAttribs(array('style' => "border: 0; color: #f6931f; font-weight: bold;"))
->setDecorators(array('ViewHelper'));
$this->addElement($replay_gain);
$custom = Application_Model_Preference::getUsingCustomStreamSettings();
$customSettings = new Zend_Form_Element_Radio('customStreamSettings');
$customSettings->setLabel(_('Streaming Server:'));
$customSettings->setMultiOptions(array(_("Airtime Pro Streaming"), _("Custom / 3rd Party Streaming")));
$customSettings->setValue(!empty($custom) ? $custom : 0);
$this->addElement($customSettings);
}
public function isValid($data)

View File

@ -6,6 +6,8 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
private $stream_types;
private $stream_bitrates;
static $customizable;
public function init()
{
@ -39,54 +41,49 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$stream_types = $this->stream_types;
$stream_bitrates = $this->stream_bitrates;
$streamDefaults = Application_Model_StreamSetting::getDefaults($prefix);
// If we're not using custom stream settings, use the defaults
$useDefaults = !Application_Model_Preference::getUsingCustomStreamSettings();
$this->setIsArray(true);
$this->setElementsBelongTo($prefix."_data");
$disable_all = Application_Model_Preference::GetEnableStreamConf() == "false";
$enable = new Zend_Form_Element_Checkbox('enable');
$enable->setLabel(_('Enabled:'))
->setValue($setting[$prefix.'_enable'] == 'true' ? 1 : 0)
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$enable->setAttrib("disabled", "disabled");
}
$this->addElement($enable);
static::$customizable[] = $enable->getName();
$mobile = new Zend_Form_Element_Checkbox('mobile');
$mobile->setLabel(_('Mobile:'));
$mobile->setValue($setting[$prefix.'_mobile']);
$mobile->setDecorators(array('ViewHelper'));
$this->addElement($mobile);
static::$customizable[] = $mobile->getName();
$type = new Zend_Form_Element_Select('type');
$type->setLabel(_("Stream Type:"))
->setMultiOptions($stream_types)
->setValue(isset($setting[$prefix.'_type'])?$setting[$prefix.'_type']:0)
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$type->setAttrib("disabled", "disabled");
}
$this->addElement($type);
static::$customizable[] = $type->getName();
$bitrate = new Zend_Form_Element_Select('bitrate');
$bitrate->setLabel(_("Bit Rate:"))
->setMultiOptions($stream_bitrates)
->setValue(isset($setting[$prefix.'_bitrate'])?$setting[$prefix.'_bitrate']:0)
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$bitrate->setAttrib("disabled", "disabled");
}
$this->addElement($bitrate);
static::$customizable[] = $bitrate->getName();
$output = new Zend_Form_Element_Select('output');
$output->setLabel(_("Service Type:"))
->setMultiOptions(array("icecast"=>"Icecast", "shoutcast"=>"SHOUTcast"))
->setValue(isset($setting[$prefix.'_output'])?$setting[$prefix.'_output']:"icecast")
->setValue($useDefaults ? $streamDefaults['output'] :
(isset($setting[$prefix.'_output'])?$setting[$prefix.'_output']:"icecast"))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$output->setAttrib("disabled", "disabled");
}
$this->addElement($output);
$channels = new Zend_Form_Element_Select('channels');
@ -94,43 +91,35 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
->setMultiOptions(array("mono"=>_("1 - Mono"), "stereo"=>_("2 - Stereo")))
->setValue(isset($setting[$prefix.'_channels']) ? $setting[$prefix.'_channels'] : "stereo")
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$channels->setAttrib("disabled", "disabled");
}
$this->addElement($channels);
static::$customizable[] = $channels->getName();
$host = new Zend_Form_Element_Text('host');
$host->setLabel(_("Server"))
->setValue(isset($setting[$prefix.'_host'])?$setting[$prefix.'_host']:"")
->setValue($useDefaults ? $streamDefaults['host'] :
(isset($setting[$prefix.'_host'])?$setting[$prefix.'_host']:""))
->setValidators(array(
array('regex', false, array('/^[0-9a-zA-Z-_.]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$host->setAttrib("disabled", "disabled");
}
$host->setAttrib('alt', 'domain');
$this->addElement($host);
$port = new Zend_Form_Element_Text('port');
$port->setLabel(_("Port"))
->setValue(isset($setting[$prefix.'_port'])?$setting[$prefix.'_port']:"")
->setValue($useDefaults ? $streamDefaults['port'] :
(isset($setting[$prefix.'_port'])?$setting[$prefix.'_port']:""))
->setValidators(array(new Zend_Validate_Between(array('min'=>0, 'max'=>99999))))
->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>_('Only numbers are allowed.'))))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$port->setAttrib("disabled", "disabled");
}
$this->addElement($port);
$pass = new Zend_Form_Element_Text('pass');
$pass->setLabel(_("Password"))
->setValue(isset($setting[$prefix.'_pass'])?$setting[$prefix.'_pass']:"")
->setValue($useDefaults ? $streamDefaults['pass'] :
(isset($setting[$prefix.'_pass'])?$setting[$prefix.'_pass']:""))
->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$pass->setAttrib("disabled", "disabled");
}
$pass->setAttrib('alt', 'regular_text');
$this->addElement($pass);
@ -138,9 +127,6 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$genre->setLabel(_("Genre"))
->setValue(isset($setting[$prefix.'_genre'])?$setting[$prefix.'_genre']:"")
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$genre->setAttrib("disabled", "disabled");
}
$this->addElement($genre);
$url = new Zend_Form_Element_Text('url');
@ -149,9 +135,6 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
->setValidators(array(
array('regex', false, array('/^[0-9a-zA-Z\-_.:\/]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$url->setAttrib("disabled", "disabled");
}
$url->setAttrib('alt', 'url');
$this->addElement($url);
@ -159,41 +142,31 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$name->setLabel(_("Name"))
->setValue(isset($setting[$prefix.'_name'])?$setting[$prefix.'_name']:"")
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$name->setAttrib("disabled", "disabled");
}
$this->addElement($name);
$description = new Zend_Form_Element_Text('description');
$description->setLabel(_("Description"))
->setValue(isset($setting[$prefix.'_description'])?$setting[$prefix.'_description']:"")
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$description->setAttrib("disabled", "disabled");
}
$this->addElement($description);
$mount = new Zend_Form_Element_Text('mount');
$mount->setLabel(_("Mount Point"))
->setValue(isset($setting[$prefix.'_mount'])?$setting[$prefix.'_mount']:"")
->setValue($useDefaults ? $streamDefaults['mount'] :
(isset($setting[$prefix.'_mount'])?$setting[$prefix.'_mount']:""))
->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$mount->setAttrib("disabled", "disabled");
}
$mount->setAttrib('alt', 'regular_text');
$this->addElement($mount);
$user = new Zend_Form_Element_Text('user');
$user->setLabel(_("Username"))
->setValue(isset($setting[$prefix.'_user'])?$setting[$prefix.'_user']:"")
->setValue($useDefaults ? $streamDefaults['user'] :
(isset($setting[$prefix.'_user'])?$setting[$prefix.'_user']:""))
->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$user->setAttrib("disabled", "disabled");
}
$user->setAttrib('alt', 'regular_text');
$this->addElement($user);
@ -203,9 +176,6 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$adminUser->setAttrib("disabled", "disabled");
}
$adminUser->setAttrib('alt', 'regular_text');
$this->addElement($adminUser);
@ -215,16 +185,16 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$adminPass->setAttrib("disabled", "disabled");
}
$adminPass->setAttrib('alt', 'regular_text');
$this->addElement($adminPass);
$liquidsopa_error_msg = '<div class="stream-status status-info"><h3>'._('Getting information from the server...').'</h3></div>';
$liquidsoap_error_msg = '<div class="stream-status status-info"><h3>'._('Getting information from the server...').'</h3></div>';
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/stream-setting-form.phtml', "stream_number"=>$stream_number, "enabled"=>$enable->getValue(), "liquidsoap_error_msg"=>$liquidsopa_error_msg))
array('ViewScript', array('viewScript' => 'form/stream-setting-form.phtml',
"stream_number"=>$stream_number,
"enabled"=>$enable->getValue(),
"liquidsoap_error_msg"=>$liquidsoap_error_msg))
));
}
@ -232,26 +202,42 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
{
$f_data = $data['s'.$this->prefix."_data"];
$isValid = parent::isValid($f_data);
if ($f_data['enable'] == 1) {
if ($f_data['host'] == '') {
$element = $this->getElement("host");
$element->addError(_("Server cannot be empty."));
$isValid = false;
}
if ($f_data['port'] == '') {
$element = $this->getElement("port");
$element->addError(_("Port cannot be empty."));
$isValid = false;
}
if ($f_data['output'] == 'icecast') {
if ($f_data['mount'] == '') {
$element = $this->getElement("mount");
$element->addError(_("Mount cannot be empty with Icecast server."));
// XXX: A couple of ugly workarounds here, but I guess that's what you get when you
// combine an already-complex POST and GET into a single action...
if (Application_Model_Preference::getUsingCustomStreamSettings() && $f_data) {
if ($f_data['enable'] == 1 && isset($f_data["host"])) {
if ($f_data['host'] == '') {
$element = $this->getElement("host");
$element->addError(_("Server cannot be empty."));
$isValid = false;
}
if ($f_data['port'] == '') {
$element = $this->getElement("port");
$element->addError(_("Port cannot be empty."));
$isValid = false;
}
if ($f_data['output'] == 'icecast') {
if ($f_data['mount'] == '') {
$element = $this->getElement("mount");
$element->addError(_("Mount cannot be empty with Icecast server."));
$isValid = false;
}
}
}
}
return $isValid;
}
public function toggleState() {
$elements = $this->getElements();
foreach ($elements as $element) {
if (Application_Model_Preference::getUsingCustomStreamSettings()) {
$element->setAttrib('disabled', null);
} else if (!(in_array($element->getName(), static::$customizable)
|| $element->getType() == 'Zend_Form_Element_Hidden')) {
$element->setAttrib('disabled', 'disabled');
}
}
}
}

View File

@ -34,9 +34,7 @@ class Application_Model_Auth
$message .= "{$e_link_protocol}://{$e_link_base}:{$e_link_port}{$e_link_path}";
$str = sprintf(_('%s Password Reset'), PRODUCT_NAME);
$success = Application_Model_Email::send($str, $message, $user->getDbEmail());
return $success;
return Application_Model_Email::send($str, $message, $user->getDbEmail());
}
public function invalidateTokens($user, $action)

View File

@ -2,18 +2,20 @@
class Application_Model_Email
{
/**
* Send email
*
* @param string $subject
* @param string $message
* @param mixed $tos
* @return void
* @param mixed $to
* @return boolean
*/
public static function send($subject, $message, $tos, $from = null)
{
public static function send($subject, $message, $to) {
return mail($tos, $subject, $message);
$headers = 'From: Airtime <noreply@account.sourcefabric.com>';
return mail($to, $subject, $message, $headers);
}
}

View File

@ -1161,87 +1161,6 @@ class Application_Model_Preference
{
return self::getValue("auto_switch");
}
public static function SetEnableSystemEmail($upload)
{
self::setValue("enable_system_email", $upload);
}
public static function GetEnableSystemEmail()
{
$v = self::getValue("enable_system_email");
return ($v === "") ? 0 : $v;
}
public static function SetSystemEmail($value)
{
self::setValue("system_email", $value, false);
}
public static function GetSystemEmail()
{
return self::getValue("system_email");
}
public static function SetMailServerConfigured($value)
{
self::setValue("mail_server_configured", $value, false);
}
public static function GetMailServerConfigured()
{
return self::getValue("mail_server_configured");
}
public static function SetMailServer($value)
{
self::setValue("mail_server", $value, false);
}
public static function GetMailServer()
{
return self::getValue("mail_server");
}
public static function SetMailServerEmailAddress($value)
{
self::setValue("mail_server_email_address", $value, false);
}
public static function GetMailServerEmailAddress()
{
return self::getValue("mail_server_email_address");
}
public static function SetMailServerPassword($value)
{
self::setValue("mail_server_password", $value, false);
}
public static function GetMailServerPassword()
{
return self::getValue("mail_server_password");
}
public static function SetMailServerPort($value)
{
self::setValue("mail_server_port", $value, false);
}
public static function GetMailServerPort()
{
return self::getValue("mail_server_port");
}
public static function SetMailServerRequiresAuth($value)
{
self::setValue("mail_server_requires_auth", $value, false);
}
public static function GetMailServerRequiresAuth()
{
return self::getValue("mail_server_requires_auth");
}
/* User specific preferences end */
public static function ShouldShowPopUp()
@ -1512,6 +1431,28 @@ class Application_Model_Preference
self::setValue("task_manager_lock", $value);
}
// SAAS-876 - Toggle indicating whether user is using custom stream settings
public static function getUsingCustomStreamSettings() {
return self::getValue("using_custom_stream_settings");
}
public static function setUsingCustomStreamSettings($value) {
self::setValue("using_custom_stream_settings", $value);
}
// SAAS-876 - Store the default Icecast password to restore when switching
// back to Airtime Pro streaming settings
public static function getDefaultIcecastPassword() {
$val = self::getValue("default_icecast_password");
return empty($val) ? DEFAULT_ICECAST_PASS : $val;
}
public static function setDefaultIcecastPassword($value) {
self::setValue("default_icecast_password", $value);
}
public static function getRadioPageDisplayLoginButton()
{
return self::getValue("radio_page_display_login_button");
@ -1521,4 +1462,14 @@ class Application_Model_Preference
{
self::setValue("radio_page_display_login_button", $value);
}
public static function getLangTimezoneSetupComplete()
{
return self::getValue("lang_tz_setup_complete");
}
public static function setLangTimezoneSetupComplete($value)
{
self::setValue("lang_tz_setup_complete", $value);
}
}

View File

@ -215,6 +215,7 @@ SQL;
$currentMedia["ends"] = $currentMedia["show_ends"];
}
$currentMediaName = "";
$currentMediaFileId = $currentMedia["file_id"];
$currentMediaStreamId = $currentMedia["stream_id"];
if (isset($currentMediaFileId)) {
@ -256,6 +257,7 @@ SQL;
->orderByDbStarts(Criteria::DESC)
->findOne();
if (isset($previousMedia)) {
$previousMediaName = "";
$previousMediaFileId = $previousMedia->getDbFileId();
$previousMediaStreamId = $previousMedia->getDbStreamId();
if (isset($previousMediaFileId)) {

View File

@ -246,6 +246,10 @@ class Application_Model_StreamSetting
} elseif (is_array($d)) {
$temp = explode('_', $key);
$prefix = $temp[0];
// SAAS-876 - If we're using Airtime Pro streaming, set the stream to use the default settings
if (!Application_Model_Preference::getUsingCustomStreamSettings()) {
$d = array_merge($d, static::getDefaults($prefix));
}
foreach ($d as $k => $v) {
$keyname = $prefix . "_" . $k;
if ($k == 'enable') {
@ -265,8 +269,28 @@ class Application_Model_StreamSetting
}
}
/**
* SAAS-876 - Get the default stream settings values for Airtime Pro streaming
*
* @param int $prefix
*
* @return array array of default stream setting values
*/
public static function getDefaults($prefix) {
$config = Config::getConfig();
return array(
'host' => $config['stationId'] . ".out.airtime.pro",
'port' => DEFAULT_ICECAST_PORT,
'output' => 'icecast',
'user' => $config['stationId'],
'pass' => Application_Model_Preference::getDefaultIcecastPassword(),
// Kind of ugly... convert prefix int to ascii char
'mount' => $config['stationId'] . '_' . chr($prefix[1] + 96),
);
}
/*
* Sets indivisual stream setting.
* Sets individual stream setting.
*
* $data - data array. $data is [].
* TODO: Make this SQL a prepared statement!

View File

@ -18,6 +18,11 @@ class CcSubjs extends BaseCcSubjs {
return $this->type === UTYPE_SUPERADMIN || $this->type === UTYPE_ADMIN || $this->type === UTYPE_PROGRAM_MANAGER;
}
public function isSuperAdmin()
{
return $this->type === UTYPE_SUPERADMIN;
}
public function isHostOfShow($showId)
{
return CcShowHostsQuery::create()

View File

@ -30,17 +30,15 @@
<?php echo $this->element->getElement('csrf') ?>
<?php if (Application_Model_Preference::GetEnableSystemEmail()): ?>
<dt id="reset-label" class="hidden">&nbsp;</dt>
<dd id="reset-element" class="text-right">
<a href="<?php echo $this->baseUrl('login/password-restore'); ?>" class="link reset"><?php echo _("Reset password") ?></a>
</dd>
<?php endif; ?>
<?php echo $this->element->getElement('captcha') ?>
<dt id="submit-label">&nbsp;</dt>
<dd id="submit-element">
<?php echo $this->element->getElement('submit') ?>
</dd>
<dt id="reset-label" class="hidden">&nbsp;</dt>
<dd id="reset-element" class="text-right">
<a href="<?php echo $this->baseUrl('login/password-restore'); ?>" class="link reset"><?php echo _("Forgot your password?") ?></a>
</dd>
</dl>
</form>

View File

@ -1,36 +1,36 @@
<form enctype="application/x-www-form-urlencoded" method="post" action="">
<dl class="zend_form">
<dt id="username-label">
<label for="username" class="required">
<?php echo $this->element->getElement('username')->getLabel() ?>
</label>
</dt>
<dd id="username-element">
<?php echo $this->element->getElement('username') ?>
</dd>
<dt id="email-label">
<label for="email" class="required">
<?php echo $this->element->getElement('email')->getLabel() ?>
</label>
</dt>
<dd id="email-element">
<?php echo $this->element->getElement('email') ?>
</dd>
<?php if($this->element->getElement('email')->hasErrors()): ?>
<ul class='errors'>
<?php foreach($this->element->getElement('email')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<dt id="submit-label">&nbsp;</dt>
<dd id="submit-element">
<?php echo $this->element->getElement('submit') ?>
</dd>
<dd id="cancel-element">
<?php echo $this->element->getElement('cancel') ?>
</dd>
<dl class="zend_form">
<dt id="username-label">
<dt id="email-label">
<label for="email" class="required">
<?php echo $this->element->getElement('email')->getLabel() ?>
</label>
</dt>
<dd id="email-element">
<?php echo $this->element->getElement('email') ?>
</dd>
<?php if ($this->element->getElement('email')->hasErrors()): ?>
<ul class='errors'>
<?php foreach ($this->element->getElement('email')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<label for="username" class="required">
<?php echo $this->element->getElement('username')->getLabel() ?>
</label>
</dt>
<dd id="username-element">
<?php echo $this->element->getElement('username') ?>
</dd>
<dt id="submit-label">&nbsp;</dt>
<dd id="submit-element">
<?php echo $this->element->getElement('submit') ?>
</dd>
<dd id="cancel-element">
<?php echo $this->element->getElement('cancel') ?>
</dd>
</dl>
</form>

View File

@ -0,0 +1,15 @@
<div id="lang-timezone-popup" class="dialogPopup register-dialog" title="<?php echo sprintf(_("Welcome to %s!"), SAAS_PRODUCT_BRANDING_NAME); ?>" style="display: none;">
<form id="lang-timezone-form" method="post" action="/setup/setup-language-timezone">
<fieldset>
<dl class="zend_form">
<?php echo $this->element->getElement('csrf') ?>
<?php echo $this->element->getElement('setup_language')->render(); ?>
<?php echo $this->element->getElement('setup_timezone')->render(); ?>
</dl>
</fieldset>
<p style="margin-bottom: 0px; text-align: center;">You can change these later in your preferences and user settings.</p>
</form>
</div>

View File

@ -1,7 +1,7 @@
<?php
$s_name = "s".$this->stream_number;
?>
<h3 class="collapsible-header <?php echo $this->stream_number == '1'?"closed":""?>"><span class="arrow-icon"></span><?php echo _("Stream "); ?><?php echo $this->stream_number?></h3>
<h3 class="collapsible-header <?php echo $this->enabled == 0?"closed":""?>"><span class="arrow-icon"></span><?php echo _("Stream "); ?><?php echo $this->stream_number?></h3>
<div class="stream-setting-content" <?php echo $this->enabled == 0?'style="display: none;':''?> id="<?php echo $s_name?>-config">
<fieldset class="padded">
<dl class="zend_form clearfix">

View File

@ -1,10 +1,11 @@
<div class="login_box">
<div class="logobox">&nbsp;</div>
<h2><?php echo _("Reset password") ?></h2>
<div id="login" class="login-content clearfix">
<p class="light">
<?php echo _("Please enter your account e-mail address. You will receive a link to create a new password via e-mail.")?>
<?php echo _("Enter your account e-mail address or your username (or both, if you have multiple accounts
using the same email address), and we'll send you a link to reset your password.")?>
</p>
<?php echo $this->form; ?>
</div>

View File

@ -1,12 +1,10 @@
<div class="ui-widget ui-widget-content block-shadow simple-formblock clearfix padded-strong stream-config">
<h2 <?php if($this->enable_stream_conf == "true"){?>style="float:left"<?php }?>><?php echo _("Stream Settings") ?></h2>
<h2 style="float:left"><?php echo _("Stream Settings") ?></h2>
<?php $baseUrl = Application_Common_OsPath::getBaseDir(); ?>
<?php if($this->enable_stream_conf == "true"){?>
<form method="post" id="stream_form" enctype="application/x-www-form-urlencoded">
<button name="stream_save" id="stream_save" type="button" class="btn btn-small right-floated"><?php echo _("Save") ?></button>
<button name="stream_save" id="stream_save_top" type="button" class="btn btn-small right-floated"><?php echo _("Save") ?></button>
<?php echo $this->form->getElement('csrf') ?>
<div style="clear:both"></div>
<?php }?>
<?php echo $this->statusMsg;?>
<div style="float: left; margin-right: 10px; width: 490px; overflow: auto;">
<fieldset class="padded stream-setting-global">
@ -39,6 +37,7 @@
<dd id="vorbisMetadata-element">
<?php echo $this->form->getElement('icecast_vorbis_metadata') ?>
</dd>
<dt id="streamFormat-label">
<label class="optional"><?php echo $this->form->getElement('streamFormat')->getLabel() ?></label>
</dt>
@ -105,16 +104,16 @@
<div style="float: left; width: 600px;">
<fieldset class="padded">
<legend><?php echo _("Output Stream Settings") ?></legend>
<?php
for($i=1;$i<=$this->num_stream;$i++){
echo $this->form->getSubform("s".$i."_subform");
}
?>
<?php
// TODO: replace this with something that looks good
echo $this->form->getElement('customStreamSettings')->render();
for($i=1;$i<=$this->num_stream;$i++){
echo $this->form->getSubform("s".$i."_subform");
}
?>
</fieldset>
<?php if($this->enable_stream_conf == "true"){?>
<br />
<button name="stream_save" id="stream_save" type="button" class="btn btn-small right-floated"><?php echo _("Save") ?></button>
<?php }?>
<button name="stream_save" id="stream_save_bottom" type="button" class="btn btn-small right-floated"><?php echo _("Save") ?></button>
</div>
</form>
</div>

View File

@ -20,5 +20,4 @@
<table id="show_builder_table" cellpadding="0" cellspacing="0" class="datatable"></table>
</div>
<?php echo $this->dialog ?>
<?php echo $this->lang_tz_popup_form; ?>

View File

@ -1912,6 +1912,7 @@ span.errors.sp-errors{
margin:8px 0 0 0;
cursor:pointer;
position:relative;
clear: both;
}
.collapsible-content {
margin-top:-1px;
@ -2258,6 +2259,10 @@ span.errors.sp-errors{
width: 1100px;
}
#stream_save_bottom {
bottom: 0;
}
.preferences .padded {
margin-top: 5px; /* Firefox needs this */
}

View File

@ -0,0 +1,46 @@
$(document).ready(function() {
var dialog = $("#lang-timezone-popup");
dialog.dialog({
autoOpen: false,
width: 500,
resizable: false,
modal: true,
position:['center','center'],
buttons: [
{
id: "setup-later",
text: $.i18n._("Not Now"),
"class": "btn",
click: function() {
$(this).dialog("close");
}
},
{
id: "help_airtime",
text: $.i18n._("OK"),
"class": "btn",
click: function() {
$("#lang-timezone-form").submit();
}
}
]
});
var language = window.navigator.userLanguage || window.navigator.language;
if (language === undefined) {
language = "en_CA";
}
language = language.replace("-", "_");
$("#setup_language").val(language);
var timezone = jstz.determine();
var timezone_name = timezone.name();
if (timezone_name === undefined) {
timezone_name = "America/Toronto";
}
$("#setup_timezone").val(timezone_name);
dialog.dialog('open');
});

View File

@ -28,7 +28,7 @@ function rebuildStreamURL(ele){
}else{
streamurl = "http://"+host+":"+port+"/"
}
div.find("#stream_url").text(streamurl)
div.find("#stream_url").html('<a href="' + streamurl + '" target="_blank">' + streamurl + '</a>')
}
function restrictOggBitrate(ele, on){
var div = ele.closest("div")
@ -468,19 +468,30 @@ $(document).ready(function() {
setupEventListeners();
setSliderForReplayGain();
getAdminPasswordStatus();
$('#stream_save').live('click', function(){
var confirm_pypo_restart_text = sprintf($.i18n._("If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings). If %s is recording, and if the change causes a playout engine restart, the recording will be interrupted."), PRODUCT_NAME);
var s = $("[name^='customStreamSettings']:checked");
$("[id^='stream_save'], [name^='customStreamSettings']").live('click', function() {
var e = $(this);
if (e[0] == s[0]) { return; }
var confirm_pypo_restart_text = $.i18n._("WARNING: This will restart your stream and may cause a short dropout for your listeners!");
if (confirm(confirm_pypo_restart_text)) {
var data = $('#stream_form').serialize();
var url = baseUrl+'Preference/stream-setting';
$.post(url, {format:"json", data: data}, function(json){
$('#content').empty().append(json.html);
setupEventListeners();
setSliderForReplayGain();
setPseudoAdminPassword(json.s1_set_admin_pass, json.s2_set_admin_pass, json.s3_set_admin_pass, json.s4_set_admin_pass);
window.location.reload();
//$('#content').empty().append(json.html);
//setupEventListeners();
//setSliderForReplayGain();
//setPseudoAdminPassword(json.s1_set_admin_pass, json.s2_set_admin_pass, json.s3_set_admin_pass, json.s4_set_admin_pass);
});
} else {
if (e.prop('checked')) {
if (e[0] != s[0]) {
e.prop('checked', false);
s.prop('checked', true);
}
}
}
});
});

File diff suppressed because one or more lines are too long