Merge branch 'saas-dev' into saas

Conflicts:
	airtime_mvc/application/common/FileDataHelper.php
This commit is contained in:
Albert Santoni 2015-08-10 09:00:54 -04:00
commit 75914b791c
40 changed files with 615 additions and 603 deletions

View file

@ -4,22 +4,23 @@ class FileDataHelper {
public static function getAudioMimeTypeArray() { public static function getAudioMimeTypeArray() {
return array( return array(
"audio/ogg" => "ogg", "audio/ogg" => "ogg",
"application/ogg" => "ogg", "application/ogg" => "ogg",
"audio/vorbis" => "ogg", "audio/vorbis" => "ogg",
"audio/mp3" => "mp3", "audio/mp3" => "mp3",
"audio/mpeg" => "mp3", "audio/mpeg" => "mp3",
"audio/mpeg3" => "mp3", "audio/mpeg3" => "mp3",
"audio/aac" => "aac", "audio/x-aac" => "aac",
"audio/aacp" => "aac", "audio/aac" => "aac",
"audio/mp4" => "m4a", "audio/aacp" => "aac",
"audio/x-flac" => "flac", "audio/mp4" => "m4a",
"audio/wav" => "wav", "audio/x-flac" => "flac",
"audio/x-wav" => "wav", "audio/wav" => "wav",
"audio/mp2" => "mp2", "audio/x-wav" => "wav",
"audio/mp1" => "mp1", "audio/mp2" => "mp2",
"audio/x-ms-wma" => "wma", "audio/mp1" => "mp1",
"audio/basic" => "au", "audio/x-ms-wma" => "wma",
"audio/basic" => "au",
); );
} }

View file

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

View file

@ -40,7 +40,8 @@ $ccAcl->add(new Zend_Acl_Resource('library'))
->add(new Zend_Acl_Resource('provisioning')) ->add(new Zend_Acl_Resource('provisioning'))
->add(new Zend_Acl_Resource('player')) ->add(new Zend_Acl_Resource('player'))
->add(new Zend_Acl_Resource('soundcloud')) ->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 */ /** Creating permissions */
$ccAcl->allow('G', 'index') $ccAcl->allow('G', 'index')
@ -60,6 +61,7 @@ $ccAcl->allow('G', 'index')
->allow('G', 'downgrade') ->allow('G', 'downgrade')
->allow('G', 'rest:show-image', 'get') ->allow('G', 'rest:show-image', 'get')
->allow('G', 'rest:media', 'get') ->allow('G', 'rest:media', 'get')
->allow('G', 'setup')
->allow('H', 'soundcloud') ->allow('H', 'soundcloud')
->allow('H', 'rest:show-image') ->allow('H', 'rest:show-image')
->allow('H', 'rest:media') ->allow('H', 'rest:media')

View file

@ -9,6 +9,7 @@ define('COMPANY_NAME' , 'Sourcefabric');
define('COMPANY_SUFFIX' , 'z.ú.'); define('COMPANY_SUFFIX' , 'z.ú.');
define('COMPANY_SITE' , 'Sourcefabric.org'); define('COMPANY_SITE' , 'Sourcefabric.org');
define('COMPANY_SITE_URL' , 'http://sourcefabric.org/'); define('COMPANY_SITE_URL' , 'http://sourcefabric.org/');
define('SUPPORT_EMAIL_ADDRESS', "help@sourcefabric.org");
define('HELP_URL' , 'http://help.sourcefabric.org/'); define('HELP_URL' , 'http://help.sourcefabric.org/');
define('FAQ_URL' , 'https://sourcefabricberlin.zendesk.com/hc/en-us/sections/200994309-Airtime-FAQ'); define('FAQ_URL' , 'https://sourcefabricberlin.zendesk.com/hc/en-us/sections/200994309-Airtime-FAQ');
@ -17,6 +18,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('PRIVACY_POLICY_URL' , 'http://www.sourcefabric.org/en/about/policy/');
define('USER_MANUAL_URL' , 'http://sourcefabric.booktype.pro/airtime-pro-for-broadcasters'); define('USER_MANUAL_URL' , 'http://sourcefabric.booktype.pro/airtime-pro-for-broadcasters');
define('AIRTIME_TRANSIFEX_URL' , 'https://www.transifex.com/projects/p/airtime/'); 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_VERSION' , 'GNU AGPL v.3');
define('LICENSE_URL' , 'http://www.gnu.org/licenses/agpl-3.0-standalone.html'); define('LICENSE_URL' , 'http://www.gnu.org/licenses/agpl-3.0-standalone.html');
@ -32,6 +34,8 @@ define('DEFAULT_LOGO_PLACEHOLDER', 1);
define('DEFAULT_LOGO_FILE', 'images/airtime_logo.png'); define('DEFAULT_LOGO_FILE', 'images/airtime_logo.png');
define('DEFAULT_TIMESTAMP_FORMAT', 'Y-m-d H:i:s'); define('DEFAULT_TIMESTAMP_FORMAT', 'Y-m-d H:i:s');
define('DEFAULT_MICROTIME_FORMAT', 'Y-m-d H:i:s.u'); 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 // Metadata Keys for files
define('MDATA_KEY_FILEPATH' , 'filepath'); 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."), "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 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 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." "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!"),
=> _("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."),
"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."), "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 //preferences/support-setting.js
"Image must be one of jpg, jpeg, png, or gif" => _("Image must be one of jpg, jpeg, png, or gif"), "Image must be one of jpg, jpeg, png, or gif" => _("Image must be one of jpg, jpeg, png, or gif"),

View file

