From cee89b3966e4a0f56b3ed486409801fd01d7b420 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Thu, 9 May 2024 15:55:03 +0100 Subject: [PATCH 1/6] Added support for the GMDX Summer Challenge --- application/controllers/Awards.php | 63 ++++++++++++- application/models/Gmdxsummer_model.php | 86 ++++++++++++++++++ application/views/awards/gmdxsummer/index.php | 91 +++++++++++++++++++ application/views/interface_assets/header.php | 2 + 4 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 application/models/Gmdxsummer_model.php create mode 100644 application/views/awards/gmdxsummer/index.php diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 649fe31c..68e06755 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -515,12 +515,73 @@ class Awards extends CI_Controller $this->load->view('interface_assets/footer'); } + + public function gmdxsummer() + { + // Load the GMDX Summer Challenge model + $this->load->model('gmdxsummer_model'); + + // Get Week 1 + $data['week1_6m_cw'] = $this->gmdxsummer_model->get_week('2024-05-26 18:00:00', '6m', 'CW'); + $data['week1_6m_ssb'] = $this->gmdxsummer_model->get_week_voice('2024-05-26 18:00:00', '6m'); + $data['week1_6m_digital'] = $this->gmdxsummer_model->get_week_digital('2024-05-26 18:00:00', '6m'); + $data['week1_6m_combined'] = $this->gmdxsummer_model->get_week_combined('2024-05-26 18:00:00', '6m'); + + + $data['week1_4m_cw'] = $this->gmdxsummer_model->get_week('2024-05-26 18:00:00', '4m', 'CW'); + $data['week1_4m_ssb'] = $this->gmdxsummer_model->get_week_voice('2024-05-26 18:00:00', '4m'); + $data['week1_4m_digital'] = $this->gmdxsummer_model->get_week_digital('2024-05-26 18:00:00', '4m'); + $data['week1_4m_combined'] = $this->gmdxsummer_model->get_week_combined('2024-05-26 18:00:00', '4m'); + + // Get Week 2 + $data['week2_6m_cw'] = $this->gmdxsummer_model->get_week('2024-06-09 18:00:00', '6m', 'CW'); + $data['week2_6m_ssb'] = $this->gmdxsummer_model->get_week_voice('2024-06-09 18:00:00', '6m'); + $data['week2_6m_digital'] = $this->gmdxsummer_model->get_week_digital('2024-06-09 18:00:00', '6m'); + $data['week2_6m_combined'] = $this->gmdxsummer_model->get_week_combined('2024-06-09 18:00:00', '6m'); + + + $data['week2_4m_cw'] = $this->gmdxsummer_model->get_week('2024-06-09 18:00:00', '4m', 'CW'); + $data['week2_4m_ssb'] = $this->gmdxsummer_model->get_week_voice('2024-06-09 18:00:00', '4m'); + $data['week2_4m_digital'] = $this->gmdxsummer_model->get_week_digital('2024-06-09 18:00:00', '4m'); + $data['week2_4m_combined'] = $this->gmdxsummer_model->get_week_combined('2024-06-09 18:00:00', '4m'); + + + // Get Week 3 + $data['week3_6m_cw'] = $this->gmdxsummer_model->get_week('2024-06-23 18:00:00', '6m', 'CW'); + $data['week3_6m_ssb'] = $this->gmdxsummer_model->get_week_voice('2024-06-23 18:00:00', '6m'); + $data['week3_6m_digital'] = $this->gmdxsummer_model->get_week_digital('2024-06-23 18:00:00', '6m'); + $data['week3_6m_combined'] = $this->gmdxsummer_model->get_week_combined('2024-06-23 18:00:00', '6m'); + + $data['week3_4m_cw'] = $this->gmdxsummer_model->get_week('2024-06-23 18:00:00', '4m', 'CW'); + $data['week3_4m_ssb'] = $this->gmdxsummer_model->get_week_voice('2024-06-23 18:00:00', '4m'); + $data['week3_4m_digital'] = $this->gmdxsummer_model->get_week_digital('2024-06-23 18:00:00', '4m'); + $data['week3_4m_combined'] = $this->gmdxsummer_model->get_week_combined('2024-06-23 18:00:00', '4m'); + + // Get Week 4 + $data['week4_6m_cw'] = $this->gmdxsummer_model->get_week('2024-07-01 18:00:00', '6m', 'CW'); + $data['week4_6m_ssb'] = $this->gmdxsummer_model->get_week_voice('2024-07-01 18:00:00', '6m'); + $data['week4_6m_digital'] = $this->gmdxsummer_model->get_week_digital('2024-07-01 18:00:00', '6m'); + $data['week4_6m_combined'] = $this->gmdxsummer_model->get_week_combined('2024-07-01 18:00:00', '6m'); + + $data['week4_4m_cw'] = $this->gmdxsummer_model->get_week('2024-07-01 18:00:00', '4m', 'CW'); + $data['week4_4m_ssb'] = $this->gmdxsummer_model->get_week_voice('2024-07-01 18:00:00', '4m'); + $data['week4_4m_digital'] = $this->gmdxsummer_model->get_week_digital('2024-07-01 18:00:00', '4m'); + $data['week4_4m_combined'] = $this->gmdxsummer_model->get_week_combined('2024-07-01 18:00:00', '4m'); + + + // Render page + $data['page_title'] = "Awards - GMDX Summer Challenge"; + $this->load->view('interface_assets/header', $data); + $this->load->view('awards/gmdxsummer/index'); + $this->load->view('interface_assets/footer'); + } + public function wab_details_ajax() { $this->load->model('logbook_model'); $wab = str_replace('"', "", $this->security->xss_clean($this->input->post("Wab"))); - + $wab = str_replace(["Small Square ", " Boundry Box"], "", $wab); $data['results'] = $this->logbook_model->wab_qso_details($wab); diff --git a/application/models/Gmdxsummer_model.php b/application/models/Gmdxsummer_model.php new file mode 100644 index 00000000..ad9ff67a --- /dev/null +++ b/application/models/Gmdxsummer_model.php @@ -0,0 +1,86 @@ +config->item('table_name'); + + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + $location_list = "'" . implode("','", $logbooks_locations_array) . "'"; + + $query = $this->db->query(" + SELECT COUNT(DISTINCT SUBSTRING(COL_GRIDSQUARE, 1, 4)) AS count + FROM " . $table_name . " + WHERE station_id in (" . $location_list . ") AND COL_MODE = '" . $mode . "' AND COL_BAND = '" . $band . "' + AND (COL_TIME_ON >= '2024-05-13 00:00:00' AND COL_TIME_ON <= '. $end_date .') + "); + + return $query->row()->count; + } + + public function get_week_voice($end_date, $band) + { + $table_name = $this->config->item('table_name'); + + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + $location_list = "'" . implode("','", $logbooks_locations_array) . "'"; + + $query = $this->db->query(" + SELECT COUNT(DISTINCT SUBSTRING(COL_GRIDSQUARE, 1, 4)) AS count + FROM " . $table_name . " + WHERE station_id in (".$location_list.") AND COL_MODE IN ('SSB', 'AM', 'FM') AND COL_BAND = '" . $band . "' + AND (COL_TIME_ON >= '2024-05-13 00:00:00' AND COL_TIME_ON <= '" . $end_date . "') + "); + + + return $query->row()->count; + } + + public function get_week_digital($end_date, $band) + { + $table_name = $this->config->item('table_name'); + + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + $location_list = "'" . implode("','", $logbooks_locations_array) . "'"; + + $query = $this->db->query(" + SELECT COUNT(DISTINCT SUBSTRING(COL_GRIDSQUARE, 1, 4)) AS count + FROM " . $table_name . " + WHERE station_id in (".$location_list.") AND COL_MODE NOT IN ('CW', 'FM', 'SSB', 'AM') AND COL_BAND = '" . $band . "' + AND (COL_TIME_ON >= '2024-05-13 00:00:00' AND COL_TIME_ON <= '" . $end_date . "') + "); + + return $query->row()->count; + } + + public function get_week_combined($end_date, $band) + { + $table_name = $this->config->item('table_name'); + + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + $location_list = "'" . implode("','", $logbooks_locations_array) . "'"; + + $query = $this->db->query(" + SELECT COUNT(DISTINCT SUBSTRING(COL_GRIDSQUARE, 1, 4)) AS count + FROM " . $table_name . " + WHERE station_id in (".$location_list.") AND COL_BAND = '" . $band . "' + AND (COL_TIME_ON >= '2024-05-13 00:00:00' AND COL_TIME_ON <= '" . $end_date . "') + "); + + return $query->row()->count; + } +} diff --git a/application/views/awards/gmdxsummer/index.php b/application/views/awards/gmdxsummer/index.php new file mode 100644 index 00000000..98d6592d --- /dev/null +++ b/application/views/awards/gmdxsummer/index.php @@ -0,0 +1,91 @@ +
+ + +
+
+

+
+ + +
+
+ What is the GMDX Summer Challenge? +
+
+

The GMDX Summer Challenge will takes place over 6 weeks beginning 00:00 on Monday 13th May until 2359 on Sunday 30th June.

+

The Summer Challenge is a single event using CW, SSB or Digital Modes on both 4m and 6m. GMDX members are expected not to set up FT8 in automated robot mode. You are trusted to operate your station manually.

+

The overall winner will have worked the most 4 digit maidenhead locator squares (eg IO75) on 4m and 6m to give the highest combined score. DXCC Countries are not counted, only locator squares. In order to have the leading score, it is expected operators would have to make contacts on both 4m and 6m using all modes.

+

All GMDX members worldwide are welcome to enter.

+ Submit your entry +
+
+ +
+
+ Fortnightly Breakdown +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Week6m SSB6m CW6m Digital6m Combined4m SSB4m CW4m Digital4m Combined
18:00 on Sunday 26th May
18:00 on Sunday 9th June
18:00 on Sunday 23th June
18:00 on Monday 1st July
+
+
+
\ No newline at end of file diff --git a/application/views/interface_assets/header.php b/application/views/interface_assets/header.php index b25a9091..7617ed9a 100644 --- a/application/views/interface_assets/header.php +++ b/application/views/interface_assets/header.php @@ -161,6 +161,8 @@ + GMDX Summer Challenge + From 2e3d3e33f3ad87f26247e553f460033358eb2d53 Mon Sep 17 00:00:00 2001 From: phl0 Date: Mon, 13 May 2024 16:38:30 +0200 Subject: [PATCH 2/6] OpenSSL signatures need a newline after base64 string --- application/controllers/Lotw.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php index a328824a..cb30b8ba 100644 --- a/application/controllers/Lotw.php +++ b/application/controllers/Lotw.php @@ -967,7 +967,7 @@ class Lotw extends CI_Controller { openssl_free_key($pkeyid); } $signature_b64 = base64_encode($signature); - return $signature_b64; + return $signature_b64."\n"; } From a2504882be0d32934ee65536f2d8b6f8df2f72f8 Mon Sep 17 00:00:00 2001 From: phl0 Date: Mon, 13 May 2024 16:39:31 +0200 Subject: [PATCH 3/6] Strip full path from upload filename --- application/controllers/Lotw.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php index cb30b8ba..64a46544 100644 --- a/application/controllers/Lotw.php +++ b/application/controllers/Lotw.php @@ -300,20 +300,22 @@ class Lotw extends CI_Controller { //If the function curl_file_create exists if(function_exists('curl_file_create')){ //Use the recommended way, creating a CURLFile object. - $filePath = curl_file_create($filePath); + $uploadfile = curl_file_create($filePath); + $uploadfile->setPostFilename(basename($filePath)); } else{ //Otherwise, do it the old way. //Get the canonicalized pathname of our file and prepend //the @ character. - $filePath = '@' . realpath($filePath); + $uploadfile = '@' . realpath($filePath).';filename='.basename($filePath); //Turn off SAFE UPLOAD so that it accepts files //starting with an @ curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false); } + //Setup our POST fields $postFields = array( - $uploadFieldName => $filePath + $uploadFieldName => $uploadfile ); curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields); From d50ff03215381c5b0f70e1eacca50b36aaa09fd5 Mon Sep 17 00:00:00 2001 From: phl0 Date: Mon, 13 May 2024 16:39:59 +0200 Subject: [PATCH 4/6] Remove deprecated way of creating upload files --- application/controllers/Lotw.php | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php index 64a46544..cb9b5a59 100644 --- a/application/controllers/Lotw.php +++ b/application/controllers/Lotw.php @@ -297,21 +297,9 @@ class Lotw extends CI_Controller { //Tell cURL to return the output as a string. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - //If the function curl_file_create exists - if(function_exists('curl_file_create')){ - //Use the recommended way, creating a CURLFile object. - $uploadfile = curl_file_create($filePath); - $uploadfile->setPostFilename(basename($filePath)); - } else{ - //Otherwise, do it the old way. - //Get the canonicalized pathname of our file and prepend - //the @ character. - $uploadfile = '@' . realpath($filePath).';filename='.basename($filePath); - //Turn off SAFE UPLOAD so that it accepts files - //starting with an @ - curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false); - } - + //Use the recommended way, creating a CURLFile object. + $uploadfile = curl_file_create($filePath); + $uploadfile->setPostFilename(basename($filePath)); //Setup our POST fields $postFields = array( From 62a83c607214af99ed2279df9e6b0f6776e45e87 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 14 May 2024 14:16:29 +0100 Subject: [PATCH 5/6] tag 2.6.12 --- application/config/migration.php | 2 +- application/migrations/182_tag_2_6_12.php | 30 +++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 application/migrations/182_tag_2_6_12.php diff --git a/application/config/migration.php b/application/config/migration.php index ada7ac41..1d9283c0 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE; | */ -$config['migration_version'] = 181; +$config['migration_version'] = 182; /* |-------------------------------------------------------------------------- diff --git a/application/migrations/182_tag_2_6_12.php b/application/migrations/182_tag_2_6_12.php new file mode 100644 index 00000000..a3d91ee6 --- /dev/null +++ b/application/migrations/182_tag_2_6_12.php @@ -0,0 +1,30 @@ +db->where('option_name', 'version'); + $this->db->update('options', array('option_value' => '2.6.12')); + + // Trigger Version Info Dialog + $this->db->where('option_type', 'version_dialog'); + $this->db->where('option_name', 'confirmed'); + $this->db->update('user_options', array('option_value' => 'false')); + + } + + public function down() + { + $this->db->where('option_name', 'version'); + $this->db->update('options', array('option_value' => '2.6.11')); + } +} \ No newline at end of file From 9ff7e81c8a340a8341cfc24a503e584bfc962b81 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Wed, 15 May 2024 10:54:29 +0100 Subject: [PATCH 6/6] [Awards][GMDX] error in SQL --- application/models/Gmdxsummer_model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/models/Gmdxsummer_model.php b/application/models/Gmdxsummer_model.php index ad9ff67a..70f6e642 100644 --- a/application/models/Gmdxsummer_model.php +++ b/application/models/Gmdxsummer_model.php @@ -17,7 +17,7 @@ class Gmdxsummer_model extends CI_Model SELECT COUNT(DISTINCT SUBSTRING(COL_GRIDSQUARE, 1, 4)) AS count FROM " . $table_name . " WHERE station_id in (" . $location_list . ") AND COL_MODE = '" . $mode . "' AND COL_BAND = '" . $band . "' - AND (COL_TIME_ON >= '2024-05-13 00:00:00' AND COL_TIME_ON <= '. $end_date .') + AND (COL_TIME_ON >= '2024-05-13 00:00:00' AND COL_TIME_ON <= '" . $end_date . "') "); return $query->row()->count;