diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index ce3096d0f..3ca0e9e79 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -95,7 +95,8 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap if (strpos($_SERVER['REQUEST_URI'], $baseUrl.'/Dashboard/stream-player') === false && strpos($_SERVER['REQUEST_URI'], $baseUrl.'/audiopreview/audio-preview') === false - && strpos($_SERVER['REQUEST_URI'], $baseUrl.'/audiopreview/playlist-preview') === false) { + && strpos($_SERVER['REQUEST_URI'], $baseUrl.'/audiopreview/playlist-preview') === false + && strpos($_SERVER['REQUEST_URI'], $baseUrl.'/audiopreview/block-preview') === false) { $client_id = Application_Model_Preference::GetClientId(); $view->headScript()->appendScript("var livechat_client_id = '$client_id';"); $view->headScript()->appendFile($baseUrl . '/js/airtime/common/livechat.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 1a1876ce9..5d07d250a 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -686,6 +686,22 @@ class ApiController extends Zend_Controller_Action Logging::info("Registered Component: ".$component."@".$remoteAddr); Application_Model_ServiceRegister::Register($component, $remoteAddr); + + //send ip, subdomain + if (Application_Model_Preference::GetPlanLevel() != 'disabled'){ + if ($component == "pypo"){ + $split = explode('.', $_SERVER['SERVER_NAME']); + if (count($split) > 0){ + $subDomain = $split[0]; + + $md = array(); + $md["sub_domain"] = $subDomain; + $md["pypo_ip"] = $remoteAddr; + + Application_Model_RabbitMq::SendMessageToHaproxyConfigDaemon($md); + } + } + } } public function updateLiquidsoapStatusAction() diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index 5c375deab..c1ffda4ad 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -53,7 +53,6 @@ class PreferenceController extends Zend_Controller_Action Application_Model_Preference::SetMailServerRequiresAuth($values["preferences_email_server"]["msRequiresAuth"]); } - Application_Model_Preference::SetAutoUploadRecordedShowToSoundcloud($values["preferences_soundcloud"]["UseSoundCloud"]); Application_Model_Preference::SetUploadToSoundcloudOption($values["preferences_soundcloud"]["UploadToSoundcloudOption"]); Application_Model_Preference::SetSoundCloudDownloadbleOption($values["preferences_soundcloud"]["SoundCloudDownloadbleOption"]); Application_Model_Preference::SetSoundCloudUser($values["preferences_soundcloud"]["SoundCloudUser"]); diff --git a/airtime_mvc/application/controllers/SystemstatusController.php b/airtime_mvc/application/controllers/SystemstatusController.php index aa2400f41..32ed64c22 100644 --- a/airtime_mvc/application/controllers/SystemstatusController.php +++ b/airtime_mvc/application/controllers/SystemstatusController.php @@ -18,7 +18,7 @@ class SystemstatusController extends Zend_Controller_Action "pypo"=>Application_Model_Systemstatus::GetPypoStatus(), "liquidsoap"=>Application_Model_Systemstatus::GetLiquidsoapStatus(), "media-monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus(), - "rabbitmq-server"=>Application_Model_Systemstatus::GetRabbitMqStatus() + //"rabbitmq-server"=>Application_Model_Systemstatus::GetRabbitMqStatus() ); $partitions = Application_Model_Systemstatus::GetDiskInfo(); diff --git a/airtime_mvc/application/forms/SoundcloudPreferences.php b/airtime_mvc/application/forms/SoundcloudPreferences.php index d3840cbbf..848368697 100644 --- a/airtime_mvc/application/forms/SoundcloudPreferences.php +++ b/airtime_mvc/application/forms/SoundcloudPreferences.php @@ -11,16 +11,6 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm 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 $this->addElement('checkbox', 'UploadToSoundcloudOption', array( 'label' => 'Enable SoundCloud Upload', diff --git a/airtime_mvc/application/models/RabbitMq.php b/airtime_mvc/application/models/RabbitMq.php index d92975413..7fea88348 100644 --- a/airtime_mvc/application/models/RabbitMq.php +++ b/airtime_mvc/application/models/RabbitMq.php @@ -71,4 +71,46 @@ class Application_Model_RabbitMq 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(); + } } diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 233128433..b668f13e5 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -263,6 +263,15 @@ SQL; global $CC_CONFIG; $con = Propel::getConnection(); + $p_start_str = $p_start->format("Y-m-d H:i:s"); + $p_end_str = $p_end->format("Y-m-d H:i:s"); + + + //We need to search 24 hours before and after the show times so that that we + //capture all of the show's contents. + $p_track_start= $p_start->sub(new DateInterval("PT24H"))->format("Y-m-d H:i:s"); + $p_track_end = $p_end->add(new DateInterval("PT24H"))->format("Y-m-d H:i:s"); + $templateSql = <<= '{$p_start}' - AND sched.starts < '{$p_end}') - OR (sched.ends > '{$p_start}' - AND sched.ends <= '{$p_end}') - OR (sched.starts <= '{$p_start}' - AND sched.ends >= '{$p_end}')) + AND ((sched.starts >= '{$p_track_start}' + AND sched.starts < '{$p_track_end}') + OR (sched.ends > '{$p_track_start}' + AND sched.ends <= '{$p_track_end}') + OR (sched.starts <= '{$p_track_start}' + AND sched.ends >= '{$p_track_end}')) ) SQL; @@ -315,12 +324,12 @@ SQL; $streamJoin = <<= '{$p_start}' - AND sched.starts < '{$p_end}') - OR (sched.ends > '{$p_start}' - AND sched.ends <= '{$p_end}') - OR (sched.starts <= '{$p_start}' - AND sched.ends >= '{$p_end}')) + AND ((sched.starts >= '{$p_track_start}' + AND sched.starts < '{$p_track_end}') + OR (sched.ends > '{$p_track_start}' + AND sched.ends <= '{$p_track_end}') + OR (sched.starts <= '{$p_track_start}' + AND sched.ends >= '{$p_track_end}')) ) LEFT JOIN cc_subjs AS sub ON (ws.creator_id = sub.id) SQL; @@ -358,12 +367,12 @@ SELECT showt.name AS show_name, JOIN cc_show AS showt ON (showt.id = si.show_id) WHERE si.modified_instance = FALSE $showPredicate - AND ((si.starts >= '{$p_start}' - AND si.starts < '{$p_end}') - OR (si.ends > '{$p_start}' - AND si.ends <= '{$p_end}') - OR (si.starts <= '{$p_start}' - AND si.ends >= '{$p_end}')) + AND ((si.starts >= '{$p_start_str}' + AND si.starts < '{$p_end_str}') + OR (si.ends > '{$p_start_str}' + AND si.ends <= '{$p_end_str}') + OR (si.starts <= '{$p_start_str}' + AND si.ends >= '{$p_end_str}')) ORDER BY si_starts, sched_starts; SQL; diff --git a/airtime_mvc/application/models/ShowBuilder.php b/airtime_mvc/application/models/ShowBuilder.php index 90a67a1d6..8436c3011 100644 --- a/airtime_mvc/application/models/ShowBuilder.php +++ b/airtime_mvc/application/models/ShowBuilder.php @@ -423,8 +423,7 @@ class Application_Model_ShowBuilder } $scheduled_items = Application_Model_Schedule::GetScheduleDetailItems( - $this->startDT->format("Y-m-d H:i:s"), $this->endDT->format( - "Y-m-d H:i:s"), $shows); + $this->startDT, $this->endDT, $shows); for ($i = 0, $rows = count($scheduled_items); $i < $rows; $i++) { diff --git a/airtime_mvc/application/models/User.php b/airtime_mvc/application/models/User.php index 63b82820a..48a4c3e2f 100644 --- a/airtime_mvc/application/models/User.php +++ b/airtime_mvc/application/models/User.php @@ -329,14 +329,24 @@ 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) { + foreach($res['aaData'] as $key => &$record){ if ($record['login'] == $username) { $record['delete'] = "self"; } else { $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']--; + } } + $res['aaData'] = array_values($res['aaData']); + return $res; } diff --git a/airtime_mvc/application/views/scripts/form/preferences_soundcloud.phtml b/airtime_mvc/application/views/scripts/form/preferences_soundcloud.phtml index 20bcc92c9..8a007c10d 100644 --- a/airtime_mvc/application/views/scripts/form/preferences_soundcloud.phtml +++ b/airtime_mvc/application/views/scripts/form/preferences_soundcloud.phtml @@ -13,19 +13,6 @@ -
- - element->getElement('UseSoundCloud')->hasErrors()) : ?> -
    - element->getElement('UseSoundCloud')->getMessages() as $error): ?> -
  • - -
- -