From 94d9577539119c11e4aa0e95ceb0a439d2d0b4f8 Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Mon, 1 Dec 2014 11:34:47 -0500 Subject: [PATCH 1/9] Temporarily disable the Google Tag Manager generation for debugging --- airtime_mvc/application/controllers/ShowbuilderController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/controllers/ShowbuilderController.php b/airtime_mvc/application/controllers/ShowbuilderController.php index 2de99ce52..09314a432 100644 --- a/airtime_mvc/application/controllers/ShowbuilderController.php +++ b/airtime_mvc/application/controllers/ShowbuilderController.php @@ -35,7 +35,7 @@ class ShowbuilderController extends Zend_Controller_Action $user = Application_Model_User::GetCurrentUser(); $userType = $user->getType(); $this->view->headScript()->appendScript("localStorage.setItem( 'user-type', '$userType' );"); - $this->view->headScript()->appendScript($this->generateGoogleTagManagerDataLayerJavaScript()); + //$this->view->headScript()->appendScript($this->generateGoogleTagManagerDataLayerJavaScript()); $this->view->headScript()->appendFile($baseUrl.'js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); From 183fa7b3a3b8eeaaf0274714e4a6baa6d4e7bbce Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Mon, 1 Dec 2014 16:10:03 -0500 Subject: [PATCH 2/9] Bind CURL calls to WHMCS to ipv4 adapter because WHMCS IP whitelist doesn't support IPv6 * Fixes WHMCS login for all airtime.pro users --- .../application/controllers/BillingController.php | 3 ++- .../application/controllers/ShowbuilderController.php | 3 ++- .../application/controllers/WhmcsLoginController.php | 10 +++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/airtime_mvc/application/controllers/BillingController.php b/airtime_mvc/application/controllers/BillingController.php index ca2f7594d..fd7f90c10 100644 --- a/airtime_mvc/application/controllers/BillingController.php +++ b/airtime_mvc/application/controllers/BillingController.php @@ -572,6 +572,7 @@ class BillingController extends Zend_Controller_Action { try { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 ); // WHMCS IP whitelist doesn't support IPv6 curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 5); //Aggressive 5 second timeout curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); @@ -598,4 +599,4 @@ class BillingController extends Zend_Controller_Action { throw new Exception("Invalid client ID: " . Application_Model_Preference::GetClientId()); } } -} \ No newline at end of file +} diff --git a/airtime_mvc/application/controllers/ShowbuilderController.php b/airtime_mvc/application/controllers/ShowbuilderController.php index 09314a432..b88d4e2e7 100644 --- a/airtime_mvc/application/controllers/ShowbuilderController.php +++ b/airtime_mvc/application/controllers/ShowbuilderController.php @@ -35,7 +35,7 @@ class ShowbuilderController extends Zend_Controller_Action $user = Application_Model_User::GetCurrentUser(); $userType = $user->getType(); $this->view->headScript()->appendScript("localStorage.setItem( 'user-type', '$userType' );"); - //$this->view->headScript()->appendScript($this->generateGoogleTagManagerDataLayerJavaScript()); + $this->view->headScript()->appendScript($this->generateGoogleTagManagerDataLayerJavaScript()); $this->view->headScript()->appendFile($baseUrl.'js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); @@ -439,6 +439,7 @@ class ShowbuilderController extends Zend_Controller_Action $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 ); // WHMCS IP whitelist doesn't support IPv6 curl_setopt($ch, CURLOPT_TIMEOUT, 5); //Aggressive 5 second timeout curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string); diff --git a/airtime_mvc/application/controllers/WhmcsLoginController.php b/airtime_mvc/application/controllers/WhmcsLoginController.php index b8573c557..0b8a00a83 100644 --- a/airtime_mvc/application/controllers/WhmcsLoginController.php +++ b/airtime_mvc/application/controllers/WhmcsLoginController.php @@ -155,6 +155,7 @@ class WHMCS_Auth_Adapter implements Zend_Auth_Adapter_Interface { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, WHMCS_API_URL); + curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 ); // WHMCS IP whitelist doesn't support IPv6 curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_FAILONERROR, 1); @@ -164,7 +165,8 @@ class WHMCS_Auth_Adapter implements Zend_Auth_Adapter_Interface { curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $jsondata = curl_exec($ch); if (curl_error($ch)) { - die(curl_getinfo($ch, CURLINFO_EFFECTIVE_URL)); + Logging::error("Failed to reach WHMCS server in " . __FUNCTION__ . ": " + . curl_errno($ch) . ' - ' . curl_error($ch) . ' - ' . curl_getinfo($ch, CURLINFO_EFFECTIVE_URL)); //die("Connection Error: ".curl_errno($ch).' - '.curl_error($ch)); } curl_close($ch); @@ -201,6 +203,7 @@ class WHMCS_Auth_Adapter implements Zend_Auth_Adapter_Interface { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, WHMCS_API_URL); + curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 ); // WHMCS IP whitelist doesn't support IPv6 curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_FAILONERROR, 1); @@ -210,7 +213,8 @@ class WHMCS_Auth_Adapter implements Zend_Auth_Adapter_Interface { curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $jsondata = curl_exec($ch); if (curl_error($ch)) { - die(curl_getinfo($ch, CURLINFO_EFFECTIVE_URL)); + Logging::error("Failed to reach WHMCS server in " . __FUNCTION__ . ": " + . curl_errno($ch) . ' - ' . curl_error($ch) . ' - ' . curl_getinfo($ch, CURLINFO_EFFECTIVE_URL)); //die("Connection Error: ".curl_errno($ch).' - '.curl_error($ch)); } curl_close($ch); @@ -255,4 +259,4 @@ class WHMCS_Auth_Adapter implements Zend_Auth_Adapter_Interface { } return false; } -} \ No newline at end of file +} From ad56d6cafbb3442592fe6692d4c1842f2725e168 Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Thu, 11 Dec 2014 17:40:34 -0500 Subject: [PATCH 3/9] Show the plan and station URL in Live Chat --- airtime_mvc/application/Bootstrap.php | 6 +++++- airtime_mvc/public/js/airtime/common/livechat.js | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index 715c90a2c..6b29aa081 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -159,7 +159,11 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap && strpos($_SERVER['REQUEST_URI'], $baseUrl.'audiopreview/block-preview') === false) { if (Application_Model_Preference::GetLiveChatEnabled()) { $client_id = Application_Model_Preference::GetClientId(); - $view->headScript()->appendScript("var livechat_client_id = '$client_id';"); + $plan_level = Application_Model_Preference::GetPlanLevel(); + $station_url = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; + $view->headScript()->appendScript("var livechat_client_id = $client_id;\n". + "var livechat_plan_type = '$plan_level';\n". + "var livechat_station_url = 'http://$station_url';"); $view->headScript()->appendFile($baseUrl . 'js/airtime/common/livechat.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); } } diff --git a/airtime_mvc/public/js/airtime/common/livechat.js b/airtime_mvc/public/js/airtime/common/livechat.js index 35801c697..0adc99d83 100644 --- a/airtime_mvc/public/js/airtime/common/livechat.js +++ b/airtime_mvc/public/js/airtime/common/livechat.js @@ -5,7 +5,9 @@ function setupLiveChat() { // this is where we pass custom variables to livechat; // only pass the client id assigned by WHMCS for now __lc.params = [ - { name: 'client_id', value: livechat_client_id } + { name: 'client_id', value: livechat_client_id }, + { name: 'plan_type', value: livechat_plan_type}, + { name: 'station_url', value: livechat_station_url} ]; var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true; @@ -15,4 +17,4 @@ function setupLiveChat() { $(document).ready(function() { setupLiveChat(); -}); \ No newline at end of file +}); From 797bafa45392ae1addda09ddfd0af196263d34e4 Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Fri, 12 Dec 2014 11:57:16 -0500 Subject: [PATCH 4/9] Make the LiveChat changes from yesterday slightly more reslient to missing database keys. --- airtime_mvc/application/Bootstrap.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index 6b29aa081..d92fa314e 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -158,10 +158,10 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap && strpos($_SERVER['REQUEST_URI'], $baseUrl.'audiopreview/playlist-preview') === false && strpos($_SERVER['REQUEST_URI'], $baseUrl.'audiopreview/block-preview') === false) { if (Application_Model_Preference::GetLiveChatEnabled()) { - $client_id = Application_Model_Preference::GetClientId(); - $plan_level = Application_Model_Preference::GetPlanLevel(); + $client_id = strval(Application_Model_Preference::GetClientId()); + $plan_level = strval(Application_Model_Preference::GetPlanLevel()); $station_url = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; - $view->headScript()->appendScript("var livechat_client_id = $client_id;\n". + $view->headScript()->appendScript("var livechat_client_id = '$client_id';\n". "var livechat_plan_type = '$plan_level';\n". "var livechat_station_url = 'http://$station_url';"); $view->headScript()->appendFile($baseUrl . 'js/airtime/common/livechat.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); From a0f5e338558a747ed3b7ce4b9251a8db79105688 Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Wed, 17 Dec 2014 16:10:04 -0500 Subject: [PATCH 5/9] Added "Help Center" link to Help menu for Josh --- airtime_mvc/application/configs/navigation.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/airtime_mvc/application/configs/navigation.php b/airtime_mvc/application/configs/navigation.php index 5b7e4e049..e25fb7900 100644 --- a/airtime_mvc/application/configs/navigation.php +++ b/airtime_mvc/application/configs/navigation.php @@ -114,6 +114,11 @@ $pages = array( 'uri' => '#', 'resource' => 'dashboard', 'pages' => array( + array( + 'label' => _('Help Center'), + 'uri' => "http://help.sourcefabric.org/", + 'target' => "_blank" + ), array( 'label' => _('Getting Started'), 'module' => 'default', From fc912923cea991bbe9841facd1f2c66e33369df6 Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Tue, 6 Jan 2015 12:58:11 -0500 Subject: [PATCH 6/9] Force the use of FDK-AAC and significantly boost AAC sound quality --- .../pypo/liquidsoap_scripts/fdkaac.liq | 22 ++++++++--------- .../pypo/liquidsoap_scripts/ls_lib.liq | 24 ++++++++++--------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/python_apps/pypo/liquidsoap_scripts/fdkaac.liq b/python_apps/pypo/liquidsoap_scripts/fdkaac.liq index 0c6945221..d1746e097 100644 --- a/python_apps/pypo/liquidsoap_scripts/fdkaac.liq +++ b/python_apps/pypo/liquidsoap_scripts/fdkaac.liq @@ -1,24 +1,24 @@ if bitrate == 24 then - ignore(output_stereo(%fdkaac(bitrate = 24, aot="mpeg4_he_aac_v2"), !source)) + ignore(output_stereo(%fdkaac(bitrate = 24, aot="mpeg4_he_aac_v2", afterburner=false, sbr_mode=true), !source)) elsif bitrate == 32 then - ignore(output_stereo(%fdkaac(bitrate = 32, aot="mpeg4_he_aac_v2"), !source)) + ignore(output_stereo(%fdkaac(bitrate = 32, aot="mpeg4_he_aac_v2", afterburner=false, sbr_mode=true), !source)) elsif bitrate == 48 then - ignore(output_stereo(%fdkaac(bitrate = 48, aot="mpeg4_he_aac_v2"), !source)) + ignore(output_stereo(%fdkaac(bitrate = 48, aot="mpeg4_he_aac_v2", afterburner=false, sbr_mode=true), !source)) elsif bitrate == 64 then - ignore(output_stereo(%fdkaac(bitrate = 64, aot="mpeg4_he_aac_v2"), !source)) + ignore(output_stereo(%fdkaac(bitrate = 64, aot="mpeg4_he_aac_v2", afterburner=false, sbr_mode=true), !source)) elsif bitrate == 96 then - ignore(output_stereo(%fdkaac(bitrate = 96, aot="mpeg4_he_aac_v2"), !source)) + ignore(output_stereo(%fdkaac(bitrate = 96, aot="mpeg4_he_aac_v2", afterburner=false, sbr_mode=true), !source)) elsif bitrate == 128 then - ignore(output_stereo(%fdkaac(bitrate = 128, aot="mpeg4_he_aac_v2"), !source)) + ignore(output_stereo(%fdkaac(bitrate = 128, aot="mpeg4_he_aac_v2", afterburner=false, sbr_mode=true), !source)) elsif bitrate == 160 then - ignore(output_stereo(%fdkaac(bitrate = 160, aot="mpeg4_he_aac_v2"), !source)) + ignore(output_stereo(%fdkaac(bitrate = 160, aot="mpeg4_he_aac_v2", afterburner=true, sbr_mode=true), !source)) elsif bitrate == 192 then - ignore(output_stereo(%fdkaac(bitrate = 192, aot="mpeg4_he_aac_v2"), !source)) + ignore(output_stereo(%fdkaac(bitrate = 192, aot="mpeg4_he_aac_v2"), afterburner=true, sbr_mode=true, !source)) elsif bitrate == 224 then - ignore(output_stereo(%fdkaac(bitrate = 224, aot="mpeg4_he_aac_v2"), !source)) + ignore(output_stereo(%fdkaac(bitrate = 224, aot="mpeg4_he_aac_v2"), afterburner=true, sbr_mode=true, !source)) elsif bitrate == 256 then - ignore(output_stereo(%fdkaac(bitrate = 256, aot="mpeg4_he_aac_v2"), !source)) + ignore(output_stereo(%fdkaac(bitrate = 256, aot="mpeg4_he_aac_v2"), afterburner=true, sbr_mode=true, !source)) elsif bitrate == 320 then - ignore(output_stereo(%fdkaac(bitrate = 320, aot="mpeg4_he_aac_v2"), !source)) + ignore(output_stereo(%fdkaac(bitrate = 320, aot="mpeg4_he_aac_v2"), afterburner=true, sbr_mode=true, !source)) end diff --git a/python_apps/pypo/liquidsoap_scripts/ls_lib.liq b/python_apps/pypo/liquidsoap_scripts/ls_lib.liq index e4459600d..0646bf6b6 100644 --- a/python_apps/pypo/liquidsoap_scripts/ls_lib.liq +++ b/python_apps/pypo/liquidsoap_scripts/ls_lib.liq @@ -150,20 +150,22 @@ def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, de end %endif - %ifencoder %aac - if type == "aac" then - %include "aac.liq" - end - %endif +# FDK-AAC is the only good AAC encoder. libvoaac is deprecated and aacplus is subpar. +# The difference in compression quality is clearly audible. -- Albert +# %ifencoder %aac +# if type == "aac" then +# %include "aac.liq" +# end +# %endif - %ifencoder %aacplus - if type == "aacplus" then - %include "aacplus.liq" - end - %endif +# %ifencoder %aacplus +# if type == "aacplus" then +# %include "aacplus.liq" +# end +# %endif %ifencoder %fdkaac - if type == "fdkaac" then + if type == "aac" then %include "fdkaac.liq" end %endif From 3225fcc6bcbcedaf514a9f0b5150733aa66b2903 Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Wed, 7 Jan 2015 11:35:43 -0500 Subject: [PATCH 7/9] Fix syntax errors in fdkaac.liq --- python_apps/pypo/liquidsoap_scripts/fdkaac.liq | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python_apps/pypo/liquidsoap_scripts/fdkaac.liq b/python_apps/pypo/liquidsoap_scripts/fdkaac.liq index d1746e097..ab51b8655 100644 --- a/python_apps/pypo/liquidsoap_scripts/fdkaac.liq +++ b/python_apps/pypo/liquidsoap_scripts/fdkaac.liq @@ -13,12 +13,12 @@ elsif bitrate == 160 then ignore(output_stereo(%fdkaac(bitrate = 160, aot="mpeg4_he_aac_v2", afterburner=true, sbr_mode=true), !source)) elsif bitrate == 192 then - ignore(output_stereo(%fdkaac(bitrate = 192, aot="mpeg4_he_aac_v2"), afterburner=true, sbr_mode=true, !source)) + ignore(output_stereo(%fdkaac(bitrate = 192, aot="mpeg4_he_aac_v2", afterburner=true, sbr_mode=true), !source)) elsif bitrate == 224 then - ignore(output_stereo(%fdkaac(bitrate = 224, aot="mpeg4_he_aac_v2"), afterburner=true, sbr_mode=true, !source)) + ignore(output_stereo(%fdkaac(bitrate = 224, aot="mpeg4_he_aac_v2", afterburner=true, sbr_mode=true), !source)) elsif bitrate == 256 then - ignore(output_stereo(%fdkaac(bitrate = 256, aot="mpeg4_he_aac_v2"), afterburner=true, sbr_mode=true, !source)) + ignore(output_stereo(%fdkaac(bitrate = 256, aot="mpeg4_he_aac_v2", afterburner=true, sbr_mode=true), !source)) elsif bitrate == 320 then - ignore(output_stereo(%fdkaac(bitrate = 320, aot="mpeg4_he_aac_v2"), afterburner=true, sbr_mode=true, !source)) + ignore(output_stereo(%fdkaac(bitrate = 320, aot="mpeg4_he_aac_v2", afterburner=true, sbr_mode=true), !source)) end From 05c9e21e484a17ea6e4301b9b55cd49a3b7da78a Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Fri, 9 Jan 2015 10:44:24 -0500 Subject: [PATCH 8/9] Recognize audio/aac as a MIME type for webstreams --- airtime_mvc/application/models/Webstream.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/Webstream.php b/airtime_mvc/application/models/Webstream.php index 21c794b07..a7e7d82b1 100644 --- a/airtime_mvc/application/models/Webstream.php +++ b/airtime_mvc/application/models/Webstream.php @@ -309,7 +309,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable $media_url = self::getXspfUrl($url); } elseif (preg_match("/pls\+xml/", $mime) || preg_match("/x-scpls/", $mime)) { $media_url = self::getPlsUrl($url); - } elseif (preg_match("/(mpeg|ogg|audio\/aacp)/", $mime)) { + } elseif (preg_match("/(mpeg|ogg|audio\/aacp|audio\/aac)/", $mime)) { if ($content_length_found) { throw new Exception(_("Invalid webstream - This appears to be a file download.")); } From 9cfcaf2ffd7ae65b31874cc8f487af967a85e481 Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Mon, 12 Jan 2015 22:29:21 -0500 Subject: [PATCH 9/9] SAAS-537: Fixed the week view of the schedule widgets * Also improved the instructions inline for how to use them... (this is a stop-gap measure until we get a real iframe widget) * ALSO renamed the field HTML Code since it's not JS! (it was misleading before) --- .../application/forms/GeneralPreferences.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/forms/GeneralPreferences.php b/airtime_mvc/application/forms/GeneralPreferences.php index c45437b08..ecee11b6d 100644 --- a/airtime_mvc/application/forms/GeneralPreferences.php +++ b/airtime_mvc/application/forms/GeneralPreferences.php @@ -94,7 +94,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm // // Add the description element $this->addElement('textarea', 'widgetCode', array( - 'label' => 'Javascript Code:', + 'label' => _('HTML Code:'), 'required' => false, 'readonly' => true, 'style' => 'font-family: Consolas, "Liberation Mono", Courier, @@ -134,10 +134,14 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm $host = $_SERVER['SERVER_NAME']; $code = << - - + + + + + +
@@ -159,6 +163,8 @@ $(document).ready(function() { sourceDomain:"http://$host", updatePeriod: 600 //seconds }); + var d = new Date().getDay(); + $('#scheduleTabs').tabs({selected: d === 0 ? 6 : d-1, fx: { opacity: 'toggle' }}); }); CODE;