Merge branch 'cc-84-smart-playlist' of dev.sourcefabric.org:airtime into cc-84-smart-playlist
This commit is contained in:
commit
fe75ba0e93
|
@ -83,7 +83,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
|
||||
$view->headScript()->appendFile($baseUrl.'/js/airtime/common/common.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
if (!is_null($user)){
|
||||
$userType = $user->getType();
|
||||
} else {
|
||||
|
|
|
@ -270,18 +270,18 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
$date = new Application_Common_DateHelper;
|
||||
$utcTimeNow = $date->getUtcTimestamp();
|
||||
$utcTimeEnd = ""; // if empty, GetNextShows will use interval instead of end of day
|
||||
$utcTimeEnd = ""; // if empty, getNextShows will use interval instead of end of day
|
||||
|
||||
$request = $this->getRequest();
|
||||
$type = $request->getParam('type');
|
||||
if($type == "endofday") {
|
||||
// make GetNextShows use end of day
|
||||
// make getNextShows use end of day
|
||||
$utcTimeEnd = Application_Common_DateHelper::GetDayEndTimestampInUtc();
|
||||
$result = array("env"=>APPLICATION_ENV,
|
||||
"schedulerTime"=>gmdate("Y-m-d H:i:s"),
|
||||
"nextShow"=>Application_Model_Show::GetNextShows($utcTimeNow, 5, $utcTimeEnd));
|
||||
"nextShow"=>Application_Model_Show::getNextShows($utcTimeNow, 5, $utcTimeEnd));
|
||||
|
||||
Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
Application_Model_Show::convertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
}else{
|
||||
|
||||
$limit = $request->getParam('limit');
|
||||
|
@ -292,8 +292,8 @@ class ApiController extends Zend_Controller_Action
|
|||
$result = Application_Model_Schedule::GetPlayOrderRange();
|
||||
|
||||
//Convert from UTC to localtime for user.
|
||||
Application_Model_Show::ConvertToLocalTimeZone($result["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
Application_Model_Show::convertToLocalTimeZone($result["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
Application_Model_Show::convertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
}
|
||||
|
||||
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; //used by caller to determine if the airtime they are running or widgets in use is out of date.
|
||||
|
@ -324,10 +324,10 @@ class ApiController extends Zend_Controller_Action
|
|||
$result = array();
|
||||
for ($i=0; $i<7; $i++){
|
||||
$utcDayEnd = Application_Common_DateHelper::GetDayEndTimestamp($utcDayStart);
|
||||
$shows = Application_Model_Show::GetNextShows($utcDayStart, "0", $utcDayEnd);
|
||||
$shows = Application_Model_Show::getNextShows($utcDayStart, "0", $utcDayEnd);
|
||||
$utcDayStart = $utcDayEnd;
|
||||
|
||||
Application_Model_Show::ConvertToLocalTimeZone($shows, array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
Application_Model_Show::convertToLocalTimeZone($shows, array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
|
||||
$result[$dow[$i]] = $shows;
|
||||
}
|
||||
|
@ -413,7 +413,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$this->view->server_timezone = Application_Model_Preference::GetTimezone();
|
||||
|
||||
$rows = Application_Model_Show::GetCurrentShow($today_timestamp);
|
||||
Application_Model_Show::ConvertToLocalTimeZone($rows, array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
Application_Model_Show::convertToLocalTimeZone($rows, array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
|
||||
if (count($rows) > 0){
|
||||
$this->view->is_recording = ($rows[0]['record'] == 1);
|
||||
|
|
|
@ -111,7 +111,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
//array containing id and type of media to delete.
|
||||
$mediaItems = $this->_getParam('media', null);
|
||||
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||
|
||||
$files = array();
|
||||
|
@ -204,7 +204,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
public function editFileMdAction()
|
||||
{
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||
if(!$isAdminOrPM){
|
||||
return;
|
||||
|
|
|
@ -186,7 +186,6 @@ class PlaylistController extends Zend_Controller_Action
|
|||
try {
|
||||
$pl = new Application_Model_Playlist($id);
|
||||
$this->createFullResponse($pl);
|
||||
//$this->view->form = $form;
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
$this->playlistNotFound();
|
||||
|
|
|
@ -254,10 +254,10 @@ class PreferenceController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
// extra info that goes into cc_stream_setting
|
||||
Application_Model_StreamSetting::SetMasterLiveSteamPort($values["master_harbor_input_port"]);
|
||||
Application_Model_StreamSetting::SetMasterLiveSteamMountPoint($values["master_harbor_input_mount_point"]);
|
||||
Application_Model_StreamSetting::SetDJLiveSteamPort($values["dj_harbor_input_port"]);
|
||||
Application_Model_StreamSetting::SetDJLiveSteamMountPoint($values["dj_harbor_input_mount_point"]);
|
||||
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"]);
|
||||
}
|
||||
|
||||
// store stream update timestamp
|
||||
|
|
|
@ -90,7 +90,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
Application_Model_Schedule::createNewFormSections($this->view);
|
||||
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
|
||||
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))){
|
||||
$this->view->preloadShowForm = true;
|
||||
|
@ -357,8 +357,8 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$range["next"]["ends"] = Application_Common_DateHelper::ConvertToLocalDateTimeString($range["next"]["ends"]);
|
||||
}
|
||||
|
||||
Application_Model_Show::ConvertToLocalTimeZone($range["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
Application_Model_Show::ConvertToLocalTimeZone($range["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
Application_Model_Show::convertToLocalTimeZone($range["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
Application_Model_Show::convertToLocalTimeZone($range["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
|
||||
$source_status = array();
|
||||
$switch_status = array();
|
||||
|
@ -689,7 +689,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
public function getFormAction() {
|
||||
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
|
||||
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))){
|
||||
Application_Model_Schedule::createNewFormSections($this->view);
|
||||
|
@ -822,7 +822,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
public function cancelShowAction()
|
||||
{
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
|
||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
$showInstanceId = $this->_getParam('id');
|
||||
|
@ -842,7 +842,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
public function cancelCurrentShowAction()
|
||||
{
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
|
||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
$id = $this->_getParam('id');
|
||||
|
|
|
@ -22,12 +22,12 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
|
||||
$userType = $user->getType();
|
||||
$this->view->headScript()->appendScript("localStorage.setItem( 'user-type', '$userType' );");
|
||||
|
||||
$data = Application_Model_Preference::GetValue("library_datatable", true);
|
||||
$data = Application_Model_Preference::getValue("library_datatable", true);
|
||||
if ($data != "") {
|
||||
$libraryTable = json_encode(unserialize($data));
|
||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-library', JSON.stringify($libraryTable) );");
|
||||
|
@ -36,7 +36,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-library', '' );");
|
||||
}
|
||||
|
||||
$data = Application_Model_Preference::GetValue("timeline_datatable", true);
|
||||
$data = Application_Model_Preference::getValue("timeline_datatable", true);
|
||||
if ($data != "") {
|
||||
$timelineTable = json_encode(unserialize($data));
|
||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', JSON.stringify($timelineTable) );");
|
||||
|
@ -130,7 +130,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$showLib = false;
|
||||
if (!$user->isGuest()) {
|
||||
$disableLib = false;
|
||||
$data = Application_Model_Preference::GetValue("nowplaying_screen", true);
|
||||
$data = Application_Model_Preference::getValue("nowplaying_screen", true);
|
||||
if ($data != "") {
|
||||
$settings = unserialize($data);
|
||||
|
||||
|
@ -184,7 +184,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$baseUrl = $request->getBaseUrl();
|
||||
$menu = array();
|
||||
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
|
||||
$item = CcScheduleQuery::create()->findPK($id);
|
||||
$instance = $item->getCcShowInstances();
|
||||
|
|
|
@ -23,12 +23,12 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
$settings = $request->getParam("settings");
|
||||
|
||||
$data = serialize($settings);
|
||||
Application_Model_Preference::SetValue("nowplaying_screen", $data, true);
|
||||
Application_Model_Preference::setValue("nowplaying_screen", $data, true);
|
||||
}
|
||||
|
||||
public function getNowPlayingScreenSettingsAction() {
|
||||
|
||||
$data = Application_Model_Preference::GetValue("nowplaying_screen", true);
|
||||
$data = Application_Model_Preference::getValue("nowplaying_screen", true);
|
||||
if ($data != "") {
|
||||
$this->view->settings = unserialize($data);
|
||||
}
|
||||
|
@ -40,12 +40,12 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
$settings = $request->getParam("settings");
|
||||
|
||||
$data = serialize($settings);
|
||||
Application_Model_Preference::SetValue("library_datatable", $data, true);
|
||||
Application_Model_Preference::setValue("library_datatable", $data, true);
|
||||
}
|
||||
|
||||
public function getLibraryDatatableAction() {
|
||||
|
||||
$data = Application_Model_Preference::GetValue("library_datatable", true);
|
||||
$data = Application_Model_Preference::getValue("library_datatable", true);
|
||||
if ($data != "") {
|
||||
$this->view->settings = unserialize($data);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
$settings = $request->getParam("settings");
|
||||
|
||||
$data = serialize($settings);
|
||||
Application_Model_Preference::SetValue("timeline_datatable", $data, true);
|
||||
Application_Model_Preference::setValue("timeline_datatable", $data, true);
|
||||
|
||||
$end = microtime(true);
|
||||
|
||||
|
@ -71,7 +71,7 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
|
||||
$start = microtime(true);
|
||||
|
||||
$data = Application_Model_Preference::GetValue("timeline_datatable", true);
|
||||
$data = Application_Model_Preference::getValue("timeline_datatable", true);
|
||||
if ($data != "") {
|
||||
$this->view->settings = unserialize($data);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
|||
{
|
||||
// retrieves the length limit for each char field
|
||||
// and store to assoc array
|
||||
$maxLens = Application_Model_Show::GetMaxLengths();
|
||||
$maxLens = Application_Model_Show::getMaxLengths();
|
||||
|
||||
// Hidden element to indicate whether the show is new or
|
||||
// whether we are updating an existing show.
|
||||
|
|
|
@ -86,6 +86,9 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
public function checkReliantFields($formData, $validateStartDate, $originalStartDate=null, $update=false, $instanceId=null) {
|
||||
$valid = true;
|
||||
|
||||
$hours;
|
||||
$minutes;
|
||||
|
||||
$start_time = $formData['add_show_start_date']." ".$formData['add_show_start_time'];
|
||||
$end_time = $formData['add_show_end_date_no_repeat']." ".$formData['add_show_end_time'];
|
||||
|
||||
|
@ -148,12 +151,114 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
$show_end = new DateTime($end_time);
|
||||
$show_end->setTimezone(new DateTimeZone('UTC'));
|
||||
|
||||
if ($formData["add_show_repeats"]) {
|
||||
|
||||
//get repeating show end date
|
||||
if ($formData["add_show_no_end"]) {
|
||||
$date = Application_Model_Preference::GetShowsPopulatedUntil();
|
||||
|
||||
if (is_null($date)) {
|
||||
$populateUntilDateTime = new DateTime("now", new DateTimeZone('UTC'));
|
||||
Application_Model_Preference::SetShowsPopulatedUntil($populateUntilDateTime);
|
||||
} else {
|
||||
$populateUntilDateTime = clone $date;
|
||||
}
|
||||
|
||||
} elseif (!$formData["add_show_no_end"]) {
|
||||
$popUntil = $formData["add_show_end_date"]." ".$formData["add_show_end_time"];
|
||||
$populateUntilDateTime = new DateTime($popUntil, new DateTimeZone('UTC'));
|
||||
}
|
||||
|
||||
//get repeat interval
|
||||
if ($formData["add_show_repeat_type"] == 0) {
|
||||
$interval = 'P7D';
|
||||
} elseif ($formData["add_show_repeat_type"] == 1) {
|
||||
$interval = 'P14D';
|
||||
} elseif ($formData["add_show_repeat_type"] == 2) {
|
||||
$interval = 'P1M';
|
||||
}
|
||||
|
||||
/* Check first show
|
||||
* Continue if the first show does not overlap
|
||||
*/
|
||||
$overlapping = Application_Model_Schedule::checkOverlappingShows($show_start, $show_end, $update, $instanceId);
|
||||
|
||||
/* Check if repeats overlap with previously scheduled shows
|
||||
* Do this for each show day
|
||||
*/
|
||||
if (!$overlapping) {
|
||||
$startDow = date("w", $show_start->getTimestamp());
|
||||
foreach($formData["add_show_day_check"] as $day) {
|
||||
$repeatShowStart = clone $show_start;
|
||||
$repeatShowEnd = clone $show_end;
|
||||
$daysAdd=0;
|
||||
if ($startDow !== $day){
|
||||
if ($startDow > $day)
|
||||
$daysAdd = 6 - $startDow + 1 + $day;
|
||||
else
|
||||
$daysAdd = $day - $startDow;
|
||||
|
||||
$repeatShowStart->add(new DateInterval("P".$daysAdd."D"));
|
||||
$repeatShowEnd->add(new DateInterval("P".$daysAdd."D"));
|
||||
}
|
||||
while ($repeatShowStart->getTimestamp() < $populateUntilDateTime->getTimestamp()) {
|
||||
$overlapping = Application_Model_Schedule::checkOverlappingShows($repeatShowStart, $repeatShowEnd, $update, $instanceId);
|
||||
if ($overlapping) {
|
||||
$valid = false;
|
||||
$this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows'));
|
||||
break 1;
|
||||
} else {
|
||||
$repeatShowStart->add(new DateInterval($interval));
|
||||
$repeatShowEnd->add(new DateInterval($interval));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$valid = false;
|
||||
$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) {
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
$hours = ltrim($hours, '0');
|
||||
if ($minutes != "00") {
|
||||
$minutes = ltrim($minutes, '0');
|
||||
$durationToAdd = "PT".$hours."H".$minutes."I";
|
||||
} else {
|
||||
$minutes = "0";
|
||||
$durationToAdd = "PT".$hours."H";
|
||||
}
|
||||
|
||||
$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, $instanceId);
|
||||
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 {
|
||||
$overlapping = Application_Model_Schedule::checkOverlappingShows($show_start, $show_end, $update, $instanceId);
|
||||
if ($overlapping) {
|
||||
$this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows'));
|
||||
$valid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $valid;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
|||
'label' => 'Station Name',
|
||||
'required' => false,
|
||||
'filters' => array('StringTrim'),
|
||||
'value' => Application_Model_Preference::GetValue("station_name"),
|
||||
'value' => Application_Model_Preference::getValue("station_name"),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
|
|
|
@ -83,7 +83,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
|||
|
||||
//liquidsoap harbor.input port
|
||||
if (!$isSaas) {
|
||||
$m_port = Application_Model_StreamSetting::GetMasterLiveSteamPort();
|
||||
$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)
|
||||
|
@ -92,7 +92,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
|||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($master_dj_port);
|
||||
|
||||
$m_mount = Application_Model_StreamSetting::GetMasterLiveSteamMountPoint();
|
||||
$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)
|
||||
|
@ -102,7 +102,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
|||
$this->addElement($master_dj_mount);
|
||||
|
||||
//liquidsoap harbor.input port
|
||||
$l_port = Application_Model_StreamSetting::GetDJLiveSteamPort();
|
||||
$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)
|
||||
|
@ -111,7 +111,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
|||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($live_dj_port);
|
||||
|
||||
$l_mount = Application_Model_StreamSetting::GetDJLiveSteamMountPoint();
|
||||
$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)
|
||||
|
@ -159,7 +159,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
|||
}
|
||||
if($master_harbor_input_port != ""){
|
||||
if(is_numeric($master_harbor_input_port)){
|
||||
if($master_harbor_input_port != Application_Model_StreamSetting::GetMasterLiveSteamPort()){
|
||||
if($master_harbor_input_port != Application_Model_StreamSetting::getMasterLiveStreamPort()){
|
||||
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
||||
$res = socket_bind($sock, 0, $master_harbor_input_port);
|
||||
if(!$res){
|
||||
|
@ -175,7 +175,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
|||
}
|
||||
if($dj_harbor_input_port != ""){
|
||||
if(is_numeric($dj_harbor_input_port)){
|
||||
if($dj_harbor_input_port != Application_Model_StreamSetting::GetDJLiveSteamPort()){
|
||||
if($dj_harbor_input_port != Application_Model_StreamSetting::getDjLiveStreamPort()){
|
||||
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
||||
$res = socket_bind($sock, 0, $dj_harbor_input_port);
|
||||
if(!$res){
|
||||
|
|
|
@ -5,7 +5,7 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
|
|||
|
||||
public function init()
|
||||
{
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/showbuilder.phtml'))
|
||||
|
|
|
@ -24,7 +24,7 @@ class Application_Form_SupportSettings extends Zend_Form
|
|||
'required' => true,
|
||||
'filters' => array('StringTrim'),
|
||||
'validator' => array('NotEmpty'),
|
||||
'value' => Application_Model_Preference::GetValue("station_name"),
|
||||
'value' => Application_Model_Preference::getValue("station_name"),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class Application_Model_Preference
|
||||
{
|
||||
|
||||
public static function SetValue($key, $value, $isUserValue = false){
|
||||
public static function setValue($key, $value, $isUserValue = false){
|
||||
try {
|
||||
$con = Propel::getConnection();
|
||||
|
||||
|
@ -72,7 +72,7 @@ class Application_Model_Preference
|
|||
|
||||
}
|
||||
|
||||
public static function GetValue($key, $isUserValue = false){
|
||||
public static function getValue($key, $isUserValue = false){
|
||||
try {
|
||||
$con = Propel::getConnection();
|
||||
|
||||
|
@ -110,7 +110,7 @@ class Application_Model_Preference
|
|||
}
|
||||
|
||||
public static function GetHeadTitle(){
|
||||
$title = self::GetValue("station_name");
|
||||
$title = self::getValue("station_name");
|
||||
$defaultNamespace->title = $title;
|
||||
if (strlen($title) > 0)
|
||||
$title .= " - ";
|
||||
|
@ -119,7 +119,7 @@ class Application_Model_Preference
|
|||
}
|
||||
|
||||
public static function SetHeadTitle($title, $view=null){
|
||||
self::SetValue("station_name", $title);
|
||||
self::setValue("station_name", $title);
|
||||
|
||||
// in case this is called from airtime-saas script
|
||||
if($view !== null){
|
||||
|
@ -143,7 +143,7 @@ class Application_Model_Preference
|
|||
* A row from cc_show_days table
|
||||
*/
|
||||
public static function SetShowsPopulatedUntil($dateTime) {
|
||||
self::SetValue("shows_populated_until", $dateTime->format("Y-m-d H:i:s"));
|
||||
self::setValue("shows_populated_until", $dateTime->format("Y-m-d H:i:s"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -156,7 +156,7 @@ class Application_Model_Preference
|
|||
* @return DateTime (in UTC Timezone)
|
||||
*/
|
||||
public static function GetShowsPopulatedUntil() {
|
||||
$date = self::GetValue("shows_populated_until");
|
||||
$date = self::getValue("shows_populated_until");
|
||||
|
||||
if ($date == ""){
|
||||
return null;
|
||||
|
@ -166,11 +166,11 @@ class Application_Model_Preference
|
|||
}
|
||||
|
||||
public static function SetDefaultFade($fade) {
|
||||
self::SetValue("default_fade", $fade);
|
||||
self::setValue("default_fade", $fade);
|
||||
}
|
||||
|
||||
public static function GetDefaultFade() {
|
||||
$fade = self::GetValue("default_fade");
|
||||
$fade = self::getValue("default_fade");
|
||||
|
||||
if ($fade === "") {
|
||||
// the default value of the fade is 00.500000
|
||||
|
@ -195,7 +195,7 @@ class Application_Model_Preference
|
|||
}
|
||||
|
||||
public static function SetDefaultTransitionFade($fade) {
|
||||
self::SetValue("default_transition_fade", $fade);
|
||||
self::setValue("default_transition_fade", $fade);
|
||||
|
||||
$eventType = "update_transition_fade";
|
||||
$md = array("transition_fade"=>$fade);
|
||||
|
@ -203,7 +203,7 @@ class Application_Model_Preference
|
|||
}
|
||||
|
||||
public static function GetDefaultTransitionFade() {
|
||||
$transition_fade = self::GetValue("default_transition_fade");
|
||||
$transition_fade = self::getValue("default_transition_fade");
|
||||
if($transition_fade == ""){
|
||||
$transition_fade = "00.000000";
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ class Application_Model_Preference
|
|||
}
|
||||
|
||||
public static function SetStreamLabelFormat($type){
|
||||
self::SetValue("stream_label_format", $type);
|
||||
self::setValue("stream_label_format", $type);
|
||||
|
||||
$eventType = "update_stream_format";
|
||||
$md = array("stream_format"=>$type);
|
||||
|
@ -228,68 +228,68 @@ class Application_Model_Preference
|
|||
}
|
||||
|
||||
public static function SetAutoUploadRecordedShowToSoundcloud($upload) {
|
||||
self::SetValue("soundcloud_auto_upload_recorded_show", $upload);
|
||||
self::setValue("soundcloud_auto_upload_recorded_show", $upload);
|
||||
}
|
||||
|
||||
public static function GetAutoUploadRecordedShowToSoundcloud() {
|
||||
return self::GetValue("soundcloud_auto_upload_recorded_show");
|
||||
return self::getValue("soundcloud_auto_upload_recorded_show");
|
||||
}
|
||||
|
||||
public static function SetSoundCloudUser($user) {
|
||||
self::SetValue("soundcloud_user", $user);
|
||||
self::setValue("soundcloud_user", $user);
|
||||
}
|
||||
|
||||
public static function GetSoundCloudUser() {
|
||||
return self::GetValue("soundcloud_user");
|
||||
return self::getValue("soundcloud_user");
|
||||
}
|
||||
|
||||
public static function SetSoundCloudPassword($password) {
|
||||
if (strlen($password) > 0)
|
||||
self::SetValue("soundcloud_password", $password);
|
||||
self::setValue("soundcloud_password", $password);
|
||||
}
|
||||
|
||||
public static function GetSoundCloudPassword() {
|
||||
return self::GetValue("soundcloud_password");
|
||||
return self::getValue("soundcloud_password");
|
||||
}
|
||||
|
||||
public static function SetSoundCloudTags($tags) {
|
||||
self::SetValue("soundcloud_tags", $tags);
|
||||
self::setValue("soundcloud_tags", $tags);
|
||||
}
|
||||
|
||||
public static function GetSoundCloudTags() {
|
||||
return self::GetValue("soundcloud_tags");
|
||||
return self::getValue("soundcloud_tags");
|
||||
}
|
||||
|
||||
public static function SetSoundCloudGenre($genre) {
|
||||
self::SetValue("soundcloud_genre", $genre);
|
||||
self::setValue("soundcloud_genre", $genre);
|
||||
}
|
||||
|
||||
public static function GetSoundCloudGenre() {
|
||||
return self::GetValue("soundcloud_genre");
|
||||
return self::getValue("soundcloud_genre");
|
||||
}
|
||||
|
||||
public static function SetSoundCloudTrackType($track_type) {
|
||||
self::SetValue("soundcloud_tracktype", $track_type);
|
||||
self::setValue("soundcloud_tracktype", $track_type);
|
||||
}
|
||||
|
||||
public static function GetSoundCloudTrackType() {
|
||||
return self::GetValue("soundcloud_tracktype");
|
||||
return self::getValue("soundcloud_tracktype");
|
||||
}
|
||||
|
||||
public static function SetSoundCloudLicense($license) {
|
||||
self::SetValue("soundcloud_license", $license);
|
||||
self::setValue("soundcloud_license", $license);
|
||||
}
|
||||
|
||||
public static function GetSoundCloudLicense() {
|
||||
return self::GetValue("soundcloud_license");
|
||||
return self::getValue("soundcloud_license");
|
||||
}
|
||||
|
||||
public static function SetAllow3rdPartyApi($bool) {
|
||||
self::SetValue("third_party_api", $bool);
|
||||
self::setValue("third_party_api", $bool);
|
||||
}
|
||||
|
||||
public static function GetAllow3rdPartyApi() {
|
||||
$val = self::GetValue("third_party_api");
|
||||
$val = self::getValue("third_party_api");
|
||||
if (strlen($val) == 0){
|
||||
return "0";
|
||||
} else {
|
||||
|
@ -298,101 +298,101 @@ class Application_Model_Preference
|
|||
}
|
||||
|
||||
public static function SetPhone($phone){
|
||||
self::SetValue("phone", $phone);
|
||||
self::setValue("phone", $phone);
|
||||
}
|
||||
|
||||
public static function GetPhone(){
|
||||
return self::GetValue("phone");
|
||||
return self::getValue("phone");
|
||||
}
|
||||
|
||||
public static function SetEmail($email){
|
||||
self::SetValue("email", $email);
|
||||
self::setValue("email", $email);
|
||||
}
|
||||
|
||||
public static function GetEmail(){
|
||||
return self::GetValue("email");
|
||||
return self::getValue("email");
|
||||
}
|
||||
|
||||
public static function SetStationWebSite($site){
|
||||
self::SetValue("station_website", $site);
|
||||
self::setValue("station_website", $site);
|
||||
}
|
||||
|
||||
public static function GetStationWebSite(){
|
||||
return self::GetValue("station_website");
|
||||
return self::getValue("station_website");
|
||||
}
|
||||
|
||||
public static function SetSupportFeedback($feedback){
|
||||
self::SetValue("support_feedback", $feedback);
|
||||
self::setValue("support_feedback", $feedback);
|
||||
}
|
||||
|
||||
public static function GetSupportFeedback(){
|
||||
return self::GetValue("support_feedback");
|
||||
return self::getValue("support_feedback");
|
||||
}
|
||||
|
||||
public static function SetPublicise($publicise){
|
||||
self::SetValue("publicise", $publicise);
|
||||
self::setValue("publicise", $publicise);
|
||||
}
|
||||
|
||||
public static function GetPublicise(){
|
||||
return self::GetValue("publicise");
|
||||
return self::getValue("publicise");
|
||||
}
|
||||
|
||||
public static function SetRegistered($registered){
|
||||
self::SetValue("registered", $registered);
|
||||
self::setValue("registered", $registered);
|
||||
}
|
||||
|
||||
public static function GetRegistered(){
|
||||
return self::GetValue("registered");
|
||||
return self::getValue("registered");
|
||||
}
|
||||
|
||||
public static function SetStationCountry($country){
|
||||
self::SetValue("country", $country);
|
||||
self::setValue("country", $country);
|
||||
}
|
||||
|
||||
public static function GetStationCountry(){
|
||||
return self::GetValue("country");
|
||||
return self::getValue("country");
|
||||
}
|
||||
|
||||
public static function SetStationCity($city){
|
||||
self::SetValue("city", $city);
|
||||
self::setValue("city", $city);
|
||||
}
|
||||
|
||||
public static function GetStationCity(){
|
||||
return self::GetValue("city");
|
||||
return self::getValue("city");
|
||||
}
|
||||
|
||||
public static function SetStationDescription($description){
|
||||
self::SetValue("description", $description);
|
||||
self::setValue("description", $description);
|
||||
}
|
||||
|
||||
public static function GetStationDescription(){
|
||||
return self::GetValue("description");
|
||||
return self::getValue("description");
|
||||
}
|
||||
|
||||
public static function SetTimezone($timezone){
|
||||
self::SetValue("timezone", $timezone);
|
||||
self::setValue("timezone", $timezone);
|
||||
date_default_timezone_set($timezone);
|
||||
$md = array("timezone" => $timezone);
|
||||
}
|
||||
|
||||
public static function GetTimezone(){
|
||||
return self::GetValue("timezone");
|
||||
return self::getValue("timezone");
|
||||
}
|
||||
|
||||
public static function SetStationLogo($imagePath){
|
||||
if(!empty($imagePath)){
|
||||
$image = @file_get_contents($imagePath);
|
||||
$image = base64_encode($image);
|
||||
self::SetValue("logoImage", $image);
|
||||
self::setValue("logoImage", $image);
|
||||
}
|
||||
}
|
||||
|
||||
public static function GetStationLogo(){
|
||||
return self::GetValue("logoImage");
|
||||
return self::getValue("logoImage");
|
||||
}
|
||||
|
||||
public static function GetUniqueId(){
|
||||
return self::GetValue("uniqueId");
|
||||
return self::getValue("uniqueId");
|
||||
}
|
||||
|
||||
public static function GetCountryList()
|
||||
|
@ -531,64 +531,64 @@ class Application_Model_Preference
|
|||
|
||||
public static function SetRemindMeDate(){
|
||||
$weekAfter = mktime(0, 0, 0, gmdate("m"), gmdate("d")+7, gmdate("Y"));
|
||||
self::SetValue("remindme", $weekAfter);
|
||||
self::setValue("remindme", $weekAfter);
|
||||
}
|
||||
|
||||
public static function GetRemindMeDate(){
|
||||
return self::GetValue("remindme");
|
||||
return self::getValue("remindme");
|
||||
}
|
||||
|
||||
public static function SetImportTimestamp(){
|
||||
$now = time();
|
||||
if(self::GetImportTimestamp()+5 < $now){
|
||||
self::SetValue("import_timestamp", $now);
|
||||
self::setValue("import_timestamp", $now);
|
||||
}
|
||||
}
|
||||
|
||||
public static function GetImportTimestamp(){
|
||||
return self::GetValue("import_timestamp");
|
||||
return self::getValue("import_timestamp");
|
||||
}
|
||||
|
||||
public static function GetStreamType(){
|
||||
$st = self::GetValue("stream_type");
|
||||
$st = self::getValue("stream_type");
|
||||
return explode(',', $st);
|
||||
}
|
||||
|
||||
public static function GetStreamBitrate(){
|
||||
$sb = self::GetValue("stream_bitrate");
|
||||
$sb = self::getValue("stream_bitrate");
|
||||
return explode(',', $sb);
|
||||
}
|
||||
|
||||
public static function SetPrivacyPolicyCheck($flag){
|
||||
self::SetValue("privacy_policy", $flag);
|
||||
self::setValue("privacy_policy", $flag);
|
||||
}
|
||||
|
||||
public static function GetPrivacyPolicyCheck(){
|
||||
return self::GetValue("privacy_policy");
|
||||
return self::getValue("privacy_policy");
|
||||
}
|
||||
|
||||
public static function SetNumOfStreams($num){
|
||||
self::SetValue("num_of_streams", intval($num));
|
||||
self::setValue("num_of_streams", intval($num));
|
||||
}
|
||||
|
||||
public static function GetNumOfStreams(){
|
||||
return self::GetValue("num_of_streams");
|
||||
return self::getValue("num_of_streams");
|
||||
}
|
||||
|
||||
public static function SetMaxBitrate($bitrate){
|
||||
self::SetValue("max_bitrate", intval($bitrate));
|
||||
self::setValue("max_bitrate", intval($bitrate));
|
||||
}
|
||||
|
||||
public static function GetMaxBitrate(){
|
||||
return self::GetValue("max_bitrate");
|
||||
return self::getValue("max_bitrate");
|
||||
}
|
||||
|
||||
public static function SetPlanLevel($plan){
|
||||
self::SetValue("plan_level", $plan);
|
||||
self::setValue("plan_level", $plan);
|
||||
}
|
||||
|
||||
public static function GetPlanLevel(){
|
||||
$plan = self::GetValue("plan_level");
|
||||
$plan = self::getValue("plan_level");
|
||||
if(trim($plan) == ''){
|
||||
$plan = 'disabled';
|
||||
}
|
||||
|
@ -596,36 +596,36 @@ class Application_Model_Preference
|
|||
}
|
||||
|
||||
public static function SetTrialEndingDate($date){
|
||||
self::SetValue("trial_end_date", $date);
|
||||
self::setValue("trial_end_date", $date);
|
||||
}
|
||||
|
||||
public static function GetTrialEndingDate(){
|
||||
return self::GetValue("trial_end_date");
|
||||
return self::getValue("trial_end_date");
|
||||
}
|
||||
|
||||
public static function SetEnableStreamConf($bool){
|
||||
self::SetValue("enable_stream_conf", $bool);
|
||||
self::setValue("enable_stream_conf", $bool);
|
||||
}
|
||||
|
||||
public static function GetEnableStreamConf(){
|
||||
if(self::GetValue("enable_stream_conf") == Null){
|
||||
if(self::getValue("enable_stream_conf") == Null){
|
||||
return "true";
|
||||
}
|
||||
return self::GetValue("enable_stream_conf");
|
||||
return self::getValue("enable_stream_conf");
|
||||
}
|
||||
|
||||
public static function GetAirtimeVersion(){
|
||||
if (defined('APPLICATION_ENV') && APPLICATION_ENV == "development" && function_exists('exec')){
|
||||
$version = exec("git rev-parse --short HEAD 2>/dev/null", $out, $return_code);
|
||||
if ($return_code == 0){
|
||||
return self::GetValue("system_version")."+".$version.":".time();
|
||||
return self::getValue("system_version")."+".$version.":".time();
|
||||
}
|
||||
}
|
||||
return self::GetValue("system_version");
|
||||
return self::getValue("system_version");
|
||||
}
|
||||
|
||||
public static function GetLatestVersion(){
|
||||
$latest = self::GetValue("latest_version");
|
||||
$latest = self::getValue("latest_version");
|
||||
if($latest == null || strlen($latest) == 0) {
|
||||
return self::GetAirtimeVersion();
|
||||
} else {
|
||||
|
@ -636,12 +636,12 @@ class Application_Model_Preference
|
|||
public static function SetLatestVersion($version){
|
||||
$pattern = "/^[0-9]+\.[0-9]+\.[0-9]+/";
|
||||
if(preg_match($pattern, $version)) {
|
||||
self::SetValue("latest_version", $version);
|
||||
self::setValue("latest_version", $version);
|
||||
}
|
||||
}
|
||||
|
||||
public static function GetLatestLink(){
|
||||
$link = self::GetValue("latest_link");
|
||||
$link = self::getValue("latest_link");
|
||||
if($link == null || strlen($link) == 0) {
|
||||
return 'http://airtime.sourcefabric.org';
|
||||
} else {
|
||||
|
@ -654,32 +654,32 @@ class Application_Model_Preference
|
|||
"([a-zA-Z0-9]+\.)*[a-zA-Z0-9]+" .
|
||||
"(/[a-zA-Z0-9\-\.\_\~\:\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=]+)*/?$#";
|
||||
if(preg_match($pattern, $link)) {
|
||||
self::SetValue("latest_link", $link);
|
||||
self::setValue("latest_link", $link);
|
||||
}
|
||||
}
|
||||
|
||||
public static function SetUploadToSoundcloudOption($upload) {
|
||||
self::SetValue("soundcloud_upload_option", $upload);
|
||||
self::setValue("soundcloud_upload_option", $upload);
|
||||
}
|
||||
|
||||
public static function GetUploadToSoundcloudOption() {
|
||||
return self::GetValue("soundcloud_upload_option");
|
||||
return self::getValue("soundcloud_upload_option");
|
||||
}
|
||||
|
||||
public static function SetSoundCloudDownloadbleOption($upload) {
|
||||
self::SetValue("soundcloud_downloadable", $upload);
|
||||
self::setValue("soundcloud_downloadable", $upload);
|
||||
}
|
||||
|
||||
public static function GetSoundCloudDownloadbleOption() {
|
||||
return self::GetValue("soundcloud_downloadable");
|
||||
return self::getValue("soundcloud_downloadable");
|
||||
}
|
||||
|
||||
public static function SetWeekStartDay($day) {
|
||||
self::SetValue("week_start_day", $day);
|
||||
self::setValue("week_start_day", $day);
|
||||
}
|
||||
|
||||
public static function GetWeekStartDay() {
|
||||
$val = self::GetValue("week_start_day");
|
||||
$val = self::getValue("week_start_day");
|
||||
if (strlen($val) == 0){
|
||||
return "0";
|
||||
} else {
|
||||
|
@ -692,14 +692,14 @@ class Application_Model_Preference
|
|||
*/
|
||||
public static function SetStreamUpdateTimestamp() {
|
||||
$now = time();
|
||||
self::SetValue("stream_update_timestamp", $now);
|
||||
self::setValue("stream_update_timestamp", $now);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the last timestamp of user updating stream setting
|
||||
*/
|
||||
public static function GetStreamUpdateTimestemp() {
|
||||
$update_time = self::GetValue("stream_update_timestamp");
|
||||
$update_time = self::getValue("stream_update_timestamp");
|
||||
if($update_time == null){
|
||||
$update_time = 0;
|
||||
}
|
||||
|
@ -707,12 +707,12 @@ class Application_Model_Preference
|
|||
}
|
||||
|
||||
public static function GetClientId() {
|
||||
return self::GetValue("client_id");
|
||||
return self::getValue("client_id");
|
||||
}
|
||||
|
||||
public static function SetClientId($id) {
|
||||
if (is_numeric($id)) {
|
||||
self::SetValue("client_id", $id);
|
||||
self::setValue("client_id", $id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -724,7 +724,7 @@ class Application_Model_Preference
|
|||
* @param $timeScale new time scale
|
||||
*/
|
||||
public static function SetCalendarTimeScale($timeScale) {
|
||||
self::SetValue("calendar_time_scale", $timeScale, true /* user specific */);
|
||||
self::setValue("calendar_time_scale", $timeScale, true /* user specific */);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -732,7 +732,7 @@ class Application_Model_Preference
|
|||
* Defaults to month if no entry exists
|
||||
*/
|
||||
public static function GetCalendarTimeScale() {
|
||||
$val = self::GetValue("calendar_time_scale", true /* user specific */);
|
||||
$val = self::getValue("calendar_time_scale", true /* user specific */);
|
||||
if(strlen($val) == 0) {
|
||||
$val = "month";
|
||||
}
|
||||
|
@ -745,7 +745,7 @@ class Application_Model_Preference
|
|||
* @param $numEntries new number of entries to show
|
||||
*/
|
||||
public static function SetLibraryNumEntries($numEntries) {
|
||||
self::SetValue("library_num_entries", $numEntries, true /* user specific */);
|
||||
self::setValue("library_num_entries", $numEntries, true /* user specific */);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -753,7 +753,7 @@ class Application_Model_Preference
|
|||
* Defaults to 10 if no entry exists
|
||||
*/
|
||||
public static function GetLibraryNumEntries() {
|
||||
$val = self::GetValue("library_num_entries", true /* user specific */);
|
||||
$val = self::getValue("library_num_entries", true /* user specific */);
|
||||
if(strlen($val) == 0) {
|
||||
$val = "10";
|
||||
}
|
||||
|
@ -766,7 +766,7 @@ class Application_Model_Preference
|
|||
* @param $timeInterval new time interval
|
||||
*/
|
||||
public static function SetCalendarTimeInterval($timeInterval) {
|
||||
self::SetValue("calendar_time_interval", $timeInterval, true /* user specific */);
|
||||
self::setValue("calendar_time_interval", $timeInterval, true /* user specific */);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -774,7 +774,7 @@ class Application_Model_Preference
|
|||
* Defaults to 30 min if no entry exists
|
||||
*/
|
||||
public static function GetCalendarTimeInterval() {
|
||||
$val = self::GetValue("calendar_time_interval", true /* user specific */);
|
||||
$val = self::getValue("calendar_time_interval", true /* user specific */);
|
||||
if(strlen($val) == 0) {
|
||||
$val = "30";
|
||||
}
|
||||
|
@ -782,11 +782,11 @@ class Application_Model_Preference
|
|||
}
|
||||
|
||||
public static function SetDiskQuota($value){
|
||||
self::SetValue("disk_quota", $value, false);
|
||||
self::setValue("disk_quota", $value, false);
|
||||
}
|
||||
|
||||
public static function GetDiskQuota(){
|
||||
$val = self::GetValue("disk_quota");
|
||||
$val = self::getValue("disk_quota");
|
||||
if(strlen($val) == 0) {
|
||||
$val = "0";
|
||||
}
|
||||
|
@ -794,27 +794,27 @@ class Application_Model_Preference
|
|||
}
|
||||
|
||||
public static function SetLiveSteamMasterUsername($value){
|
||||
self::SetValue("live_stream_master_username", $value, false);
|
||||
self::setValue("live_stream_master_username", $value, false);
|
||||
}
|
||||
|
||||
public static function GetLiveSteamMasterUsername(){
|
||||
return self::GetValue("live_stream_master_username");
|
||||
return self::getValue("live_stream_master_username");
|
||||
}
|
||||
|
||||
public static function SetLiveSteamMasterPassword($value){
|
||||
self::SetValue("live_stream_master_password", $value, false);
|
||||
self::setValue("live_stream_master_password", $value, false);
|
||||
}
|
||||
|
||||
public static function GetLiveSteamMasterPassword(){
|
||||
return self::GetValue("live_stream_master_password");
|
||||
return self::getValue("live_stream_master_password");
|
||||
}
|
||||
|
||||
public static function SetSourceStatus($sourcename, $status){
|
||||
self::SetValue($sourcename, $status, false);
|
||||
self::setValue($sourcename, $status, false);
|
||||
}
|
||||
|
||||
public static function GetSourceStatus($sourcename){
|
||||
$value = self::GetValue($sourcename);
|
||||
$value = self::getValue($sourcename);
|
||||
if($value == null || $value == "false"){
|
||||
return false;
|
||||
}else{
|
||||
|
@ -823,11 +823,11 @@ class Application_Model_Preference
|
|||
}
|
||||
|
||||
public static function SetSourceSwitchStatus($sourcename, $status){
|
||||
self::SetValue($sourcename."_switch", $status, false);
|
||||
self::setValue($sourcename."_switch", $status, false);
|
||||
}
|
||||
|
||||
public static function GetSourceSwitchStatus($sourcename){
|
||||
$value = self::GetValue($sourcename."_switch");
|
||||
$value = self::getValue($sourcename."_switch");
|
||||
if($value == null || $value == "off"){
|
||||
return "off";
|
||||
}else{
|
||||
|
@ -836,61 +836,61 @@ class Application_Model_Preference
|
|||
}
|
||||
|
||||
public static function SetMasterDJSourceConnectionURL($value){
|
||||
self::SetValue("master_dj_source_connection_url", $value, false);
|
||||
self::setValue("master_dj_source_connection_url", $value, false);
|
||||
}
|
||||
|
||||
public static function GetMasterDJSourceConnectionURL(){
|
||||
return self::GetValue("master_dj_source_connection_url");
|
||||
return self::getValue("master_dj_source_connection_url");
|
||||
}
|
||||
|
||||
public static function SetLiveDJSourceConnectionURL($value){
|
||||
self::SetValue("live_dj_source_connection_url", $value, false);
|
||||
self::setValue("live_dj_source_connection_url", $value, false);
|
||||
}
|
||||
|
||||
public static function GetLiveDJSourceConnectionURL(){
|
||||
return self::GetValue("live_dj_source_connection_url");
|
||||
return self::getValue("live_dj_source_connection_url");
|
||||
}
|
||||
|
||||
/* Source Connection URL override status starts */
|
||||
public static function GetLiveDjConnectionUrlOverride(){
|
||||
return self::GetValue("live_dj_connection_url_override");
|
||||
return self::getValue("live_dj_connection_url_override");
|
||||
}
|
||||
|
||||
public static function SetLiveDjConnectionUrlOverride($value){
|
||||
self::SetValue("live_dj_connection_url_override", $value, false);
|
||||
self::setValue("live_dj_connection_url_override", $value, false);
|
||||
}
|
||||
|
||||
public static function GetMasterDjConnectionUrlOverride(){
|
||||
return self::GetValue("master_dj_connection_url_override");
|
||||
return self::getValue("master_dj_connection_url_override");
|
||||
}
|
||||
|
||||
public static function SetMasterDjConnectionUrlOverride($value){
|
||||
self::SetValue("master_dj_connection_url_override", $value, false);
|
||||
self::setValue("master_dj_connection_url_override", $value, false);
|
||||
}
|
||||
/* Source Connection URL override status ends */
|
||||
|
||||
public static function SetAutoTransition($value){
|
||||
self::SetValue("auto_transition", $value, false);
|
||||
self::setValue("auto_transition", $value, false);
|
||||
}
|
||||
|
||||
public static function GetAutoTransition(){
|
||||
return self::GetValue("auto_transition");
|
||||
return self::getValue("auto_transition");
|
||||
}
|
||||
|
||||
public static function SetAutoSwitch($value){
|
||||
self::SetValue("auto_switch", $value, false);
|
||||
self::setValue("auto_switch", $value, false);
|
||||
}
|
||||
|
||||
public static function GetAutoSwitch(){
|
||||
return self::GetValue("auto_switch");
|
||||
return self::getValue("auto_switch");
|
||||
}
|
||||
|
||||
public static function SetEnableSystemEmail($upload) {
|
||||
self::SetValue("enable_system_email", $upload);
|
||||
self::setValue("enable_system_email", $upload);
|
||||
}
|
||||
|
||||
public static function GetEnableSystemEmail() {
|
||||
$v = self::GetValue("enable_system_email");
|
||||
$v = self::getValue("enable_system_email");
|
||||
|
||||
if ($v === "") {
|
||||
return 0;
|
||||
|
@ -900,51 +900,51 @@ class Application_Model_Preference
|
|||
}
|
||||
|
||||
public static function SetSystemEmail($value) {
|
||||
self::SetValue("system_email", $value, false);
|
||||
self::setValue("system_email", $value, false);
|
||||
}
|
||||
|
||||
public static function GetSystemEmail() {
|
||||
return self::GetValue("system_email");
|
||||
return self::getValue("system_email");
|
||||
}
|
||||
|
||||
public static function SetMailServerConfigured($value) {
|
||||
self::SetValue("mail_server_configured", $value, false);
|
||||
self::setValue("mail_server_configured", $value, false);
|
||||
}
|
||||
|
||||
public static function GetMailServerConfigured() {
|
||||
return self::GetValue("mail_server_configured");
|
||||
return self::getValue("mail_server_configured");
|
||||
}
|
||||
|
||||
public static function SetMailServer($value) {
|
||||
self::SetValue("mail_server", $value, false);
|
||||
self::setValue("mail_server", $value, false);
|
||||
}
|
||||
|
||||
public static function GetMailServer() {
|
||||
return self::GetValue("mail_server");
|
||||
return self::getValue("mail_server");
|
||||
}
|
||||
|
||||
public static function SetMailServerEmailAddress($value) {
|
||||
self::SetValue("mail_server_email_address", $value, false);
|
||||
self::setValue("mail_server_email_address", $value, false);
|
||||
}
|
||||
|
||||
public static function GetMailServerEmailAddress() {
|
||||
return self::GetValue("mail_server_email_address");
|
||||
return self::getValue("mail_server_email_address");
|
||||
}
|
||||
|
||||
public static function SetMailServerPassword($value) {
|
||||
self::SetValue("mail_server_password", $value, false);
|
||||
self::setValue("mail_server_password", $value, false);
|
||||
}
|
||||
|
||||
public static function GetMailServerPassword() {
|
||||
return self::GetValue("mail_server_password");
|
||||
return self::getValue("mail_server_password");
|
||||
}
|
||||
|
||||
public static function SetMailServerPort($value) {
|
||||
self::SetValue("mail_server_port", $value, false);
|
||||
self::setValue("mail_server_port", $value, false);
|
||||
}
|
||||
|
||||
public static function GetMailServerPort() {
|
||||
return self::GetValue("mail_server_port");
|
||||
return self::getValue("mail_server_port");
|
||||
}
|
||||
/* User specific preferences end */
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class Application_Model_Scheduler {
|
|||
$this->nowDT = DateTime::createFromFormat("U", time(), new DateTimeZone("UTC"));
|
||||
}
|
||||
|
||||
$this->user = Application_Model_User::GetCurrentUser();
|
||||
$this->user = Application_Model_User::getCurrentUser();
|
||||
}
|
||||
|
||||
public function setCheckUserPermissions($value) {
|
||||
|
|
|
@ -303,8 +303,6 @@ class Application_Model_Show {
|
|||
." AND starts > TIMESTAMP '$timestamp'"
|
||||
." AND show_id = $showId";
|
||||
|
||||
//Logging::log($sql);
|
||||
|
||||
$con->exec($sql);
|
||||
}
|
||||
|
||||
|
@ -1733,7 +1731,8 @@ class Application_Model_Show {
|
|||
$timeNow = $date->getUtcTimestamp();
|
||||
}
|
||||
//TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin
|
||||
$sql = "SELECT si.starts as start_timestamp, si.ends as end_timestamp, s.name, s.id, si.id as instance_id, si.record, s.url, starts, ends"
|
||||
$sql = "SELECT si.starts as start_timestamp, si.ends as end_timestamp, s.name,"
|
||||
." s.id, si.id as instance_id, si.record, s.url, starts, ends"
|
||||
." FROM $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] s"
|
||||
." WHERE si.show_id = s.id"
|
||||
." AND si.starts <= TIMESTAMP '$timeNow'"
|
||||
|
@ -1746,14 +1745,16 @@ class Application_Model_Show {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the current show, previous and next with an 2day window from the given timeNow, so timeNow-2days and timeNow+2days.
|
||||
* Gets the current show, previous and next with an 2day window from
|
||||
* the given timeNow, so timeNow-2days and timeNow+2days.
|
||||
*/
|
||||
public static function getPrevCurrentNext($p_timeNow)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
//TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin
|
||||
$sql = "SELECT si.starts as start_timestamp, si.ends as end_timestamp, s.name, s.id, si.id as instance_id, si.record, s.url, starts, ends"
|
||||
$sql = "SELECT si.starts as start_timestamp, si.ends as end_timestamp, s.name,"
|
||||
." s.id, si.id as instance_id, si.record, s.url, starts, ends"
|
||||
." FROM $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] s"
|
||||
." WHERE si.show_id = s.id"
|
||||
." AND si.starts > TIMESTAMP '$p_timeNow' - INTERVAL '2 days'"
|
||||
|
@ -1770,10 +1771,11 @@ class Application_Model_Show {
|
|||
|
||||
$timeNowAsMillis = strtotime($p_timeNow);
|
||||
|
||||
for( $i = 0; $i < $numberOfRows; ++$i ){
|
||||
for ($i = 0; $i < $numberOfRows; ++$i) {
|
||||
//Find the show that is within the current time.
|
||||
if ((strtotime($rows[$i]['starts']) <= $timeNowAsMillis) && (strtotime($rows[$i]['ends']) > $timeNowAsMillis)){
|
||||
if ( $i - 1 >= 0){
|
||||
if ((strtotime($rows[$i]['starts']) <= $timeNowAsMillis)
|
||||
&& (strtotime($rows[$i]['ends']) > $timeNowAsMillis)) {
|
||||
if ($i-1 >= 0) {
|
||||
$results['previousShow'][0] = array(
|
||||
"id"=>$rows[$i-1]['id'],
|
||||
"instance_id"=>$rows[$i-1]['instance_id'],
|
||||
|
@ -1789,7 +1791,7 @@ class Application_Model_Show {
|
|||
|
||||
$results['currentShow'][0] = $rows[$i];
|
||||
|
||||
if ( isset($rows[$i+1])){
|
||||
if (isset($rows[$i+1])) {
|
||||
$results['nextShow'][0] = array(
|
||||
"id"=>$rows[$i+1]['id'],
|
||||
"instance_id"=>$rows[$i+1]['instance_id'],
|
||||
|
@ -1801,7 +1803,6 @@ class Application_Model_Show {
|
|||
"ends"=>$rows[$i+1]['ends'],
|
||||
"record"=>$rows[$i+1]['record'],
|
||||
"type"=>"show");
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1855,7 +1856,7 @@ class Application_Model_Show {
|
|||
* @param String $timeEnd - interval end time (in UTC)
|
||||
* @return array - the next $limit number of shows within the time interval
|
||||
*/
|
||||
public static function GetNextShows($timeStart, $limit = "0", $timeEnd = "")
|
||||
public static function getNextShows($timeStart, $limit = "0", $timeEnd = "")
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
|
@ -1878,7 +1879,7 @@ class Application_Model_Show {
|
|||
." ORDER BY si.starts";
|
||||
|
||||
// defaults to retrieve all shows within the interval if $limit not set
|
||||
if($limit != "0") {
|
||||
if ($limit != "0") {
|
||||
$sql = $sql . " LIMIT $limit";
|
||||
}
|
||||
|
||||
|
@ -1893,20 +1894,22 @@ class Application_Model_Show {
|
|||
* @param type $rows arrays of arrays containing database query result
|
||||
* @param type $columnsToConvert array of column names to convert
|
||||
*/
|
||||
public static function ConvertToLocalTimeZone(&$rows, $columnsToConvert) {
|
||||
public static function convertToLocalTimeZone(&$rows, $columnsToConvert)
|
||||
{
|
||||
$timezone = date_default_timezone_get();
|
||||
|
||||
if (!is_array($rows)) {
|
||||
return;
|
||||
}
|
||||
foreach($rows as &$row) {
|
||||
foreach($columnsToConvert as $column) {
|
||||
foreach ($rows as &$row) {
|
||||
foreach ($columnsToConvert as $column) {
|
||||
$row[$column] = Application_Common_DateHelper::ConvertToLocalDateTimeString($row[$column]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function GetMaxLengths() {
|
||||
public static function getMaxLengths()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class Application_Model_ShowBuilder {
|
|||
$this->startDT = $p_startDT;
|
||||
$this->endDT = $p_endDT;
|
||||
$this->timezone = date_default_timezone_get();
|
||||
$this->user = Application_Model_User::GetCurrentUser();
|
||||
$this->user = Application_Model_User::getCurrentUser();
|
||||
$this->opts = $p_opts;
|
||||
$this->epoch_now = floatval(microtime(true));
|
||||
$this->currentShow = false;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
class Application_Model_StreamSetting {
|
||||
|
||||
public static function SetValue($key, $value, $type)
|
||||
public static function setValue($key, $value, $type)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
|
@ -27,7 +27,7 @@ class Application_Model_StreamSetting {
|
|||
return $con->exec($sql);
|
||||
}
|
||||
|
||||
public static function GetValue($key)
|
||||
public static function getValue($key)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
|
@ -37,14 +37,14 @@ class Application_Model_StreamSetting {
|
|||
." WHERE keyname = '$key'";
|
||||
$result = $con->query($sql)->fetchColumn(0);
|
||||
|
||||
if ($result == 0)
|
||||
if ($result == 0) {
|
||||
return "";
|
||||
else {
|
||||
} else {
|
||||
$sql = "SELECT value FROM cc_stream_setting"
|
||||
." WHERE keyname = '$key'";
|
||||
|
||||
$result = $con->query($sql)->fetchColumn(0);
|
||||
return ($result !== false) ? $result : NULL;
|
||||
return ($result !== false) ? $result : null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,16 +130,24 @@ class Application_Model_StreamSetting {
|
|||
}
|
||||
|
||||
if (!isset($exists["master_live_stream_port"])) {
|
||||
$rows[] = (array("keyname" =>"master_live_stream_port", "value"=>self::GetMasterLiveSteamPort(), "type"=>"integer"));
|
||||
$rows[] = array("keyname" =>"master_live_stream_port",
|
||||
"value"=>self::getMasterLiveStreamPort(),
|
||||
"type"=>"integer");
|
||||
}
|
||||
if (!isset($exists["master_live_stream_mp"])) {
|
||||
$rows[] = (array("keyname" =>"master_live_stream_mp", "value"=>self::GetMasterLiveSteamMountPoint(), "type"=>"string"));
|
||||
$rows[] = array("keyname" =>"master_live_stream_mp",
|
||||
"value"=>self::getMasterLiveStreamMountPoint(),
|
||||
"type"=>"string");
|
||||
}
|
||||
if (!isset($exists["dj_live_stream_port"])) {
|
||||
$rows[] = (array("keyname" =>"dj_live_stream_port", "value"=>self::GetDJLiveSteamPort(), "type"=>"integer"));
|
||||
$rows[] = array("keyname" =>"dj_live_stream_port",
|
||||
"value"=>self::getDjLiveStreamPort(),
|
||||
"type"=>"integer");
|
||||
}
|
||||
if (!isset($exists["dj_live_stream_mp"])) {
|
||||
$rows[] = (array("keyname" =>"dj_live_stream_mp", "value"=>self::GetDJLiveSteamMountPoint(), "type"=>"string"));
|
||||
$rows[] = array("keyname" =>"dj_live_stream_mp",
|
||||
"value"=>self::getDjLiveStreamMountPoint(),
|
||||
"type"=>"string");
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
@ -155,7 +163,7 @@ class Application_Model_StreamSetting {
|
|||
{
|
||||
$con = Propel::getConnection();
|
||||
|
||||
foreach ($data as $key=>$d) {
|
||||
foreach ($data as $key => $d) {
|
||||
if ($key == "output_sound_device" || $key == "icecast_vorbis_metadata") {
|
||||
$v = $d == 1?"true":"false";
|
||||
$sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$key'";
|
||||
|
@ -166,7 +174,7 @@ class Application_Model_StreamSetting {
|
|||
} else if (is_array($d)) {
|
||||
$temp = explode('_', $key);
|
||||
$prefix = $temp[0];
|
||||
foreach ($d as $k=>$v) {
|
||||
foreach ($d as $k => $v) {
|
||||
$keyname = $prefix . "_" . $k;
|
||||
if ($k == 'enable') {
|
||||
$v = $d['enable'] == 1 ? 'true' : 'false';
|
||||
|
@ -233,7 +241,7 @@ class Application_Model_StreamSetting {
|
|||
." WHERE keyname = '$keyname'";
|
||||
$result = $con->query($sql)->fetchColumn(0);
|
||||
|
||||
return ($result !== false) ? $result : NULL;
|
||||
return ($result !== false) ? $result : null;
|
||||
}
|
||||
|
||||
public static function getStreamEnabled($stream_id)
|
||||
|
@ -264,7 +272,8 @@ class Application_Model_StreamSetting {
|
|||
$enabled_stream = self::getEnabledStreamIds();
|
||||
|
||||
foreach ($enabled_stream as $stream) {
|
||||
$keys = "'".$stream."_output', "."'".$stream."_type', "."'".$stream."_bitrate', "."'".$stream."_host'";
|
||||
$keys = "'".$stream."_output', "."'".$stream."_type', "."'"
|
||||
.$stream."_bitrate', "."'".$stream."_host'";
|
||||
|
||||
$sql = "SELECT keyname, value FROM cc_stream_setting"
|
||||
." WHERE keyname IN ($keys)";
|
||||
|
@ -280,35 +289,43 @@ class Application_Model_StreamSetting {
|
|||
return $out;
|
||||
}
|
||||
|
||||
public static function SetMasterLiveSteamPort($value){
|
||||
self::SetValue("master_live_stream_port", $value, "integer");
|
||||
public static function setMasterLiveStreamPort($value)
|
||||
{
|
||||
self::setValue("master_live_stream_port", $value, "integer");
|
||||
}
|
||||
|
||||
public static function GetMasterLiveSteamPort(){
|
||||
return self::GetValue("master_live_stream_port");
|
||||
public static function getMasterLiveStreamPort()
|
||||
{
|
||||
return self::getValue("master_live_stream_port");
|
||||
}
|
||||
|
||||
public static function SetMasterLiveSteamMountPoint($value){
|
||||
self::SetValue("master_live_stream_mp", $value, "string");
|
||||
public static function setMasterLiveStreamMountPoint($value)
|
||||
{
|
||||
self::setValue("master_live_stream_mp", $value, "string");
|
||||
}
|
||||
|
||||
public static function GetMasterLiveSteamMountPoint(){
|
||||
return self::GetValue("master_live_stream_mp");
|
||||
public static function getMasterLiveStreamMountPoint()
|
||||
{
|
||||
return self::getValue("master_live_stream_mp");
|
||||
}
|
||||
|
||||
public static function SetDJLiveSteamPort($value){
|
||||
self::SetValue("dj_live_stream_port", $value, "integer");
|
||||
public static function setDjLiveStreamPort($value)
|
||||
{
|
||||
self::setValue("dj_live_stream_port", $value, "integer");
|
||||
}
|
||||
|
||||
public static function GetDJLiveSteamPort(){
|
||||
return self::GetValue("dj_live_stream_port");
|
||||
public static function getDjLiveStreamPort()
|
||||
{
|
||||
return self::getValue("dj_live_stream_port");
|
||||
}
|
||||
|
||||
public static function SetDJLiveSteamMountPoint($value){
|
||||
self::SetValue("dj_live_stream_mp", $value, "string");
|
||||
public static function setDjLiveStreamMountPoint($value)
|
||||
{
|
||||
self::setValue("dj_live_stream_mp", $value, "string");
|
||||
}
|
||||
|
||||
public static function GetDJLiveSteamMountPoint(){
|
||||
return self::GetValue("dj_live_stream_mp");
|
||||
public static function getDjLiveStreamMountPoint()
|
||||
{
|
||||
return self::getValue("dj_live_stream_mp");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,102 +18,6 @@ class Application_Model_Subjects {
|
|||
|
||||
/* ======================================================= public methods */
|
||||
|
||||
/**
|
||||
* Check login and password
|
||||
*
|
||||
* @param string $login
|
||||
* @param string $pass
|
||||
* optional
|
||||
* @return boolean|int|PEAR_Error
|
||||
*/
|
||||
public static function Authenticate($login, $pass='')
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
$cpass = md5($pass);
|
||||
$sql = "SELECT id FROM ".$CC_CONFIG['subjTable']
|
||||
." WHERE login='$login' AND pass='$cpass' AND type='U'"
|
||||
." LIMIT 1";
|
||||
$query = $con->query($sql)->fetchColumn(0);
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Change user password
|
||||
*
|
||||
* @param string $login
|
||||
* @param string $oldpass
|
||||
* old password (optional for 'superuser mode')
|
||||
* @param string $pass
|
||||
* optional
|
||||
* @param boolean $passenc
|
||||
* optional, password already encrypted if true
|
||||
* @return boolean|PEAR_Error
|
||||
*/
|
||||
public static function Passwd($login, $oldpass=null, $pass='', $passenc=FALSE)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
if (!$passenc) {
|
||||
$cpass = md5($pass);
|
||||
} else {
|
||||
$cpass = $pass;
|
||||
}
|
||||
if (!is_null($oldpass)) {
|
||||
$oldcpass = md5($oldpass);
|
||||
$oldpCond = "AND pass='$oldcpass'";
|
||||
} else {
|
||||
$oldpCond = '';
|
||||
}
|
||||
$sql = "UPDATE ".$CC_CONFIG['subjTable']." SET pass='$cpass'"
|
||||
." WHERE login='$login' $oldpCond AND type='U'";
|
||||
$con->exec($sql);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* --------------------------------------------------------------- groups */
|
||||
|
||||
/* --------------------------------------------------------- info methods */
|
||||
|
||||
/**
|
||||
* Get subject id from login
|
||||
*
|
||||
* @param string $login
|
||||
* @return int|false
|
||||
*/
|
||||
public static function GetSubjId($login)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
$sql = "SELECT id FROM ".$CC_CONFIG['subjTable']
|
||||
." WHERE login='$login'";
|
||||
$query = $con->query($sql)->fetchColumn(0);
|
||||
return ($query !== false) ? $query : NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return true if uid is direct member of gid
|
||||
*
|
||||
* @param int $uid
|
||||
* local user id
|
||||
* @param int $gid
|
||||
* local group id
|
||||
* @return boolean
|
||||
*/
|
||||
public static function IsMemberOf($uid, $gid)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
$sql = "SELECT count(*) as cnt"
|
||||
." FROM ".$CC_CONFIG['smembTable']
|
||||
." WHERE uid='$uid' AND gid='$gid'";
|
||||
$res = $con->query($sql)->fetchColumn(0);
|
||||
return (intval($res) > 0);
|
||||
}
|
||||
|
||||
public static function increaseLoginAttempts($login)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
@ -131,7 +35,7 @@ class Application_Model_Subjects {
|
|||
$sql = "UPDATE ".$CC_CONFIG['subjTable']." SET login_attempts = '0'"
|
||||
." WHERE login='$login'";
|
||||
$res = $con->exec($sql);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function getLoginAttempts($login)
|
||||
|
|
|
@ -11,74 +11,81 @@ class Application_Model_User {
|
|||
|
||||
public function __construct($userId)
|
||||
{
|
||||
if (empty($userId)){
|
||||
if (empty($userId)) {
|
||||
$this->_userInstance = $this->createUser();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->_userInstance = CcSubjsQuery::create()->findPK($userId);
|
||||
|
||||
if (is_null($this->_userInstance)){
|
||||
if (is_null($this->_userInstance)) {
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getId() {
|
||||
public function getId()
|
||||
{
|
||||
return $this->_userInstance->getDbId();
|
||||
}
|
||||
|
||||
public function isGuest() {
|
||||
public function isGuest()
|
||||
{
|
||||
return $this->getType() == UTYPE_GUEST;
|
||||
}
|
||||
|
||||
public function isHost($showId) {
|
||||
public function isHost($showId)
|
||||
{
|
||||
return $this->isUserType(UTYPE_HOST, $showId);
|
||||
}
|
||||
|
||||
public function isPM() {
|
||||
public function isPM()
|
||||
{
|
||||
return $this->isUserType(UTYPE_PROGRAM_MANAGER);
|
||||
}
|
||||
|
||||
public function isAdmin() {
|
||||
public function isAdmin()
|
||||
{
|
||||
return $this->isUserType(UTYPE_ADMIN);
|
||||
}
|
||||
|
||||
public function canSchedule($p_showId) {
|
||||
public function canSchedule($p_showId)
|
||||
{
|
||||
$type = $this->getType();
|
||||
$result = false;
|
||||
|
||||
if ( $type === UTYPE_ADMIN ||
|
||||
if ($type === UTYPE_ADMIN ||
|
||||
$type === UTYPE_PROGRAM_MANAGER ||
|
||||
CcShowHostsQuery::create()->filterByDbShow($p_showId)->filterByDbHost($this->getId())->count() > 0 )
|
||||
{
|
||||
CcShowHostsQuery::create()->filterByDbShow($p_showId)->filterByDbHost($this->getId())->count() > 0) {
|
||||
$result = true;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function isUserType($type, $showId=''){
|
||||
if(is_array($type)){
|
||||
public function isUserType($type, $showId='')
|
||||
{
|
||||
if (is_array($type)) {
|
||||
$result = false;
|
||||
foreach($type as $t){
|
||||
foreach ($type as $t) {
|
||||
switch($t){
|
||||
case UTYPE_ADMIN:
|
||||
$result = $this->_userInstance->getDbType() === 'A';
|
||||
break;
|
||||
case UTYPE_HOST:
|
||||
$userId = $this->_userInstance->getDbId();
|
||||
$result = CcShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($userId)->count() > 0;
|
||||
$result = CcShowHostsQuery::create()
|
||||
->filterByDbShow($showId)
|
||||
->filterByDbHost($userId)->count() > 0;
|
||||
break;
|
||||
case UTYPE_PROGRAM_MANAGER:
|
||||
$result = $this->_userInstance->getDbType() === 'P';
|
||||
break;
|
||||
}
|
||||
if($result){
|
||||
if ($result) {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
switch($type){
|
||||
} else {
|
||||
switch($type) {
|
||||
case UTYPE_ADMIN:
|
||||
return $this->_userInstance->getDbType() === 'A';
|
||||
case UTYPE_HOST:
|
||||
|
@ -90,112 +97,134 @@ class Application_Model_User {
|
|||
}
|
||||
}
|
||||
|
||||
public function setLogin($login){
|
||||
public function setLogin($login)
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbLogin($login);
|
||||
}
|
||||
|
||||
public function setPassword($password){
|
||||
public function setPassword($password)
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbPass(md5($password));
|
||||
}
|
||||
|
||||
public function setFirstName($firstName){
|
||||
public function setFirstName($firstName)
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbFirstName($firstName);
|
||||
}
|
||||
|
||||
public function setLastName($lastName){
|
||||
public function setLastName($lastName)
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbLastName($lastName);
|
||||
}
|
||||
|
||||
public function setType($type){
|
||||
public function setType($type)
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbType($type);
|
||||
}
|
||||
|
||||
public function setEmail($email){
|
||||
public function setEmail($email)
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbEmail(strtolower($email));
|
||||
}
|
||||
|
||||
public function setCellPhone($cellPhone){
|
||||
public function setCellPhone($cellPhone)
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbCellPhone($cellPhone);
|
||||
}
|
||||
|
||||
public function setSkype($skype){
|
||||
public function setSkype($skype)
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbSkypeContact($skype);
|
||||
}
|
||||
|
||||
public function setJabber($jabber){
|
||||
public function setJabber($jabber)
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbJabberContact($jabber);
|
||||
}
|
||||
|
||||
public function getLogin(){
|
||||
public function getLogin()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbLogin();
|
||||
}
|
||||
|
||||
public function getPassword(){
|
||||
public function getPassword()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbPass();
|
||||
}
|
||||
|
||||
public function getFirstName(){
|
||||
public function getFirstName()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbFirstName();
|
||||
}
|
||||
|
||||
public function getLastName(){
|
||||
public function getLastName()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbLastName();
|
||||
}
|
||||
|
||||
public function getType(){
|
||||
public function getType()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbType();
|
||||
}
|
||||
|
||||
public function getEmail(){
|
||||
public function getEmail()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbEmail();
|
||||
}
|
||||
|
||||
public function getCellPhone(){
|
||||
public function getCellPhone()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbCellPhone();
|
||||
}
|
||||
|
||||
public function getSkype(){
|
||||
public function getSkype()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbSkypeContact();
|
||||
}
|
||||
|
||||
public function getJabber(){
|
||||
public function getJabber()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbJabberContact();
|
||||
|
||||
}
|
||||
|
||||
public function save(){
|
||||
public function save()
|
||||
{
|
||||
$this->_userInstance->save();
|
||||
}
|
||||
|
||||
public function delete(){
|
||||
if (!$this->_userInstance->isDeleted())
|
||||
public function delete()
|
||||
{
|
||||
if (!$this->_userInstance->isDeleted()) {
|
||||
$this->_userInstance->delete();
|
||||
}
|
||||
}
|
||||
|
||||
private function createUser() {
|
||||
private function createUser()
|
||||
{
|
||||
$user = new CcSubjs();
|
||||
return $user;
|
||||
}
|
||||
|
||||
public static function getUsers($type, $search=NULL)
|
||||
public static function getUsers($type, $search=null)
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
|
||||
|
@ -203,12 +232,11 @@ class Application_Model_User {
|
|||
$sql = $sql_gen;
|
||||
|
||||
if (is_array($type)) {
|
||||
for($i=0; $i<count($type); $i++) {
|
||||
for ($i=0; $i<count($type); $i++) {
|
||||
$type[$i] = "type = '{$type[$i]}'";
|
||||
}
|
||||
$sql_type = join(" OR ", $type);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$sql_type = "type = {$type}";
|
||||
}
|
||||
|
||||
|
@ -225,22 +253,21 @@ class Application_Model_User {
|
|||
return $con->query($sql)->fetchAll();;
|
||||
}
|
||||
|
||||
public static function getUserCount($type=NULL){
|
||||
public static function getUserCount($type=null)
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
$sql = '';
|
||||
$sql_gen = "SELECT count(*) AS cnt FROM cc_subjs ";
|
||||
|
||||
if (!isset($type)) {
|
||||
$sql = $sql_gen;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
if (is_array($type)) {
|
||||
for ($i=0; $i<count($type); $i++) {
|
||||
$type[$i] = "type = '{$type[$i]}'";
|
||||
}
|
||||
$sql_type = join(" OR ", $type);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$sql_type = "type = {$type}";
|
||||
}
|
||||
|
||||
|
@ -248,14 +275,16 @@ class Application_Model_User {
|
|||
}
|
||||
|
||||
$query = $con->query($sql)->fetchColumn(0);
|
||||
return ($query !== false) ? $query : NULL;
|
||||
return ($query !== false) ? $query : null;
|
||||
}
|
||||
|
||||
public static function getHosts($search=NULL) {
|
||||
public static function getHosts($search=null)
|
||||
{
|
||||
return Application_Model_User::getUsers(array('H'), $search);
|
||||
}
|
||||
|
||||
public static function getUsersDataTablesInfo($datatables) {
|
||||
public static function getUsersDataTablesInfo($datatables)
|
||||
{
|
||||
|
||||
$con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME);
|
||||
|
||||
|
@ -273,8 +302,8 @@ class Application_Model_User {
|
|||
$res = Application_Model_Datatables::findEntries($con, $displayColumns, $fromTable, $datatables);
|
||||
|
||||
// mark record which is for the current user
|
||||
foreach($res['aaData'] as &$record){
|
||||
if($record['login'] == $username){
|
||||
foreach ($res['aaData'] as &$record) {
|
||||
if ($record['login'] == $username) {
|
||||
$record['delete'] = "self";
|
||||
} else {
|
||||
$record['delete'] = "";
|
||||
|
@ -284,7 +313,8 @@ class Application_Model_User {
|
|||
return $res;
|
||||
}
|
||||
|
||||
public static function getUserData($id){
|
||||
public static function getUserData($id)
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$sql = "SELECT login, first_name, last_name, type, id, email, cell_phone, skype_contact, jabber_contact"
|
||||
|
@ -294,24 +324,16 @@ class Application_Model_User {
|
|||
return $con->query($sql)->fetch();
|
||||
}
|
||||
|
||||
public static function GetUserID($login){
|
||||
$user = CcSubjsQuery::create()->findOneByDbLogin($login);
|
||||
if (is_null($user)){
|
||||
return -1;
|
||||
} else {
|
||||
return $user->getDbId();
|
||||
}
|
||||
}
|
||||
|
||||
public static function GetCurrentUser() {
|
||||
public static function getCurrentUser()
|
||||
{
|
||||
$userinfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
||||
if (is_null($userinfo)){
|
||||
if (is_null($userinfo)) {
|
||||
return null;
|
||||
} else {
|
||||
try {
|
||||
return new self($userinfo->id);
|
||||
} catch (Exception $e){
|
||||
} catch (Exception $e) {
|
||||
//we get here if $userinfo->id is defined, but doesn't exist
|
||||
//in the database anymore.
|
||||
Zend_Auth::getInstance()->clearIdentity();
|
||||
|
|
|
@ -51,7 +51,7 @@ class MediaMonitorCommon:
|
|||
|
||||
def is_audio_file(self, filename):
|
||||
info = filename.split(".")
|
||||
if len(info) < 2: return false # handle cases like filename="mp3"
|
||||
if len(info) < 2: return False # handle cases like filename="mp3"
|
||||
return info[-1].lower() in self.supported_file_formats
|
||||
|
||||
#check if file is readable by "nobody"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 492242f4bb7367afebbf2f096067cb5a5d3c0449
|
||||
Subproject commit 0653ec0b89362921f075af96ee8772538b801a7c
|
Loading…
Reference in New Issue