From 88c4a10d355d55d9cf502dc5494d243717bf8cc0 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Tue, 27 Jul 2021 12:11:41 +0200 Subject: [PATCH 01/13] [Awards WAS] Added mode filtering. --- application/controllers/Awards.php | 18 ++++++---- application/models/Was.php | 16 +++++++-- application/views/awards/was/index.php | 35 ++++++++++++++----- application/views/awards/was/map.php | 2 +- application/views/interface_assets/footer.php | 4 +-- 5 files changed, 55 insertions(+), 20 deletions(-) diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index e26b82c3..87af9d77 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -274,7 +274,10 @@ class Awards extends CI_Controller { public function was() { $this->load->model('was'); + $this->load->model('modes'); + $data['worked_bands'] = $this->was->get_worked_bands(); + $data['modes'] = $this->modes->active(); // Used in the view for mode select if ($this->input->post('band') != NULL) { // Band is not set when page first loads. if ($this->input->post('band') == 'All') { // Did the user specify a band? If not, use all bands @@ -297,6 +300,7 @@ class Awards extends CI_Controller { $postdata['confirmed'] = $this->input->post('confirmed'); $postdata['notworked'] = $this->input->post('notworked'); $postdata['band'] = $this->input->post('band'); + $postdata['mode'] = $this->input->post('mode'); } else { // Setting default values at first load of page $postdata['lotw'] = 1; @@ -305,10 +309,11 @@ class Awards extends CI_Controller { $postdata['confirmed'] = 1; $postdata['notworked'] = 1; $postdata['band'] = 'All'; + $postdata['mode'] = 'All'; } $data['was_array'] = $this->was->get_was_array($bands, $postdata); - $data['was_summary'] = $this->was->get_was_summary($bands); + $data['was_summary'] = $this->was->get_was_summary($data['worked_bands']); // Render Page $data['page_title'] = "Awards - WAS (Worked All States)"; @@ -467,24 +472,23 @@ class Awards extends CI_Controller { /* function was_map - This displays the WAS map and requires the $band_type + This displays the WAS map and requires the $band_type and $mode_type */ - public function was_map($band_type) { + public function was_map($band_type, $mode_type) { $this->load->model('was'); - $data['worked_bands'] = $this->was->get_worked_bands(); + + $data['mode'] = $mode_type; $bands[] = $band_type; - $data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view - $postdata['lotw'] = 1; $postdata['qsl'] = 1; $postdata['worked'] = 1; $postdata['confirmed'] = 1; $postdata['notworked'] = 1; $postdata['band'] = $band_type; - + $postdata['mode'] = $mode_type; $data['was_array'] = $this->was->get_was_array($bands, $postdata); diff --git a/application/models/Was.php b/application/models/Was.php index c6e76394..0d98cdd3 100644 --- a/application/models/Was.php +++ b/application/models/Was.php @@ -87,14 +87,14 @@ class was extends CI_Model { if ($postdata['worked'] != NULL) { $wasBand = $this->getWasWorked($station_id, $band, $postdata); foreach ($wasBand as $line) { - $bandWas[$line->col_state][$band] = '
col_state . '","' . $band . '","All","WAS")\'>W
'; + $bandWas[$line->col_state][$band] = '
col_state . '","' . $band . '","'. $postdata['mode'] . '","WAS")\'>W
'; $states[$line->col_state]['count']++; } } if ($postdata['confirmed'] != NULL) { $wasBand = $this->getWasConfirmed($station_id, $band, $postdata); foreach ($wasBand as $line) { - $bandWas[$line->col_state][$band] = '
col_state . '","' . $band . '","All","WAS")\'>C
'; + $bandWas[$line->col_state][$band] = '
col_state . '","' . $band . '","'. $postdata['mode'] . '","WAS")\'>C
'; $states[$line->col_state]['count']++; } } @@ -211,6 +211,10 @@ class was extends CI_Model { $sql = "SELECT distinct col_state FROM " . $this->config->item('table_name') . " thcv where station_id = " . $station_id; + if ($postdata['mode'] != 'All') { + $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; + } + $sql .= $this->addStateToQuery(); $sql .= $this->addBandToQuery($band); @@ -219,6 +223,10 @@ class was extends CI_Model { " where station_id = ". $station_id . " and col_state = thcv.col_state"; + if ($postdata['mode'] != 'All') { + $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; + } + $sql .= $this->addBandToQuery($band); $sql .= $this->addQslToQuery($postdata); @@ -240,6 +248,10 @@ class was extends CI_Model { $sql = "SELECT distinct col_state FROM " . $this->config->item('table_name') . " thcv where station_id = " . $station_id; + if ($postdata['mode'] != 'All') { + $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; + } + $sql .= $this->addStateToQuery(); $sql .= $this->addBandToQuery($band); diff --git a/application/views/awards/was/index.php b/application/views/awards/was/index.php index 5531b8f3..904346f8 100644 --- a/application/views/awards/was/index.php +++ b/application/views/awards/was/index.php @@ -5,7 +5,6 @@
-
Worked / Confirmed
@@ -38,11 +37,10 @@
-
-
- +
+ +
+ +
+
+
- - - + + +
@@ -99,7 +118,7 @@ '; - foreach($bands as $band) { + foreach($worked_bands as $band) { echo '' . $band . ''; } echo 'Total diff --git a/application/views/awards/was/map.php b/application/views/awards/was/map.php index 77c8fc1a..f01f6bfc 100644 --- a/application/views/awards/was/map.php +++ b/application/views/awards/was/map.php @@ -135,7 +135,7 @@ 'click' : function(event, data) { - displayContacts(data.name,$('#band2').val(), 'All', 'WAS'); + displayContacts(data.name,$('#band2').val(), $('#mode').val(), 'WAS'); } }); diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 247fb398..7eab74c4 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -23,9 +23,9 @@ function load_was_map() { BootstrapDialog.show({ - title: 'Worked All States Map ('+$('#band2').val()+')', + title: 'Worked All States Map ('+$('#band2').val()+' '+$('#mode').val()+')', cssClass: 'was-map-dialog', - message: $('
').load(site_url + '/awards/was_map/' + $('#band2').val()) + message: $('
').load(site_url + '/awards/was_map/' + $('#band2').val() + '/' + $('#mode').val()) }); } From f96b608b52b172103d95930db46e4b23e682050e Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Wed, 28 Jul 2021 11:10:15 +0200 Subject: [PATCH 02/13] [QSL Print] Added button to see list of QSOs with callsign. Can add them to print queue from this list. --- application/controllers/Qslprint.php | 16 +++++++ application/models/Qslprint_model.php | 22 +++++++++ application/views/interface_assets/footer.php | 47 ++++++++++++++++++- application/views/qslprint/index.php | 6 ++- application/views/qslprint/qslprint.php | 6 ++- application/views/qslprint/qsolist.php | 44 +++++++++++++++++ 6 files changed, 136 insertions(+), 5 deletions(-) create mode 100644 application/views/qslprint/qsolist.php diff --git a/application/controllers/Qslprint.php b/application/controllers/Qslprint.php index fc2f2c00..3de67e65 100644 --- a/application/controllers/Qslprint.php +++ b/application/controllers/Qslprint.php @@ -149,6 +149,22 @@ class QSLPrint extends CI_Controller { $data['station_id'] = $station_id; $this->load->view('qslprint/qslprint', $data); } + + public function open_qso_list() { + $callsign = $this->input->post('callsign'); + $this->load->model('qslprint_model'); + + $data['qsos'] = $this->qslprint_model->open_qso_list($this->security->xss_clean($callsign)); + $this->load->view('qslprint/qsolist', $data); + } + + public function add_qso_to_print_queue() { + $id = $this->input->post('id'); + $this->load->model('qslprint_model'); + + $this->qslprint_model->add_qso_to_print_queue($this->security->xss_clean($id)); + } + } /* End of file Qslprint.php */ diff --git a/application/models/Qslprint_model.php b/application/models/Qslprint_model.php index 354e2460..b32ef8b5 100644 --- a/application/models/Qslprint_model.php +++ b/application/models/Qslprint_model.php @@ -63,6 +63,28 @@ class Qslprint_model extends CI_Model { return true; } + + function add_qso_to_print_queue($id) { + $data = array( + 'COL_QSL_SENT' => "R", + ); + + $this->db->where("COL_PRIMARY_KEY", $id); + $this->db->update($this->config->item('table_name'), $data); + + return true; + } + + function open_qso_list($callsign) { + $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); + $this->db->where('COL_CALL like "%'.$callsign.'%"'); + $this->db->where('coalesce(COL_QSL_SENT, "") not in ("R", "Q")'); + $this->db->order_by("COL_TIME_ON", "ASC"); + $query = $this->db->get($this->config->item('table_name')); + + return $query; + } + } ?> diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 247fb398..e6009e6e 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -2041,13 +2041,58 @@ function deleteQsl(id) { type: 'post', data: {'id': id }, success: function(html) { - location.reload(); + $("#qslprint_"+id).remove(); } }); } }); } + function openQsoList(callsign) { + $.ajax({ + url: base_url + 'index.php/qslprint/open_qso_list', + type: 'post', + data: {'callsign': callsign}, + success: function(html) { + BootstrapDialog.show({ + title: 'QSO List', + size: BootstrapDialog.SIZE_WIDE, + cssClass: 'qso-dialog', + nl2br: false, + message: html, + buttons: [{ + label: 'Close', + action: function (dialogItself) { + dialogItself.close(); + } + }] + }); + } + }); + } + + function addQsoToPrintQueue(id) { + $.ajax({ + url: base_url + 'index.php/qslprint/add_qso_to_print_queue', + type: 'post', + data: {'id': id}, + success: function(html) { + var line = ''; + line += ''+$("#qsolist_"+id).find("td:eq(0)").text()+''; + line += ''+$("#qsolist_"+id).find("td:eq(1)").text()+''; + line += ''+$("#qsolist_"+id).find("td:eq(2)").text()+''; + line += ''+$("#qsolist_"+id).find("td:eq(3)").text()+''; + line += ''+$("#qsolist_"+id).find("td:eq(4)").text()+''; + line += ''+$("#qsolist_"+id).find("td:eq(5)").text()+''; + line += ''; + line += ''; + line += ''; + $('.table tr:last').after(line); + $("#qsolist_"+id).remove();'' + } + }); + } + $(".station_id").change(function(){ var station_id = $(".station_id").val(); $.ajax({ diff --git a/application/views/qslprint/index.php b/application/views/qslprint/index.php index 9e236c3a..dbbc9a98 100644 --- a/application/views/qslprint/index.php +++ b/application/views/qslprint/index.php @@ -42,6 +42,7 @@ ' . $this->lang->line('gen_hamradio_band') . ' ' . $this->lang->line('gen_hamradio_station') . ' + '; @@ -55,14 +56,15 @@ } foreach ($qsos->result() as $qsl) { - echo ''; + echo ''; echo '' . $qsl->COL_CALL . ''; echo ''; $timestamp = strtotime($qsl->COL_TIME_ON); echo date($custom_date_format, $timestamp); echo ''; echo ''; $timestamp = strtotime($qsl->COL_TIME_ON); echo date('H:i', $timestamp); echo ''; echo ''; echo $qsl->COL_SUBMODE==null?$qsl->COL_MODE:$qsl->COL_SUBMODE; echo ''; echo ''; if($qsl->COL_SAT_NAME != null) { echo $qsl->COL_SAT_NAME; } else { echo strtolower($qsl->COL_BAND); }; echo ''; echo '' . $qsl->station_callsign . ''; - echo ''; + echo ''; + echo ''; echo ''; } diff --git a/application/views/qslprint/qslprint.php b/application/views/qslprint/qslprint.php index ca215d6f..7c34a942 100644 --- a/application/views/qslprint/qslprint.php +++ b/application/views/qslprint/qslprint.php @@ -10,6 +10,7 @@ if ($qsos->result() != NULL) { ' . $this->lang->line('gen_hamradio_band') . ' ' . $this->lang->line('gen_hamradio_station') . ' + '; @@ -23,14 +24,15 @@ if ($qsos->result() != NULL) { } foreach ($qsos->result() as $qsl) { - echo ''; + echo ''; echo '' . $qsl->COL_CALL . ''; echo ''; $timestamp = strtotime($qsl->COL_TIME_ON); echo date($custom_date_format, $timestamp); echo ''; echo ''; $timestamp = strtotime($qsl->COL_TIME_ON); echo date('H:i', $timestamp); echo ''; echo ''; echo $qsl->COL_SUBMODE==null?$qsl->COL_MODE:$qsl->COL_SUBMODE; echo ''; echo ''; if($qsl->COL_SAT_NAME != null) { echo $qsl->COL_SAT_NAME; } else { echo strtolower($qsl->COL_BAND); }; echo ''; echo '' . $qsl->station_callsign . ''; - echo ''; + echo ''; + echo ''; echo ''; } diff --git a/application/views/qslprint/qsolist.php b/application/views/qslprint/qsolist.php new file mode 100644 index 00000000..bbf28c23 --- /dev/null +++ b/application/views/qslprint/qsolist.php @@ -0,0 +1,44 @@ +result() != NULL) { + echo ' + + + + + + + + + + + '; + + // Get Date format + if($this->session->userdata('user_date_format')) { + // If Logged in and session exists + $custom_date_format = $this->session->userdata('user_date_format'); + } else { + // Get Default date format from /config/cloudlog.php + $custom_date_format = $this->config->item('qso_date_format'); + } + + foreach ($qsos->result() as $qsl) { + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + } + + echo '
'.$this->lang->line('gen_hamradio_callsign').'' . $this->lang->line('general_word_date') . ''. $this->lang->line('general_word_time') .'' . $this->lang->line('gen_hamradio_mode') . '' . $this->lang->line('gen_hamradio_band') . '' . $this->lang->line('gen_hamradio_station') . '
' . $qsl->COL_CALL . ''; $timestamp = strtotime($qsl->COL_TIME_ON); echo date($custom_date_format, $timestamp); echo ''; $timestamp = strtotime($qsl->COL_TIME_ON); echo date('H:i', $timestamp); echo ''; echo $qsl->COL_SUBMODE==null?$qsl->COL_MODE:$qsl->COL_SUBMODE; echo ''; if($qsl->COL_SAT_NAME != null) { echo $qsl->COL_SAT_NAME; } else { echo strtolower($qsl->COL_BAND); }; echo '' . $qsl->station_callsign . '
'; + ?> + + ×No additional QSO\'s were found. That means they are probably already in the queue.
'; +} +?> From 826a08b41d7582cf4bcb371146fb359c9fceeac8 Mon Sep 17 00:00:00 2001 From: Matthew Wright Date: Wed, 28 Jul 2021 11:40:30 +0100 Subject: [PATCH 03/13] Update update_cloudlog.sh Change to asset directory permission check rather than just QSL --- update_cloudlog.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update_cloudlog.sh b/update_cloudlog.sh index 58761e35..6a0927e7 100644 --- a/update_cloudlog.sh +++ b/update_cloudlog.sh @@ -10,7 +10,7 @@ # The user and group that own the CLOUDLOG_SUBDIR directories. Passed to 'chown' as-is. DIR_OWNERSHIP="root:www-data" # The list of directories that need to have ownership restored after a git pull -declare -a CLOUDLOG_SUBDIRS=("application/config" "assets/qslcard" "backup" "updates" "uploads") +declare -a CLOUDLOG_SUBDIRS=("application/config" "assets" "backup" "updates" "uploads") # The name of the Git remote to fetch/pull from GIT_REMOTE="origin" # If true, pull from the HEAD of the configured origin, otherwise the latest tag From 30937eaf75269c95e070116b08f125f97a232f51 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Wed, 28 Jul 2021 13:11:50 +0100 Subject: [PATCH 04/13] [Station Profile] Added DXCC "None" The DXCC ID 0 is used for stations who are /MM --- application/views/station_profile/create.php | 1 + application/views/station_profile/edit.php | 1 + 2 files changed, 2 insertions(+) diff --git a/application/views/station_profile/create.php b/application/views/station_profile/create.php index 7b831670..bb900dcf 100644 --- a/application/views/station_profile/create.php +++ b/application/views/station_profile/create.php @@ -44,6 +44,7 @@ num_rows() > 0) { ?> + result() as $dxcc) { ?> From c10ba57cc541e4c16f495cb0129c07e46865075f Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Wed, 28 Jul 2021 13:26:20 +0100 Subject: [PATCH 05/13] [QSO Entry] Added Ability to select None as DXCC option None as DXCC option is used for /MM style stations --- application/views/qso/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 43d7b694..97607510 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -245,7 +245,7 @@
- + adif; From 38d6112b4cb2d7cee929495e501bdd56c5099654 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Wed, 28 Jul 2021 18:51:44 +0200 Subject: [PATCH 07/13] [Awards DXCC] Added fix for summary that didn't check if col_dxcc > 0. Fixed a small bug in a query and added some checks for col_dxcc > 0, just to be sure --- application/models/Dxcc.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/application/models/Dxcc.php b/application/models/Dxcc.php index 5a8e712c..54112070 100644 --- a/application/models/Dxcc.php +++ b/application/models/Dxcc.php @@ -322,7 +322,7 @@ class DXCC extends CI_Model { from dxcc_entities"; if ($postdata['notworked'] == NULL) { - $sql .= " join (select col_dxcc from ".$this->config->item('table_name')." where station_id = $station_id"; + $sql .= " join (select col_dxcc from " . $this->config->item('table_name') . " where station_id = " . $station_id . " and col_dxcc > 0"; if ($postdata['band'] != 'All') { if ($postdata['band'] == 'SAT') { @@ -377,7 +377,7 @@ class DXCC extends CI_Model { $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; } - $sql .= " and not exists (select 1 from ".$this->config->item('table_name')." where station_id = $station_id and col_dxcc = thcv.col_dxcc"; + $sql .= " and not exists (select 1 from ".$this->config->item('table_name')." where station_id = $station_id and col_dxcc = thcv.col_dxcc and col_dxcc > 0"; if ($postdata['band'] != 'All') { if ($postdata['band'] == 'SAT') { @@ -530,7 +530,7 @@ class DXCC extends CI_Model { { $sql = "SELECT count(distinct thcv.col_dxcc) as count FROM " . $this->config->item('table_name') . " thcv"; - $sql .= " where station_id = " . $station_id; + $sql .= " where station_id = " . $station_id . " and col_dxcc > 0"; if ($band == 'SAT') { @@ -561,7 +561,7 @@ class DXCC extends CI_Model { $sql .= " and thcv.col_band ='" . $band . "'"; } - $sql .= " and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')"; + $sql .= " and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y') and col_dxcc > 0"; $query = $this->db->query($sql); From 6bd39ac356112f1eafb809ef183ebcd71b47a572 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Wed, 28 Jul 2021 22:10:52 +0100 Subject: [PATCH 08/13] [Readme] Security Vulnerabilities Details Added Added details on how to report Security Vulnerabilities. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 55806048..49355f72 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,8 @@ Installation information can be found on the [wiki](https://github.com/magicbug/ Cloudlog has two support systems for code issues use Github issues, however if you have general issues with setting up your server please use our general discussion forum [https://github.com/magicbug/Cloudlog/discussions](https://github.com/magicbug/Cloudlog/discussions). +## Security Vulnerabilities +If you discover a security vulnerability within Cloudlog, please send an e-mail to Peter Goodhall, 2M0SQL via [peter@magicbug.co.uk](mailto:peter@magicbug.co.uk). All security vulnerabilities will be promptly addressed. ## Want Cloudlog Hosting? From 78f11d62c6f47b7f9a11d597ce3ecc51061bdc66 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Thu, 29 Jul 2021 10:38:27 +0200 Subject: [PATCH 09/13] [Quick lookup] Added clickable links so that you can see the qso information that lies behind the W/C in quick lookup. --- application/controllers/Awards.php | 8 +++++++ application/controllers/Lookup.php | 22 +++++++++--------- application/models/Logbook_model.php | 10 ++++++++ application/views/lookup/result.php | 34 +++++++++++++++++++++++----- 4 files changed, 57 insertions(+), 17 deletions(-) diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 1130810c..4fa7d2ec 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -195,6 +195,14 @@ class Awards extends CI_Controller { $data['results'] = $this->logbook_model->qso_details($searchphrase, $band, $mode, $type); + // This is done because we have two different ways to get dxcc info in Cloudlog. Once is using the name (in awards), and the other one is using the ADIF DXCC. + // We replace the values to make it look a bit nicer + if ($type == 'DXCC2') { + $type = 'DXCC'; + $dxccname = $this->logbook_model->get_entity($searchphrase); + $searchphrase = $dxccname['name']; + } + // Render Page $data['page_title'] = "Log View - " . $type; $data['filter'] = $type . " " . $searchphrase . " and band ".$band . " and mode ".$mode; diff --git a/application/controllers/Lookup.php b/application/controllers/Lookup.php index e2247d16..587fb7da 100644 --- a/application/controllers/Lookup.php +++ b/application/controllers/Lookup.php @@ -35,18 +35,18 @@ class Lookup extends CI_Controller { $data['bands'] = $this->lookup_model->get_Worked_Bands($station_id); - $queryinfo['type'] = xss_clean($this->input->post('type')); - $queryinfo['dxcc'] = xss_clean($this->input->post('dxcc')); - $queryinfo['was'] = xss_clean($this->input->post('was')); - $queryinfo['sota'] = xss_clean($this->input->post('sota')); - $queryinfo['grid'] = xss_clean($this->input->post('grid')); - $queryinfo['iota'] = xss_clean($this->input->post('iota')); - $queryinfo['cqz'] = xss_clean($this->input->post('cqz')); - $queryinfo['wwff'] = xss_clean($this->input->post('wwff')); - $queryinfo['station_id'] = $station_id; - $queryinfo['bands'] = $data['bands']; + $data['type'] = xss_clean($this->input->post('type')); + $data['dxcc'] = xss_clean($this->input->post('dxcc')); + $data['was'] = xss_clean($this->input->post('was')); + $data['sota'] = xss_clean($this->input->post('sota')); + $data['grid'] = xss_clean($this->input->post('grid')); + $data['iota'] = xss_clean($this->input->post('iota')); + $data['cqz'] = xss_clean($this->input->post('cqz')); + $data['wwff'] = xss_clean($this->input->post('wwff')); + $data['station_id'] = $station_id; + + $data['result'] = $this->lookup_model->getSearchResult($data); - $data['result'] = $this->lookup_model->getSearchResult($queryinfo); $this->load->view('lookup/result', $data); } diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index f6d773c2..2a52ba5b 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -244,6 +244,9 @@ class Logbook_model extends CI_Model { case 'DXCC': $this->db->where('COL_COUNTRY', $searchphrase); break; + case 'DXCC2': + $this->db->where('COL_DXCC', $searchphrase); + break; case 'IOTA': $this->db->where('COL_IOTA', $searchphrase); break; @@ -257,6 +260,13 @@ class Logbook_model extends CI_Model { $this->db->where('COL_STATE', $searchphrase); $this->db->where_in('COL_DXCC', ['291', '6', '110']); break; + case 'SOTA': + $this->db->where('COL_SOTA_REF', $searchphrase); + break; + case 'WWFF': + $this->db->where('COL_SIG', 'WWFF'); + $this->db->where('COL_SIG_INFO', $searchphrase); + break; } $this->db->where('station_id', $station_id); diff --git a/application/views/lookup/result.php b/application/views/lookup/result.php index fba7869a..3212e305 100644 --- a/application/views/lookup/result.php +++ b/application/views/lookup/result.php @@ -13,15 +13,37 @@ echo ' foreach ($result as $mode => $value) { echo ' '. strtoupper($mode) .''; - foreach ($value as $key) { - if ($key == 'W') { - echo '
' . $key . '
'; + foreach ($value as $key => $val) { + if ($val == 'W') { + $info = '
'; + switch($type) { + case 'dxcc': $info .= 'W'; break; + case 'iota': $info .= 'W'; break; + case 'grid': $info .= 'W'; break; + case 'cqz': $info .= 'W'; break; + case 'was': $info .= 'W'; break; + case 'sota': $info .= 'W'; break; + case 'wwff': $info .= 'W'; break; + } + $info .= '
'; + echo $info; } - else if ($key == 'C') { - echo '
' . $key . '
'; + else if ($val == 'C') { + $info = '
'; + switch($type) { + case 'dxcc': $info .= 'C'; break; + case 'iota': $info .= 'C'; break; + case 'grid': $info .= 'C'; break; + case 'cqz': $info .= 'C'; break; + case 'was': $info .= 'C'; break; + case 'sota': $info .= 'C'; break; + case 'wwff': $info .= 'C'; break; + } + $info .= '
'; + echo $info; } else { - echo '' . $key . ''; + echo '' . $val . ''; } } echo ''; From 608b09c973c84f9760e9cd624caebfe3e53520ae Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Thu, 29 Jul 2021 12:38:41 +0200 Subject: [PATCH 10/13] [Quick lookup] Rewrote the view for easier editing. --- application/views/lookup/result.php | 46 +++++++++++++---------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/application/views/lookup/result.php b/application/views/lookup/result.php index 3212e305..0f968ac4 100644 --- a/application/views/lookup/result.php +++ b/application/views/lookup/result.php @@ -12,39 +12,33 @@ echo ' '; foreach ($result as $mode => $value) { echo ' - '. strtoupper($mode) .''; + '. strtoupper($mode) .''; foreach ($value as $key => $val) { + switch($type) { + case 'dxcc': $linkinfo = '' . $val . ''; break; + case 'iota': $linkinfo = '' . $val . ''; break; + case 'grid': $linkinfo = '' . $val . ''; break; + case 'cqz': $linkinfo = '' . $val . ''; break; + case 'was': $linkinfo = '' . $val . ''; break; + case 'sota': $linkinfo = '' . $val . ''; break; + case 'wwff': $linkinfo = '' . $val . ''; break; + } + + $info = ''; + if ($val == 'W') { - $info = '
'; - switch($type) { - case 'dxcc': $info .= 'W'; break; - case 'iota': $info .= 'W'; break; - case 'grid': $info .= 'W'; break; - case 'cqz': $info .= 'W'; break; - case 'was': $info .= 'W'; break; - case 'sota': $info .= 'W'; break; - case 'wwff': $info .= 'W'; break; - } - $info .= '
'; - echo $info; + $info .= '
' . $linkinfo . '
'; } else if ($val == 'C') { - $info = '
'; - switch($type) { - case 'dxcc': $info .= 'C'; break; - case 'iota': $info .= 'C'; break; - case 'grid': $info .= 'C'; break; - case 'cqz': $info .= 'C'; break; - case 'was': $info .= 'C'; break; - case 'sota': $info .= 'C'; break; - case 'wwff': $info .= 'C'; break; - } - $info .= '
'; - echo $info; + $info .= '
' . $linkinfo . '
'; } else { - echo '' . $val . ''; + $info .= $val; } + + $info .= ''; + + echo $info; } echo ''; } From 946f11d538dbaca1dba354bb394593f249de74f2 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Fri, 30 Jul 2021 09:06:53 +0200 Subject: [PATCH 11/13] [QSO Entry] Maritime Mobile identification fix --- application/models/Cq.php | 4 ++-- application/models/Logbook_model.php | 20 ++++++++++++++++++-- application/views/qso/index.php | 2 +- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/application/models/Cq.php b/application/models/Cq.php index d193c699..c22735a0 100644 --- a/application/models/Cq.php +++ b/application/models/Cq.php @@ -239,7 +239,7 @@ class CQ extends CI_Model{ function getSummaryByBand($band, $station_id) { $sql = "SELECT count(distinct thcv.col_cqz) as count FROM " . $this->config->item('table_name') . " thcv"; - $sql .= " where station_id = " . $station_id; + $sql .= " where station_id = " . $station_id . ' and col_cqz > 0'; if ($band == 'SAT') { $sql .= " and thcv.col_prop_mode ='" . $band . "'"; @@ -258,7 +258,7 @@ class CQ extends CI_Model{ function getSummaryByBandConfirmed($band, $station_id){ $sql = "SELECT count(distinct thcv.col_cqz) as count FROM " . $this->config->item('table_name') . " thcv"; - $sql .= " where station_id = " . $station_id; + $sql .= " where station_id = " . $station_id . ' and col_cqz > 0'; if ($band == 'SAT') { $sql .= " and thcv.col_prop_mode ='" . $band . "'"; diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index f6d773c2..77bb818b 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -2082,7 +2082,14 @@ class Logbook_model extends CI_Model { if (preg_match('/(^KG4)[A-Z09]{3,}/', $call)) { // KG4/ and KG4 5 char calls are Guantanamo Bay. If 6 char, it is USA $call = "K"; - } + } elseif (preg_match_all('/^((\d|[A-Z])+\/)?((\d|[A-Z]){3,})(\/(\d|[A-Z])+)?(\/(\d|[A-Z])+)?$/', $call, $matches)) { + if ($matches[5][0] == '/MM') { + $row['adif'] = 0; + $row['entity'] = 'None'; + $row['cqz'] = 0; + return array($row['adif'], $row['entity'], $row['cqz']); + } + } $len = strlen($call); @@ -2127,7 +2134,16 @@ class Logbook_model extends CI_Model { if (preg_match('/(^KG4)[A-Z09]{3,}/', $call)) { // KG4/ and KG4 5 char calls are Guantanamo Bay. If 6 char, it is USA $call = "K"; - } + } elseif (preg_match_all('/^((\d|[A-Z])+\/)?((\d|[A-Z]){3,})(\/(\d|[A-Z])+)?(\/(\d|[A-Z])+)?$/', $call, $matches)) { + if ($matches[5][0] == '/MM') { + $row['adif'] = 0; + $row['entity'] = 'None'; + $row['cqz'] = 0; + $row['long'] = '0'; + $row['lat'] = '0'; + return $row; + } + } $len = strlen($call); diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 97607510..3a2fa808 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -258,7 +258,7 @@