@ -38,11 +38,9 @@ class LoginController extends Zend_Controller_Action
$baseUrl = Application_Common_OsPath::getBaseDir(); $baseUrl = Application_Common_OsPath::getBaseDir();
$this->view->headScript()->appendFile($baseUrl.'js/airtime/login/login.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$form = new Application_Form_Login(); $form = new Application_Form_Login();
$message = _("Please enter your user name and password"); $message = _("Please enter your username and password.");
if ($request->isPost()) { if ($request->isPost()) {
// if the post contains recaptcha field, which means form had recaptcha field. // if the post contains recaptcha field, which means form had recaptcha field.
@ -132,34 +130,32 @@ class LoginController extends Zend_Controller_Action
$CC_CONFIG = Config::getConfig(); $CC_CONFIG = Config::getConfig();
$baseUrl = Application_Common_OsPath::getBaseDir(); $baseUrl = Application_Common_OsPath::getBaseDir();
$this->view->headScript()->appendFile($baseUrl.'js/airtime/login/password-restore.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl . 'js/airtime/login/password-restore.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
$request = $this->getRequest(); $request = $this->getRequest();
$stationLocale = Application_Model_Preference::GetDefaultLocale(); $stationLocale = Application_Model_Preference::GetDefaultLocale();
Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', $stationLocale)); Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', $stationLocale));
if (!Application_Model_Preference::GetEnableSystemEmail()) { //uses separate layout without a navigation.
$this->_redirect('login'); $this->_helper->layout->setLayout('login');
} else {
//uses separate layout without a navigation.
$this->_helper->layout->setLayout('login');
$form = new Application_Form_PasswordRestore(); $form = new Application_Form_PasswordRestore();
$request = $this->getRequest(); $request = $this->getRequest();
if ($request->isPost() && $form->isValid($request->getPost())) { if ($request->isPost()) {
if (is_null($form->username->getValue()) || $form->username->getValue() == '') { if ($form->isValid($request->getPost())) {
$user = CcSubjsQuery::create() $query = CcSubjsQuery::create();
->filterByDbEmail($form->email->getValue()) if (empty($form->username->getValue())) {
->findOne(); $query->filterByDbEmail($form->email->getValue());
} else if (empty($form->email->getValue())) {
$query->filterByDbLogin($form->username->getValue());
} else { } else {
$user = CcSubjsQuery::create() $query->filterByDbEmail($form->email->getValue())
->filterByDbEmail($form->email->getValue()) ->filterByDbLogin($form->username->getValue());
->filterByDbLogin($form->username->getValue())
->findOne();
} }
$user = $query->findOne();
if (!empty($user)) { if (!empty($user)) {
$auth = new Application_Model_Auth(); $auth = new Application_Model_Auth();
@ -171,12 +167,14 @@ 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."))); $form->email->addError($this->view->translate(_("Email could not be sent. Check your mail server settings and ensure it has been configured properly.")));
} }
} else { } else {
$form->email->addError($this->view->translate(_("Given email not found."))); $form->email->addError($this->view->translate(sprintf(_pro("That username or email address could not be found. If you are the station owner, you should <a href=\"%s\">reset your here</a>."), WHMCS_PASSWORD_RESET_URL)));
} }
} else { //Form is not valid
$form->email->addError($this->view->translate(_("There was a problem with the username or email address you entered.")));
} }
$this->view->form = $form;
} }
$this->view->form = $form;
} }
public function passwordRestoreAfterAction() public function passwordRestoreAfterAction()

View file

