From a0bf7c90ba8abfc9c1c61b30fe47a545c6b5d6ab Mon Sep 17 00:00:00 2001 From: Yuchen Wang Date: Wed, 16 Nov 2011 15:52:05 -0500 Subject: [PATCH 1/9] CC-2436: Save pulldown settings Fixing the issue of "show entries" dropdown setting not being saved. After some investigation, it seems like we're destroying the calendar everytime we modify the dropdown value, and create a new one, which explains why the new setting is not being saved. Fixed by moving the code that handles the updating to the place after we create the new calendar. This makes the code cleaner as well. --- airtime_mvc/application/models/Preference.php | 26 +++++++++---- .../schedule/full-calendar-functions.js | 8 ++++ .../public/js/airtime/schedule/schedule.js | 38 +------------------ 3 files changed, 28 insertions(+), 44 deletions(-) diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index d76b4e9fc..2d86e2bfa 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -559,19 +559,24 @@ class Application_Model_Preference /* User specific preferences start */ /** - * Sets the time scale preference (day/week/month) in Calendar. + * Sets the time scale preference (agendaDay/agendaWeek/month) in Calendar. * * @param $timeScale new time scale */ - public static function SetCalendarTimeScale($timeScale) { - return self::SetValue("calendar_time_scale", $timeScale, true /* user specific */); + public static function SetCalendarTimeScale($timeScale) { + self::SetValue("calendar_time_scale", $timeScale, true /* user specific */); } /** * Retrieves the time scale preference for the current user. + * Defaults to month if no entry exists */ public static function GetCalendarTimeScale() { - return self::GetValue("calendar_time_scale", true /* user specific */); + $val = self::GetValue("calendar_time_scale", true /* user specific */); + if(strlen($val) == 0) { + $val = 'month'; + } + return $val; } /** @@ -580,7 +585,7 @@ class Application_Model_Preference * @param $numEntries new number of entries to show */ public static function SetLibraryNumEntries($numEntries) { - return self::SetValue("library_num_entries", $numEntries, true /* user specific */); + self::SetValue("library_num_entries", $numEntries, true /* user specific */); } /** @@ -595,15 +600,20 @@ class Application_Model_Preference * * @param $timeInterval new time interval */ - public static function SetCalendarTimeInterval($timeInterval) { - return self::SetValue("calendar_time_interval", $timeInterval, true /* user specific */); + public static function SetCalendarTimeInterval($timeInterval) { + self::SetValue("calendar_time_interval", $timeInterval, true /* user specific */); } /** * Retrieves the time interval preference for the current user. + * Defaults to 30 min if no entry exists */ public static function GetCalendarTimeInterval() { - return self::GetValue("calendar_time_interval", true /* user specific */); + $val = self::GetValue("calendar_time_interval", true /* user specific */); + if(strlen($val) == 0) { + $val = "30"; + } + return $val; } /* User specific preferences end */ diff --git a/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js b/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js index 9b21086d1..dae0c5648 100644 --- a/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js +++ b/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js @@ -197,6 +197,10 @@ function viewDisplay( view ) { .fullCalendar('destroy') .fullCalendar(opt) .fullCalendar( 'gotoDate', date ); + + //save slotMin value to db + var url = '/Schedule/set-time-interval/format/json'; + $.post(url, {timeInterval: slotMin}); }); var topLeft = $(view.element).find("table.fc-agenda-days > thead th:first"); @@ -214,6 +218,10 @@ function viewDisplay( view ) { if(($("#add-show-form").length == 1) && ($("#add-show-form").css('display')=='none') && ($('.fc-header-left > span').length == 5)) { makeAddShowButton(); } + + //save view name to db + var url = '/Schedule/set-time-scale/format/json'; + $.post(url, {timeScale: view.name}); } function eventRender(event, element, view) { diff --git a/airtime_mvc/public/js/airtime/schedule/schedule.js b/airtime_mvc/public/js/airtime/schedule/schedule.js index e3cd1a523..6cc8858bf 100644 --- a/airtime_mvc/public/js/airtime/schedule/schedule.js +++ b/airtime_mvc/public/js/airtime/schedule/schedule.js @@ -306,26 +306,14 @@ function buildScheduleDialog(json){ * Use user preference for time scale; defaults to month if preference was never set */ function getTimeScalePreference(data) { - var timeScale = data.calendarInit.timeScale; - if(timeScale == 'day') { - timeScale = 'agendaDay'; - } else if(timeScale == 'week') { - timeScale = 'agendaWeek'; - } else { - timeScale = 'month'; - } - return timeScale; + return data.calendarInit.timeScale; } /** * Use user preference for time interval; defaults to 30m if preference was never set */ function getTimeIntervalPreference(data) { - var timeInterval = data.calendarInit.timeInterval; - if(timeInterval == '') { - timeInterval = '30'; - } - return parseInt(timeInterval); + return parseInt(data.calendarInit.timeInterval); } function createFullCalendar(data){ @@ -366,28 +354,6 @@ function createFullCalendar(data){ eventDrop: eventDrop, eventResize: eventResize }); - - //Update time scale preference when day/week/month button is clicked - $(".fc-button-content").click(function() { - var url = '/Schedule/set-time-scale/format/json'; - $.post(url, {timeScale: $(this).text()}, - function(json){ - if(json.error) { - alert(json.error); - } - }); - }); - - //Update time interval preference when dropdown is updated - $(".schedule_change_slots.input_select").change(function() { - var url = '/Schedule/set-time-interval/format/json'; - $.post(url, {timeInterval: $(this).val()}, - function(json){ - if(json.error) { - alert(json.error); - } - }); - }); } //Alert the error and reload the page From 1fd29def278e3490aa595e5c833e0c2d78bb2ec3 Mon Sep 17 00:00:00 2001 From: Yuchen Wang Date: Wed, 16 Nov 2011 16:12:58 -0500 Subject: [PATCH 2/9] CC-2436: Save pulldown settings Move the code that updates the database for the "show entries" dropdown to a more appropriate place. --- airtime_mvc/application/models/Preference.php | 9 ++- .../public/js/airtime/library/library.js | 67 +++++++++---------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index 010daa713..e528308e8 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -574,7 +574,7 @@ class Application_Model_Preference public static function GetCalendarTimeScale() { $val = self::GetValue("calendar_time_scale", true /* user specific */); if(strlen($val) == 0) { - $val = 'month'; + $val = "month"; } return $val; } @@ -590,9 +590,14 @@ class Application_Model_Preference /** * Retrieves the number of entries to show preference in library under Playlist Builder. + * Defaults to 10 if no entry exists */ public static function GetLibraryNumEntries() { - return self::GetValue("library_num_entries", true /* user specific */); + $val = self::GetValue("library_num_entries", true /* user specific */); + if(strlen($val) == 0) { + $val = "10"; + } + return $val; } /** diff --git a/airtime_mvc/public/js/airtime/library/library.js b/airtime_mvc/public/js/airtime/library/library.js index 46b29b29c..ec04a37c7 100644 --- a/airtime_mvc/public/js/airtime/library/library.js +++ b/airtime_mvc/public/js/airtime/library/library.js @@ -122,6 +122,7 @@ function dtRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) { function dtDrawCallback() { addLibraryItemEvents(); addMetadataQtip(); + saveNumEntriesSetting(); } function addProgressIcon(id) { @@ -280,19 +281,24 @@ function addMetadataQtip(){ } /** - * Use user preference for number of entries to show; - * defaults to 10 if preference was never set + * Updates pref db when user changes the # of entries to show + */ +function saveNumEntriesSetting() { + $('select[name=library_display_length]').change(function() { + var url = '/Library/set-num-entries/format/json'; + $.post(url, {numEntries: $(this).val()}); + }); +} + +/** + * Use user preference for number of entries to show */ function getNumEntriesPreference(data) { - var numEntries = data.libraryInit.numEntries; - if(numEntries == '') { - numEntries = '10'; - } - return parseInt(numEntries); + return parseInt(data.libraryInit.numEntries); } function createDataTable(data) { - var dTable = $('#library_display').dataTable( { + var dTable = $('#library_display').dataTable( { "bProcessing": true, "bServerSide": true, "sAjaxSource": "/Library/contents/format/json", @@ -320,35 +326,24 @@ function createDataTable(data) { "sPaginationType": "full_numbers", "bJQueryUI": true, "bAutoWidth": false, - "oLanguage": { - "sSearch": "" - }, - "iDisplayLength": getNumEntriesPreference(data), - "bStateSave": true - }); - dTable.fnSetFilteringDelay(350); - - // Updates pref db when user changes the # of entries to show - $('select[name=library_display_length]').change(function() { - var url = '/Library/set-num-entries/format/json'; - $.post(url, {numEntries: $(this).val()}, - function(json){ - if(json.error) { - alert(json.error); - } - }); - }); + "oLanguage": { + "sSearch": "" + }, + "iDisplayLength": getNumEntriesPreference(data), + "bStateSave": true + }); + dTable.fnSetFilteringDelay(350); } $(document).ready(function() { - $('.tabs').tabs(); - - $.ajax({ url: "/Api/library-init/format/json", dataType:"json", success:createDataTable - , error:function(jqXHR, textStatus, errorThrown){}}); - - checkImportStatus() - setInterval( "checkImportStatus()", 5000 ); - setInterval( "checkSCUploadStatus()", 5000 ); - - addQtipToSCIcons() + $('.tabs').tabs(); + + $.ajax({ url: "/Api/library-init/format/json", dataType:"json", success:createDataTable, + error:function(jqXHR, textStatus, errorThrown){}}); + + checkImportStatus() + setInterval( "checkImportStatus()", 5000 ); + setInterval( "checkSCUploadStatus()", 5000 ); + + addQtipToSCIcons() }); From 1b3d61913b36f384efde4feb3637e3c6bc940c0e Mon Sep 17 00:00:00 2001 From: james Date: Wed, 16 Nov 2011 16:31:27 -0500 Subject: [PATCH 3/9] CC-3052: Stream settings collapse when req. input is missing - fixed. It was only handling error in the "Additional Input" --- .../public/js/airtime/preferences/streamsetting.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/airtime_mvc/public/js/airtime/preferences/streamsetting.js b/airtime_mvc/public/js/airtime/preferences/streamsetting.js index bf29514c2..277d1e34a 100644 --- a/airtime_mvc/public/js/airtime/preferences/streamsetting.js +++ b/airtime_mvc/public/js/airtime/preferences/streamsetting.js @@ -2,9 +2,12 @@ function showErrorSections() { $(".errors").each(function(i){ if($(this).length > 0){ - $(window).scrollTop($(this).closest("div").position().top); - $(this).closest("fieldset").removeClass('closed'); - return false; + var div = $(this).closest("div") + if(div.attr('class') == "stream-setting-content"){ + $(this).closest("div").show(); + $(this).closest("fieldset").removeClass('closed'); + $(window).scrollTop($(this).closest("div").position().top); + } } }); } From 1f9b2559ab780b0541c9563096db3f21c5dabf39 Mon Sep 17 00:00:00 2001 From: james Date: Wed, 16 Nov 2011 16:46:54 -0500 Subject: [PATCH 4/9] CC-3032: Airtime -> Help -> About. shows variable name instead of value - fixed --- airtime_mvc/application/controllers/DashboardController.php | 2 +- airtime_mvc/application/views/scripts/dashboard/about.phtml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/controllers/DashboardController.php b/airtime_mvc/application/controllers/DashboardController.php index 8b918137d..afdb26f33 100644 --- a/airtime_mvc/application/controllers/DashboardController.php +++ b/airtime_mvc/application/controllers/DashboardController.php @@ -35,7 +35,7 @@ class DashboardController extends Zend_Controller_Action public function aboutAction() { - // action body + $this->view->airtime_version = Application_Model_Preference::GetAirtimeVersion(); } } diff --git a/airtime_mvc/application/views/scripts/dashboard/about.phtml b/airtime_mvc/application/views/scripts/dashboard/about.phtml index 6a551c1e4..bdedfcfd2 100644 --- a/airtime_mvc/application/views/scripts/dashboard/about.phtml +++ b/airtime_mvc/application/views/scripts/dashboard/about.phtml @@ -1,7 +1,7 @@

