From ee59b4cd73b1db8df47c633d645d5ba8b38e7b9e Mon Sep 17 00:00:00 2001 From: int2001 Date: Tue, 27 Feb 2024 07:53:36 +0000 Subject: [PATCH 01/33] First Approach for the new "Reset to default" button (PHP) --- application/views/interface_assets/header.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/application/views/interface_assets/header.php b/application/views/interface_assets/header.php index 0673f45a9..55c0e34bc 100644 --- a/application/views/interface_assets/header.php +++ b/application/views/interface_assets/header.php @@ -52,7 +52,15 @@ } ?> Date: Tue, 27 Feb 2024 07:54:08 +0000 Subject: [PATCH 02/33] First Approach for the new "Reset to default" button (JS) --- assets/js/sections/qso.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js index e34420064..fc8bf71da 100644 --- a/assets/js/sections/qso.js +++ b/assets/js/sections/qso.js @@ -527,9 +527,17 @@ function changebadge(entityname) { } } +function reset_to_default() { + reset_fields(); + $("#stationProfile").val(activeStationId); + $("#selectPropagation").val(""); + $("#frequency_rx").val(""); + $("#band_rx").val(""); + $("#transmit_power").val(activeStationTXPower); +} + /* Function: reset_fields is used to reset the fields on the QSO page */ function reset_fields() { - $('#locator_info').text(""); $('#country').val(""); $('#continent').val(""); From 7673b5c22d1eca69881c1784cc207b759435d0c4 Mon Sep 17 00:00:00 2001 From: int2001 Date: Wed, 28 Feb 2024 14:14:29 +0000 Subject: [PATCH 03/33] Added Fullreset Logic (PHP) --- application/controllers/Qso.php | 10 +++++++++- application/views/interface_assets/header.php | 1 + application/views/qso/index.php | 8 +++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index f212b83d0..f04a8c29e 100755 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -99,8 +99,16 @@ class QSO extends CI_Controller { //change to create_qso function as add and create_qso duplicate functionality $this->logbook_model->create_qso(); + $retuner=[]; + $actstation=$this->stations->find_active() ?? ''; + $returner['activeStationId'] = $actstation; + $profile_info = $this->stations->profile($actstation)->row(); + $returner['activeStationTXPower'] = xss_clean($profile_info->station_power); + $returner['activeStationOP'] = xss_clean($this->session->userdata('operator_callsign')); + $returner['message']='success'; + // Get last 5 qsos - echo json_encode(array('message' => 'success')); + echo json_encode($returner); } } diff --git a/application/views/interface_assets/header.php b/application/views/interface_assets/header.php index 55c0e34bc..88ed12120 100644 --- a/application/views/interface_assets/header.php +++ b/application/views/interface_assets/header.php @@ -59,6 +59,7 @@ echo "var activeStationId = '".$actstation."';\n"; $profile_info = $this->stations->profile($actstation)->row(); echo "var activeStationTXPower = '".xss_clean($profile_info->station_power)."';\n"; + echo "var activeStationOP = '".xss_clean($this->session->userdata('operator_callsign'))."';\n"; } ?> diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 243467f81..d4005a560 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -506,7 +506,13 @@ - +
+ + + +
From e73995a6c73cc96890ac449d8e50af3988144316 Mon Sep 17 00:00:00 2001 From: int2001 Date: Wed, 28 Feb 2024 14:15:02 +0000 Subject: [PATCH 04/33] Added Fullreset Logic (JS) --- assets/js/sections/qso.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js index fc8bf71da..c42d0b166 100644 --- a/assets/js/sections/qso.js +++ b/assets/js/sections/qso.js @@ -33,6 +33,9 @@ $( document ).ready(function() { success: function(resdata) { result = JSON.parse(resdata); if (result.message == 'success') { + activeStationId=result.activeStationId; + activeStationOP=result.activeStationOP; + activeStationTXPower=result.activeStationTXPower; $("#noticer").removeClass(""); $("#noticer").addClass("alert alert-info"); $("#noticer").html("QSO Added"); @@ -527,6 +530,10 @@ function changebadge(entityname) { } } +$('#btn_fullreset').click(function() { + reset_to_default(); +}); + function reset_to_default() { reset_fields(); $("#stationProfile").val(activeStationId); @@ -534,6 +541,8 @@ function reset_to_default() { $("#frequency_rx").val(""); $("#band_rx").val(""); $("#transmit_power").val(activeStationTXPower); + $("#sat_name").val(""); + $("#sat_mode").val(""); } /* Function: reset_fields is used to reset the fields on the QSO page */ @@ -566,6 +575,7 @@ function reset_fields() { $('#callsign_info').removeClass("text-bg-danger"); $('#callsign-image').attr('style', 'display: none;'); $('#callsign-image-content').text(""); + $("#operator_callsign").val(activeStationOP); $('#qsl_via').val(""); $('#callsign_info').text(""); $('#stateDropdown').val(""); @@ -912,6 +922,9 @@ $('#band').change(function() { $('#frequency').val(result); $('#frequency_rx').val(""); }); + $("#selectPropagation").val(""); + $("#sat_name").val(""); + $("#sat_mode").val(""); }); /* On Key up Calculate Bearing and Distance */ From 88e073a3443c2baf2d756b452b62b9611d683151 Mon Sep 17 00:00:00 2001 From: int2001 Date: Wed, 28 Feb 2024 15:59:05 +0000 Subject: [PATCH 05/33] A lot of JS relocated to qso.js --- application/views/interface_assets/footer.php | 125 ------------------ application/views/qso/index.php | 2 +- 2 files changed, 1 insertion(+), 126 deletions(-) diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 0ff09946b..545ac0bfa 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -970,17 +970,6 @@ $($('#callsign')).on('keypress',function(e) { if ($this->optionslib->get_option('dxcache_url') != ''){ ?> ; - $(document).ready(function() { - - $('.callsign-suggest').hide(); - - setRst($(".mode").val()); - - /* On Page Load */ - var catcher = function() { - var changed = false; - $('form').each(function() { - if ($(this).data('initialForm') != $(this).serialize()) { - changed = true; - $(this).addClass('changed'); - } else { - $(this).removeClass('changed'); - } - }); - if (changed) { - return 'Unsaved QSO!'; - } - }; - - // Callsign always has focus on load - $("#callsign").focus(); - - if ( ! manual ) { - $(function($) { - resetTimers(0); - }); - } - }); - session->userdata('user_qso_end_times') == 1) { ?> $('#callsign').focusout(function() { if (! manual && $('#callsign').val() != '') { @@ -1083,32 +1040,6 @@ $($('#callsign')).on('keypress',function(e) { }); - jQuery(function($) { - var input = $('#callsign'); - input.on('keydown', function() { - var key = event.keyCode || event.charCode; - - if( key == 8 || key == 46 ) { - reset_fields(); - } - }); - - $(document).keyup(function(e) { - if (e.charCode === 0) { - let fixedcall = $('#callsign').val(); - $('#callsign').val(fixedcall.replace('Ø', '0')); - } - if (e.key === "Escape") { // escape key maps to keycode `27` - reset_fields(); - if ( ! manual ) { - resetTimers(0) - } - $('#callsign').val(""); - $("#callsign").focus(); - } - }); -}); - session->userdata('user_sota_lookup') == 1) { ?> $('#sota_ref').change(function() { var sota = $('#sota_ref').val(); @@ -1172,27 +1103,6 @@ $($('#callsign')).on('keypress',function(e) { }); - $('#stationProfile').change(function() { - var stationProfile = $('#stationProfile').val(); - $.ajax({ - url: base_url+'index.php/qso/get_station_power', - type: 'post', - data: {'stationProfile': stationProfile}, - success: function(res) { - $('#transmit_power').val(res.station_power); - }, - error: function() { - $('#transmit_power').val(''); - }, - }); - // [eQSL default msg] change value on change station profle // - qso_set_eqsl_qslmsg(stationProfile,false,'.qso_panel'); - }); - // [eQSL default msg] change value on clic // - $('.qso_panel .qso_eqsl_qslmsg_update').off('click').on('click',function() { - qso_set_eqsl_qslmsg($('.qso_panel #stationProfile').val(),true,'.qso_panel'); - $('#charsLeft').text(" "); - }); session->userdata('user_qth_lookup') == 1) { ?> $('#qth').focusout(function() { @@ -1265,41 +1175,6 @@ $($('#callsign')).on('keypress',function(e) { uri->segment(1) == "qso" || ($this->uri->segment(1) == "contesting" && $this->uri->segment(2) != "add")) { ?> - From cd091a780f6262073c333418968b1aa7489f71f6 Mon Sep 17 00:00:00 2001 From: int2001 Date: Wed, 28 Feb 2024 16:19:07 +0000 Subject: [PATCH 08/33] Band OnChange JS --- assets/js/sections/qso.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js index 15516f5df..103cb989e 100644 --- a/assets/js/sections/qso.js +++ b/assets/js/sections/qso.js @@ -1,11 +1,4 @@ -$( document ).ready(function() { - clearTimeout(); - set_timers(); - updateStateDropdown(); - - $('#notice-alerts').delay(1000).fadeOut(5000); - - function setRst(mode) { +function setRst(mode) { if(mode == 'JT65' || mode == 'JT65B' || mode == 'JT6C' || mode == 'JTMS' || mode == 'ISCAT' || mode == 'MSK144' || mode == 'JTMSK' || mode == 'QRA64' || mode == 'FT8' || mode == 'FT4' || mode == 'JS8' || mode == 'JT9' || mode == 'JT9-1' || mode == 'ROS'){ $('#rst_sent').val('-5'); $('#rst_rcvd').val('-5'); @@ -21,7 +14,14 @@ $( document ).ready(function() { } } - function getUTCTimeStamp(el) { +$( document ).ready(function() { + clearTimeout(); + set_timers(); + updateStateDropdown(); + + $('#notice-alerts').delay(1000).fadeOut(5000); + + function getUTCTimeStamp(el) { var now = new Date(); var localTime = now.getTime(); var utc = localTime + (now.getTimezoneOffset() * 60000); From ab8b51acd33cd6c5f6d9192fb32b7fcab1387a1e Mon Sep 17 00:00:00 2001 From: int2001 Date: Wed, 28 Feb 2024 16:22:20 +0000 Subject: [PATCH 09/33] Removed old Debug-Output --- assets/js/sections/common.js | 1 - 1 file changed, 1 deletion(-) diff --git a/assets/js/sections/common.js b/assets/js/sections/common.js index aa0df7a8d..e3fbf42b9 100644 --- a/assets/js/sections/common.js +++ b/assets/js/sections/common.js @@ -319,7 +319,6 @@ function qso_edit(id) { } async function updateStateDropdown() { - console.log('dropdown triggered'); var selectedDxcc = $("#dxcc_id"); if (selectedDxcc.val() !== "") { From f0c4dfc41a0e41c81f3d54dc34408ba52c7b30bf Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Thu, 29 Feb 2024 09:44:23 +0100 Subject: [PATCH 10/33] reset comment --- assets/js/sections/qso.js | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js index 103cb989e..aa6fa2166 100644 --- a/assets/js/sections/qso.js +++ b/assets/js/sections/qso.js @@ -665,6 +665,7 @@ $( document ).ready(function() { /* Function: reset_fields is used to reset the fields on the QSO page */ function reset_fields() { $('#locator_info').text(""); + $('#comment').val(""); $('#country').val(""); $('#continent').val(""); $('#lotw_info').text(""); From bb50b5726777d41b5fcb39976ba2713e45e70711 Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Thu, 29 Feb 2024 10:20:17 +0100 Subject: [PATCH 11/33] fix sota/wwff/pota info links --- assets/js/sections/qso.js | 51 ++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js index aa6fa2166..465b61c6a 100644 --- a/assets/js/sections/qso.js +++ b/assets/js/sections/qso.js @@ -403,14 +403,18 @@ $( document ).ready(function() { callback(res); } }); + }, + onChange: function(value) { + if (value !== '') { + $('#sota_info').show(); + $('#sota_info').html(''); + $('#sota_info').attr('title', 'Lookup '+ value +' summit info on sota.org.uk'); + } else { + $('#sota_info').hide(); + } } }); - $('#sota_ref').change(function(){ - $('#sota_info').html(''); - $('#sota_info').attr('title', 'Lookup '+$('#sota_ref').val()+' summit info on sota.org.uk'); - }); - $('#wwff_ref').selectize({ maxItems: 1, closeAfterSelect: true, @@ -436,14 +440,18 @@ $( document ).ready(function() { callback(res); } }); + }, + onChange: function(value) { + if (value !== '') { + $('#wwff_info').show(); + $('#wwff_info').html(''); + $('#wwff_info').attr('title', 'Lookup '+ value +' reference info on cqgma.org'); + } else { + $('#wwff_info').hide(); + } } }); - - $('#wwff_ref').change(function(){ - $('#wwff_info').html(''); - $('#wwff_info').attr('title', 'Lookup '+$('#wwff_ref').val()+' reference info on cqgma.org'); - }); - + $('#pota_ref').selectize({ maxItems: 1, closeAfterSelect: true, @@ -469,14 +477,18 @@ $( document ).ready(function() { callback(res); } }); + }, + onChange: function(value) { + if (value != '') { + $('#pota_info').show(); + $('#pota_info').html(''); + $('#pota_info').attr('title', 'Lookup '+ value +' reference info on pota.co'); + } else { + $('#pota_info').hide(); + } } }); - $('#pota_ref').change(function(){ - $('#pota_info').html(''); - $('#pota_info').attr('title', 'Lookup '+$('#pota_ref').val()+' reference info on pota.co'); - }); - $('#darc_dok').selectize({ maxItems: 1, closeAfterSelect: true, @@ -656,7 +668,7 @@ $( document ).ready(function() { $("#stationProfile").val(activeStationId); $("#selectPropagation").val(""); $("#frequency_rx").val(""); - $("#band_rx").val(""); + $("#band_rx").val(""); $("#transmit_power").val(activeStationTXPower); $("#sat_name").val(""); $("#sat_mode").val(""); @@ -674,14 +686,12 @@ $( document ).ready(function() { $('#lotw_info').removeClass("lotw_info_orange"); $('#qrz_info').text("").hide(); $('#hamqth_info').text("").hide(); - $('#sota_info').text(""); $('#dxcc_id').val(""); $('#cqz').val(""); $('#name').val(""); $('#qth').val(""); $('#locator').val(""); $('#iota_ref').val(""); - $('#sota_ref').val(""); $("#locator").removeClass("confirmedGrid"); $("#locator").removeClass("workedGrid"); $("#locator").removeClass("newGrid"); @@ -702,6 +712,9 @@ $( document ).ready(function() { $('#partial_view').hide(); $('.callsign-suggest').hide(); setRst($(".mode").val()); + var $select = $('#sota_ref').selectize(); + var selectize = $select[0].selectize; + selectize.clear(); var $select = $('#wwff_ref').selectize(); var selectize = $select[0].selectize; selectize.clear(); From b40455f9f5ee5cdedb53d590528e8167a971edd6 Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Thu, 29 Feb 2024 10:30:07 +0100 Subject: [PATCH 12/33] clear notes in notes tab after submit --- assets/js/sections/qso.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js index 465b61c6a..3996b9c09 100644 --- a/assets/js/sections/qso.js +++ b/assets/js/sections/qso.js @@ -732,6 +732,8 @@ $( document ).ready(function() { var selectize = $select[0].selectize; selectize.clear(); + $('#notes').val(""); + $('#sig').val(""); $('#sig_info').val(""); $('#sent').val("N"); From 52dda38a030da0023fb0ca3a49c1ce8ed8c3f186 Mon Sep 17 00:00:00 2001 From: int2001 Date: Thu, 29 Feb 2024 11:09:55 +0000 Subject: [PATCH 13/33] Harmonized keys and change to innoDB for QSO-Table --- application/config/migration.php | 2 +- application/migrations/185_harmonize_keys.php | 53 +++++++++++++++++++ application/models/Logbook_model.php | 44 ++++++++------- 3 files changed, 78 insertions(+), 21 deletions(-) create mode 100644 application/migrations/185_harmonize_keys.php diff --git a/application/config/migration.php b/application/config/migration.php index ad5f2d9e3..c52d5d72d 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE; | */ -$config['migration_version'] = 184; +$config['migration_version'] = 185; /* |-------------------------------------------------------------------------- diff --git a/application/migrations/185_harmonize_keys.php b/application/migrations/185_harmonize_keys.php new file mode 100644 index 000000000..1912f9328 --- /dev/null +++ b/application/migrations/185_harmonize_keys.php @@ -0,0 +1,53 @@ +db->query("update ".$this->config->item('table_name')." set station_id=0 where station_id is null;"); + $this->db->query("ALTER TABLE ".$this->config->item('table_name')." ENGINE=InnoDB;"); + $this->db->query("ALTER TABLE ".$this->config->item('table_name')." CHANGE COLUMN `station_id` `station_id` INT(10) UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE ".$this->config->item('table_name')." CHANGE COLUMN `COL_PRIMARY_KEY` `COL_PRIMARY_KEY` BIGINT(20) UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE `station_profile` CHANGE COLUMN `user_id` `user_id` INT UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE `users` CHANGE COLUMN `user_id` `user_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT;"); + $this->db->query("ALTER TABLE `station_logbooks_relationship` CHANGE COLUMN `logbook_relation_id` `logbook_relation_id` INT UNSIGNED NOT NULL, CHANGE COLUMN `station_logbook_id` `station_logbook_id` INT UNSIGNED NOT NULL, CHANGE COLUMN `station_location_id` `station_location_id` INT UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE `station_logbooks` CHANGE COLUMN `logbook_id` `logbook_id` INT UNSIGNED NOT NULL AUTO_INCREMENT, CHANGE COLUMN `user_id` `user_id` INT UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE `user_options` CHANGE COLUMN `user_id` `user_id` INT UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE `oqrs` CHANGE COLUMN `station_id` `station_id` INT UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE `notes` CHANGE COLUMN `user_id` `user_id` INT UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE `lotw_certs` CHANGE COLUMN `user_id` `user_id` INT UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE `label_types` CHANGE COLUMN `user_id` `user_id` INT UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE `paper_types` CHANGE COLUMN `user_id` `user_id` INT UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE `eQSL_images` CHANGE COLUMN `qso_id` `qso_id` BIGINT(20) UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE `contest_session` CHANGE COLUMN `station_id` `station_id` INT UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE `qsl_images` CHANGE COLUMN `qsoid` `qsoid` BIGINT(20) UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE `contest_session` CHANGE COLUMN `station_id` `station_id` INT UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE `cat` CHANGE COLUMN `user_id` `user_id` INT UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE `api` CHANGE COLUMN `user_id` `user_id` INT UNSIGNED NOT NULL;"); + + + } + + public function down(){ + $this->db->query("ALTER TABLE ".$this->config->item('table_name')." ENGINE=MyISAM;"); + $this->db->query("ALTER TABLE ".$this->config->item('table_name')." CHANGE COLUMN `station_id` `station_id` INT(11) NOT NULL;"); + $this->db->query("ALTER TABLE ".$this->config->item('table_name')." CHANGE COLUMN `COL_PRIMARY_KEY` `COL_PRIMARY_KEY` INT UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE `station_profile` CHANGE COLUMN `user_id` `user_id` BIGINT(20) DEFAULT NULL;"); + $this->db->query("ALTER TABLE `station_logbooks_relationship` CHANGE COLUMN `logbook_relation_id` `logbook_relation_id` BIGINT(20) NOT NULL, CHANGE COLUMN `station_logbook_id` `station_logbook_id` BIGINT(20) NOT NULL, CHANGE COLUMN `station_location_id` `station_location_id` BIGINT(20) NOT NULL;"); + $this->db->query("ALTER TABLE `station_logbooks` CHANGE COLUMN `logbook_id` `logbook_id` BIGINT(20) NOT NULL AUTO_INCREMENT, CHANGE COLUMN `user_id` `user_id` BIGINT(20) NOT NULL;"); + $this->db->query("ALTER TABLE `user_options` CHANGE COLUMN `user_id` `user_id` INT NOT NULL;"); + $this->db->query("ALTER TABLE `oqrs` CHANGE COLUMN `station_id` `station_id` INT NOT NULL;"); + $this->db->query("ALTER TABLE `notes` CHANGE COLUMN `user_id` `user_id` BIGINT(20) NULL DEFAULT NULL;"); + $this->db->query("ALTER TABLE `lotw_certs` CHANGE COLUMN `user_id` `user_id` INT NULL DEFAULT NULL;"); + $this->db->query("ALTER TABLE `label_types` CHANGE COLUMN `user_id` `user_id` INT(5) NULL DEFAULT NULL;"); + $this->db->query("ALTER TABLE `paper_types` CHANGE COLUMN `user_id` `user_id` INT(5) NULL DEFAULT NULL;"); + $this->db->query("ALTER TABLE `eQSL_images` CHANGE COLUMN `qso_id` `qso_id` VARCHAR(250) NOT NULL;"); + $this->db->query("ALTER TABLE `contest_session` CHANGE COLUMN `station_id` `station_id` BIGINT(20) UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE `qsl_images` CHANGE COLUMN `qsoid` `qsoid` INT NULL;"); + $this->db->query("ALTER TABLE `contest_session` CHANGE COLUMN `station_id` `station_id` BIGINT(20) UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE `cat` CHANGE COLUMN `user_id` `user_id` BIGINT(20) NULL;"); + $this->db->query("ALTER TABLE `api` CHANGE COLUMN `user_id` `user_id` BIGINT(20) NULL;"); + $this->db->query("ALTER TABLE `users` CHANGE COLUMN `user_id` `user_id` INT(11) NOT NULL AUTO_INCREMENT;"); + } +} diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 1a297c3bf..503995155 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -1038,7 +1038,7 @@ class Logbook_model extends CI_Model { $entity = $this->get_entity($this->input->post('dxcc_id')); $stationId = $this->input->post('station_profile'); - $country = ucwords(strtolower($entity['name']), "- (/"); + $country = ucwords(strtolower($entity['name'] ?? ''), "- (/"); // Prevent Errors, if JS-Fence doesn't help // be sure that station belongs to user $this->load->model('stations'); @@ -4513,6 +4513,7 @@ function lotw_last_qsl_date($user_id) { public function check_for_station_id() { $this->db->select('COL_PRIMARY_KEY, COL_TIME_ON, COL_CALL, COL_MODE, COL_BAND, COL_STATION_CALLSIGN'); $this->db->where('station_id =', NULL); + $this->db->or_where("station_id",0); $query = $this->db->get($this->config->item('table_name')); if($query->num_rows() >= 1) { return $query->result(); @@ -4571,26 +4572,29 @@ function lotw_last_qsl_date($user_id) { public function update_station_ids($station_id,$station_callsign,$qsoids) { if (! empty($qsoids)) { - $data = array( - 'station_id' => $station_id, - ); + $data = array( + 'station_id' => $station_id, + ); - $this->db->where_in('COL_PRIMARY_KEY', $qsoids); - $this->db->where(array('station_id' => NULL)); - if ($station_callsign == '') { - $this->db->where(array('col_station_callsign' => NULL)); - } else { - $this->db->where('col_station_callsign', $station_callsign); - } - $this->db->update($this->config->item('table_name'), $data); - if ($this->db->affected_rows() > 0) { - return TRUE; - } else { - return FALSE; - } - } else { - return FALSE; - } + $this->db->where_in('COL_PRIMARY_KEY', $qsoids); + $this->db->group_start(); + $this->db->where(array('station_id' => NULL)); + $this->db->or_where(array('station_id' => 0)); // 0 is also unassigned, compare mig_185 + $this->db->group_end(); + if ($station_callsign == '') { + $this->db->where(array('col_station_callsign' => NULL)); + } else { + $this->db->where('col_station_callsign', $station_callsign); + } + $this->db->update($this->config->item('table_name'), $data); + if ($this->db->affected_rows() > 0) { + return TRUE; + } else { + return FALSE; + } + } else { + return FALSE; + } } public function parse_frequency($frequency) From 193882538eafe8f5b0b6ffb395925e9a3f4f162e Mon Sep 17 00:00:00 2001 From: int2001 Date: Thu, 29 Feb 2024 12:09:02 +0000 Subject: [PATCH 14/33] Fixed Bug with paper_types-templates --- application/migrations/185_harmonize_keys.php | 2 ++ application/models/User_model.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/application/migrations/185_harmonize_keys.php b/application/migrations/185_harmonize_keys.php index 1912f9328..88c60c040 100644 --- a/application/migrations/185_harmonize_keys.php +++ b/application/migrations/185_harmonize_keys.php @@ -18,6 +18,7 @@ class Migration_harmonize_keys extends CI_Migration { $this->db->query("ALTER TABLE `notes` CHANGE COLUMN `user_id` `user_id` INT UNSIGNED NOT NULL;"); $this->db->query("ALTER TABLE `lotw_certs` CHANGE COLUMN `user_id` `user_id` INT UNSIGNED NOT NULL;"); $this->db->query("ALTER TABLE `label_types` CHANGE COLUMN `user_id` `user_id` INT UNSIGNED NOT NULL;"); + $this->db->query("update `paper_types` set user_id=0 where user_id=-1;"); // Make user_id 0 as template for papers $this->db->query("ALTER TABLE `paper_types` CHANGE COLUMN `user_id` `user_id` INT UNSIGNED NOT NULL;"); $this->db->query("ALTER TABLE `eQSL_images` CHANGE COLUMN `qso_id` `qso_id` BIGINT(20) UNSIGNED NOT NULL;"); $this->db->query("ALTER TABLE `contest_session` CHANGE COLUMN `station_id` `station_id` INT UNSIGNED NOT NULL;"); @@ -42,6 +43,7 @@ class Migration_harmonize_keys extends CI_Migration { $this->db->query("ALTER TABLE `lotw_certs` CHANGE COLUMN `user_id` `user_id` INT NULL DEFAULT NULL;"); $this->db->query("ALTER TABLE `label_types` CHANGE COLUMN `user_id` `user_id` INT(5) NULL DEFAULT NULL;"); $this->db->query("ALTER TABLE `paper_types` CHANGE COLUMN `user_id` `user_id` INT(5) NULL DEFAULT NULL;"); + $this->db->query("update `paper_types` set user_id=-1 where user_id=0;"); $this->db->query("ALTER TABLE `eQSL_images` CHANGE COLUMN `qso_id` `qso_id` VARCHAR(250) NOT NULL;"); $this->db->query("ALTER TABLE `contest_session` CHANGE COLUMN `station_id` `station_id` BIGINT(20) UNSIGNED NOT NULL;"); $this->db->query("ALTER TABLE `qsl_images` CHANGE COLUMN `qsoid` `qsoid` INT NULL;"); diff --git a/application/models/User_model.php b/application/models/User_model.php index 3783f84a3..6dadb3586 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -201,7 +201,7 @@ class User_Model extends CI_Model { $this->db->insert($this->config->item('auth_table'), $data); $insert_id = $this->db->insert_id(); $this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, helvetia, iota, pota, sig, sota, uscounties, was, wwff, vucc, waja, rac) select bands.id, " . $insert_id . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands;"); - $this->db->query("insert into paper_types (user_id,paper_name,metric,width,orientation,height) SELECT ".$insert_id.", paper_name, metric, width, orientation,height FROM paper_types where user_id = -1;"); + $this->db->query("insert into paper_types (user_id,paper_name,metric,width,orientation,height) SELECT ".$insert_id.", paper_name, metric, width, orientation,height FROM paper_types where user_id = 0;"); // Templates have user_id 0 return OK; } else { return EUSERNAMEEXISTS; From 36493c4050c488db5ca56caef64aa7462782e778 Mon Sep 17 00:00:00 2001 From: int2001 Date: Fri, 1 Mar 2024 19:29:59 +0000 Subject: [PATCH 15/33] Fixed losing last auto_increment-value + A bug at User-Add --- application/config/migration.php | 2 +- application/migrations/185_harmonize_keys.php | 21 +++++++++++++++---- application/models/User_model.php | 2 +- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/application/config/migration.php b/application/config/migration.php index c52d5d72d..ad5f2d9e3 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE; | */ -$config['migration_version'] = 185; +$config['migration_version'] = 184; /* |-------------------------------------------------------------------------- diff --git a/application/migrations/185_harmonize_keys.php b/application/migrations/185_harmonize_keys.php index 88c60c040..29e00ba04 100644 --- a/application/migrations/185_harmonize_keys.php +++ b/application/migrations/185_harmonize_keys.php @@ -8,11 +8,15 @@ class Migration_harmonize_keys extends CI_Migration { $this->db->query("update ".$this->config->item('table_name')." set station_id=0 where station_id is null;"); $this->db->query("ALTER TABLE ".$this->config->item('table_name')." ENGINE=InnoDB;"); $this->db->query("ALTER TABLE ".$this->config->item('table_name')." CHANGE COLUMN `station_id` `station_id` INT(10) UNSIGNED NOT NULL;"); - $this->db->query("ALTER TABLE ".$this->config->item('table_name')." CHANGE COLUMN `COL_PRIMARY_KEY` `COL_PRIMARY_KEY` BIGINT(20) UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE ".$this->config->item('table_name')." CHANGE COLUMN `COL_PRIMARY_KEY` `COL_PRIMARY_KEY` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT;"); + $this->db->query("ALTER TABLE ".$this->config->item('table_name')." AUTO_INCREMENT=".$this->get_max_from_tbl($this->config->item('table_name'),"`COL_PRIMARY_KEY`").";"); $this->db->query("ALTER TABLE `station_profile` CHANGE COLUMN `user_id` `user_id` INT UNSIGNED NOT NULL;"); $this->db->query("ALTER TABLE `users` CHANGE COLUMN `user_id` `user_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT;"); - $this->db->query("ALTER TABLE `station_logbooks_relationship` CHANGE COLUMN `logbook_relation_id` `logbook_relation_id` INT UNSIGNED NOT NULL, CHANGE COLUMN `station_logbook_id` `station_logbook_id` INT UNSIGNED NOT NULL, CHANGE COLUMN `station_location_id` `station_location_id` INT UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE `users` AUTO_INCREMENT=".$this->get_max_from_tbl("`users`","user_id").";"); + $this->db->query("ALTER TABLE `station_logbooks_relationship` CHANGE COLUMN `logbook_relation_id` `logbook_relation_id` INT UNSIGNED NOT NULL AUTO_INCREMENT, CHANGE COLUMN `station_logbook_id` `station_logbook_id` INT UNSIGNED NOT NULL, CHANGE COLUMN `station_location_id` `station_location_id` INT UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE `station_logbooks_relationship` AUTO_INCREMENT=".$this->get_max_from_tbl("`station_logbooks_relationship`","logbook_relation_id").";"); $this->db->query("ALTER TABLE `station_logbooks` CHANGE COLUMN `logbook_id` `logbook_id` INT UNSIGNED NOT NULL AUTO_INCREMENT, CHANGE COLUMN `user_id` `user_id` INT UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE `station_logbooks` AUTO_INCREMENT=".$this->get_max_from_tbl("`station_logbooks`","logbook_id").";"); $this->db->query("ALTER TABLE `user_options` CHANGE COLUMN `user_id` `user_id` INT UNSIGNED NOT NULL;"); $this->db->query("ALTER TABLE `oqrs` CHANGE COLUMN `station_id` `station_id` INT UNSIGNED NOT NULL;"); $this->db->query("ALTER TABLE `notes` CHANGE COLUMN `user_id` `user_id` INT UNSIGNED NOT NULL;"); @@ -33,10 +37,13 @@ class Migration_harmonize_keys extends CI_Migration { public function down(){ $this->db->query("ALTER TABLE ".$this->config->item('table_name')." ENGINE=MyISAM;"); $this->db->query("ALTER TABLE ".$this->config->item('table_name')." CHANGE COLUMN `station_id` `station_id` INT(11) NOT NULL;"); - $this->db->query("ALTER TABLE ".$this->config->item('table_name')." CHANGE COLUMN `COL_PRIMARY_KEY` `COL_PRIMARY_KEY` INT UNSIGNED NOT NULL;"); + $this->db->query("ALTER TABLE ".$this->config->item('table_name')." CHANGE COLUMN `COL_PRIMARY_KEY` `COL_PRIMARY_KEY` INT UNSIGNED NOT NULL AUTO_INCREMENT;"); + $this->db->query("ALTER TABLE ".$this->config->item('table_name')." AUTO_INCREMENT=".$this->get_max_from_tbl($this->config->item('table_name'),"`COL_PRIMARY_KEY`").";"); $this->db->query("ALTER TABLE `station_profile` CHANGE COLUMN `user_id` `user_id` BIGINT(20) DEFAULT NULL;"); - $this->db->query("ALTER TABLE `station_logbooks_relationship` CHANGE COLUMN `logbook_relation_id` `logbook_relation_id` BIGINT(20) NOT NULL, CHANGE COLUMN `station_logbook_id` `station_logbook_id` BIGINT(20) NOT NULL, CHANGE COLUMN `station_location_id` `station_location_id` BIGINT(20) NOT NULL;"); + $this->db->query("ALTER TABLE `station_logbooks_relationship` CHANGE COLUMN `logbook_relation_id` `logbook_relation_id` BIGINT(20) NOT NULL AUTO_INCREMENT, CHANGE COLUMN `station_logbook_id` `station_logbook_id` BIGINT(20) NOT NULL, CHANGE COLUMN `station_location_id` `station_location_id` BIGINT(20) NOT NULL;"); + $this->db->query("ALTER TABLE `station_logbooks_relationship` AUTO_INCREMENT=".$this->get_max_from_tbl("`station_logbooks_relationship`","logbook_relation_id").";"); $this->db->query("ALTER TABLE `station_logbooks` CHANGE COLUMN `logbook_id` `logbook_id` BIGINT(20) NOT NULL AUTO_INCREMENT, CHANGE COLUMN `user_id` `user_id` BIGINT(20) NOT NULL;"); + $this->db->query("ALTER TABLE `station_logbooks` AUTO_INCREMENT=".$this->get_max_from_tbl("`station_logbooks`","logbook_id").";"); $this->db->query("ALTER TABLE `user_options` CHANGE COLUMN `user_id` `user_id` INT NOT NULL;"); $this->db->query("ALTER TABLE `oqrs` CHANGE COLUMN `station_id` `station_id` INT NOT NULL;"); $this->db->query("ALTER TABLE `notes` CHANGE COLUMN `user_id` `user_id` BIGINT(20) NULL DEFAULT NULL;"); @@ -52,4 +59,10 @@ class Migration_harmonize_keys extends CI_Migration { $this->db->query("ALTER TABLE `api` CHANGE COLUMN `user_id` `user_id` BIGINT(20) NULL;"); $this->db->query("ALTER TABLE `users` CHANGE COLUMN `user_id` `user_id` INT(11) NOT NULL AUTO_INCREMENT;"); } + + function get_max_from_tbl($tbl,$col) { + $query = $this->db->query("select max(".$col.") as MAXI from ".$tbl.";"); + $row = $query->row(); + return $row->MAXI; + } } diff --git a/application/models/User_model.php b/application/models/User_model.php index 6dadb3586..dfed8e71a 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -200,7 +200,7 @@ class User_Model extends CI_Model { // Add user and insert bandsettings for user $this->db->insert($this->config->item('auth_table'), $data); $insert_id = $this->db->insert_id(); - $this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, helvetia, iota, pota, sig, sota, uscounties, was, wwff, vucc, waja, rac) select bands.id, " . $insert_id . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands;"); + $this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, helvetia, iota, pota, sig, sota, uscounties, was, wwff, vucc, waja, rac) select bands.id, " . $insert_id . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands;"); $this->db->query("insert into paper_types (user_id,paper_name,metric,width,orientation,height) SELECT ".$insert_id.", paper_name, metric, width, orientation,height FROM paper_types where user_id = 0;"); // Templates have user_id 0 return OK; } else { From 8e4ebf976e6033799679efb63c05ef1fe0797b9c Mon Sep 17 00:00:00 2001 From: int2001 Date: Fri, 1 Mar 2024 19:33:52 +0000 Subject: [PATCH 16/33] Correctged Mig-ID --- application/config/migration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/config/migration.php b/application/config/migration.php index ad5f2d9e3..c52d5d72d 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE; | */ -$config['migration_version'] = 184; +$config['migration_version'] = 185; /* |-------------------------------------------------------------------------- From d3e07bc1d44e2b8882ec4c8794149c0d2fa8627a Mon Sep 17 00:00:00 2001 From: int2001 Date: Fri, 1 Mar 2024 19:46:32 +0000 Subject: [PATCH 17/33] Added Jump Back to first tab when QSO is submitted --- assets/js/sections/qso.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js index 3996b9c09..e37dea847 100644 --- a/assets/js/sections/qso.js +++ b/assets/js/sections/qso.js @@ -163,6 +163,8 @@ $( document ).ready(function() { $("#callsign").val(""); $("#callsign").focus(); $("#noticer").fadeOut(2000); + var triggerEl = document.querySelector('#myTab a[href="#qso"]') + bootstrap.Tab.getInstance(triggerEl).show() // Select tab by name } else { $("#noticer").removeClass(""); $("#noticer").addClass("alert alert-warning"); From 33424a0257c4c971099864d0c0c97e9337f98f99 Mon Sep 17 00:00:00 2001 From: int2001 Date: Fri, 1 Mar 2024 19:55:04 +0000 Subject: [PATCH 18/33] Change Tab before setting focus to QSO-Partner --- assets/js/sections/qso.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js index e37dea847..a4ef62ec9 100644 --- a/assets/js/sections/qso.js +++ b/assets/js/sections/qso.js @@ -161,10 +161,10 @@ $( document ).ready(function() { htmx.trigger("#qso-last-table", "qso_event") $("#saveQso").html(saveQsoButtonText).prop("disabled",false); $("#callsign").val(""); - $("#callsign").focus(); $("#noticer").fadeOut(2000); var triggerEl = document.querySelector('#myTab a[href="#qso"]') bootstrap.Tab.getInstance(triggerEl).show() // Select tab by name + $("#callsign").focus(); } else { $("#noticer").removeClass(""); $("#noticer").addClass("alert alert-warning"); From b84694f531e90e976e89800ea70ad0f7e36ee2fc Mon Sep 17 00:00:00 2001 From: int2001 Date: Sat, 2 Mar 2024 08:49:51 +0000 Subject: [PATCH 19/33] Altered bandxuser-table, too (set defaults and so on) --- application/migrations/185_harmonize_keys.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/application/migrations/185_harmonize_keys.php b/application/migrations/185_harmonize_keys.php index 29e00ba04..392ce6356 100644 --- a/application/migrations/185_harmonize_keys.php +++ b/application/migrations/185_harmonize_keys.php @@ -30,8 +30,7 @@ class Migration_harmonize_keys extends CI_Migration { $this->db->query("ALTER TABLE `contest_session` CHANGE COLUMN `station_id` `station_id` INT UNSIGNED NOT NULL;"); $this->db->query("ALTER TABLE `cat` CHANGE COLUMN `user_id` `user_id` INT UNSIGNED NOT NULL;"); $this->db->query("ALTER TABLE `api` CHANGE COLUMN `user_id` `user_id` INT UNSIGNED NOT NULL;"); - - + $this->db->query("ALTER TABLE `bandxuser` CHANGE COLUMN `active` `active` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 , CHANGE COLUMN `cq` `cq` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 , CHANGE COLUMN `dok` `dok` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 , CHANGE COLUMN `dxcc` `dxcc` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 , CHANGE COLUMN `iota` `iota` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 , CHANGE COLUMN `sig` `sig` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 , CHANGE COLUMN `sota` `sota` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 , CHANGE COLUMN `uscounties` `uscounties` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 , CHANGE COLUMN `was` `was` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 , CHANGE COLUMN `vucc` `vucc` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 , CHANGE COLUMN `wwff` `wwff` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 , CHANGE COLUMN `pota` `pota` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 , CHANGE COLUMN `waja` `waja` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 , CHANGE COLUMN `rac` `rac` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 , CHANGE COLUMN `helvetia` `helvetia` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 , CHANGE COLUMN `jcc` `jcc` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1;"); } public function down(){ From 2c2e88c8fecd97635f106524264409016524d2a9 Mon Sep 17 00:00:00 2001 From: int2001 Date: Sat, 2 Mar 2024 10:54:44 +0000 Subject: [PATCH 20/33] Added "0" if table is empty (obtaining last max-value) --- application/migrations/185_harmonize_keys.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/migrations/185_harmonize_keys.php b/application/migrations/185_harmonize_keys.php index 392ce6356..2dbe7841a 100644 --- a/application/migrations/185_harmonize_keys.php +++ b/application/migrations/185_harmonize_keys.php @@ -62,6 +62,6 @@ class Migration_harmonize_keys extends CI_Migration { function get_max_from_tbl($tbl,$col) { $query = $this->db->query("select max(".$col.") as MAXI from ".$tbl.";"); $row = $query->row(); - return $row->MAXI; + return $row->MAXI ?? 0; } } From 7da34e190025d4ffd1b7193febaa621ae59f2a83 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Sun, 3 Mar 2024 08:58:56 +0100 Subject: [PATCH 21/33] [Bands] Added RAC and JCC. And some future proofing --- application/controllers/Band.php | 22 ++++++++++++---------- application/models/Bands.php | 8 +++++--- application/models/User_model.php | 2 +- application/views/bands/index.php | 8 ++++++++ assets/js/sections/bands.js | 2 ++ 5 files changed, 28 insertions(+), 14 deletions(-) diff --git a/application/controllers/Band.php b/application/controllers/Band.php index d56e7a05d..0bedbad6a 100644 --- a/application/controllers/Band.php +++ b/application/controllers/Band.php @@ -20,7 +20,7 @@ class Band extends CI_Controller { $this->load->model('bands'); $data['bands'] = $this->bands->get_all_bands_for_user(); - + // Render Page $data['page_title'] = "Bands"; $this->load->view('interface_assets/header', $data); @@ -28,7 +28,7 @@ class Band extends CI_Controller { $this->load->view('interface_assets/footer'); } - public function create() + public function create() { $this->load->model('bands'); $this->load->library('form_validation'); @@ -41,7 +41,7 @@ class Band extends CI_Controller { $this->load->view('bands/create', $data); } else - { + { $this->bands->add(); } } @@ -55,7 +55,7 @@ class Band extends CI_Controller { $band_query = $this->bands->getband($item_id_clean); $data['my_band'] = $band_query->row(); - + $data['page_title'] = "Edit Band"; $this->load->view('bands/edit', $data); @@ -122,8 +122,11 @@ class Band extends CI_Controller { $band['cq'] = $this->security->xss_clean($this->input->post('cq')); $band['dok'] = $this->security->xss_clean($this->input->post('dok')); $band['dxcc'] = $this->security->xss_clean($this->input->post('dxcc')); - $band['helvetia'] = $this->security->xss_clean($this->input->post('helvetia')); + $band['helvetia'] = $this->security->xss_clean($this->input->post('helvetia')); $band['iota'] = $this->security->xss_clean($this->input->post('iota')); + $band['jcc'] = $this->security->xss_clean($this->input->post('jcc')); + $band['pota'] = $this->security->xss_clean($this->input->post('pota')); + $band['rac'] = $this->security->xss_clean($this->input->post('rac')); $band['sig'] = $this->security->xss_clean($this->input->post('sig')); $band['sota'] = $this->security->xss_clean($this->input->post('sota')); $band['uscounties'] = $this->security->xss_clean($this->input->post('uscounties')); @@ -131,11 +134,10 @@ class Band extends CI_Controller { $band['wwff'] = $this->security->xss_clean($this->input->post('wwff')); $band['vucc'] = $this->security->xss_clean($this->input->post('vucc')); $band['waja'] = $this->security->xss_clean($this->input->post('waja')); - $band['pota'] = $this->security->xss_clean($this->input->post('pota')); - + $this->load->model('bands'); $this->bands->saveBand($id, $band); - + header('Content-Type: application/json'); echo json_encode(array('message' => 'OK')); return; @@ -144,10 +146,10 @@ class Band extends CI_Controller { public function saveBandAward() { $award = $this->security->xss_clean($this->input->post('award')); $status = $this->security->xss_clean($this->input->post('status')); - + $this->load->model('bands'); $this->bands->saveBandAward($award, $status); - + header('Content-Type: application/json'); echo json_encode(array('message' => 'OK')); return; diff --git a/application/models/Bands.php b/application/models/Bands.php index 2a8df6cc5..3b932e756 100644 --- a/application/models/Bands.php +++ b/application/models/Bands.php @@ -260,9 +260,11 @@ class Bands extends CI_Model { 'cq' => $band['cq'] == "true" ? '1' : '0', 'dok' => $band['dok'] == "true" ? '1' : '0', 'dxcc' => $band['dxcc'] == "true" ? '1' : '0', - 'helvetia' => $band['helvetia'] == "true" ? '1' : '0', + 'helvetia' => $band['helvetia'] == "true" ? '1' : '0', 'iota' => $band['iota'] == "true" ? '1' : '0', + 'jcc' => $band['jcc'] == "true" ? '1' : '0', 'pota' => $band['pota'] == "true" ? '1' : '0', + 'rac' => $band['rac'] == "true" ? '1' : '0', 'sig' => $band['sig'] == "true" ? '1' : '0', 'sota' => $band['sota'] == "true" ? '1' : '0', 'uscounties' => $band['uscounties'] == "true" ? '1' : '0', @@ -308,8 +310,8 @@ class Bands extends CI_Model { $this->db->insert('bands', $data); } - $this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, helvetia, iota, pota, sig, sota, uscounties, was, wwff, vucc, waja) - select bands.id, " . $this->session->userdata('user_id') . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands where band ='".$data['band']."' and not exists (select 1 from bandxuser where userid = " . $this->session->userdata('user_id') . " and bandid = bands.id);"); + $this->db->query("insert into bandxuser (bandid, userid) + select bands.id, " . $this->session->userdata('user_id') . " from bands where band ='".$data['band']."' and not exists (select 1 from bandxuser where userid = " . $this->session->userdata('user_id') . " and bandid = bands.id);"); } function getband($id) { diff --git a/application/models/User_model.php b/application/models/User_model.php index 3783f84a3..44b33b849 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -200,7 +200,7 @@ class User_Model extends CI_Model { // Add user and insert bandsettings for user $this->db->insert($this->config->item('auth_table'), $data); $insert_id = $this->db->insert_id(); - $this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, helvetia, iota, pota, sig, sota, uscounties, was, wwff, vucc, waja, rac) select bands.id, " . $insert_id . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands;"); + $this->db->query("insert into bandxuser (bandid, userid, active) select bands.id, " . $insert_id . " from bands;"); $this->db->query("insert into paper_types (user_id,paper_name,metric,width,orientation,height) SELECT ".$insert_id.", paper_name, metric, width, orientation,height FROM paper_types where user_id = -1;"); return OK; } else { diff --git a/application/views/bands/index.php b/application/views/bands/index.php index a0c4f04ef..85bf0e3d8 100644 --- a/application/views/bands/index.php +++ b/application/views/bands/index.php @@ -4,7 +4,9 @@ $dok = 0; $dxcc = 0; $helvetia = 0; $iota = 0; +$jcc = 0; $pota = 0; +$rac = 0; $sig = 0; $sota = 0; $uscounties = 0; @@ -48,7 +50,9 @@ $wwff = 0; + + @@ -76,7 +80,9 @@ $wwff = 0; dxcc == 1) {echo 'checked'; $dxcc++;}?>> helvetia == 1) {echo 'checked'; $helvetia++;}?>> iota == 1) {echo 'checked'; $iota++;}?>> + jcc == 1) {echo 'checked'; $jcc++;}?>> pota == 1) {echo 'checked'; $pota++;}?>> + rac == 1) {echo 'checked'; $rac++;}?>> sig == 1) {echo 'checked'; $sig++;}?>> sota == 1) {echo 'checked'; $sota++;}?>> uscounties == 1) {echo 'checked'; $uscounties++;}?>> @@ -108,7 +114,9 @@ $wwff = 0; 0) echo 'checked';?>> 0) echo 'checked';?>> 0) echo 'checked';?>> + 0) echo 'checked';?>> 0) echo 'checked';?>> + 0) echo 'checked';?>> 0) echo 'checked';?>> 0) echo 'checked';?>> 0) echo 'checked';?>> diff --git a/assets/js/sections/bands.js b/assets/js/sections/bands.js index 7ddca4c65..bb6ffb0ec 100644 --- a/assets/js/sections/bands.js +++ b/assets/js/sections/bands.js @@ -215,7 +215,9 @@ function saveBand(id) { 'dxcc': $(".dxcc_"+id+" input[type='checkbox']").is(":checked"), 'helvetia': $(".helvetia_"+id+" input[type='checkbox']").is(":checked"), 'iota': $(".iota_"+id+" input[type='checkbox']").is(":checked"), + 'jcc': $(".jcc_"+id+" input[type='checkbox']").is(":checked"), 'pota': $(".pota_"+id+" input[type='checkbox']").is(":checked"), + 'rac': $(".rac_"+id+" input[type='checkbox']").is(":checked"), 'sig': $(".sig_"+id+" input[type='checkbox']").is(":checked"), 'sota': $(".sota_"+id+" input[type='checkbox']").is(":checked"), 'uscounties': $(".uscounties_"+id+" input[type='checkbox']").is(":checked"), From bef3210f07429f11dea864277230933f7615166b Mon Sep 17 00:00:00 2001 From: Joerg Date: Sun, 3 Mar 2024 09:43:07 +0100 Subject: [PATCH 22/33] Fixed a PHP8.3 issue and removed BOM at Mig 139 (causes header_send) --- application/migrations/139_modify_eQSL_url.php | 16 ---------------- application/migrations/139_modify_eqsl.php | 17 +++++++++++++++++ install/index.php | 7 +++---- 3 files changed, 20 insertions(+), 20 deletions(-) delete mode 100644 application/migrations/139_modify_eQSL_url.php create mode 100644 application/migrations/139_modify_eqsl.php diff --git a/application/migrations/139_modify_eQSL_url.php b/application/migrations/139_modify_eQSL_url.php deleted file mode 100644 index ab8cbba46..000000000 --- a/application/migrations/139_modify_eQSL_url.php +++ /dev/null @@ -1,16 +0,0 @@ -db->query($sql); - } - - public function down() - { - // Will not go back to insecure connections - } -} -?> diff --git a/application/migrations/139_modify_eqsl.php b/application/migrations/139_modify_eqsl.php new file mode 100644 index 000000000..8050bdb58 --- /dev/null +++ b/application/migrations/139_modify_eqsl.php @@ -0,0 +1,17 @@ +db->where('id', '1'); + $this->db->update('config', array('eqsl_download_url' => 'https://www.eqsl.cc/qslcard/DownloadInBox.cfm')); + } + + public function down() + { + // Will not go back to insecure connections + } +} diff --git a/install/index.php b/install/index.php index 46f837e29..ddd799617 100644 --- a/install/index.php +++ b/install/index.php @@ -53,8 +53,7 @@ function isExtensionInstalled($extensionName) return in_array($extensionName, get_loaded_extensions()); } -function delDir($dir) -{ +function delDir($dir) { $files = glob($dir . '*', GLOB_MARK); foreach ($files as $file) { if (substr($file, -1) == '/') { @@ -91,7 +90,7 @@ if ($_POST) { $core = new Core(); $database = new Database(); - if ($_POST['database_check'] == true) { + if ($_POST['database_check'] ?? false == true) { $result = $database->database_check($_POST); echo $result; @@ -1030,4 +1029,4 @@ global $wavelog_url; - \ No newline at end of file + From 834340a35716f532eccaf8a4a3aa0f707c0016a9 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Sun, 3 Mar 2024 11:22:21 +0100 Subject: [PATCH 23/33] Removed active. It is default in db, and would cause an error --- application/models/User_model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/models/User_model.php b/application/models/User_model.php index 44b33b849..50c18a971 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -200,7 +200,7 @@ class User_Model extends CI_Model { // Add user and insert bandsettings for user $this->db->insert($this->config->item('auth_table'), $data); $insert_id = $this->db->insert_id(); - $this->db->query("insert into bandxuser (bandid, userid, active) select bands.id, " . $insert_id . " from bands;"); + $this->db->query("insert into bandxuser (bandid, userid) select bands.id, " . $insert_id . " from bands;"); $this->db->query("insert into paper_types (user_id,paper_name,metric,width,orientation,height) SELECT ".$insert_id.", paper_name, metric, width, orientation,height FROM paper_types where user_id = -1;"); return OK; } else { From e972d82e7b0a611333237064e57739e93079b858 Mon Sep 17 00:00:00 2001 From: HB9HIL <80885850+HB9HIL@users.noreply.github.com> Date: Sun, 3 Mar 2024 13:42:08 +0100 Subject: [PATCH 24/33] disabled paging --- assets/js/sections/bandmap_list.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/js/sections/bandmap_list.js b/assets/js/sections/bandmap_list.js index 7652b921a..2a7137f2d 100644 --- a/assets/js/sections/bandmap_list.js +++ b/assets/js/sections/bandmap_list.js @@ -8,7 +8,8 @@ $(function() { function get_dtable () { var table = $('.spottable').DataTable({ - "retrieve":true, + "paging": false, + "retrieve": true, "language": { url: getDataTablesLanguageUrl(), }, From 1c06fe6ac2e6ed9bd4561ad8dff9d137378d70bb Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Sun, 3 Mar 2024 14:52:20 +0100 Subject: [PATCH 25/33] Use default dxcache url if not set --- application/models/Dxcluster_model.php | 153 +++++++++--------- application/views/interface_assets/footer.php | 11 +- application/views/interface_assets/header.php | 8 +- application/views/qso/index.php | 4 +- 4 files changed, 87 insertions(+), 89 deletions(-) diff --git a/application/models/Dxcluster_model.php b/application/models/Dxcluster_model.php index 45070489c..825fc918f 100644 --- a/application/models/Dxcluster_model.php +++ b/application/models/Dxcluster_model.php @@ -6,104 +6,107 @@ class Dxcluster_model extends CI_Model { public function dxc_spotlist($band = '20m', $maxage = 60, $de = '') { $this->load->helper(array('psr4_autoloader')); $CI =& get_instance(); - if ( ($this->optionslib->get_option('dxcache_url') != '') ) { - if($CI->session->userdata('user_date_format')) { - $custom_date_format = $CI->session->userdata('user_date_format'); - } else { - $custom_date_format = $CI->config->item('qso_date_format'); - } - if ($band == "All") { - $dxcache_url = $this->optionslib->get_option('dxcache_url').'/spots/'; - } else { - $dxcache_url = $this->optionslib->get_option('dxcache_url').'/spots/'.$band; - } - $CI->load->model('logbooks_model'); - $CI->load->model('logbook_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if($CI->session->userdata('user_date_format')) { + $custom_date_format = $CI->session->userdata('user_date_format'); + } else { + $custom_date_format = $CI->config->item('qso_date_format'); + } - $this->load->driver('cache', array('adapter' => 'file', 'backup' => 'file')); - if (!$jsonraw = $this->cache->get('dxcache'.$band)) { - // CURL Functions - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $dxcache_url); - curl_setopt($ch, CURLOPT_USERAGENT, 'Wavelog '.$this->optionslib->get_option('version').' DXLookup'); - curl_setopt($ch, CURLOPT_HEADER, false); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - $jsonraw = curl_exec($ch); - curl_close($ch); - $this->cache->save('dxcache'.$band, $jsonraw, 59); // Cache DXClusterCache Instancewide for 59seconds - } - $json = json_decode($jsonraw); - $date = date('Ymd', time()); + $dxcache_url = ($this->optionslib->get_option('dxcache_url') == '' ? 'https://dxc.jo30.de/dxcache' : $this->optionslib->get_option('dxcache_url')); - $dxccObj = new DXCC($date); + if ($band == "All") { + $dxcache_url = $dxcache_url . '/spots/'; + } else { + $dxcache_url = $dxcache_url . '/spots/'.$band; + } + $CI->load->model('logbooks_model'); + $CI->load->model('logbook_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - // Create JSON object - if (strlen($jsonraw)>20) { - $spotsout=[]; - foreach($json as $singlespot){ - $spotband = $CI->frequency->GetBand($singlespot->frequency*1000); - $singlespot->band=$spotband; - if (($band != 'All') && ($band != $spotband)) { continue; } - $datetimecurrent = new DateTime("now", new DateTimeZone('UTC')); // Today's Date/Time - $datetimespot = new DateTime($singlespot->when, new DateTimeZone('UTC')); - $spotage = $datetimecurrent->diff($datetimespot); - $minutes = $spotage->days * 24 * 60; - $minutes += $spotage->h * 60; - $minutes += $spotage->i; - $singlespot->age=$minutes; - $singlespot->when_pretty=date($custom_date_format . " H:i", strtotime($singlespot->when)); + $this->load->driver('cache', array('adapter' => 'file', 'backup' => 'file')); + if (!$jsonraw = $this->cache->get('dxcache'.$band)) { + // CURL Functions + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $dxcache_url); + curl_setopt($ch, CURLOPT_USERAGENT, 'Wavelog '.$this->optionslib->get_option('version').' DXLookup'); + curl_setopt($ch, CURLOPT_HEADER, false); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + $jsonraw = curl_exec($ch); + curl_close($ch); + $this->cache->save('dxcache'.$band, $jsonraw, 59); // Cache DXClusterCache Instancewide for 59seconds + } + $json = json_decode($jsonraw); + $date = date('Ymd', time()); - if ($minutes<=$maxage) { - if (!(property_exists($singlespot,'dxcc_spotted'))) { // Check if we already have dxcc of spotted - $dxcc=$dxccObj->dxcc_lookup($singlespot->spotted,date('Ymd', time())); - $singlespot->dxcc_spotted->dxcc_id=$dxcc['adif']; - $singlespot->dxcc_spotted->cont=$dxcc['cont']; - $singlespot->dxcc_spotted->flag=''; - $singlespot->dxcc_spotted->entity=$dxcc['entity']; - } - if (!(property_exists($singlespot,'dxcc_spotter'))) { // Check if we already have dxcc of spotter - $dxcc=$dxccObj->dxcc_lookup($singlespot->spotter,date('Ymd', time())); - $singlespot->dxcc_spotter->dxcc_id=$dxcc['adif']; - $singlespot->dxcc_spotter->cont=$dxcc['cont']; - $singlespot->dxcc_spotter->flag=''; - $singlespot->dxcc_spotter->entity=$dxcc['entity']; - } - if ( ($de != '') && ($de != 'Any') && (property_exists($singlespot->dxcc_spotter,'cont')) ){ // If we have a "de continent" and a filter-wish filter on that - if (strtolower($de) == strtolower($singlespot->dxcc_spotter->cont ?? '')) { - $singlespot->worked_dxcc = ($this->logbook_model->check_if_dxcc_worked_in_logbook($singlespot->dxcc_spotted->dxcc_id, $logbooks_locations_array, $singlespot->band) >= 1); - $singlespot->cnfmd_dxcc = ($this->logbook_model->check_if_dxcc_cnfmd_in_logbook($singlespot->dxcc_spotted->dxcc_id, $logbooks_locations_array, $singlespot->band) >= 1); - $singlespot->worked_call = ($this->logbook_model->check_if_callsign_worked_in_logbook($singlespot->spotted, $logbooks_locations_array, $singlespot->band) >= 1); - $singlespot->cnfmd_call = ($this->logbook_model->check_if_callsign_cnfmd_in_logbook($singlespot->spotted, $logbooks_locations_array, $singlespot->band) >= 1); - array_push($spotsout,$singlespot); - } - } else { // No de continent? No Filter --> Just push + $dxccObj = new DXCC($date); + + // Create JSON object + if (strlen($jsonraw)>20) { + $spotsout=[]; + foreach($json as $singlespot){ + $spotband = $CI->frequency->GetBand($singlespot->frequency*1000); + $singlespot->band=$spotband; + if (($band != 'All') && ($band != $spotband)) { continue; } + $datetimecurrent = new DateTime("now", new DateTimeZone('UTC')); // Today's Date/Time + $datetimespot = new DateTime($singlespot->when, new DateTimeZone('UTC')); + $spotage = $datetimecurrent->diff($datetimespot); + $minutes = $spotage->days * 24 * 60; + $minutes += $spotage->h * 60; + $minutes += $spotage->i; + $singlespot->age=$minutes; + $singlespot->when_pretty=date($custom_date_format . " H:i", strtotime($singlespot->when)); + + if ($minutes<=$maxage) { + if (!(property_exists($singlespot,'dxcc_spotted'))) { // Check if we already have dxcc of spotted + $dxcc=$dxccObj->dxcc_lookup($singlespot->spotted,date('Ymd', time())); + $singlespot->dxcc_spotted->dxcc_id=$dxcc['adif']; + $singlespot->dxcc_spotted->cont=$dxcc['cont']; + $singlespot->dxcc_spotted->flag=''; + $singlespot->dxcc_spotted->entity=$dxcc['entity']; + } + if (!(property_exists($singlespot,'dxcc_spotter'))) { // Check if we already have dxcc of spotter + $dxcc=$dxccObj->dxcc_lookup($singlespot->spotter,date('Ymd', time())); + $singlespot->dxcc_spotter->dxcc_id=$dxcc['adif']; + $singlespot->dxcc_spotter->cont=$dxcc['cont']; + $singlespot->dxcc_spotter->flag=''; + $singlespot->dxcc_spotter->entity=$dxcc['entity']; + } + if ( ($de != '') && ($de != 'Any') && (property_exists($singlespot->dxcc_spotter,'cont')) ){ // If we have a "de continent" and a filter-wish filter on that + if (strtolower($de) == strtolower($singlespot->dxcc_spotter->cont ?? '')) { $singlespot->worked_dxcc = ($this->logbook_model->check_if_dxcc_worked_in_logbook($singlespot->dxcc_spotted->dxcc_id, $logbooks_locations_array, $singlespot->band) >= 1); - $singlespot->worked_call = ($this->logbook_model->check_if_callsign_worked_in_logbook($singlespot->spotted, $logbooks_locations_array, $singlespot->band) >= 1); $singlespot->cnfmd_dxcc = ($this->logbook_model->check_if_dxcc_cnfmd_in_logbook($singlespot->dxcc_spotted->dxcc_id, $logbooks_locations_array, $singlespot->band) >= 1); + $singlespot->worked_call = ($this->logbook_model->check_if_callsign_worked_in_logbook($singlespot->spotted, $logbooks_locations_array, $singlespot->band) >= 1); $singlespot->cnfmd_call = ($this->logbook_model->check_if_callsign_cnfmd_in_logbook($singlespot->spotted, $logbooks_locations_array, $singlespot->band) >= 1); array_push($spotsout,$singlespot); } + } else { // No de continent? No Filter --> Just push + $singlespot->worked_dxcc = ($this->logbook_model->check_if_dxcc_worked_in_logbook($singlespot->dxcc_spotted->dxcc_id, $logbooks_locations_array, $singlespot->band) >= 1); + $singlespot->worked_call = ($this->logbook_model->check_if_callsign_worked_in_logbook($singlespot->spotted, $logbooks_locations_array, $singlespot->band) >= 1); + $singlespot->cnfmd_dxcc = ($this->logbook_model->check_if_dxcc_cnfmd_in_logbook($singlespot->dxcc_spotted->dxcc_id, $logbooks_locations_array, $singlespot->band) >= 1); + $singlespot->cnfmd_call = ($this->logbook_model->check_if_callsign_cnfmd_in_logbook($singlespot->spotted, $logbooks_locations_array, $singlespot->band) >= 1); + array_push($spotsout,$singlespot); } } - return ($spotsout); - } else { - return ''; } + return ($spotsout); } else { return ''; } + } public function dxc_qrg_lookup($qrg, $maxage = 120) { $this->load->helper(array('psr4_autoloader')); - if ( ($this->optionslib->get_option('dxcache_url') != '') && (is_numeric($qrg)) ) { - $dxcache_url = $this->optionslib->get_option('dxcache_url').'/spot/'.$qrg; + if (is_numeric($qrg)) { + + $dxcache_url = ($this->optionslib->get_option('dxcache_url') == '' ? 'https://dxc.jo30.de/dxcache' : $this->optionslib->get_option('dxcache_url')); + + $dxcache_url = $dxcache_url .'/spot/'.$qrg; // CURL Functions $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $dxcache_url); + curl_setopt($ch, CURLOPT_URL, $dxcache_url ?? 'https://dxc.jo30.de/dxcache'); curl_setopt($ch, CURLOPT_USERAGENT, 'Wavelog '.$this->optionslib->get_option('version').' DXLookup by QRG'); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 0ff09946b..6b2251ff7 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -965,9 +965,7 @@ $($('#callsign')).on('keypress',function(e) { session->userdata('isWinkeyEnabled')) { ?> -optionslib->get_option('dxcache_url') != ''){ ?> + stations->find_active(); $station_profile = $this->stations->profile($active_station_id); $active_station_info = $station_profile->row(); @@ -2410,7 +2407,7 @@ function qso_save() { uri->segment(1) == "oqrs") { ?> diff --git a/application/views/interface_assets/header.php b/application/views/interface_assets/header.php index 0673f45a9..198234d6c 100644 --- a/application/views/interface_assets/header.php +++ b/application/views/interface_assets/header.php @@ -69,7 +69,7 @@