@ -149,9 +149,6 @@ class PreferenceController extends Zend_Controller_Action
session_start(); //Open session for writing. session_start(); //Open session for writing.
// get current settings
$setting = Application_Model_StreamSetting::getStreamSetting();
$name_map = array( $name_map = array(
'ogg' => 'Ogg Vorbis', 'ogg' => 'Ogg Vorbis',
'fdkaac' => 'AAC+', 'fdkaac' => 'AAC+',
@ -160,55 +157,14 @@ class PreferenceController extends Zend_Controller_Action
'mp3' => 'MP3', '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()); $num_of_stream = intval(Application_Model_Preference::GetNumOfStreams());
$form = new Application_Form_StreamSetting(); $form = new Application_Form_StreamSetting();
// $form->addElement('hash', 'csrf', array(
// 'salt' => 'unique'
// ));
$csrf_namespace = new Zend_Session_Namespace('csrf_namespace'); $csrf_namespace = new Zend_Session_Namespace('csrf_namespace');
$csrf_element = new Zend_Form_Element_Hidden('csrf'); $csrf_element = new Zend_Form_Element_Hidden('csrf');
$csrf_element->setValue($csrf_namespace->authtoken)->setRequired('true')->removeDecorator('HtmlTag')->removeDecorator('Label'); $csrf_element->setValue($csrf_namespace->authtoken)->setRequired('true')->removeDecorator('HtmlTag')->removeDecorator('Label');
$form->addElement($csrf_element); $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()) { if ($request->isPost()) {
$params = $request->getPost(); $params = $request->getPost();
/* Parse through post data and put in format /* Parse through post data and put in format
@ -246,7 +202,6 @@ class PreferenceController extends Zend_Controller_Action
$values["s3_data"] = $s3_data; $values["s3_data"] = $s3_data;
$values["s4_data"] = $s4_data; $values["s4_data"] = $s4_data;
$error = false;
if ($form->isValid($values)) { if ($form->isValid($values)) {
$values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata'); $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"]); $s4_set_admin_pass = !empty($values["s4_data"]["admin_pass"]);
// this goes into cc_pref table // this goes into cc_pref table
Application_Model_Preference::SetStreamLabelFormat($values['streamFormat']); $this->setStreamPreferences($values);
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"]);
// compare new values with current value // compare new values with current value
$changeRGenabled = Application_Model_Preference::GetEnableReplayGain() != $values["enableReplayGain"]; $changeRGenabled = Application_Model_Preference::GetEnableReplayGain() != $values["enableReplayGain"];
$changeRGmodifier = Application_Model_Preference::getReplayGainModifier() != $values["replayGainModifier"]; $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); 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->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(); $live_stream_subform->updateVariables();
$this->view->num_stream = $num_of_stream; $this->view->num_stream = $num_of_stream;
$this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf(); $this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf();
$this->view->form = $form; $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() public function serverBrowseAction()

View file

@ -41,6 +41,9 @@ class ProvisioningController extends Zend_Controller_Action
if (isset($_POST['provisioning_status'])) { if (isset($_POST['provisioning_status'])) {
Application_Model_Preference::setProvisioningStatus($_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) { } catch (Exception $e) {
$this->getResponse() $this->getResponse()
->setHttpResponseCode(400) ->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.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.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/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/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'); $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/ColVis.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColReorder.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'); //Show the timezone and language setup popup, if needed.
$this->checkAndShowSetupPopup($request);
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');
}
//determine whether to remove/hide/display the library. //determine whether to remove/hide/display the library.
$showLib = false; $showLib = false;
@ -186,6 +129,26 @@ class ShowbuilderController extends Zend_Controller_Action
$this->view->headLink()->appendStylesheet($baseUrl.'css/showbuilder.css?'.$CC_CONFIG['airtime_version']); $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() public function contextMenuAction()
{ {
$baseUrl = Application_Common_OsPath::getBaseDir(); $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(); $CC_CONFIG = Config::getConfig();
$isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1; $isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1;
$isStreamConfigable = Application_Model_Preference::GetEnableStreamConf() == "true";
$defaultFade = Application_Model_Preference::GetDefaultTransitionFade(); $defaultFade = Application_Model_Preference::GetDefaultTransitionFade();
@ -103,7 +102,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
$this->addElement($showSourceMount); $this->addElement($showSourceMount);
// demo only code // demo only code
if (!$isStreamConfigable) { if ($isDemo) {
$elements = $this->getElements(); $elements = $this->getElements();
foreach ($elements as $element) { foreach ($elements as $element) {
if ($element->getType() != 'Zend_Form_Element_Hidden') { if ($element->getType() != 'Zend_Form_Element_Hidden') {

View file

@ -40,7 +40,7 @@ class Application_Form_PasswordChange extends Zend_Form
)); ));
$this->addElement('submit', 'submit', array( $this->addElement('submit', 'submit', array(
'label' => _('Get new password'), 'label' => _('Save'),
'ignore' => true, 'ignore' => true,
'class' => 'ui-button ui-widget ui-state-default ui-button-text-only center', 'class' => 'ui-button ui-widget ui-state-default ui-button-text-only center',
'decorators' => array( 'decorators' => array(

View file

@ -11,7 +11,7 @@ class Application_Form_PasswordRestore extends Zend_Form
)); ));
$this->addElement('text', 'email', array( $this->addElement('text', 'email', array(
'label' => _('E-mail'), 'label' => _('Email'),
'required' => true, 'required' => true,
'filters' => array( 'filters' => array(
'stringTrim', 'stringTrim',
@ -33,7 +33,7 @@ class Application_Form_PasswordRestore extends Zend_Form
)); ));
$this->addElement('submit', 'submit', array( $this->addElement('submit', 'submit', array(
'label' => _('Restore password'), 'label' => _('Reset password'),
'ignore' => true, 'ignore' => true,
'class' => 'ui-button ui-widget ui-state-default ui-button-text-only center', 'class' => 'ui-button ui-widget ui-state-default ui-button-text-only center',
'decorators' => array( 'decorators' => array(
@ -41,12 +41,14 @@ class Application_Form_PasswordRestore extends Zend_Form
) )
)); ));
/*
$cancel = new Zend_Form_Element_Button("cancel"); $cancel = new Zend_Form_Element_Button("cancel");
$cancel->class = 'ui-button ui-widget ui-state-default ui-button-text-only center'; $cancel->class = 'ui-button ui-widget ui-state-default ui-button-text-only center';
$cancel->setLabel(_("Cancel")) $cancel->setLabel(_("Back"))
->setIgnore(True) ->setIgnore(True)
->setAttrib('onclick', 'redirectToLogin();') ->setAttrib('onclick', 'window.location = ' . Zend_Controller_Front::getInstance()->getBaseUrl('login'))
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
$this->addElement($cancel); $this->addElement($cancel);
*/
} }
} }

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() public function startFrom()
{ {
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'preference/stream-setting.phtml'))
));
$setting = $this->setting; $setting = $this->setting;
$icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata'); $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;")) ->setAttribs(array('style' => "border: 0; color: #f6931f; font-weight: bold;"))
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
$this->addElement($replay_gain); $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) public function isValid($data)

View file