About

-Airtime , the open radio software for scheduling and remote station management.
+Airtime airtime_version ?>, the open radio software for scheduling and remote station management.
© 2011 Sourcefabric o.p.s 2011. Airtime is distributed under the GNU GPL v.3

From 590a74b8ce072f6bac98ab1292065ad8ff21a2d8 Mon Sep 17 00:00:00 2001 From: james Date: Wed, 16 Nov 2011 17:57:07 -0500 Subject: [PATCH 5/9] CC-3053: Stream settings -> the collapse/expend arrow is pointing the wrong way - fixed --- .../application/views/scripts/form/stream-setting-form.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/views/scripts/form/stream-setting-form.phtml b/airtime_mvc/application/views/scripts/form/stream-setting-form.phtml index 5417b35a6..020be44a9 100644 --- a/airtime_mvc/application/views/scripts/form/stream-setting-form.phtml +++ b/airtime_mvc/application/views/scripts/form/stream-setting-form.phtml @@ -1,7 +1,7 @@ stream_number; ?> -

Stream stream_number?>

+

">Stream stream_number?>

stream_number != '1'?'style="display: none;':''?> id="-config">
From ad708d9983cc583639b861f24ff39bf4837d854b Mon Sep 17 00:00:00 2001 From: james Date: Wed, 16 Nov 2011 18:14:10 -0500 Subject: [PATCH 6/9] CC-2156: Searching for a host and hitting ENTER submits the show form - done. Had to port the code manually --- .../controllers/UserController.php | 1 + airtime_mvc/application/forms/AddShowWho.php | 2 +- airtime_mvc/application/models/User.php | 2 +- .../public/js/airtime/schedule/add-show.js | 20 +++++++++++++++++-- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/controllers/UserController.php b/airtime_mvc/application/controllers/UserController.php index b84a0dede..37404931c 100644 --- a/airtime_mvc/application/controllers/UserController.php +++ b/airtime_mvc/application/controllers/UserController.php @@ -63,6 +63,7 @@ class UserController extends Zend_Controller_Action public function getHostsAction() { $search = $this->_getParam('term'); + $res = Application_Model_User::getHosts($search); $this->view->hosts = Application_Model_User::getHosts($search); } diff --git a/airtime_mvc/application/forms/AddShowWho.php b/airtime_mvc/application/forms/AddShowWho.php index 360a5abea..22dd109eb 100644 --- a/airtime_mvc/application/forms/AddShowWho.php +++ b/airtime_mvc/application/forms/AddShowWho.php @@ -16,7 +16,7 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm $hosts = Application_Model_User::getHosts(); foreach ($hosts as $host) { - $options[$host['value']] = $host['label']; + $options[$host['index']] = $host['label']; } //Add hosts selection diff --git a/airtime_mvc/application/models/User.php b/airtime_mvc/application/models/User.php index 6f0ec13c7..81548f013 100644 --- a/airtime_mvc/application/models/User.php +++ b/airtime_mvc/application/models/User.php @@ -163,7 +163,7 @@ class Application_Model_User { $sql; - $sql_gen = "SELECT id AS value, login AS label FROM cc_subjs "; + $sql_gen = "SELECT login AS value, login AS label, id as index FROM cc_subjs "; $sql = $sql_gen; if(is_array($type)) { diff --git a/airtime_mvc/public/js/airtime/schedule/add-show.js b/airtime_mvc/public/js/airtime/schedule/add-show.js index 09e6a997e..0a7da3f8d 100644 --- a/airtime_mvc/public/js/airtime/schedule/add-show.js +++ b/airtime_mvc/public/js/airtime/schedule/add-show.js @@ -40,7 +40,7 @@ function createDateInput(el, onSelect) { function autoSelect(event, ui) { - $("#add_show_hosts-"+ui.item.value).attr("checked", "checked"); + $("#add_show_hosts-"+ui.item.index).attr("checked", "checked"); event.preventDefault(); } @@ -50,11 +50,21 @@ function findHosts(request, callback) { url = "/User/get-hosts"; search = request.term; + var noResult = new Array(); + noResult[0] = new Array(); + noResult[0]['value'] = $("#add_show_hosts_autocomplete").val(); + noResult[0]['label'] = "No result found"; + noResult[0]['index'] = null; + $.post(url, {format: "json", term: search}, function(json) { - callback(json.hosts); + if(json.hosts.length<1){ + callback(noResult); + }else{ + callback(json.hosts); + } }); } @@ -232,6 +242,12 @@ function setAddShowEvents() { select: autoSelect, delay: 200 }); + + form.find("#add_show_hosts_autocomplete").keypress(function(e){ + if( e.which == 13 ){ + return false; + } + }) form.find("#schedule-show-style input").ColorPicker({ onChange: function (hsb, hex, rgb, el) { From 9e48139bddacc99aea2b1669d3762fef45c6c78a Mon Sep 17 00:00:00 2001 From: Yuchen Wang Date: Wed, 16 Nov 2011 19:45:36 -0500 Subject: [PATCH 7/9] CC-3049: Extra grey space in live stream box Fixed by changing new window height --- airtime_mvc/public/js/airtime/dashboard/playlist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/public/js/airtime/dashboard/playlist.js b/airtime_mvc/public/js/airtime/dashboard/playlist.js index 070ac4686..0c0e2f4c6 100644 --- a/airtime_mvc/public/js/airtime/dashboard/playlist.js +++ b/airtime_mvc/public/js/airtime/dashboard/playlist.js @@ -264,7 +264,7 @@ function init() { $('.listen-control-button').click(function() { if (stream_window == null || stream_window.closed) - stream_window=window.open(baseUrl+"Dashboard/stream-player", 'name', 'width=400,height=216'); + stream_window=window.open(baseUrl+"Dashboard/stream-player", 'name', 'width=400,height=178'); stream_window.focus(); return false; }); From eae90862b10551a3d53cd206fe3e18c86f111173 Mon Sep 17 00:00:00 2001 From: Yuchen Wang Date: Thu, 17 Nov 2011 14:10:26 -0500 Subject: [PATCH 8/9] CC-2950: Tell users if they are running an out-of-date version or not Get rid of hardcoded url for downloading the latest version, and use the url stored in the stat server instead --- airtime_mvc/application/models/Preference.php | 13 +++++++++++++ .../application/views/helpers/VersionNotify.php | 2 ++ .../public/js/airtime/dashboard/versiontooltip.js | 14 +++++++------- utils/phone_home_stat.php | 4 +++- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index e528308e8..509abecf7 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -526,6 +526,19 @@ class Application_Model_Preference self::SetValue("latest_version", $version); } } + + public static function GetLatestLink(){ + $link = self::GetValue("latest_link"); + if($link == null || strlen($link) == 0) { + return ""; + } else { + return $link; + } + } + + public static function SetLatestLink($link){ + self::SetValue("latest_link", $link); + } public static function SetUploadToSoundcloudOption($upload) { self::SetValue("soundcloud_upload_option", $upload); diff --git a/airtime_mvc/application/views/helpers/VersionNotify.php b/airtime_mvc/application/views/helpers/VersionNotify.php index 655843f0e..430f7f2ed 100644 --- a/airtime_mvc/application/views/helpers/VersionNotify.php +++ b/airtime_mvc/application/views/helpers/VersionNotify.php @@ -19,6 +19,7 @@ class Airtime_View_Helper_VersionNotify extends Zend_View_Helper_Abstract{ // retrieve and validate current and latest versions, $current = Application_Model_Preference::GetAirtimeVersion(); $latest = Application_Model_Preference::GetLatestVersion(); + $link = Application_Model_Preference::GetLatestLink(); $pattern = "/^([0-9]+)\.([0-9]+)\.[0-9]+/"; preg_match($pattern, $current, $curMatch); preg_match($pattern, $latest, $latestMatch); @@ -50,6 +51,7 @@ class Airtime_View_Helper_VersionNotify extends Zend_View_Helper_Abstract{ $result = "" . "" . "" + . "" . "
"; return $result; } diff --git a/airtime_mvc/public/js/airtime/dashboard/versiontooltip.js b/airtime_mvc/public/js/airtime/dashboard/versiontooltip.js index e428cc7f3..6087bb6a2 100644 --- a/airtime_mvc/public/js/airtime/dashboard/versiontooltip.js +++ b/airtime_mvc/public/js/airtime/dashboard/versiontooltip.js @@ -40,6 +40,13 @@ function getLatestVersion() { return $("#version-latest").html(); } +/** + * Returns the download link to latest release in HTML + */ +function getLatestLink() { + return "" + getLatestVersion() + ""; +} + /** * Returns true if current version is up to date */ @@ -51,13 +58,6 @@ function isUpToDate() { return (diff == 0 && current == latest) || diff < 0; } -/** - * Returns the download link to latest release in HTML - */ -function getLatestLink() { - return "" + getLatestVersion() + ""; -} - /** * Sets up the tooltip for version notification */ diff --git a/utils/phone_home_stat.php b/utils/phone_home_stat.php index fd1f90b81..24a975d06 100644 --- a/utils/phone_home_stat.php +++ b/utils/phone_home_stat.php @@ -82,8 +82,10 @@ if(Application_Model_Preference::GetPlanLevel() == 'disabled'){ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_URL, $url); $result = curl_exec($ch); + $resultArray = explode("\n", $result); - Application_Model_Preference::SetLatestVersion($result); + Application_Model_Preference::SetLatestVersion($resultArray[0]); + Application_Model_Preference::SetLatestLink($resultArray[1]); } /** From 52052bd57323b4bf960cd2e2316d9c892d4432d8 Mon Sep 17 00:00:00 2001 From: Yuchen Wang Date: Thu, 17 Nov 2011 15:33:29 -0500 Subject: [PATCH 9/9] CC-2950: Tell users if they are running an out-of-date version or not - added error checking to curl call - added regex validation when storing link to latest version --- airtime_mvc/application/models/Preference.php | 9 +++++++-- utils/phone_home_stat.php | 14 +++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index 509abecf7..82b29e387 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -530,14 +530,19 @@ class Application_Model_Preference public static function GetLatestLink(){ $link = self::GetValue("latest_link"); if($link == null || strlen($link) == 0) { - return ""; + return "http://www.sourcefabric.org/en/airtime/download/"; } else { return $link; } } public static function SetLatestLink($link){ - self::SetValue("latest_link", $link); + $pattern = "#^(http|https|ftp)://" . + "([a-zA-Z0-9]+\.)*[a-zA-Z0-9]+" . + "(/[a-zA-Z0-9\-\.\_\~\:\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=]+)*/?$#"; + if(preg_match($pattern, $link)) { + self::SetValue("latest_link", $link); + } } public static function SetUploadToSoundcloudOption($upload) { diff --git a/utils/phone_home_stat.php b/utils/phone_home_stat.php index 24a975d06..6b3d8ecde 100644 --- a/utils/phone_home_stat.php +++ b/utils/phone_home_stat.php @@ -72,6 +72,8 @@ if(Application_Model_Preference::GetSupportFeedback() == '1'){ curl_setopt($ch, CURLOPT_POSTFIELDS, $dataArray); $result = curl_exec($ch); + + curl_close($ch); } // Get latest version from stat server and store to db @@ -82,10 +84,16 @@ if(Application_Model_Preference::GetPlanLevel() == 'disabled'){ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_URL, $url); $result = curl_exec($ch); - $resultArray = explode("\n", $result); - Application_Model_Preference::SetLatestVersion($resultArray[0]); - Application_Model_Preference::SetLatestLink($resultArray[1]); + if(curl_errno($ch)) { + echo "curl error: " . curl_error($ch) . "\n"; + } else { + $resultArray = explode("\n", $result); + Application_Model_Preference::SetLatestVersion($resultArray[0]); + Application_Model_Preference::SetLatestLink($resultArray[1]); + } + + curl_close($ch); } /**