diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index 11fead872..64d7ae4a0 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -76,10 +76,10 @@ class PreferenceController extends Zend_Controller_Action Application_Model_Preference::SetStationWebSite($values["StationWebSite"]); Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]); 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"]); @@ -103,36 +103,36 @@ class PreferenceController extends Zend_Controller_Action $this->view->form = $form; //$form->render($this->view); } - + public function directoryConfigAction() { if(Application_Model_Preference::GetPlanLevel() == 'disabled'){ $request = $this->getRequest(); $baseUrl = $request->getBaseUrl(); - + $this->view->headScript()->appendFile($baseUrl.'/js/serverbrowse/serverbrowser.js','text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/musicdirs.js','text/javascript'); - + $watched_dirs_pref = new Application_Form_WatchedDirPreferences(); - + $this->view->form = $watched_dirs_pref; } } - + public function streamSettingAction() { $request = $this->getRequest(); $baseUrl = $request->getBaseUrl(); - + $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/streamsetting.js','text/javascript'); - + // get current settings $temp = Application_Model_StreamSetting::getStreamSetting(); $setting = array(); foreach ($temp as $t){ $setting[$t['keyname']] = $t['value']; } - + // get predefined type and bitrate from pref table $temp_types = Application_Model_Preference::GetStreamType(); $stream_types = array(); @@ -144,7 +144,7 @@ class PreferenceController extends Zend_Controller_Action } $stream_types[trim($type)] = $temp; } - + $temp_bitrate = Application_Model_Preference::GetStreamBitrate(); $max_bitrate = intval(Application_Model_Preference::GetMaxBitrate()); $stream_bitrates = array(); @@ -153,7 +153,7 @@ class PreferenceController extends Zend_Controller_Action $stream_bitrates[trim($type)] = strtoupper(trim($type))." Kbit/s"; } } - + $num_of_stream = intval(Application_Model_Preference::GetNumOfStreams()); $form = new Application_Form_StreamSetting(); $form->setSetting($setting); @@ -193,7 +193,7 @@ class PreferenceController extends Zend_Controller_Action } } $this->view->num_stream = $num_of_stream; - $this->view->disable_stream_conf = Application_Model_Preference::GetDisableStreamConf(); + $this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf(); $this->view->form = $form; } @@ -273,7 +273,7 @@ class PreferenceController extends Zend_Controller_Action $watched_dirs_form = new Application_Form_WatchedDirPreferences(); $this->view->subform = $watched_dirs_form->render(); } - + public function isImportInProgressAction(){ $now = time(); $res = false; diff --git a/airtime_mvc/application/forms/StreamSetting.php b/airtime_mvc/application/forms/StreamSetting.php index 746215b11..cb7735cb5 100644 --- a/airtime_mvc/application/forms/StreamSetting.php +++ b/airtime_mvc/application/forms/StreamSetting.php @@ -3,29 +3,29 @@ class Application_Form_StreamSetting extends Zend_Form { private $setting; - + public function init() { - + } - + public function setSetting($setting){ $this->setting = $setting; } - - public function startFrom(){ + + public function startFrom() { $setting = $this->setting; $output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device'); $output_sound_device->setLabel('Enabled') ->setRequired(false) ->setValue(($setting['output_sound_device'] == "true")?1:0) ->setDecorators(array('ViewHelper')); - if(Application_Model_Preference::GetDisableStreamConf() == "true"){ + if (Application_Model_Preference::GetEnableStreamConf() == "false"){ $output_sound_device->setAttrib("readonly", true); } $this->addElement($output_sound_device); } - + public function isValid($data){ $this->populate(array("output_sound_device"=>$data)); return true; diff --git a/airtime_mvc/application/forms/StreamSettingSubForm.php b/airtime_mvc/application/forms/StreamSettingSubForm.php index 5a3e37e65..c8398d806 100644 --- a/airtime_mvc/application/forms/StreamSettingSubForm.php +++ b/airtime_mvc/application/forms/StreamSettingSubForm.php @@ -4,43 +4,43 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{ private $setting; private $stream_types; private $stream_bitrates; - + public function init() { - + } - + public function setPrefix($prefix){ $this->prefix = $prefix; } - + public function setSetting($setting){ $this->setting = $setting; } - + public function setStreamTypes($stream_types){ $this->stream_types = $stream_types; } - + public function setStreamBitrates($stream_bitrates){ $this->stream_bitrates = $stream_bitrates; } - + public function startForm(){ $prefix = "s".$this->prefix; $stream_number = $this->prefix; $setting = $this->setting; $stream_types = $this->stream_types; $stream_bitrates = $this->stream_bitrates; - + $this->setIsArray(true); $this->setElementsBelongTo($prefix."_data"); - + $disable_all = false; - if(Application_Model_Preference::GetDisableStreamConf() == "true"){ + if(Application_Model_Preference::GetEnableStreamConf() == "false"){ $disable_all = true; } - + $enable = new Zend_Form_Element_Checkbox('enable'); $enable->setLabel('Enabled:') ->setValue($setting[$prefix.'_output'] != 'disabled'?1:0) @@ -49,7 +49,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{ $enable->setAttrib("disabled", "disabled"); } $this->addElement($enable); - + $type = new Zend_Form_Element_Select('type'); $type->setLabel("Stream Type:") ->setMultiOptions($stream_types) @@ -59,7 +59,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{ $type->setAttrib("disabled", "disabled"); } $this->addElement($type); - + $bitrate = new Zend_Form_Element_Select('bitrate'); $bitrate->setLabel("Bit Rate:") ->setMultiOptions($stream_bitrates) @@ -70,7 +70,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{ } $this->addElement($type); $this->addElement($bitrate); - + $output = new Zend_Form_Element_Select('output'); $output->setLabel("Service Type:") ->setMultiOptions(array("icecast"=>"Icecast", "shoutcast"=>"Shoutcast")) @@ -80,7 +80,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{ $output->setAttrib("disabled", "disabled"); } $this->addElement($output); - + $host = new Zend_Form_Element_Text('host'); $host->setLabel("Server") ->setValue(isset($setting[$prefix.'_host'])?$setting[$prefix.'_host']:"") @@ -89,7 +89,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{ $host->setAttrib("disabled", "disabled"); } $this->addElement($host); - + $port = new Zend_Form_Element_Text('port'); $port->setLabel("Port") ->setValue(isset($setting[$prefix.'_port'])?$setting[$prefix.'_port']:"") @@ -100,7 +100,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{ $port->setAttrib("disabled", "disabled"); } $this->addElement($port); - + $pass = new Zend_Form_Element_Text('pass'); $pass->setLabel("Password") ->setValue(isset($setting[$prefix.'_pass'])?$setting[$prefix.'_pass']:"") @@ -109,7 +109,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{ $pass->setAttrib("disabled", "disabled"); } $this->addElement($pass); - + $genre = new Zend_Form_Element_Text('genre'); $genre->setLabel("Genre") ->setValue(isset($setting[$prefix.'_genre'])?$setting[$prefix.'_genre']:"") @@ -118,7 +118,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{ $genre->setAttrib("disabled", "disabled"); } $this->addElement($genre); - + $url = new Zend_Form_Element_Text('url'); $url->setLabel("URL") ->setValue(isset($setting[$prefix.'_url'])?$setting[$prefix.'_url']:"") @@ -127,7 +127,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{ $url->setAttrib("disabled", "disabled"); } $this->addElement($url); - + $description = new Zend_Form_Element_Text('description'); $description->setLabel("Name/Description") ->setValue(isset($setting[$prefix.'_description'])?$setting[$prefix.'_description']:"") @@ -136,7 +136,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{ $description->setAttrib("disabled", "disabled"); } $this->addElement($description); - + $mount = new Zend_Form_Element_Text('mount'); $mount->setLabel("Mount Point") ->setValue(isset($setting[$prefix.'_mount'])?$setting[$prefix.'_mount']:"") @@ -145,7 +145,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{ $mount->setAttrib("disabled", "disabled"); } $this->addElement($mount); - + $user = new Zend_Form_Element_Text('user'); $user->setLabel("Username") ->setValue(isset($setting[$prefix.'_user'])?$setting[$prefix.'_user']:"") @@ -154,12 +154,12 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{ $user->setAttrib("disabled", "disabled"); } $this->addElement($user); - + $this->setDecorators(array( array('ViewScript', array('viewScript' => 'form/stream-setting-form.phtml', "stream_number"=>$stream_number)) )); } - + public function isValid ($data){ $isValid = parent::isValid($data); if($data['enable'] == 1){ diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index 513067b79..bd55a28eb 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -259,13 +259,13 @@ class Application_Model_Preference public static function GetStationDescription(){ return self::GetValue("description"); } - + public static function SetTimezone($timezone){ self::SetValue("timezone", $timezone); date_default_timezone_set($timezone); $md = array("timezone" => $timezone); } - + public static function GetTimezone(){ return self::GetValue("timezone"); } @@ -328,11 +328,11 @@ class Application_Model_Preference $url = $systemInfoArray["AIRTIME_VERSION_URL"]; $index = strpos($url,'/api/'); $url = substr($url, 0, $index); - + $headerInfo = get_headers(trim($url),1); $outputArray['WEB_SERVER'] = $headerInfo['Server'][0]; } - + $outputArray['NUM_OF_USERS'] = Application_Model_User::getUserCount(); $outputArray['NUM_OF_SONGS'] = Application_Model_StoredFile::getFileCount(); $outputArray['NUM_OF_PLAYLISTS'] = Application_Model_Playlist::getPlaylistCount(); @@ -365,74 +365,74 @@ class Application_Model_Preference public static function GetRemindMeDate(){ return self::GetValue("remindme"); } - + public static function SetImportTimestamp(){ $now = time(); if(self::GetImportTimestamp()+5 < $now){ self::SetValue("import_timestamp", $now); } } - + public static function GetImportTimestamp(){ return self::GetValue("import_timestamp"); } - + public static function GetStreamType(){ $st = self::GetValue("stream_type"); return explode(',', $st); } - + public static function GetStreamBitrate(){ $sb = self::GetValue("stream_bitrate"); return explode(',', $sb); } - + public static function SetPrivacyPolicyCheck($flag){ self::SetValue("privacy_policy", $flag); } - + public static function GetPrivacyPolicyCheck(){ return self::GetValue("privacy_policy"); } - + public static function SetNumOfStreams($num){ self::SetValue("num_of_streams", intval($num)); } - + public static function GetNumOfStreams(){ return self::GetValue("num_of_streams"); } - + public static function SetMaxBitrate($bitrate){ self::SetValue("max_bitrate", intval($bitrate)); } - + public static function GetMaxBitrate(){ return self::GetValue("max_bitrate"); } - + public static function SetPlanLevel($plan){ self::SetValue("plan_level", $plan); } - + public static function GetPlanLevel(){ return self::GetValue("plan_level"); } - + public static function SetTrialEndingDate($date){ self::SetValue("trial_end_date", $date); } - + public static function GetTrialEndingDate(){ return self::GetValue("trial_end_date"); } - - public static function SetDisableStreamConf($bool){ - self::SetValue("disable_stream_conf", $bool); + + public static function SetEnableStreamConf($bool){ + self::SetValue("enable_stream_conf", $bool); } - - public static function GetDisableStreamConf(){ - return self::GetValue("disable_stream_conf"); + + public static function GetEnableStreamConf(){ + return self::GetValue("enable_stream_conf"); } public static function GetAirtimeVersion(){ diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index db73f4278..4bb172c8b 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -958,7 +958,7 @@ class Application_Model_StoredFile { $this->setSoundCloudErrorCode($code); $this->setSoundCloudErrorMsg($msg); // setting sc id to -3 which indicates error - $this->setSoundCloudFileId(-3); + $this->setSoundCloudFileId(SOUNDCLOUD_ERROR); if(!in_array($code, array(0, 100))) { break; } diff --git a/airtime_mvc/application/views/scripts/preference/stream-setting.phtml b/airtime_mvc/application/views/scripts/preference/stream-setting.phtml index 68436f7b9..aa413857b 100644 --- a/airtime_mvc/application/views/scripts/preference/stream-setting.phtml +++ b/airtime_mvc/application/views/scripts/preference/stream-setting.phtml @@ -1,6 +1,6 @@

Stream Settings

- disable_stream_conf != "true"){?> + enable_stream_conf == "true"){?>
@@ -22,11 +22,11 @@ num_stream;$i++){ + for($i=1;$i<=$this->num_stream;$i++){ echo $this->form->getSubform("s".$i."_subform"); } ?> - disable_stream_conf != "true"){?> + enable_stream_conf == "true"){?>
diff --git a/python_apps/icecast2/airtime-icecast2-status.xsl b/python_apps/icecast2/airtime-icecast-status.xsl similarity index 100% rename from python_apps/icecast2/airtime-icecast2-status.xsl rename to python_apps/icecast2/airtime-icecast-status.xsl diff --git a/python_apps/icecast2/install/icecast-install.py b/python_apps/icecast2/install/icecast2-install.py similarity index 100% rename from python_apps/icecast2/install/icecast-install.py rename to python_apps/icecast2/install/icecast2-install.py