@ -6,6 +6,8 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
private $stream_types; private $stream_types;
private $stream_bitrates; private $stream_bitrates;
static $customizable;
public function init() public function init()
{ {
@ -39,54 +41,49 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$stream_types = $this->stream_types; $stream_types = $this->stream_types;
$stream_bitrates = $this->stream_bitrates; $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->setIsArray(true);
$this->setElementsBelongTo($prefix."_data"); $this->setElementsBelongTo($prefix."_data");
$disable_all = Application_Model_Preference::GetEnableStreamConf() == "false";
$enable = new Zend_Form_Element_Checkbox('enable'); $enable = new Zend_Form_Element_Checkbox('enable');
$enable->setLabel(_('Enabled:')) $enable->setLabel(_('Enabled:'))
->setValue($setting[$prefix.'_enable'] == 'true' ? 1 : 0) ->setValue($setting[$prefix.'_enable'] == 'true' ? 1 : 0)
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
if ($disable_all) {
$enable->setAttrib("disabled", "disabled");
}
$this->addElement($enable); $this->addElement($enable);
static::$customizable[] = $enable->getName();
$mobile = new Zend_Form_Element_Checkbox('mobile'); $mobile = new Zend_Form_Element_Checkbox('mobile');
$mobile->setLabel(_('Mobile:')); $mobile->setLabel(_('Mobile:'));
$mobile->setValue($setting[$prefix.'_mobile']); $mobile->setValue($setting[$prefix.'_mobile']);
$mobile->setDecorators(array('ViewHelper')); $mobile->setDecorators(array('ViewHelper'));
$this->addElement($mobile); $this->addElement($mobile);
static::$customizable[] = $mobile->getName();
$type = new Zend_Form_Element_Select('type'); $type = new Zend_Form_Element_Select('type');
$type->setLabel(_("Stream Type:")) $type->setLabel(_("Stream Type:"))
->setMultiOptions($stream_types) ->setMultiOptions($stream_types)
->setValue(isset($setting[$prefix.'_type'])?$setting[$prefix.'_type']:0) ->setValue(isset($setting[$prefix.'_type'])?$setting[$prefix.'_type']:0)
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
if ($disable_all) {
$type->setAttrib("disabled", "disabled");
}
$this->addElement($type); $this->addElement($type);
static::$customizable[] = $type->getName();
$bitrate = new Zend_Form_Element_Select('bitrate'); $bitrate = new Zend_Form_Element_Select('bitrate');
$bitrate->setLabel(_("Bit Rate:")) $bitrate->setLabel(_("Bit Rate:"))
->setMultiOptions($stream_bitrates) ->setMultiOptions($stream_bitrates)
->setValue(isset($setting[$prefix.'_bitrate'])?$setting[$prefix.'_bitrate']:0) ->setValue(isset($setting[$prefix.'_bitrate'])?$setting[$prefix.'_bitrate']:0)
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
if ($disable_all) {
$bitrate->setAttrib("disabled", "disabled");
}
$this->addElement($bitrate); $this->addElement($bitrate);
static::$customizable[] = $bitrate->getName();
$output = new Zend_Form_Element_Select('output'); $output = new Zend_Form_Element_Select('output');
$output->setLabel(_("Service Type:")) $output->setLabel(_("Service Type:"))
->setMultiOptions(array("icecast"=>"Icecast", "shoutcast"=>"SHOUTcast")) ->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')); ->setDecorators(array('ViewHelper'));
if ($disable_all) {
$output->setAttrib("disabled", "disabled");
}
$this->addElement($output); $this->addElement($output);
$channels = new Zend_Form_Element_Select('channels'); $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"))) ->setMultiOptions(array("mono"=>_("1 - Mono"), "stereo"=>_("2 - Stereo")))
->setValue(isset($setting[$prefix.'_channels']) ? $setting[$prefix.'_channels'] : "stereo") ->setValue(isset($setting[$prefix.'_channels']) ? $setting[$prefix.'_channels'] : "stereo")
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
if ($disable_all) {
$channels->setAttrib("disabled", "disabled");
}
$this->addElement($channels); $this->addElement($channels);
static::$customizable[] = $channels->getName();
$host = new Zend_Form_Element_Text('host'); $host = new Zend_Form_Element_Text('host');
$host->setLabel(_("Server")) $host->setLabel(_("Server"))
->setValue(isset($setting[$prefix.'_host'])?$setting[$prefix.'_host']:"") ->setValue($useDefaults ? $streamDefaults['host'] :
(isset($setting[$prefix.'_host'])?$setting[$prefix.'_host']:""))
->setValidators(array( ->setValidators(array(
array('regex', false, array('/^[0-9a-zA-Z-_.]+$/', 'messages' => _('Invalid character entered'))))) array('regex', false, array('/^[0-9a-zA-Z-_.]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
if ($disable_all) {
$host->setAttrib("disabled", "disabled");
}
$host->setAttrib('alt', 'domain'); $host->setAttrib('alt', 'domain');
$this->addElement($host); $this->addElement($host);
$port = new Zend_Form_Element_Text('port'); $port = new Zend_Form_Element_Text('port');
$port->setLabel(_("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)))) ->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.')))) ->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>_('Only numbers are allowed.'))))
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
if ($disable_all) {
$port->setAttrib("disabled", "disabled");
}
$this->addElement($port); $this->addElement($port);
$pass = new Zend_Form_Element_Text('pass'); $pass = new Zend_Form_Element_Text('pass');
$pass->setLabel(_("Password")) $pass->setLabel(_("Password"))
->setValue(isset($setting[$prefix.'_pass'])?$setting[$prefix.'_pass']:"") ->setValue($useDefaults ? $streamDefaults['pass'] :
(isset($setting[$prefix.'_pass'])?$setting[$prefix.'_pass']:""))
->setValidators(array( ->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered'))))) array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
if ($disable_all) {
$pass->setAttrib("disabled", "disabled");
}
$pass->setAttrib('alt', 'regular_text'); $pass->setAttrib('alt', 'regular_text');
$this->addElement($pass); $this->addElement($pass);
@ -138,9 +127,6 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$genre->setLabel(_("Genre")) $genre->setLabel(_("Genre"))
->setValue(isset($setting[$prefix.'_genre'])?$setting[$prefix.'_genre']:"") ->setValue(isset($setting[$prefix.'_genre'])?$setting[$prefix.'_genre']:"")
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
if ($disable_all) {
$genre->setAttrib("disabled", "disabled");
}
$this->addElement($genre); $this->addElement($genre);
$url = new Zend_Form_Element_Text('url'); $url = new Zend_Form_Element_Text('url');
@ -149,9 +135,6 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
->setValidators(array( ->setValidators(array(
array('regex', false, array('/^[0-9a-zA-Z\-_.:\/]+$/', 'messages' => _('Invalid character entered'))))) array('regex', false, array('/^[0-9a-zA-Z\-_.:\/]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
if ($disable_all) {
$url->setAttrib("disabled", "disabled");
}
$url->setAttrib('alt', 'url'); $url->setAttrib('alt', 'url');
$this->addElement($url); $this->addElement($url);
@ -159,41 +142,31 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$name->setLabel(_("Name")) $name->setLabel(_("Name"))
->setValue(isset($setting[$prefix.'_name'])?$setting[$prefix.'_name']:"") ->setValue(isset($setting[$prefix.'_name'])?$setting[$prefix.'_name']:"")
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
if ($disable_all) {
$name->setAttrib("disabled", "disabled");
}
$this->addElement($name); $this->addElement($name);
$description = new Zend_Form_Element_Text('description'); $description = new Zend_Form_Element_Text('description');
$description->setLabel(_("Description")) $description->setLabel(_("Description"))
->setValue(isset($setting[$prefix.'_description'])?$setting[$prefix.'_description']:"") ->setValue(isset($setting[$prefix.'_description'])?$setting[$prefix.'_description']:"")
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
if ($disable_all) {
$description->setAttrib("disabled", "disabled");
}
$this->addElement($description); $this->addElement($description);
$mount = new Zend_Form_Element_Text('mount'); $mount = new Zend_Form_Element_Text('mount');
$mount->setLabel(_("Mount Point")) $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( ->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered'))))) array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
if ($disable_all) {
$mount->setAttrib("disabled", "disabled");
}
$mount->setAttrib('alt', 'regular_text'); $mount->setAttrib('alt', 'regular_text');
$this->addElement($mount); $this->addElement($mount);
$user = new Zend_Form_Element_Text('user'); $user = new Zend_Form_Element_Text('user');
$user->setLabel(_("Username")) $user->setLabel(_("Username"))
->setValue(isset($setting[$prefix.'_user'])?$setting[$prefix.'_user']:"") ->setValue($useDefaults ? $streamDefaults['user'] :
(isset($setting[$prefix.'_user'])?$setting[$prefix.'_user']:""))
->setValidators(array( ->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered'))))) array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
if ($disable_all) {
$user->setAttrib("disabled", "disabled");
}
$user->setAttrib('alt', 'regular_text'); $user->setAttrib('alt', 'regular_text');
$this->addElement($user); $this->addElement($user);
@ -203,9 +176,6 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
->setValidators(array( ->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered'))))) array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
if ($disable_all) {
$adminUser->setAttrib("disabled", "disabled");
}
$adminUser->setAttrib('alt', 'regular_text'); $adminUser->setAttrib('alt', 'regular_text');
$this->addElement($adminUser); $this->addElement($adminUser);
@ -215,16 +185,16 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
->setValidators(array( ->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered'))))) array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
if ($disable_all) {
$adminPass->setAttrib("disabled", "disabled");
}
$adminPass->setAttrib('alt', 'regular_text'); $adminPass->setAttrib('alt', 'regular_text');
$this->addElement($adminPass); $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( $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"]; $f_data = $data['s'.$this->prefix."_data"];
$isValid = parent::isValid($f_data); $isValid = parent::isValid($f_data);
if ($f_data['enable'] == 1) { // XXX: A couple of ugly workarounds here, but I guess that's what you get when you
if ($f_data['host'] == '') { // combine an already-complex POST and GET into a single action...
$element = $this->getElement("host"); if (Application_Model_Preference::getUsingCustomStreamSettings() && $f_data) {
$element->addError(_("Server cannot be empty.")); if ($f_data['enable'] == 1 && isset($f_data["host"])) {
$isValid = false; if ($f_data['host'] == '') {
} $element = $this->getElement("host");
if ($f_data['port'] == '') { $element->addError(_("Server cannot be empty."));
$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; $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; 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

@ -30,13 +30,13 @@ class Application_Model_Auth
$e_link_port = $_SERVER['SERVER_PORT']; $e_link_port = $_SERVER['SERVER_PORT'];
$e_link_path = $view->url(array('user_id' => $user->getDbId(), 'token' => $token), 'password-change'); $e_link_path = $view->url(array('user_id' => $user->getDbId(), 'token' => $token), 'password-change');
$message = sprintf(_("Hi %s, \n\nClick this link to reset your password: "), $user->getDbLogin()); $message = sprintf(_("Hi %s, \n\nPlease click this link to reset your password: "), $user->getDbLogin());
$message .= "{$e_link_protocol}://{$e_link_base}:{$e_link_port}{$e_link_path}"; $message .= "{$e_link_protocol}://{$e_link_base}:{$e_link_port}{$e_link_path}";
$message .= sprintf(_pro("\n\nIf you have any problems, please contact our support team: %s"), SUPPORT_EMAIL_ADDRESS);
$message .= sprintf(_pro("\n\nThank you,\nThe %s Team"), SAAS_PRODUCT_BRANDING_NAME);
$str = sprintf(_('%s Password Reset'), PRODUCT_NAME); $str = sprintf(_('%s Password Reset'), SAAS_PRODUCT_BRANDING_NAME);
$success = Application_Model_Email::send($str, $message, $user->getDbEmail()); return Application_Model_Email::send($str, $message, $user->getDbEmail());
return $success;
} }
public function invalidateTokens($user, $action) public function invalidateTokens($user, $action)

View file

@ -2,75 +2,20 @@
class Application_Model_Email class Application_Model_Email
{ {
/** /**
* Send email * Send email
* *
* @param string $subject * @param string $subject
* @param string $message * @param string $message
* @param mixed $tos * @param mixed $to
* @return void * @return boolean
*/ */
public static function send($subject, $message, $tos, $from = null) public static function send($subject, $message, $to) {
{
$mailServerConfigured = Application_Model_Preference::GetMailServerConfigured() == true ? true : false;
$mailServerRequiresAuth = Application_Model_Preference::GetMailServerRequiresAuth() == true ? true : false;
$success = true;
if ($mailServerConfigured) { $headers = sprintf('From: %s <noreply@account.sourcefabric.com>', SAAS_PRODUCT_BRANDING_NAME);
$mailServer = Application_Model_Preference::GetMailServer(); return mail($to, $subject, $message, $headers);
$mailServerPort = Application_Model_Preference::GetMailServerPort();
if (!empty($mailServerPort)) {
$port = $mailServerPort;
}
if ($mailServerRequiresAuth) {
$username = Application_Model_Preference::GetMailServerEmailAddress();
$password = Application_Model_Preference::GetMailServerPassword();
$config = array(
'auth' => 'login',
'ssl' => 'ssl',
'username' => $username,
'password' => $password
);
} else {
$config = array(
'ssl' => 'tls'
);
}
if (isset($port)) {
$config['port'] = $port;
}
$transport = new Zend_Mail_Transport_Smtp($mailServer, $config);
}
$mail = new Zend_Mail('utf-8');
$mail->setSubject($subject);
$mail->setBodyText($message);
foreach ((array) $tos as $to) {
$mail->addTo($to);
}
if ($mailServerConfigured) {
$mail->setFrom(isset($from) ? $from : Application_Model_Preference::GetMailServerEmailAddress());
try {
$mail->send($transport);
} catch (Exception $e) {
$success = false;
}
} else {
$mail->setFrom(isset($from) ? $from : Application_Model_Preference::GetSystemEmail());
try {
$mail->send();
} catch (Exception $e) {
$success = false;
}
}
return $success;
} }
} }

View file

@ -1096,6 +1096,13 @@ class Application_Model_Preference
public static function GetSourceSwitchStatus($sourcename) public static function GetSourceSwitchStatus($sourcename)
{ {
// Scheduled play switch should always be "on".
// Even though we've hidden this element in the dashboard we should
// always make sure it's on or else a station's stream could go offline.
if ($sourcename == "scheduled_play") {
return "on";
}
$value = self::getValue($sourcename."_switch"); $value = self::getValue($sourcename."_switch");
return ($value == null || $value == "off") ? 'off' : 'on'; return ($value == null || $value == "off") ? 'off' : 'on';
} }
@ -1161,87 +1168,6 @@ class Application_Model_Preference
{ {
return self::getValue("auto_switch"); 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 */ /* User specific preferences end */
public static function ShouldShowPopUp() public static function ShouldShowPopUp()
@ -1512,6 +1438,29 @@ class Application_Model_Preference
self::setValue("task_manager_lock", $value); self::setValue("task_manager_lock", $value);
} }
// SAAS-876 - Toggle indicating whether user is using custom stream settings
public static function getUsingCustomStreamSettings() {
$val = self::getValue("using_custom_stream_settings");
return empty($val) ? false : $val;
}
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() public static function getRadioPageDisplayLoginButton()
{ {
return self::getValue("radio_page_display_login_button"); return self::getValue("radio_page_display_login_button");
@ -1521,4 +1470,14 @@ class Application_Model_Preference
{ {
self::setValue("radio_page_display_login_button", $value); 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

@ -246,6 +246,10 @@ class Application_Model_StreamSetting
} elseif (is_array($d)) { } elseif (is_array($d)) {
$temp = explode('_', $key); $temp = explode('_', $key);
$prefix = $temp[0]; $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) { foreach ($d as $k => $v) {
$keyname = $prefix . "_" . $k; $keyname = $prefix . "_" . $k;
if ($k == 'enable') { 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 []. * $data - data array. $data is [].
* TODO: Make this SQL a prepared statement! * 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; 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) public function isHostOfShow($showId)
{ {
return CcShowHostsQuery::create() return CcShowHostsQuery::create()

View file

@ -30,17 +30,15 @@
<?php echo $this->element->getElement('csrf') ?> <?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') ?> <?php echo $this->element->getElement('captcha') ?>
<dt id="submit-label">&nbsp;</dt> <dt id="submit-label">&nbsp;</dt>
<dd id="submit-element"> <dd id="submit-element">
<?php echo $this->element->getElement('submit') ?> <?php echo $this->element->getElement('submit') ?>
</dd> </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> </dl>
</form> </form>

View file

@ -1,36 +1,54 @@
<form enctype="application/x-www-form-urlencoded" method="post" action=""> <fieldset>
<dl class="zend_form"> <legend>Station Owners</legend>
<dt id="username-label"> <p>
<label for="username" class="required"> <?php echo(sprintf(_pro("If you are the primary owner of this station, <a href=\"%s\">please reset your password here</a>."), WHMCS_PASSWORD_RESET_URL)); ?>
<?php echo $this->element->getElement('username')->getLabel() ?> </p>
</label>
</dt> </fieldset>
<dd id="username-element"> <fieldset>
<?php echo $this->element->getElement('username') ?> <legend>DJs, Program Managers, and Others</legend>
</dd> <form enctype="application/x-www-form-urlencoded" method="post" action="">
<dl class="zend_form">
<dt id="email-label">
<label for="email" class="required"> <p>Please enter both your username and email address.</p>
<?php echo $this->element->getElement('email')->getLabel() ?> <dt id="username-label">
</label> <label for="username" class="required">
</dt> <?php echo $this->element->getElement('username')->getLabel() ?>
<dd id="email-element"> </label>
<?php echo $this->element->getElement('email') ?> </dt>
</dd> <dd id="username-element">
<?php if($this->element->getElement('email')->hasErrors()): ?> <?php echo $this->element->getElement('username') ?>
<ul class='errors'> </dd>
<?php foreach($this->element->getElement('email')->getMessages() as $error): ?> </dt>
<li><?php echo $error; ?></li>
<?php endforeach; ?> <dt id="email-label">
</ul> <label for="email" class="required">
<?php endif; ?> <?php echo $this->element->getElement('email')->getLabel() ?>
</label>
<dt id="submit-label">&nbsp;</dt> </dt>
<dd id="submit-element"> <dd id="email-element">
<?php echo $this->element->getElement('submit') ?> <?php echo $this->element->getElement('email') ?>
</dd> </dd>
<dd id="cancel-element"> <?php if ($this->element->getElement('email')->hasErrors()): ?>
<?php echo $this->element->getElement('cancel') ?> <ul class='errors'>
</dd> <?php foreach ($this->element->getElement('email')->getMessages() as $error): ?>
</dl> <li><?php echo $error; ?></li>
</form> <?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">
<a href="<?php echo($this->baseUrl('login')); ?>">
<button name="cancel" type="button" class="ui-button ui-widget ui-state-default ui-button-text-only center"><?php echo(_("Back")); ?></button>
</a>
</dd>
</dl>
</form>
</fieldset>

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 <?php
$s_name = "s".$this->stream_number; $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"> <div class="stream-setting-content" <?php echo $this->enabled == 0?'style="display: none;':''?> id="<?php echo $s_name?>-config">
<fieldset class="padded"> <fieldset class="padded">
<dl class="zend_form clearfix"> <dl class="zend_form clearfix">

View file

@ -1,9 +1,16 @@
<div class="login_box"> <div class="login_box">
<div class="logobox">&nbsp;</div> <div class="logobox">&nbsp;</div>
<h2><?php echo _("Email sent") ?></h2> <h2><?php echo _("Email Sent!") ?></h2>
<div id="login" class="login-content clearfix"> <div id="login" class="login-content clearfix">
<p class="light"><?php echo _("An email has been sent") ?></p> <p class="light"><?php echo _("A password reset link has been sent to your email address. Please check your email and follow the instructions inside to reset your password. If you don't see the email, please check your spam folder!") ?></p>
<p><a class="link" href="<?php echo $this->baseUrl('login'); ?>"><?php echo _("Back to login screen") ?></a></p> <br>
<dl class="zend-form">
<dd id="cancel-element">
<a href="<?php echo($this->baseUrl('login')); ?>">
<button name="cancel" type="button" class="ui-button ui-widget ui-state-default ui-button-text-only center"><?php echo(_("Back")); ?></button>
</a>
</dd>
</dl>
</div> </div>
</div> </div>

View file

@ -1,11 +1,8 @@
<div class="login_box"> <div class="login_box">
<div class="logobox">&nbsp;</div> <div class="logobox">&nbsp;</div>
<h2><?php echo _("Reset password") ?></h2> <h2><?php echo _("Password Reset") ?></h2>
<div id="login" class="login-content clearfix"> <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.")?>
</p>
<?php echo $this->form; ?> <?php echo $this->form; ?>
</div> </div>
</div> </div>

View file

@ -22,7 +22,7 @@
</div> </div>
<div class="source-info-block"> <div class="source-info-block">
<h3><?php echo _("Source Streams") ?></h3> <h3><?php echo _("Source Streams") ?></h3>
<ul> <ul style="padding-top: 10px;">
<li> <li>
<div id="master_dj_div" class="source-label"> <div id="master_dj_div" class="source-label">
<a id="master_dj" class="source-kick-button" onclick="kickSource(this)"></a> <a id="master_dj" class="source-kick-button" onclick="kickSource(this)"></a>
@ -41,12 +41,6 @@
<a href="#" id="live_dj" class="source-switch-button" onclick="setSwitchListener(this);"><span><?php echo $this->live_dj_switch?></span></a> <a href="#" id="live_dj" class="source-switch-button" onclick="setSwitchListener(this);"><span><?php echo $this->live_dj_switch?></span></a>
<div class="line-to-on-air"></div> <div class="line-to-on-air"></div>
</li> </li>
<li>
<div id="scheduled_play_div" class="source-label"><?php echo " "._("Scheduled Play") ?></div>
<div class="line-to-switch"></div>
<a href="#" id="scheduled_play" class="source-switch-button" onclick="setSwitchListener(this);"><span><?php echo $this->scheduled_play_switch?></span></a>
<div class="line-to-on-air"></div>
</li>
</ul> </ul>
</div> </div>
<div class="on-air-block"> <div class="on-air-block">

View file

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

View file

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

View file

@ -21,6 +21,19 @@ html, body {
text-align:center; text-align:center;
} }
#login-page fieldset
{
padding: 10px;
border: 1px solid #555;
margin-bottom: 10px;
}
#login-page legend {
font-weight: bold;
color: #919191;
}
h2 { h2 {
color: #000000; color: #000000;
font-size: 2.1em; font-size: 2.1em;
@ -1070,7 +1083,7 @@ input[type="checkbox"] {
margin:0; margin:0;
padding:8px 0 16px 0; padding:8px 0 16px 0;
font-size:12px; font-size:12px;
color:#717171; color: #919191;
text-align:left; text-align:left;
} }
.logobox { .logobox {
@ -1195,13 +1208,17 @@ input[type="checkbox"] {
.login-content .text-right, .text-right { .login-content .text-right, .text-right {
text-align:right; text-align:right;
} }
.login-content .link { .login-content a {
color:#FF5D1A; color:#FF5D1A;
text-decoration:none; text-decoration:none;
} }
.login-content .link:hover { .login-content a:hover {
text-decoration:underline; text-decoration:underline;
} }
.login-content .errors a {
color: #ff1c13;
}
/*---//////////////////// END LOGIN ////////////////////---*/ /*---//////////////////// END LOGIN ////////////////////---*/
@ -1888,6 +1905,7 @@ span.errors.sp-errors{
margin:8px 0 0 0; margin:8px 0 0 0;
cursor:pointer; cursor:pointer;
position:relative; position:relative;
clear: both;
} }
.collapsible-content { .collapsible-content {
margin-top:-1px; margin-top:-1px;
@ -2234,6 +2252,10 @@ span.errors.sp-errors{
width: 1100px; width: 1100px;
} }
#stream_save_bottom {
bottom: 0;
}
.preferences .padded { .preferences .padded {
margin-top: 5px; /* Firefox needs this */ margin-top: 5px; /* Firefox needs this */
} }

View file

@ -22,7 +22,7 @@ $(document).ready(function() {
unique_names : 'true', unique_names : 'true',
multiple_queues : 'true', multiple_queues : 'true',
filters : [ filters : [
{title: "Audio Files", extensions: "ogg,mp3,oga,flac,wav,m4a,mp4,opus"} {title: "Audio Files", extensions: "ogg,mp3,oga,flac,wav,m4a,mp4,opus,aac,oga,mp1,mp2,wma,au"}
], ],
multipart_params : { multipart_params : {
"csrf_token" : $("#csrf").attr('value'), "csrf_token" : $("#csrf").attr('value'),

View file

@ -1,3 +0,0 @@
function redirectToLogin(){
window.location = baseUrl+"Login"
}

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{ }else{
streamurl = "http://"+host+":"+port+"/" 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){ function restrictOggBitrate(ele, on){
var div = ele.closest("div") var div = ele.closest("div")
@ -468,19 +468,30 @@ $(document).ready(function() {
setupEventListeners(); setupEventListeners();
setSliderForReplayGain(); setSliderForReplayGain();
getAdminPasswordStatus(); getAdminPasswordStatus();
var s = $("[name^='customStreamSettings']:checked");
$('#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); $("[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)) { if (confirm(confirm_pypo_restart_text)) {
var data = $('#stream_form').serialize(); var data = $('#stream_form').serialize();
var url = baseUrl+'Preference/stream-setting'; var url = baseUrl+'Preference/stream-setting';
$.post(url, {format:"json", data: data}, function(json){ $.post(url, {format:"json", data: data}, function(json){
$('#content').empty().append(json.html); window.location.reload();
setupEventListeners(); //$('#content').empty().append(json.html);
setSliderForReplayGain(); //setupEventListeners();
setPseudoAdminPassword(json.s1_set_admin_pass, json.s2_set_admin_pass, json.s3_set_admin_pass, json.s4_set_admin_pass); //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

View file

@ -0,0 +1,17 @@
audio/ogg ogg
application/ogg ogg
audio/vorbis ogg
audio/mp3 mp3
audio/mpeg mp3
audio/mpeg3 mp3
audio/x-aac aac
audio/aac aac
audio/aacp aac
audio/mp4 mp4
audio/x-flac flac
audio/wav wav
audio/x-wav wav
audio/mp2 mp2
audio/mp1 mp1
audio/x-ms-wma wma
audio/basic au

View file

@ -12,7 +12,7 @@ import signal
from datetime import datetime from datetime import datetime
import traceback import traceback
import pure import pure
import mimetypes
from Queue import Empty from Queue import Empty
from threading import Thread, Timer from threading import Thread, Timer
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
@ -377,6 +377,21 @@ class PypoFetch(Thread):
start = datetime.strptime(media_item['start'], "%Y-%m-%d-%H-%M-%S") start = datetime.strptime(media_item['start'], "%Y-%m-%d-%H-%M-%S")
end = datetime.strptime(media_item['end'], "%Y-%m-%d-%H-%M-%S") end = datetime.strptime(media_item['end'], "%Y-%m-%d-%H-%M-%S")
root, ext = os.path.splitext(media_item['uri'])
mime = media_item['metadata']['mime']
mimetypes.init()
mime_ext = mimetypes.guess_extension(mime, strict=False)
if mime_ext is None:
mimes = mimetypes.read_mime_types("%s/mime.types" % os.path.dirname(os.path.realpath(__file__)))
for k, v in mimes.iteritems():
if v == mime:
mime_ext = k
if mime_ext is not None and mime_ext != ext:
self.logger.info("Invalid extension %s for file %s, changing to %s" % (ext, root, mime_ext))
media_item['uri'] = root + mime_ext
length1 = pure.date_interval_to_seconds(end - start) length1 = pure.date_interval_to_seconds(end - start)
length2 = media_item['cue_out'] - media_item['cue_in'] length2 = media_item['cue_out'] - media_item['cue_in']

View file

@ -39,7 +39,7 @@ setup(name='airtime-playout',
license='AGPLv3', license='AGPLv3',
packages=['pypo', 'pypo.media', 'pypo.media.update', packages=['pypo', 'pypo.media', 'pypo.media.update',
'liquidsoap', 'liquidsoap.library'], 'liquidsoap', 'liquidsoap.library'],
package_data={'': ['*.liq', '*.cfg']}, package_data={'': ['*.liq', '*.cfg', '*.types']},
scripts=[ scripts=[
'bin/airtime-playout', 'bin/airtime-playout',
'bin/airtime-liquidsoap', 'bin/airtime-liquidsoap',