Merge branch '2.3.x-saas' into 2.4.x-saas

Conflicts:
	airtime_mvc/application/controllers/ScheduleController.php
	airtime_mvc/application/forms/AddShowWhen.php
	airtime_mvc/application/models/Schedule.php
	python_apps/pypo/airtime-playout
This commit is contained in:
Martin Konecny 2013-05-21 16:40:10 -04:00
commit 3b9b23a7dd
36 changed files with 261 additions and 739 deletions

View file

@ -116,21 +116,21 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
} else { } else {
$userType = ""; $userType = "";
} }
$view->headScript()->appendScript("var userType = '$userType';"); $view->headScript()->appendScript("var userType = '$userType';");
if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1) { if (strpos($_SERVER['REQUEST_URI'], $baseUrl.'Dashboard/stream-player') === false
$view->headScript()->appendFile($baseUrl.'js/libs/google-analytics.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); && strpos($_SERVER['REQUEST_URI'], $baseUrl.'audiopreview/audio-preview') === false
} && strpos($_SERVER['REQUEST_URI'], $baseUrl.'audiopreview/playlist-preview') === false
&& strpos($_SERVER['REQUEST_URI'], $baseUrl.'audiopreview/block-preview') === false) {
if (Application_Model_Preference::GetPlanLevel() != "disabled"
&& !($_SERVER['REQUEST_URI'] == $baseUrl.'Dashboard/stream-player' ||
strncmp($_SERVER['REQUEST_URI'], $baseUrl.'audiopreview/audio-preview', strlen($baseUrl.'audiopreview/audio-preview'))==0)) {
$client_id = Application_Model_Preference::GetClientId(); $client_id = Application_Model_Preference::GetClientId();
$view->headScript()->appendScript("var livechat_client_id = '$client_id';"); $view->headScript()->appendScript("var livechat_client_id = '$client_id';");
$view->headScript()->appendFile($baseUrl . 'js/airtime/common/livechat.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $view->headScript()->appendFile($baseUrl . 'js/airtime/common/livechat.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
} }
if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1) {
$view->headScript()->appendFile($baseUrl.'js/libs/google-analytics.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
}
} }
protected function _initViewHelpers() protected function _initViewHelpers()

View file

@ -712,6 +712,28 @@ class ApiController extends Zend_Controller_Action
Logging::info("Registered Component: ".$component."@".$remoteAddr); Logging::info("Registered Component: ".$component."@".$remoteAddr);
Application_Model_ServiceRegister::Register($component, $remoteAddr); Application_Model_ServiceRegister::Register($component, $remoteAddr);
//send ip, subdomain
if ($component == "pypo"){
$split = explode('.', $_SERVER['SERVER_NAME']);
$subdomain = array();
foreach ($split as $value) {
if ($value == 'airtime') {
break;
} else {
$subdomain[] = $value;
}
}
if (count($subdomain) > 0){
$subDomain = implode('.',$subdomain);
$md = array();
$md["sub_domain"] = $subDomain;
$md["pypo_ip"] = $remoteAddr;
Application_Model_RabbitMq::SendMessageToHaproxyConfigDaemon($md);
}
}
} }
public function updateLiquidsoapStatusAction() public function updateLiquidsoapStatusAction()

View file

@ -23,9 +23,7 @@ class PreferenceController extends Zend_Controller_Action
{ {
$CC_CONFIG = Config::getConfig(); $CC_CONFIG = Config::getConfig();
$request = $this->getRequest(); $request = $this->getRequest();
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$baseUrl = Application_Common_OsPath::getBaseDir(); $baseUrl = Application_Common_OsPath::getBaseDir();
$this->view->headScript()->appendFile($baseUrl.'js/airtime/preferences/preferences.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/airtime/preferences/preferences.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
@ -51,16 +49,6 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetDefaultTimezone($values["timezone"]); Application_Model_Preference::SetDefaultTimezone($values["timezone"]);
Application_Model_Preference::SetWeekStartDay($values["weekStartDay"]); Application_Model_Preference::SetWeekStartDay($values["weekStartDay"]);
Application_Model_Preference::SetEnableSystemEmail($values["enableSystemEmail"]);
Application_Model_Preference::SetSystemEmail($values["systemEmail"]);
Application_Model_Preference::SetMailServerConfigured($values["configureMailServer"]);
Application_Model_Preference::SetMailServer($values["mailServer"]);
Application_Model_Preference::SetMailServerEmailAddress($values["email"]);
Application_Model_Preference::SetMailServerPassword($values["ms_password"]);
Application_Model_Preference::SetMailServerPort($values["port"]);
Application_Model_Preference::SetMailServerRequiresAuth($values["msRequiresAuth"]);
Application_Model_Preference::SetAutoUploadRecordedShowToSoundcloud($values["UseSoundCloud"]);
Application_Model_Preference::SetUploadToSoundcloudOption($values["UploadToSoundcloudOption"]); Application_Model_Preference::SetUploadToSoundcloudOption($values["UploadToSoundcloudOption"]);
Application_Model_Preference::SetSoundCloudDownloadbleOption($values["SoundCloudDownloadbleOption"]); Application_Model_Preference::SetSoundCloudDownloadbleOption($values["SoundCloudDownloadbleOption"]);
Application_Model_Preference::SetSoundCloudUser($values["SoundCloudUser"]); Application_Model_Preference::SetSoundCloudUser($values["SoundCloudUser"]);
@ -95,20 +83,11 @@ class PreferenceController extends Zend_Controller_Action
$form = new Application_Form_SupportSettings(); $form = new Application_Form_SupportSettings();
if ($request->isPost()) { if ($request->isPost()) {
$values = $request->getPost(); $values = $request->getPost();
if ($form->isValid($values)) {
if ($values["Publicise"] != 1) {
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
Application_Model_Preference::SetPublicise($values["Publicise"]);
if (isset($values["Privacy"])) {
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
}
} else if ($form->isValid($values)) {
Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view); Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view);
Application_Model_Preference::SetPhone($values["Phone"]); Application_Model_Preference::SetPhone($values["Phone"]);
Application_Model_Preference::SetEmail($values["Email"]); Application_Model_Preference::SetEmail($values["Email"]);
Application_Model_Preference::SetStationWebSite($values["StationWebSite"]); Application_Model_Preference::SetStationWebSite($values["StationWebSite"]);
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
Application_Model_Preference::SetPublicise($values["Publicise"]);
$form->Logo->receive(); $form->Logo->receive();
$imagePath = $form->Logo->getFileName(); $imagePath = $form->Logo->getFileName();
@ -139,15 +118,6 @@ class PreferenceController extends Zend_Controller_Action
public function directoryConfigAction() public function directoryConfigAction()
{ {
$CC_CONFIG = Config::getConfig();
$baseUrl = Application_Common_OsPath::getBaseDir();
$this->view->headScript()->appendFile($baseUrl.'js/serverbrowse/serverbrowser.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/preferences/musicdirs.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$watched_dirs_pref = new Application_Form_WatchedDirPreferences();
$this->view->form = $watched_dirs_pref;
} }
public function streamSettingAction() public function streamSettingAction()
@ -247,8 +217,6 @@ class PreferenceController extends Zend_Controller_Action
$error = false; $error = false;
if ($form->isValid($values)) { if ($form->isValid($values)) {
$values['output_sound_device'] = $form->getValue('output_sound_device');
$values['output_sound_device_type'] = $form->getValue('output_sound_device_type');
$values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata'); $values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata');
$values['streamFormat'] = $form->getValue('streamFormat'); $values['streamFormat'] = $form->getValue('streamFormat');
@ -281,33 +249,6 @@ class PreferenceController extends Zend_Controller_Action
//Application_Model_RabbitMq::PushSchedule(); //Application_Model_RabbitMq::PushSchedule();
} }
if (!Application_Model_Preference::GetMasterDjConnectionUrlOverride()) {
$master_connection_url = "http://".$_SERVER['SERVER_NAME'].":".$values["master_harbor_input_port"]."/".$values["master_harbor_input_mount_point"];
if (empty($values["master_harbor_input_port"]) || empty($values["master_harbor_input_mount_point"])) {
Application_Model_Preference::SetMasterDJSourceConnectionURL('N/A');
} else {
Application_Model_Preference::SetMasterDJSourceConnectionURL($master_connection_url);
}
} else {
Application_Model_Preference::SetMasterDJSourceConnectionURL($values["master_dj_connection_url"]);
}
if (!Application_Model_Preference::GetLiveDjConnectionUrlOverride()) {
$live_connection_url = "http://".$_SERVER['SERVER_NAME'].":".$values["dj_harbor_input_port"]."/".$values["dj_harbor_input_mount_point"];
if (empty($values["dj_harbor_input_port"]) || empty($values["dj_harbor_input_mount_point"])) {
Application_Model_Preference::SetLiveDJSourceConnectionURL('N/A');
} else {
Application_Model_Preference::SetLiveDJSourceConnectionURL($live_connection_url);
}
} else {
Application_Model_Preference::SetLiveDJSourceConnectionURL($values["live_dj_connection_url"]);
}
// extra info that goes into cc_stream_setting
Application_Model_StreamSetting::setMasterLiveStreamPort($values["master_harbor_input_port"]);
Application_Model_StreamSetting::setMasterLiveStreamMountPoint($values["master_harbor_input_mount_point"]);
Application_Model_StreamSetting::setDjLiveStreamPort($values["dj_harbor_input_port"]);
Application_Model_StreamSetting::setDjLiveStreamMountPoint($values["dj_harbor_input_mount_point"]);
Application_Model_StreamSetting::setOffAirMeta($values['offAirMeta']); Application_Model_StreamSetting::setOffAirMeta($values['offAirMeta']);
// store stream update timestamp // store stream update timestamp

View file

@ -477,7 +477,7 @@ class ScheduleController extends Zend_Controller_Action
if (!$validateStartTime) { if (!$validateStartTime) {
$this->view->when->getElement('add_show_start_time')->setOptions(array('disabled' => true)); $this->view->when->getElement('add_show_start_time')->setOptions(array('disabled' => true));
} }
$this->view->rr->getElement('add_show_record')->setOptions(array('disabled' => true)); //$this->view->rr->getElement('add_show_record')->setOptions(array('disabled' => true));
$this->view->addNewShow = false; $this->view->addNewShow = false;
$this->view->action = "edit-show"; $this->view->action = "edit-show";
$this->view->form = $this->view->render('schedule/add-show-form.phtml'); $this->view->form = $this->view->render('schedule/add-show-form.phtml');

View file

@ -7,13 +7,9 @@ class RabbitMqPlugin extends Zend_Controller_Plugin_Abstract
if (Application_Model_RabbitMq::$doPush) { if (Application_Model_RabbitMq::$doPush) {
$md = array('schedule' => Application_Model_Schedule::getSchedule()); $md = array('schedule' => Application_Model_Schedule::getSchedule());
Application_Model_RabbitMq::SendMessageToPypo("update_schedule", $md); Application_Model_RabbitMq::SendMessageToPypo("update_schedule", $md);
if (!isset($_SERVER['AIRTIME_SRV'])) {
Application_Model_RabbitMq::SendMessageToShowRecorder("update_recorder_schedule");
}
} }
if (memory_get_peak_usage() > 30*pow(2, 20)) { if (memory_get_peak_usage() > 30*pow(2, 20)) {
Logging::debug("Peak memory usage: " Logging::debug("Peak memory usage: "
.(memory_get_peak_usage()/1000000) .(memory_get_peak_usage()/1000000)
." MB while accessing URI ".$_SERVER['REQUEST_URI']); ." MB while accessing URI ".$_SERVER['REQUEST_URI']);

View file

@ -241,22 +241,9 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
//this is a new show //this is a new show
$overlapping = Application_Model_Schedule::checkOverlappingShows( $overlapping = Application_Model_Schedule::checkOverlappingShows(
$repeatShowStart, $repeatShowEnd); $repeatShowStart, $repeatShowEnd);
/* If the repeating show is rebroadcasted we need to check
* the rebroadcast dates relative to the repeating show
*/
if (!$overlapping && $formData['add_show_rebroadcast']) {
$overlapping = self::checkRebroadcastDates(
$repeatShowStart, $formData, $hours, $minutes);
}
} else { } else {
$overlapping = Application_Model_Schedule::checkOverlappingShows( $overlapping = Application_Model_Schedule::checkOverlappingShows(
$repeatShowStart, $repeatShowEnd, $update, null, $formData["add_show_id"]); $repeatShowStart, $repeatShowEnd, $update, null, $formData["add_show_id"]);
if (!$overlapping && $formData['add_show_rebroadcast']) {
$overlapping = self::checkRebroadcastDates(
$repeatShowStart, $formData, $hours, $minutes, true);
}
} }
if ($overlapping) { if ($overlapping) {
@ -277,36 +264,6 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$valid = false; $valid = false;
$this->getElement('add_show_duration')->setErrors(array(_('Cannot schedule overlapping shows'))); $this->getElement('add_show_duration')->setErrors(array(_('Cannot schedule overlapping shows')));
} }
} elseif ($formData["add_show_rebroadcast"]) {
/* Check first show
* Continue if the first show does not overlap
*/
$overlapping = Application_Model_Schedule::checkOverlappingShows($show_start, $show_end, $update, $instanceId);
if (!$overlapping) {
$durationToAdd = "PT".$hours."H".$minutes."M";
for ($i = 1; $i <= 10; $i++) {
if (empty($formData["add_show_rebroadcast_date_absolute_".$i])) break;
$abs_rebroadcast_start = $formData["add_show_rebroadcast_date_absolute_".$i]." ".
$formData["add_show_rebroadcast_time_absolute_".$i];
$rebroadcastShowStart = new DateTime($abs_rebroadcast_start);
$rebroadcastShowStart->setTimezone(new DateTimeZone('UTC'));
$rebroadcastShowEnd = clone $rebroadcastShowStart;
$rebroadcastShowEnd->add(new DateInterval($durationToAdd));
$overlapping = Application_Model_Schedule::checkOverlappingShows($rebroadcastShowStart,
$rebroadcastShowEnd, $update, null, $formData["add_show_id"]);
if ($overlapping) {
$valid = false;
$this->getElement('add_show_duration')->setErrors(array(_('Cannot schedule overlapping shows')));
break;
}
}
} else {
$valid = false;
$this->getElement('add_show_duration')->setErrors(array(_('Cannot schedule overlapping shows')));
}
} else { } else {
$overlapping = Application_Model_Schedule::checkOverlappingShows($show_start, $show_end, $update, $instanceId); $overlapping = Application_Model_Schedule::checkOverlappingShows($show_start, $show_end, $update, $instanceId);
if ($overlapping) { if ($overlapping) {

View file

@ -7,7 +7,6 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
public function init() public function init()
{ {
$this->setDecorators(array( $this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/preferences_email_server.phtml')) array('ViewScript', array('viewScript' => 'form/preferences_email_server.phtml'))
)); ));

View file

@ -5,7 +5,6 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
public function init() public function init()
{ {
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator(); $notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
$rangeValidator = Application_Form_Helper_ValidationTypes::overrideBetweenValidator(0, 59.9); $rangeValidator = Application_Form_Helper_ValidationTypes::overrideBetweenValidator(0, 59.9);
$this->setDecorators(array( $this->setDecorators(array(
@ -92,6 +91,20 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
$third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi()); $third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi());
$third_party_api->setDecorators(array('ViewHelper')); $third_party_api->setDecorators(array('ViewHelper'));
$this->addElement($third_party_api); $this->addElement($third_party_api);
//
// Add the description element
$this->addElement('textarea', 'widgetCode', array(
'label' => 'Javascript Code:',
'required' => false,
'readonly' => true,
'style' => 'font-family: Consolas, "Liberation Mono", Courier,
monospace;',
'class' => 'input_text_area',
'value' => self::getWidgetCode(), //$_SERVER["SERVER_NAME"],
'decorators' => array(
'ViewHelper'
)
));
$locale = new Zend_Form_Element_Select("locale"); $locale = new Zend_Form_Element_Select("locale");
$locale->setLabel(_("Default Interface Language")); $locale->setLabel(_("Default Interface Language"));
@ -117,6 +130,42 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
$this->addElement($week_start_day); $this->addElement($week_start_day);
} }
private static function getWidgetCode() {
$host = $_SERVER['SERVER_NAME'];
$code = <<<CODE
<script src="http://$host/widgets/js/jquery-1.6.1.min.js" type="text/javascript"></script>
<script src="http://$host/widgets/js/jquery-ui-1.8.10.custom.min.js" type="text/javascript"></script>
<script src="http://$host/widgets/js/jquery.showinfo.js" type="text/javascript"></script>
<div id="headerLiveHolder" style="border: 1px solid #999999; padding: 10px;"></div>
<div id="onAirToday"></div>
<div id="scheduleTabs"></div>
<script type="text/javascript">
$(document).ready(function() {
$("#headerLiveHolder").airtimeLiveInfo({
sourceDomain: "http://$host",
updatePeriod: 20 //seconds
});
$("#onAirToday").airtimeShowSchedule({
sourceDomain: "http://$host",
updatePeriod: 5, //seconds
showLimit: 10
});
$("#scheduleTabs").airtimeWeekSchedule({
sourceDomain:"http://$host",
updatePeriod: 600 //seconds
});
});
</script>
CODE;
return $code;
}
private function getWeekStartDays() private function getWeekStartDays()
{ {
$days = array( $days = array(

View file

@ -80,44 +80,6 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
$this->addElement($live_dj_connection_url); $this->addElement($live_dj_connection_url);
//liquidsoap harbor.input port
$betweenValidator = Application_Form_Helper_ValidationTypes::overrideBetweenValidator(1024, 49151);
$m_port = Application_Model_StreamSetting::getMasterLiveStreamPort();
$master_dj_port = new Zend_Form_Element_Text('master_harbor_input_port');
$master_dj_port->setLabel(_("Master Source Port"))
->setValue($m_port)
->setValidators(array($betweenValidator))
->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>_('Only numbers are allowed.'))))
->setDecorators(array('ViewHelper'));
$this->addElement($master_dj_port);
$m_mount = Application_Model_StreamSetting::getMasterLiveStreamMountPoint();
$master_dj_mount = new Zend_Form_Element_Text('master_harbor_input_mount_point');
$master_dj_mount->setLabel(_("Master Source Mount Point"))
->setValue($m_mount)
->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
$this->addElement($master_dj_mount);
//liquidsoap harbor.input port
$l_port = Application_Model_StreamSetting::getDjLiveStreamPort();
$live_dj_port = new Zend_Form_Element_Text('dj_harbor_input_port');
$live_dj_port->setLabel(_("Show Source Port"))
->setValue($l_port)
->setValidators(array($betweenValidator))
->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>_('Only numbers are allowed.'))))
->setDecorators(array('ViewHelper'));
$this->addElement($live_dj_port);
$l_mount = Application_Model_StreamSetting::getDjLiveStreamMountPoint();
$live_dj_mount = new Zend_Form_Element_Text('dj_harbor_input_mount_point');
$live_dj_mount->setLabel(_("Show Source Mount Point"))
->setValue($l_mount)
->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
$this->addElement($live_dj_mount);
// demo only code // demo only code
if (!$isStreamConfigable) { if (!$isStreamConfigable) {
$elements = $this->getElements(); $elements = $this->getElements();
@ -145,50 +107,6 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
public function isValid($data) public function isValid($data)
{ {
$isValid = parent::isValid($data); $isValid = parent::isValid($data);
$master_harbor_input_port = $data['master_harbor_input_port'];
$dj_harbor_input_port = $data['dj_harbor_input_port'];
if ($master_harbor_input_port == $dj_harbor_input_port && $master_harbor_input_port != "") {
$element = $this->getElement("dj_harbor_input_port");
$element->addError(_("You cannot use same port as Master DJ port."));
$isValid = false;
}
if ($master_harbor_input_port != "") {
if (is_numeric($master_harbor_input_port)) {
if ($master_harbor_input_port != Application_Model_StreamSetting::getMasterLiveStreamPort()) {
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
try {
socket_bind($sock, 0, $master_harbor_input_port);
} catch (Exception $e) {
$element = $this->getElement("master_harbor_input_port");
$element->addError(sprintf(_("Port %s is not available"), $master_harbor_input_port));
$isValid = false;
}
socket_close($sock);
}
} else {
$isValid = false;
}
}
if ($dj_harbor_input_port != "") {
if (is_numeric($dj_harbor_input_port)) {
if ($dj_harbor_input_port != Application_Model_StreamSetting::getDjLiveStreamPort()) {
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
try {
socket_bind($sock, 0, $dj_harbor_input_port);
} catch (Exception $e) {
$element = $this->getElement("dj_harbor_input_port");
$element->addError(sprintf(_("Port %s is not available"). $dj_harbor_input_port));
$isValid = false;
}
socket_close($sock);
}
} else {
$isValid = false;
}
}
return $isValid; return $isValid;
} }

View file

@ -2,14 +2,12 @@
class Application_Form_Preferences extends Zend_Form class Application_Form_Preferences extends Zend_Form
{ {
public function init() public function init()
{ {
$baseUrl = Application_Common_OsPath::getBaseDir(); $baseUrl = Application_Common_OsPath::getBaseDir();
$this->setMethod('post'); $this->setMethod('post');
$this->setDecorators(array( $this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/preferences.phtml')) array('ViewScript', array('viewScript' => 'form/preferences.phtml'))
)); ));
@ -17,9 +15,6 @@ class Application_Form_Preferences extends Zend_Form
$general_pref = new Application_Form_GeneralPreferences(); $general_pref = new Application_Form_GeneralPreferences();
$this->addSubForm($general_pref, 'preferences_general'); $this->addSubForm($general_pref, 'preferences_general');
$email_pref = new Application_Form_EmailServerPreferences();
$this->addSubForm($email_pref, 'preferences_email_server');
$soundcloud_pref = new Application_Form_SoundcloudPreferences(); $soundcloud_pref = new Application_Form_SoundcloudPreferences();
$this->addSubForm($soundcloud_pref, 'preferences_soundcloud'); $this->addSubForm($soundcloud_pref, 'preferences_soundcloud');

View file

@ -11,16 +11,6 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
array('ViewScript', array('viewScript' => 'form/preferences_soundcloud.phtml')) array('ViewScript', array('viewScript' => 'form/preferences_soundcloud.phtml'))
)); ));
//enable soundcloud uploads
$this->addElement('checkbox', 'UseSoundCloud', array(
'label' => _('Automatically Upload Recorded Shows'),
'required' => false,
'value' => Application_Model_Preference::GetAutoUploadRecordedShowToSoundcloud(),
'decorators' => array(
'ViewHelper'
)
));
//enable soundcloud uploads option //enable soundcloud uploads option
$this->addElement('checkbox', 'UploadToSoundcloudOption', array( $this->addElement('checkbox', 'UploadToSoundcloudOption', array(
'label' => _('Enable SoundCloud Upload'), 'label' => _('Enable SoundCloud Upload'),

View file

@ -17,28 +17,6 @@ class Application_Form_StreamSetting extends Zend_Form
public function startFrom() public function startFrom()
{ {
$setting = $this->setting; $setting = $this->setting;
if (Application_Model_Preference::GetPlanLevel() == 'disabled') {
$output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device');
$output_sound_device->setLabel(_('Hardware Audio Output'))
->setRequired(false)
->setValue(($setting['output_sound_device'] == "true")?1:0)
->setDecorators(array('ViewHelper'));
if (Application_Model_Preference::GetEnableStreamConf() == "false") {
$output_sound_device->setAttrib("readonly", true);
}
$this->addElement($output_sound_device);
$output_types = array("ALSA"=>"ALSA", "AO"=>"AO", "OSS"=>"OSS", "Portaudio"=>"Portaudio", "Pulseaudio"=>"Pulseaudio");
$output_type = new Zend_Form_Element_Select('output_sound_device_type');
$output_type->setLabel(_("Output Type"))
->setMultiOptions($output_types)
->setValue($setting['output_sound_device_type'])
->setDecorators(array('ViewHelper'));
if ($setting['output_sound_device'] != "true") {
$output_type->setAttrib("disabled", "disabled");
}
$this->addElement($output_type);
}
$icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata'); $icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata');
$icecast_vorbis_metadata->setLabel(_('Icecast Vorbis Metadata')) $icecast_vorbis_metadata->setLabel(_('Icecast Vorbis Metadata'))

View file

@ -4,7 +4,6 @@ require_once 'customfilters/ImageSize.php';
class Application_Form_SupportSettings extends Zend_Form class Application_Form_SupportSettings extends Zend_Form
{ {
public function init() public function init()
{ {
$country_list = Application_Model_Preference::GetCountryList(); $country_list = Application_Model_Preference::GetCountryList();
@ -128,20 +127,6 @@ class Application_Form_SupportSettings extends Zend_Form
} }
$this->addElement($checkboxPublicise); $this->addElement($checkboxPublicise);
// text area for sending detail
$this->addElement('textarea', 'SendInfo', array(
'class' => 'sending_textarea',
'required' => false,
'filters' => array('StringTrim'),
'readonly' => true,
'cols' => 61,
'rows' => 5,
'value' => Application_Model_Preference::GetSystemInfo(false, true),
'decorators' => array(
'ViewHelper'
)
));
// checkbox for privacy policy // checkbox for privacy policy
$checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy"); $checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy");
$checkboxPrivacy->setLabel( $checkboxPrivacy->setLabel(
@ -164,7 +149,6 @@ class Application_Form_SupportSettings extends Zend_Form
public function isValid ($data) public function isValid ($data)
{ {
$isValid = parent::isValid($data); $isValid = parent::isValid($data);
if (isset($data["Privacy"])) { if (isset($data["Privacy"])) {
$checkPrivacy = $this->getElement('Privacy'); $checkPrivacy = $this->getElement('Privacy');
if ($data["SupportFeedback"] == "1" && $data["Privacy"] != "1") { if ($data["SupportFeedback"] == "1" && $data["Privacy"] != "1") {

View file

@ -685,11 +685,7 @@ class Application_Model_Preference
$outputArray['NUM_OF_PAST_SHOWS'] = Application_Model_ShowInstance::GetShowInstanceCount(gmdate("Y-m-d H:i:s")); $outputArray['NUM_OF_PAST_SHOWS'] = Application_Model_ShowInstance::GetShowInstanceCount(gmdate("Y-m-d H:i:s"));
$outputArray['UNIQUE_ID'] = self::GetUniqueId(); $outputArray['UNIQUE_ID'] = self::GetUniqueId();
$outputArray['SAAS'] = self::GetPlanLevel(); $outputArray['SAAS'] = self::GetPlanLevel();
if ($outputArray['SAAS'] != 'disabled') { $outputArray['TRIAL_END_DATE'] = self::GetTrialEndingDate();
$outputArray['TRIAL_END_DATE'] = self::GetTrialEndingDate();
} else {
$outputArray['TRIAL_END_DATE'] = NULL;
}
$outputArray['INSTALL_METHOD'] = self::GetInstallMethod(); $outputArray['INSTALL_METHOD'] = self::GetInstallMethod();
$outputArray['NUM_OF_STREAMS'] = self::GetNumOfStreams(); $outputArray['NUM_OF_STREAMS'] = self::GetNumOfStreams();
$outputArray['STREAM_INFO'] = Application_Model_StreamSetting::getStreamInfoForDataCollection(); $outputArray['STREAM_INFO'] = Application_Model_StreamSetting::getStreamInfoForDataCollection();
@ -715,9 +711,7 @@ class Application_Model_Preference
$outputString .= $key." : FALSE\n"; $outputString .= $key." : FALSE\n";
} }
} elseif ($key == "SAAS") { } elseif ($key == "SAAS") {
if (strcmp($out, 'disabled')!=0) { $outputString .= $key.' : '.$out."\n";
$outputString .= $key.' : '.$out."\n";
}
} else { } else {
$outputString .= $key.' : '.$out."\n"; $outputString .= $key.' : '.$out."\n";
} }

View file

@ -76,4 +76,46 @@ class Application_Model_RabbitMq
self::sendMessage($exchange, $data); self::sendMessage($exchange, $data);
} }
public static function SendMessageToHaproxyConfigDaemon($md){
$config = parse_ini_file("/etc/airtime-saas/rabbitmq.ini", true);
$conn = new AMQPConnection($config["rabbitmq"]["host"],
$config["rabbitmq"]["port"],
$config["rabbitmq"]["user"],
$config["rabbitmq"]["password"],
$config["rabbitmq"]["vhost"]);
$exchange = $config["rabbitmq"]["queue"];
$queue = $config["rabbitmq"]["queue"];
$ch = $conn->channel();
/*
name: $queue
passive: false
durable: true // the queue will survive server restarts
exclusive: false // the queue can be accessed in other channels
auto_delete: false //the queue won't be deleted once the channel is closed.
*/
$ch->queue_declare($queue, false, true, false, false);
/*
name: $exchange
type: direct
passive: false
durable: true // the exchange will survive server restarts
auto_delete: false //the exchange won't be deleted once the channel is closed.
*/
$ch->exchange_declare($exchange, 'direct', false, true, false);
$ch->queue_bind($queue, $exchange);
$data = json_encode($md).PHP_EOL;
$msg = new AMQPMessage($data, array('content_type' => 'application/json'));
$ch->basic_publish($msg, $exchange);
$ch->close();
$conn->close();
}
} }

View file

@ -1039,17 +1039,6 @@ SQL;
$formRepeats->populate(array('add_show_end_date' => date("Y-m-d"))); $formRepeats->populate(array('add_show_end_date' => date("Y-m-d")));
$formRecord = new Application_Form_AddShowRR();
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
$formRecord->removeDecorator('DtDdWrapper');
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
$formRebroadcast->removeDecorator('DtDdWrapper');
$p_view->rr = $formRecord;
$p_view->absoluteRebroadcast = $formAbsoluteRebroadcast;
$p_view->rebroadcast = $formRebroadcast;
$p_view->addNewShow = true; $p_view->addNewShow = true;
}*/ }*/
@ -1074,13 +1063,6 @@ SQL;
$formStyle->removeDecorator('DtDdWrapper'); $formStyle->removeDecorator('DtDdWrapper');
$formLive->removeDecorator('DtDdWrapper'); $formLive->removeDecorator('DtDdWrapper');
$formRecord = new Application_Form_AddShowRR();
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
$formRecord->removeDecorator('DtDdWrapper');
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
$formRebroadcast->removeDecorator('DtDdWrapper');
$when = $formWhen->isValid($data); $when = $formWhen->isValid($data);
if ($when && $formWhen->checkReliantFields($data, true, null, true)) { if ($when && $formWhen->checkReliantFields($data, true, null, true)) {
@ -1114,13 +1096,6 @@ SQL;
$controller->view->who = $formWho; $controller->view->who = $formWho;
$controller->view->style = $formStyle; $controller->view->style = $formStyle;
$controller->view->live = $formLive; $controller->view->live = $formLive;
$controller->view->rr = $formRecord;
$controller->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
$controller->view->rebroadcast = $formRebroadcast;
//$formRecord->disable();
//$formAbsoluteRebroadcast->disable();
//$formRebroadcast->disable();
return false; return false;
} }
@ -1186,79 +1161,27 @@ SQL;
$data["add_show_duration"] = $hValue.":".$mValue; $data["add_show_duration"] = $hValue.":".$mValue;
$formRecord = new Application_Form_AddShowRR();
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
$formRecord->removeDecorator('DtDdWrapper');
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
$formRebroadcast->removeDecorator('DtDdWrapper');
$record = $formRecord->isValid($data);
if ($data["add_show_repeats"]) { if ($data["add_show_repeats"]) {
$repeats = $formRepeats->isValid($data); $repeats = $formRepeats->isValid($data);
if ($repeats) { if ($repeats) {
$repeats = $formRepeats->checkReliantFields($data); $repeats = $formRepeats->checkReliantFields($data);
} }
$formAbsoluteRebroadcast->reset();
//make it valid, results don't matter anyways.
$rebroadAb = 1;
if ($data["add_show_rebroadcast"]) {
$rebroad = $formRebroadcast->isValid($data);
if ($rebroad) {
$rebroad = $formRebroadcast->checkReliantFields($data);
}
} else {
$rebroad = 1;
}
} else { } else {
$repeats = 1; $repeats = 1;
$formRebroadcast->reset();
//make it valid, results don't matter anyways.
$rebroad = 1;
if ($data["add_show_rebroadcast"]) {
$rebroadAb = $formAbsoluteRebroadcast->isValid($data);
if ($rebroadAb) {
$rebroadAb = $formAbsoluteRebroadcast->checkReliantFields($data);
}
} else {
$rebroadAb = 1;
}
} }
$who = $formWho->isValid($data); $who = $formWho->isValid($data);
$style = $formStyle->isValid($data); $style = $formStyle->isValid($data);
if ($what && $when && $repeats && $who && $style && $live) { if ($what && $when && $repeats && $who && $style && $live) {
if ($record && $rebroadAb && $rebroad) { if ($isAdminOrPM) {
if ($isAdminOrPM) { Application_Model_Show::create($data);
Application_Model_Show::create($data); }
}
//send back a new form for the user. //send back a new form for the user.
Application_Model_Schedule::createNewFormSections($controller->view); Application_Model_Schedule::createNewFormSections($controller->view);
//$controller->view->newForm = $controller->view->render('schedule/add-show-form.phtml'); //$controller->view->newForm = $controller->view->render('schedule/add-show-form.phtml');
return true; return true;
} else {
$controller->view->what = $formWhat;
$controller->view->when = $formWhen;
$controller->view->repeats = $formRepeats;
$controller->view->who = $formWho;
$controller->view->style = $formStyle;
$controller->view->rr = $formRecord;
$controller->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
$controller->view->rebroadcast = $formRebroadcast;
$controller->view->live = $formLive;
//$controller->view->addNewShow = !$editShow;
//$controller->view->form = $controller->view->render('schedule/add-show-form.phtml');
return false;
}
} else { } else {
$controller->view->what = $formWhat; $controller->view->what = $formWhat;
$controller->view->when = $formWhen; $controller->view->when = $formWhen;
@ -1266,9 +1189,6 @@ SQL;
$controller->view->who = $formWho; $controller->view->who = $formWho;
$controller->view->style = $formStyle; $controller->view->style = $formStyle;
$controller->view->live = $formLive; $controller->view->live = $formLive;
$controller->view->rr = $formRecord;
$controller->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
$controller->view->rebroadcast = $formRebroadcast;
//$controller->view->addNewShow = !$editShow; //$controller->view->addNewShow = !$editShow;
//$controller->view->form = $controller->view->render('schedule/add-show-form.phtml'); //$controller->view->form = $controller->view->render('schedule/add-show-form.phtml');
return false; return false;

View file

@ -214,23 +214,21 @@ class Application_Model_Systemstatus
{ {
$partions = array(); $partions = array();
/* First lets get all the watched directories. Then we can group them //connect to DB and find how much total space user has allocated.
* into the same partitions by comparing the partition sizes. */ $totalSpace = Application_Model_Preference::GetDiskQuota();
$musicDirs = Application_Model_MusicDir::getWatchedDirs();
$musicDirs[] = Application_Model_MusicDir::getStorDir();
foreach ($musicDirs as $md) { $path = $_SERVER['AIRTIME_BASE']."etc/airtime/num_bytes.ini";
$totalSpace = disk_total_space($md->getDirectory()); $arr = parse_ini_file($path);
if (!isset($partitions[$totalSpace])) { $usedSpace = 0;
$partitions[$totalSpace] = new StdClass; if ($arr !== false) {
$partitions[$totalSpace]->totalSpace = $totalSpace; $usedSpace = $arr['num_bytes'];
$partitions[$totalSpace]->totalFreeSpace = disk_free_space($md->getDirectory());
}
$partitions[$totalSpace]->dirs[] = $md->getDirectory();
} }
$partitions[$totalSpace] = new stdClass();
$partitions[$totalSpace]->totalSpace = $totalSpace;
$partitions[$totalSpace]->totalFreeSpace = $totalSpace - $usedSpace;
Logging::info($partitions[$totalSpace]->totalFreeSpace);
return array_values($partitions); return array_values($partitions);
} }

View file

@ -329,16 +329,26 @@ class Application_Model_User
$res = Application_Model_Datatables::findEntries($con, $displayColumns, $fromTable, $datatables); $res = Application_Model_Datatables::findEntries($con, $displayColumns, $fromTable, $datatables);
// mark record which is for the current user // mark record which is for the current user
foreach ($res['aaData'] as &$record) { foreach($res['aaData'] as $key => &$record){
if ($record['login'] == $username) { if ($record['login'] == $username) {
$record['delete'] = "self"; $record['delete'] = "self";
} else { } else {
$record['delete'] = ""; $record['delete'] = "";
} }
if($record['login'] == 'sourcefabric_admin'){
//arrays in PHP are basically associative arrays that can be iterated in order.
//Deleting an earlier element does not change the keys of elements that come after it. --MK
unset($res['aaData'][$key]);
$res['iTotalDisplayRecords']--;
$res['iTotalRecords']--;
}
$record = array_map('htmlspecialchars', $record); $record = array_map('htmlspecialchars', $record);
} }
$res['aaData'] = array_values($res['aaData']);
return $res; return $res;
} }

View file

@ -3,10 +3,6 @@
class Airtime_View_Helper_IsTrial extends Zend_View_Helper_Abstract{ class Airtime_View_Helper_IsTrial extends Zend_View_Helper_Abstract{
public function isTrial(){ public function isTrial(){
$plan = Application_Model_Preference::GetPlanLevel(); $plan = Application_Model_Preference::GetPlanLevel();
if($plan == 'trial'){ return $plan == 'trial';
return true;
}else{
return false;
}
} }
} }

View file

@ -12,46 +12,6 @@
class Airtime_View_Helper_VersionNotify extends Zend_View_Helper_Abstract{ class Airtime_View_Helper_VersionNotify extends Zend_View_Helper_Abstract{
public function versionNotify(){ public function versionNotify(){
if(Application_Model_Preference::GetPlanLevel() != 'disabled'){ return "";
return "";
}
// retrieve and validate current and latest versions,
$current = Application_Model_Preference::GetAirtimeVersion();
$latest = Application_Model_Preference::GetLatestVersion();
$link = Application_Model_Preference::GetLatestLink();
$currentExploded = explode('.', $current);
$latestExploded = explode('.', $latest);
if(count($currentExploded) != 3 || count($latestExploded) != 3) {
return "";
}
// Calculate the version difference;
// Example: if current = 1.9.5 and latest = 3.0.0, diff = 105
// Note: algorithm assumes the number after 1st dot never goes above 9
$versionDifference = (intval($latestExploded[0]) * 100 + intval($latestExploded[1]) *10 + intval($latestExploded[2]))
- (intval($currentExploded[0]) * 100 + intval($currentExploded[1] *10 + intval($currentExploded[2])));
// Pick icon based on distance this version is to the latest version available
if($versionDifference <= 0) {
// current version is up to date or newer
$class = "uptodate";
} else if($versionDifference < 20) {
// 2 or less major versions back
$class = "update";
} else if($versionDifference < 30) {
// 3 major versions back
$class = "update2";
} else {
// more than 3 major versions back
$class = "outdated";
}
$result = "<div id='version-diff' style='display:none'>" . $versionDifference . "</div>"
. "<div id='version-current' style='display:none'>" . $current . "</div>"
. "<div id='version-latest' style='display:none'>" . $latest . "</div>"
. "<div id='version-link' style='display:none'>" . $link . "</div>"
. "<div id='version-icon' class='" . $class . "'></div>";
return $result;
} }
} }

View file

@ -2,11 +2,6 @@
<?php echo $this->element->getSubform('preferences_general') ?> <?php echo $this->element->getSubform('preferences_general') ?>
<h3 class="collapsible-header" id="email-server-heading"><span class="arrow-icon"></span><? echo _("Email / Mail Server Settings"); ?></h3>
<div class="collapsible-content" id="email-server-settings">
<?php echo $this->element->getSubform('preferences_email_server') ?>
</div>
<h3 class="collapsible-header" id="soundcloud-heading"><span class="arrow-icon"></span><? echo _("SoundCloud Settings") ?></h3> <h3 class="collapsible-header" id="soundcloud-heading"><span class="arrow-icon"></span><? echo _("SoundCloud Settings") ?></h3>
<div class="collapsible-content" id="soundcloud-settings"> <div class="collapsible-content" id="soundcloud-settings">

View file

@ -1,106 +1,5 @@
<fieldset class="padded"> <fieldset class="padded">
<dl class="zend_form"> <dl class="zend_form">
<!-- Enable System Email option --> <!-- Enable System Email option -->
<dd id="enableSystemEmail-element" class="block-display">
<label class="required" for="timezone">
<?php echo $this->element->getElement('enableSystemEmail') ?>
<strong><?php echo $this->element->getElement('enableSystemEmail')->getLabel() ?></strong>
</label>
<?php if($this->element->getElement('enableSystemEmail')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('enableSystemEmail')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<!-- System Email option -->
<dt id="systemEmail-label" class="block-display">
<label class="required" for="timezone"><?php echo $this->element->getElement('systemEmail')->getLabel() ?>:
</label>
</dt>
<dd id="systemEmail-element" class="block-display">
<?php echo $this->element->getElement('systemEmail') ?>
<?php if($this->element->getElement('systemEmail')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('systemEmail')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<br />
<dd id="configureMailServer-element" class="block-display">
<label class="required" for="configureMailServer">
<?php echo $this->element->getElement('configureMailServer') ?>
<strong><?php echo $this->element->getElement('configureMailServer')->getLabel() ?></strong>
</label>
</dd>
<dt id="mailServer-label" class="block-display">
<label class="required" for="mailServer"><?php echo $this->element->getElement('mailServer')->getLabel() ?>
<span class="info-text-small"><?php echo _("(Required)") ?></span>:
</label>
<label class="required" for="msRequiresAuth">
<?php echo $this->element->getElement('msRequiresAuth') ?>
<?php echo $this->element->getElement('msRequiresAuth')->getLabel() ?>
</label>
</dt>
<dd id="mailServer-element" class="block-display">
<?php echo $this->element->getElement('mailServer') ?>
<?php if($this->element->getElement('mailServer')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('mailServer')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="port-label" class="block-display">
<label class="required" for="port"><?php echo $this->element->getElement('port')->getLabel() ?>:
</label>
</dt>
<dd id="port-element" class="block-display">
<?php echo $this->element->getElement('port') ?>
</dd>
<dt id="email-label" class="block-display">
<label class="required" for="email"><?php echo $this->element->getElement('email')->getLabel() ?>
<span class="info-text-small"><?php echo _("(Required)") ?></span>:
</label>
</dt>
<dd id="email-element" class="block-display">
<?php echo $this->element->getElement('email') ?>
<?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; ?>
</dd>
<dt id="password-label" class="block-display">
<label class="required" for="password"><?php echo $this->element->getElement('ms_password')->getLabel() ?>
<span class="info-text-small"><?php echo _("(Required)") ?></span>:
</label>
</dt>
<dd id="password-element" class="block-display">
<?php echo $this->element->getElement('ms_password') ?>
<?php if($this->element->getElement('ms_password')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('ms_password')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
</dl> </dl>
</fieldset> </fieldset>

View file

@ -54,12 +54,17 @@
<?php endif; ?> <?php endif; ?>
</dd> </dd>
<dt id="thirdPartyApi-label" class="block-display"> <dt id="thirdPartyApi-label" class="block-display">
<label class="optional"><?php echo $this->element->getElement('thirdPartyApi')->getLabel() ?></label> <label class="optional"><?php echo $this->element->getElement('thirdPartyApi')->getLabel() ?>
<span class="icecast_metadata_help_icon" id="thirdPartyApiInfo"></span>
</label>
</dt> </dt>
<dd id="thirdPartyApi-element" class="block-display radio-inline-list"> <dd id="thirdPartyApi-element" class="block-display radio-inline-list">
<?php $i=0; <?php $i=0;
$value = $this->element->getElement('thirdPartyApi')->getValue(); $value = $this->element->getElement('thirdPartyApi')->getValue();
?> ?>
<?php foreach ($this->element->getElement('thirdPartyApi')->getMultiOptions() as $radio) : ?> <?php foreach ($this->element->getElement('thirdPartyApi')->getMultiOptions() as $radio) : ?>
<label for="thirdPartyApi-<?php echo $i ?>"> <label for="thirdPartyApi-<?php echo $i ?>">
<input type="radio" value="<?php echo $i ?>" id="thirdPartyApi-<?php echo $i ?>" name="thirdPartyApi" <?php if($i == $value){echo 'checked="checked"';}?>> <input type="radio" value="<?php echo $i ?>" id="thirdPartyApi-<?php echo $i ?>" name="thirdPartyApi" <?php if($i == $value){echo 'checked="checked"';}?>>
@ -77,6 +82,19 @@
<?php endif; ?> <?php endif; ?>
</dd> </dd>
<dt id="widgetCode-label" style="display:none;" class="block-display">
<label class="optional" for="widgetCode"><?php echo $this->element->getElement('widgetCode')->getLabel() ?></label>
</dt>
<dd id="widgetCode-element" style="display:none;" class="block-display clearfix">
<?php echo $this->element->getElement('widgetCode') ?>
<?php if($this->element->getElement('widgetCode')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('widgetCode')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="locale-label" class="block-display"> <dt id="locale-label" class="block-display">
<label class="required" for="locale"><?php echo $this->element->getElement('locale')->getLabel() ?>: <label class="required" for="locale"><?php echo $this->element->getElement('locale')->getLabel() ?>:
</label> </label>

View file

@ -76,34 +76,6 @@
</ul> </ul>
<?php endif; ?> <?php endif; ?>
</dd> </dd>
<dt id="master_harbor_input_port-label">
<label class="optional" for="master_harbor_input_port"><?php echo $this->element->getElement('master_harbor_input_port')->getLabel() ?> :
</label>
</dt>
<dd id="master_harbor_input_port-element">
<?php echo $this->element->getElement('master_harbor_input_port') ?>
<?php if($this->element->getElement('master_harbor_input_port')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('master_harbor_input_port')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="master_harbor_input_mount_point-label">
<label class="optional" for="master_harbor_input_mount_point"><?php echo $this->element->getElement('master_harbor_input_mount_point')->getLabel() ?> :
</label>
</dt>
<dd id="master_harbor_input_mount_point-element">
<?php echo $this->element->getElement('master_harbor_input_mount_point') ?>
<?php if($this->element->getElement('master_harbor_input_mount_point')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('master_harbor_input_mount_point')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="master_dj_connection_url-label"> <dt id="master_dj_connection_url-label">
<label class="optional" for="master_dj_connection_url" style="white-space: nowrap"> <label class="optional" for="master_dj_connection_url" style="white-space: nowrap">
<?php echo _("Master Source Connection URL:")?> <?php echo _("Master Source Connection URL:")?>
@ -111,43 +83,10 @@
</dt> </dt>
<dd id="master_dj_connection_url-element"> <dd id="master_dj_connection_url-element">
<span id="stream_url"><?php echo $this->element->getElement('master_dj_connection_url')->setValue($this->master_dj_connection_url) ?></span> <span id="stream_url"><?php echo $this->element->getElement('master_dj_connection_url')->setValue($this->master_dj_connection_url) ?></span>
<?php if(!$this->isDemo){?>
<a href=# id="connection_url_override" style="font-size: 12px;"><? echo _("Override") ?></a>&nbsp;&nbsp;
<span class="override_help_icon">
</span><br>
<?php } ?>
<div id="master_dj_connection_url_actions" style="display:none"> <div id="master_dj_connection_url_actions" style="display:none">
<a href=# id="ok" style="font-size: 12px;"><? echo _("OK") ?></a> <a href=# id="reset" style="font-size: 12px;"><? echo _("RESET"); ?></a> <a href=# id="ok" style="font-size: 12px;"><? echo _("OK") ?></a> <a href=# id="reset" style="font-size: 12px;"><? echo _("RESET"); ?></a>
</div> </div>
</dd> </dd>
<dt id="dj_harbor_input_port-label">
<label class="optional" for="dj_harbor_input_port"><?php echo $this->element->getElement('dj_harbor_input_port')->getLabel() ?> :
</label>
</dt>
<dd id="dj_harbor_input_port-element">
<?php echo $this->element->getElement('dj_harbor_input_port') ?>
<?php if($this->element->getElement('dj_harbor_input_port')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('dj_harbor_input_port')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="dj_harbor_input_mount_point-label">
<label class="optional" for="dj_harbor_input_mount_point"><?php echo $this->element->getElement('dj_harbor_input_mount_point')->getLabel() ?> :
</label>
</dt>
<dd id="dj_harbor_input_mount_point-element">
<?php echo $this->element->getElement('dj_harbor_input_mount_point') ?>
<?php if($this->element->getElement('dj_harbor_input_mount_point')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('dj_harbor_input_mount_point')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="live_dj_connection_url-label"> <dt id="live_dj_connection_url-label">
<label class="optional" for="live_dj_connection_url" style="white-space: nowrap"> <label class="optional" for="live_dj_connection_url" style="white-space: nowrap">
<?php echo _("Show Source Connection URL:")?> <?php echo _("Show Source Connection URL:")?>
@ -155,11 +94,6 @@
</dt> </dt>
<dd id="live_dj_connection_url-element"> <dd id="live_dj_connection_url-element">
<span id="stream_url"><?php echo $this->element->getElement('live_dj_connection_url')->setValue($this->live_dj_connection_url) ?></span> <span id="stream_url"><?php echo $this->element->getElement('live_dj_connection_url')->setValue($this->live_dj_connection_url) ?></span>
<?php if( !$this->isDemo ){?>
<a href=# id="connection_url_override" style="font-size: 12px;"><? echo _("Override") ?></a>&nbsp;&nbsp;
<span class="override_help_icon">
</span><br>
<?php } ?>
<div id="live_dj_connection_url_actions" style="display:none"> <div id="live_dj_connection_url_actions" style="display:none">
<a href=# id="ok" style="font-size: 12px;"><? echo _("OK") ?></a> <a href=# id="reset" style="font-size: 12px;"><? echo _("RESET"); ?></a> <a href=# id="ok" style="font-size: 12px;"><? echo _("OK") ?></a> <a href=# id="reset" style="font-size: 12px;"><? echo _("RESET"); ?></a>
</div> </div>

View file

@ -13,19 +13,6 @@
</ul> </ul>
<?php endif; ?> <?php endif; ?>
</dd> </dd>
<dd id="UseSoundCloud-element" class="block-display" style="padding-left:20px; margin:6px 0 10px 0">
<label class="optional" for="UseSoundCloud">
<?php echo $this->element->getElement('UseSoundCloud') ?>
<strong><?php echo $this->element->getElement('UseSoundCloud')->getLabel() ?></strong>
</label>
<?php if($this->element->getElement('UseSoundCloud')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('UseSoundCloud')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dd id="SoundCloudDownloadbleOption-element" class="block-display" style="padding-left:20px; margin:6px 0 10px 0"> <dd id="SoundCloudDownloadbleOption-element" class="block-display" style="padding-left:20px; margin:6px 0 10px 0">
<label class="optional" for="SoundCloudDownloadbleOption"> <label class="optional" for="SoundCloudDownloadbleOption">
<?php echo $this->element->getElement('SoundCloudDownloadbleOption') ?> <?php echo $this->element->getElement('SoundCloudDownloadbleOption') ?>

View file

@ -1,46 +1,5 @@
<fieldset class="padded"> <fieldset class="padded">
<dl class="zend_form"> <dl id="public-info" style="display:<?php echo "block"?>;">
<dd id="SupportFeedback-element" style="width:90%;">
<div class="info-text">
<?php echo sprintf(_("Help Airtime improve by letting Sourcefabric know how you are using it. This information"
." will be collected regularly in order to enhance your user experience.%s"
."Click the 'Send support feedback' box and we'll make sure the features you use are constantly improving."), "<br />")?>
</div>
<label class="optional" for="SupportFeedback">
<?php echo $this->element->getElement('SupportFeedback') ?>
<strong><?php echo $this->element->getElement('SupportFeedback')->getLabel() ?></strong>
</label>
<?php if($this->element->getElement('SupportFeedback')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('SupportFeedback')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dd id="publicize-element" style="width:90%;">
<div class="info-text">
<?php echo sprintf(_("Click the box below to promote your station on %sSourcefabric.org%s."),
"<a id='link_to_whos_using' href='http://www.sourcefabric.org/en/airtime/whosusing/' onclick='window.open(this.href); return false'>",
"</a>")?>
</div>
<label class="optional" for="Publicise">
<?php echo $this->element->getElement('Publicise') ?>
<strong><?php echo $this->element->getElement('Publicise')->getLabel() ?></strong>
</label>
<?php if($this->element->getElement('Publicise')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('Publicise')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
</dl>
<div class="info-text" style="clear: both;padding: 4px 0 4px 15px;">
<?php echo _("(In order to promote your station, 'Send support feedback' must be enabled).")?><br /><br />
</div>
<dl id="public-info" style="display:<?php echo "none"?>;">
<dt id="stationName-label" class="block-display"> <dt id="stationName-label" class="block-display">
<label class="required" for="stationName"><?php echo $this->element->getElement('stationName')->getLabel() ?> <label class="required" for="stationName"><?php echo $this->element->getElement('stationName')->getLabel() ?>
<span class="info-text-small"><?php echo _("(Required)")?></span>: <span class="info-text-small"><?php echo _("(Required)")?></span>:
@ -159,31 +118,4 @@
<?php endif; ?> <?php endif; ?>
</dd> </dd>
</dl> </dl>
<div id="show_what_sending" style="display: block;">
<fieldset class="display_field toggle closed">
<legend style="cursor: pointer;"><span class="ui-icon ui-icon-triangle-2-n-s"></span><? echo _("Show me what I am sending ") ?></legend>
<dl>
<?php echo $this->element->getElement('SendInfo') ?>
</dl>
</fieldset>
</div>
<div>
<br>
<?php if(!$this->element->getView()->privacyChecked){?>
<label class="optional" for="Privacy">
<?php echo $this->element->getElement('Privacy') ?>
<?php echo $this->element->getElement('Privacy')->getLabel() ?>
</label>
<?php if($this->element->getElement('Privacy')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('Privacy')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php }else{?>
<a id="link_to_terms_and_condition" href="http://www.sourcefabric.org/en/about/policy/" onclick="window.open(this.href); return false;"><? echo _("Sourcefabric Privacy Policy") ?></a>
<?php }?>
</div>
</fieldset> </fieldset>

View file

@ -7,7 +7,10 @@
<span class="down"><?php echo _($page->getLabel()); ?></span> <span class="down"><?php echo _($page->getLabel()); ?></span>
</a> </a>
<ul class="sub"> <ul class="sub">
<?php foreach ($page->getPages() as $sub) : ?> <?php foreach ($page->getPages() as $sub) :
if($sub->getId() == "manage_folder"){
continue;
} ?>
<li> <li>
<a href="<?php echo $sub->getHref(); ?>" <?php echo ($sub->getTarget() != "")?"target=\"".$sub->getTarget()."\"":""; ?>><?php echo _($sub->getLabel()); ?></a> <a href="<?php echo $sub->getHref(); ?>" <?php echo ($sub->getTarget() != "")?"target=\"".$sub->getTarget()."\"":""; ?>><?php echo _($sub->getLabel()); ?></a>
</li> </li>

View file

@ -20,12 +20,6 @@
<div id="live-stream-override" class="collapsible-content"> <div id="live-stream-override" class="collapsible-content">
<?php echo $this->live; ?> <?php echo $this->live; ?>
</div> </div>
<h3 class="collapsible-header"><span class="arrow-icon"></span><? echo _("Record & Rebroadcast")?></h3>
<div id="schedule-record-rebroadcast" class="collapsible-content">
<?php echo $this->rr; ?>
<?php echo $this->absoluteRebroadcast; ?>
<?php echo $this->rebroadcast; ?>
</div>
<h3 class="collapsible-header"><span class="arrow-icon"></span><? echo _("Who") ?></h3> <h3 class="collapsible-header"><span class="arrow-icon"></span><? echo _("Who") ?></h3>
<div id="schedule-show-who" class="collapsible-content"> <div id="schedule-show-who" class="collapsible-content">
<?php echo $this->who; ?> <?php echo $this->who; ?>

View file

@ -4,15 +4,6 @@ php_value request_order "GPC"
php_value session.gc_probability 0 php_value session.gc_probability 0
php_value session.auto_start 0 php_value session.auto_start 0
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
#RewriteBase /
AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/xml

View file

@ -12,7 +12,6 @@ function exception_error_handler($errno, $errstr, $errfile, $errline)
throw new ErrorException($errstr, $errno, 0, $errfile, $errline); throw new ErrorException($errstr, $errno, 0, $errfile, $errline);
return false; return false;
} }
set_error_handler("exception_error_handler");
// Define path to application directory // Define path to application directory
defined('APPLICATION_PATH') defined('APPLICATION_PATH')
@ -48,31 +47,8 @@ if (file_exists('/usr/share/php/libzend-framework-php')) {
require_once 'Zend/Application.php'; require_once 'Zend/Application.php';
$application = new Zend_Application( $application = new Zend_Application(
APPLICATION_ENV, APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini' $_SERVER["AIRTIME_APPINI"]
); );
$application->bootstrap()
require_once (APPLICATION_PATH."/logging/Logging.php"); ->run();
Logging::setLogPath('/var/log/airtime/zendphp.log');
// Create application, bootstrap, and run
try {
$sapi_type = php_sapi_name();
if (substr($sapi_type, 0, 3) == 'cli') {
set_include_path(APPLICATION_PATH . PATH_SEPARATOR . get_include_path());
require_once("Bootstrap.php");
} else {
$application->bootstrap()->run();
}
} catch (Exception $e) {
echo $e->getMessage();
echo "<pre>";
echo $e->getTraceAsString();
echo "</pre>";
Logging::info($e->getMessage());
if (VERBOSE_STACK_TRACE) {
Logging::info($e->getTraceAsString());
} else {
Logging::info($e->getTrace());
}
}

View file

@ -80,6 +80,49 @@ function setMsAuthenticationFieldsReadonly(ele) {
} }
} }
function setCollapsibleWidgetJsCode() {
var x = function() {
var val = $('input:radio[name=thirdPartyApi]:checked').val();
if (val == "1") {
//show js textarea
$('#widgetCode-label').show("fast");
$('#widgetCode-element').show("fast");
} else {
//hide js textarea
$('#widgetCode-label').hide("fast");
$('#widgetCode-element').hide("fast");
}
}
x();
$('#thirdPartyApi-element input').click(x);
}
function createWidgetHelpDescription() {
$('#thirdPartyApiInfo').qtip({
content: {
text: "Enabling this feature will allow Airtime to " +
"provide schedule data to external widgets that can be embedded " +
"in your website. Enable this feature to reveal the embeddable " +
"code."
},
hide: {
delay: 500,
fixed: true
},
style: {
border: {
width: 0,
radius: 4
},
classes: "ui-tooltip-dark ui-tooltip-rounded"
},
position: {
my: "left bottom",
at: "right center"
},
});
}
function setSoundCloudCheckBoxListener() { function setSoundCloudCheckBoxListener() {
var subCheckBox= $("#UseSoundCloud,#SoundCloudDownloadbleOption"); var subCheckBox= $("#UseSoundCloud,#SoundCloudDownloadbleOption");
var mainCheckBox= $("#UploadToSoundcloudOption"); var mainCheckBox= $("#UploadToSoundcloudOption");
@ -126,4 +169,6 @@ $(document).ready(function() {
setSystemFromEmailReadonly(); setSystemFromEmailReadonly();
setConfigureMailServerListener(); setConfigureMailServerListener();
setEnableSystemEmailsListener(); setEnableSystemEmailsListener();
setCollapsibleWidgetJsCode();
createWidgetHelpDescription();
}); });

View file

@ -1,6 +1,18 @@
set daemon 10 # Poll at 10 second intervals set daemon 10 # Poll at 10 second intervals
set logfile /var/log/monit.log set logfile /var/log/monit.log
set mailserver %%mail_server%% port 25
set alert support@airtime.pro
set mail-format {
from: lxc%%instance_id%%@airtime.pro
subject: $ACTION $SERVICE (%%mail_server%%)
message:
Monit: $ACTION $SERVICE
Date: $DATE
Description: $DESCRIPTION.
}
set httpd port 2812 set httpd port 2812
allow admin:$admin_pass allow admin:$admin_pass
allow guest:airtime read-only allow guest:airtime read-only

View file

@ -26,6 +26,10 @@ export LC_ALL=`cat /etc/default/locale | grep "LANG=" | cut -d= -f2 | tr -d "\n\
export TERM=xterm export TERM=xterm
#Nothing to do with Pypo, but for container maintenance. Let's parse the IP address
#so we may more easily manage our instance containers
ifconfig eth0 | egrep -o 'inet addr:([0-9]{1,3}\.){3}[0-9]{1,3}' | cut -d':' -f2 > /etc/airtime_ip_addr
exec python ${pypo_path}/${pypo_script} > /var/log/airtime/pypo/py-interpreter.log 2>&1 exec python ${pypo_path}/${pypo_script} > /var/log/airtime/pypo/py-interpreter.log 2>&1
# EOF # EOF

View file

@ -10,8 +10,9 @@ import time
from api_clients import api_client from api_clients import api_client
class ListenerStat(Thread): class ListenerStat(Thread):
def __init__(self, logger=None): def __init__(self, config, logger=None):
Thread.__init__(self) Thread.__init__(self)
self.config = config
self.api_client = api_client.AirtimeApiClient() self.api_client = api_client.AirtimeApiClient()
if logger is None: if logger is None:
self.logger = logging.getLogger() self.logger = logging.getLogger()
@ -48,12 +49,18 @@ class ListenerStat(Thread):
f = urllib2.urlopen(req) f = urllib2.urlopen(req)
document = f.read() document = f.read()
return document return document
def get_icecast_stats(self, ip): def get_icecast_stats(self, ip):
url = 'http://%(host)s:%(port)s/admin/stats.xml' % ip document = None
document = self.get_stream_server_xml(ip, url) if "airtime.pro" in ip["host"].lower():
url = 'http://%(host)s:%(port)s/stats.xsl' % ip
document = self.get_stream_server_xml(ip, url)
else:
url = 'http://%(host)s:%(port)s/admin/stats.xml' % ip
document = self.get_stream_server_xml(ip, url)
dom = xml.dom.minidom.parseString(document) dom = xml.dom.minidom.parseString(document)
sources = dom.getElementsByTagName("source") sources = dom.getElementsByTagName("source")
@ -156,5 +163,5 @@ if __name__ == "__main__":
# add ch to logger # add ch to logger
#logger.addHandler(ch) #logger.addHandler(ch)
ls = ListenerStat(logger) #ls = ListenerStat(logger=logger)
ls.run() #ls.run()

View file

@ -287,7 +287,7 @@ if __name__ == '__main__':
recorder.daemon = True recorder.daemon = True
recorder.start() recorder.start()
stat = ListenerStat() stat = ListenerStat(config)
stat.daemon = True stat.daemon = True
stat.start() stat.start()

View file

@ -88,30 +88,6 @@ if(Application_Model_Preference::GetSupportFeedback() == '1'){
curl_close($ch); curl_close($ch);
} }
// Get latest version from stat server and store to db
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
$url = 'http://stat.sourcefabric.org/airtime-stats/airtime_latest_version';
//$url = 'http://localhost:9999/index.php?p=airtime';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
if(curl_errno($ch)) {
echo "curl error: " . curl_error($ch) . "\n";
} else {
$resultArray = explode("\n", $result);
if (isset($resultArray[0])) {
Application_Model_Preference::SetLatestVersion($resultArray[0]);
}
if (isset($resultArray[1])) {
Application_Model_Preference::SetLatestLink($resultArray[1]);
}
}
curl_close($ch);
}
/** /**
* Ensures that the user is running this PHP script with root * Ensures that the user is running this PHP script with root