From ed13799132639b864b31f27a301f5877bd0677e1 Mon Sep 17 00:00:00 2001 From: Yuluoxk Date: Sat, 27 Jan 2024 00:08:35 +0800 Subject: [PATCH 01/30] update general_words_lang.php for zh-cn --- .../chinese_simplified/general_words_lang.php | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/application/language/chinese_simplified/general_words_lang.php b/application/language/chinese_simplified/general_words_lang.php index e6c5b080..778edd97 100644 --- a/application/language/chinese_simplified/general_words_lang.php +++ b/application/language/chinese_simplified/general_words_lang.php @@ -76,16 +76,16 @@ $lang['general_word_qslcard_management'] = 'QSL 管理'; $lang['general_word_qslcards'] = 'QSL 卡片'; $lang['general_word_qslcard_direct'] = '直邮'; $lang['general_word_qslcard_bureau'] = '卡片局'; -$lang['general_word_qslcard_electronic'] = '电子'; -$lang['general_word_qslcard_manager'] = '管理员'; -$lang['general_word_qslcard_via'] = '通过'; +$lang['general_word_qslcard_electronic'] = '电子卡片'; +$lang['general_word_qslcard_manager'] = '卡片管理员'; +$lang['general_word_qslcard_via'] = '通过(via)'; $lang['general_word_eqslcard'] = '电子 QSL 卡片'; $lang['general_word_eqslcards'] = 'eQSL 卡片'; $lang['general_word_lotw'] = 'Logbook of the World(LoTW)'; $lang['general_word_lotw_short'] = 'LoTW'; -$lang['general_word_details'] = '详细'; -$lang['general_word_qso_data'] = 'QSO 数据'; +$lang['general_word_details'] = '详细信息'; +$lang['general_word_qso_data'] = 'QSO 信息'; $lang['general_edit_qso'] = '编辑 QSO'; $lang['general_mark_qsl_rx_bureau'] = '标记 已收到的QSL (卡片局)'; @@ -124,20 +124,20 @@ $lang['gen_hamradio_suffix'] = "后缀"; $lang['gen_hamradio_mode'] = '模式'; $lang['gen_hamradio_de'] = '本台呼号(De)'; $lang['gen_hamradio_dx'] = '对方呼号(Dx)'; -$lang['gen_hamradio_rst_sent'] = 'Sent RST'; -$lang['gen_hamradio_rst_rcvd'] = 'Rcvd RST'; +$lang['gen_hamradio_rst_sent'] = '发送 信号报告(RST)'; +$lang['gen_hamradio_rst_rcvd'] = '接收 信号报告(RST)'; $lang['gen_hamradio_band'] = '频段'; $lang['gen_hamradio_bandgroup'] = "波段"; -$lang['gen_hamradio_band_rx'] = '频段 (RX)'; +$lang['gen_hamradio_band_rx'] = '接收频段 (RX)'; $lang['gen_hamradio_frequency'] = '频率'; -$lang['gen_hamradio_frequency_rx'] = '频率 (RX)'; +$lang['gen_hamradio_frequency_rx'] = '接收频率 (RX)'; $lang['gen_hamradio_radio'] = '电台'; $lang['gen_hamradio_rsts'] = '信号报告 (发)'; $lang['gen_hamradio_rstr'] = '信号报告 (收)'; $lang['gen_hamradio_refs'] = '对方网格'; -$lang['gen_hamradio_myrefs'] = '电台网格'; -$lang['gen_hamradio_exchange_sent_short'] = '信号交换 (发)'; -$lang['gen_hamradio_exchange_rcvd_short'] = '信号交换 (收)'; +$lang['gen_hamradio_myrefs'] = '我的网格'; +$lang['gen_hamradio_exchange_sent_short'] = '信号报告交换 (发)'; +$lang['gen_hamradio_exchange_rcvd_short'] = '信号报告交换 (收)'; $lang['gen_hamradio_qsl'] = 'QSL'; $lang['gen_hamradio_qsltype'] = "QSL 类型"; $lang['gen_hamradio_qslvia'] = 'QSL via'; From c7e0aacdfaaa5d1ba96091b6ef4936ddff3d6f8e Mon Sep 17 00:00:00 2001 From: Yuluoxk Date: Sat, 27 Jan 2024 00:10:21 +0800 Subject: [PATCH 02/30] update filter_lang.php for zh-cn --- .../language/chinese_simplified/filter_lang.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/application/language/chinese_simplified/filter_lang.php b/application/language/chinese_simplified/filter_lang.php index 9f14d3f2..d733cfcc 100644 --- a/application/language/chinese_simplified/filter_lang.php +++ b/application/language/chinese_simplified/filter_lang.php @@ -45,15 +45,15 @@ QSL Filters ___________________________________________________________________________________________ */ -$lang['filter_qsl_sent'] = 'QSL 发送'; -$lang['filter_qsl_recv'] = 'QSL 接收'; +$lang['filter_qsl_sent'] = 'QSL 发送状态'; +$lang['filter_qsl_recv'] = 'QSL 接收状态'; $lang['filter_qsl_sent_method'] = 'QSL 发送方式'; $lang['filter_qsl_recv_method'] = 'QSL 接收方式'; -$lang['filter_lotw_sent'] = 'LoTW 发送'; -$lang['filter_lotw_recv'] = 'LoTW 接收'; -$lang['filter_eqsl_sent'] = 'eQSL 发送'; -$lang['filter_eqsl_recv'] = 'eQSL 接收'; -$lang['filter_qsl_via'] = 'QSL 通过'; +$lang['filter_lotw_sent'] = 'LoTW 发送状态'; +$lang['filter_lotw_recv'] = 'LoTW 接收状态'; +$lang['filter_eqsl_sent'] = 'eQSL 发送状态'; +$lang['filter_eqsl_recv'] = 'eQSL 接收状态'; +$lang['filter_qsl_via'] = '通过(via)……发送QSL'; $lang['filter_qsl_images'] = 'QSL 图片'; // $lang['general_word_all'] --> application/language/english/general_words_lang.php @@ -156,5 +156,5 @@ $lang['filter_options_show'] = '显示'; // $lang['gen_hamradio_wwff'] --> application/language/english/general_words_lang.php // $lang['gen_hamradio_pota'] --> application/language/english/general_words_lang.php // $lang['options_save'] --> application/language/english/options_lang.php -$lang['filter_search_operator']='Search Operator'; +$lang['filter_search_operator']='搜素操作员'; $lang['filter_options_close'] = '关闭'; From 7eb11f2fc4a35f2e9b40b02213a0767ed1e0ec1b Mon Sep 17 00:00:00 2001 From: Yuluoxk Date: Sat, 27 Jan 2024 00:16:03 +0800 Subject: [PATCH 03/30] update admin_lang.php for zh-cn --- application/language/chinese_simplified/admin_lang.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/language/chinese_simplified/admin_lang.php b/application/language/chinese_simplified/admin_lang.php index 86f78bbd..9e13a127 100644 --- a/application/language/chinese_simplified/admin_lang.php +++ b/application/language/chinese_simplified/admin_lang.php @@ -54,7 +54,7 @@ $lang['admin_contest_name_of_contest'] = '竞赛 名称'; $lang['admin_contest_name_of_adif'] = '竞赛 在 ADIF 中的名称'; $lang['admin_contest_edit_active_hint'] = '如果要列在竞赛列表中,则设置为启用'; $lang['admin_contest_edit_update_contest'] = '更新竞赛'; -$lang['admin_contest_deletion_warning'] = '注意!您确定要删除以下竞赛吗:'; -$lang['admin_contest_active_all_warning'] = '注意!您确定要启用所有竞赛吗?'; -$lang['admin_contest_deactive_all_warning'] = '注意!您确定要停用所有竞赛吗?'; +$lang['admin_contest_deletion_warning'] = '警告!您确定要删除以下竞赛吗:'; +$lang['admin_contest_active_all_warning'] = '警告!您确定要启用所有竞赛吗?'; +$lang['admin_contest_deactive_all_warning'] = '警告!您确定要停用所有竞赛吗?'; From edca16f1fee741459f795bf2d410075df1390ba9 Mon Sep 17 00:00:00 2001 From: Yuluoxk Date: Sat, 27 Jan 2024 00:23:37 +0800 Subject: [PATCH 04/30] update contesting_lang.php for zh-cn --- .../language/chinese_simplified/contesting_lang.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/application/language/chinese_simplified/contesting_lang.php b/application/language/chinese_simplified/contesting_lang.php index 12c93bcb..33da0602 100644 --- a/application/language/chinese_simplified/contesting_lang.php +++ b/application/language/chinese_simplified/contesting_lang.php @@ -14,10 +14,10 @@ $lang['contesting_exchange_type_gridsquare'] = '网格座标'; $lang['contesting_exchange_type_other'] = '其他'; $lang['contesting_exchange_type_serial_exchange'] = '序列编号 + 交换信息'; $lang['contesting_exchange_type_serial_gridsquare'] = '序列编号 + 网格座标'; -$lang['contesting_exchange_serial_s'] = '序列编号 (S)'; -$lang['contesting_exchange_serial_r'] = '序列编号 (R)'; -$lang['contesting_exchange_gridsquare_s'] = '网格座标 (S)'; -$lang['contesting_exchange_gridsquare_r'] = '网格座标 (R)'; +$lang['contesting_exchange_serial_s'] = '序列编号 (发)'; +$lang['contesting_exchange_serial_r'] = '序列编号 (收)'; +$lang['contesting_exchange_gridsquare_s'] = '网格座标 (发)'; +$lang['contesting_exchange_gridsquare_r'] = '网格座标 (收)'; $lang['contesting_contest_name'] = '竞赛名称'; From d212eeee50b0ecad9079172e370999b684521c00 Mon Sep 17 00:00:00 2001 From: Yuluoxk Date: Sat, 27 Jan 2024 00:35:34 +0800 Subject: [PATCH 05/30] update qso_lang.php for zh-cn --- application/language/chinese_simplified/qso_lang.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/application/language/chinese_simplified/qso_lang.php b/application/language/chinese_simplified/qso_lang.php index 6c978228..c0f96511 100644 --- a/application/language/chinese_simplified/qso_lang.php +++ b/application/language/chinese_simplified/qso_lang.php @@ -90,10 +90,10 @@ $lang['qso_simplefle_syntax_help_title'] = "FLE 语法帮助"; $lang['qso_simplefle_syntax_help_ln1'] = "FLE 语法是一种简单的语法,用于快速记录 QSO。它的工作原理是,您只需输入每个 QSO 的更改部分。"; $lang['qso_simplefle_syntax_help_ln2'] = "在每一行上,只写与上一个 QSO 不同的数据。"; $lang['qso_simplefle_syntax_help_ln3'] = "例如,如果您在 20m 上与 DF3CB 进行了两次 QSO,您可以这样写:"; -$lang['qso_simplefle_syntax_help_ln4'] = "如果您不提供任何 RST 信息,语法将使用 59 (599 用于数据)。我们的下一个 QSO 不是双方都是 59,所以我们首先提供发送的 RST 信息。它比第一个 QSO 晚了 2 分钟。"; -$lang['qso_simplefle_syntax_help_ln5'] = "第一个 QSO 是在 21:34,第二个 QSO 在 21:36,比第一个 QSO 晚了 2 分钟。我们写下 6,因为这是这里唯一改变的数据。关于波段和模式的信息没有改变,因此省略了这些数据。"; -$lang['qso_simplefle_syntax_help_ln6'] = "我们的下一个 QSO 是在 2021 年 5 月 14 日的 21:40,我们将波段更改为 40m,但仍然在 SSB 上。如果没有给出 RST 信息,语法将为每个新的 QSO 使用 59。因此,我们可以添加另一个 QSO,它在两天后的同一时间发生。日期必须是 YYYY-MM-DD 格式。"; -$lang['qso_simplefle_syntax_help_ln7'] = "有关语法的更多信息,请查看 DF3CB 的网站此处。"; -$lang['qso_simplefle_syntax_help_ln8'] = ""; -$lang['qso_simplefle_syntax_help_ln9'] = ""; +$lang['qso_simplefle_syntax_help_ln4'] = ""; +$lang['qso_simplefle_syntax_help_ln5'] = "如果您不提供任何 RST 信息,语法将使用 59 (599 用于数据)。我们的下一个 QSO 不是双方都是 59,所以我们首先提供发送的 RST 信息。它比第一个 QSO 晚了 2 分钟。"; +$lang['qso_simplefle_syntax_help_ln6'] = "第一个 QSO 是在 21:34,第二个 QSO 在 21:36,比第一个 QSO 晚了 2 分钟。我们写下 6,因为这是这里唯一改变的数据。关于波段和模式的信息没有改变,因此省略了这些数据。"; +$lang['qso_simplefle_syntax_help_ln7'] = ""; +$lang['qso_simplefle_syntax_help_ln8'] = "我们的下一个 QSO 是在 2021 年 5 月 14 日的 21:40,我们将波段更改为 40m,但仍然在 SSB 上。如果没有给出 RST 信息,语法将为每个新的 QSO 使用 59。因此,我们可以添加另一个 QSO,它在两天后的同一时间发生。日期必须是 YYYY-MM-DD 格式。"; +$lang['qso_simplefle_syntax_help_ln9'] = "有关语法的更多信息,请查看 DF3CB 的网站此处。"; From cb9defbe91aa7bd024dd1df45da7d2eab6ce2593 Mon Sep 17 00:00:00 2001 From: Christoph Kottke Date: Tue, 26 Sep 2023 11:30:45 +0200 Subject: [PATCH 06/30] only locations with a eQSL nickname should be displayed in the dropdown under eQSL Import --- application/views/eqsl/import.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/application/views/eqsl/import.php b/application/views/eqsl/import.php index 55ebb169..2a24e17d 100644 --- a/application/views/eqsl/import.php +++ b/application/views/eqsl/import.php @@ -37,9 +37,10 @@

Choose Station(location) eQSL File belongs to:

From 088a4828ed6bf3161acbfaa6be4cdba1e75c4656 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 31 Jan 2024 11:47:37 +0100 Subject: [PATCH 07/30] Show all unconfirmed if no QSL method is selected --- application/controllers/Gridmap.php | 2 +- application/models/Gridmap_model.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/application/controllers/Gridmap.php b/application/controllers/Gridmap.php index 07590626..922e987c 100644 --- a/application/controllers/Gridmap.php +++ b/application/controllers/Gridmap.php @@ -173,7 +173,7 @@ class Gridmap extends CI_Controller { } } - $data['grid_2char_confirmed'] = ($array_grid_2char_confirmed); + $data['grid_2char_confirmed'] = ($array_grid_2char_confirmed); $data['grid_4char_confirmed'] = ($array_grid_4char_confirmed); $data['grid_6char_confirmed'] = ($array_grid_6char_confirmed); diff --git a/application/models/Gridmap_model.php b/application/models/Gridmap_model.php index 067545c3..0e38a3be 100644 --- a/application/models/Gridmap_model.php +++ b/application/models/Gridmap_model.php @@ -13,6 +13,10 @@ class Gridmap_model extends CI_Model { return null; } + if ($lotw != "true" && $qsl != "true" && $eqsl != "true" && $qrz != "true") { + return null; + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; $sql = 'SELECT distinct substring(COL_GRIDSQUARE,1,6) as GRID_SQUARES, COL_BAND FROM ' @@ -129,6 +133,11 @@ class Gridmap_model extends CI_Model { return null; } + + if ($lotw != "true" && $qsl != "true" && $eqsl != "true" && $qrz != "true") { + return null; + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; $sql = 'SELECT distinct COL_VUCC_GRIDS, COL_BAND FROM ' From b24c318eaf81dd239fd68ca3927fe02519e2a5a9 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 31 Jan 2024 12:28:20 +0100 Subject: [PATCH 08/30] Revert "Show all unconfirmed if no QSL method is selected" This reverts commit 088a4828ed6bf3161acbfaa6be4cdba1e75c4656. --- application/controllers/Gridmap.php | 2 +- application/models/Gridmap_model.php | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/application/controllers/Gridmap.php b/application/controllers/Gridmap.php index 922e987c..07590626 100644 --- a/application/controllers/Gridmap.php +++ b/application/controllers/Gridmap.php @@ -173,7 +173,7 @@ class Gridmap extends CI_Controller { } } - $data['grid_2char_confirmed'] = ($array_grid_2char_confirmed); + $data['grid_2char_confirmed'] = ($array_grid_2char_confirmed); $data['grid_4char_confirmed'] = ($array_grid_4char_confirmed); $data['grid_6char_confirmed'] = ($array_grid_6char_confirmed); diff --git a/application/models/Gridmap_model.php b/application/models/Gridmap_model.php index 0e38a3be..067545c3 100644 --- a/application/models/Gridmap_model.php +++ b/application/models/Gridmap_model.php @@ -13,10 +13,6 @@ class Gridmap_model extends CI_Model { return null; } - if ($lotw != "true" && $qsl != "true" && $eqsl != "true" && $qrz != "true") { - return null; - } - $location_list = "'".implode("','",$logbooks_locations_array)."'"; $sql = 'SELECT distinct substring(COL_GRIDSQUARE,1,6) as GRID_SQUARES, COL_BAND FROM ' @@ -133,11 +129,6 @@ class Gridmap_model extends CI_Model { return null; } - - if ($lotw != "true" && $qsl != "true" && $eqsl != "true" && $qrz != "true") { - return null; - } - $location_list = "'".implode("','",$logbooks_locations_array)."'"; $sql = 'SELECT distinct COL_VUCC_GRIDS, COL_BAND FROM ' From be1327f53a816542950d54c15cd7e5ec746d1c34 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 31 Jan 2024 12:29:19 +0100 Subject: [PATCH 09/30] (Much) easier approach --- application/models/Gridmap_model.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/application/models/Gridmap_model.php b/application/models/Gridmap_model.php index 067545c3..56047f3b 100644 --- a/application/models/Gridmap_model.php +++ b/application/models/Gridmap_model.php @@ -177,7 +177,10 @@ class Gridmap_model extends CI_Model { $sql .= " or col_qrzcom_qso_download_status = 'Y'"; } if ($sql != '') { - $sql='and (1=0 '.$sql.')'; + $sql=' and (1=0 '.$sql.')'; + } + if ($sql == '') { + $sql=' and 1=0'; } return $sql; } From a4038cb8c640fa376aca16db4bcad45e22e7b25f Mon Sep 17 00:00:00 2001 From: Yuluoxk Date: Fri, 2 Feb 2024 11:31:26 +0800 Subject: [PATCH 10/30] update station_lang.php translate for zh-cn --- .../chinese_simplified/station_lang.php | 144 +++++++++--------- 1 file changed, 72 insertions(+), 72 deletions(-) diff --git a/application/language/chinese_simplified/station_lang.php b/application/language/chinese_simplified/station_lang.php index e8b4def3..23afd347 100644 --- a/application/language/chinese_simplified/station_lang.php +++ b/application/language/chinese_simplified/station_lang.php @@ -27,12 +27,12 @@ $lang['station_logbooks_edit_name_update'] = "更新台站日志名称"; $lang['station_logbooks_public_slug'] = "自定义日志链接"; $lang['station_logbooks_public_slug_hint'] = "通过自定义日志链接,你可以通过此链接让别人访问你的日志"; $lang['station_logbooks_public_slug_format1'] = "他将会看起来像这样:"; -$lang['station_logbooks_public_slug_format2'] = "[your slug]"; -$lang['station_logbooks_public_slug_input'] = "Type in Public Slug choice"; -$lang['station_logbooks_public_slug_visit'] = "Visit Public Page"; -$lang['station_logbooks_public_search_hint'] = "Enabling public search function offers a search input box on the public logbook page accessed via public slug. Search only covers this logbook."; -$lang['station_logbooks_public_search_enabled'] = "Public search enabled"; -$lang['station_logbooks_select_avail_loc'] = "Select Available Station Locations"; +$lang['station_logbooks_public_slug_format2'] = "[你的日志]"; +$lang['station_logbooks_public_slug_input'] = "输入公共日志选项"; +$lang['station_logbooks_public_slug_visit'] = "访问公开日志页面"; +$lang['station_logbooks_public_search_hint'] = "启用公共搜索功能可在通过公共 slug 访问的公共日志页面上提供搜索输入框。 搜索仅涵盖此日志。"; +$lang['station_logbooks_public_search_enabled'] = "启用公共搜索"; +$lang['station_logbooks_select_avail_loc'] = "选择可用的台站位置"; $lang['station_logbooks_link_loc'] = "链接的台站位置"; $lang['station_logbooks_linked_loc'] = "已链接的台站位置"; $lang['station_logbooks_no_linked_loc'] = "未链接的台站位置"; @@ -46,72 +46,72 @@ Station Locations ___________________________________________________________________________________________ */ -$lang['station_location'] = 'Station Location'; -$lang['station_location_plural'] = "Station Locations"; -$lang['station_location_header_ln1'] = 'Station Locations define operating locations, such as your QTH, a friends QTH, or a portable station.'; -$lang['station_location_header_ln2'] = 'Similar to logbooks, a station profile keeps a set of QSOs together.'; -$lang['station_location_header_ln3'] = 'Only one station may be active at a time. In the table below this is shown with the -Active Station- badge.'; -$lang['station_location_create_header'] = 'Create Station Location'; -$lang['station_location_create'] = 'Create a Station Location'; -$lang['station_location_edit'] = 'Edit Station Location: '; -$lang['station_location_updated_suff'] = ' Updated.'; -$lang['station_location_warning'] = 'Attention: You need to set an active station location. Go to Callsign->Station Location to select one.'; -$lang['station_location_reassign_at'] = 'Please reassign them at '; -$lang['station_location_warning_reassign'] = 'Due to recent changes within Cloudlog you need to reassign QSOs to your station profiles.'; -$lang['station_location_name'] = 'Profile Name'; -$lang['station_location_name_hint'] = 'Shortname for the station location. For example: Home (IO87IP)'; -$lang['station_location_callsign'] = 'Station Callsign'; -$lang['station_location_callsign_hint'] = 'Station callsign. For example: 2M0SQL/P'; -$lang['station_location_power'] = 'Station Power (W)'; -$lang['station_location_power_hint'] = 'Default station power in Watt. Overwritten by CAT.'; -$lang['station_location_emptylog'] = 'Empty Log'; -$lang['station_location_confirm_active'] = 'Are you sure you want to make the following station the active station: '; -$lang['station_location_set_active'] = 'Set Active'; -$lang['station_location_active'] = 'Active Station'; -$lang['station_location_claim_ownership'] = 'Claim Ownership'; -$lang['station_location_confirm_del_qso'] = 'Are you sure you want to delete all QSOs within this station profile?'; -$lang['station_location_confirm_del_stationlocation'] = 'Are you sure you want delete station profile '; -$lang['station_location_confirm_del_stationlocation_qso'] = 'This will delete all QSOs within this station profile?'; -$lang['station_location_dxcc'] = 'Station DXCC'; -$lang['station_location_dxcc_hint'] = 'Station DXCC entity. For example: Scotland'; -$lang['station_location_dxcc_warning'] = "Stop here for a Moment. Your chosen DXCC is outdated and not valid anymore. Check which DXCC for this particular location is the correct one. If you are sure, ignore this warning."; -$lang['station_location_city'] = 'Station City'; -$lang['station_location_city_hint'] = 'Station city. For example: Inverness'; -$lang['station_location_state'] = 'Station State'; -$lang['station_location_state_hint'] = 'Station state. Applies to certain countries only. Leave blank if not applicable.'; -$lang['station_location_county'] = 'Station County'; -$lang['station_location_county_hint'] = 'Station County (Only used for USA/Alaska/Hawaii).'; -$lang['station_location_gridsquare'] = 'Station Gridsquare'; -$lang['station_location_gridsquare_hint_ln1'] = "Station gridsquare. For example: IO87IP. If you don't know your grid square then click here!"; -$lang['station_location_gridsquare_hint_ln2'] = "If you are located on a grid line, enter multiple grid squares separated with commas. For example: IO77,IO78,IO87,IO88."; -$lang['station_location_iota_hint_ln1'] = "Station IOTA reference. For example: EU-005"; -$lang['station_location_iota_hint_ln2'] = "You can look up IOTA references at the IOTA World website."; -$lang['station_location_sota_hint_ln1'] = "Station SOTA reference. You can look up SOTA references at the SOTA Maps website."; -$lang['station_location_wwff_hint_ln1'] = "Station WWFF reference. You can look up WWFF references at the GMA Map website."; -$lang['station_location_pota_hint_ln1'] = "Station POTA reference. You can look up POTA references at the POTA Map website."; -$lang['station_location_signature'] = "Signature"; -$lang['station_location_signature_name'] = "Signature Name"; -$lang['station_location_signature_name_hint'] = "Station Signature (e.g. GMA).."; -$lang['station_location_signature_info'] = "Signature Information"; -$lang['station_location_signature_info_hint'] = "Station Signature Info (e.g. DA/NW-357)."; -$lang['station_location_eqsl_hint'] = 'The QTH Nickname which is configured in your eQSL Profile'; -$lang['station_location_eqsl_defaultqslmsg'] = "Default QSLMSG"; -$lang['station_location_eqsl_defaultqslmsg_hint'] = "Define a default message that will be populated and sent for each QSO for this station location."; -$lang['station_location_qrz_subscription'] = 'Subscription Required'; -$lang['station_location_qrz_hint'] = "Find your API key on the QRZ.com Logbook settings page"; -$lang['station_location_qrz_realtime_upload'] = 'QRZ.com Logbook Realtime Upload'; -$lang['station_location_hrdlog_username'] = "HRDLog.net Username"; -$lang['station_location_hrdlog_username_hint'] = "The username you are registered with at HRDlog.net (usually your callsign)."; +$lang['station_location'] = '台站地址'; +$lang['station_location_plural'] = "台站地址"; +$lang['station_location_header_ln1'] = '台站地址定义的是操作位置,例如您的 QTH、朋友的 QTH 或野外架台的地址。'; +$lang['station_location_header_ln2'] = '与日志类似,台站地址配置将一组 QSO 保存在一起。'; +$lang['station_location_header_ln3'] = '一次只能有一个台站地址处于活动状态。 在下表中,这显示为带有“活动站”("Active Station")标识。'; +$lang['station_location_create_header'] = '创建台站地址'; +$lang['station_location_create'] = '新建台站地址'; +$lang['station_location_edit'] = '编辑台站地址'; +$lang['station_location_updated_suff'] = '已更新'; +$lang['station_location_warning'] = '注意:您需要设置活动的电台站位置(QTH)。 前往呼号->电台位置选择一个。'; +$lang['station_location_reassign_at'] = '请在这里重新分配:'; +$lang['station_location_warning_reassign'] = '由于 Cloudlog 中最近发生的变化,您需要将 QSO 重新分配给您的电台站配置文件。'; +$lang['station_location_name'] = '个人资料名称'; +$lang['station_location_name_hint'] = '台站位置的简称。 例如:学校(PN35GT)'; +$lang['station_location_callsign'] = '电台站的呼号'; +$lang['station_location_callsign_hint'] = '电台的呼号。 例如:B1/BG2FFJ'; +$lang['station_location_power'] = '电台功率'; +$lang['station_location_power_hint'] = '默认的电台功率(以瓦特为单位)。 这个设置会被从电台 CAT 读取到的数据所覆盖。'; +$lang['station_location_emptylog'] = '空日志'; +$lang['station_location_confirm_active'] = '您确定要将以下电台站位置设为活动的(在用的)电台站位置吗:'; +$lang['station_location_set_active'] = '设置为活动电台站位置'; +$lang['station_location_active'] = '活动的电台站'; +$lang['station_location_claim_ownership'] = '认领所有权'; +$lang['station_location_confirm_del_qso'] = '您确定要删除此电台配置文件中的所有 QSO 吗?'; +$lang['station_location_confirm_del_stationlocation'] = '您确定要删除电台配置文件吗 '; +$lang['station_location_confirm_del_stationlocation_qso'] = '这将会删除该电台配置文件中的所有 QSO,确定删除 ?'; +$lang['station_location_dxcc'] = '电台站的 DXCC 实体'; +$lang['station_location_dxcc_hint'] = '电台站的 DXCC 实体。 例如:中国大陆'; +$lang['station_location_dxcc_warning'] = "等一下。 您选择的 DXCC 已过时并且不再有效。 检查一下您要选择的位置所属的 DXCC 哪一个是正确的。 如果您确定没选错,我就要选这个,请忽略此警告。"; +$lang['station_location_city'] = '电台站的城市'; +$lang['station_location_city_hint'] = '电台站的城市。 例如:长春'; +$lang['station_location_state'] = '电台站的州/省份'; +$lang['station_location_state_hint'] = '电台站的省份。 仅适用于某些国家。,如果不适用则留空。如:吉林'; +$lang['station_location_county'] = '电台站的县/区'; +$lang['station_location_county_hint'] = '电台站的县/区。(仅用于美国/阿拉斯加/夏威夷)。'; +$lang['station_location_gridsquare'] = '电台站的网格方格(梅登海德网格)'; +$lang['station_location_gridsquare_hint_ln1'] = "电台站所属的网格。 例如:PN35GT。 如果您不知道自己的网格,请点击此处!"; +$lang['station_location_gridsquare_hint_ln2'] = "如果您正好位于网格线上,请输入多个网格方块,并用逗号分隔。 例如:PN24、PN34、PN23、PN33。"; +$lang['station_location_iota_hint_ln1'] = "电台站的IOTA编号。 例如:BY-001"; +$lang['station_location_iota_hint_ln2'] = "您可以在 IOTA World 网站查找 IOTA 编号。"; +$lang['station_location_sota_hint_ln1'] = "电台站内的 SOTA 编号. 您可以在 SOTA 地图 网站查找 SOTA 编号。"; +$lang['station_location_wwff_hint_ln1'] = "电台站内的 WWFF 编号. 您可以在 GMA 地图 网站查找 WWFF 编号。"; +$lang['station_location_pota_hint_ln1'] = "电台站内的 POTA 编号. 您可以在 POTA 地图 网站查找 POTA 编号。"; +$lang['station_location_signature'] = "签名"; +$lang['station_location_signature_name'] = "签名名称"; +$lang['station_location_signature_name_hint'] = "电台签名(例如 GMA).."; +$lang['station_location_signature_info'] = "签名信息"; +$lang['station_location_signature_info_hint'] = "电台签名信息(例如 DA/NW-357)。"; +$lang['station_location_eqsl_hint'] = '在您的 eQSL 配置文件中配置的 QTH 昵称'; +$lang['station_location_eqsl_defaultqslmsg'] = "默认的QSL信息"; +$lang['station_location_eqsl_defaultqslmsg_hint'] = "该设置将为此电台站站位置的每个 QSO 设置一个默认填充和发送的消息。"; +$lang['station_location_qrz_subscription'] = '需要 QRZ.com 的订阅'; +$lang['station_location_qrz_hint'] = "在 上查找您的API KEY。"; +$lang['station_location_qrz_realtime_upload'] = 'QRZ.com 日志簿实时上传'; +$lang['station_location_hrdlog_username'] = "HRDLog.net 用户名"; +$lang['station_location_hrdlog_username_hint'] = "您在 HRDlog.net 注册时使用的用户名(通常是您的呼号)。"; $lang['station_location_hrdlog_code'] = "HRDLog.net API Key"; -$lang['station_location_hrdlog_realtime_upload'] = "HRDLog.net Logbook Realtime Upload"; -$lang['station_location_hrdlog_code_hint'] = "Create your API Code on HRDLog.net Userprofile page"; -$lang['station_location_qo100_hint'] = "Create your API key on your QO-100 Dx Club's profile page"; -$lang['station_location_qo100_realtime_upload'] = "QO-100 Dx Club Realtime Upload"; -$lang['station_location_oqrs_enabled'] = "OQRS Enabled"; -$lang['station_location_oqrs_email_alert'] = "OQRS Email alert"; -$lang['station_location_oqrs_email_hint'] = "Make sure email is set up under admin and global options."; -$lang['station_location_oqrs_text'] = "OQRS Text"; -$lang['station_location_oqrs_text_hint'] = "Some info you want to add regarding QSL'ing."; -$lang['station_location_clublog_realtime_upload']='ClubLog Realtime Upload'; +$lang['station_location_hrdlog_realtime_upload'] = "HRDLog.net 日志簿实时上传"; +$lang['station_location_hrdlog_code_hint'] = "在 的用户资料页面创建你的API key。"; +$lang['station_location_qo100_hint'] = "在 的用户资料页面创建你的API key"; +$lang['station_location_qo100_realtime_upload'] = "QO-100 DX Club 实时上传"; +$lang['station_location_oqrs_enabled'] = "OQRS 启用"; +$lang['station_location_oqrs_email_alert'] = "OQRS 邮件提醒"; +$lang['station_location_oqrs_email_hint'] = "请确保已经和在管理-全局选项下设置了电子邮件。"; +$lang['station_location_oqrs_text'] = "OQRS 提示文本"; +$lang['station_location_oqrs_text_hint'] = "您想要的添加一些有关 QSL'ing 的信息。"; +$lang['station_location_clublog_realtime_upload']='ClubLog 日志实时上传'; From 0f717b7c8cc2398f5188045e3ccf4a1893a3f0c9 Mon Sep 17 00:00:00 2001 From: Yuluoxk Date: Fri, 2 Feb 2024 11:49:56 +0800 Subject: [PATCH 11/30] Optimized some translations in station_lang.php for zh-cn --- application/language/chinese_simplified/station_lang.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/language/chinese_simplified/station_lang.php b/application/language/chinese_simplified/station_lang.php index 23afd347..c51e2e28 100644 --- a/application/language/chinese_simplified/station_lang.php +++ b/application/language/chinese_simplified/station_lang.php @@ -98,14 +98,14 @@ $lang['station_location_eqsl_hint'] = '在您的 eQSL 配置文件中配置的 Q $lang['station_location_eqsl_defaultqslmsg'] = "默认的QSL信息"; $lang['station_location_eqsl_defaultqslmsg_hint'] = "该设置将为此电台站站位置的每个 QSO 设置一个默认填充和发送的消息。"; $lang['station_location_qrz_subscription'] = '需要 QRZ.com 的订阅'; -$lang['station_location_qrz_hint'] = "在 上查找您的API KEY。"; +$lang['station_location_qrz_hint'] = "在 QRZ.com的日志簿界面查找您的API KEY。"; $lang['station_location_qrz_realtime_upload'] = 'QRZ.com 日志簿实时上传'; $lang['station_location_hrdlog_username'] = "HRDLog.net 用户名"; $lang['station_location_hrdlog_username_hint'] = "您在 HRDlog.net 注册时使用的用户名(通常是您的呼号)。"; $lang['station_location_hrdlog_code'] = "HRDLog.net API Key"; $lang['station_location_hrdlog_realtime_upload'] = "HRDLog.net 日志簿实时上传"; -$lang['station_location_hrdlog_code_hint'] = "在 的用户资料页面创建你的API key。"; -$lang['station_location_qo100_hint'] = "在 的用户资料页面创建你的API key"; +$lang['station_location_hrdlog_code_hint'] = "在 hrdlog.net的用户资料页面创建你的API key。"; +$lang['station_location_qo100_hint'] = "在 qo100dx.club的用户资料页面创建你的API key"; $lang['station_location_qo100_realtime_upload'] = "QO-100 DX Club 实时上传"; $lang['station_location_oqrs_enabled'] = "OQRS 启用"; $lang['station_location_oqrs_email_alert'] = "OQRS 邮件提醒"; From f264e561db38bfde20935c9b35103b46865c59dc Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Sat, 3 Feb 2024 13:27:06 +0000 Subject: [PATCH 12/30] Should fix #2947 --- application/models/Logbook_model.php | 7280 +++++++++++++------------- 1 file changed, 3677 insertions(+), 3603 deletions(-) diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 2f1d9cff..48fefee7 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -1,35 +1,37 @@ input->post('callsign')); // Join date+time - $datetime = date("Y-m-d",strtotime($this->input->post('start_date')))." ". $this->input->post('start_time'); + $datetime = date("Y-m-d", strtotime($this->input->post('start_date'))) . " " . $this->input->post('start_time'); if ($this->input->post('end_time') != null) { - $datetime_off = date("Y-m-d",strtotime($this->input->post('start_date')))." ". $this->input->post('end_time'); - // if time off < time on, and time off is on 00:xx >> add 1 day (concidering start and end are between 23:00 and 00:59) // - $_tmp_datetime_off = strtotime($datetime_off); - if (($_tmp_datetime_off < strtotime($datetime)) && (substr($this->input->post('end_time'),0,2)=="00")) { - $datetime_off = date("Y-m-d H:i:s", ($_tmp_datetime_off + 60*60*24)); - } + $datetime_off = date("Y-m-d", strtotime($this->input->post('start_date'))) . " " . $this->input->post('end_time'); + // if time off < time on, and time off is on 00:xx >> add 1 day (concidering start and end are between 23:00 and 00:59) // + $_tmp_datetime_off = strtotime($datetime_off); + if (($_tmp_datetime_off < strtotime($datetime)) && (substr($this->input->post('end_time'), 0, 2) == "00")) { + $datetime_off = date("Y-m-d H:i:s", ($_tmp_datetime_off + 60 * 60 * 24)); + } } else { - $datetime_off = $datetime; + $datetime_off = $datetime; } if ($this->input->post('prop_mode') != null) { - $prop_mode = $this->input->post('prop_mode'); + $prop_mode = $this->input->post('prop_mode'); } else { - $prop_mode = ""; + $prop_mode = ""; } - if($this->input->post('sat_name')) { - $prop_mode = "SAT"; + if ($this->input->post('sat_name')) { + $prop_mode = "SAT"; } // Contest exchange, need to separate between serial and other type of exchange - if($this->input->post('exchangetype')) { + if ($this->input->post('exchangetype')) { switch ($this->input->post('exchangetype')) { case 'Exchange': $srx_string = $this->input->post('exch_rcvd') == '' ? null : $this->input->post('exch_rcvd'); @@ -61,12 +63,12 @@ class Logbook_model extends CI_Model { $srx_string = null; $stx_string = null; break; - case 'None': - $srx_string = null; - $stx_string = null; - $srx = null; - $stx = null; - break; + case 'None': + $srx_string = null; + $stx_string = null; + $srx = null; + $stx = null; + break; } } else { $srx_string = null; @@ -75,32 +77,32 @@ class Logbook_model extends CI_Model { $stx = null; } - if($this->input->post('contestname')) { - $contestid = $this->input->post('contestname'); + if ($this->input->post('contestname')) { + $contestid = $this->input->post('contestname'); } else { - $contestid = null; + $contestid = null; } - if($this->session->userdata('user_locator')){ - $locator = $this->session->userdata('user_locator'); + if ($this->session->userdata('user_locator')) { + $locator = $this->session->userdata('user_locator'); } else { - $locator = $this->config->item('locator'); + $locator = $this->config->item('locator'); } - if($this->input->post('transmit_power')) { - $tx_power = $this->input->post('transmit_power'); + if ($this->input->post('transmit_power')) { + $tx_power = $this->input->post('transmit_power'); } else { - $tx_power = null; + $tx_power = null; } - if($this->input->post('country') == "") { + if ($this->input->post('country') == "") { $dxcc = $this->check_dxcc_table(strtoupper(trim($callsign)), $datetime); $country = ucwords(strtolower($dxcc[1]), "- (/"); } else { $country = $this->input->post('country'); } - if($this->input->post('cqz') == "") { + if ($this->input->post('cqz') == "") { $dxcc = $this->check_dxcc_table(strtoupper(trim($callsign)), $datetime); if (empty($dxcc[2])) { $cqz = null; @@ -111,166 +113,164 @@ class Logbook_model extends CI_Model { $cqz = $this->input->post('cqz'); } - if($this->input->post('dxcc_id') == "") { + if ($this->input->post('dxcc_id') == "") { $dxcc = $this->check_dxcc_table(strtoupper(trim($callsign)), $datetime); if (empty($dxcc[0])) { $dxcc_id = null; } else { - $dxcc_id = $dxcc[0]; + $dxcc_id = $dxcc[0]; } - } else { - $dxcc_id = $this->input->post('dxcc_id'); + $dxcc_id = $this->input->post('dxcc_id'); } - if($this->input->post('continent') == "") { + if ($this->input->post('continent') == "") { $dxcc = $this->check_dxcc_table(strtoupper(trim($callsign)), $datetime); if (empty($dxcc[3])) { $continent = null; } else { - $continent = $dxcc[3]; + $continent = $dxcc[3]; } - } else { - $continent = $this->input->post('continent'); + $continent = $this->input->post('continent'); } $mode = $this->get_main_mode_if_submode($this->input->post('mode')); if ($mode == null) { - $mode = $this->input->post('mode'); - $submode = null; + $mode = $this->input->post('mode'); + $submode = null; } else { - $submode = $this->input->post('mode'); + $submode = $this->input->post('mode'); } - if($this->input->post('county') && $this->input->post('usa_state')) { + if ($this->input->post('county') && $this->input->post('usa_state')) { $clean_county_input = trim($this->input->post('usa_state')) . "," . trim($this->input->post('county')); } else { $clean_county_input = null; } - if($this->input->post('copyexchangetodok')) { + if ($this->input->post('copyexchangetodok')) { $darc_dok = $this->input->post('exch_rcvd'); } else { $darc_dok = $this->input->post('darc_dok'); } if ($this->input->post('qsl_sent')) { - $qsl_sent = $this->input->post('qsl_sent'); + $qsl_sent = $this->input->post('qsl_sent'); } else { - $qsl_sent = 'N'; + $qsl_sent = 'N'; } if ($this->input->post('qsl_rcvd')) { - $qsl_rcvd = $this->input->post('qsl_rcvd'); + $qsl_rcvd = $this->input->post('qsl_rcvd'); } else { - $qsl_rcvd = 'N'; + $qsl_rcvd = 'N'; } if ($qsl_sent == 'N') { - $qslsdate = null; + $qslsdate = null; } else { - $qslsdate = date('Y-m-d H:i:s'); + $qslsdate = date('Y-m-d H:i:s'); } if ($qsl_rcvd == 'N') { - $qslrdate = null; + $qslrdate = null; } else { - $qslrdate = date('Y-m-d H:i:s'); + $qslrdate = date('Y-m-d H:i:s'); } // Create array with QSO Data $data = array( - 'COL_TIME_ON' => $datetime, - 'COL_TIME_OFF' => $datetime_off, - 'COL_CALL' => strtoupper(trim($callsign)), - 'COL_BAND' => $this->input->post('band'), - 'COL_BAND_RX' => $this->input->post('band_rx'), - 'COL_FREQ' => $this->parse_frequency($this->input->post('freq_display')), - 'COL_MODE' => $mode, - 'COL_SUBMODE' => $submode, - 'COL_RST_RCVD' => $this->input->post('rst_rcvd'), - 'COL_RST_SENT' => $this->input->post('rst_sent'), - 'COL_NAME' => $this->input->post('name'), - 'COL_COMMENT' => $this->input->post('comment'), - 'COL_SAT_NAME' => $this->input->post('sat_name') == null ? '' : strtoupper($this->input->post('sat_name')), - 'COL_SAT_MODE' => $this->input->post('sat_mode') == null ? '' : strtoupper($this->input->post('sat_mode')), - 'COL_COUNTRY' => $country, - 'COL_CONT' => $continent, - 'COL_QSLSDATE' => $qslsdate, - 'COL_QSLRDATE' => $qslrdate, - 'COL_QSL_SENT' => $qsl_sent, - 'COL_QSL_RCVD' => $qsl_rcvd, - 'COL_QSL_SENT_VIA' => $this->input->post('qsl_sent_method'), - 'COL_QSL_RCVD_VIA' => $this->input->post('qsl_rcvd_method'), - 'COL_QSL_VIA' => $this->input->post('qsl_via'), - 'COL_QSLMSG' => $this->input->post('qslmsg'), - 'COL_OPERATOR' => $this->input->post('operator_callsign') ?? $this->session->userdata('operator_callsign'), - 'COL_QTH' => $this->input->post('qth'), - 'COL_PROP_MODE' => $prop_mode, - 'COL_IOTA' => $this->input->post('iota_ref') == null ? '' : trim($this->input->post('iota_ref')), - 'COL_DISTANCE' => $this->input->post('distance'), - 'COL_FREQ_RX' => $this->parse_frequency($this->input->post('freq_display_rx')), - 'COL_ANT_AZ' => null, - 'COL_ANT_EL' => null, - 'COL_A_INDEX' => null, - 'COL_AGE' => null, - 'COL_TEN_TEN' => null, - 'COL_TX_PWR' => $tx_power, - 'COL_STX' => $stx, - 'COL_SRX' => $srx, - 'COL_STX_STRING' => $stx_string == null ? '' : strtoupper(trim($stx_string)), - 'COL_SRX_STRING' => $srx_string == null ? '' : strtoupper(trim($srx_string)), - 'COL_CONTEST_ID' => $contestid, - 'COL_NR_BURSTS' => null, - 'COL_NR_PINGS' => null, - 'COL_MAX_BURSTS' => null, - 'COL_K_INDEX' => null, - 'COL_SFI' => null, - 'COL_RX_PWR' => null, - 'COL_LAT' => null, - 'COL_LON' => null, - 'COL_DXCC' => $dxcc_id, - 'COL_CQZ' => $cqz, - 'COL_STATE' => $this->input->post('usa_state') == null ? '' : trim($this->input->post('usa_state')), - 'COL_CNTY' => $clean_county_input, - 'COL_SOTA_REF' => $this->input->post('sota_ref') == null ? '' : trim($this->input->post('sota_ref')), - 'COL_WWFF_REF' => $this->input->post('wwff_ref') == null ? '' : trim($this->input->post('wwff_ref')), - 'COL_POTA_REF' => $this->input->post('pota_ref') == null ? '' : trim($this->input->post('pota_ref')), - 'COL_SIG' => $this->input->post('sig') == null ? '' : trim($this->input->post('sig')), - 'COL_SIG_INFO' => $this->input->post('sig_info') == null ? '' : trim($this->input->post('sig_info')), - 'COL_DARC_DOK' => $darc_dok == null ? '' : strtoupper(trim($darc_dok)), - 'COL_NOTES' => $this->input->post('notes'), + 'COL_TIME_ON' => $datetime, + 'COL_TIME_OFF' => $datetime_off, + 'COL_CALL' => strtoupper(trim($callsign)), + 'COL_BAND' => $this->input->post('band'), + 'COL_BAND_RX' => $this->input->post('band_rx'), + 'COL_FREQ' => $this->parse_frequency($this->input->post('freq_display')), + 'COL_MODE' => $mode, + 'COL_SUBMODE' => $submode, + 'COL_RST_RCVD' => $this->input->post('rst_rcvd'), + 'COL_RST_SENT' => $this->input->post('rst_sent'), + 'COL_NAME' => $this->input->post('name'), + 'COL_COMMENT' => $this->input->post('comment'), + 'COL_SAT_NAME' => $this->input->post('sat_name') == null ? '' : strtoupper($this->input->post('sat_name')), + 'COL_SAT_MODE' => $this->input->post('sat_mode') == null ? '' : strtoupper($this->input->post('sat_mode')), + 'COL_COUNTRY' => $country, + 'COL_CONT' => $continent, + 'COL_QSLSDATE' => $qslsdate, + 'COL_QSLRDATE' => $qslrdate, + 'COL_QSL_SENT' => $qsl_sent, + 'COL_QSL_RCVD' => $qsl_rcvd, + 'COL_QSL_SENT_VIA' => $this->input->post('qsl_sent_method'), + 'COL_QSL_RCVD_VIA' => $this->input->post('qsl_rcvd_method'), + 'COL_QSL_VIA' => $this->input->post('qsl_via'), + 'COL_QSLMSG' => $this->input->post('qslmsg'), + 'COL_OPERATOR' => $this->input->post('operator_callsign') ?? $this->session->userdata('operator_callsign'), + 'COL_QTH' => $this->input->post('qth'), + 'COL_PROP_MODE' => $prop_mode, + 'COL_IOTA' => $this->input->post('iota_ref') == null ? '' : trim($this->input->post('iota_ref')), + 'COL_DISTANCE' => $this->input->post('distance'), + 'COL_FREQ_RX' => $this->parse_frequency($this->input->post('freq_display_rx')), + 'COL_ANT_AZ' => null, + 'COL_ANT_EL' => null, + 'COL_A_INDEX' => null, + 'COL_AGE' => null, + 'COL_TEN_TEN' => null, + 'COL_TX_PWR' => $tx_power, + 'COL_STX' => $stx, + 'COL_SRX' => $srx, + 'COL_STX_STRING' => $stx_string == null ? '' : strtoupper(trim($stx_string)), + 'COL_SRX_STRING' => $srx_string == null ? '' : strtoupper(trim($srx_string)), + 'COL_CONTEST_ID' => $contestid, + 'COL_NR_BURSTS' => null, + 'COL_NR_PINGS' => null, + 'COL_MAX_BURSTS' => null, + 'COL_K_INDEX' => null, + 'COL_SFI' => null, + 'COL_RX_PWR' => null, + 'COL_LAT' => null, + 'COL_LON' => null, + 'COL_DXCC' => $dxcc_id, + 'COL_CQZ' => $cqz, + 'COL_STATE' => $this->input->post('usa_state') == null ? '' : trim($this->input->post('usa_state')), + 'COL_CNTY' => $clean_county_input, + 'COL_SOTA_REF' => $this->input->post('sota_ref') == null ? '' : trim($this->input->post('sota_ref')), + 'COL_WWFF_REF' => $this->input->post('wwff_ref') == null ? '' : trim($this->input->post('wwff_ref')), + 'COL_POTA_REF' => $this->input->post('pota_ref') == null ? '' : trim($this->input->post('pota_ref')), + 'COL_SIG' => $this->input->post('sig') == null ? '' : trim($this->input->post('sig')), + 'COL_SIG_INFO' => $this->input->post('sig_info') == null ? '' : trim($this->input->post('sig_info')), + 'COL_DARC_DOK' => $darc_dok == null ? '' : strtoupper(trim($darc_dok)), + 'COL_NOTES' => $this->input->post('notes'), ); $station_id = $this->input->post('station_profile'); - if($station_id == "" || $station_id == "0") { - $CI =& get_instance(); + if ($station_id == "" || $station_id == "0") { + $CI = &get_instance(); $CI->load->model('stations'); $station_id = $CI->stations->find_active(); } - $CI =& get_instance(); - $CI->load->model('stations'); - if (!$CI->stations->check_station_is_accessible($station_id)) { // Hard Exit if station_profile not accessible - return 'Station not accessible
'; - } + $CI = &get_instance(); + $CI->load->model('stations'); + if (!$CI->stations->check_station_is_accessible($station_id)) { // Hard Exit if station_profile not accessible + return 'Station not accessible
'; + } // If station profile has been provided fill in the fields - if($station_id != "0") { + if ($station_id != "0") { $station = $this->check_station($station_id); - $data['station_id'] = $station_id; + $data['station_id'] = $station_id; - // [eQSL default msg] add info to QSO for Contest or SFLE // - if (empty($data['COL_QSLMSG']) && (($this->input->post('isSFLE')==true) || (!empty($data['COL_CONTEST_ID'])))) { - $this->load->model('user_options_model'); - $options_object = $this->user_options_model->get_options('eqsl_default_qslmsg',array('option_name'=>'key_station_id','option_key'=>$station_id))->result(); - $data['COL_QSLMSG'] = (isset($options_object[0]->option_value))?$options_object[0]->option_value:''; - } + // [eQSL default msg] add info to QSO for Contest or SFLE // + if (empty($data['COL_QSLMSG']) && (($this->input->post('isSFLE') == true) || (!empty($data['COL_CONTEST_ID'])))) { + $this->load->model('user_options_model'); + $options_object = $this->user_options_model->get_options('eqsl_default_qslmsg', array('option_name' => 'key_station_id', 'option_key' => $station_id))->result(); + $data['COL_QSLMSG'] = (isset($options_object[0]->option_value)) ? $options_object[0]->option_value : ''; + } if (strpos(trim($station['station_gridsquare']), ',') !== false) { $data['COL_MY_VUCC_GRIDS'] = strtoupper(trim($station['station_gridsquare'])); @@ -278,13 +278,13 @@ class Logbook_model extends CI_Model { $data['COL_MY_GRIDSQUARE'] = strtoupper(trim($station['station_gridsquare'])); } - if ($this->exists_hrdlog_credentials($station_id)) { + if ($this->exists_hrdlog_credentials($station_id)) { $data['COL_HRDLOG_QSO_UPLOAD_STATUS'] = 'N'; - } + } - if ($this->exists_qrz_api_key($station_id)) { + if ($this->exists_qrz_api_key($station_id)) { $data['COL_QRZCOM_QSO_UPLOAD_STATUS'] = 'N'; - } + } $data['COL_MY_CITY'] = strtoupper(trim($station['station_city'])); $data['COL_MY_IOTA'] = strtoupper(trim($station['station_iota'])); @@ -294,7 +294,11 @@ class Logbook_model extends CI_Model { $data['COL_STATION_CALLSIGN'] = strtoupper(trim($station['station_callsign'])); $data['COL_MY_DXCC'] = strtoupper(trim($station['station_dxcc'])); - $data['COL_MY_COUNTRY'] = strtoupper(trim($station['station_country'])); + if (isset($station['station_country'])) { + $data['COL_MY_COUNTRY'] = strtoupper(trim($station['station_country'])); + } else { + $data['COL_MY_COUNTRY'] = null; + } $data['COL_MY_CNTY'] = strtoupper(trim($station['station_cnty'])); $data['COL_MY_CQ_ZONE'] = strtoupper(trim($station['station_cq'])); $data['COL_MY_ITU_ZONE'] = strtoupper(trim($station['station_itu'])); @@ -308,266 +312,275 @@ class Logbook_model extends CI_Model { } // if eQSL username set, default SENT & RCVD to 'N' else leave as null - if ($this->session->userdata('user_eqsl_name')){ - $data['COL_EQSL_QSL_SENT'] = 'N'; - $data['COL_EQSL_QSL_RCVD'] = 'N'; + if ($this->session->userdata('user_eqsl_name')) { + $data['COL_EQSL_QSL_SENT'] = 'N'; + $data['COL_EQSL_QSL_RCVD'] = 'N'; } // if LoTW username set, default SENT & RCVD to 'N' else leave as null - if ($this->session->userdata('user_lotw_name')){ - $data['COL_LOTW_QSL_SENT'] = 'N'; - $data['COL_LOTW_QSL_RCVD'] = 'N'; + if ($this->session->userdata('user_lotw_name')) { + $data['COL_LOTW_QSL_SENT'] = 'N'; + $data['COL_LOTW_QSL_RCVD'] = 'N'; } $this->add_qso($data, $skipexport = false); } - public function check_last_lotw($call){ // Fetch difference in days when $call has last updated LotW + public function check_last_lotw($call) + { // Fetch difference in days when $call has last updated LotW - $sql="select datediff(now(),lastupload) as DAYS from lotw_users where callsign = ?"; // Use binding to prevent SQL-injection - $query = $this->db->query($sql, $call); - $row = $query->row(); - if (isset($row)) { - return($row->DAYS); - } + $sql = "select datediff(now(),lastupload) as DAYS from lotw_users where callsign = ?"; // Use binding to prevent SQL-injection + $query = $this->db->query($sql, $call); + $row = $query->row(); + if (isset($row)) { + return ($row->DAYS); + } } - public function check_station($id){ + public function check_station($id) + { $this->db->select('station_profile.*, dxcc_entities.name as station_country'); - $this->db->join('dxcc_entities','station_profile.station_dxcc = dxcc_entities.adif','left outer'); + $this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif', 'left outer'); $this->db->where('station_id', $id); $query = $this->db->get('station_profile'); if ($query->num_rows() > 0) { $row = $query->row_array(); - return($row); + return ($row); } } - /* + /* * Used to fetch QSOs from the logbook in the awards */ - public function qso_details($searchphrase, $band, $mode, $type, $qsl, $searchmode = null){ - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + public function qso_details($searchphrase, $band, $mode, $type, $qsl, $searchmode = null) + { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); - $this->db->join('dxcc_entities', 'dxcc_entities.adif = '.$this->config->item('table_name').'.COL_DXCC', 'left outer'); - $this->db->join('lotw_users', 'lotw_users.callsign = '.$this->config->item('table_name').'.col_call', 'left outer'); - switch ($type) { - 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; - case 'VUCC': - if ($searchmode == 'activated') { - $this->db->where("station_gridsquare like '%" . $searchphrase . "%'"); - } else { - $this->db->where("(COL_GRIDSQUARE like '" . $searchphrase . "%' OR COL_VUCC_GRIDS like '%" . $searchphrase ."%')"); - } - break; - case 'CQZone': - $this->db->where('COL_CQZ', $searchphrase); - break; - case 'WAS': - $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_WWFF_REF', $searchphrase); - break; - case 'POTA': - $this->db->where('COL_POTA_REF', $searchphrase); - break; - case 'DOK': - $this->db->where('COL_DARC_DOK', $searchphrase); - break; - case 'WAJA': - $state = str_pad($searchphrase, 2, '0', STR_PAD_LEFT); - $this->db->where('COL_STATE', $state); - $this->db->where('COL_DXCC', '339'); - break; - case 'QSLRDATE': - $this->db->where('date(COL_QSLRDATE)=date(SYSDATE())'); - break; - case 'QSLSDATE': - $this->db->where('date(COL_QSLSDATE)=date(SYSDATE())'); - break; - case 'EQSLRDATE': - $this->db->where('date(COL_EQSL_QSLRDATE)=date(SYSDATE())'); - break; - case 'EQSLSDATE': - $this->db->where('date(COL_EQSL_QSLSDATE)=date(SYSDATE())'); - break; - case 'LOTWRDATE': - $this->db->where('date(COL_LOTW_QSLRDATE)=date(SYSDATE())'); - break; - case 'LOTWSDATE': - $this->db->where('date(COL_LOTW_QSLSDATE)=date(SYSDATE())'); - break; - case 'QRZRDATE': - $this->db->where('date(COL_QRZCOM_QSO_DOWNLOAD_DATE)=date(SYSDATE())'); - break; - case 'QRZSDATE': - $this->db->where('date(COL_QRZCOM_QSO_UPLOAD_DATE)=date(SYSDATE())'); - break; - } - - $this->db->where_in($this->config->item('table_name').'.station_id', $logbooks_locations_array); - - if (strtolower($band) != 'all') { - if($band != "SAT") { - $this->db->where('COL_PROP_MODE !=', 'SAT'); - $this->db->where('COL_BAND', $band); - } else { - $this->db->where('COL_PROP_MODE', "SAT"); - } - } - - if (!empty($qsl)) { - $qslfilter = array(); - if (strpos($qsl, "Q") !== false) { - $qslfilter[] = 'COL_QSL_RCVD = "Y"'; - } - if (strpos($qsl, "L") !== false) { - $qslfilter[] = 'COL_LOTW_QSL_RCVD = "Y"'; - } - if (strpos($qsl, "E") !== false) { - $qslfilter[] = 'COL_EQSL_QSL_RCVD = "Y"'; - } - $sql = "(".implode(' OR ', $qslfilter).")"; - $this->db->where($sql); - } - - if (strtolower($mode) != 'all' && $mode != '') { - $this->db->where("(COL_MODE='" . $mode . "' OR COL_SUBMODE='" . $mode ."')"); - } - $this->db->order_by("COL_TIME_ON", "desc"); - - $this->db->limit(500); - - $result = $this->db->get($this->config->item('table_name')); - return $result; - //return $this->db->get($this->config->item('table_name')); - } - - public function activated_grids_qso_details($searchphrase, $band, $mode){ - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - $sql = 'SELECT COL_FREQ, COL_SOTA_REF, COL_OPERATOR, COL_IOTA, COL_VUCC_GRIDS, COL_STATE, COL_GRIDSQUARE, COL_PRIMARY_KEY, COL_CALL, COL_TIME_ON, COL_BAND, COL_SAT_NAME, COL_MODE, COL_SUBMODE, COL_RST_SENT, '; - $sql .= 'COL_RST_RCVD, COL_STX, COL_SRX, COL_STX_STRING, COL_SRX_STRING, COL_COUNTRY, COL_QSL_SENT, COL_QSL_SENT_VIA, '; - $sql .= 'COL_QSLSDATE, COL_QSL_RCVD, COL_QSL_RCVD_VIA, COL_QSLRDATE, COL_EQSL_QSL_SENT, COL_EQSL_QSLSDATE, COL_EQSL_QSLRDATE, '; - $sql .= 'COL_EQSL_QSL_RCVD, COL_LOTW_QSL_SENT, COL_LOTW_QSLSDATE, COL_LOTW_QSL_RCVD, COL_LOTW_QSLRDATE, COL_CONTEST_ID, station_gridsquare, dxcc_entities.name as name, dxcc_entities.end as end, callsign, lastupload '; - $sql .= 'FROM '.$this->config->item('table_name').' JOIN `station_profile` ON station_profile.station_id = '.$this->config->item('table_name').'.station_id '; - $sql .= 'LEFT OUTER JOIN `dxcc_entities` ON dxcc_entities.adif = '.$this->config->item('table_name').'.COL_DXCC '; - $sql .= 'LEFT OUTER JOIN `lotw_users` ON lotw_users.callsign = '.$this->config->item('table_name').'.COL_CALL '; - $sql .= 'WHERE '.$this->config->item('table_name').'.station_id IN (SELECT station_id from station_profile '; - $sql .= 'WHERE station_gridsquare LIKE "%'.$searchphrase.'%") '; - - if ($band != 'All') { - if($band != "SAT") { - $sql .= 'AND COL_PROP_MODE != "SAT" AND '; - $sql .= 'COL_BAND = "'.$band.'" '; - } else { - $sql .= 'AND COL_PROP_MODE = "SAT"'; - } - } - - if ($mode != 'All') { - $sql .= ' AND COL_MODE = "'.$mode.'" OR COL_SUBMODE="'.$mode.'"'; - } - $sql .= ' ORDER BY COL_TIME_ON DESC LIMIT 500'; - - return $this->db->query($sql); - } - - public function vucc_qso_details($gridsquare, $band) { - $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)."'"; - - $sql = "select * from " . $this->config->item('table_name') . - " where station_id in (" . $location_list . ")" . - " and (col_gridsquare like '" . $gridsquare. "%' - or col_vucc_grids like '%" . $gridsquare. "%')"; - - if ($band != 'All') { - if ($band == 'SAT') { - $sql .= " and col_prop_mode ='" . $band . "'"; - } else { - $sql .= " and col_prop_mode !='SAT'"; - $sql .= " and col_band ='" . $band . "'"; - } + $this->db->join('station_profile', 'station_profile.station_id = ' . $this->config->item('table_name') . '.station_id'); + $this->db->join('dxcc_entities', 'dxcc_entities.adif = ' . $this->config->item('table_name') . '.COL_DXCC', 'left outer'); + $this->db->join('lotw_users', 'lotw_users.callsign = ' . $this->config->item('table_name') . '.col_call', 'left outer'); + switch ($type) { + 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; + case 'VUCC': + if ($searchmode == 'activated') { + $this->db->where("station_gridsquare like '%" . $searchphrase . "%'"); + } else { + $this->db->where("(COL_GRIDSQUARE like '" . $searchphrase . "%' OR COL_VUCC_GRIDS like '%" . $searchphrase . "%')"); } - - return $this->db->query($sql); + break; + case 'CQZone': + $this->db->where('COL_CQZ', $searchphrase); + break; + case 'WAS': + $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_WWFF_REF', $searchphrase); + break; + case 'POTA': + $this->db->where('COL_POTA_REF', $searchphrase); + break; + case 'DOK': + $this->db->where('COL_DARC_DOK', $searchphrase); + break; + case 'WAJA': + $state = str_pad($searchphrase, 2, '0', STR_PAD_LEFT); + $this->db->where('COL_STATE', $state); + $this->db->where('COL_DXCC', '339'); + break; + case 'QSLRDATE': + $this->db->where('date(COL_QSLRDATE)=date(SYSDATE())'); + break; + case 'QSLSDATE': + $this->db->where('date(COL_QSLSDATE)=date(SYSDATE())'); + break; + case 'EQSLRDATE': + $this->db->where('date(COL_EQSL_QSLRDATE)=date(SYSDATE())'); + break; + case 'EQSLSDATE': + $this->db->where('date(COL_EQSL_QSLSDATE)=date(SYSDATE())'); + break; + case 'LOTWRDATE': + $this->db->where('date(COL_LOTW_QSLRDATE)=date(SYSDATE())'); + break; + case 'LOTWSDATE': + $this->db->where('date(COL_LOTW_QSLSDATE)=date(SYSDATE())'); + break; + case 'QRZRDATE': + $this->db->where('date(COL_QRZCOM_QSO_DOWNLOAD_DATE)=date(SYSDATE())'); + break; + case 'QRZSDATE': + $this->db->where('date(COL_QRZCOM_QSO_UPLOAD_DATE)=date(SYSDATE())'); + break; } - public function activator_details($call, $band, $leogeo){ - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $this->db->where_in($this->config->item('table_name') . '.station_id', $logbooks_locations_array); - $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); - $this->db->join('dxcc_entities', 'dxcc_entities.adif = '.$this->config->item('table_name').'.COL_DXCC', 'left outer'); - $this->db->join('lotw_users', 'lotw_users.callsign = '.$this->config->item('table_name').'.col_call', 'left outer'); - $this->db->where('COL_CALL', $call); - if ($band != 'All') { - if ($band == 'SAT') { - $this->db->where('col_prop_mode', $band); - switch ($leogeo) { - case 'leo' : $this->db->where('COL_SAT_NAME !=', 'QO-100'); - break; - case 'geo': $this->db->where('COL_SAT_NAME', 'QO-100'); - break; - } - } else { - $this->db->where('COL_PROP_MODE !=', 'SAT'); - $this->db->where('col_band', $band); - } - } - - $this->db->where_in('station_profile.station_id', $logbooks_locations_array); - $this->db->order_by('COL_TIME_ON', 'DESC'); - - return $this->db->get($this->config->item('table_name')); + if (strtolower($band) != 'all') { + if ($band != "SAT") { + $this->db->where('COL_PROP_MODE !=', 'SAT'); + $this->db->where('COL_BAND', $band); + } else { + $this->db->where('COL_PROP_MODE', "SAT"); + } } - public function get_callsigns($callsign){ + if (!empty($qsl)) { + $qslfilter = array(); + if (strpos($qsl, "Q") !== false) { + $qslfilter[] = 'COL_QSL_RCVD = "Y"'; + } + if (strpos($qsl, "L") !== false) { + $qslfilter[] = 'COL_LOTW_QSL_RCVD = "Y"'; + } + if (strpos($qsl, "E") !== false) { + $qslfilter[] = 'COL_EQSL_QSL_RCVD = "Y"'; + } + $sql = "(" . implode(' OR ', $qslfilter) . ")"; + $this->db->where($sql); + } + + if (strtolower($mode) != 'all' && $mode != '') { + $this->db->where("(COL_MODE='" . $mode . "' OR COL_SUBMODE='" . $mode . "')"); + } + $this->db->order_by("COL_TIME_ON", "desc"); + + $this->db->limit(500); + + $result = $this->db->get($this->config->item('table_name')); + return $result; + //return $this->db->get($this->config->item('table_name')); + } + + public function activated_grids_qso_details($searchphrase, $band, $mode) + { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + $sql = 'SELECT COL_FREQ, COL_SOTA_REF, COL_OPERATOR, COL_IOTA, COL_VUCC_GRIDS, COL_STATE, COL_GRIDSQUARE, COL_PRIMARY_KEY, COL_CALL, COL_TIME_ON, COL_BAND, COL_SAT_NAME, COL_MODE, COL_SUBMODE, COL_RST_SENT, '; + $sql .= 'COL_RST_RCVD, COL_STX, COL_SRX, COL_STX_STRING, COL_SRX_STRING, COL_COUNTRY, COL_QSL_SENT, COL_QSL_SENT_VIA, '; + $sql .= 'COL_QSLSDATE, COL_QSL_RCVD, COL_QSL_RCVD_VIA, COL_QSLRDATE, COL_EQSL_QSL_SENT, COL_EQSL_QSLSDATE, COL_EQSL_QSLRDATE, '; + $sql .= 'COL_EQSL_QSL_RCVD, COL_LOTW_QSL_SENT, COL_LOTW_QSLSDATE, COL_LOTW_QSL_RCVD, COL_LOTW_QSLRDATE, COL_CONTEST_ID, station_gridsquare, dxcc_entities.name as name, dxcc_entities.end as end, callsign, lastupload '; + $sql .= 'FROM ' . $this->config->item('table_name') . ' JOIN `station_profile` ON station_profile.station_id = ' . $this->config->item('table_name') . '.station_id '; + $sql .= 'LEFT OUTER JOIN `dxcc_entities` ON dxcc_entities.adif = ' . $this->config->item('table_name') . '.COL_DXCC '; + $sql .= 'LEFT OUTER JOIN `lotw_users` ON lotw_users.callsign = ' . $this->config->item('table_name') . '.COL_CALL '; + $sql .= 'WHERE ' . $this->config->item('table_name') . '.station_id IN (SELECT station_id from station_profile '; + $sql .= 'WHERE station_gridsquare LIKE "%' . $searchphrase . '%") '; + + if ($band != 'All') { + if ($band != "SAT") { + $sql .= 'AND COL_PROP_MODE != "SAT" AND '; + $sql .= 'COL_BAND = "' . $band . '" '; + } else { + $sql .= 'AND COL_PROP_MODE = "SAT"'; + } + } + + if ($mode != 'All') { + $sql .= ' AND COL_MODE = "' . $mode . '" OR COL_SUBMODE="' . $mode . '"'; + } + $sql .= ' ORDER BY COL_TIME_ON DESC LIMIT 500'; + + return $this->db->query($sql); + } + + public function vucc_qso_details($gridsquare, $band) + { + $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) . "'"; + + $sql = "select * from " . $this->config->item('table_name') . + " where station_id in (" . $location_list . ")" . + " and (col_gridsquare like '" . $gridsquare . "%' + or col_vucc_grids like '%" . $gridsquare . "%')"; + + if ($band != 'All') { + if ($band == 'SAT') { + $sql .= " and col_prop_mode ='" . $band . "'"; + } else { + $sql .= " and col_prop_mode !='SAT'"; + $sql .= " and col_band ='" . $band . "'"; + } + } + + return $this->db->query($sql); + } + + public function activator_details($call, $band, $leogeo) + { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + $this->db->join('station_profile', 'station_profile.station_id = ' . $this->config->item('table_name') . '.station_id'); + $this->db->join('dxcc_entities', 'dxcc_entities.adif = ' . $this->config->item('table_name') . '.COL_DXCC', 'left outer'); + $this->db->join('lotw_users', 'lotw_users.callsign = ' . $this->config->item('table_name') . '.col_call', 'left outer'); + $this->db->where('COL_CALL', $call); + if ($band != 'All') { + if ($band == 'SAT') { + $this->db->where('col_prop_mode', $band); + switch ($leogeo) { + case 'leo': + $this->db->where('COL_SAT_NAME !=', 'QO-100'); + break; + case 'geo': + $this->db->where('COL_SAT_NAME', 'QO-100'); + break; + } + } else { + $this->db->where('COL_PROP_MODE !=', 'SAT'); + $this->db->where('col_band', $band); + } + } + + $this->db->where_in('station_profile.station_id', $logbooks_locations_array); + $this->db->order_by('COL_TIME_ON', 'DESC'); + + return $this->db->get($this->config->item('table_name')); + } + + public function get_callsigns($callsign) + { $this->db->select('COL_CALL'); $this->db->distinct(); $this->db->like('COL_CALL', $callsign); return $this->db->get($this->config->item('table_name')); - } - public function get_dok($callsign){ + public function get_dok($callsign) + { $this->db->select('COL_DARC_DOK'); $this->db->where('COL_CALL', $callsign); $this->db->order_by("COL_TIME_ON", "desc"); $this->db->limit(1); return $this->db->get($this->config->item('table_name')); - } - function add_qso($data, $skipexport = false) { + function add_qso($data, $skipexport = false) + { - if ($data['COL_DXCC'] == "Not Found"){ + if ($data['COL_DXCC'] == "Not Found") { $data['COL_DXCC'] = NULL; } @@ -581,327 +594,334 @@ class Logbook_model extends CI_Model { $last_id = $this->db->insert_id(); if ($this->session->userdata('user_amsat_status_upload') && $data['COL_PROP_MODE'] == "SAT") { - $this->upload_amsat_status($data); + $this->upload_amsat_status($data); } // No point in fetching hrdlog code or qrz api key and qrzrealtime setting if we're skipping the export - if (!$skipexport) { + if (!$skipexport) { - $result = $this->exists_clublog_credentials($data['station_id']); - if (isset($result->ucp) && isset($result->ucn) && (($result->ucp ?? '') != '') && (($result->ucn ?? '') != '') && ($result->clublogrealtime == 1)) { - $CI =& get_instance(); - $CI->load->library('AdifHelper'); - $qso = $this->get_qso($last_id,true)->result(); + $result = $this->exists_clublog_credentials($data['station_id']); + if (isset($result->ucp) && isset($result->ucn) && (($result->ucp ?? '') != '') && (($result->ucn ?? '') != '') && ($result->clublogrealtime == 1)) { + $CI = &get_instance(); + $CI->load->library('AdifHelper'); + $qso = $this->get_qso($last_id, true)->result(); - $adif = $CI->adifhelper->getAdifLine($qso[0]); - $result = $this->push_qso_to_clublog($result->ucn, $result->ucp, $data['COL_STATION_CALLSIGN'], $adif); - if ( ($result['status'] == 'OK') || ( ($result['status'] == 'error') || ($result['status'] == 'duplicate') || ($result['status'] == 'auth_error') )){ - $this->mark_clublog_qsos_sent($last_id); - } - } + $adif = $CI->adifhelper->getAdifLine($qso[0]); + $result = $this->push_qso_to_clublog($result->ucn, $result->ucp, $data['COL_STATION_CALLSIGN'], $adif); + if (($result['status'] == 'OK') || (($result['status'] == 'error') || ($result['status'] == 'duplicate') || ($result['status'] == 'auth_error'))) { + $this->mark_clublog_qsos_sent($last_id); + } + } - $result = ''; - $result = $this->exists_hrdlog_credentials($data['station_id']); - // Push qso to hrdlog if code is set, and realtime upload is enabled, and we're not importing an adif-file - if (isset($result->hrdlog_code) && isset($result->hrdlog_username) && $result->hrdlogrealtime == 1) { - $CI =& get_instance(); - $CI->load->library('AdifHelper'); - $qso = $this->get_qso($last_id,true)->result(); + $result = ''; + $result = $this->exists_hrdlog_credentials($data['station_id']); + // Push qso to hrdlog if code is set, and realtime upload is enabled, and we're not importing an adif-file + if (isset($result->hrdlog_code) && isset($result->hrdlog_username) && $result->hrdlogrealtime == 1) { + $CI = &get_instance(); + $CI->load->library('AdifHelper'); + $qso = $this->get_qso($last_id, true)->result(); - $adif = $CI->adifhelper->getAdifLine($qso[0]); - $result = $this->push_qso_to_hrdlog($result->hrdlog_username, $result->hrdlog_code, $adif); - if ( ($result['status'] == 'OK') || ( ($result['status'] == 'error') || ($result['status'] == 'duplicate') || ($result['status'] == 'auth_error') )){ - $this->mark_hrdlog_qsos_sent($last_id); - } - } - $result = ''; // Empty result from previous hrdlog-attempt for safety - $result = $this->exists_qrz_api_key($data['station_id']); -// Push qso to qrz if apikey is set, and realtime upload is enabled, and we're not importing an adif-file - if (isset($result->qrzapikey) && $result->qrzrealtime == 1) { - $CI =& get_instance(); - $CI->load->library('AdifHelper'); - $qso = $this->get_qso($last_id,true)->result(); + $adif = $CI->adifhelper->getAdifLine($qso[0]); + $result = $this->push_qso_to_hrdlog($result->hrdlog_username, $result->hrdlog_code, $adif); + if (($result['status'] == 'OK') || (($result['status'] == 'error') || ($result['status'] == 'duplicate') || ($result['status'] == 'auth_error'))) { + $this->mark_hrdlog_qsos_sent($last_id); + } + } + $result = ''; // Empty result from previous hrdlog-attempt for safety + $result = $this->exists_qrz_api_key($data['station_id']); + // Push qso to qrz if apikey is set, and realtime upload is enabled, and we're not importing an adif-file + if (isset($result->qrzapikey) && $result->qrzrealtime == 1) { + $CI = &get_instance(); + $CI->load->library('AdifHelper'); + $qso = $this->get_qso($last_id, true)->result(); - $adif = $CI->adifhelper->getAdifLine($qso[0]); - $result = $this->push_qso_to_qrz($result->qrzapikey, $adif); - if ( ($result['status'] == 'OK') || ( ($result['status'] == 'error') && ($result['message'] == 'STATUS=FAIL&REASON=Unable to add QSO to database: duplicate&EXTENDED=')) ){ - $this->mark_qrz_qsos_sent($last_id); - } - } + $adif = $CI->adifhelper->getAdifLine($qso[0]); + $result = $this->push_qso_to_qrz($result->qrzapikey, $adif); + if (($result['status'] == 'OK') || (($result['status'] == 'error') && ($result['message'] == 'STATUS=FAIL&REASON=Unable to add QSO to database: duplicate&EXTENDED='))) { + $this->mark_qrz_qsos_sent($last_id); + } + } - $result = $this->exists_webadif_api_key($data['station_id']); - // Push qso to webadif if apikey is set, and realtime upload is enabled, and we're not importing an adif-file - if (isset($result->webadifapikey) && $result->webadifrealtime == 1) { - $CI =& get_instance(); - $CI->load->library('AdifHelper'); - $qso = $this->get_qso($last_id,true)->result(); + $result = $this->exists_webadif_api_key($data['station_id']); + // Push qso to webadif if apikey is set, and realtime upload is enabled, and we're not importing an adif-file + if (isset($result->webadifapikey) && $result->webadifrealtime == 1) { + $CI = &get_instance(); + $CI->load->library('AdifHelper'); + $qso = $this->get_qso($last_id, true)->result(); - $adif = $CI->adifhelper->getAdifLine($qso[0]); - $result = $this->push_qso_to_webadif( - $result->webadifapiurl, - $result->webadifapikey, - $adif - ); + $adif = $CI->adifhelper->getAdifLine($qso[0]); + $result = $this->push_qso_to_webadif( + $result->webadifapiurl, + $result->webadifapikey, + $adif + ); - if ($result) { - $this->mark_webadif_qsos_sent([$last_id]); - } - } - } + if ($result) { + $this->mark_webadif_qsos_sent([$last_id]); + } + } + } } /* * Function checks if a HRDLog Code and Username exists in the table with the given station id */ - function exists_hrdlog_credentials($station_id) { - $sql = 'select hrdlog_username, hrdlog_code, hrdlogrealtime from station_profile + function exists_hrdlog_credentials($station_id) + { + $sql = 'select hrdlog_username, hrdlog_code, hrdlogrealtime from station_profile where station_id = ?'; - $query = $this->db->query($sql,$station_id); + $query = $this->db->query($sql, $station_id); - $result = $query->row(); + $result = $query->row(); - if ($result) { - return $result; - } else { - return false; - } + if ($result) { + return $result; + } else { + return false; + } } /* * Function checks if a Clublog Credebtials exists in the table with the given station id */ - function exists_clublog_credentials($station_id) { - $sql = 'select auth.user_clublog_name ucn, auth.user_clublog_password ucp, prof.clublogrealtime from '.$this->config->item('auth_table').' auth inner join station_profile prof on (auth.user_id=prof.user_id) where prof.station_id = ? and prof.clublogrealtime=1'; + function exists_clublog_credentials($station_id) + { + $sql = 'select auth.user_clublog_name ucn, auth.user_clublog_password ucp, prof.clublogrealtime from ' . $this->config->item('auth_table') . ' auth inner join station_profile prof on (auth.user_id=prof.user_id) where prof.station_id = ? and prof.clublogrealtime=1'; - $query = $this->db->query($sql, $station_id); + $query = $this->db->query($sql, $station_id); - $result = $query->row(); + $result = $query->row(); - if ($result) { - return $result; - } else { - return false; - } + if ($result) { + return $result; + } else { + return false; + } } /* * Function checks if a QRZ API Key exists in the table with the given station id */ - function exists_qrz_api_key($station_id) { - $sql = 'select qrzapikey, qrzrealtime from station_profile + function exists_qrz_api_key($station_id) + { + $sql = 'select qrzapikey, qrzrealtime from station_profile where station_id = ?'; - $query = $this->db->query($sql, $station_id); + $query = $this->db->query($sql, $station_id); - $result = $query->row(); + $result = $query->row(); - if ($result) { - return $result; - } - else { - return false; - } + if ($result) { + return $result; + } else { + return false; + } } - /* + /* * Function checks if a WebADIF API Key exists in the table with the given station id */ - function exists_webadif_api_key($station_id) { - $sql = 'select webadifapikey, webadifapiurl, webadifrealtime from station_profile + function exists_webadif_api_key($station_id) + { + $sql = 'select webadifapikey, webadifapiurl, webadifrealtime from station_profile where station_id = ?'; - $query = $this->db->query($sql, $station_id); + $query = $this->db->query($sql, $station_id); - $result = $query->row(); + $result = $query->row(); - if ($result) { - return $result; - } - else { - return false; - } + if ($result) { + return $result; + } else { + return false; + } } - function push_qso_to_clublog($cl_username, $cl_password, $station_callsign, $adif) { + function push_qso_to_clublog($cl_username, $cl_password, $station_callsign, $adif) + { - // initialise the curl request - $returner=[]; - $request = curl_init('https://clublog.org/realtime.php'); + // initialise the curl request + $returner = []; + $request = curl_init('https://clublog.org/realtime.php'); - curl_setopt($request, CURLOPT_POST, true); - curl_setopt( - $request, - CURLOPT_POSTFIELDS, - array( - 'email' => $cl_username, - 'password' => $cl_password, - 'callsign' => $station_callsign, - 'adif' => $adif, - 'api' => "a11c3235cd74b88212ce726857056939d52372bd", - )); + curl_setopt($request, CURLOPT_POST, true); + curl_setopt( + $request, + CURLOPT_POSTFIELDS, + array( + 'email' => $cl_username, + 'password' => $cl_password, + 'callsign' => $station_callsign, + 'adif' => $adif, + 'api' => "a11c3235cd74b88212ce726857056939d52372bd", + ) + ); - // output the response - curl_setopt($request, CURLOPT_RETURNTRANSFER, true); - $response = curl_exec($request); - $info = curl_getinfo($request); + // output the response + curl_setopt($request, CURLOPT_RETURNTRANSFER, true); + $response = curl_exec($request); + $info = curl_getinfo($request); - // If Clublog Accepts mark the QSOs - if (preg_match('/\bOK\b/', $response)) { - $returner['status']='OK'; - } else { - $returner['status']=$response; - } - curl_close ($request); - return ($returner); + // If Clublog Accepts mark the QSOs + if (preg_match('/\bOK\b/', $response)) { + $returner['status'] = 'OK'; + } else { + $returner['status'] = $response; + } + curl_close($request); + return ($returner); } /* * Function uploads a QSO to HRDLog with the API given. * $adif contains a line with the QSO in the ADIF format. QSO ends with an */ - function push_qso_to_hrdlog($hrdlog_username, $apikey, $adif, $replaceoption = false) { - $url = 'https://robot.hrdlog.net/newentry.aspx'; + function push_qso_to_hrdlog($hrdlog_username, $apikey, $adif, $replaceoption = false) + { + $url = 'https://robot.hrdlog.net/newentry.aspx'; - $post_data['Code'] = $apikey; - if ($replaceoption) { - $post_data['Cmd'] = 'UPDATE'; - $post_data['ADIFKey'] = $adif; - } - $post_data['ADIFData'] = $adif; + $post_data['Code'] = $apikey; + if ($replaceoption) { + $post_data['Cmd'] = 'UPDATE'; + $post_data['ADIFKey'] = $adif; + } + $post_data['ADIFData'] = $adif; - $post_data['Callsign'] = $hrdlog_username; + $post_data['Callsign'] = $hrdlog_username; - $post_encoded=http_build_query($post_data); + $post_encoded = http_build_query($post_data); - $ch = curl_init( $url ); - curl_setopt( $ch, CURLOPT_POST, true); - curl_setopt( $ch, CURLOPT_POSTFIELDS, $post_encoded); - curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1); - curl_setopt( $ch, CURLOPT_HEADER, 0); - curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded')); - $content = curl_exec($ch); - if ($content){ - if (stristr($content,'1')) { - $result['status'] = 'OK'; - return $result; - } elseif (stristr($content,'0')) { - $result['status'] = 'duplicate'; - $result['message'] = $content; - return $result; - } elseif (stristr($content,'Unknown user')) { - $result['status'] = 'auth_error'; - $result['message'] = $content; - return $result; - } elseif (stristr($content,'Invalid token')) { - $result['status'] = 'auth_error'; - $result['message'] = $content; - return $result; - } else { - $result['status'] = 'error'; - $result['message'] = $content; - return $result; - } - } - if(curl_errno($ch)){ - $result['status'] = 'error'; - $result['message'] = 'Curl error: '. curl_errno($ch); - return $result; - } - curl_close($ch); + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $post_encoded); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded')); + $content = curl_exec($ch); + if ($content) { + if (stristr($content, '1')) { + $result['status'] = 'OK'; + return $result; + } elseif (stristr($content, '0')) { + $result['status'] = 'duplicate'; + $result['message'] = $content; + return $result; + } elseif (stristr($content, 'Unknown user')) { + $result['status'] = 'auth_error'; + $result['message'] = $content; + return $result; + } elseif (stristr($content, 'Invalid token')) { + $result['status'] = 'auth_error'; + $result['message'] = $content; + return $result; + } else { + $result['status'] = 'error'; + $result['message'] = $content; + return $result; + } + } + if (curl_errno($ch)) { + $result['status'] = 'error'; + $result['message'] = 'Curl error: ' . curl_errno($ch); + return $result; + } + curl_close($ch); } /* * Function uploads a QSO to QRZ with the API given. * $adif contains a line with the QSO in the ADIF format. QSO ends with an */ - function push_qso_to_qrz($apikey, $adif, $replaceoption = false) { - $url = 'http://logbook.qrz.com/api'; // TODO: Move this to database + function push_qso_to_qrz($apikey, $adif, $replaceoption = false) + { + $url = 'http://logbook.qrz.com/api'; // TODO: Move this to database - $post_data['KEY'] = $apikey; - $post_data['ACTION'] = 'INSERT'; - $post_data['ADIF'] = $adif; + $post_data['KEY'] = $apikey; + $post_data['ACTION'] = 'INSERT'; + $post_data['ADIF'] = $adif; - if ($replaceoption) { - $post_data['OPTION'] = 'REPLACE'; + if ($replaceoption) { + $post_data['OPTION'] = 'REPLACE'; + } + + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + + $content = curl_exec($ch); + if ($content) { + if (stristr($content, 'RESULT=OK') || stristr($content, 'RESULT=REPLACE')) { + $result['status'] = 'OK'; + return $result; + } else { + $result['status'] = 'error'; + $result['message'] = $content; + return $result; } - - $ch = curl_init( $url ); - curl_setopt( $ch, CURLOPT_POST, true); - curl_setopt( $ch, CURLOPT_POSTFIELDS, $post_data); - curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1); - curl_setopt( $ch, CURLOPT_HEADER, 0); - curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true); - - $content = curl_exec($ch); - if ($content){ - if (stristr($content,'RESULT=OK') || stristr($content,'RESULT=REPLACE')) { - $result['status'] = 'OK'; - return $result; - } - else { - $result['status'] = 'error'; - $result['message'] = $content; - return $result; - } - } - if(curl_errno($ch)){ - $result['status'] = 'error'; - $result['message'] = 'Curl error: '. curl_errno($ch); - return $result; - } - curl_close($ch); + } + if (curl_errno($ch)) { + $result['status'] = 'error'; + $result['message'] = 'Curl error: ' . curl_errno($ch); + return $result; + } + curl_close($ch); } - /* + /* * Function uploads a QSO to WebADIF consumer with the API given. * $adif contains a line with the QSO in the ADIF format. */ - function push_qso_to_webadif($url, $apikey, $adif) : bool{ + function push_qso_to_webadif($url, $apikey, $adif): bool + { - $headers = array( - 'Content-Type: text/plain', - 'X-API-Key: ' . $apikey - ); + $headers = array( + 'Content-Type: text/plain', + 'X-API-Key: ' . $apikey + ); - if (substr($url, -1) !== "/") { - $url .= "/"; - } + if (substr($url, -1) !== "/") { + $url .= "/"; + } - $ch = curl_init( $url . "qso"); - curl_setopt( $ch, CURLOPT_POST, true); - curl_setopt( $ch, CURLOPT_POSTFIELDS, (string)$adif); - curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1); - curl_setopt( $ch, CURLOPT_HEADER, 0); - curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers); - curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true); + $ch = curl_init($url . "qso"); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, (string)$adif); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - $content = curl_exec($ch); // TODO: better error handling - $errors = curl_error($ch); - $response = curl_getinfo($ch, CURLINFO_HTTP_CODE); - curl_close($ch); - return $response === 200; - } + $content = curl_exec($ch); // TODO: better error handling + $errors = curl_error($ch); + $response = curl_getinfo($ch, CURLINFO_HTTP_CODE); + curl_close($ch); + return $response === 200; + } /* * Function marks QSOs as uploaded to Clublog * $primarykey is the unique id for that QSO in the logbook */ - function mark_clublog_qsos_sent($primarykey) { - $data = array( - 'COL_CLUBLOG_QSO_UPLOAD_DATE' => date("Y-m-d H:i:s", strtotime("now")), - 'COL_CLUBLOG_QSO_UPLOAD_STATUS' => 'Y', - ); + function mark_clublog_qsos_sent($primarykey) + { + $data = array( + 'COL_CLUBLOG_QSO_UPLOAD_DATE' => date("Y-m-d H:i:s", strtotime("now")), + 'COL_CLUBLOG_QSO_UPLOAD_STATUS' => 'Y', + ); - $this->db->where('COL_PRIMARY_KEY', $primarykey); + $this->db->where('COL_PRIMARY_KEY', $primarykey); - $this->db->update($this->config->item('table_name'), $data); + $this->db->update($this->config->item('table_name'), $data); - return true; + return true; } @@ -909,343 +929,347 @@ class Logbook_model extends CI_Model { * Function marks QSOs as uploaded to HRDLog. * $primarykey is the unique id for that QSO in the logbook */ - function mark_hrdlog_qsos_sent($primarykey) { - $data = array( - 'COL_HRDLOG_QSO_UPLOAD_DATE' => date("Y-m-d H:i:s", strtotime("now")), - 'COL_HRDLOG_QSO_UPLOAD_STATUS' => 'Y', - ); + function mark_hrdlog_qsos_sent($primarykey) + { + $data = array( + 'COL_HRDLOG_QSO_UPLOAD_DATE' => date("Y-m-d H:i:s", strtotime("now")), + 'COL_HRDLOG_QSO_UPLOAD_STATUS' => 'Y', + ); - $this->db->where('COL_PRIMARY_KEY', $primarykey); + $this->db->where('COL_PRIMARY_KEY', $primarykey); - $this->db->update($this->config->item('table_name'), $data); + $this->db->update($this->config->item('table_name'), $data); - return true; + return true; } /* * Function marks QSOs as uploaded to QRZ. * $primarykey is the unique id for that QSO in the logbook */ - function mark_qrz_qsos_sent($primarykey) { - $data = array( - 'COL_QRZCOM_QSO_UPLOAD_DATE' => date("Y-m-d H:i:s", strtotime("now")), - 'COL_QRZCOM_QSO_UPLOAD_STATUS' => 'Y', - ); + function mark_qrz_qsos_sent($primarykey) + { + $data = array( + 'COL_QRZCOM_QSO_UPLOAD_DATE' => date("Y-m-d H:i:s", strtotime("now")), + 'COL_QRZCOM_QSO_UPLOAD_STATUS' => 'Y', + ); - $this->db->where('COL_PRIMARY_KEY', $primarykey); + $this->db->where('COL_PRIMARY_KEY', $primarykey); - $this->db->update($this->config->item('table_name'), $data); + $this->db->update($this->config->item('table_name'), $data); - return true; - } + return true; + } - /* + /* * Function marks QSOs as uploaded to WebADIF. * $qsoIDs is an arroy of unique id for the QSOs in the logbook */ - function mark_webadif_qsos_sent(array $qsoIDs) - { - $data = []; - $now = date("Y-m-d H:i:s", strtotime("now")); - foreach ($qsoIDs as $qsoID) { - $data[] = [ - 'upload_date' => $now, - 'qso_id' => $qsoID, - ]; - } - $this->db->insert_batch('webadif', $data); - return true; - } + function mark_webadif_qsos_sent(array $qsoIDs) + { + $data = []; + $now = date("Y-m-d H:i:s", strtotime("now")); + foreach ($qsoIDs as $qsoID) { + $data[] = [ + 'upload_date' => $now, + 'qso_id' => $qsoID, + ]; + } + $this->db->insert_batch('webadif', $data); + return true; + } - function upload_amsat_status($data) { - $sat_name = ''; - if ($data['COL_SAT_NAME'] == 'AO-7') { - if ($data['COL_BAND'] == '2m' && $data['COL_BAND_RX'] == '10m') { - $sat_name = 'AO-7[A]'; - } - if ($data['COL_BAND'] == '70cm' && $data['COL_BAND_RX'] == '2m') { - $sat_name = 'AO-7[B]'; - } - } else if ($data['COL_SAT_NAME'] == 'QO-100') { - $sat_name = 'QO-100_NB'; - } else if ($data['COL_SAT_NAME'] == 'AO-92') { - if ($data['COL_BAND'] == '70cm' && $data['COL_BAND_RX'] == '2m') { - $sat_name = 'AO-92_U/v'; - } - if ($data['COL_BAND'] == '23cm' && $data['COL_BAND_RX'] == '2m') { - $sat_name = 'AO-92_L/v'; - } - } else if ($data['COL_SAT_NAME'] == 'AO-95') { - if ($data['COL_BAND'] == '70cm' && $data['COL_BAND_RX'] == '2m') { - $sat_name = 'AO-95_U/v'; - } - if ($data['COL_BAND'] == '23cm' && $data['COL_BAND_RX'] == '2m') { - $sat_name = 'AO-95_L/v'; - } - } else if ($data['COL_SAT_NAME'] == 'PO-101') { - if ($data['COL_MODE'] == 'PKT') { - $sat_name = 'PO-101[APRS]'; - } else { - $sat_name = 'PO-101[FM]'; - } - } else if ($data['COL_SAT_NAME'] == 'FO-118') { - if ($data['COL_BAND'] == '2m') { - if ($data['COL_MODE'] == 'FM') { - $sat_name = 'FO-118[V/u FM]'; - } else if ($data['COL_MODE'] == 'SSB') { - $sat_name = 'FO-118[V/u]'; - } - } else if ($data['COL_BAND'] == '15m') { - $sat_name = 'FO-118[H/u]'; - } - } else if ($data['COL_SAT_NAME'] == 'ARISS' || $data['COL_SAT_NAME'] == 'ISS') { - if ($data['COL_MODE'] == 'FM') { - $sat_name = 'ISS-FM'; - } else if ($data['COL_MODE'] == 'PKT') { - $sat_name = 'ISS-DATA'; - } - } else if ($data['COL_SAT_NAME'] == 'CAS-3H') { - $sat_name = 'LilacSat-2'; - } else { - $sat_name = $data['COL_SAT_NAME']; + function upload_amsat_status($data) + { + $sat_name = ''; + if ($data['COL_SAT_NAME'] == 'AO-7') { + if ($data['COL_BAND'] == '2m' && $data['COL_BAND_RX'] == '10m') { + $sat_name = 'AO-7[A]'; } - $datearray = date_parse_from_format("Y-m-d H:i:s", $data['COL_TIME_ON']); - $url='https://amsat.org/status/submit.php?SatSubmit=yes&Confirm=yes&SatName='.$sat_name.'&SatYear='.$datearray['year'].'&SatMonth='.str_pad($datearray['month'], 2, '0', STR_PAD_LEFT).'&SatDay='.str_pad($datearray['day'], 2, '0', STR_PAD_LEFT).'&SatHour='.str_pad($datearray['hour'], 2, '0', STR_PAD_LEFT).'&SatPeriod='.(intdiv(($datearray['minute']-1), 15)).'&SatCall='.$data['COL_STATION_CALLSIGN'].'&SatReport=Heard&SatGridSquare='.$data['COL_MY_GRIDSQUARE']; - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_exec($ch); + if ($data['COL_BAND'] == '70cm' && $data['COL_BAND_RX'] == '2m') { + $sat_name = 'AO-7[B]'; + } + } else if ($data['COL_SAT_NAME'] == 'QO-100') { + $sat_name = 'QO-100_NB'; + } else if ($data['COL_SAT_NAME'] == 'AO-92') { + if ($data['COL_BAND'] == '70cm' && $data['COL_BAND_RX'] == '2m') { + $sat_name = 'AO-92_U/v'; + } + if ($data['COL_BAND'] == '23cm' && $data['COL_BAND_RX'] == '2m') { + $sat_name = 'AO-92_L/v'; + } + } else if ($data['COL_SAT_NAME'] == 'AO-95') { + if ($data['COL_BAND'] == '70cm' && $data['COL_BAND_RX'] == '2m') { + $sat_name = 'AO-95_U/v'; + } + if ($data['COL_BAND'] == '23cm' && $data['COL_BAND_RX'] == '2m') { + $sat_name = 'AO-95_L/v'; + } + } else if ($data['COL_SAT_NAME'] == 'PO-101') { + if ($data['COL_MODE'] == 'PKT') { + $sat_name = 'PO-101[APRS]'; + } else { + $sat_name = 'PO-101[FM]'; + } + } else if ($data['COL_SAT_NAME'] == 'FO-118') { + if ($data['COL_BAND'] == '2m') { + if ($data['COL_MODE'] == 'FM') { + $sat_name = 'FO-118[V/u FM]'; + } else if ($data['COL_MODE'] == 'SSB') { + $sat_name = 'FO-118[V/u]'; + } + } else if ($data['COL_BAND'] == '15m') { + $sat_name = 'FO-118[H/u]'; + } + } else if ($data['COL_SAT_NAME'] == 'ARISS' || $data['COL_SAT_NAME'] == 'ISS') { + if ($data['COL_MODE'] == 'FM') { + $sat_name = 'ISS-FM'; + } else if ($data['COL_MODE'] == 'PKT') { + $sat_name = 'ISS-DATA'; + } + } else if ($data['COL_SAT_NAME'] == 'CAS-3H') { + $sat_name = 'LilacSat-2'; + } else { + $sat_name = $data['COL_SAT_NAME']; + } + $datearray = date_parse_from_format("Y-m-d H:i:s", $data['COL_TIME_ON']); + $url = 'https://amsat.org/status/submit.php?SatSubmit=yes&Confirm=yes&SatName=' . $sat_name . '&SatYear=' . $datearray['year'] . '&SatMonth=' . str_pad($datearray['month'], 2, '0', STR_PAD_LEFT) . '&SatDay=' . str_pad($datearray['day'], 2, '0', STR_PAD_LEFT) . '&SatHour=' . str_pad($datearray['hour'], 2, '0', STR_PAD_LEFT) . '&SatPeriod=' . (intdiv(($datearray['minute'] - 1), 15)) . '&SatCall=' . $data['COL_STATION_CALLSIGN'] . '&SatReport=Heard&SatGridSquare=' . $data['COL_MY_GRIDSQUARE']; + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_exec($ch); } /* Edit QSO */ - function edit() { - $qso = $this->get_qso($this->input->post('id'))->row(); + function edit() + { + $qso = $this->get_qso($this->input->post('id'))->row(); - $entity = $this->get_entity($this->input->post('dxcc_id')); - $stationId = $this->input->post('station_profile'); - $country = ucwords(strtolower($entity['name']), "- (/"); + $entity = $this->get_entity($this->input->post('dxcc_id')); + $stationId = $this->input->post('station_profile'); + $country = ucwords(strtolower($entity['name']), "- (/"); - // be sure that station belongs to user - $CI =& get_instance(); - $CI->load->model('stations'); - if (!$CI->stations->check_station_is_accessible($stationId)) { - return; - } + // be sure that station belongs to user + $CI = &get_instance(); + $CI->load->model('stations'); + if (!$CI->stations->check_station_is_accessible($stationId)) { + return; + } - if (trim($this->input->post('callsign')) == '') { - return; - } + if (trim($this->input->post('callsign')) == '') { + return; + } - $station_profile=$CI->stations->profile_clean($stationId); - $stationCallsign=$station_profile->station_callsign; + $station_profile = $CI->stations->profile_clean($stationId); + $stationCallsign = $station_profile->station_callsign; - $mode = $this->get_main_mode_if_submode($this->input->post('mode')); - if ($mode == null) { - $mode = $this->input->post('mode'); - $submode = null; - } else { - $submode = $this->input->post('mode'); - } + $mode = $this->get_main_mode_if_submode($this->input->post('mode')); + if ($mode == null) { + $mode = $this->input->post('mode'); + $submode = null; + } else { + $submode = $this->input->post('mode'); + } - if($this->input->post('transmit_power')) { - $txpower = $this->input->post('transmit_power'); - } else { - $txpower = null; - } + if ($this->input->post('transmit_power')) { + $txpower = $this->input->post('transmit_power'); + } else { + $txpower = null; + } - if($this->input->post('stx')) { - $stx_string = $this->input->post('stx'); - } else { - $stx_string = null; - } + if ($this->input->post('stx')) { + $stx_string = $this->input->post('stx'); + } else { + $stx_string = null; + } - if($this->input->post('srx')) { - $srx_string = $this->input->post('srx'); - } else { - $srx_string = null; - } + if ($this->input->post('srx')) { + $srx_string = $this->input->post('srx'); + } else { + $srx_string = null; + } - if ($this->input->post('usa_county') && $this->input->post('usa_state')) { - $uscounty = trim($this->input->post('usa_state') . "," . $this->input->post('usa_county')); - } else { - $uscounty = null; - } + if ($this->input->post('usa_county') && $this->input->post('usa_state')) { + $uscounty = trim($this->input->post('usa_state') . "," . $this->input->post('usa_county')); + } else { + $uscounty = null; + } - if ($this->input->post('qsl_sent')) { - $qsl_sent = $this->input->post('qsl_sent'); - } else { - $qsl_sent = 'N'; - } + if ($this->input->post('qsl_sent')) { + $qsl_sent = $this->input->post('qsl_sent'); + } else { + $qsl_sent = 'N'; + } - if ($this->input->post('qsl_rcvd')) { - $qsl_rcvd = $this->input->post('qsl_rcvd'); - } else { - $qsl_rcvd = 'N'; - } + if ($this->input->post('qsl_rcvd')) { + $qsl_rcvd = $this->input->post('qsl_rcvd'); + } else { + $qsl_rcvd = 'N'; + } - if ($this->input->post('eqsl_sent')) { - $eqsl_sent = $this->input->post('eqsl_sent'); - } else { - $eqsl_sent = 'N'; - } + if ($this->input->post('eqsl_sent')) { + $eqsl_sent = $this->input->post('eqsl_sent'); + } else { + $eqsl_sent = 'N'; + } - if ($this->input->post('eqsl_rcvd')) { - $eqsl_rcvd = $this->input->post('eqsl_rcvd'); - } else { - $eqsl_rcvd = 'N'; - } + if ($this->input->post('eqsl_rcvd')) { + $eqsl_rcvd = $this->input->post('eqsl_rcvd'); + } else { + $eqsl_rcvd = 'N'; + } - if ($this->input->post('lotw_sent')) { - $lotw_sent = $this->input->post('lotw_sent'); - } else { - $lotw_sent = 'N'; - } + if ($this->input->post('lotw_sent')) { + $lotw_sent = $this->input->post('lotw_sent'); + } else { + $lotw_sent = 'N'; + } - if ($this->input->post('lotw_rcvd')) { - $lotw_rcvd = $this->input->post('lotw_rcvd'); - } else { - $lotw_rcvd = 'N'; - } + if ($this->input->post('lotw_rcvd')) { + $lotw_rcvd = $this->input->post('lotw_rcvd'); + } else { + $lotw_rcvd = 'N'; + } - if ($qsl_sent == 'N') { - $qslsdate = null; - } elseif (!$qso->COL_QSLSDATE || $qso->COL_QSL_SENT != $qsl_sent) { - $qslsdate = date('Y-m-d H:i:s'); - } else { - $qslsdate = $qso->COL_QSLSDATE; - } + if ($qsl_sent == 'N') { + $qslsdate = null; + } elseif (!$qso->COL_QSLSDATE || $qso->COL_QSL_SENT != $qsl_sent) { + $qslsdate = date('Y-m-d H:i:s'); + } else { + $qslsdate = $qso->COL_QSLSDATE; + } - if ($qsl_rcvd == 'N') { - $qslrdate = null; - } elseif (!$qso->COL_QSLRDATE || $qso->COL_QSL_RCVD != $qsl_rcvd) { - $qslrdate = date('Y-m-d H:i:s'); - } else { - $qslrdate = $qso->COL_QSLRDATE; - } + if ($qsl_rcvd == 'N') { + $qslrdate = null; + } elseif (!$qso->COL_QSLRDATE || $qso->COL_QSL_RCVD != $qsl_rcvd) { + $qslrdate = date('Y-m-d H:i:s'); + } else { + $qslrdate = $qso->COL_QSLRDATE; + } - if ($eqsl_sent == 'N') { - $eqslsdate = null; - } elseif (!$qso->COL_EQSL_QSLSDATE || $qso->COL_EQSL_QSL_SENT != $eqsl_sent) { - $eqslsdate = date('Y-m-d H:i:s'); - } else { - $eqslsdate = $qso->COL_EQSL_QSLSDATE; - } + if ($eqsl_sent == 'N') { + $eqslsdate = null; + } elseif (!$qso->COL_EQSL_QSLSDATE || $qso->COL_EQSL_QSL_SENT != $eqsl_sent) { + $eqslsdate = date('Y-m-d H:i:s'); + } else { + $eqslsdate = $qso->COL_EQSL_QSLSDATE; + } - if ($eqsl_rcvd == 'N') { - $eqslrdate = null; - } elseif (!$qso->COL_EQSL_QSLRDATE || $qso->COL_EQSL_QSL_RCVD != $eqsl_rcvd) { - $eqslrdate = date('Y-m-d H:i:s'); - } else { - $eqslrdate = $qso->COL_EQSL_QSLRDATE; - } + if ($eqsl_rcvd == 'N') { + $eqslrdate = null; + } elseif (!$qso->COL_EQSL_QSLRDATE || $qso->COL_EQSL_QSL_RCVD != $eqsl_rcvd) { + $eqslrdate = date('Y-m-d H:i:s'); + } else { + $eqslrdate = $qso->COL_EQSL_QSLRDATE; + } - if ($lotw_sent == 'N') { - $lotwsdate = null; - } elseif (!$qso->COL_LOTW_QSLSDATE || $qso->COL_LOTW_QSL_SENT != $lotw_sent) { - $lotwsdate = date('Y-m-d H:i:s'); - } else { - $lotwsdate = $qso->COL_LOTW_QSLSDATE; - } + if ($lotw_sent == 'N') { + $lotwsdate = null; + } elseif (!$qso->COL_LOTW_QSLSDATE || $qso->COL_LOTW_QSL_SENT != $lotw_sent) { + $lotwsdate = date('Y-m-d H:i:s'); + } else { + $lotwsdate = $qso->COL_LOTW_QSLSDATE; + } - if ($lotw_rcvd == 'N') { - $lotwrdate = null; - } elseif (!$qso->COL_LOTW_QSLRDATE || $qso->COL_LOTW_QSL_RCVD != $lotw_rcvd) { - $lotwrdate = date('Y-m-d H:i:s'); - } else { - $lotwrdate = $qso->COL_LOTW_QSLRDATE; - } + if ($lotw_rcvd == 'N') { + $lotwrdate = null; + } elseif (!$qso->COL_LOTW_QSLRDATE || $qso->COL_LOTW_QSL_RCVD != $lotw_rcvd) { + $lotwrdate = date('Y-m-d H:i:s'); + } else { + $lotwrdate = $qso->COL_LOTW_QSLRDATE; + } - $data = array( - 'COL_TIME_ON' => $this->input->post('time_on'), - 'COL_TIME_OFF' => $this->input->post('time_off'), - 'COL_CALL' => strtoupper(trim($this->input->post('callsign'))), - 'COL_BAND' => $this->input->post('band'), - 'COL_BAND_RX' => $this->input->post('band_rx'), - 'COL_FREQ' => $this->parse_frequency($this->input->post('freq')), - 'COL_MODE' => $mode, - 'COL_SUBMODE' => $submode, - 'COL_RST_RCVD' => $this->input->post('rst_rcvd'), - 'COL_RST_SENT' => $this->input->post('rst_sent'), - 'COL_GRIDSQUARE' => strtoupper(trim($this->input->post('locator'))), - 'COL_VUCC_GRIDS' => strtoupper(preg_replace('/\s+/', '', $this->input->post('vucc_grids'))), - 'COL_DISTANCE' => $this->input->post('distance'), - 'COL_COMMENT' => $this->input->post('comment'), - 'COL_NAME' => $this->input->post('name'), - 'COL_COUNTRY' => $country, - 'COL_CONT' => $this->input->post('continent'), - 'COL_DXCC'=> $this->input->post('dxcc_id'), - 'COL_CQZ' => $this->input->post('cqz'), - 'COL_SAT_NAME' => $this->input->post('sat_name'), - 'COL_SAT_MODE' => $this->input->post('sat_mode'), - 'COL_NOTES' => $this->input->post('notes'), - 'COL_QSLSDATE' => $qslsdate, - 'COL_QSLRDATE' => $qslrdate, - 'COL_QSL_SENT' => $qsl_sent, - 'COL_QSL_RCVD' => $qsl_rcvd, - 'COL_QSL_SENT_VIA' => $this->input->post('qsl_sent_method'), - 'COL_QSL_RCVD_VIA' => $this->input->post('qsl_rcvd_method'), - 'COL_EQSL_QSLSDATE' => $eqslsdate, - 'COL_EQSL_QSLRDATE' => $eqslrdate, - 'COL_EQSL_QSL_SENT' => $this->input->post('eqsl_sent'), - 'COL_EQSL_QSL_RCVD' => $this->input->post('eqsl_rcvd'), - 'COL_QSLMSG' => $this->input->post('qslmsg'), - 'COL_LOTW_QSLSDATE' => $lotwsdate, - 'COL_LOTW_QSLRDATE' => $lotwrdate, - 'COL_LOTW_QSL_SENT' => $this->input->post('lotw_sent'), - 'COL_LOTW_QSL_RCVD' => $this->input->post('lotw_rcvd'), - 'COL_IOTA' => $this->input->post('iota_ref'), - 'COL_SOTA_REF' => $this->input->post('sota_ref'), - 'COL_WWFF_REF' => $this->input->post('wwff_ref'), - 'COL_POTA_REF' => $this->input->post('pota_ref'), - 'COL_TX_PWR' => $txpower, - 'COL_SIG' => $this->input->post('sig'), - 'COL_SIG_INFO' => $this->input->post('sig_info'), - 'COL_DARC_DOK' => strtoupper($this->input->post('darc_dok')), - 'COL_QTH' => $this->input->post('qth'), - 'COL_PROP_MODE' => $this->input->post('prop_mode'), - 'COL_FREQ_RX' => $this->parse_frequency($this->input->post('freq_display_rx')), - 'COL_STX_STRING' => strtoupper(trim($this->input->post('stx_string'))), - 'COL_SRX_STRING' => strtoupper(trim($this->input->post('srx_string'))), - 'COL_STX' => $stx_string, - 'COL_SRX' => $srx_string, - 'COL_CONTEST_ID' => $this->input->post('contest_name'), - 'COL_QSL_VIA' => $this->input->post('qsl_via_callsign'), - 'station_id' => $stationId, - 'COL_STATION_CALLSIGN' => $stationCallsign, - 'COL_OPERATOR' => $this->input->post('operator_callsign'), - 'COL_STATE' =>$this->input->post('usa_state'), - 'COL_CNTY' => $uscounty - ); + $data = array( + 'COL_TIME_ON' => $this->input->post('time_on'), + 'COL_TIME_OFF' => $this->input->post('time_off'), + 'COL_CALL' => strtoupper(trim($this->input->post('callsign'))), + 'COL_BAND' => $this->input->post('band'), + 'COL_BAND_RX' => $this->input->post('band_rx'), + 'COL_FREQ' => $this->parse_frequency($this->input->post('freq')), + 'COL_MODE' => $mode, + 'COL_SUBMODE' => $submode, + 'COL_RST_RCVD' => $this->input->post('rst_rcvd'), + 'COL_RST_SENT' => $this->input->post('rst_sent'), + 'COL_GRIDSQUARE' => strtoupper(trim($this->input->post('locator'))), + 'COL_VUCC_GRIDS' => strtoupper(preg_replace('/\s+/', '', $this->input->post('vucc_grids'))), + 'COL_DISTANCE' => $this->input->post('distance'), + 'COL_COMMENT' => $this->input->post('comment'), + 'COL_NAME' => $this->input->post('name'), + 'COL_COUNTRY' => $country, + 'COL_CONT' => $this->input->post('continent'), + 'COL_DXCC' => $this->input->post('dxcc_id'), + 'COL_CQZ' => $this->input->post('cqz'), + 'COL_SAT_NAME' => $this->input->post('sat_name'), + 'COL_SAT_MODE' => $this->input->post('sat_mode'), + 'COL_NOTES' => $this->input->post('notes'), + 'COL_QSLSDATE' => $qslsdate, + 'COL_QSLRDATE' => $qslrdate, + 'COL_QSL_SENT' => $qsl_sent, + 'COL_QSL_RCVD' => $qsl_rcvd, + 'COL_QSL_SENT_VIA' => $this->input->post('qsl_sent_method'), + 'COL_QSL_RCVD_VIA' => $this->input->post('qsl_rcvd_method'), + 'COL_EQSL_QSLSDATE' => $eqslsdate, + 'COL_EQSL_QSLRDATE' => $eqslrdate, + 'COL_EQSL_QSL_SENT' => $this->input->post('eqsl_sent'), + 'COL_EQSL_QSL_RCVD' => $this->input->post('eqsl_rcvd'), + 'COL_QSLMSG' => $this->input->post('qslmsg'), + 'COL_LOTW_QSLSDATE' => $lotwsdate, + 'COL_LOTW_QSLRDATE' => $lotwrdate, + 'COL_LOTW_QSL_SENT' => $this->input->post('lotw_sent'), + 'COL_LOTW_QSL_RCVD' => $this->input->post('lotw_rcvd'), + 'COL_IOTA' => $this->input->post('iota_ref'), + 'COL_SOTA_REF' => $this->input->post('sota_ref'), + 'COL_WWFF_REF' => $this->input->post('wwff_ref'), + 'COL_POTA_REF' => $this->input->post('pota_ref'), + 'COL_TX_PWR' => $txpower, + 'COL_SIG' => $this->input->post('sig'), + 'COL_SIG_INFO' => $this->input->post('sig_info'), + 'COL_DARC_DOK' => strtoupper($this->input->post('darc_dok')), + 'COL_QTH' => $this->input->post('qth'), + 'COL_PROP_MODE' => $this->input->post('prop_mode'), + 'COL_FREQ_RX' => $this->parse_frequency($this->input->post('freq_display_rx')), + 'COL_STX_STRING' => strtoupper(trim($this->input->post('stx_string'))), + 'COL_SRX_STRING' => strtoupper(trim($this->input->post('srx_string'))), + 'COL_STX' => $stx_string, + 'COL_SRX' => $srx_string, + 'COL_CONTEST_ID' => $this->input->post('contest_name'), + 'COL_QSL_VIA' => $this->input->post('qsl_via_callsign'), + 'station_id' => $stationId, + 'COL_STATION_CALLSIGN' => $stationCallsign, + 'COL_OPERATOR' => $this->input->post('operator_callsign'), + 'COL_STATE' => $this->input->post('usa_state'), + 'COL_CNTY' => $uscounty + ); - if ($this->exists_hrdlog_credentials($data['station_id'])) { - $data['COL_HRDLOG_QSO_UPLOAD_STATUS'] = 'M'; - } + if ($this->exists_hrdlog_credentials($data['station_id'])) { + $data['COL_HRDLOG_QSO_UPLOAD_STATUS'] = 'M'; + } - if ($this->exists_qrz_api_key($data['station_id'])) { - $data['COL_QRZCOM_QSO_UPLOAD_STATUS'] = 'M'; - } - - $this->db->where('COL_PRIMARY_KEY', $this->input->post('id')); - $this->db->update($this->config->item('table_name'), $data); + if ($this->exists_qrz_api_key($data['station_id'])) { + $data['COL_QRZCOM_QSO_UPLOAD_STATUS'] = 'M'; + } + $this->db->where('COL_PRIMARY_KEY', $this->input->post('id')); + $this->db->update($this->config->item('table_name'), $data); } /* QSL received */ - function qsl_rcvd() { + function qsl_rcvd() + { $data = array( - 'COL_QSLRDATE' => date('Y-m-d H:i:s'), - 'COL_QSL_RCVD' => "Y" + 'COL_QSLRDATE' => date('Y-m-d H:i:s'), + 'COL_QSL_RCVD' => "Y" ); $this->db->where('COL_PRIMARY_KEY', $this->input->post('id')); $this->db->update($this->config->item('table_name'), $data); - } /* Return last 10 QSOs */ - function last_ten() { - $CI =& get_instance(); + function last_ten() + { + $CI = &get_instance(); $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -1258,14 +1282,15 @@ class Logbook_model extends CI_Model { } /* Show custom number of qsos */ - function last_custom($num) { - $CI =& get_instance(); + function last_custom($num) + { + $CI = &get_instance(); $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - if(!empty($logbooks_locations_array)) { + if (!empty($logbooks_locations_array)) { $this->db->select('COL_CALL, COL_BAND, COL_FREQ, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_SUBMODE, COL_NAME, COL_COUNTRY, COL_DXCC, COL_PRIMARY_KEY, COL_SAT_NAME, COL_SRX, COL_SRX_STRING, COL_STX, COL_STX_STRING, COL_VUCC_GRIDS, COL_GRIDSQUARE, COL_MY_GRIDSQUARE, COL_OPERATOR, COL_IOTA, COL_WWFF_REF, COL_POTA_REF, COL_STATE, COL_CNTY, COL_DISTANCE, COL_SOTA_REF, COL_CONTEST_ID, dxcc_entities.end AS end'); - $this->db->join('dxcc_entities', $this->config->item('table_name').'.col_dxcc = dxcc_entities.adif', 'left outer'); + $this->db->join('dxcc_entities', $this->config->item('table_name') . '.col_dxcc = dxcc_entities.adif', 'left outer'); $this->db->where_in('station_id', $logbooks_locations_array); $this->db->order_by("COL_TIME_ON", "desc"); $this->db->limit($num); @@ -1283,7 +1308,8 @@ class Logbook_model extends CI_Model { * Usage: Callsign lookup data for the QSO panel and API/callsign_lookup * */ - function call_lookup_result($callsign) { + function call_lookup_result($callsign) + { $this->db->select('COL_CALL, COL_NAME, COL_QSL_VIA, COL_GRIDSQUARE, COL_QTH, COL_IOTA, COL_TIME_ON, COL_STATE, COL_CNTY'); $this->db->where('COL_CALL', $callsign); $where = "COL_NAME != \"\""; @@ -1294,8 +1320,7 @@ class Logbook_model extends CI_Model { $this->db->limit(1); $query = $this->db->get($this->config->item('table_name')); $name = ""; - if ($query->num_rows() > 0) - { + if ($query->num_rows() > 0) { $data = $query->row(); } @@ -1303,277 +1328,283 @@ class Logbook_model extends CI_Model { } /* Callsign QRA */ - function call_qra($callsign) { - $this->db->select('COL_CALL, COL_GRIDSQUARE, COL_TIME_ON'); - $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); - $this->db->where('COL_CALL', $callsign); - $this->db->where('station_profile.user_id', $this->session->userdata('user_id')); - $where = "COL_GRIDSQUARE != \"\""; + function call_qra($callsign) + { + $this->db->select('COL_CALL, COL_GRIDSQUARE, COL_TIME_ON'); + $this->db->join('station_profile', 'station_profile.station_id = ' . $this->config->item('table_name') . '.station_id'); + $this->db->where('COL_CALL', $callsign); + $this->db->where('station_profile.user_id', $this->session->userdata('user_id')); + $where = "COL_GRIDSQUARE != \"\""; - $this->db->where($where); + $this->db->where($where); - $this->db->order_by("COL_TIME_ON", "desc"); - $this->db->limit(1); - $query = $this->db->get($this->config->item('table_name')); - $callsign = ""; - if ($query->num_rows() > 0) - { - $data = $query->row(); - $callsign = strtoupper($data->COL_GRIDSQUARE); - } - - return $callsign; - } - - function call_name($callsign) { - $this->db->select('COL_CALL, COL_NAME, COL_TIME_ON'); - $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); - $this->db->where('COL_CALL', $callsign); - $this->db->where('station_profile.user_id', $this->session->userdata('user_id')); - $where = "COL_NAME != \"\""; - - $this->db->where($where); - - $this->db->order_by("COL_TIME_ON", "desc"); - $this->db->limit(1); - $query = $this->db->get($this->config->item('table_name')); - $name = ""; - if ($query->num_rows() > 0) - { - $data = $query->row(); - $name = $data->COL_NAME; - } - - return $name; - } - - function times_worked($callsign) { - $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - $this->db->select('count(1) as TWKED'); - $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); - $this->db->group_start(); - $this->db->where($this->config->item('table_name').'.COL_CALL', $callsign); - $this->db->or_like($this->config->item('table_name').'.COL_CALL', '/'.$callsign,'before'); - $this->db->or_like($this->config->item('table_name').'.COL_CALL', $callsign.'/','after'); - $this->db->or_like($this->config->item('table_name').'.COL_CALL', '/'.$callsign.'/'); - - $this->db->group_end(); - $this->db->where('station_profile.user_id', $this->session->userdata('user_id')); - $this->db->where_in('station_profile.station_id', $logbooks_locations_array); - $this->db->limit(1); - $query = $this->db->get($this->config->item('table_name')); - $name = ""; - if ($query->num_rows() > 0) - { - $data = $query->row(); - $times_worked = $data->TWKED; - } - - return $times_worked; - } - - function call_qslvia($callsign) { - $this->db->select('COL_CALL, COL_QSL_VIA, COL_TIME_ON'); - $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); - $this->db->where('COL_CALL', $callsign); - $this->db->where('station_profile.user_id', $this->session->userdata('user_id')); - $where = "COL_QSL_VIA != \"\""; - - $this->db->where($where); - - $this->db->order_by("COL_TIME_ON", "desc"); - $this->db->limit(1); - $query = $this->db->get($this->config->item('table_name')); - $qsl_via = ""; - if ($query->num_rows() > 0) - { - $data = $query->row(); - $qsl_via = $data->COL_QSL_VIA; - } - - return $qsl_via; - } - - function call_state($callsign) { - $this->db->select('COL_CALL, COL_STATE'); - $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); - $this->db->where('COL_CALL', $callsign); - $this->db->where('station_profile.user_id', $this->session->userdata('user_id')); - $where = "COL_STATE != \"\""; - - $this->db->where($where); - - $this->db->order_by("COL_TIME_ON", "desc"); - $this->db->limit(1); - $query = $this->db->get($this->config->item('table_name')); - $qsl_state = ""; - if ($query->num_rows() > 0) - { - $data = $query->row(); - $qsl_state = $data->COL_STATE; - } - - return $qsl_state; + $this->db->order_by("COL_TIME_ON", "desc"); + $this->db->limit(1); + $query = $this->db->get($this->config->item('table_name')); + $callsign = ""; + if ($query->num_rows() > 0) { + $data = $query->row(); + $callsign = strtoupper($data->COL_GRIDSQUARE); } - function call_us_county($callsign) { - $this->db->select('COL_CALL, COL_CNTY'); - $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); - $this->db->where('COL_CALL', $callsign); - $this->db->where('station_profile.user_id', $this->session->userdata('user_id')); - $where = "COL_CNTY != \"\""; + return $callsign; + } - $this->db->where($where); + function call_name($callsign) + { + $this->db->select('COL_CALL, COL_NAME, COL_TIME_ON'); + $this->db->join('station_profile', 'station_profile.station_id = ' . $this->config->item('table_name') . '.station_id'); + $this->db->where('COL_CALL', $callsign); + $this->db->where('station_profile.user_id', $this->session->userdata('user_id')); + $where = "COL_NAME != \"\""; - $this->db->order_by("COL_TIME_ON", "desc"); - $this->db->limit(1); - $query = $this->db->get($this->config->item('table_name')); - if ($query->num_rows() > 0) - { - $data = $query->row(); - $qsl_county = $data->COL_CNTY; - $qsl_county = substr($qsl_county, (strpos($qsl_county, ',')+1)); - return $qsl_county; - } else { - return NULL; - } + $this->db->where($where); + + $this->db->order_by("COL_TIME_ON", "desc"); + $this->db->limit(1); + $query = $this->db->get($this->config->item('table_name')); + $name = ""; + if ($query->num_rows() > 0) { + $data = $query->row(); + $name = $data->COL_NAME; } - function call_qth($callsign) { - $this->db->select('COL_CALL, COL_QTH, COL_TIME_ON'); - $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); - $this->db->where('COL_CALL', $callsign); - $where = "COL_QTH != \"\""; + return $name; + } - $this->db->where($where); + function times_worked($callsign) + { + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $this->db->select('count(1) as TWKED'); + $this->db->join('station_profile', 'station_profile.station_id = ' . $this->config->item('table_name') . '.station_id'); + $this->db->group_start(); + $this->db->where($this->config->item('table_name') . '.COL_CALL', $callsign); + $this->db->or_like($this->config->item('table_name') . '.COL_CALL', '/' . $callsign, 'before'); + $this->db->or_like($this->config->item('table_name') . '.COL_CALL', $callsign . '/', 'after'); + $this->db->or_like($this->config->item('table_name') . '.COL_CALL', '/' . $callsign . '/'); - $this->db->order_by("COL_TIME_ON", "desc"); - $this->db->limit(1); - $query = $this->db->get($this->config->item('table_name')); - $name = ""; - if ($query->num_rows() > 0) - { - $data = $query->row(); - $name = $data->COL_QTH; - } + $this->db->group_end(); + $this->db->where('station_profile.user_id', $this->session->userdata('user_id')); + $this->db->where_in('station_profile.station_id', $logbooks_locations_array); + $this->db->limit(1); + $query = $this->db->get($this->config->item('table_name')); + $name = ""; + if ($query->num_rows() > 0) { + $data = $query->row(); + $times_worked = $data->TWKED; + } - return $name; - } + return $times_worked; + } - function call_iota($callsign) { - $this->db->select('COL_CALL, COL_IOTA, COL_TIME_ON'); - $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); - $this->db->where('COL_CALL', $callsign); - $where = "COL_IOTA != \"\""; + function call_qslvia($callsign) + { + $this->db->select('COL_CALL, COL_QSL_VIA, COL_TIME_ON'); + $this->db->join('station_profile', 'station_profile.station_id = ' . $this->config->item('table_name') . '.station_id'); + $this->db->where('COL_CALL', $callsign); + $this->db->where('station_profile.user_id', $this->session->userdata('user_id')); + $where = "COL_QSL_VIA != \"\""; - $this->db->where($where); + $this->db->where($where); - $this->db->order_by("COL_TIME_ON", "desc"); - $this->db->limit(1); - $query = $this->db->get($this->config->item('table_name')); - $name = ""; - if ($query->num_rows() > 0) - { - $data = $query->row(); - $name = $data->COL_IOTA; - } + $this->db->order_by("COL_TIME_ON", "desc"); + $this->db->limit(1); + $query = $this->db->get($this->config->item('table_name')); + $qsl_via = ""; + if ($query->num_rows() > 0) { + $data = $query->row(); + $qsl_via = $data->COL_QSL_VIA; + } - return $name; - } + return $qsl_via; + } + + function call_state($callsign) + { + $this->db->select('COL_CALL, COL_STATE'); + $this->db->join('station_profile', 'station_profile.station_id = ' . $this->config->item('table_name') . '.station_id'); + $this->db->where('COL_CALL', $callsign); + $this->db->where('station_profile.user_id', $this->session->userdata('user_id')); + $where = "COL_STATE != \"\""; + + $this->db->where($where); + + $this->db->order_by("COL_TIME_ON", "desc"); + $this->db->limit(1); + $query = $this->db->get($this->config->item('table_name')); + $qsl_state = ""; + if ($query->num_rows() > 0) { + $data = $query->row(); + $qsl_state = $data->COL_STATE; + } + + return $qsl_state; + } + + function call_us_county($callsign) + { + $this->db->select('COL_CALL, COL_CNTY'); + $this->db->join('station_profile', 'station_profile.station_id = ' . $this->config->item('table_name') . '.station_id'); + $this->db->where('COL_CALL', $callsign); + $this->db->where('station_profile.user_id', $this->session->userdata('user_id')); + $where = "COL_CNTY != \"\""; + + $this->db->where($where); + + $this->db->order_by("COL_TIME_ON", "desc"); + $this->db->limit(1); + $query = $this->db->get($this->config->item('table_name')); + if ($query->num_rows() > 0) { + $data = $query->row(); + $qsl_county = $data->COL_CNTY; + $qsl_county = substr($qsl_county, (strpos($qsl_county, ',') + 1)); + return $qsl_county; + } else { + return NULL; + } + } + + function call_qth($callsign) + { + $this->db->select('COL_CALL, COL_QTH, COL_TIME_ON'); + $this->db->join('station_profile', 'station_profile.station_id = ' . $this->config->item('table_name') . '.station_id'); + $this->db->where('COL_CALL', $callsign); + $where = "COL_QTH != \"\""; + + $this->db->where($where); + + $this->db->order_by("COL_TIME_ON", "desc"); + $this->db->limit(1); + $query = $this->db->get($this->config->item('table_name')); + $name = ""; + if ($query->num_rows() > 0) { + $data = $query->row(); + $name = $data->COL_QTH; + } + + return $name; + } + + function call_iota($callsign) + { + $this->db->select('COL_CALL, COL_IOTA, COL_TIME_ON'); + $this->db->join('station_profile', 'station_profile.station_id = ' . $this->config->item('table_name') . '.station_id'); + $this->db->where('COL_CALL', $callsign); + $where = "COL_IOTA != \"\""; + + $this->db->where($where); + + $this->db->order_by("COL_TIME_ON", "desc"); + $this->db->limit(1); + $query = $this->db->get($this->config->item('table_name')); + $name = ""; + if ($query->num_rows() > 0) { + $data = $query->row(); + $name = $data->COL_IOTA; + } + + return $name; + } /* Return QSO Info */ - function qso_info($id) { - if ($this->logbook_model->check_qso_is_accessible($id)) { - $this->db->where('COL_PRIMARY_KEY', $id); + function qso_info($id) + { + if ($this->logbook_model->check_qso_is_accessible($id)) { + $this->db->where('COL_PRIMARY_KEY', $id); - return $this->db->get($this->config->item('table_name')); - } else { - return; - } - } + return $this->db->get($this->config->item('table_name')); + } else { + return; + } + } // Set Paper to received - function paperqsl_update($qso_id, $method) { - if ($this->logbook_model->check_qso_is_accessible($qso_id)) { + function paperqsl_update($qso_id, $method) + { + if ($this->logbook_model->check_qso_is_accessible($qso_id)) { - $data = array( - 'COL_QSLRDATE' => date('Y-m-d H:i:s'), - 'COL_QSL_RCVD' => 'Y', - 'COL_QSL_RCVD_VIA' => $method - ); + $data = array( + 'COL_QSLRDATE' => date('Y-m-d H:i:s'), + 'COL_QSL_RCVD' => 'Y', + 'COL_QSL_RCVD_VIA' => $method + ); - $this->db->where('COL_PRIMARY_KEY', $qso_id); + $this->db->where('COL_PRIMARY_KEY', $qso_id); - $this->db->update($this->config->item('table_name'), $data); - } else { - return; - } - } + $this->db->update($this->config->item('table_name'), $data); + } else { + return; + } + } // Set Paper to sent - function paperqsl_update_sent($qso_id, $method) { - if ($this->logbook_model->check_qso_is_accessible($qso_id)) { - if ($method != '') { - $data = array( - 'COL_QSLSDATE' => date('Y-m-d H:i:s'), - 'COL_QSL_SENT' => 'Y', - 'COL_QSL_SENT_VIA' => $method - ); - } else { - $data = array( - 'COL_QSLSDATE' => date('Y-m-d H:i:s'), - 'COL_QSL_SENT' => 'Y' - ); - } + function paperqsl_update_sent($qso_id, $method) + { + if ($this->logbook_model->check_qso_is_accessible($qso_id)) { + if ($method != '') { + $data = array( + 'COL_QSLSDATE' => date('Y-m-d H:i:s'), + 'COL_QSL_SENT' => 'Y', + 'COL_QSL_SENT_VIA' => $method + ); + } else { + $data = array( + 'COL_QSLSDATE' => date('Y-m-d H:i:s'), + 'COL_QSL_SENT' => 'Y' + ); + } - $this->db->where('COL_PRIMARY_KEY', $qso_id); + $this->db->where('COL_PRIMARY_KEY', $qso_id); - $this->db->update($this->config->item('table_name'), $data); - } else { - return; - } - } + $this->db->update($this->config->item('table_name'), $data); + } else { + return; + } + } // Set Paper to requested - function paperqsl_requested($qso_id, $method) { - if ($this->logbook_model->check_qso_is_accessible($qso_id)) { + function paperqsl_requested($qso_id, $method) + { + if ($this->logbook_model->check_qso_is_accessible($qso_id)) { - $data = array( - 'COL_QSLSDATE' => date('Y-m-d H:i:s'), - 'COL_QSL_SENT' => 'R', - 'COL_QSL_SENT_VIA' => $method - ); + $data = array( + 'COL_QSLSDATE' => date('Y-m-d H:i:s'), + 'COL_QSL_SENT' => 'R', + 'COL_QSL_SENT_VIA' => $method + ); - $this->db->where('COL_PRIMARY_KEY', $qso_id); + $this->db->where('COL_PRIMARY_KEY', $qso_id); - $this->db->update($this->config->item('table_name'), $data); - } else { - return; - } + $this->db->update($this->config->item('table_name'), $data); + } else { + return; + } } - function paperqsl_ignore($qso_id, $method) { - if ($this->logbook_model->check_qso_is_accessible($qso_id)) { + function paperqsl_ignore($qso_id, $method) + { + if ($this->logbook_model->check_qso_is_accessible($qso_id)) { - $data = array( - 'COL_QSLSDATE' => date('Y-m-d H:i:s'), - 'COL_QSL_SENT' => 'I' - ); + $data = array( + 'COL_QSLSDATE' => date('Y-m-d H:i:s'), + 'COL_QSL_SENT' => 'I' + ); - $this->db->where('COL_PRIMARY_KEY', $qso_id); + $this->db->where('COL_PRIMARY_KEY', $qso_id); - $this->db->update($this->config->item('table_name'), $data); - } else { - return; - } + $this->db->update($this->config->item('table_name'), $data); + } else { + return; + } } - function get_qsos_for_printing($station_id2 = null) { + function get_qsos_for_printing($station_id2 = null) + { - $CI =& get_instance(); + $CI = &get_instance(); $CI->load->model('stations'); $station_id = $CI->stations->find_active(); @@ -1595,29 +1626,30 @@ class Logbook_model extends CI_Model { (select adif from dxcc_prefixes where (CASE WHEN COL_QSL_VIA != \'\' THEN COL_QSL_VIA ELSE COL_CALL END) like concat(dxcc_prefixes.`call`,\'%\') order by end limit 1) as ADIF, (select entity from dxcc_prefixes where (CASE WHEN COL_QSL_VIA != \'\' THEN COL_QSL_VIA ELSE COL_CALL END) like concat(dxcc_prefixes.`call`,\'%\') order by end limit 1) as ENTITY, (CASE WHEN COL_QSL_VIA != \'\' THEN COL_QSL_VIA ELSE COL_CALL END) AS COL_ROUTING - FROM '.$this->config->item('table_name').' thcv + FROM ' . $this->config->item('table_name') . ' thcv join station_profile on thcv.station_id = station_profile.station_id WHERE COL_QSL_SENT in (\'R\', \'Q\')'; if ($station_id2 == NULL) { - $sql .= ' and thcv.station_id = ' . $station_id; - } else if ($station_id2 != 'All') { - $sql .= ' and thcv.station_id = ' . $station_id2; - } + $sql .= ' and thcv.station_id = ' . $station_id; + } else if ($station_id2 != 'All') { + $sql .= ' and thcv.station_id = ' . $station_id2; + } - // always filter user. this ensures that even if the station_id is from another user no inaccesible QSOs will be returned - $sql .= ' and station_profile.user_id = ' . $this->session->userdata('user_id'); + // always filter user. this ensures that even if the station_id is from another user no inaccesible QSOs will be returned + $sql .= ' and station_profile.user_id = ' . $this->session->userdata('user_id'); - $sql .= ' ORDER BY ADIF, COL_ROUTING'; + $sql .= ' ORDER BY ADIF, COL_ROUTING'; $query = $this->db->query($sql); return $query; } - function get_qsos($num, $offset, $StationLocationsArray = null) { - if($StationLocationsArray == null) { - $CI =& get_instance(); + function get_qsos($num, $offset, $StationLocationsArray = null) + { + if ($StationLocationsArray == null) { + $CI = &get_instance(); $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); } else { @@ -1628,18 +1660,18 @@ class Logbook_model extends CI_Model { return array(); } - $this->db->select($this->config->item('table_name').'.*, station_profile.*, dxcc_entities.*, lotw_users.callsign, lotw_users.lastupload'); + $this->db->select($this->config->item('table_name') . '.*, station_profile.*, dxcc_entities.*, lotw_users.callsign, lotw_users.lastupload'); $this->db->from($this->config->item('table_name')); // remove anything thats duplicated based on COL_PRIMARY_KEY - $this->db->distinct(''.$this->config->item('table_name').'.COL_PRIMARY_KEY'); + $this->db->distinct('' . $this->config->item('table_name') . '.COL_PRIMARY_KEY'); - $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); - $this->db->join('dxcc_entities', $this->config->item('table_name').'.col_dxcc = dxcc_entities.adif', 'left'); - $this->db->join('lotw_users', 'lotw_users.callsign = '.$this->config->item('table_name').'.col_call', 'left outer'); + $this->db->join('station_profile', 'station_profile.station_id = ' . $this->config->item('table_name') . '.station_id'); + $this->db->join('dxcc_entities', $this->config->item('table_name') . '.col_dxcc = dxcc_entities.adif', 'left'); + $this->db->join('lotw_users', 'lotw_users.callsign = ' . $this->config->item('table_name') . '.col_call', 'left outer'); $this->db->where_in('station_profile.station_id', $logbooks_locations_array); - $this->db->order_by(''.$this->config->item('table_name').'.COL_TIME_ON', "desc"); - $this->db->order_by(''.$this->config->item('table_name').'.COL_PRIMARY_KEY', "desc"); + $this->db->order_by('' . $this->config->item('table_name') . '.COL_TIME_ON', "desc"); + $this->db->order_by('' . $this->config->item('table_name') . '.COL_PRIMARY_KEY', "desc"); $this->db->limit($num); $this->db->offset($offset); @@ -1647,72 +1679,76 @@ class Logbook_model extends CI_Model { return $this->db->get(); } - function get_qso($id, $trusted = false) { - if ($trusted || ($this->logbook_model->check_qso_is_accessible($id))) { - $this->db->select($this->config->item('table_name').'.*, station_profile.*, dxcc_entities.*, coalesce(dxcc_entities_2.name, "- NONE -") as station_country, dxcc_entities_2.end as station_end, eQSL_images.image_file as eqsl_image_file, lotw_users.callsign as lotwuser, lotw_users.lastupload'); - $this->db->from($this->config->item('table_name')); - $this->db->join('dxcc_entities', $this->config->item('table_name').'.col_dxcc = dxcc_entities.adif', 'left'); - $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id', 'left'); - $this->db->join('dxcc_entities as dxcc_entities_2', 'station_profile.station_dxcc = dxcc_entities_2.adif', 'left outer'); - $this->db->join('eQSL_images', $this->config->item('table_name').'.COL_PRIMARY_KEY = eQSL_images.qso_id', 'left outer'); - $this->db->join('lotw_users', $this->config->item('table_name').'.COL_CALL = lotw_users.callsign', 'left outer'); - $this->db->where('COL_PRIMARY_KEY', $id); + function get_qso($id, $trusted = false) + { + if ($trusted || ($this->logbook_model->check_qso_is_accessible($id))) { + $this->db->select($this->config->item('table_name') . '.*, station_profile.*, dxcc_entities.*, coalesce(dxcc_entities_2.name, "- NONE -") as station_country, dxcc_entities_2.end as station_end, eQSL_images.image_file as eqsl_image_file, lotw_users.callsign as lotwuser, lotw_users.lastupload'); + $this->db->from($this->config->item('table_name')); + $this->db->join('dxcc_entities', $this->config->item('table_name') . '.col_dxcc = dxcc_entities.adif', 'left'); + $this->db->join('station_profile', 'station_profile.station_id = ' . $this->config->item('table_name') . '.station_id', 'left'); + $this->db->join('dxcc_entities as dxcc_entities_2', 'station_profile.station_dxcc = dxcc_entities_2.adif', 'left outer'); + $this->db->join('eQSL_images', $this->config->item('table_name') . '.COL_PRIMARY_KEY = eQSL_images.qso_id', 'left outer'); + $this->db->join('lotw_users', $this->config->item('table_name') . '.COL_CALL = lotw_users.callsign', 'left outer'); + $this->db->where('COL_PRIMARY_KEY', $id); - return $this->db->get(); - } else { - return; - } + return $this->db->get(); + } else { + return; + } } - /* + /* * Function returns the QSOs from the logbook, which have not been either marked as uploaded to hrdlog, or has been modified with an edit */ - function get_hrdlog_qsos($station_id){ - $sql = 'select *, dxcc_entities.name as station_country from ' . $this->config->item('table_name') . ' thcv ' . - ' left join station_profile on thcv.station_id = station_profile.station_id' . - ' left outer join dxcc_entities on thcv.col_my_dxcc = dxcc_entities.adif' . - ' where thcv.station_id = ' . $station_id . - ' and (COL_HRDLOG_QSO_UPLOAD_STATUS is NULL + function get_hrdlog_qsos($station_id) + { + $sql = 'select *, dxcc_entities.name as station_country from ' . $this->config->item('table_name') . ' thcv ' . + ' left join station_profile on thcv.station_id = station_profile.station_id' . + ' left outer join dxcc_entities on thcv.col_my_dxcc = dxcc_entities.adif' . + ' where thcv.station_id = ' . $station_id . + ' and (COL_HRDLOG_QSO_UPLOAD_STATUS is NULL or COL_HRDLOG_QSO_UPLOAD_STATUS = "" or COL_HRDLOG_QSO_UPLOAD_STATUS = "M" or COL_HRDLOG_QSO_UPLOAD_STATUS = "N")'; - $query = $this->db->query($sql); - return $query; - } + $query = $this->db->query($sql); + return $query; + } - /* + /* * Function returns the QSOs from the logbook, which have not been either marked as uploaded to qrz, or has been modified with an edit */ - function get_qrz_qsos($station_id, $trusted = false){ - $CI =& get_instance(); - $CI->load->model('stations'); - if ((!$trusted) && (!$CI->stations->check_station_is_accessible($station_id))) { - return; - } - $sql = 'select *, dxcc_entities.name as station_country from ' . $this->config->item('table_name') . ' thcv ' . - ' left join station_profile on thcv.station_id = station_profile.station_id' . - ' left outer join dxcc_entities on thcv.col_my_dxcc = dxcc_entities.adif' . - ' where thcv.station_id = ' . $station_id . - ' and (COL_QRZCOM_QSO_UPLOAD_STATUS is NULL + function get_qrz_qsos($station_id, $trusted = false) + { + $CI = &get_instance(); + $CI->load->model('stations'); + if ((!$trusted) && (!$CI->stations->check_station_is_accessible($station_id))) { + return; + } + $sql = 'select *, dxcc_entities.name as station_country from ' . $this->config->item('table_name') . ' thcv ' . + ' left join station_profile on thcv.station_id = station_profile.station_id' . + ' left outer join dxcc_entities on thcv.col_my_dxcc = dxcc_entities.adif' . + ' where thcv.station_id = ' . $station_id . + ' and (COL_QRZCOM_QSO_UPLOAD_STATUS is NULL or COL_QRZCOM_QSO_UPLOAD_STATUS = "" or COL_QRZCOM_QSO_UPLOAD_STATUS = "M" or COL_QRZCOM_QSO_UPLOAD_STATUS = "N")'; - $query = $this->db->query($sql); - return $query; + $query = $this->db->query($sql); + return $query; } - /* + /* * Function returns the QSOs from the logbook, which have not been either marked as uploaded to webADIF */ - function get_webadif_qsos($station_id,$from = null, $to = null,$trusted = false){ - $CI =& get_instance(); - $CI->load->model('stations'); - if ((!$trusted) && (!$CI->stations->check_station_is_accessible($station_id))) { - return; - } - $sql = " + function get_webadif_qsos($station_id, $from = null, $to = null, $trusted = false) + { + $CI = &get_instance(); + $CI->load->model('stations'); + if ((!$trusted) && (!$CI->stations->check_station_is_accessible($station_id))) { + return; + } + $sql = " SELECT qsos.*, station_profile.*, dxcc_entities.name as station_country FROM %s qsos INNER JOIN station_profile ON qsos.station_id = station_profile.station_id @@ -1722,118 +1758,120 @@ class Logbook_model extends CI_Model { AND qsos.COL_SAT_NAME = 'QO-100' AND webadif.upload_date IS NULL "; - $sql = sprintf( - $sql, - $this->config->item('table_name'), - $station_id - ); - if ($from) { - $from = DateTime::createFromFormat('d/m/Y', $from); - $from = $from->format('Y-m-d'); + $sql = sprintf( + $sql, + $this->config->item('table_name'), + $station_id + ); + if ($from) { + $from = DateTime::createFromFormat('d/m/Y', $from); + $from = $from->format('Y-m-d'); - $sql.=" AND qsos.COL_TIME_ON >= %s"; - $sql=sprintf( - $sql, - $this->db->escape($from) - ); - } - if ($to) { - $to = DateTime::createFromFormat('d/m/Y', $to); - $to = $to->format('Y-m-d'); + $sql .= " AND qsos.COL_TIME_ON >= %s"; + $sql = sprintf( + $sql, + $this->db->escape($from) + ); + } + if ($to) { + $to = DateTime::createFromFormat('d/m/Y', $to); + $to = $to->format('Y-m-d'); - $sql.=" AND qsos.COL_TIME_ON <= %s"; - $sql=sprintf( - $sql, - $this->db->escape($to) - ); - } - - return $this->db->query($sql); + $sql .= " AND qsos.COL_TIME_ON <= %s"; + $sql = sprintf( + $sql, + $this->db->escape($to) + ); } - /* - * Function returns all the station_id's with QRZ API Key's - */ - function get_station_id_with_qrz_api() { - $sql = 'select station_id, qrzapikey from station_profile - where coalesce(qrzapikey, "") <> ""'; - - $query = $this->db->query($sql); - - $result = $query->result(); - - if ($result) { - return $result; - } - else { - return null; - } + return $this->db->query($sql); } - /* + /* + * Function returns all the station_id's with QRZ API Key's + */ + function get_station_id_with_qrz_api() + { + $sql = 'select station_id, qrzapikey from station_profile + where coalesce(qrzapikey, "") <> ""'; + + $query = $this->db->query($sql); + + $result = $query->result(); + + if ($result) { + return $result; + } else { + return null; + } + } + + /* * Function returns all the station_id's with HRDLOG Code */ - function get_station_id_with_hrdlog_code() { - $sql = 'SELECT station_id, hrdlog_username, hrdlog_code + function get_station_id_with_hrdlog_code() + { + $sql = 'SELECT station_id, hrdlog_username, hrdlog_code FROM station_profile WHERE coalesce(hrdlog_username, "") <> "" AND coalesce(hrdlog_code, "") <> ""'; - $query = $this->db->query($sql); + $query = $this->db->query($sql); - $result = $query->result(); + $result = $query->result(); - if ($result) { - return $result; - } - else { - return null; - } + if ($result) { + return $result; + } else { + return null; } + } - /* + /* * Function returns all the station_id's with QRZ API Key's */ - function get_qrz_apikeys() { - $sql = 'select distinct qrzapikey, user_id from station_profile + function get_qrz_apikeys() + { + $sql = 'select distinct qrzapikey, user_id from station_profile where coalesce(qrzapikey, "") <> "" order by qrzapikey'; - $query = $this->db->query($sql); + $query = $this->db->query($sql); - $result = $query->result(); + $result = $query->result(); - if ($result) { - return $result; - } - else { - return null; - } + if ($result) { + return $result; + } else { + return null; } + } - /* + /* * Function returns all the station_id's with QRZ API Key's */ - function get_station_id_with_webadif_api() { - $sql = " + function get_station_id_with_webadif_api() + { + $sql = " SELECT station_id, webadifapikey, webadifapiurl FROM station_profile WHERE COALESCE(webadifapikey, '') <> '' AND COALESCE(webadifapiurl, '') <> '' "; - $query = $this->db->query($sql); - $result = $query->result(); - if ($result) { - return $result; - } else { - return null; - } - } + $query = $this->db->query($sql); + $result = $query->result(); + if ($result) { + return $result; + } else { + return null; + } + } - function get_last_qsos($num, $StationLocationsArray = null) { + function get_last_qsos($num, $StationLocationsArray = null) + { - if($StationLocationsArray == null) { - $CI =& get_instance(); + if ($StationLocationsArray == null) { + $CI = &get_instance(); $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); } else { @@ -1841,10 +1879,10 @@ class Logbook_model extends CI_Model { } if ($logbooks_locations_array) { - $location_list = "'".implode("','",$logbooks_locations_array)."'"; + $location_list = "'" . implode("','", $logbooks_locations_array) . "'"; - $sql = "SELECT * FROM ( select * from " . $this->config->item('table_name'). " - WHERE station_id IN(". $location_list .") + $sql = "SELECT * FROM ( select * from " . $this->config->item('table_name') . " + WHERE station_id IN(" . $location_list . ") order by col_time_on desc, col_primary_key desc limit " . $num . ") hrd @@ -1858,71 +1896,71 @@ class Logbook_model extends CI_Model { } else { return null; } - } - function check_if_callsign_cnfmd_in_logbook($callsign, $StationLocationsArray = null, $band = null) { - $user_default_confirmation = $this->session->userdata('user_default_confirmation'); - - if($StationLocationsArray == null) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - } else { - $logbooks_locations_array = $StationLocationsArray; - } - - $extrawhere=''; - if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'Q') !== false) { - $extrawhere="COL_QSL_RCVD='Y'"; - } - if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'L') !== false) { - if ($extrawhere!='') { - $extrawhere.=" OR"; - } - $extrawhere.=" COL_LOTW_QSL_RCVD='Y'"; - } - if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'E') !== false) { - if ($extrawhere!='') { - $extrawhere.=" OR"; - } - $extrawhere.=" COL_EQSL_QSL_RCVD='Y'"; - } - - if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'Z') !== false) { - if ($extrawhere!='') { - $extrawhere.=" OR"; - } - $extrawhere.=" COL_QRZCOM_QSO_DOWNLOAD_STATUS='Y'"; - } - - - $this->db->select('COL_CALL'); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_CALL', $callsign); - - if($band != null && $band != 'SAT') { - $this->db->where('COL_BAND', $band); - } else if($band == 'SAT') { - // Where col_sat_name is not empty - $this->db->where('COL_SAT_NAME !=', ''); - } - if ($extrawhere != '') { - $this->db->where('('.$extrawhere.')'); - } else { - $this->db->where("1=0"); - } - $this->db->limit('2'); - $query = $this->db->get($this->config->item('table_name')); - - return $query->num_rows(); + function check_if_callsign_cnfmd_in_logbook($callsign, $StationLocationsArray = null, $band = null) + { + $user_default_confirmation = $this->session->userdata('user_default_confirmation'); + if ($StationLocationsArray == null) { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + } else { + $logbooks_locations_array = $StationLocationsArray; } -function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray = null, $band = null) { + $extrawhere = ''; + if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'Q') !== false) { + $extrawhere = "COL_QSL_RCVD='Y'"; + } + if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'L') !== false) { + if ($extrawhere != '') { + $extrawhere .= " OR"; + } + $extrawhere .= " COL_LOTW_QSL_RCVD='Y'"; + } + if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'E') !== false) { + if ($extrawhere != '') { + $extrawhere .= " OR"; + } + $extrawhere .= " COL_EQSL_QSL_RCVD='Y'"; + } - if($StationLocationsArray == null) { - $CI =& get_instance(); + if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'Z') !== false) { + if ($extrawhere != '') { + $extrawhere .= " OR"; + } + $extrawhere .= " COL_QRZCOM_QSO_DOWNLOAD_STATUS='Y'"; + } + + + $this->db->select('COL_CALL'); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_CALL', $callsign); + + if ($band != null && $band != 'SAT') { + $this->db->where('COL_BAND', $band); + } else if ($band == 'SAT') { + // Where col_sat_name is not empty + $this->db->where('COL_SAT_NAME !=', ''); + } + if ($extrawhere != '') { + $this->db->where('(' . $extrawhere . ')'); + } else { + $this->db->where("1=0"); + } + $this->db->limit('2'); + $query = $this->db->get($this->config->item('table_name')); + + return $query->num_rows(); + } + + function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray = null, $band = null) + { + + if ($StationLocationsArray == null) { + $CI = &get_instance(); $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); } else { @@ -1933,9 +1971,9 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray = $this->db->where_in('station_id', $logbooks_locations_array); $this->db->where('COL_CALL', $callsign); - if($band != null && $band != 'SAT') { + if ($band != null && $band != 'SAT') { $this->db->where('COL_BAND', $band); - } else if($band == 'SAT') { + } else if ($band == 'SAT') { // Where col_sat_name is not empty $this->db->where('COL_SAT_NAME !=', ''); } @@ -1943,13 +1981,13 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray = $query = $this->db->get($this->config->item('table_name')); return $query->num_rows(); - } - function check_if_grid_worked_in_logbook($grid, $StationLocationsArray = null, $band = null) { + function check_if_grid_worked_in_logbook($grid, $StationLocationsArray = null, $band = null) + { - if($StationLocationsArray == null) { - $CI =& get_instance(); + if ($StationLocationsArray == null) { + $CI = &get_instance(); $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); } else { @@ -1963,9 +2001,9 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray = $this->db->or_like('COL_VUCC_GRIDS', $grid); $this->db->group_end(); - if($band != null && $band != 'SAT') { + if ($band != null && $band != 'SAT') { $this->db->where('COL_BAND', $band); - } else if($band == 'SAT') { + } else if ($band == 'SAT') { // Where col_sat_name is not empty $this->db->where('COL_SAT_NAME !=', ''); } @@ -1974,60 +2012,60 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray = $query = $this->db->get($this->config->item('table_name')); return $query->num_rows(); - } - /* Get all QSOs with a valid grid for use in the KML export */ - function kml_get_all_qsos($band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + /* Get all QSOs with a valid grid for use in the KML export */ + function kml_get_all_qsos($band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate) + { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - $this->db->select('COL_CALL, COL_BAND, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_SUBMODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME, COL_GRIDSQUARE'); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where("coalesce(COL_GRIDSQUARE, '') <> ''"); + $this->db->select('COL_CALL, COL_BAND, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_SUBMODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME, COL_GRIDSQUARE'); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where("coalesce(COL_GRIDSQUARE, '') <> ''"); - if ($band != 'All') { - if ($band == 'SAT') { - $this->db->where('COL_PROP_MODE = \'' . $band . '\''); - } - else { - $this->db->where('COL_PROP_MODE != \'SAT\''); - $this->db->where('COL_BAND = \'' . $band .'\''); - } - } - - if ($mode != 'All') { - $this->db->where('COL_MODE = \'' . $mode . '\''); - } - - if ($dxcc != 'All') { - $this->db->where('COL_DXCC = ' . $dxcc); - } - - if ($cqz != 'All') { - $this->db->where('COL_CQZ = ' . $cqz); - } - - if ($propagation != 'All') { - $this->db->where('COL_PROP_MODE = ' . $propagation); - } - - // If date is set, we add it to the where-statement - if ($fromdate != "") { - $this->db->where("date(".$this->config->item('table_name').".COL_TIME_ON) >= '".$fromdate."'"); - } - if ($todate != "") { - $this->db->where("date(".$this->config->item('table_name').".COL_TIME_ON) <= '".$todate."'"); - } - - $query = $this->db->get($this->config->item('table_name')); - return $query; + if ($band != 'All') { + if ($band == 'SAT') { + $this->db->where('COL_PROP_MODE = \'' . $band . '\''); + } else { + $this->db->where('COL_PROP_MODE != \'SAT\''); + $this->db->where('COL_BAND = \'' . $band . '\''); + } } - function totals_year() { + if ($mode != 'All') { + $this->db->where('COL_MODE = \'' . $mode . '\''); + } - $CI =& get_instance(); + if ($dxcc != 'All') { + $this->db->where('COL_DXCC = ' . $dxcc); + } + + if ($cqz != 'All') { + $this->db->where('COL_CQZ = ' . $cqz); + } + + if ($propagation != 'All') { + $this->db->where('COL_PROP_MODE = ' . $propagation); + } + + // If date is set, we add it to the where-statement + if ($fromdate != "") { + $this->db->where("date(" . $this->config->item('table_name') . ".COL_TIME_ON) >= '" . $fromdate . "'"); + } + if ($todate != "") { + $this->db->where("date(" . $this->config->item('table_name') . ".COL_TIME_ON) <= '" . $todate . "'"); + } + + $query = $this->db->get($this->config->item('table_name')); + return $query; + } + + function totals_year() + { + + $CI = &get_instance(); $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -2045,464 +2083,463 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray = return $query; } - /* Return total number of qsos */ - function total_qsos($StationLocationsArray = null, $api_key = null) { - if($StationLocationsArray == null) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - if ($api_key != null) { - $CI->load->model('api_model'); - if (strpos($this->api_model->access($api_key), 'r') !== false) { - $this->api_model->update_last_used($api_key); - $user_id = $this->api_model->key_userid($api_key); - $active_station_logbook = $CI->logbooks_model->find_active_station_logbook_from_userid($user_id); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($active_station_logbook); - } else { - $logbooks_locations_array = []; - } + /* Return total number of qsos */ + function total_qsos($StationLocationsArray = null, $api_key = null) + { + if ($StationLocationsArray == null) { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + if ($api_key != null) { + $CI->load->model('api_model'); + if (strpos($this->api_model->access($api_key), 'r') !== false) { + $this->api_model->update_last_used($api_key); + $user_id = $this->api_model->key_userid($api_key); + $active_station_logbook = $CI->logbooks_model->find_active_station_logbook_from_userid($user_id); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($active_station_logbook); } else { - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $logbooks_locations_array = []; } } else { - $logbooks_locations_array = $StationLocationsArray; - } - - if ($logbooks_locations_array) { - $this->db->select('COUNT( * ) as count', FALSE); - $this->db->where_in('station_id', $logbooks_locations_array); - $query = $this->db->get($this->config->item('table_name')); - - if ($query->num_rows() > 0) - { - foreach ($query->result() as $row) - { - return $row->count; - } - } - } else { - return null; - } - } - - /* Return number of QSOs had today */ - function todays_qsos($StationLocationsArray = null, $api_key = null) { - if($StationLocationsArray == null) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - if ($api_key != null) { - $CI->load->model('api_model'); - if (strpos($this->api_model->access($api_key), 'r') !== false) { - $this->api_model->update_last_used($api_key); - $user_id = $this->api_model->key_userid($api_key); - $active_station_logbook = $CI->logbooks_model->find_active_station_logbook_from_userid($user_id); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($active_station_logbook); - } else { - $logbooks_locations_array = []; - } - } else { - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - } - } else { - $logbooks_locations_array = $StationLocationsArray; - } - - if ($logbooks_locations_array) { - $morning = date('Y-m-d 00:00:00'); - $night = date('Y-m-d 23:59:59'); - - $this->db->select('COUNT( * ) as count', FALSE); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_TIME_ON >=', $morning); - $this->db->where('COL_TIME_ON <=', $night); - $query = $this->db->get($this->config->item('table_name')); - - if ($query->num_rows() > 0) - { - foreach ($query->result() as $row) - { - return $row->count; - } - } - } else { - return null; - } - - } - - /* Return QSOs over a period of days */ - function map_week_qsos($start, $end) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - $this->db->where("COL_TIME_ON BETWEEN '".$start."' AND '".$end."'"); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->order_by("COL_TIME_ON", "ASC"); - $query = $this->db->get($this->config->item('table_name')); - - return $query; + } + } else { + $logbooks_locations_array = $StationLocationsArray; } - /* used to return custom qsos requires start, end date plus a band */ - function map_custom_qsos($start, $end, $band, $mode, $propagation) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + if ($logbooks_locations_array) { + $this->db->select('COUNT( * ) as count', FALSE); + $this->db->where_in('station_id', $logbooks_locations_array); + $query = $this->db->get($this->config->item('table_name')); + + if ($query->num_rows() > 0) { + foreach ($query->result() as $row) { + return $row->count; + } + } + } else { + return null; + } + } + + /* Return number of QSOs had today */ + function todays_qsos($StationLocationsArray = null, $api_key = null) + { + if ($StationLocationsArray == null) { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + if ($api_key != null) { + $CI->load->model('api_model'); + if (strpos($this->api_model->access($api_key), 'r') !== false) { + $this->api_model->update_last_used($api_key); + $user_id = $this->api_model->key_userid($api_key); + $active_station_logbook = $CI->logbooks_model->find_active_station_logbook_from_userid($user_id); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($active_station_logbook); + } else { + $logbooks_locations_array = []; + } + } else { + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + } + } else { + $logbooks_locations_array = $StationLocationsArray; + } + + if ($logbooks_locations_array) { + $morning = date('Y-m-d 00:00:00'); + $night = date('Y-m-d 23:59:59'); + + $this->db->select('COUNT( * ) as count', FALSE); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_TIME_ON >=', $morning); + $this->db->where('COL_TIME_ON <=', $night); + $query = $this->db->get($this->config->item('table_name')); + + if ($query->num_rows() > 0) { + foreach ($query->result() as $row) { + return $row->count; + } + } + } else { + return null; + } + } + + /* Return QSOs over a period of days */ + function map_week_qsos($start, $end) + { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + $this->db->where("COL_TIME_ON BETWEEN '" . $start . "' AND '" . $end . "'"); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->order_by("COL_TIME_ON", "ASC"); + $query = $this->db->get($this->config->item('table_name')); + + return $query; + } + + /* used to return custom qsos requires start, end date plus a band */ + function map_custom_qsos($start, $end, $band, $mode, $propagation) + { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); if (!$logbooks_locations_array) { return null; } - $this->db->join('dxcc_entities', $this->config->item('table_name').'.col_dxcc = dxcc_entities.adif', 'left'); - $this->db->where("COL_TIME_ON BETWEEN '".$start." 00:00:00' AND '".$end." 23:59:59'"); - $this->db->where_in("station_id", $logbooks_locations_array); + $this->db->join('dxcc_entities', $this->config->item('table_name') . '.col_dxcc = dxcc_entities.adif', 'left'); + $this->db->where("COL_TIME_ON BETWEEN '" . $start . " 00:00:00' AND '" . $end . " 23:59:59'"); + $this->db->where_in("station_id", $logbooks_locations_array); - if($band != "All" && $band != "SAT") { - $this->db->where("COL_BAND", $band); - } + if ($band != "All" && $band != "SAT") { + $this->db->where("COL_BAND", $band); + } - if ($band == "SAT") { - $this->db->where("COL_PROP_MODE", "SAT"); - } + if ($band == "SAT") { + $this->db->where("COL_PROP_MODE", "SAT"); + } - if ($mode != 'All') { - $this->db->group_start(); - $this->db->where("COL_MODE", $mode); - $this->db->or_where("COL_SUBMODE", $mode); - $this->db->group_end(); - } + if ($mode != 'All') { + $this->db->group_start(); + $this->db->where("COL_MODE", $mode); + $this->db->or_where("COL_SUBMODE", $mode); + $this->db->group_end(); + } - if ($propagation != 'All') { - $this->db->where("COL_PROP_MODE", $propagation); - } + if ($propagation != 'All') { + $this->db->where("COL_PROP_MODE", $propagation); + } - $this->db->order_by("COL_TIME_ON", "ASC"); - $query = $this->db->get($this->config->item('table_name')); + $this->db->order_by("COL_TIME_ON", "ASC"); + $query = $this->db->get($this->config->item('table_name')); - return $query; + return $query; } - /* Returns QSOs for the date sent eg 2011-09-30 */ - function map_day($date) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); + /* Returns QSOs for the date sent eg 2011-09-30 */ + function map_day($date) + { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + $start = $date . " 00:00:00"; + $end = $date . " 23:59:59"; + + $this->db->where("COL_TIME_ON BETWEEN '" . $start . "' AND '" . $end . "'"); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->order_by("COL_TIME_ON", "ASC"); + $query = $this->db->get($this->config->item('table_name')); + + return $query; + } + + // Return QSOs made during the current month + function month_qsos($StationLocationsArray = null, $api_key = null) + { + if ($StationLocationsArray == null) { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + if ($api_key != null) { + $CI->load->model('api_model'); + if (strpos($this->api_model->access($api_key), 'r') !== false) { + $this->api_model->update_last_used($api_key); + $user_id = $this->api_model->key_userid($api_key); + $active_station_logbook = $CI->logbooks_model->find_active_station_logbook_from_userid($user_id); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($active_station_logbook); + } else { + $logbooks_locations_array = []; + } + } else { $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - $start = $date." 00:00:00"; - $end = $date." 23:59:59"; - - $this->db->where("COL_TIME_ON BETWEEN '".$start."' AND '".$end."'"); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->order_by("COL_TIME_ON", "ASC"); - $query = $this->db->get($this->config->item('table_name')); - - return $query; + } + } else { + $logbooks_locations_array = $StationLocationsArray; } - // Return QSOs made during the current month - function month_qsos($StationLocationsArray = null, $api_key = null) { - if($StationLocationsArray == null) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - if ($api_key != null) { - $CI->load->model('api_model'); - if (strpos($this->api_model->access($api_key), 'r') !== false) { - $this->api_model->update_last_used($api_key); - $user_id = $this->api_model->key_userid($api_key); - $active_station_logbook = $CI->logbooks_model->find_active_station_logbook_from_userid($user_id); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($active_station_logbook); - } else { - $logbooks_locations_array = []; - } + if ($logbooks_locations_array) { + + $morning = date('Y-m-01 00:00:00'); + + $date = new DateTime('now'); + $date->modify('last day of this month'); + + $night = $date->format('Y-m-d') . " 23:59:59"; + + $this->db->select('COUNT( * ) as count', FALSE); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_TIME_ON >=', $morning); + $this->db->where('COL_TIME_ON <=', $night); + $query = $this->db->get($this->config->item('table_name')); + + if ($query->num_rows() > 0) { + foreach ($query->result() as $row) { + return $row->count; + } + } + } else { + return null; + } + } + + /* Return QSOs made during the current Year */ + function year_qsos($StationLocationsArray = null, $api_key = null) + { + + if ($StationLocationsArray == null) { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + if ($api_key != null) { + $CI->load->model('api_model'); + if (strpos($this->api_model->access($api_key), 'r') !== false) { + $this->api_model->update_last_used($api_key); + $user_id = $this->api_model->key_userid($api_key); + $active_station_logbook = $CI->logbooks_model->find_active_station_logbook_from_userid($user_id); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($active_station_logbook); } else { - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $logbooks_locations_array = []; } } else { - $logbooks_locations_array = $StationLocationsArray; - } - - if ($logbooks_locations_array) { - - $morning = date('Y-m-01 00:00:00'); - - $date = new DateTime('now'); - $date->modify('last day of this month'); - - $night = $date->format('Y-m-d')." 23:59:59"; - - $this->db->select('COUNT( * ) as count', FALSE); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_TIME_ON >=', $morning); - $this->db->where('COL_TIME_ON <=', $night); - $query = $this->db->get($this->config->item('table_name')); - - if ($query->num_rows() > 0) - { - foreach ($query->result() as $row) - { - return $row->count; - } - } - } else { - return null; + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); } + } else { + $logbooks_locations_array = $StationLocationsArray; } - /* Return QSOs made during the current Year */ - function year_qsos($StationLocationsArray = null, $api_key = null) { + if ($logbooks_locations_array) { - if($StationLocationsArray == null) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - if ($api_key != null) { - $CI->load->model('api_model'); - if (strpos($this->api_model->access($api_key), 'r') !== false) { - $this->api_model->update_last_used($api_key); - $user_id = $this->api_model->key_userid($api_key); - $active_station_logbook = $CI->logbooks_model->find_active_station_logbook_from_userid($user_id); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($active_station_logbook); - } else { - $logbooks_locations_array = []; - } - } else { - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - } - } else { - $logbooks_locations_array = $StationLocationsArray; - } - - if ($logbooks_locations_array) { - - $morning = date('Y-01-01 00:00:00'); - $night = date('Y-12-31 23:59:59'); - - $this->db->select('COUNT( * ) as count', FALSE); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_TIME_ON >=', $morning); - $this->db->where('COL_TIME_ON <=', $night); - $query = $this->db->get($this->config->item('table_name')); - - if ($query->num_rows() > 0) - { - foreach ($query->result() as $row) - { - return $row->count; - } - } - } else { - return null; - } - } - - /* Return total amount of SSB QSOs logged */ - function total_ssb() { - - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if (!$logbooks_locations_array) { - return null; - } - $mode[] = 'SSB'; - $mode[] = 'LSB'; - $mode[] = 'USB'; + $morning = date('Y-01-01 00:00:00'); + $night = date('Y-12-31 23:59:59'); $this->db->select('COUNT( * ) as count', FALSE); $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where_in('COL_MODE', $mode); - + $this->db->where('COL_TIME_ON >=', $morning); + $this->db->where('COL_TIME_ON <=', $night); $query = $this->db->get($this->config->item('table_name')); - if ($query->num_rows() > 0) - { - foreach ($query->result() as $row) - { - return $row->count; - } - } - } - - /* Return total number of satellite QSOs */ - function total_sat() { - - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if (!$logbooks_locations_array) { - return null; - } - - $this->db->select('COL_SAT_NAME, COUNT( * ) as count', FALSE); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_SAT_NAME is not null'); - $this->db->where('COL_SAT_NAME !=', ''); - $this->db->order_by('count DESC'); - $this->db->group_by('COL_SAT_NAME'); - $query = $this->db->get($this->config->item('table_name')); - - return $query; - } - - /* Return total number of QSOs per continent */ - function total_continents($searchCriteria) { - - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if (!$logbooks_locations_array) { - return null; - } - - $this->db->select('COL_CONT, COUNT( * ) as count', FALSE); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_CONT is not null'); - $this->db->where('COL_CONT !=', ''); - - if ($searchCriteria['mode'] !== '') { - $this->db->group_start(); - $this->db->where('COL_MODE', $searchCriteria['mode']); - $this->db->or_where('COL_SUBMODE', $searchCriteria['mode']); - $this->db->group_end(); - } - - if ($searchCriteria['band'] !== '') { - if($searchCriteria['band'] != "SAT") { - $this->db->where('COL_BAND', $searchCriteria['band']); - $this->db->where('COL_PROP_MODE != "SAT"'); - } else { - $this->db->where('COL_PROP_MODE', 'SAT'); + if ($query->num_rows() > 0) { + foreach ($query->result() as $row) { + return $row->count; } } + } else { + return null; + } + } - $this->db->order_by('count DESC'); - $this->db->group_by('COL_CONT'); - $query = $this->db->get($this->config->item('table_name')); + /* Return total amount of SSB QSOs logged */ + function total_ssb() + { - return $query; + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!$logbooks_locations_array) { + return null; + } + $mode[] = 'SSB'; + $mode[] = 'LSB'; + $mode[] = 'USB'; + + $this->db->select('COUNT( * ) as count', FALSE); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where_in('COL_MODE', $mode); + + $query = $this->db->get($this->config->item('table_name')); + + if ($query->num_rows() > 0) { + foreach ($query->result() as $row) { + return $row->count; + } + } + } + + /* Return total number of satellite QSOs */ + function total_sat() + { + + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!$logbooks_locations_array) { + return null; } - /* Return total number of CW QSOs */ - function total_cw() { + $this->db->select('COL_SAT_NAME, COUNT( * ) as count', FALSE); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_SAT_NAME is not null'); + $this->db->where('COL_SAT_NAME !=', ''); + $this->db->order_by('count DESC'); + $this->db->group_by('COL_SAT_NAME'); + $query = $this->db->get($this->config->item('table_name')); - $CI =& get_instance(); + return $query; + } + + /* Return total number of QSOs per continent */ + function total_continents($searchCriteria) + { + + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!$logbooks_locations_array) { + return null; + } + + $this->db->select('COL_CONT, COUNT( * ) as count', FALSE); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_CONT is not null'); + $this->db->where('COL_CONT !=', ''); + + if ($searchCriteria['mode'] !== '') { + $this->db->group_start(); + $this->db->where('COL_MODE', $searchCriteria['mode']); + $this->db->or_where('COL_SUBMODE', $searchCriteria['mode']); + $this->db->group_end(); + } + + if ($searchCriteria['band'] !== '') { + if ($searchCriteria['band'] != "SAT") { + $this->db->where('COL_BAND', $searchCriteria['band']); + $this->db->where('COL_PROP_MODE != "SAT"'); + } else { + $this->db->where('COL_PROP_MODE', 'SAT'); + } + } + + $this->db->order_by('count DESC'); + $this->db->group_by('COL_CONT'); + $query = $this->db->get($this->config->item('table_name')); + + return $query; + } + + /* Return total number of CW QSOs */ + function total_cw() + { + + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!$logbooks_locations_array) { + return null; + } + + $this->db->select('COUNT( * ) as count', FALSE); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_MODE', 'CW'); + $query = $this->db->get($this->config->item('table_name')); + + if ($query->num_rows() > 0) { + foreach ($query->result() as $row) { + return $row->count; + } + } + } + + /* Return total number of FM QSOs */ + function total_fm() + { + + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!$logbooks_locations_array) { + return null; + } + + $this->db->select('COUNT( * ) as count', FALSE); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_MODE', 'FM'); + $query = $this->db->get($this->config->item('table_name')); + + if ($query->num_rows() > 0) { + foreach ($query->result() as $row) { + return $row->count; + } + } + } + + /* Return total number of Digital QSOs */ + function total_digi() + { + + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!$logbooks_locations_array) { + return null; + } + + $this->db->select('COUNT( * ) as count', FALSE); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_MODE !=', 'SSB'); + $this->db->where('COL_MODE !=', 'LSB'); + $this->db->where('COL_MODE !=', 'USB'); + $this->db->where('COL_MODE !=', 'CW'); + $this->db->where('COL_MODE !=', 'FM'); + $this->db->where('COL_MODE !=', 'AM'); + + $query = $this->db->get($this->config->item('table_name')); + + if ($query->num_rows() > 0) { + foreach ($query->result() as $row) { + return $row->count; + } + } + } + + /* Return the list of modes in the logbook */ + function get_modes() + { + $query = $this->db->query('select distinct(COL_MODE) from ' . $this->config->item('table_name') . ' order by COL_MODE'); + return $query; + } + + /* Return total number of QSOs per band */ + function total_bands() + { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!$logbooks_locations_array) { + return null; + } + + $this->db->select('COL_BAND AS band, count( * ) AS count', FALSE); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->group_by('band'); + $this->db->order_by('count', 'DESC'); + + $query = $this->db->get($this->config->item('table_name')); + + return $query; + } + + function get_QSLStats($StationLocationsArray = null) + { + + if ($StationLocationsArray == null) { + $CI = &get_instance(); $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if (!$logbooks_locations_array) { - return null; - } - - $this->db->select('COUNT( * ) as count', FALSE); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_MODE', 'CW'); - $query = $this->db->get($this->config->item('table_name')); - - if ($query->num_rows() > 0) - { - foreach ($query->result() as $row) - { - return $row->count; - } - } + } else { + $logbooks_locations_array = $StationLocationsArray; } - /* Return total number of FM QSOs */ - function total_fm() { - - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if (!$logbooks_locations_array) { - return null; - } - - $this->db->select('COUNT( * ) as count', FALSE); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_MODE', 'FM'); - $query = $this->db->get($this->config->item('table_name')); - - if ($query->num_rows() > 0) - { - foreach ($query->result() as $row) - { - return $row->count; - } - } - } - - /* Return total number of Digital QSOs */ - function total_digi() { - - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if (!$logbooks_locations_array) { - return null; - } - - $this->db->select('COUNT( * ) as count', FALSE); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_MODE !=', 'SSB'); - $this->db->where('COL_MODE !=', 'LSB'); - $this->db->where('COL_MODE !=', 'USB'); - $this->db->where('COL_MODE !=', 'CW'); - $this->db->where('COL_MODE !=', 'FM'); - $this->db->where('COL_MODE !=', 'AM'); - - $query = $this->db->get($this->config->item('table_name')); - - if ($query->num_rows() > 0) - { - foreach ($query->result() as $row) - { - return $row->count; - } - } - } - - /* Return the list of modes in the logbook */ - function get_modes(){ - $query = $this->db->query('select distinct(COL_MODE) from '.$this->config->item('table_name').' order by COL_MODE'); - return $query; - } - - /* Return total number of QSOs per band */ - function total_bands() { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if (!$logbooks_locations_array) { - return null; - } - - $this->db->select('COL_BAND AS band, count( * ) AS count', FALSE); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->group_by('band'); - $this->db->order_by('count', 'DESC'); - - $query = $this->db->get($this->config->item('table_name')); - - return $query; - } - - function get_QSLStats($StationLocationsArray = null) { - - if($StationLocationsArray == null) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - } else { - $logbooks_locations_array = $StationLocationsArray; - } - - if(!empty($logbooks_locations_array)) { - $this->db->select(' + if (!empty($logbooks_locations_array)) { + $this->db->select(' COUNT(IF(COL_QSL_SENT="Y",COL_QSL_SENT,null)) as QSL_Sent, COUNT(IF(COL_QSL_RCVD="Y",COL_QSL_RCVD,null)) as QSL_Received, COUNT(IF(COL_QSL_SENT IN("Q", "R") ,COL_QSL_SENT,null)) as QSL_Requested, @@ -2522,536 +2559,546 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray = COUNT(IF(COL_QRZCOM_QSO_UPLOAD_STATUS="Y" and DATE(COL_QRZCOM_QSO_UPLOAD_DATE)=DATE(SYSDATE()),COL_QRZCOM_QSO_UPLOAD_STATUS,null)) as QRZ_Sent_today, COUNT(IF(COL_QRZCOM_QSO_DOWNLOAD_STATUS="Y" and DATE(COL_QRZCOM_QSO_DOWNLOAD_DATE)=DATE(SYSDATE()),COL_QRZCOM_QSO_DOWNLOAD_STATUS,null)) as QRZ_Received_today '); - $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where_in('station_id', $logbooks_locations_array); - if ($query = $this->db->get($this->config->item('table_name'))) { - $this->db->last_query(); - foreach ($query->result() as $row) { - $QSLBreakdown['QSL_Sent'] = $row->QSL_Sent; - $QSLBreakdown['QSL_Received'] = $row->QSL_Received; - $QSLBreakdown['QSL_Requested'] = $row->QSL_Requested; - $QSLBreakdown['eQSL_Sent'] = $row->eQSL_Sent; - $QSLBreakdown['eQSL_Received'] = $row->eQSL_Received; - $QSLBreakdown['LoTW_Sent'] = $row->LoTW_Sent; - $QSLBreakdown['LoTW_Received'] = $row->LoTW_Received; - $QSLBreakdown['QRZ_Sent'] = $row->QRZ_Sent; - $QSLBreakdown['QRZ_Received'] = $row->QRZ_Received; - $QSLBreakdown['QSL_Sent_today'] = $row->QSL_Sent_today; - $QSLBreakdown['QSL_Received_today'] = $row->QSL_Received_today; - $QSLBreakdown['QSL_Requested_today'] = $row->QSL_Requested_today; - $QSLBreakdown['eQSL_Sent_today'] = $row->eQSL_Sent_today; - $QSLBreakdown['eQSL_Received_today'] = $row->eQSL_Received_today; - $QSLBreakdown['LoTW_Sent_today'] = $row->LoTW_Sent_today; - $QSLBreakdown['LoTW_Received_today'] = $row->LoTW_Received_today; - $QSLBreakdown['QRZ_Sent_today'] = $row->QRZ_Sent_today; - $QSLBreakdown['QRZ_Received_today'] = $row->QRZ_Received_today; - } + if ($query = $this->db->get($this->config->item('table_name'))) { + $this->db->last_query(); + foreach ($query->result() as $row) { + $QSLBreakdown['QSL_Sent'] = $row->QSL_Sent; + $QSLBreakdown['QSL_Received'] = $row->QSL_Received; + $QSLBreakdown['QSL_Requested'] = $row->QSL_Requested; + $QSLBreakdown['eQSL_Sent'] = $row->eQSL_Sent; + $QSLBreakdown['eQSL_Received'] = $row->eQSL_Received; + $QSLBreakdown['LoTW_Sent'] = $row->LoTW_Sent; + $QSLBreakdown['LoTW_Received'] = $row->LoTW_Received; + $QSLBreakdown['QRZ_Sent'] = $row->QRZ_Sent; + $QSLBreakdown['QRZ_Received'] = $row->QRZ_Received; + $QSLBreakdown['QSL_Sent_today'] = $row->QSL_Sent_today; + $QSLBreakdown['QSL_Received_today'] = $row->QSL_Received_today; + $QSLBreakdown['QSL_Requested_today'] = $row->QSL_Requested_today; + $QSLBreakdown['eQSL_Sent_today'] = $row->eQSL_Sent_today; + $QSLBreakdown['eQSL_Received_today'] = $row->eQSL_Received_today; + $QSLBreakdown['LoTW_Sent_today'] = $row->LoTW_Sent_today; + $QSLBreakdown['LoTW_Received_today'] = $row->LoTW_Received_today; + $QSLBreakdown['QRZ_Sent_today'] = $row->QRZ_Sent_today; + $QSLBreakdown['QRZ_Received_today'] = $row->QRZ_Received_today; + } - return $QSLBreakdown; - } else { - $QSLBreakdown['QSL_Sent'] = 0; - $QSLBreakdown['QSL_Received'] = 0; - $QSLBreakdown['QSL_Requested'] = 0; - $QSLBreakdown['eQSL_Sent'] = 0; - $QSLBreakdown['eQSL_Received'] = 0; - $QSLBreakdown['LoTW_Sent'] = 0; - $QSLBreakdown['LoTW_Received'] = 0; - $QSLBreakdown['QRZ_Sent'] = 0; - $QSLBreakdown['QRZ_Received'] = 0; - $QSLBreakdown['QSL_Sent_today'] = 0; - $QSLBreakdown['QSL_Received_today'] = 0; - $QSLBreakdown['QSL_Requested_today'] = 0; - $QSLBreakdown['eQSL_Sent_today'] = 0; - $QSLBreakdown['eQSL_Received_today'] = 0; - $QSLBreakdown['LoTW_Sent_today'] = 0; - $QSLBreakdown['LoTW_Received_today'] = 0; - $QSLBreakdown['QRZ_Sent_today'] = 0; - $QSLBreakdown['QRZ_Received_today'] = 0; + return $QSLBreakdown; + } else { + $QSLBreakdown['QSL_Sent'] = 0; + $QSLBreakdown['QSL_Received'] = 0; + $QSLBreakdown['QSL_Requested'] = 0; + $QSLBreakdown['eQSL_Sent'] = 0; + $QSLBreakdown['eQSL_Received'] = 0; + $QSLBreakdown['LoTW_Sent'] = 0; + $QSLBreakdown['LoTW_Received'] = 0; + $QSLBreakdown['QRZ_Sent'] = 0; + $QSLBreakdown['QRZ_Received'] = 0; + $QSLBreakdown['QSL_Sent_today'] = 0; + $QSLBreakdown['QSL_Received_today'] = 0; + $QSLBreakdown['QSL_Requested_today'] = 0; + $QSLBreakdown['eQSL_Sent_today'] = 0; + $QSLBreakdown['eQSL_Received_today'] = 0; + $QSLBreakdown['LoTW_Sent_today'] = 0; + $QSLBreakdown['LoTW_Received_today'] = 0; + $QSLBreakdown['QRZ_Sent_today'] = 0; + $QSLBreakdown['QRZ_Received_today'] = 0; - return $QSLBreakdown; - } - } else { - $QSLBreakdown['QSL_Sent'] = 0; - $QSLBreakdown['QSL_Received'] = 0; - $QSLBreakdown['QSL_Requested'] = 0; - $QSLBreakdown['eQSL_Sent'] = 0; - $QSLBreakdown['eQSL_Received'] = 0; - $QSLBreakdown['LoTW_Sent'] = 0; - $QSLBreakdown['LoTW_Received'] = 0; - $QSLBreakdown['QRZ_Sent'] = 0; - $QSLBreakdown['QRZ_Received'] = 0; - $QSLBreakdown['QSL_Sent_today'] = 0; - $QSLBreakdown['QSL_Received_today'] = 0; - $QSLBreakdown['QSL_Requested_today'] = 0; - $QSLBreakdown['eQSL_Sent_today'] = 0; - $QSLBreakdown['eQSL_Received_today'] = 0; - $QSLBreakdown['LoTW_Sent_today'] = 0; - $QSLBreakdown['LoTW_Received_today'] = 0; - $QSLBreakdown['QRZ_Sent_today'] = 0; - $QSLBreakdown['QRZ_Received_today'] = 0; - - return $QSLBreakdown; + return $QSLBreakdown; } - } + } else { + $QSLBreakdown['QSL_Sent'] = 0; + $QSLBreakdown['QSL_Received'] = 0; + $QSLBreakdown['QSL_Requested'] = 0; + $QSLBreakdown['eQSL_Sent'] = 0; + $QSLBreakdown['eQSL_Received'] = 0; + $QSLBreakdown['LoTW_Sent'] = 0; + $QSLBreakdown['LoTW_Received'] = 0; + $QSLBreakdown['QRZ_Sent'] = 0; + $QSLBreakdown['QRZ_Received'] = 0; + $QSLBreakdown['QSL_Sent_today'] = 0; + $QSLBreakdown['QSL_Received_today'] = 0; + $QSLBreakdown['QSL_Requested_today'] = 0; + $QSLBreakdown['eQSL_Sent_today'] = 0; + $QSLBreakdown['eQSL_Received_today'] = 0; + $QSLBreakdown['LoTW_Sent_today'] = 0; + $QSLBreakdown['LoTW_Received_today'] = 0; + $QSLBreakdown['QRZ_Sent_today'] = 0; + $QSLBreakdown['QRZ_Received_today'] = 0; - /* Return total number of QSL Cards sent */ - function total_qsl_sent() { - $CI =& get_instance(); + return $QSLBreakdown; + } + } + + /* Return total number of QSL Cards sent */ + function total_qsl_sent() + { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!empty($logbooks_locations_array)) { + $this->db->select('count(COL_QSL_SENT) AS count'); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_QSL_SENT =', 'Y'); + + $query = $this->db->get($this->config->item('table_name')); + + $row = $query->row(); + + if ($row == null) { + return 0; + } else { + return $row->count; + } + } else { + return 0; + } + } + + /* Return total number of QSL Cards requested for printing - that means "requested" or "queued" */ + function total_qsl_requested() + { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!empty($logbooks_locations_array)) { + $this->db->select('count(COL_QSL_SENT) AS count'); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where_in('COL_QSL_SENT', array('Q', 'R')); + + $query = $this->db->get($this->config->item('table_name')); + + $row = $query->row(); + + if ($row == null) { + return 0; + } else { + return $row->count; + } + } else { + return 0; + } + } + + /* Return total number of QSL Cards received */ + function total_qsl_rcvd() + { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!empty($logbooks_locations_array)) { + $this->db->select('count(COL_QSL_RCVD) AS count'); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_QSL_RCVD =', 'Y'); + + $query = $this->db->get($this->config->item('table_name')); + + $row = $query->row(); + + if ($row == null) { + return 0; + } else { + return $row->count; + } + } else { + return 0; + } + } + + /* Return total number of eQSL Cards sent */ + function total_eqsl_sent() + { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!empty($logbooks_locations_array)) { + $this->db->select('count(COL_EQSL_QSL_SENT) AS count'); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_EQSL_QSL_SENT =', 'Y'); + + $query = $this->db->get($this->config->item('table_name')); + + $row = $query->row(); + + if ($row == null) { + return 0; + } else { + return $row->count; + } + } else { + return 0; + } + } + + /* Return total number of eQSL Cards received */ + function total_eqsl_rcvd() + { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!empty($logbooks_locations_array)) { + $this->db->select('count(COL_EQSL_QSL_RCVD) AS count'); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_EQSL_QSL_RCVD =', 'Y'); + + $query = $this->db->get($this->config->item('table_name')); + + $row = $query->row(); + + if ($row == null) { + return 0; + } else { + return $row->count; + } + } else { + return 0; + } + } + + /* Return total number of LoTW sent */ + function total_lotw_sent() + { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!empty($logbooks_locations_array)) { + $this->db->select('count(COL_LOTW_QSL_SENT) AS count'); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_LOTW_QSL_SENT =', 'Y'); + + $query = $this->db->get($this->config->item('table_name')); + + $row = $query->row(); + + if ($row == null) { + return 0; + } else { + return $row->count; + } + } else { + return 0; + } + } + + /* Return total number of LoTW received */ + function total_lotw_rcvd() + { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!empty($logbooks_locations_array)) { + $this->db->select('count(COL_LOTW_QSL_RCVD) AS count'); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_LOTW_QSL_RCVD =', 'Y'); + + $query = $this->db->get($this->config->item('table_name')); + + $row = $query->row(); + + if ($row == null) { + return 0; + } else { + return $row->count; + } + } else { + return 0; + } + } + + /* Return total number of countries worked */ + function total_countries() + { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!empty($logbooks_locations_array)) { + $this->db->select('DISTINCT (COL_COUNTRY)'); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_COUNTRY !=', 'Invalid'); + $this->db->where('COL_DXCC >', '0'); + $query = $this->db->get($this->config->item('table_name')); + + return $query->num_rows(); + } else { + return 0; + } + } + + /* Return total number of countries worked */ + function total_countries_current($StationLocationsArray = null) + { + if ($StationLocationsArray == null) { + $CI = &get_instance(); $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if(!empty($logbooks_locations_array)) { - $this->db->select('count(COL_QSL_SENT) AS count'); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_QSL_SENT =', 'Y'); - - $query = $this->db->get($this->config->item('table_name')); - - $row = $query->row(); - - if($row == null) { - return 0; - } else { - return $row->count; - } - } else { - return 0; - } + } else { + $logbooks_locations_array = $StationLocationsArray; } - /* Return total number of QSL Cards requested for printing - that means "requested" or "queued" */ - function total_qsl_requested() { - $CI =& get_instance(); + if (!empty($logbooks_locations_array)) { + $this->db->select('DISTINCT (' . $this->config->item('table_name') . '.COL_COUNTRY)'); + $this->db->join('dxcc_entities', 'dxcc_entities.adif = ' . $this->config->item('table_name') . '.col_dxcc'); + $this->db->where_in($this->config->item('table_name') . '.station_id', $logbooks_locations_array); + $this->db->where($this->config->item('table_name') . '.COL_COUNTRY !=', 'Invalid'); + $this->db->where('dxcc_entities.end is null'); + $query = $this->db->get($this->config->item('table_name')); + + return $query->num_rows(); + } else { + return 0; + } + } + + /* Return total number of countries confirmed with along with qsl types confirmed */ + function total_countries_confirmed($StationLocationsArray = null) + { + + if ($StationLocationsArray == null) { + $CI = &get_instance(); $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if(!empty($logbooks_locations_array)) { - $this->db->select('count(COL_QSL_SENT) AS count'); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where_in('COL_QSL_SENT', array('Q', 'R')); - - $query = $this->db->get($this->config->item('table_name')); - - $row = $query->row(); - - if($row == null) { - return 0; - } else { - return $row->count; - } - } else { - return 0; - } + } else { + $logbooks_locations_array = $StationLocationsArray; } - /* Return total number of QSL Cards received */ - function total_qsl_rcvd() { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if(!empty($logbooks_locations_array)) { - $this->db->select('count(COL_QSL_RCVD) AS count'); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_QSL_RCVD =', 'Y'); - - $query = $this->db->get($this->config->item('table_name')); - - $row = $query->row(); - - if($row == null) { - return 0; - } else { - return $row->count; - } - } else { - return 0; - } - } - - /* Return total number of eQSL Cards sent */ - function total_eqsl_sent() { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if(!empty($logbooks_locations_array)) { - $this->db->select('count(COL_EQSL_QSL_SENT) AS count'); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_EQSL_QSL_SENT =', 'Y'); - - $query = $this->db->get($this->config->item('table_name')); - - $row = $query->row(); - - if($row == null) { - return 0; - } else { - return $row->count; - } - } else { - return 0; - } - } - - /* Return total number of eQSL Cards received */ - function total_eqsl_rcvd() { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if(!empty($logbooks_locations_array)) { - $this->db->select('count(COL_EQSL_QSL_RCVD) AS count'); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_EQSL_QSL_RCVD =', 'Y'); - - $query = $this->db->get($this->config->item('table_name')); - - $row = $query->row(); - - if($row == null) { - return 0; - } else { - return $row->count; - } - } else { - return 0; - } - } - - /* Return total number of LoTW sent */ - function total_lotw_sent() { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if(!empty($logbooks_locations_array)) { - $this->db->select('count(COL_LOTW_QSL_SENT) AS count'); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_LOTW_QSL_SENT =', 'Y'); - - $query = $this->db->get($this->config->item('table_name')); - - $row = $query->row(); - - if($row == null) { - return 0; - } else { - return $row->count; - } - } else { - return 0; - } - } - - /* Return total number of LoTW received */ - function total_lotw_rcvd() { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if(!empty($logbooks_locations_array)) { - $this->db->select('count(COL_LOTW_QSL_RCVD) AS count'); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_LOTW_QSL_RCVD =', 'Y'); - - $query = $this->db->get($this->config->item('table_name')); - - $row = $query->row(); - - if($row == null) { - return 0; - } else { - return $row->count; - } - } else { - return 0; - } - } - - /* Return total number of countries worked */ - function total_countries() { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if(!empty($logbooks_locations_array)) { - $this->db->select('DISTINCT (COL_COUNTRY)'); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_COUNTRY !=', 'Invalid'); - $this->db->where('COL_DXCC >', '0'); - $query = $this->db->get($this->config->item('table_name')); - - return $query->num_rows(); - } else { - return 0; - } - } - - /* Return total number of countries worked */ - function total_countries_current($StationLocationsArray = null) { - if($StationLocationsArray == null) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - } else { - $logbooks_locations_array = $StationLocationsArray; - } - - if(!empty($logbooks_locations_array)) { - $this->db->select('DISTINCT ('.$this->config->item('table_name').'.COL_COUNTRY)'); - $this->db->join('dxcc_entities', 'dxcc_entities.adif = '.$this->config->item('table_name').'.col_dxcc'); - $this->db->where_in($this->config->item('table_name').'.station_id', $logbooks_locations_array); - $this->db->where($this->config->item('table_name').'.COL_COUNTRY !=', 'Invalid'); - $this->db->where('dxcc_entities.end is null'); - $query = $this->db->get($this->config->item('table_name')); - - return $query->num_rows(); - } else { - return 0; - } - } - - /* Return total number of countries confirmed with along with qsl types confirmed */ - function total_countries_confirmed($StationLocationsArray = null) { - - if($StationLocationsArray == null) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - } else { - $logbooks_locations_array = $StationLocationsArray; - } - - if(!empty($logbooks_locations_array)) { - $this->db->select('COUNT(DISTINCT COL_COUNTRY) as Countries_Worked, + if (!empty($logbooks_locations_array)) { + $this->db->select('COUNT(DISTINCT COL_COUNTRY) as Countries_Worked, COUNT(DISTINCT IF(COL_QSL_RCVD = "Y", COL_COUNTRY, NULL)) as Countries_Worked_QSL, COUNT(DISTINCT IF(COL_EQSL_QSL_RCVD = "Y", COL_COUNTRY, NULL)) as Countries_Worked_EQSL, COUNT(DISTINCT IF(COL_LOTW_QSL_RCVD = "Y", COL_COUNTRY, NULL)) as Countries_Worked_LOTW'); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_COUNTRY !=', 'Invalid'); - $this->db->where('COL_DXCC >', '0'); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_COUNTRY !=', 'Invalid'); + $this->db->where('COL_DXCC >', '0'); - if ($query = $this->db->get($this->config->item('table_name'))) - { - foreach ($query->result() as $row) - { - $CountriesBreakdown['Countries_Worked'] = $row->Countries_Worked; - $CountriesBreakdown['Countries_Worked_QSL'] = $row->Countries_Worked_QSL; - $CountriesBreakdown['Countries_Worked_EQSL'] = $row->Countries_Worked_EQSL; - $CountriesBreakdown['Countries_Worked_LOTW'] = $row->Countries_Worked_LOTW; - } - - return $CountriesBreakdown; - } - else - { - $CountriesBreakdown['Countries_Worked'] = 0; - $CountriesBreakdown['Countries_Worked_QSL'] = 0; - $CountriesBreakdown['Countries_Worked_EQSL'] = 0; - $CountriesBreakdown['Countries_Worked_LOTW'] = 0; - return $CountriesBreakdown; - } - } else { - $CountriesBreakdown['Countries_Worked'] = 0; - $CountriesBreakdown['Countries_Worked_QSL'] = 0; - $CountriesBreakdown['Countries_Worked_EQSL'] = 0; - $CountriesBreakdown['Countries_Worked_LOTW'] = 0; - return $CountriesBreakdown; - } + if ($query = $this->db->get($this->config->item('table_name'))) { + foreach ($query->result() as $row) { + $CountriesBreakdown['Countries_Worked'] = $row->Countries_Worked; + $CountriesBreakdown['Countries_Worked_QSL'] = $row->Countries_Worked_QSL; + $CountriesBreakdown['Countries_Worked_EQSL'] = $row->Countries_Worked_EQSL; + $CountriesBreakdown['Countries_Worked_LOTW'] = $row->Countries_Worked_LOTW; } - /* Return total number of countries confirmed with paper QSL */ - function total_countries_confirmed_paper() { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if(!empty($logbooks_locations_array)) { - $this->db->select('DISTINCT (COL_COUNTRY)'); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_COUNTRY !=', 'Invalid'); - $this->db->where('COL_DXCC >', '0'); - $this->db->where('COL_QSL_RCVD =', 'Y'); - $query = $this->db->get($this->config->item('table_name')); - - return $query->num_rows(); + return $CountriesBreakdown; } else { - return 0; + $CountriesBreakdown['Countries_Worked'] = 0; + $CountriesBreakdown['Countries_Worked_QSL'] = 0; + $CountriesBreakdown['Countries_Worked_EQSL'] = 0; + $CountriesBreakdown['Countries_Worked_LOTW'] = 0; + return $CountriesBreakdown; } + } else { + $CountriesBreakdown['Countries_Worked'] = 0; + $CountriesBreakdown['Countries_Worked_QSL'] = 0; + $CountriesBreakdown['Countries_Worked_EQSL'] = 0; + $CountriesBreakdown['Countries_Worked_LOTW'] = 0; + return $CountriesBreakdown; } + } - /* Return total number of countries confirmed with eQSL */ - function total_countries_confirmed_eqsl() { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + /* Return total number of countries confirmed with paper QSL */ + function total_countries_confirmed_paper() + { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - if(!empty($logbooks_locations_array)) { - $this->db->select('DISTINCT (COL_COUNTRY)'); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_COUNTRY !=', 'Invalid'); - $this->db->where('COL_DXCC >', '0'); - $this->db->where('COL_EQSL_QSL_RCVD =', 'Y'); - $query = $this->db->get($this->config->item('table_name')); + if (!empty($logbooks_locations_array)) { + $this->db->select('DISTINCT (COL_COUNTRY)'); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_COUNTRY !=', 'Invalid'); + $this->db->where('COL_DXCC >', '0'); + $this->db->where('COL_QSL_RCVD =', 'Y'); + $query = $this->db->get($this->config->item('table_name')); - return $query->num_rows(); - } else { - return 0; - } + return $query->num_rows(); + } else { + return 0; } + } - /* Return total number of countries confirmed with LoTW */ - function total_countries_confirmed_lotw() { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + /* Return total number of countries confirmed with eQSL */ + function total_countries_confirmed_eqsl() + { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - if(!empty($logbooks_locations_array)) { - $this->db->select('DISTINCT (COL_COUNTRY)'); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_COUNTRY !=', 'Invalid'); - $this->db->where('COL_DXCC >', '0'); - $this->db->where('COL_LOTW_QSL_RCVD =', 'Y'); - $query = $this->db->get($this->config->item('table_name')); + if (!empty($logbooks_locations_array)) { + $this->db->select('DISTINCT (COL_COUNTRY)'); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_COUNTRY !=', 'Invalid'); + $this->db->where('COL_DXCC >', '0'); + $this->db->where('COL_EQSL_QSL_RCVD =', 'Y'); + $query = $this->db->get($this->config->item('table_name')); - return $query->num_rows(); - } else { - return 0; - } + return $query->num_rows(); + } else { + return 0; } + } - /* Delete QSO based on the QSO ID */ - function delete($id) { - if ($this->check_qso_is_accessible($id)) { - $this->db->where('COL_PRIMARY_KEY', $id); - $this->db->delete($this->config->item('table_name')); - } else { - return; - } + /* Return total number of countries confirmed with LoTW */ + function total_countries_confirmed_lotw() + { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!empty($logbooks_locations_array)) { + $this->db->select('DISTINCT (COL_COUNTRY)'); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->where('COL_COUNTRY !=', 'Invalid'); + $this->db->where('COL_DXCC >', '0'); + $this->db->where('COL_LOTW_QSL_RCVD =', 'Y'); + $query = $this->db->get($this->config->item('table_name')); + + return $query->num_rows(); + } else { + return 0; + } + } + + /* Delete QSO based on the QSO ID */ + function delete($id) + { + if ($this->check_qso_is_accessible($id)) { + $this->db->where('COL_PRIMARY_KEY', $id); + $this->db->delete($this->config->item('table_name')); + } else { + return; + } } /* Used to check if the qso is already in the database */ - function import_check($datetime, $callsign, $band, $mode, $station_callsign) { - $mode=$this->get_main_mode_from_mode($mode); + function import_check($datetime, $callsign, $band, $mode, $station_callsign) + { + $mode = $this->get_main_mode_from_mode($mode); - $this->db->select('COL_PRIMARY_KEY, COL_TIME_ON, COL_CALL, COL_BAND'); - $this->db->where('COL_TIME_ON >= DATE_ADD(DATE_FORMAT("'.$datetime.'", \'%Y-%m-%d %H:%i\' ), INTERVAL -15 MINUTE )'); - $this->db->where('COL_TIME_ON <= DATE_ADD(DATE_FORMAT("'.$datetime.'", \'%Y-%m-%d %H:%i\' ), INTERVAL 15 MINUTE )'); - $this->db->where('COL_CALL', $callsign); - $this->db->where('COL_STATION_CALLSIGN', $station_callsign); - $this->db->where('COL_BAND', $band); - $this->db->where('COL_MODE', $mode); + $this->db->select('COL_PRIMARY_KEY, COL_TIME_ON, COL_CALL, COL_BAND'); + $this->db->where('COL_TIME_ON >= DATE_ADD(DATE_FORMAT("' . $datetime . '", \'%Y-%m-%d %H:%i\' ), INTERVAL -15 MINUTE )'); + $this->db->where('COL_TIME_ON <= DATE_ADD(DATE_FORMAT("' . $datetime . '", \'%Y-%m-%d %H:%i\' ), INTERVAL 15 MINUTE )'); + $this->db->where('COL_CALL', $callsign); + $this->db->where('COL_STATION_CALLSIGN', $station_callsign); + $this->db->where('COL_BAND', $band); + $this->db->where('COL_MODE', $mode); - $query = $this->db->get($this->config->item('table_name')); + $query = $this->db->get($this->config->item('table_name')); - if ($query->num_rows() > 0) - { - $ret = $query->row(); - return ["Found", $ret->COL_PRIMARY_KEY]; - } else { - return ["No Match", 0]; - } + if ($query->num_rows() > 0) { + $ret = $query->row(); + return ["Found", $ret->COL_PRIMARY_KEY]; + } else { + return ["No Match", 0]; } - - function qrz_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $station_callsign) { - - $data = array( - 'COL_QRZCOM_QSO_DOWNLOAD_DATE' => $qsl_date, - 'COL_QRZCOM_QSO_DOWNLOAD_STATUS' => $qsl_status, - ); - - - $this->db->where('date_format(COL_TIME_ON, \'%Y-%m-%d %H:%i\') = "'.$datetime.'"'); - $this->db->where('COL_CALL', $callsign); - $this->db->where('COL_BAND', $band); - $this->db->where('COL_STATION_CALLSIGN', $station_callsign); - - if ($this->db->update($this->config->item('table_name'), $data)) { - unset($data); - return "Updated"; - } else { - unset($data); - return "Not updated"; - } - - } -function lotw_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $state, $qsl_gridsquare, $qsl_vucc_grids, $iota, $cnty, $cqz, $ituz, $station_callsign) { + function qrz_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $station_callsign) + { - $data = array( + $data = array( + 'COL_QRZCOM_QSO_DOWNLOAD_DATE' => $qsl_date, + 'COL_QRZCOM_QSO_DOWNLOAD_STATUS' => $qsl_status, + ); + + + $this->db->where('date_format(COL_TIME_ON, \'%Y-%m-%d %H:%i\') = "' . $datetime . '"'); + $this->db->where('COL_CALL', $callsign); + $this->db->where('COL_BAND', $band); + $this->db->where('COL_STATION_CALLSIGN', $station_callsign); + + if ($this->db->update($this->config->item('table_name'), $data)) { + unset($data); + return "Updated"; + } else { + unset($data); + return "Not updated"; + } + } + + function lotw_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $state, $qsl_gridsquare, $qsl_vucc_grids, $iota, $cnty, $cqz, $ituz, $station_callsign) + { + + $data = array( 'COL_LOTW_QSLRDATE' => $qsl_date, 'COL_LOTW_QSL_RCVD' => $qsl_status, 'COL_LOTW_QSL_SENT' => 'Y' ); - if($state != "") { + if ($state != "") { $data['COL_STATE'] = $state; - } - if($iota != "") { + } + if ($iota != "") { $data['COL_IOTA'] = $iota; - } + } - if($cnty != "") { + if ($cnty != "") { $data['COL_CNTY'] = $cnty; - } + } - if($cqz != "") { + if ($cqz != "") { $data['COL_CQZ'] = $cqz; - } + } - if($ituz != "") { + if ($ituz != "") { $data['COL_ITUZ'] = $ituz; - } + } - // Check if QRZ or ClubLog is already uploaded. If so, set qso to reupload to qrz.com (M) or clublog - $qsql = "select COL_CLUBLOG_QSO_UPLOAD_STATUS as CL_STATE, COL_QRZCOM_QSO_UPLOAD_STATUS as QRZ_STATE from ".$this->config->item('table_name')." where COL_BAND=? and COL_CALL=? and COL_STATION_CALLSIGN=? and date_format(COL_TIME_ON, '%Y-%m-%d %H:%i') = ?"; - $query = $this->db->query($qsql, array($band, $callsign,$station_callsign,$datetime)); - $row = $query->row(); - if (($row->QRZ_STATE ?? '') == 'Y') { - $data['COL_QRZCOM_QSO_UPLOAD_STATUS'] = 'M'; - } - if (($row->CL_STATE ?? '') == 'Y') { - $data['COL_CLUBLOG_QSO_UPLOAD_STATUS'] = 'M'; - } + // Check if QRZ or ClubLog is already uploaded. If so, set qso to reupload to qrz.com (M) or clublog + $qsql = "select COL_CLUBLOG_QSO_UPLOAD_STATUS as CL_STATE, COL_QRZCOM_QSO_UPLOAD_STATUS as QRZ_STATE from " . $this->config->item('table_name') . " where COL_BAND=? and COL_CALL=? and COL_STATION_CALLSIGN=? and date_format(COL_TIME_ON, '%Y-%m-%d %H:%i') = ?"; + $query = $this->db->query($qsql, array($band, $callsign, $station_callsign, $datetime)); + $row = $query->row(); + if (($row->QRZ_STATE ?? '') == 'Y') { + $data['COL_QRZCOM_QSO_UPLOAD_STATUS'] = 'M'; + } + if (($row->CL_STATE ?? '') == 'Y') { + $data['COL_CLUBLOG_QSO_UPLOAD_STATUS'] = 'M'; + } - $this->db->where('date_format(COL_TIME_ON, \'%Y-%m-%d %H:%i\') = "'.$datetime.'"'); + $this->db->where('date_format(COL_TIME_ON, \'%Y-%m-%d %H:%i\') = "' . $datetime . '"'); $this->db->where('COL_CALL', $callsign); $this->db->where('COL_BAND', $band); $this->db->where('ifnull(COL_LOTW_QSL_RCVD,\'\') !=', $qsl_status); // Prevent QSO from beeing updated twice (or more) $this->db->where('COL_STATION_CALLSIGN', $station_callsign); $this->db->update($this->config->item('table_name'), $data); - unset($data); + unset($data); - if($qsl_gridsquare != "" || $qsl_vucc_grids != "") { + if ($qsl_gridsquare != "" || $qsl_vucc_grids != "") { $data = array( 'COL_DISTANCE' => 0 ); - $this->db->select('station_profile.station_gridsquare as station_gridsquare'); - $this->db->where('date_format(COL_TIME_ON, \'%Y-%m-%d %H:%i\') = "'.$datetime.'"'); - $this->db->where('COL_CALL', $callsign); - $this->db->where('COL_BAND', $band); - $this->db->join('station_profile', $this->config->item('table_name').'.station_id = station_profile.station_id', 'left outer'); - $this->db->limit(1); - $query = $this->db->get($this->config->item('table_name')); - $row = $query->row(); - $station_gridsquare = ''; - if (isset($row)) { - $station_gridsquare = $row->station_gridsquare; - } - if(!$this->load->is_loaded('Qra')) { - $this->load->library('Qra'); - } - if ($qsl_gridsquare != "") { - $data['COL_GRIDSQUARE'] = $qsl_gridsquare; - $data['COL_DISTANCE'] = $this->qra->distance($station_gridsquare, $qsl_gridsquare, 'K'); - } elseif ($qsl_vucc_grids != "") { - $data['COL_VUCC_GRIDS'] = $qsl_vucc_grids; - $data['COL_DISTANCE'] = $this->qra->distance($station_gridsquare, $qsl_vucc_grids, 'K'); - } + $this->db->select('station_profile.station_gridsquare as station_gridsquare'); + $this->db->where('date_format(COL_TIME_ON, \'%Y-%m-%d %H:%i\') = "' . $datetime . '"'); + $this->db->where('COL_CALL', $callsign); + $this->db->where('COL_BAND', $band); + $this->db->join('station_profile', $this->config->item('table_name') . '.station_id = station_profile.station_id', 'left outer'); + $this->db->limit(1); + $query = $this->db->get($this->config->item('table_name')); + $row = $query->row(); + $station_gridsquare = ''; + if (isset($row)) { + $station_gridsquare = $row->station_gridsquare; + } + if (!$this->load->is_loaded('Qra')) { + $this->load->library('Qra'); + } + if ($qsl_gridsquare != "") { + $data['COL_GRIDSQUARE'] = $qsl_gridsquare; + $data['COL_DISTANCE'] = $this->qra->distance($station_gridsquare, $qsl_gridsquare, 'K'); + } elseif ($qsl_vucc_grids != "") { + $data['COL_VUCC_GRIDS'] = $qsl_vucc_grids; + $data['COL_DISTANCE'] = $this->qra->distance($station_gridsquare, $qsl_vucc_grids, 'K'); + } - $this->db->where('date_format(COL_TIME_ON, \'%Y-%m-%d %H:%i\') = "'.$datetime.'"'); + $this->db->where('date_format(COL_TIME_ON, \'%Y-%m-%d %H:%i\') = "' . $datetime . '"'); $this->db->where('COL_CALL', $callsign); $this->db->where('COL_BAND', $band); @@ -3061,44 +3108,47 @@ function lotw_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $state return "Updated"; } - function qrz_last_qsl_date($user_id) { - $sql="SELECT date_format(MAX(COALESCE(COL_QRZCOM_QSO_DOWNLOAD_DATE, str_to_date('1900-01-01','%Y-%m-%d'))),'%Y-%m-%d') MAXDATE - FROM ".$this->config->item('table_name')." INNER JOIN station_profile ON (".$this->config->item('table_name').".station_id = station_profile.station_id) + function qrz_last_qsl_date($user_id) + { + $sql = "SELECT date_format(MAX(COALESCE(COL_QRZCOM_QSO_DOWNLOAD_DATE, str_to_date('1900-01-01','%Y-%m-%d'))),'%Y-%m-%d') MAXDATE + FROM " . $this->config->item('table_name') . " INNER JOIN station_profile ON (" . $this->config->item('table_name') . ".station_id = station_profile.station_id) WHERE station_profile.user_id=? and station_profile.qrzapikey is not null and COL_QRZCOM_QSO_DOWNLOAD_DATE is not null"; - $query = $this->db->query($sql,$user_id); - $row = $query->row(); - if (isset($row) && ($row->MAXDATE ?? '' != '')) { - return $row->MAXDATE; - } else { - return '1900-01-01'; - } + $query = $this->db->query($sql, $user_id); + $row = $query->row(); + if (isset($row) && ($row->MAXDATE ?? '' != '')) { + return $row->MAXDATE; + } else { + return '1900-01-01'; + } } -function lotw_last_qsl_date($user_id) { - $sql="SELECT MAX(COALESCE(COL_LOTW_QSLRDATE, '1900-01-01 00:00:00')) MAXDATE - FROM ".$this->config->item('table_name')." INNER JOIN station_profile ON (".$this->config->item('table_name').".station_id = station_profile.station_id) - WHERE station_profile.user_id=".$user_id." and COL_LOTW_QSLRDATE is not null"; - $query = $this->db->query($sql); - $row = $query->row(); + function lotw_last_qsl_date($user_id) + { + $sql = "SELECT MAX(COALESCE(COL_LOTW_QSLRDATE, '1900-01-01 00:00:00')) MAXDATE + FROM " . $this->config->item('table_name') . " INNER JOIN station_profile ON (" . $this->config->item('table_name') . ".station_id = station_profile.station_id) + WHERE station_profile.user_id=" . $user_id . " and COL_LOTW_QSLRDATE is not null"; + $query = $this->db->query($sql); + $row = $query->row(); - if (isset($row)) { - return $row->MAXDATE; - } + if (isset($row)) { + return $row->MAXDATE; + } - return '1900-01-01 00:00:00.000'; + return '1900-01-01 00:00:00.000'; } - function import_bulk($records, $station_id = "0", $skipDuplicate = false, $markClublog = false, $markLotw = false, $dxccAdif = false, $markQrz = false, $markHrd = false,$skipexport = false, $operatorName = false, $apicall = false, $skipStationCheck = false) { - $custom_errors=''; - foreach ($records as $record) { - $one_error = $this->logbook_model->import($record, $station_id, $skipDuplicate, $markClublog, $markLotw,$dxccAdif, $markQrz, $markHrd, $skipexport, $operatorName, $apicall, $skipStationCheck); - if ($one_error != '') { - $custom_errors.=$one_error."
"; - } - } - return $custom_errors; + function import_bulk($records, $station_id = "0", $skipDuplicate = false, $markClublog = false, $markLotw = false, $dxccAdif = false, $markQrz = false, $markHrd = false, $skipexport = false, $operatorName = false, $apicall = false, $skipStationCheck = false) + { + $custom_errors = ''; + foreach ($records as $record) { + $one_error = $this->logbook_model->import($record, $station_id, $skipDuplicate, $markClublog, $markLotw, $dxccAdif, $markQrz, $markHrd, $skipexport, $operatorName, $apicall, $skipStationCheck); + if ($one_error != '') { + $custom_errors .= $one_error . "
"; + } + } + return $custom_errors; } - /* + /* * $skipDuplicate - used in ADIF import to skip duplicate checking when importing QSOs * $markLoTW - used in ADIF import to mark QSOs as exported to LoTW when importing QSOs * $dxccAdif - used in ADIF import to determine if DXCC From ADIF is used, or if Cloudlog should try to guess @@ -3106,787 +3156,791 @@ function lotw_last_qsl_date($user_id) { * $markHrd - used in ADIF import to mark QSOs as exported to HRDLog.net Logbook when importing QSOs * $skipexport - used in ADIF import to skip the realtime upload to QRZ Logbook when importing QSOs from ADIF */ - function import($record, $station_id = "0", $skipDuplicate = false, $markClublog = false, $markLotw = false, $dxccAdif = false, $markQrz = false, $markHrd = false,$skipexport = false, $operatorName = false, $apicall = false, $skipStationCheck = false) { - // be sure that station belongs to user - $this->load->model('stations'); - if (!$this->stations->check_station_is_accessible($station_id) && $apicall == false ) { - return 'Station not accessible
'; - } + function import($record, $station_id = "0", $skipDuplicate = false, $markClublog = false, $markLotw = false, $dxccAdif = false, $markQrz = false, $markHrd = false, $skipexport = false, $operatorName = false, $apicall = false, $skipStationCheck = false) + { + // be sure that station belongs to user + $this->load->model('stations'); + if (!$this->stations->check_station_is_accessible($station_id) && $apicall == false) { + return 'Station not accessible
'; + } - $station_profile=$this->stations->profile_clean($station_id); - $station_profile_call=$station_profile->station_callsign; + $station_profile = $this->stations->profile_clean($station_id); + $station_profile_call = $station_profile->station_callsign; - if (($station_id !=0 ) && (!(isset($record['station_callsign'])))) { - $record['station_callsign']=$station_profile_call; - } + if (($station_id != 0) && (!(isset($record['station_callsign'])))) { + $record['station_callsign'] = $station_profile_call; + } - if ((!$skipStationCheck) && ($station_id != 0) && (strtoupper($record['station_callsign']) != strtoupper($station_profile_call))) { // Check if station_call from import matches profile ONLY when submitting via GUI. - return "Wrong station callsign \"".htmlentities($record['station_callsign'])."\" while importing QSO with ".$record['call']." for ".$station_profile_call." : SKIPPED" . - "
See the
Cloudlog Wiki for hints about errors in ADIF files."; - } + if ((!$skipStationCheck) && ($station_id != 0) && (strtoupper($record['station_callsign']) != strtoupper($station_profile_call))) { // Check if station_call from import matches profile ONLY when submitting via GUI. + return "Wrong station callsign \"" . htmlentities($record['station_callsign']) . "\" while importing QSO with " . $record['call'] . " for " . $station_profile_call . " : SKIPPED" . + "
See the Cloudlog Wiki for hints about errors in ADIF files."; + } - $this->load->library('frequency'); - $my_error = ""; + $this->load->library('frequency'); + $my_error = ""; - // Join date+time - $time_on = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i:s', strtotime($record['time_on'])); + // Join date+time + $time_on = date('Y-m-d', strtotime($record['qso_date'])) . " " . date('H:i:s', strtotime($record['time_on'])); - if (isset($record['time_off'])) { - if (isset($record['date_off'])) { - // date_off and time_off set - $time_off = date('Y-m-d', strtotime($record['date_off'])) . ' ' . date('H:i:s', strtotime($record['time_off'])); - } elseif (strtotime($record['time_off']) < strtotime($record['time_on'])) { - // date_off is not set, QSO ends next day - $time_off = date('Y-m-d', strtotime($record['qso_date'] . ' + 1 day')) . ' ' . date('H:i:s', strtotime($record['time_off'])); - } else { - // date_off is not set, QSO ends same day - $time_off = date('Y-m-d', strtotime($record['qso_date'])) . ' ' . date('H:i:s', strtotime($record['time_off'])); - } - } else { - // date_off and time_off not set, QSO end == QSO start - $time_off = $time_on; - } + if (isset($record['time_off'])) { + if (isset($record['date_off'])) { + // date_off and time_off set + $time_off = date('Y-m-d', strtotime($record['date_off'])) . ' ' . date('H:i:s', strtotime($record['time_off'])); + } elseif (strtotime($record['time_off']) < strtotime($record['time_on'])) { + // date_off is not set, QSO ends next day + $time_off = date('Y-m-d', strtotime($record['qso_date'] . ' + 1 day')) . ' ' . date('H:i:s', strtotime($record['time_off'])); + } else { + // date_off is not set, QSO ends same day + $time_off = date('Y-m-d', strtotime($record['qso_date'])) . ' ' . date('H:i:s', strtotime($record['time_off'])); + } + } else { + // date_off and time_off not set, QSO end == QSO start + $time_off = $time_on; + } - // Store Freq - // Check if 'freq' is defined in the import? - if (isset($record['freq'])){ // record[freq] in MHz - $freq = floatval($record['freq']) * 1E6; // store in Hz - } else { - $freq = 0; - } + // Store Freq + // Check if 'freq' is defined in the import? + if (isset($record['freq'])) { // record[freq] in MHz + $freq = floatval($record['freq']) * 1E6; // store in Hz + } else { + $freq = 0; + } - // Check for RX Freq - // Check if 'freq' is defined in the import? - if (isset($record['freq_rx'])){ // record[freq] in MHz - $freqRX = floatval($record['freq_rx']) * 1E6; // store in Hz - } else { - $freqRX = NULL; - } + // Check for RX Freq + // Check if 'freq' is defined in the import? + if (isset($record['freq_rx'])) { // record[freq] in MHz + $freqRX = floatval($record['freq_rx']) * 1E6; // store in Hz + } else { + $freqRX = NULL; + } - // Store Band - if(isset($record['band'])) { - $band = strtolower($record['band']); - } else { - if (isset($record['freq'])){ - if($freq != "0") { - $band = $this->frequency->GetBand($freq); - } - } - } + // Store Band + if (isset($record['band'])) { + $band = strtolower($record['band']); + } else { + if (isset($record['freq'])) { + if ($freq != "0") { + $band = $this->frequency->GetBand($freq); + } + } + } - if(isset($record['band_rx'])) { - $band_rx = strtolower($record['band_rx']); - } else { - if (isset($record['freq_rx'])){ - if($freq != "0") { - $band_rx = $this->frequency->GetBand($freqRX); - } - } else { - $band_rx = ""; - } - } + if (isset($record['band_rx'])) { + $band_rx = strtolower($record['band_rx']); + } else { + if (isset($record['freq_rx'])) { + if ($freq != "0") { + $band_rx = $this->frequency->GetBand($freqRX); + } + } else { + $band_rx = ""; + } + } - if (isset($record['mode'])) { - $input_mode = $record['mode']; - } else { - $input_mode = ''; - } + if (isset($record['mode'])) { + $input_mode = $record['mode']; + } else { + $input_mode = ''; + } - $mode = $this->get_main_mode_if_submode($input_mode); - if ($mode == null) { - $submode = null; - } else { - $submode = $input_mode; - $input_mode = $mode; - } + $mode = $this->get_main_mode_if_submode($input_mode); + if ($mode == null) { + $submode = null; + } else { + $submode = $input_mode; + $input_mode = $mode; + } - if (empty($submode)) { - $input_submode = (!empty($record['submode'])) ? $record['submode'] : ''; - } else { - $input_submode = $submode; - } + if (empty($submode)) { + $input_submode = (!empty($record['submode'])) ? $record['submode'] : ''; + } else { + $input_submode = $submode; + } - // Check if QSO is already in the database - if ($skipDuplicate != NULL) { - $skip = false; - } else { - if (isset($record['call'])){ - $this->db->where('COL_CALL', $record['call']); - } - $this->db->where("DATE_FORMAT(COL_TIME_ON, '%Y-%m-%d %H:%i') = DATE_FORMAT(\"".$time_on."\", '%Y-%m-%d %H:%i')"); - $this->db->where('COL_BAND', $band); - $this->db->where('COL_MODE', $input_mode); - $this->db->where('station_id', $station_id); - $check = $this->db->get($this->config->item('table_name')); + // Check if QSO is already in the database + if ($skipDuplicate != NULL) { + $skip = false; + } else { + if (isset($record['call'])) { + $this->db->where('COL_CALL', $record['call']); + } + $this->db->where("DATE_FORMAT(COL_TIME_ON, '%Y-%m-%d %H:%i') = DATE_FORMAT(\"" . $time_on . "\", '%Y-%m-%d %H:%i')"); + $this->db->where('COL_BAND', $band); + $this->db->where('COL_MODE', $input_mode); + $this->db->where('station_id', $station_id); + $check = $this->db->get($this->config->item('table_name')); - // If dupe is not found, set variable to add QSO - if ($check->num_rows() <= 0) { - $skip = false; - } else { - $skip = true; - } - } + // If dupe is not found, set variable to add QSO + if ($check->num_rows() <= 0) { + $skip = false; + } else { + $skip = true; + } + } - if (!($skip)) { - // DXCC id - if (isset($record['call'])){ - if ($dxccAdif != NULL) { - if (isset($record['dxcc'])) { - $entity = $this->get_entity($record['dxcc']); - $dxcc = array($record['dxcc'], $entity['name']); - } else { - $dxcc = $this->check_dxcc_table($record['call'], $time_off); - } - } else { - $dxcc = $this->check_dxcc_table($record['call'], $time_off); - } - } else { - $dxcc = NULL; - } + if (!($skip)) { + // DXCC id + if (isset($record['call'])) { + if ($dxccAdif != NULL) { + if (isset($record['dxcc'])) { + $entity = $this->get_entity($record['dxcc']); + $dxcc = array($record['dxcc'], $entity['name']); + } else { + $dxcc = $this->check_dxcc_table($record['call'], $time_off); + } + } else { + $dxcc = $this->check_dxcc_table($record['call'], $time_off); + } + } else { + $dxcc = NULL; + } - // Store or find country name - // dxcc has higher priority to be consistent with qso create and edit - if (isset($dxcc[1])) { - $country = ucwords(strtolower($dxcc[1]), "- (/"); - } else if (isset($record['country'])) { - $country = $record['country']; - } + // Store or find country name + // dxcc has higher priority to be consistent with qso create and edit + if (isset($dxcc[1])) { + $country = ucwords(strtolower($dxcc[1]), "- (/"); + } else if (isset($record['country'])) { + $country = $record['country']; + } - // RST recevied - if(isset($record['rst_rcvd'])) { - $rst_rx = $record['rst_rcvd']; - } else { - $rst_rx = "59"; - } + // RST recevied + if (isset($record['rst_rcvd'])) { + $rst_rx = $record['rst_rcvd']; + } else { + $rst_rx = "59"; + } - // RST Sent - if(isset($record['rst_sent'])) { - $rst_tx = $record['rst_sent']; - } else { - $rst_tx = "59"; - } + // RST Sent + if (isset($record['rst_sent'])) { + $rst_tx = $record['rst_sent']; + } else { + $rst_tx = "59"; + } - if(isset($record['cqz'])) { - $cq_zone = $record['cqz']; - } elseif(isset($dxcc[2])) { - $cq_zone = $dxcc[2]; - } else { - $cq_zone = NULL; - } + if (isset($record['cqz'])) { + $cq_zone = $record['cqz']; + } elseif (isset($dxcc[2])) { + $cq_zone = $dxcc[2]; + } else { + $cq_zone = NULL; + } - // Sanitise gridsquare input to make sure its a gridsquare - if (isset($record['gridsquare'])){ - $a_grids=explode(',',$record['gridsquare']); // Split at , if there are junctions - foreach ($a_grids as $singlegrid) { - $singlegrid=strtoupper($singlegrid); - if (strlen($singlegrid) == 4) $singlegrid .= "LL"; // Only 4 Chars? Fill with center "LL" as only A-R allowed - if (strlen($singlegrid) == 6) $singlegrid .= "55"; // Only 6 Chars? Fill with center "55" - if (strlen($singlegrid) == 8) $singlegrid .= "LL"; // Only 8 Chars? Fill with center "LL" as only A-R allowed - if (strlen($singlegrid)%2 != 0) { // Check if grid is structually valid - $record['gridsquare']=''; // If not: Set to '' - } else { - if (!preg_match('/^[A-R]{2}[0-9]{2}[A-X]{2}[0-9]{2}[A-X]{2}$/', $singlegrid)) $record['gridsquare']=''; - } - } - $input_gridsquare = $record['gridsquare']; - } else { - $input_gridsquare = NULL; - } + // Sanitise gridsquare input to make sure its a gridsquare + if (isset($record['gridsquare'])) { + $a_grids = explode(',', $record['gridsquare']); // Split at , if there are junctions + foreach ($a_grids as $singlegrid) { + $singlegrid = strtoupper($singlegrid); + if (strlen($singlegrid) == 4) $singlegrid .= "LL"; // Only 4 Chars? Fill with center "LL" as only A-R allowed + if (strlen($singlegrid) == 6) $singlegrid .= "55"; // Only 6 Chars? Fill with center "55" + if (strlen($singlegrid) == 8) $singlegrid .= "LL"; // Only 8 Chars? Fill with center "LL" as only A-R allowed + if (strlen($singlegrid) % 2 != 0) { // Check if grid is structually valid + $record['gridsquare'] = ''; // If not: Set to '' + } else { + if (!preg_match('/^[A-R]{2}[0-9]{2}[A-X]{2}[0-9]{2}[A-X]{2}$/', $singlegrid)) $record['gridsquare'] = ''; + } + } + $input_gridsquare = $record['gridsquare']; + } else { + $input_gridsquare = NULL; + } - // Sanitise vucc-gridsquare input to make sure its a gridsquare - if (isset($record['vucc_grids'])){ - $a_grids=explode(',',$record['vucc_grids']); // Split at , if there are junctions - foreach ($a_grids as $singlegrid) { - $singlegrid=strtoupper(trim($singlegrid)); - if (strlen($singlegrid) == 4) $singlegrid .= "LL"; // Only 4 Chars? Fill with center "LL" as only A-R allowed - if (strlen($singlegrid) == 6) $singlegrid .= "55"; // Only 6 Chars? Fill with center "55" - if (strlen($singlegrid) == 8) $singlegrid .= "LL"; // Only 8 Chars? Fill with center "LL" as only A-R allowed - if (strlen($singlegrid)%2 != 0) { // Check if grid is structually valid - $record['vucc_grids']=''; // If not: Set to '' - } else { - if (!preg_match('/^[A-R]{2}[0-9]{2}[A-X]{2}[0-9]{2}[A-X]{2}$/', $singlegrid)) $record['vucc_grids']=''; - } - } - $input_vucc_grids = preg_replace('/\s+/', '', $record['vucc_grids']); - } else { - $input_vucc_grids = NULL; - } + // Sanitise vucc-gridsquare input to make sure its a gridsquare + if (isset($record['vucc_grids'])) { + $a_grids = explode(',', $record['vucc_grids']); // Split at , if there are junctions + foreach ($a_grids as $singlegrid) { + $singlegrid = strtoupper(trim($singlegrid)); + if (strlen($singlegrid) == 4) $singlegrid .= "LL"; // Only 4 Chars? Fill with center "LL" as only A-R allowed + if (strlen($singlegrid) == 6) $singlegrid .= "55"; // Only 6 Chars? Fill with center "55" + if (strlen($singlegrid) == 8) $singlegrid .= "LL"; // Only 8 Chars? Fill with center "LL" as only A-R allowed + if (strlen($singlegrid) % 2 != 0) { // Check if grid is structually valid + $record['vucc_grids'] = ''; // If not: Set to '' + } else { + if (!preg_match('/^[A-R]{2}[0-9]{2}[A-X]{2}[0-9]{2}[A-X]{2}$/', $singlegrid)) $record['vucc_grids'] = ''; + } + } + $input_vucc_grids = preg_replace('/\s+/', '', $record['vucc_grids']); + } else { + $input_vucc_grids = NULL; + } - // Sanitise lat input to make sure its 11 chars - if (isset($record['lat'])){ - $input_lat = mb_strimwidth($record['lat'], 0, 11); - }else{ - $input_lat = NULL; - } + // Sanitise lat input to make sure its 11 chars + if (isset($record['lat'])) { + $input_lat = mb_strimwidth($record['lat'], 0, 11); + } else { + $input_lat = NULL; + } - // Sanitise lon input to make sure its 11 chars - if (isset($record['lon'])){ - $input_lon = mb_strimwidth($record['lon'], 0, 11); - }else{ - $input_lon = NULL; - } + // Sanitise lon input to make sure its 11 chars + if (isset($record['lon'])) { + $input_lon = mb_strimwidth($record['lon'], 0, 11); + } else { + $input_lon = NULL; + } - // Sanitise my_lat input to make sure its 11 chars - if (isset($record['my_lat'])){ - $input_my_lat = mb_strimwidth($record['my_lat'], 0, 11); - }else{ - $input_my_lat = NULL; - } + // Sanitise my_lat input to make sure its 11 chars + if (isset($record['my_lat'])) { + $input_my_lat = mb_strimwidth($record['my_lat'], 0, 11); + } else { + $input_my_lat = NULL; + } - // Sanitise my_lon input to make sure its 11 chars - if (isset($record['my_lon'])){ - $input_my_lon = mb_strimwidth($record['my_lon'], 0, 11); - }else{ - $input_my_lon = NULL; - } + // Sanitise my_lon input to make sure its 11 chars + if (isset($record['my_lon'])) { + $input_my_lon = mb_strimwidth($record['my_lon'], 0, 11); + } else { + $input_my_lon = NULL; + } - // Sanitise TX_POWER - if (isset($record['tx_pwr'])){ - $tx_pwr = filter_var($record['tx_pwr'],FILTER_VALIDATE_FLOAT); - }else{ - $tx_pwr = NULL; - } + // Sanitise TX_POWER + if (isset($record['tx_pwr'])) { + $tx_pwr = filter_var($record['tx_pwr'], FILTER_VALIDATE_FLOAT); + } else { + $tx_pwr = NULL; + } - // Sanitise RX Power - if (isset($record['rx_pwr'])){ - // Check if RX_PWR is "K" which N1MM+ uses to indicate 1000W - if($record['rx_pwr'] == "K") { - $rx_pwr = 1000; - } else { - $rx_pwr = filter_var($record['rx_pwr'],FILTER_VALIDATE_FLOAT); - } - }else{ - $rx_pwr = NULL; - } + // Sanitise RX Power + if (isset($record['rx_pwr'])) { + // Check if RX_PWR is "K" which N1MM+ uses to indicate 1000W + if ($record['rx_pwr'] == "K") { + $rx_pwr = 1000; + } else { + $rx_pwr = filter_var($record['rx_pwr'], FILTER_VALIDATE_FLOAT); + } + } else { + $rx_pwr = NULL; + } - if (isset($record['a_index'])){ - $input_a_index = filter_var($record['a_index'],FILTER_SANITIZE_NUMBER_INT); - } else { - $input_a_index = NULL; - } + if (isset($record['a_index'])) { + $input_a_index = filter_var($record['a_index'], FILTER_SANITIZE_NUMBER_INT); + } else { + $input_a_index = NULL; + } - if (isset($record['age'])){ - $input_age = filter_var($record['age'],FILTER_SANITIZE_NUMBER_INT); - } else { - $input_age = NULL; - } + if (isset($record['age'])) { + $input_age = filter_var($record['age'], FILTER_SANITIZE_NUMBER_INT); + } else { + $input_age = NULL; + } - if (isset($record['ant_az'])){ - $input_ant_az = filter_var($record['ant_az'],FILTER_SANITIZE_NUMBER_INT); - } else { - $input_ant_az = NULL; - } + if (isset($record['ant_az'])) { + $input_ant_az = filter_var($record['ant_az'], FILTER_SANITIZE_NUMBER_INT); + } else { + $input_ant_az = NULL; + } - if (isset($record['ant_el'])){ - $input_ant_el = filter_var($record['ant_el'],FILTER_SANITIZE_NUMBER_INT); - } else { - $input_ant_el = NULL; - } + if (isset($record['ant_el'])) { + $input_ant_el = filter_var($record['ant_el'], FILTER_SANITIZE_NUMBER_INT); + } else { + $input_ant_el = NULL; + } - if (isset($record['ant_path'])){ - $input_ant_path = mb_strimwidth($record['ant_path'], 0, 1); - } else { - $input_ant_path = NULL; - } + if (isset($record['ant_path'])) { + $input_ant_path = mb_strimwidth($record['ant_path'], 0, 1); + } else { + $input_ant_path = NULL; + } - /* + /* Validate QSL Fields qslrdate, qslsdate */ - if (isset($record['qslrdate'])){ - if(validateADIFDate($record['qslrdate']) == true){ - $input_qslrdate = $record['qslrdate']; - } else { - $input_qslrdate = NULL; - $my_error .= "Error QSO: Date: ".$time_on." Callsign: ".$record['call']." the qslrdate is invalid (YYYYMMDD): ".$record['qslrdate']."
"; - } - } else { - $input_qslrdate = NULL; - } + if (isset($record['qslrdate'])) { + if (validateADIFDate($record['qslrdate']) == true) { + $input_qslrdate = $record['qslrdate']; + } else { + $input_qslrdate = NULL; + $my_error .= "Error QSO: Date: " . $time_on . " Callsign: " . $record['call'] . " the qslrdate is invalid (YYYYMMDD): " . $record['qslrdate'] . "
"; + } + } else { + $input_qslrdate = NULL; + } - if (isset($record['qslsdate'])){ - if(validateADIFDate($record['qslsdate']) == true){ - $input_qslsdate = $record['qslsdate']; - } else { - $input_qslsdate = NULL; - $my_error .= "Error QSO: Date: ".$time_on." Callsign: ".$record['call']." the qslsdate is invalid (YYYYMMDD): ".$record['qslsdate']."
"; - } - } else { - $input_qslsdate = NULL; - } + if (isset($record['qslsdate'])) { + if (validateADIFDate($record['qslsdate']) == true) { + $input_qslsdate = $record['qslsdate']; + } else { + $input_qslsdate = NULL; + $my_error .= "Error QSO: Date: " . $time_on . " Callsign: " . $record['call'] . " the qslsdate is invalid (YYYYMMDD): " . $record['qslsdate'] . "
"; + } + } else { + $input_qslsdate = NULL; + } - if (isset($record['qsl_rcvd'])){ - $input_qsl_rcvd = mb_strimwidth($record['qsl_rcvd'], 0, 1); - } else { - $input_qsl_rcvd = "N"; - } + if (isset($record['qsl_rcvd'])) { + $input_qsl_rcvd = mb_strimwidth($record['qsl_rcvd'], 0, 1); + } else { + $input_qsl_rcvd = "N"; + } - if (isset($record['qsl_rcvd_via'])){ - $input_qsl_rcvd_via = mb_strimwidth($record['qsl_rcvd_via'], 0, 1); - } else { - $input_qsl_rcvd_via = ""; - } + if (isset($record['qsl_rcvd_via'])) { + $input_qsl_rcvd_via = mb_strimwidth($record['qsl_rcvd_via'], 0, 1); + } else { + $input_qsl_rcvd_via = ""; + } - if (isset($record['qsl_sent'])){ - $input_qsl_sent = mb_strimwidth($record['qsl_sent'], 0, 1); - } else { - $input_qsl_sent = "N"; - } + if (isset($record['qsl_sent'])) { + $input_qsl_sent = mb_strimwidth($record['qsl_sent'], 0, 1); + } else { + $input_qsl_sent = "N"; + } - if (isset($record['qsl_sent_via'])){ - $input_qsl_sent_via = mb_strimwidth($record['qsl_sent_via'], 0, 1); - } else { - $input_qsl_sent_via = ""; - } + if (isset($record['qsl_sent_via'])) { + $input_qsl_sent_via = mb_strimwidth($record['qsl_sent_via'], 0, 1); + } else { + $input_qsl_sent_via = ""; + } - // Validate Clublog-Fields - if (isset($record['clublog_qso_upload_status'])){ - $input_clublog_qsl_sent = mb_strimwidth($record['clublog_qso_upload_status'], 0, 1); - } else if ($markClublog != NULL) { - $input_clublog_qsl_sent = "Y"; - } else { - $input_clublog_qsl_sent = NULL; - } + // Validate Clublog-Fields + if (isset($record['clublog_qso_upload_status'])) { + $input_clublog_qsl_sent = mb_strimwidth($record['clublog_qso_upload_status'], 0, 1); + } else if ($markClublog != NULL) { + $input_clublog_qsl_sent = "Y"; + } else { + $input_clublog_qsl_sent = NULL; + } - if (isset($record['clublog_qso_upload_date'])){ - if(validateADIFDate($record['clublog_qso_upload_date']) == true){ - $input_clublog_qslsdate = $record['clublog_qso_upload_date']; - } else { - $input_clublog_qslsdate = NULL; - $my_error .= "Error QSO: Date: ".$time_on." Callsign: ".$record['call']." the clublog_qso_upload_date is invalid (YYYYMMDD): ".$record['clublog_qso_upload_date']."
"; - } - } else { - $input_clublog_qslsdate = NULL; - } + if (isset($record['clublog_qso_upload_date'])) { + if (validateADIFDate($record['clublog_qso_upload_date']) == true) { + $input_clublog_qslsdate = $record['clublog_qso_upload_date']; + } else { + $input_clublog_qslsdate = NULL; + $my_error .= "Error QSO: Date: " . $time_on . " Callsign: " . $record['call'] . " the clublog_qso_upload_date is invalid (YYYYMMDD): " . $record['clublog_qso_upload_date'] . "
"; + } + } else { + $input_clublog_qslsdate = NULL; + } - /* + /* Validate LoTW Fields */ - if (isset($record['lotw_qsl_rcvd'])){ - $input_lotw_qsl_rcvd = mb_strimwidth($record['lotw_qsl_rcvd'], 0, 1); - } else { - $input_lotw_qsl_rcvd = NULL; - } + if (isset($record['lotw_qsl_rcvd'])) { + $input_lotw_qsl_rcvd = mb_strimwidth($record['lotw_qsl_rcvd'], 0, 1); + } else { + $input_lotw_qsl_rcvd = NULL; + } - if (isset($record['lotw_qslrdate'])){ - if(validateADIFDate($record['lotw_qslrdate']) == true){ - $input_lotw_qslrdate = $record['lotw_qslrdate']; - } else { - $input_lotw_qslrdate = NULL; - $my_error .= "Error QSO: Date: ".$time_on." Callsign: ".$record['call']." the lotw_qslrdate is invalid (YYYYMMDD): ".$record['lotw_qslrdate']."
"; - } - } else { - $input_lotw_qslrdate = NULL; - } - - if (isset($record['lotw_qsl_sent'])){ - $input_lotw_qsl_sent = mb_strimwidth($record['lotw_qsl_sent'], 0, 1); - } else if ($markLotw != NULL) { - $input_lotw_qsl_sent = "Y"; - } else { - $input_lotw_qsl_sent = NULL; - } - - if (isset($record['lotw_qslsdate'])){ - if(validateADIFDate($record['lotw_qslsdate']) == true){ - $input_lotw_qslsdate = $record['lotw_qslsdate']; - } else { - $input_lotw_qslsdate = NULL; - $my_error .= "Error QSO: Date: ".$time_on." Callsign: ".$record['call']." the lotw_qslsdate is invalid (YYYYMMDD): ".$record['lotw_qslsdate']."
"; - } - } else if ($markLotw != NULL) { - $input_lotw_qslsdate = $date = date("Y-m-d H:i:s", strtotime("now")); - } else { - $input_lotw_qslsdate = NULL; - } - - // Get active station_id from station profile if one hasn't been provided - if($station_id == "" || $station_id == "0") { - $this->load->model('stations'); - $station_id = $this->stations->find_active(); - } - - - if ($operatorName != false) { - $operatorName = $this->session->userdata('user_callsign'); - } else { - $operatorName = (!empty($record['operator'])) ? $record['operator'] : ''; - } - - // If user checked to mark QSOs as uploaded to QRZ or HRDLog Logbook, or else we try to find info in ADIF import. - if ($markHrd != null) { - $input_hrdlog_qso_upload_status = 'Y'; - $input_hrdlog_qso_upload_date = $date = date("Y-m-d H:i:s", strtotime("now")); - } else { - $input_hrdlog_qso_upload_date = (!empty($record['hrdlog_qso_upload_date'])) ? $record['hrdlog_qso_upload_date'] : null; - $input_hrdlog_qso_upload_status = (!empty($record['hrdlog_qso_upload_status'])) ? $record['hrdlog_qso_upload_status'] : ''; - } - - if ($markQrz != null) { - $input_qrzcom_qso_upload_status = 'Y'; - $input_qrzcom_qso_upload_date = $date = date("Y-m-d H:i:s", strtotime("now")); - } else { - $input_qrzcom_qso_upload_date = (!empty($record['qrzcom_qso_upload_date'])) ? $record['qrzcom_qso_upload_date'] : null; - $input_qrzcom_qso_upload_status = (!empty($record['qrzcom_qso_upload_status'])) ? $record['qrzcom_qso_upload_status'] : ''; - } - - // Create array with QSO Data use ?: - $data = array( - 'COL_A_INDEX' => $input_a_index, - 'COL_ADDRESS' => (!empty($record['address'])) ? $record['address'] : '', - 'COL_ADDRESS_INTL' => (!empty($record['address_intl'])) ? $record['address_intl'] : '', - 'COL_AGE' => $input_age, - 'COL_ANT_AZ' => $input_ant_az, - 'COL_ANT_EL' => $input_ant_el, - 'COL_ANT_PATH' => $input_ant_path, - 'COL_ARRL_SECT' => (!empty($record['arrl_sect'])) ? $record['arrl_sect'] : '', - 'COL_AWARD_GRANTED' => (!empty($record['award_granted'])) ? $record['award_granted'] : '', - 'COL_AWARD_SUBMITTED' => (!empty($record['award_submitted'])) ? $record['award_submitted'] : '', - 'COL_BAND' => $band, - 'COL_BAND_RX' => $band_rx, - 'COL_BIOGRAPHY' => (!empty($record['biography'])) ? $record['biography'] : '', - 'COL_CALL' => (!empty($record['call'])) ? strtoupper($record['call']) : '', - 'COL_CHECK' => (!empty($record['check'])) ? $record['check'] : '', - 'COL_CLASS' => (!empty($record['class'])) ? $record['class'] : '', - 'COL_CLUBLOG_QSO_UPLOAD_DATE' => $input_clublog_qslsdate, - 'COL_CLUBLOG_QSO_UPLOAD_STATUS' => $input_clublog_qsl_sent, - 'COL_CNTY' => (!empty($record['cnty'])) ? $record['cnty'] : '', - 'COL_COMMENT' => (!empty($record['comment'])) ? $record['comment'] : '', - 'COL_COMMENT_INTL' => (!empty($record['comment_intl'])) ? $record['comment_intl'] : '', - 'COL_CONT' => (!empty($record['cont'])) ? $record['cont'] : '', - 'COL_CONTACTED_OP' => (!empty($record['contacted_op'])) ? $record['contacted_op'] : '', - 'COL_CONTEST_ID' => (!empty($record['contest_id'])) ? $record['contest_id'] : '', - 'COL_COUNTRY' => $country, - 'COL_COUNTRY_INTL' => (!empty($record['country_intl'])) ? $record['country_intl'] : '', - 'COL_CQZ' => $cq_zone, - 'COL_CREDIT_GRANTED' => (!empty($record['credit_granted'])) ? $record['credit_granted'] : '', - 'COL_CREDIT_SUBMITTED' => (!empty($record['credit_submitted'])) ? $record['credit_submitted'] : '', - 'COL_DARC_DOK' => (!empty($record['darc_dok'])) ? strtoupper($record['darc_dok']) : '', - 'COL_DISTANCE' => (!empty($record['distance'])) ? $record['distance'] : null, - 'COL_DXCC' => $dxcc[0], - 'COL_EMAIL' => (!empty($record['email'])) ? $record['email'] : '', - 'COL_EQ_CALL' => (!empty($record['eq_call'])) ? $record['eq_call'] : '', - 'COL_EQSL_QSL_RCVD' => (!empty($record['eqsl_qsl_rcvd'])) ? $record['eqsl_qsl_rcvd'] : null, - 'COL_EQSL_QSL_SENT' => (!empty($record['eqsl_qsl_sent'])) ? $record['eqsl_qsl_sent'] : null, - 'COL_EQSL_QSLRDATE' => (!empty($record['eqsl_qslrdate'])) ? $record['eqsl_qslrdate'] : null, - 'COL_EQSL_QSLSDATE' => (!empty($record['eqsl_qslsdate'])) ? $record['eqsl_qslsdate'] : null, - 'COL_EQSL_STATUS' => (!empty($record['eqsl_status'])) ? $record['eqsl_status'] : '', - 'COL_FISTS' => (!empty($record['fists'])) ? $record['fists'] : null, - 'COL_FISTS_CC' => (!empty($record['fists_cc'])) ? $record['fists_cc'] : null, - 'COL_FORCE_INIT' => (!empty($record['force_init'])) ? $record['force_init'] : null, - 'COL_FREQ' => $freq, - 'COL_FREQ_RX' => (!empty($record['freq_rx'])) ? $freqRX : null, - 'COL_GRIDSQUARE' => $input_gridsquare, - 'COL_HEADING' => (!empty($record['heading'])) ? $record['heading'] : null, - 'COL_HRDLOG_QSO_UPLOAD_DATE' => (!empty($record['hrdlog_qso_upload_date'])) ? $record['hrdlog_qso_upload_date'] : null, - 'COL_HRDLOG_QSO_UPLOAD_STATUS' => (!empty($record['hrdlog_qso_upload_status'])) ? $record['hrdlog_qso_upload_status'] : '', - 'COL_IOTA' => (!empty($record['iota'])) ? $record['iota'] : '', - 'COL_ITUZ' => (!empty($record['ituz'])) ? $record['ituz'] : null, - 'COL_K_INDEX' => (!empty($record['k_index'])) ? $record['k_index'] : null, - 'COL_LAT' => $input_lat, - 'COL_LON' => $input_lon, - 'COL_LOTW_QSL_RCVD' => $input_lotw_qsl_rcvd, - 'COL_LOTW_QSL_SENT' => $input_lotw_qsl_sent, - 'COL_LOTW_QSLRDATE' => $input_lotw_qslrdate, - 'COL_LOTW_QSLSDATE' => $input_lotw_qslsdate, - 'COL_LOTW_STATUS' => (!empty($record['lotw_status'])) ? $record['lotw_status'] : '', - 'COL_MAX_BURSTS' => (!empty($record['max_bursts'])) ? $record['max_bursts'] : null, - 'COL_MODE' => $input_mode, - 'COL_MS_SHOWER' => (!empty($record['ms_shower'])) ? $record['ms_shower'] : '', - 'COL_MY_ANTENNA' => (!empty($record['my_antenna'])) ? $record['my_antenna'] : '', - 'COL_MY_ANTENNA_INTL' => (!empty($record['my_antenna_intl'])) ? $record['my_antenna_intl'] : '', - 'COL_MY_CITY' => (!empty($record['my_city'])) ? $record['my_city'] : '', - 'COL_MY_CITY_INTL' => (!empty($record['my_city_intl'])) ? $record['my_city_intl'] : '', - 'COL_MY_CNTY' => (!empty($record['my_cnty'])) ? $record['my_cnty'] : '', - 'COL_MY_COUNTRY' => (!empty($record['my_country'])) ? $record['my_country'] : '', - 'COL_MY_COUNTRY_INTL' => (!empty($record['my_country_intl'])) ? $record['my_country_intl'] : null, - 'COL_MY_CQ_ZONE' => (!empty($record['my_dxcc'])) ? $record['my_dxcc'] : null, - 'COL_MY_DXCC' => (!empty($record['my_dxcc'])) ? $record['my_dxcc'] : null, - 'COL_MY_FISTS' => (!empty($record['my_fists'])) ? $record['my_fists'] : null, - 'COL_MY_GRIDSQUARE' => (!empty($record['my_gridsquare'])) ? $record['my_gridsquare'] : '', - 'COL_MY_IOTA' => (!empty($record['my_iota'])) ? $record['my_iota'] : '', - 'COL_MY_IOTA_ISLAND_ID' => (!empty($record['my_iota_island_id'])) ? $record['my_iota_island_id'] : '', - 'COL_MY_ITU_ZONE' => (!empty($record['my_itu_zone'])) ? $record['my_itu_zone'] : null, - 'COL_MY_LAT' => $input_my_lat, - 'COL_MY_LON' => $input_my_lon, - 'COL_MY_NAME' => (!empty($record['my_name'])) ? $record['my_name'] : '', - 'COL_MY_NAME_INTL' => (!empty($record['my_name_intl'])) ? $record['my_name_intl'] : '', - 'COL_MY_POSTAL_CODE' => (!empty($record['my_postal_code'])) ? $record['my_postal_code'] : '', - 'COL_MY_POSTCODE_INTL' => (!empty($record['my_postcode_intl'])) ? $record['my_postcode_intl'] : '', - 'COL_MY_RIG' => (!empty($record['my_rig'])) ? $record['my_rig'] : '', - 'COL_MY_RIG_INTL' => (!empty($record['my_rig_intl'])) ? $record['my_rig_intl'] : '', - 'COL_MY_SIG' => (!empty($record['my_sig'])) ? $record['my_sig'] : '', - 'COL_MY_SIG_INFO' => (!empty($record['my_sig_info'])) ? $record['my_sig_info'] : '', - 'COL_MY_SIG_INFO_INTL' => (!empty($record['my_sig_info_intl'])) ? $record['my_sig_info_intl'] : '', - 'COL_MY_SIG_INTL' => (!empty($record['my_sig_intl'])) ? $record['my_sig_intl'] : '', - 'COL_MY_SOTA_REF' => (!empty($record['my_sota_ref'])) ? $record['my_sota_ref'] : '', - 'COL_MY_WWFF_REF' => (!empty($record['my_wwff_ref'])) ? $record['my_wwff_ref'] : '', - 'COL_MY_POTA_REF' => (!empty($record['my_pota_ref'])) ? $record['my_pota_ref'] : '', - 'COL_MY_STATE' => (!empty($record['my_state'])) ? $record['my_state'] : '', - 'COL_MY_STREET' => (!empty($record['my_street'])) ? $record['my_street'] : '', - 'COL_MY_STREET_INTL' => (!empty($record['my_street_intl'])) ? $record['my_street_intl'] : '', - 'COL_MY_USACA_COUNTIES' => (!empty($record['my_usaca_counties'])) ? $record['my_usaca_counties'] : '', - 'COL_MY_VUCC_GRIDS' => (!empty($record['my_vucc_grids'])) ? $record['my_vucc_grids'] : '', - 'COL_NAME' => (!empty($record['name'])) ? $record['name'] : '', - 'COL_NAME_INTL' => (!empty($record['name_intl'])) ? $record['name_intl']: '', - 'COL_NOTES' => (!empty($record['notes'])) ? $record['notes'] : '', - 'COL_NOTES_INTL' => (!empty($record['notes_intl'])) ? $record['notes_intl'] : '', - 'COL_NR_BURSTS' => (!empty($record['nr_bursts'])) ? $record['nr_bursts'] : null, - 'COL_NR_PINGS' => (!empty($record['nr_pings'])) ? $record['nr_pings'] : null, - 'COL_OPERATOR' => $operatorName, - 'COL_OWNER_CALLSIGN' => (!empty($record['owner_callsign'])) ? $record['owner_callsign'] : '', - 'COL_PFX' => (!empty($record['pfx'])) ? $record['pfx'] : '', - 'COL_PRECEDENCE' => (!empty($record['precedence'])) ? $record['precedence'] : '', - 'COL_PROP_MODE' => (!empty($record['prop_mode'])) ? $record['prop_mode'] : '', - 'COL_PUBLIC_KEY' => (!empty($record['public_key'])) ? $record['public_key'] : '', - 'COL_HRDLOG_QSO_UPLOAD_DATE' => $input_hrdlog_qso_upload_date, - 'COL_HRDLOG_QSO_UPLOAD_STATUS' => $input_hrdlog_qso_upload_status, - 'COL_QRZCOM_QSO_UPLOAD_DATE' => $input_qrzcom_qso_upload_date, - 'COL_QRZCOM_QSO_UPLOAD_STATUS' => $input_qrzcom_qso_upload_status, - 'COL_QSL_RCVD' => $input_qsl_rcvd, - 'COL_QSL_RCVD_VIA' => $input_qsl_rcvd_via, - 'COL_QSL_SENT' => $input_qsl_sent, - 'COL_QSL_SENT_VIA' => $input_qsl_sent_via, - 'COL_QSL_VIA' => (!empty($record['qsl_via'])) ? $record['qsl_via'] : '', - 'COL_QSLMSG' => (!empty($record['qslmsg'])) ? $record['qslmsg'] : '', - 'COL_QSLRDATE' => $input_qslrdate, - 'COL_QSLSDATE' => $input_qslsdate, - 'COL_QSO_COMPLETE' => (!empty($record['qso_complete'])) ? $record['qso_complete'] : '', - 'COL_QSO_DATE' => (!empty($record['qso_date'])) ? $record['qso_date'] : null, - 'COL_QSO_DATE_OFF' => (!empty($record['qso_date_off'])) ? $record['qso_date_off'] : null, - 'COL_QTH' => (!empty($record['qth'])) ? $record['qth'] : '', - 'COL_QTH_INTL' => (!empty($record['qth_intl'])) ? $record['qth_intl'] : '', - 'COL_REGION' => (!empty($record['region'])) ? $record['region'] : '', - 'COL_RIG' => (!empty($record['rig'])) ? $record['rig'] : '', - 'COL_RIG_INTL' => (!empty($record['rig_intl'])) ? $record['rig_intl'] : '', - 'COL_RST_RCVD' => $rst_rx, - 'COL_RST_SENT' => $rst_tx, - 'COL_RX_PWR' => $rx_pwr, - 'COL_SAT_MODE' => (!empty($record['sat_mode'])) ? $record['sat_mode'] : '', - 'COL_SAT_NAME' => (!empty($record['sat_name'])) ? $record['sat_name'] : '', - 'COL_SFI' => (!empty($record['sfi'])) ? $record['sfi'] : null, - 'COL_SIG' => (!empty($record['sig'])) ? $record['sig'] : '', - 'COL_SIG_INFO' => (!empty($record['sig_info'])) ? $record['sig_info'] : '', - 'COL_SIG_INFO_INTL' => (!empty($record['sig_info_intl'])) ? $record['sig_info_intl'] : '', - 'COL_SIG_INTL' => (!empty($record['sig_intl'])) ? $record['sig_intl'] : '', - 'COL_SILENT_KEY' => (!empty($record['silent_key'])) ? $record['silent_key'] : '', - 'COL_SKCC' => (!empty($record['skcc'])) ? $record['skcc'] : '', - 'COL_SOTA_REF' => (!empty($record['sota_ref'])) ? $record['sota_ref'] : '', - 'COL_WWFF_REF' => (!empty($record['wwff_ref'])) ? $record['wwff_ref'] : '', - 'COL_POTA_REF' => (!empty($record['pota_ref'])) ? $record['pota_ref'] : '', - 'COL_SRX' => (!empty($record['srx'])) ? (int)$record['srx'] : null, - //convert to integer to make sure no invalid entries are imported - 'COL_SRX_STRING' => (!empty($record['srx_string'])) ? $record['srx_string'] : '', - 'COL_STATE' => (!empty($record['state'])) ? strtoupper($record['state']) : '', - 'COL_STATION_CALLSIGN' => (!empty($record['station_callsign'])) ? $record['station_callsign'] : '', - //convert to integer to make sure no invalid entries are imported - 'COL_STX' => (!empty($record['stx'])) ? (int)$record['stx'] : null, - 'COL_STX_STRING' => (!empty($record['stx_string'])) ? $record['stx_string'] : '', - 'COL_SUBMODE' => $input_submode, - 'COL_SWL' => (!empty($record['swl'])) ? $record['swl'] : null, - 'COL_TEN_TEN' => (!empty($record['ten_ten'])) ? $record['ten_ten'] : null, - 'COL_TIME_ON' => $time_on, - 'COL_TIME_OFF' => $time_off, - 'COL_TX_PWR' => (!empty($tx_pwr)) ? $tx_pwr : null, - 'COL_UKSMG' => (!empty($record['uksmg'])) ? $record['uksmg'] : '', - 'COL_USACA_COUNTIES' => (!empty($record['usaca_counties'])) ? $record['usaca_counties'] : '', - 'COL_VUCC_GRIDS' => $input_vucc_grids, - 'COL_WEB' => (!empty($record['web'])) ? $record['web'] : '' - ); - - // Collect field information from the station profile table thats required for the QSO. - if($station_id != "0") { - $this->db->select('station_profile.*, dxcc_entities.name as station_country'); - $this->db->where('station_id', $station_id); - $this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif', 'left outer'); - $station_result = $this->db->get('station_profile'); - - if ($station_result->num_rows() > 0){ - $data['station_id'] = $station_id; - - $row = $station_result->row_array(); - - if (strpos(trim($row['station_gridsquare']), ',') !== false) { - $data['COL_MY_VUCC_GRIDS'] = strtoupper(trim($row['station_gridsquare'])); - } else { - $data['COL_MY_GRIDSQUARE'] = strtoupper(trim($row['station_gridsquare'])); - } - - $data['COL_MY_CITY'] = trim($row['station_city']); - $data['COL_MY_IOTA'] = strtoupper(trim($row['station_iota'])); - $data['COL_MY_SOTA_REF'] = strtoupper(trim($row['station_sota'])); - $data['COL_MY_WWFF_REF'] = strtoupper(trim($row['station_wwff'])); - $data['COL_MY_POTA_REF'] = $row['station_pota'] == null ? '' : strtoupper(trim($row['station_pota'])); - - $data['COL_STATION_CALLSIGN'] = strtoupper(trim($row['station_callsign'])); - $data['COL_MY_DXCC'] = strtoupper(trim($row['station_dxcc'])); - $data['COL_MY_COUNTRY'] = strtoupper(trim($row['station_country'])); - $data['COL_MY_CNTY'] = strtoupper(trim($row['station_cnty'])); - $data['COL_MY_CQ_ZONE'] = strtoupper(trim($row['station_cq'])); - $data['COL_MY_ITU_ZONE'] = strtoupper(trim($row['station_itu'])); - } - } - - // Save QSO - $this->add_qso($data, $skipexport); - } else { - $my_error .= "Date/Time: ".$time_on." Callsign: ".$record['call']." Band: ".$band." Duplicate
"; - } - - return $my_error; - } - - function update_dok($record, $ignoreAmbiguous, $onlyConfirmed, $overwriteDok) { - $this->load->model('logbooks_model'); - $custom_date_format = $this->session->userdata('user_date_format'); - $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - if(isset($record['call'])) { - $call = strtoupper($record['call']); + if (isset($record['lotw_qslrdate'])) { + if (validateADIFDate($record['lotw_qslrdate']) == true) { + $input_lotw_qslrdate = $record['lotw_qslrdate']; } else { - return array(3, 'Callsign not found'); + $input_lotw_qslrdate = NULL; + $my_error .= "Error QSO: Date: " . $time_on . " Callsign: " . $record['call'] . " the lotw_qslrdate is invalid (YYYYMMDD): " . $record['lotw_qslrdate'] . "
"; } + } else { + $input_lotw_qslrdate = NULL; + } - // Join date+time - $time_on = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i', strtotime($record['time_on'])); + if (isset($record['lotw_qsl_sent'])) { + $input_lotw_qsl_sent = mb_strimwidth($record['lotw_qsl_sent'], 0, 1); + } else if ($markLotw != NULL) { + $input_lotw_qsl_sent = "Y"; + } else { + $input_lotw_qsl_sent = NULL; + } - // Store Band - if(isset($record['band'])) { - $band = strtolower($record['band']); + if (isset($record['lotw_qslsdate'])) { + if (validateADIFDate($record['lotw_qslsdate']) == true) { + $input_lotw_qslsdate = $record['lotw_qslsdate']; } else { - if (isset($record['freq'])){ - if($record['freq'] != "0") { - $band = $this->frequency->GetBand($record['freq']); - } - } + $input_lotw_qslsdate = NULL; + $my_error .= "Error QSO: Date: " . $time_on . " Callsign: " . $record['call'] . " the lotw_qslsdate is invalid (YYYYMMDD): " . $record['lotw_qslsdate'] . "
"; } + } else if ($markLotw != NULL) { + $input_lotw_qslsdate = $date = date("Y-m-d H:i:s", strtotime("now")); + } else { + $input_lotw_qslsdate = NULL; + } - if (isset($record['mode'])) { - $mode = $record['mode']; - } else { - $mode = ''; - } + // Get active station_id from station profile if one hasn't been provided + if ($station_id == "" || $station_id == "0") { + $this->load->model('stations'); + $station_id = $this->stations->find_active(); + } - if (isset($record['darc_dok'])) { - $darc_dok = $record['darc_dok']; - } else { - $darc_dok = ''; - } - if ($darc_dok != '') { - $this->db->select('COL_PRIMARY_KEY, COL_DARC_DOK'); - $this->db->where('COL_CALL', $call); - $this->db->like('COL_TIME_ON', $time_on, 'after'); - $this->db->where('COL_BAND', $band); - $this->db->where('COL_MODE', $mode); - $this->db->where_in('station_id', $logbooks_locations_array); - $check = $this->db->get($this->config->item('table_name')); - if ($check->num_rows() != 1) { - if ($ignoreAmbiguous == '1') { - return array(); - } else { - return array(2, $result['message'] = "".date($custom_date_format, strtotime($record['qso_date']))."".date('H:i', strtotime($record['time_on']))."".str_replace('0', 'Ø', $call)."".$band."".$mode."".(preg_match('/^[A-Y]\d{2}$/', $darc_dok) ? ''.$darc_dok.'' : (preg_match('/^Z\d{2}$/', $darc_dok) ? ''.$darc_dok.'' : $darc_dok))."".lang('dcl_no_match').""); - } - } else { - $dcl_qsl_status = ''; - switch($record['app_dcl_status']) { - case 'c': - $dcl_qsl_status = lang('dcl_qsl_status_c'); - break; - case 'm': - case 'n': - case 'o': - $dcl_qsl_status = lang('dcl_qsl_status_mno'); - break; - case 'i': - $dcl_qsl_status = lang('dcl_qsl_status_i'); - break; - case 'w': - $dcl_qsl_status = lang('dcl_qsl_status_w'); - break; - case 'x': - $dcl_qsl_status = lang('dcl_qsl_status_x'); - break; - default: - $dcl_qsl_status = lang('dcl_qsl_status_unknown'); - } - if ($check->row()->COL_DARC_DOK != $darc_dok) { - $dcl_cnfm = array('c', 'm', 'n', 'o', 'i'); - // Ref https://confluence.darc.de/pages/viewpage.action?pageId=21037270 - if ($onlyConfirmed == '1') { - if (in_array($record['app_dcl_status'], $dcl_cnfm)) { - if ($check->row()->COL_DARC_DOK == '' || $overwriteDok == '1') { - $this->set_dok($check->row()->COL_PRIMARY_KEY, $darc_dok); - return array(0, ''); - } else { - return array(1, $result['message'] = "".date($custom_date_format, strtotime($record['qso_date']))."".date('H:i', strtotime($record['time_on']))."row()->COL_PRIMARY_KEY.")\">".str_replace('0', 'Ø', $call)."".$band."".$mode."".($check->row()->COL_DARC_DOK == '' ? 'n/a' : (preg_match('/^[A-Y]\d{2}$/', $check->row()->COL_DARC_DOK) ? ''.$check->row()->COL_DARC_DOK.'' : (preg_match('/^Z\d{2}$/', $check->row()->COL_DARC_DOK) ? ''.$check->row()->COL_DARC_DOK.'' : $check->row()->COL_DARC_DOK)))."".(preg_match('/^[A-Y]\d{2}$/', $darc_dok) ? ''.$darc_dok.'' : (preg_match('/^Z\d{2}$/', $darc_dok) ? ''.$darc_dok.'' : $darc_dok))."".$dcl_qsl_status.""); - } + if ($operatorName != false) { + $operatorName = $this->session->userdata('user_callsign'); + } else { + $operatorName = (!empty($record['operator'])) ? $record['operator'] : ''; + } - } else { - return array(1, $result['message'] = "".date($custom_date_format, strtotime($record['qso_date']))."".date('H:i', strtotime($record['time_on']))."row()->COL_PRIMARY_KEY.")\">".str_replace('0', 'Ø', $call)."".$band."".$mode."".($check->row()->COL_DARC_DOK == '' ? 'n/a' : (preg_match('/^[A-Y]\d{2}$/', $check->row()->COL_DARC_DOK) ? ''.$check->row()->COL_DARC_DOK.'' : (preg_match('/^Z\d{2}$/', $check->row()->COL_DARC_DOK) ? ''.$check->row()->COL_DARC_DOK.'' : $check->row()->COL_DARC_DOK)))."".(preg_match('/^[A-Y]\d{2}$/', $darc_dok) ? ''.$darc_dok.'' : (preg_match('/^Z\d{2}$/', $darc_dok) ? ''.$darc_dok.'' : $darc_dok))."".$dcl_qsl_status.""); - } - } else { - if ($check->row()->COL_DARC_DOK == '' || $overwriteDok == '1') { - $this->set_dok($check->row()->COL_PRIMARY_KEY, $darc_dok); - return array(0, ''); - } else { - return array(1, $result['message'] = "".date($custom_date_format, strtotime($record['qso_date']))."".date('H:i', strtotime($record['time_on']))."row()->COL_PRIMARY_KEY.")\">".str_replace('0', 'Ø', $call)."".$band."".$mode."".($check->row()->COL_DARC_DOK == '' ? 'n/a' : (preg_match('/^[A-Y]\d{2}$/', $check->row()->COL_DARC_DOK) ? ''.$check->row()->COL_DARC_DOK.'' : (preg_match('/^Z\d{2}$/', $check->row()->COL_DARC_DOK) ? ''.$check->row()->COL_DARC_DOK.'' : $check->row()->COL_DARC_DOK)))."".(preg_match('/^[A-Y]\d{2}$/', $darc_dok) ? ''.$darc_dok.'' : (preg_match('/^Z\d{2}$/', $darc_dok) ? ''.$darc_dok.'' : $darc_dok))."".$dcl_qsl_status.""); - } - } - } - } - } + // If user checked to mark QSOs as uploaded to QRZ or HRDLog Logbook, or else we try to find info in ADIF import. + if ($markHrd != null) { + $input_hrdlog_qso_upload_status = 'Y'; + $input_hrdlog_qso_upload_date = $date = date("Y-m-d H:i:s", strtotime("now")); + } else { + $input_hrdlog_qso_upload_date = (!empty($record['hrdlog_qso_upload_date'])) ? $record['hrdlog_qso_upload_date'] : null; + $input_hrdlog_qso_upload_status = (!empty($record['hrdlog_qso_upload_status'])) ? $record['hrdlog_qso_upload_status'] : ''; + } - } + if ($markQrz != null) { + $input_qrzcom_qso_upload_status = 'Y'; + $input_qrzcom_qso_upload_date = $date = date("Y-m-d H:i:s", strtotime("now")); + } else { + $input_qrzcom_qso_upload_date = (!empty($record['qrzcom_qso_upload_date'])) ? $record['qrzcom_qso_upload_date'] : null; + $input_qrzcom_qso_upload_status = (!empty($record['qrzcom_qso_upload_status'])) ? $record['qrzcom_qso_upload_status'] : ''; + } - function set_dok($key, $dok) { + // Create array with QSO Data use ?: $data = array( - 'COL_DARC_DOK' => $dok, + 'COL_A_INDEX' => $input_a_index, + 'COL_ADDRESS' => (!empty($record['address'])) ? $record['address'] : '', + 'COL_ADDRESS_INTL' => (!empty($record['address_intl'])) ? $record['address_intl'] : '', + 'COL_AGE' => $input_age, + 'COL_ANT_AZ' => $input_ant_az, + 'COL_ANT_EL' => $input_ant_el, + 'COL_ANT_PATH' => $input_ant_path, + 'COL_ARRL_SECT' => (!empty($record['arrl_sect'])) ? $record['arrl_sect'] : '', + 'COL_AWARD_GRANTED' => (!empty($record['award_granted'])) ? $record['award_granted'] : '', + 'COL_AWARD_SUBMITTED' => (!empty($record['award_submitted'])) ? $record['award_submitted'] : '', + 'COL_BAND' => $band, + 'COL_BAND_RX' => $band_rx, + 'COL_BIOGRAPHY' => (!empty($record['biography'])) ? $record['biography'] : '', + 'COL_CALL' => (!empty($record['call'])) ? strtoupper($record['call']) : '', + 'COL_CHECK' => (!empty($record['check'])) ? $record['check'] : '', + 'COL_CLASS' => (!empty($record['class'])) ? $record['class'] : '', + 'COL_CLUBLOG_QSO_UPLOAD_DATE' => $input_clublog_qslsdate, + 'COL_CLUBLOG_QSO_UPLOAD_STATUS' => $input_clublog_qsl_sent, + 'COL_CNTY' => (!empty($record['cnty'])) ? $record['cnty'] : '', + 'COL_COMMENT' => (!empty($record['comment'])) ? $record['comment'] : '', + 'COL_COMMENT_INTL' => (!empty($record['comment_intl'])) ? $record['comment_intl'] : '', + 'COL_CONT' => (!empty($record['cont'])) ? $record['cont'] : '', + 'COL_CONTACTED_OP' => (!empty($record['contacted_op'])) ? $record['contacted_op'] : '', + 'COL_CONTEST_ID' => (!empty($record['contest_id'])) ? $record['contest_id'] : '', + 'COL_COUNTRY' => $country, + 'COL_COUNTRY_INTL' => (!empty($record['country_intl'])) ? $record['country_intl'] : '', + 'COL_CQZ' => $cq_zone, + 'COL_CREDIT_GRANTED' => (!empty($record['credit_granted'])) ? $record['credit_granted'] : '', + 'COL_CREDIT_SUBMITTED' => (!empty($record['credit_submitted'])) ? $record['credit_submitted'] : '', + 'COL_DARC_DOK' => (!empty($record['darc_dok'])) ? strtoupper($record['darc_dok']) : '', + 'COL_DISTANCE' => (!empty($record['distance'])) ? $record['distance'] : null, + 'COL_DXCC' => $dxcc[0], + 'COL_EMAIL' => (!empty($record['email'])) ? $record['email'] : '', + 'COL_EQ_CALL' => (!empty($record['eq_call'])) ? $record['eq_call'] : '', + 'COL_EQSL_QSL_RCVD' => (!empty($record['eqsl_qsl_rcvd'])) ? $record['eqsl_qsl_rcvd'] : null, + 'COL_EQSL_QSL_SENT' => (!empty($record['eqsl_qsl_sent'])) ? $record['eqsl_qsl_sent'] : null, + 'COL_EQSL_QSLRDATE' => (!empty($record['eqsl_qslrdate'])) ? $record['eqsl_qslrdate'] : null, + 'COL_EQSL_QSLSDATE' => (!empty($record['eqsl_qslsdate'])) ? $record['eqsl_qslsdate'] : null, + 'COL_EQSL_STATUS' => (!empty($record['eqsl_status'])) ? $record['eqsl_status'] : '', + 'COL_FISTS' => (!empty($record['fists'])) ? $record['fists'] : null, + 'COL_FISTS_CC' => (!empty($record['fists_cc'])) ? $record['fists_cc'] : null, + 'COL_FORCE_INIT' => (!empty($record['force_init'])) ? $record['force_init'] : null, + 'COL_FREQ' => $freq, + 'COL_FREQ_RX' => (!empty($record['freq_rx'])) ? $freqRX : null, + 'COL_GRIDSQUARE' => $input_gridsquare, + 'COL_HEADING' => (!empty($record['heading'])) ? $record['heading'] : null, + 'COL_HRDLOG_QSO_UPLOAD_DATE' => (!empty($record['hrdlog_qso_upload_date'])) ? $record['hrdlog_qso_upload_date'] : null, + 'COL_HRDLOG_QSO_UPLOAD_STATUS' => (!empty($record['hrdlog_qso_upload_status'])) ? $record['hrdlog_qso_upload_status'] : '', + 'COL_IOTA' => (!empty($record['iota'])) ? $record['iota'] : '', + 'COL_ITUZ' => (!empty($record['ituz'])) ? $record['ituz'] : null, + 'COL_K_INDEX' => (!empty($record['k_index'])) ? $record['k_index'] : null, + 'COL_LAT' => $input_lat, + 'COL_LON' => $input_lon, + 'COL_LOTW_QSL_RCVD' => $input_lotw_qsl_rcvd, + 'COL_LOTW_QSL_SENT' => $input_lotw_qsl_sent, + 'COL_LOTW_QSLRDATE' => $input_lotw_qslrdate, + 'COL_LOTW_QSLSDATE' => $input_lotw_qslsdate, + 'COL_LOTW_STATUS' => (!empty($record['lotw_status'])) ? $record['lotw_status'] : '', + 'COL_MAX_BURSTS' => (!empty($record['max_bursts'])) ? $record['max_bursts'] : null, + 'COL_MODE' => $input_mode, + 'COL_MS_SHOWER' => (!empty($record['ms_shower'])) ? $record['ms_shower'] : '', + 'COL_MY_ANTENNA' => (!empty($record['my_antenna'])) ? $record['my_antenna'] : '', + 'COL_MY_ANTENNA_INTL' => (!empty($record['my_antenna_intl'])) ? $record['my_antenna_intl'] : '', + 'COL_MY_CITY' => (!empty($record['my_city'])) ? $record['my_city'] : '', + 'COL_MY_CITY_INTL' => (!empty($record['my_city_intl'])) ? $record['my_city_intl'] : '', + 'COL_MY_CNTY' => (!empty($record['my_cnty'])) ? $record['my_cnty'] : '', + 'COL_MY_COUNTRY' => (!empty($record['my_country'])) ? $record['my_country'] : '', + 'COL_MY_COUNTRY_INTL' => (!empty($record['my_country_intl'])) ? $record['my_country_intl'] : null, + 'COL_MY_CQ_ZONE' => (!empty($record['my_dxcc'])) ? $record['my_dxcc'] : null, + 'COL_MY_DXCC' => (!empty($record['my_dxcc'])) ? $record['my_dxcc'] : null, + 'COL_MY_FISTS' => (!empty($record['my_fists'])) ? $record['my_fists'] : null, + 'COL_MY_GRIDSQUARE' => (!empty($record['my_gridsquare'])) ? $record['my_gridsquare'] : '', + 'COL_MY_IOTA' => (!empty($record['my_iota'])) ? $record['my_iota'] : '', + 'COL_MY_IOTA_ISLAND_ID' => (!empty($record['my_iota_island_id'])) ? $record['my_iota_island_id'] : '', + 'COL_MY_ITU_ZONE' => (!empty($record['my_itu_zone'])) ? $record['my_itu_zone'] : null, + 'COL_MY_LAT' => $input_my_lat, + 'COL_MY_LON' => $input_my_lon, + 'COL_MY_NAME' => (!empty($record['my_name'])) ? $record['my_name'] : '', + 'COL_MY_NAME_INTL' => (!empty($record['my_name_intl'])) ? $record['my_name_intl'] : '', + 'COL_MY_POSTAL_CODE' => (!empty($record['my_postal_code'])) ? $record['my_postal_code'] : '', + 'COL_MY_POSTCODE_INTL' => (!empty($record['my_postcode_intl'])) ? $record['my_postcode_intl'] : '', + 'COL_MY_RIG' => (!empty($record['my_rig'])) ? $record['my_rig'] : '', + 'COL_MY_RIG_INTL' => (!empty($record['my_rig_intl'])) ? $record['my_rig_intl'] : '', + 'COL_MY_SIG' => (!empty($record['my_sig'])) ? $record['my_sig'] : '', + 'COL_MY_SIG_INFO' => (!empty($record['my_sig_info'])) ? $record['my_sig_info'] : '', + 'COL_MY_SIG_INFO_INTL' => (!empty($record['my_sig_info_intl'])) ? $record['my_sig_info_intl'] : '', + 'COL_MY_SIG_INTL' => (!empty($record['my_sig_intl'])) ? $record['my_sig_intl'] : '', + 'COL_MY_SOTA_REF' => (!empty($record['my_sota_ref'])) ? $record['my_sota_ref'] : '', + 'COL_MY_WWFF_REF' => (!empty($record['my_wwff_ref'])) ? $record['my_wwff_ref'] : '', + 'COL_MY_POTA_REF' => (!empty($record['my_pota_ref'])) ? $record['my_pota_ref'] : '', + 'COL_MY_STATE' => (!empty($record['my_state'])) ? $record['my_state'] : '', + 'COL_MY_STREET' => (!empty($record['my_street'])) ? $record['my_street'] : '', + 'COL_MY_STREET_INTL' => (!empty($record['my_street_intl'])) ? $record['my_street_intl'] : '', + 'COL_MY_USACA_COUNTIES' => (!empty($record['my_usaca_counties'])) ? $record['my_usaca_counties'] : '', + 'COL_MY_VUCC_GRIDS' => (!empty($record['my_vucc_grids'])) ? $record['my_vucc_grids'] : '', + 'COL_NAME' => (!empty($record['name'])) ? $record['name'] : '', + 'COL_NAME_INTL' => (!empty($record['name_intl'])) ? $record['name_intl'] : '', + 'COL_NOTES' => (!empty($record['notes'])) ? $record['notes'] : '', + 'COL_NOTES_INTL' => (!empty($record['notes_intl'])) ? $record['notes_intl'] : '', + 'COL_NR_BURSTS' => (!empty($record['nr_bursts'])) ? $record['nr_bursts'] : null, + 'COL_NR_PINGS' => (!empty($record['nr_pings'])) ? $record['nr_pings'] : null, + 'COL_OPERATOR' => $operatorName, + 'COL_OWNER_CALLSIGN' => (!empty($record['owner_callsign'])) ? $record['owner_callsign'] : '', + 'COL_PFX' => (!empty($record['pfx'])) ? $record['pfx'] : '', + 'COL_PRECEDENCE' => (!empty($record['precedence'])) ? $record['precedence'] : '', + 'COL_PROP_MODE' => (!empty($record['prop_mode'])) ? $record['prop_mode'] : '', + 'COL_PUBLIC_KEY' => (!empty($record['public_key'])) ? $record['public_key'] : '', + 'COL_HRDLOG_QSO_UPLOAD_DATE' => $input_hrdlog_qso_upload_date, + 'COL_HRDLOG_QSO_UPLOAD_STATUS' => $input_hrdlog_qso_upload_status, + 'COL_QRZCOM_QSO_UPLOAD_DATE' => $input_qrzcom_qso_upload_date, + 'COL_QRZCOM_QSO_UPLOAD_STATUS' => $input_qrzcom_qso_upload_status, + 'COL_QSL_RCVD' => $input_qsl_rcvd, + 'COL_QSL_RCVD_VIA' => $input_qsl_rcvd_via, + 'COL_QSL_SENT' => $input_qsl_sent, + 'COL_QSL_SENT_VIA' => $input_qsl_sent_via, + 'COL_QSL_VIA' => (!empty($record['qsl_via'])) ? $record['qsl_via'] : '', + 'COL_QSLMSG' => (!empty($record['qslmsg'])) ? $record['qslmsg'] : '', + 'COL_QSLRDATE' => $input_qslrdate, + 'COL_QSLSDATE' => $input_qslsdate, + 'COL_QSO_COMPLETE' => (!empty($record['qso_complete'])) ? $record['qso_complete'] : '', + 'COL_QSO_DATE' => (!empty($record['qso_date'])) ? $record['qso_date'] : null, + 'COL_QSO_DATE_OFF' => (!empty($record['qso_date_off'])) ? $record['qso_date_off'] : null, + 'COL_QTH' => (!empty($record['qth'])) ? $record['qth'] : '', + 'COL_QTH_INTL' => (!empty($record['qth_intl'])) ? $record['qth_intl'] : '', + 'COL_REGION' => (!empty($record['region'])) ? $record['region'] : '', + 'COL_RIG' => (!empty($record['rig'])) ? $record['rig'] : '', + 'COL_RIG_INTL' => (!empty($record['rig_intl'])) ? $record['rig_intl'] : '', + 'COL_RST_RCVD' => $rst_rx, + 'COL_RST_SENT' => $rst_tx, + 'COL_RX_PWR' => $rx_pwr, + 'COL_SAT_MODE' => (!empty($record['sat_mode'])) ? $record['sat_mode'] : '', + 'COL_SAT_NAME' => (!empty($record['sat_name'])) ? $record['sat_name'] : '', + 'COL_SFI' => (!empty($record['sfi'])) ? $record['sfi'] : null, + 'COL_SIG' => (!empty($record['sig'])) ? $record['sig'] : '', + 'COL_SIG_INFO' => (!empty($record['sig_info'])) ? $record['sig_info'] : '', + 'COL_SIG_INFO_INTL' => (!empty($record['sig_info_intl'])) ? $record['sig_info_intl'] : '', + 'COL_SIG_INTL' => (!empty($record['sig_intl'])) ? $record['sig_intl'] : '', + 'COL_SILENT_KEY' => (!empty($record['silent_key'])) ? $record['silent_key'] : '', + 'COL_SKCC' => (!empty($record['skcc'])) ? $record['skcc'] : '', + 'COL_SOTA_REF' => (!empty($record['sota_ref'])) ? $record['sota_ref'] : '', + 'COL_WWFF_REF' => (!empty($record['wwff_ref'])) ? $record['wwff_ref'] : '', + 'COL_POTA_REF' => (!empty($record['pota_ref'])) ? $record['pota_ref'] : '', + 'COL_SRX' => (!empty($record['srx'])) ? (int)$record['srx'] : null, + //convert to integer to make sure no invalid entries are imported + 'COL_SRX_STRING' => (!empty($record['srx_string'])) ? $record['srx_string'] : '', + 'COL_STATE' => (!empty($record['state'])) ? strtoupper($record['state']) : '', + 'COL_STATION_CALLSIGN' => (!empty($record['station_callsign'])) ? $record['station_callsign'] : '', + //convert to integer to make sure no invalid entries are imported + 'COL_STX' => (!empty($record['stx'])) ? (int)$record['stx'] : null, + 'COL_STX_STRING' => (!empty($record['stx_string'])) ? $record['stx_string'] : '', + 'COL_SUBMODE' => $input_submode, + 'COL_SWL' => (!empty($record['swl'])) ? $record['swl'] : null, + 'COL_TEN_TEN' => (!empty($record['ten_ten'])) ? $record['ten_ten'] : null, + 'COL_TIME_ON' => $time_on, + 'COL_TIME_OFF' => $time_off, + 'COL_TX_PWR' => (!empty($tx_pwr)) ? $tx_pwr : null, + 'COL_UKSMG' => (!empty($record['uksmg'])) ? $record['uksmg'] : '', + 'COL_USACA_COUNTIES' => (!empty($record['usaca_counties'])) ? $record['usaca_counties'] : '', + 'COL_VUCC_GRIDS' => $input_vucc_grids, + 'COL_WEB' => (!empty($record['web'])) ? $record['web'] : '' ); - $this->db->where(array('COL_PRIMARY_KEY' => $key)); - $this->db->update($this->config->item('table_name'), $data); - return; - } + // Collect field information from the station profile table thats required for the QSO. + if ($station_id != "0") { + $this->db->select('station_profile.*, dxcc_entities.name as station_country'); + $this->db->where('station_id', $station_id); + $this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif', 'left outer'); + $station_result = $this->db->get('station_profile'); - function get_main_mode_from_mode($mode) { - return ($this->get_main_mode_if_submode($mode) == null ? $mode : $this->get_main_mode_if_submode($mode)); - } + if ($station_result->num_rows() > 0) { + $data['station_id'] = $station_id; - function get_main_mode_if_submode($mode) { - $this->db->select('mode'); - $this->db->where('submode', $mode); + $row = $station_result->row_array(); - $query = $this->db->get('adif_modes'); - if ($query->num_rows() > 0){ - $row = $query->row_array(); - return $row['mode']; - } else { - return null; + if (strpos(trim($row['station_gridsquare']), ',') !== false) { + $data['COL_MY_VUCC_GRIDS'] = strtoupper(trim($row['station_gridsquare'])); + } else { + $data['COL_MY_GRIDSQUARE'] = strtoupper(trim($row['station_gridsquare'])); + } + + $data['COL_MY_CITY'] = trim($row['station_city']); + $data['COL_MY_IOTA'] = strtoupper(trim($row['station_iota'])); + $data['COL_MY_SOTA_REF'] = strtoupper(trim($row['station_sota'])); + $data['COL_MY_WWFF_REF'] = strtoupper(trim($row['station_wwff'])); + $data['COL_MY_POTA_REF'] = $row['station_pota'] == null ? '' : strtoupper(trim($row['station_pota'])); + + $data['COL_STATION_CALLSIGN'] = strtoupper(trim($row['station_callsign'])); + $data['COL_MY_DXCC'] = strtoupper(trim($row['station_dxcc'])); + $data['COL_MY_COUNTRY'] = strtoupper(trim($row['station_country'])); + $data['COL_MY_CNTY'] = strtoupper(trim($row['station_cnty'])); + $data['COL_MY_CQ_ZONE'] = strtoupper(trim($row['station_cq'])); + $data['COL_MY_ITU_ZONE'] = strtoupper(trim($row['station_itu'])); } - } + } - /* + // Save QSO + $this->add_qso($data, $skipexport); + } else { + $my_error .= "Date/Time: " . $time_on . " Callsign: " . $record['call'] . " Band: " . $band . " Duplicate
"; + } + + return $my_error; + } + + function update_dok($record, $ignoreAmbiguous, $onlyConfirmed, $overwriteDok) + { + $this->load->model('logbooks_model'); + $custom_date_format = $this->session->userdata('user_date_format'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (isset($record['call'])) { + $call = strtoupper($record['call']); + } else { + return array(3, 'Callsign not found'); + } + + // Join date+time + $time_on = date('Y-m-d', strtotime($record['qso_date'])) . " " . date('H:i', strtotime($record['time_on'])); + + // Store Band + if (isset($record['band'])) { + $band = strtolower($record['band']); + } else { + if (isset($record['freq'])) { + if ($record['freq'] != "0") { + $band = $this->frequency->GetBand($record['freq']); + } + } + } + + if (isset($record['mode'])) { + $mode = $record['mode']; + } else { + $mode = ''; + } + + if (isset($record['darc_dok'])) { + $darc_dok = $record['darc_dok']; + } else { + $darc_dok = ''; + } + + if ($darc_dok != '') { + $this->db->select('COL_PRIMARY_KEY, COL_DARC_DOK'); + $this->db->where('COL_CALL', $call); + $this->db->like('COL_TIME_ON', $time_on, 'after'); + $this->db->where('COL_BAND', $band); + $this->db->where('COL_MODE', $mode); + $this->db->where_in('station_id', $logbooks_locations_array); + $check = $this->db->get($this->config->item('table_name')); + if ($check->num_rows() != 1) { + if ($ignoreAmbiguous == '1') { + return array(); + } else { + return array(2, $result['message'] = "" . date($custom_date_format, strtotime($record['qso_date'])) . "" . date('H:i', strtotime($record['time_on'])) . "" . str_replace('0', 'Ø', $call) . "" . $band . "" . $mode . "" . (preg_match('/^[A-Y]\d{2}$/', $darc_dok) ? '' . $darc_dok . '' : (preg_match('/^Z\d{2}$/', $darc_dok) ? '' . $darc_dok . '' : $darc_dok)) . "" . lang('dcl_no_match') . ""); + } + } else { + $dcl_qsl_status = ''; + switch ($record['app_dcl_status']) { + case 'c': + $dcl_qsl_status = lang('dcl_qsl_status_c'); + break; + case 'm': + case 'n': + case 'o': + $dcl_qsl_status = lang('dcl_qsl_status_mno'); + break; + case 'i': + $dcl_qsl_status = lang('dcl_qsl_status_i'); + break; + case 'w': + $dcl_qsl_status = lang('dcl_qsl_status_w'); + break; + case 'x': + $dcl_qsl_status = lang('dcl_qsl_status_x'); + break; + default: + $dcl_qsl_status = lang('dcl_qsl_status_unknown'); + } + if ($check->row()->COL_DARC_DOK != $darc_dok) { + $dcl_cnfm = array('c', 'm', 'n', 'o', 'i'); + // Ref https://confluence.darc.de/pages/viewpage.action?pageId=21037270 + if ($onlyConfirmed == '1') { + if (in_array($record['app_dcl_status'], $dcl_cnfm)) { + if ($check->row()->COL_DARC_DOK == '' || $overwriteDok == '1') { + $this->set_dok($check->row()->COL_PRIMARY_KEY, $darc_dok); + return array(0, ''); + } else { + return array(1, $result['message'] = "" . date($custom_date_format, strtotime($record['qso_date'])) . "" . date('H:i', strtotime($record['time_on'])) . "row()->COL_PRIMARY_KEY . ")\">" . str_replace('0', 'Ø', $call) . "" . $band . "" . $mode . "" . ($check->row()->COL_DARC_DOK == '' ? 'n/a' : (preg_match('/^[A-Y]\d{2}$/', $check->row()->COL_DARC_DOK) ? '' . $check->row()->COL_DARC_DOK . '' : (preg_match('/^Z\d{2}$/', $check->row()->COL_DARC_DOK) ? '' . $check->row()->COL_DARC_DOK . '' : $check->row()->COL_DARC_DOK))) . "" . (preg_match('/^[A-Y]\d{2}$/', $darc_dok) ? '' . $darc_dok . '' : (preg_match('/^Z\d{2}$/', $darc_dok) ? '' . $darc_dok . '' : $darc_dok)) . "" . $dcl_qsl_status . ""); + } + } else { + return array(1, $result['message'] = "" . date($custom_date_format, strtotime($record['qso_date'])) . "" . date('H:i', strtotime($record['time_on'])) . "row()->COL_PRIMARY_KEY . ")\">" . str_replace('0', 'Ø', $call) . "" . $band . "" . $mode . "" . ($check->row()->COL_DARC_DOK == '' ? 'n/a' : (preg_match('/^[A-Y]\d{2}$/', $check->row()->COL_DARC_DOK) ? '' . $check->row()->COL_DARC_DOK . '' : (preg_match('/^Z\d{2}$/', $check->row()->COL_DARC_DOK) ? '' . $check->row()->COL_DARC_DOK . '' : $check->row()->COL_DARC_DOK))) . "" . (preg_match('/^[A-Y]\d{2}$/', $darc_dok) ? '' . $darc_dok . '' : (preg_match('/^Z\d{2}$/', $darc_dok) ? '' . $darc_dok . '' : $darc_dok)) . "" . $dcl_qsl_status . ""); + } + } else { + if ($check->row()->COL_DARC_DOK == '' || $overwriteDok == '1') { + $this->set_dok($check->row()->COL_PRIMARY_KEY, $darc_dok); + return array(0, ''); + } else { + return array(1, $result['message'] = "" . date($custom_date_format, strtotime($record['qso_date'])) . "" . date('H:i', strtotime($record['time_on'])) . "row()->COL_PRIMARY_KEY . ")\">" . str_replace('0', 'Ø', $call) . "" . $band . "" . $mode . "" . ($check->row()->COL_DARC_DOK == '' ? 'n/a' : (preg_match('/^[A-Y]\d{2}$/', $check->row()->COL_DARC_DOK) ? '' . $check->row()->COL_DARC_DOK . '' : (preg_match('/^Z\d{2}$/', $check->row()->COL_DARC_DOK) ? '' . $check->row()->COL_DARC_DOK . '' : $check->row()->COL_DARC_DOK))) . "" . (preg_match('/^[A-Y]\d{2}$/', $darc_dok) ? '' . $darc_dok . '' : (preg_match('/^Z\d{2}$/', $darc_dok) ? '' . $darc_dok . '' : $darc_dok)) . "" . $dcl_qsl_status . ""); + } + } + } + } + } + } + + function set_dok($key, $dok) + { + $data = array( + 'COL_DARC_DOK' => $dok, + ); + + $this->db->where(array('COL_PRIMARY_KEY' => $key)); + $this->db->update($this->config->item('table_name'), $data); + return; + } + + function get_main_mode_from_mode($mode) + { + return ($this->get_main_mode_if_submode($mode) == null ? $mode : $this->get_main_mode_if_submode($mode)); + } + + function get_main_mode_if_submode($mode) + { + $this->db->select('mode'); + $this->db->where('submode', $mode); + + $query = $this->db->get('adif_modes'); + if ($query->num_rows() > 0) { + $row = $query->row_array(); + return $row['mode']; + } else { + return null; + } + } + + /* * Check the dxxc_prefixes table and return (dxcc, country) */ - public function check_dxcc_table($call, $date){ + public function check_dxcc_table($call, $date) + { $csadditions = '/^P$|^R$|^A$|^M$/'; - $dxcc_exceptions = $this->db->select('`entity`, `adif`, `cqz`, `cont`') - ->where('call', $call) - ->where('(start <= ', $date) - ->or_where('start is null)', NULL, false) - ->where('(end >= ', $date) - ->or_where('end is null)', NULL, false) - ->get('dxcc_exceptions'); + $dxcc_exceptions = $this->db->select('`entity`, `adif`, `cqz`, `cont`') + ->where('call', $call) + ->where('(start <= ', $date) + ->or_where('start is null)', NULL, false) + ->where('(end >= ', $date) + ->or_where('end is null)', NULL, false) + ->get('dxcc_exceptions'); - if ($dxcc_exceptions->num_rows() > 0){ - $row = $dxcc_exceptions->row_array(); - return array($row['adif'], $row['entity'], $row['cqz'], $row['cont']); - } + if ($dxcc_exceptions->num_rows() > 0) { + $row = $dxcc_exceptions->row_array(); + return array($row['adif'], $row['entity'], $row['cqz'], $row['cont']); + } if (preg_match('/(^KG4)[A-Z09]{3}/', $call)) { // KG4/ and KG4 5 char calls are Guantanamo Bay. If 4 or 6 char, it is USA $call = "K"; } elseif (preg_match('/(^OH\/)|(\/OH[1-9]?$)/', $call)) { # non-Aland prefix! @@ -3903,627 +3957,645 @@ function lotw_last_qsl_date($user_id) { $call = "KG4"; } elseif (preg_match('/(^KG4)[A-Z09]{1}/', $call)) { $call = "K"; - } elseif (preg_match('/\w\/\w/', $call)) { + } elseif (preg_match('/\w\/\w/', $call)) { if (preg_match_all('/^((\d|[A-Z])+\/)?((\d|[A-Z]){3,})(\/(\d|[A-Z])+)?(\/(\d|[A-Z])+)?$/', $call, $matches)) { $prefix = $matches[1][0]; $callsign = $matches[3][0]; $suffix = $matches[5][0]; - if ($prefix) { - $prefix = substr($prefix, 0, -1); # Remove the / at the end - } - if ($suffix) { - $suffix = substr($suffix, 1); # Remove the / at the beginning - }; - if (preg_match($csadditions, $suffix)) { if ($prefix) { - $call = $prefix; - } else { - $call = $callsign; + $prefix = substr($prefix, 0, -1); # Remove the / at the end } - } else { - $result = $this->wpx($call, 1); # use the wpx prefix instead - if ($result == '') { - $row['adif'] = 0; - $row['entity'] = '- NONE -'; - $row['cqz'] = 0; - $row['cont'] = ''; - return array($row['adif'], $row['entity'], $row['cqz'], $row['cont']); + if ($suffix) { + $suffix = substr($suffix, 1); # Remove the / at the beginning + }; + if (preg_match($csadditions, $suffix)) { + if ($prefix) { + $call = $prefix; + } else { + $call = $callsign; + } } else { - $call = $result . "AA"; + $result = $this->wpx($call, 1); # use the wpx prefix instead + if ($result == '') { + $row['adif'] = 0; + $row['entity'] = '- NONE -'; + $row['cqz'] = 0; + $row['cont'] = ''; + return array($row['adif'], $row['entity'], $row['cqz'], $row['cont']); + } else { + $call = $result . "AA"; + } } } } + + $len = strlen($call); + + // query the table, removing a character from the right until a match + for ($i = $len; $i > 0; $i--) { + //printf("searching for %s\n", substr($call, 0, $i)); + $dxcc_result = $this->db->select('`call`, `entity`, `adif`, `cqz`, `cont`') + ->where('call', substr($call, 0, $i)) + ->where('(start <= ', $date) + ->or_where("start is null)", NULL, false) + ->where('(end >= ', $date) + ->or_where("end is null)", NULL, false) + ->get('dxcc_prefixes'); + + //$dxcc_result = $this->db->query("select `call`, `entity`, `adif` from dxcc_prefixes where `call` = '".substr($call, 0, $i) ."'"); + //print $this->db->last_query(); + + if ($dxcc_result->num_rows() > 0) { + $row = $dxcc_result->row_array(); + return array($row['adif'], $row['entity'], $row['cqz'], $row['cont']); + } + } + + return array("Not Found", "Not Found"); } - $len = strlen($call); - - // query the table, removing a character from the right until a match - for ($i = $len; $i > 0; $i--){ - //printf("searching for %s\n", substr($call, 0, $i)); - $dxcc_result = $this->db->select('`call`, `entity`, `adif`, `cqz`, `cont`') - ->where('call', substr($call, 0, $i)) - ->where('(start <= ', $date) - ->or_where("start is null)", NULL, false) - ->where('(end >= ', $date) - ->or_where("end is null)", NULL, false) - ->get('dxcc_prefixes'); - - //$dxcc_result = $this->db->query("select `call`, `entity`, `adif` from dxcc_prefixes where `call` = '".substr($call, 0, $i) ."'"); - //print $this->db->last_query(); - - if ($dxcc_result->num_rows() > 0){ - $row = $dxcc_result->row_array(); - return array($row['adif'], $row['entity'], $row['cqz'], $row['cont']); - } - } - - return array("Not Found", "Not Found"); - - } - - public function dxcc_lookup($call, $date){ + public function dxcc_lookup($call, $date) + { $csadditions = '/^P$|^R$|^A$|^M$/'; - $dxcc_exceptions = $this->db->select('`entity`, `adif`, `cqz`') - ->where('call', $call) - ->where('(start <= ', $date) - ->or_where('start is null)', NULL, false) - ->where('(end >= ', $date) - ->or_where('end is null)', NULL, false) - ->get('dxcc_exceptions'); + $dxcc_exceptions = $this->db->select('`entity`, `adif`, `cqz`') + ->where('call', $call) + ->where('(start <= ', $date) + ->or_where('start is null)', NULL, false) + ->where('(end >= ', $date) + ->or_where('end is null)', NULL, false) + ->get('dxcc_exceptions'); - if ($dxcc_exceptions->num_rows() > 0){ - $row = $dxcc_exceptions->row_array(); - return $row; - } else { + if ($dxcc_exceptions->num_rows() > 0) { + $row = $dxcc_exceptions->row_array(); + return $row; + } else { - if (preg_match('/(^KG4)[A-Z09]{3}/', $call)) { // KG4/ and KG4 5 char calls are Guantanamo Bay. If 4 or 6 char, it is USA - $call = "K"; - } elseif (preg_match('/(^OH\/)|(\/OH[1-9]?$)/', $call)) { # non-Aland prefix! - $call = "OH"; # make callsign OH = finland - } elseif (preg_match('/(^CX\/)|(\/CX[1-9]?$)/', $call)) { # non-Antarctica prefix! - $call = "CX"; # make callsign CX = Uruguay - } elseif (preg_match('/(^3D2R)|(^3D2.+\/R)/', $call)) { # seems to be from Rotuma - $call = "3D2/R"; # will match with Rotuma - } elseif (preg_match('/^3D2C/', $call)) { # seems to be from Conway Reef - $call = "3D2/C"; # will match with Conway - } elseif (preg_match('/(^LZ\/)|(\/LZ[1-9]?$)/', $call)) { # LZ/ is LZ0 by DXCC but this is VP8h - $call = "LZ"; - } elseif (preg_match('/(^KG4)[A-Z09]{2}/', $call)) { - $call = "KG4"; - } elseif (preg_match('/(^KG4)[A-Z09]{1}/', $call)) { - $call = "K"; - } elseif (preg_match('/\w\/\w/', $call)) { - if (preg_match_all('/^((\d|[A-Z])+\/)?((\d|[A-Z]){3,})(\/(\d|[A-Z])+)?(\/(\d|[A-Z])+)?$/', $call, $matches)) { - $prefix = $matches[1][0]; - $callsign = $matches[3][0]; - $suffix = $matches[5][0]; - if ($prefix) { - $prefix = substr($prefix, 0, -1); # Remove the / at the end - } - if ($suffix) { - $suffix = substr($suffix, 1); # Remove the / at the beginning - }; - if (preg_match($csadditions, $suffix)) { - if ($prefix) { - $call = $prefix; - } else { - $call = $callsign; - } - } else { - $result = $this->wpx($call, 1); # use the wpx prefix instead - if ($result == '') { - $row['adif'] = 0; - $row['entity'] = '- NONE -'; - $row['cqz'] = 0; - $row['long'] = '0'; - $row['lat'] = '0'; - return $row; - } else { - $call = $result . "AA"; - } + if (preg_match('/(^KG4)[A-Z09]{3}/', $call)) { // KG4/ and KG4 5 char calls are Guantanamo Bay. If 4 or 6 char, it is USA + $call = "K"; + } elseif (preg_match('/(^OH\/)|(\/OH[1-9]?$)/', $call)) { # non-Aland prefix! + $call = "OH"; # make callsign OH = finland + } elseif (preg_match('/(^CX\/)|(\/CX[1-9]?$)/', $call)) { # non-Antarctica prefix! + $call = "CX"; # make callsign CX = Uruguay + } elseif (preg_match('/(^3D2R)|(^3D2.+\/R)/', $call)) { # seems to be from Rotuma + $call = "3D2/R"; # will match with Rotuma + } elseif (preg_match('/^3D2C/', $call)) { # seems to be from Conway Reef + $call = "3D2/C"; # will match with Conway + } elseif (preg_match('/(^LZ\/)|(\/LZ[1-9]?$)/', $call)) { # LZ/ is LZ0 by DXCC but this is VP8h + $call = "LZ"; + } elseif (preg_match('/(^KG4)[A-Z09]{2}/', $call)) { + $call = "KG4"; + } elseif (preg_match('/(^KG4)[A-Z09]{1}/', $call)) { + $call = "K"; + } elseif (preg_match('/\w\/\w/', $call)) { + if (preg_match_all('/^((\d|[A-Z])+\/)?((\d|[A-Z]){3,})(\/(\d|[A-Z])+)?(\/(\d|[A-Z])+)?$/', $call, $matches)) { + $prefix = $matches[1][0]; + $callsign = $matches[3][0]; + $suffix = $matches[5][0]; + if ($prefix) { + $prefix = substr($prefix, 0, -1); # Remove the / at the end } - } + if ($suffix) { + $suffix = substr($suffix, 1); # Remove the / at the beginning + }; + if (preg_match($csadditions, $suffix)) { + if ($prefix) { + $call = $prefix; + } else { + $call = $callsign; + } + } else { + $result = $this->wpx($call, 1); # use the wpx prefix instead + if ($result == '') { + $row['adif'] = 0; + $row['entity'] = '- NONE -'; + $row['cqz'] = 0; + $row['long'] = '0'; + $row['lat'] = '0'; + return $row; + } else { + $call = $result . "AA"; + } + } + } } - $len = strlen($call); + $len = strlen($call); - // query the table, removing a character from the right until a match - for ($i = $len; $i > 0; $i--){ - //printf("searching for %s\n", substr($call, 0, $i)); - $dxcc_result = $this->db->select('*') - ->where('call', substr($call, 0, $i)) - ->where('(start <= ', $date) - ->or_where("start is null)", NULL, false) - ->where('(end >= ', $date) - ->or_where("end is null)", NULL, false) - ->get('dxcc_prefixes'); + // query the table, removing a character from the right until a match + for ($i = $len; $i > 0; $i--) { + //printf("searching for %s\n", substr($call, 0, $i)); + $dxcc_result = $this->db->select('*') + ->where('call', substr($call, 0, $i)) + ->where('(start <= ', $date) + ->or_where("start is null)", NULL, false) + ->where('(end >= ', $date) + ->or_where("end is null)", NULL, false) + ->get('dxcc_prefixes'); - //$dxcc_result = $this->db->query("select `call`, `entity`, `adif` from dxcc_prefixes where `call` = '".substr($call, 0, $i) ."'"); - //print $this->db->last_query(); + //$dxcc_result = $this->db->query("select `call`, `entity`, `adif` from dxcc_prefixes where `call` = '".substr($call, 0, $i) ."'"); + //print $this->db->last_query(); - if ($dxcc_result->num_rows() > 0){ - $row = $dxcc_result->row_array(); - return $row; - } - } - } - - return array("Not Found", "Not Found"); + if ($dxcc_result->num_rows() > 0) { + $row = $dxcc_result->row_array(); + return $row; + } + } } - function wpx($testcall, $i) { - $prefix = ''; - $a = ''; - $b = ''; - $c = ''; - - $lidadditions = '/^QRP$|^LGT$/'; - $csadditions = '/^P$|^R$|^A$|^M$|^LH$/'; - $noneadditions = '/^MM$|^AM$/'; - - # First check if the call is in the proper format, A/B/C where A and C - # are optional (prefix of guest country and P, MM, AM etc) and B is the - # callsign. Only letters, figures and "/" is accepted, no further check if the - # callsign "makes sense". - # 23.Apr.06: Added another "/X" to the regex, for calls like RV0AL/0/P - # as used by RDA-DXpeditions.... - - if (preg_match_all('/^((\d|[A-Z])+\/)?((\d|[A-Z]){3,})(\/(\d|[A-Z])+)?(\/(\d|[A-Z])+)?$/', $testcall, $matches)) { - - # Now $1 holds A (incl /), $3 holds the callsign B and $5 has C - # We save them to $a, $b and $c respectively to ensure they won't get - # lost in further Regex evaluations. - $a = $matches[1][0]; - $b = $matches[3][0]; - $c = $matches[5][0]; - - if ($a) { - $a = substr($a, 0, -1); # Remove the / at the end - } - if ($c) { - $c = substr($c, 1); # Remove the / at the beginning - }; - - # In some cases when there is no part A but B and C, and C is longer than 2 - # letters, it happens that $a and $b get the values that $b and $c should - # have. This often happens with liddish callsign-additions like /QRP and - # /LGT, but also with calls like DJ1YFK/KP5. ~/.yfklog has a line called - # "lidadditions", which has QRP and LGT as defaults. This sorts out half of - # the problem, but not calls like DJ1YFK/KH5. This is tested in a second - # try: $a looks like a call (.\d[A-Z]) and $b doesn't (.\d), they are - # swapped. This still does not properly handle calls like DJ1YFK/KH7K where - # only the OP's experience says that it's DJ1YFK on KH7K. - if (!$c && $a && $b) { # $a and $b exist, no $c - if (preg_match($lidadditions, $b)) { # check if $b is a lid-addition - $b = $a; - $a = null; # $a goes to $b, delete lid-add - } elseif ((preg_match('/\d[A-Z]+$/', $a)) && (preg_match('/\d$/', $b))) { # check for call in $a - $temp = $b; - $b = $a; - $a = $temp; - } - } - - # *** Added later *** The check didn't make sure that the callsign - # contains a letter. there are letter-only callsigns like RAEM, but not - # figure-only calls. - - if (preg_match('/^[0-9]+$/', $b)) { # Callsign only consists of numbers. Bad! - return null; # exit, undef - } - - # Depending on these values we have to determine the prefix. - # Following cases are possible: - # - # 1. $a and $c undef --> only callsign, subcases - # 1.1 $b contains a number -> everything from start to number - # 1.2 $b contains no number -> first two letters plus 0 - # 2. $a undef, subcases: - # 2.1 $c is only a number -> $a with changed number - # 2.2 $c is /P,/M,/MM,/AM -> 1. - # 2.3 $c is something else and will be interpreted as a Prefix - # 3. $a is defined, will be taken as PFX, regardless of $c - - if (($a == null) && ($c == null)) { # Case 1 - if (preg_match('/\d/', $b)) { # Case 1.1, contains number - preg_match('/(.+\d)[A-Z]*/', $b, $matches); # Prefix is all but the last - $prefix = $matches[1]; # Letters - } else { # Case 1.2, no number - $prefix = substr($b, 0, 2) . "0"; # first two + 0 - } - } elseif (($a == null) && (isset($c))) { # Case 2, CALL/X - if (preg_match('/^(\d)/', $c)) { # Case 2.1, number - preg_match('/(.+\d)[A-Z]*/', $b, $matches); # regular Prefix in $1 - # Here we need to find out how many digits there are in the - # prefix, because for example A45XR/0 is A40. If there are 2 - # numbers, the first is not deleted. If course in exotic cases - # like N66A/7 -> N7 this brings the wrong result of N67, but I - # think that's rather irrelevant cos such calls rarely appear - # and if they do, it's very unlikely for them to have a number - # attached. You can still edit it by hand anyway.. - if (preg_match('/^([A-Z]\d)\d$/', $matches[1])) { # e.g. A45 $c = 0 - $prefix = $matches[1] . $c; # -> A40 - } else { # Otherwise cut all numbers - preg_match('/(.*[A-Z])\d+/', $matches[1], $match); # Prefix w/o number in $1 - $prefix = $match[1] . $c; # Add attached number - } - } elseif (preg_match($csadditions, $c)) { - preg_match('/(.+\d)[A-Z]*/', $b, $matches); # Known attachment -> like Case 1.1 - $prefix = $matches[1]; - } elseif (preg_match($noneadditions, $c)) { - return ''; - } elseif (preg_match('/^\d\d+$/', $c)) { # more than 2 numbers -> ignore - preg_match('/(.+\d)[A-Z]* /', $b, $matches); # see above - $prefix = $matches[1][0]; - } else { # Must be a Prefix! - if (preg_match('/\d$/', $c)) { # ends in number -> good prefix - $prefix = $c; - } else { # Add Zero at the end - $prefix = $c . "0"; - } - } - } elseif (($a) && (preg_match($noneadditions, $c))) { # Case 2.1, X/CALL/X ie TF/DL2NWK/MM - DXCC none - return ''; - } elseif ($a) { - # $a contains the prefix we want - if (preg_match('/\d$/', $a)) { # ends in number -> good prefix - $prefix = $a; - } else { # add zero if no number - $prefix = $a . "0"; - } - } - # In very rare cases (right now I can only think of KH5K and KH7K and FRxG/T - # etc), the prefix is wrong, for example KH5K/DJ1YFK would be KH5K0. In this - # case, the superfluous part will be cropped. Since this, however, changes the - # DXCC of the prefix, this will NOT happen when invoked from with an - # extra parameter $_[1]; this will happen when invoking it from &dxcc. - - if (preg_match('/(\w+\d)[A-Z]+\d/', $prefix, $matches) && $i == null) { - $prefix = $matches[1][0]; - } - return $prefix; - } else { - return ''; - } + return array("Not Found", "Not Found"); } - public function get_entity($dxcc){ - $sql = "select name, cqz, lat, 'long' from dxcc_entities where adif = " . $dxcc; - $query = $this->db->query($sql); + function wpx($testcall, $i) + { + $prefix = ''; + $a = ''; + $b = ''; + $c = ''; - if ($query->result() > 0){ - $row = $query->row_array(); - return $row; + $lidadditions = '/^QRP$|^LGT$/'; + $csadditions = '/^P$|^R$|^A$|^M$|^LH$/'; + $noneadditions = '/^MM$|^AM$/'; + + # First check if the call is in the proper format, A/B/C where A and C + # are optional (prefix of guest country and P, MM, AM etc) and B is the + # callsign. Only letters, figures and "/" is accepted, no further check if the + # callsign "makes sense". + # 23.Apr.06: Added another "/X" to the regex, for calls like RV0AL/0/P + # as used by RDA-DXpeditions.... + + if (preg_match_all('/^((\d|[A-Z])+\/)?((\d|[A-Z]){3,})(\/(\d|[A-Z])+)?(\/(\d|[A-Z])+)?$/', $testcall, $matches)) { + + # Now $1 holds A (incl /), $3 holds the callsign B and $5 has C + # We save them to $a, $b and $c respectively to ensure they won't get + # lost in further Regex evaluations. + $a = $matches[1][0]; + $b = $matches[3][0]; + $c = $matches[5][0]; + + if ($a) { + $a = substr($a, 0, -1); # Remove the / at the end } + if ($c) { + $c = substr($c, 1); # Remove the / at the beginning + }; + + # In some cases when there is no part A but B and C, and C is longer than 2 + # letters, it happens that $a and $b get the values that $b and $c should + # have. This often happens with liddish callsign-additions like /QRP and + # /LGT, but also with calls like DJ1YFK/KP5. ~/.yfklog has a line called + # "lidadditions", which has QRP and LGT as defaults. This sorts out half of + # the problem, but not calls like DJ1YFK/KH5. This is tested in a second + # try: $a looks like a call (.\d[A-Z]) and $b doesn't (.\d), they are + # swapped. This still does not properly handle calls like DJ1YFK/KH7K where + # only the OP's experience says that it's DJ1YFK on KH7K. + if (!$c && $a && $b) { # $a and $b exist, no $c + if (preg_match($lidadditions, $b)) { # check if $b is a lid-addition + $b = $a; + $a = null; # $a goes to $b, delete lid-add + } elseif ((preg_match('/\d[A-Z]+$/', $a)) && (preg_match('/\d$/', $b))) { # check for call in $a + $temp = $b; + $b = $a; + $a = $temp; + } + } + + # *** Added later *** The check didn't make sure that the callsign + # contains a letter. there are letter-only callsigns like RAEM, but not + # figure-only calls. + + if (preg_match('/^[0-9]+$/', $b)) { # Callsign only consists of numbers. Bad! + return null; # exit, undef + } + + # Depending on these values we have to determine the prefix. + # Following cases are possible: + # + # 1. $a and $c undef --> only callsign, subcases + # 1.1 $b contains a number -> everything from start to number + # 1.2 $b contains no number -> first two letters plus 0 + # 2. $a undef, subcases: + # 2.1 $c is only a number -> $a with changed number + # 2.2 $c is /P,/M,/MM,/AM -> 1. + # 2.3 $c is something else and will be interpreted as a Prefix + # 3. $a is defined, will be taken as PFX, regardless of $c + + if (($a == null) && ($c == null)) { # Case 1 + if (preg_match('/\d/', $b)) { # Case 1.1, contains number + preg_match('/(.+\d)[A-Z]*/', $b, $matches); # Prefix is all but the last + $prefix = $matches[1]; # Letters + } else { # Case 1.2, no number + $prefix = substr($b, 0, 2) . "0"; # first two + 0 + } + } elseif (($a == null) && (isset($c))) { # Case 2, CALL/X + if (preg_match('/^(\d)/', $c)) { # Case 2.1, number + preg_match('/(.+\d)[A-Z]*/', $b, $matches); # regular Prefix in $1 + # Here we need to find out how many digits there are in the + # prefix, because for example A45XR/0 is A40. If there are 2 + # numbers, the first is not deleted. If course in exotic cases + # like N66A/7 -> N7 this brings the wrong result of N67, but I + # think that's rather irrelevant cos such calls rarely appear + # and if they do, it's very unlikely for them to have a number + # attached. You can still edit it by hand anyway.. + if (preg_match('/^([A-Z]\d)\d$/', $matches[1])) { # e.g. A45 $c = 0 + $prefix = $matches[1] . $c; # -> A40 + } else { # Otherwise cut all numbers + preg_match('/(.*[A-Z])\d+/', $matches[1], $match); # Prefix w/o number in $1 + $prefix = $match[1] . $c; # Add attached number + } + } elseif (preg_match($csadditions, $c)) { + preg_match('/(.+\d)[A-Z]*/', $b, $matches); # Known attachment -> like Case 1.1 + $prefix = $matches[1]; + } elseif (preg_match($noneadditions, $c)) { + return ''; + } elseif (preg_match('/^\d\d+$/', $c)) { # more than 2 numbers -> ignore + preg_match('/(.+\d)[A-Z]* /', $b, $matches); # see above + $prefix = $matches[1][0]; + } else { # Must be a Prefix! + if (preg_match('/\d$/', $c)) { # ends in number -> good prefix + $prefix = $c; + } else { # Add Zero at the end + $prefix = $c . "0"; + } + } + } elseif (($a) && (preg_match($noneadditions, $c))) { # Case 2.1, X/CALL/X ie TF/DL2NWK/MM - DXCC none + return ''; + } elseif ($a) { + # $a contains the prefix we want + if (preg_match('/\d$/', $a)) { # ends in number -> good prefix + $prefix = $a; + } else { # add zero if no number + $prefix = $a . "0"; + } + } + # In very rare cases (right now I can only think of KH5K and KH7K and FRxG/T + # etc), the prefix is wrong, for example KH5K/DJ1YFK would be KH5K0. In this + # case, the superfluous part will be cropped. Since this, however, changes the + # DXCC of the prefix, this will NOT happen when invoked from with an + # extra parameter $_[1]; this will happen when invoking it from &dxcc. + + if (preg_match('/(\w+\d)[A-Z]+\d/', $prefix, $matches) && $i == null) { + $prefix = $matches[1][0]; + } + return $prefix; + } else { return ''; } + } - /* + public function get_entity($dxcc) + { + $sql = "select name, cqz, lat, 'long' from dxcc_entities where adif = " . $dxcc; + $query = $this->db->query($sql); + + if ($query->result() > 0) { + $row = $query->row_array(); + return $row; + } + return ''; + } + + /* * Same as check_dxcc_table, but the functionality is in * a stored procedure which we call */ - public function check_dxcc_stored_proc($call, $date){ - $this->db->query("call find_country('".$call."','".$date."', @country, @adif, @cqz)"); - $res = $this->db->query("select @country as country, @adif as adif, @cqz as cqz"); - $d = $res->result_array(); + public function check_dxcc_stored_proc($call, $date) + { + $this->db->query("call find_country('" . $call . "','" . $date . "', @country, @adif, @cqz)"); + $res = $this->db->query("select @country as country, @adif as adif, @cqz as cqz"); + $d = $res->result_array(); - // Should only be one result. - // NOTE: might cause unexpected data if there's an - // error with clublog.org data. - return $d[0]; + // Should only be one result. + // NOTE: might cause unexpected data if there's an + // error with clublog.org data. + return $d[0]; + } + + public function check_missing_dxcc_id($all) + { + // get all records with no COL_DXCC + $this->db->select("COL_PRIMARY_KEY, COL_CALL, COL_TIME_ON, COL_TIME_OFF"); + + // check which to update - records with no dxcc or all records + if (!$all) { + $this->db->where("COL_DXCC is NULL"); } - public function check_missing_dxcc_id($all){ - // get all records with no COL_DXCC - $this->db->select("COL_PRIMARY_KEY, COL_CALL, COL_TIME_ON, COL_TIME_OFF"); + $r = $this->db->get($this->config->item('table_name')); - // check which to update - records with no dxcc or all records - if (!$all){ - $this->db->where("COL_DXCC is NULL"); + $count = 0; + $this->db->trans_start(); + //query dxcc_prefixes + if ($r->num_rows() > 0) { + foreach ($r->result_array() as $row) { + $qso_date = $row['COL_TIME_OFF'] == '' ? $row['COL_TIME_ON'] : $row['COL_TIME_OFF']; + $qso_date = date("Y-m-d", strtotime($qso_date)); + + // Manual call + $d = $this->check_dxcc_table($row['COL_CALL'], $qso_date); + + // Stored procedure call + //$d = $this->check_dxcc_stored_proc($row["COL_CALL"], $qso_date); + + if ($d[0] != 'Not Found') { + $sql = sprintf( + "update %s set COL_COUNTRY = '%s', COL_DXCC='%s' where COL_PRIMARY_KEY=%d", + $this->config->item('table_name'), + addslashes(ucwords(strtolower($d[1]), "- (/")), + $d[0], + $row['COL_PRIMARY_KEY'] + ); + $this->db->query($sql); + //print($sql."\n"); + printf("Updating %s to %s and %s\n
", $row['COL_PRIMARY_KEY'], ucwords(strtolower($d[1]), "- (/"), $d[0]); + $count++; + } + } + } + $this->db->trans_complete(); + + print("$count updated\n"); + } + + public function check_missing_continent() + { + // get all records with no COL_CONT + $this->db->trans_start(); + $sql = "UPDATE " . $this->config->item('table_name') . " JOIN dxcc_entities ON " . $this->config->item('table_name') . ".col_dxcc = dxcc_entities.adif SET col_cont = dxcc_entities.cont WHERE COALESCE(" . $this->config->item('table_name') . ".col_cont, '') = ''"; + + $query = $this->db->query($sql); + print($this->db->affected_rows() . " updated\n"); + $this->db->trans_complete(); + } + + public function check_missing_grid_id($all) + { + // get all records with no COL_GRIDSQUARE + $this->db->select("COL_PRIMARY_KEY, COL_CALL, COL_TIME_ON, COL_TIME_OFF"); + + $this->db->where("(COL_GRIDSQUARE is NULL or COL_GRIDSQUARE = '') AND (COL_VUCC_GRIDS is NULL or COL_VUCC_GRIDS = '')"); + + $r = $this->db->get($this->config->item('table_name')); + + $count = 0; + $this->db->trans_start(); + if ($r->num_rows() > 0) { + foreach ($r->result_array() as $row) { + $callsign = $row['COL_CALL']; + if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null) { + // Lookup using QRZ + if (!$this->load->is_loaded('qrz')) { + $this->load->library('qrz'); + } + + if (!$this->session->userdata('qrz_session_key')) { + $qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password')); + $this->session->set_userdata('qrz_session_key', $qrz_session_key); + } + + $callbook = $this->qrz->search($callsign, $this->session->userdata('qrz_session_key')); } - $r = $this->db->get($this->config->item('table_name')); + if ($this->config->item('callbook') == "hamqth" && $this->config->item('hamqth_username') != null && $this->config->item('hamqth_password') != null) { + // Load the HamQTH library + if (!$this->load->is_loaded('hamqth')) { + $this->load->library('hamqth'); + } - $count = 0; - $this->db->trans_start(); - //query dxcc_prefixes - if ($r->num_rows() > 0){ - foreach($r->result_array() as $row){ - $qso_date = $row['COL_TIME_OFF']=='' ? $row['COL_TIME_ON'] : $row['COL_TIME_OFF']; - $qso_date = date("Y-m-d", strtotime($qso_date)); + if (!$this->session->userdata('hamqth_session_key')) { + $hamqth_session_key = $this->hamqth->session($this->config->item('hamqth_username'), $this->config->item('hamqth_password')); + $this->session->set_userdata('hamqth_session_key', $hamqth_session_key); + } - // Manual call - $d = $this->check_dxcc_table($row['COL_CALL'], $qso_date); + $callbook = $this->hamqth->search($callsign, $this->session->userdata('hamqth_session_key')); - // Stored procedure call - //$d = $this->check_dxcc_stored_proc($row["COL_CALL"], $qso_date); - - if ($d[0] != 'Not Found'){ - $sql = sprintf("update %s set COL_COUNTRY = '%s', COL_DXCC='%s' where COL_PRIMARY_KEY=%d", - $this->config->item('table_name'), addslashes(ucwords(strtolower($d[1]), "- (/")), $d[0], $row['COL_PRIMARY_KEY']); - $this->db->query($sql); - //print($sql."\n"); - printf("Updating %s to %s and %s\n
", $row['COL_PRIMARY_KEY'], ucwords(strtolower($d[1]), "- (/"), $d[0]); - $count++; - } - } + // If HamQTH session has expired, start a new session and retry the search. + if ($callbook['error'] == "Session does not exist or expired") { + $hamqth_session_key = $this->hamqth->session($this->config->item('hamqth_username'), $this->config->item('hamqth_password')); + $this->session->set_userdata('hamqth_session_key', $hamqth_session_key); + $callbook = $this->hamqth->search($callsign, $this->session->userdata('hamqth_session_key')); + } } - $this->db->trans_complete(); - - print("$count updated\n"); - } - - public function check_missing_continent(){ - // get all records with no COL_CONT - $this->db->trans_start(); - $sql = "UPDATE ".$this->config->item('table_name')." JOIN dxcc_entities ON ".$this->config->item('table_name').".col_dxcc = dxcc_entities.adif SET col_cont = dxcc_entities.cont WHERE COALESCE(".$this->config->item('table_name').".col_cont, '') = ''"; - - $query = $this->db->query($sql); - print($this->db->affected_rows()." updated\n"); - $this->db->trans_complete(); - } - - public function check_missing_grid_id($all){ - // get all records with no COL_GRIDSQUARE - $this->db->select("COL_PRIMARY_KEY, COL_CALL, COL_TIME_ON, COL_TIME_OFF"); - - $this->db->where("(COL_GRIDSQUARE is NULL or COL_GRIDSQUARE = '') AND (COL_VUCC_GRIDS is NULL or COL_VUCC_GRIDS = '')"); - - $r = $this->db->get($this->config->item('table_name')); - - $count = 0; - $this->db->trans_start(); - if ($r->num_rows() > 0){ - foreach($r->result_array() as $row){ - $callsign = $row['COL_CALL']; - if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null) - { - // Lookup using QRZ - if(!$this->load->is_loaded('qrz')) { - $this->load->library('qrz'); - } - - if(!$this->session->userdata('qrz_session_key')) { - $qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password')); - $this->session->set_userdata('qrz_session_key', $qrz_session_key); - } - - $callbook = $this->qrz->search($callsign, $this->session->userdata('qrz_session_key')); - } - - if ($this->config->item('callbook') == "hamqth" && $this->config->item('hamqth_username') != null && $this->config->item('hamqth_password') != null) - { - // Load the HamQTH library - if(!$this->load->is_loaded('hamqth')) { - $this->load->library('hamqth'); - } - - if(!$this->session->userdata('hamqth_session_key')) { - $hamqth_session_key = $this->hamqth->session($this->config->item('hamqth_username'), $this->config->item('hamqth_password')); - $this->session->set_userdata('hamqth_session_key', $hamqth_session_key); - } - - $callbook = $this->hamqth->search($callsign, $this->session->userdata('hamqth_session_key')); - - // If HamQTH session has expired, start a new session and retry the search. - if($callbook['error'] == "Session does not exist or expired") { - $hamqth_session_key = $this->hamqth->session($this->config->item('hamqth_username'), $this->config->item('hamqth_password')); - $this->session->set_userdata('hamqth_session_key', $hamqth_session_key); - $callbook = $this->hamqth->search($callsign, $this->session->userdata('hamqth_session_key')); - } - } - if (isset($callbook)) - { - if (isset($callbook['error'])) { - printf("Error: ".$callbook['error']."
"); - } else { - $return['callsign_qra'] = $callbook['gridsquare']; - if ($return['callsign_qra'] != ''){ - $sql = sprintf("update %s set COL_GRIDSQUARE = '%s' where COL_PRIMARY_KEY=%d", - $this->config->item('table_name'), $return['callsign_qra'], $row['COL_PRIMARY_KEY']); - $this->db->query($sql); - printf("Updating %s to %s\n
", $row['COL_PRIMARY_KEY'], $return['callsign_qra']); - $count++; - } - } - } - } - } - $this->db->trans_complete(); - - print("$count updated\n"); - } - - public function update_distances(){ - $this->db->select("COL_PRIMARY_KEY, COL_GRIDSQUARE, station_gridsquare"); - $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); - $this->db->where("((COL_DISTANCE is NULL) or (COL_DISTANCE = 0))"); - $this->db->where("COL_GRIDSQUARE is NOT NULL"); - $this->db->where("COL_GRIDSQUARE != ''"); - $this->db->where("COL_GRIDSQUARE != station_gridsquare"); - $this->db->trans_start(); - $query = $this->db->get($this->config->item('table_name')); - - $count = 0; - if ($query->num_rows() > 0){ - print("Affected QSOs: ".$this->db->affected_rows()."
"); - $this->load->library('Qra'); - foreach ($query->result() as $row) { - $distance = $this->qra->distance($row->station_gridsquare, $row->COL_GRIDSQUARE, 'K'); - $data = array( - 'COL_DISTANCE' => $distance, + if (isset($callbook)) { + if (isset($callbook['error'])) { + printf("Error: " . $callbook['error'] . "
"); + } else { + $return['callsign_qra'] = $callbook['gridsquare']; + if ($return['callsign_qra'] != '') { + $sql = sprintf( + "update %s set COL_GRIDSQUARE = '%s' where COL_PRIMARY_KEY=%d", + $this->config->item('table_name'), + $return['callsign_qra'], + $row['COL_PRIMARY_KEY'] ); - - $this->db->where(array('COL_PRIMARY_KEY' => $row->COL_PRIMARY_KEY)); - $this->db->update($this->config->item('table_name'), $data); + $this->db->query($sql); + printf("Updating %s to %s\n
", $row['COL_PRIMARY_KEY'], $return['callsign_qra']); $count++; - } - print("QSOs updated: ".$count); - } else { - print "No QSOs affected."; + } + } } - $this->db->trans_complete(); - } - - public function calls_without_station_id() { - $query=$this->db->query("select distinct COL_STATION_CALLSIGN from ".$this->config->item('table_name')." where station_id is null or station_id = ''"); - $result = $query->result_array(); - return $result; - } - - public function check_for_station_id() { - $this->db->select('COL_PRIMARY_KEY, COL_TIME_ON, COL_CALL, COL_MODE, COL_BAND'); - $this->db->where('station_id =', NULL); - $query = $this->db->get($this->config->item('table_name')); - if($query->num_rows() >= 1) { - return $query->result(); - } else { - return 0; } } + $this->db->trans_complete(); - // This should be in a helper? copied from Logbook controller - function get_plaincall($callsign) { - $split_callsign=explode('/',$callsign); - if (count($split_callsign)==1) { // case F0ABC --> return cel 0 // - $lookupcall = $split_callsign[0]; - } else if (count($split_callsign)==3) { // case EA/F0ABC/P --> return cel 1 // - $lookupcall = $split_callsign[1]; - } else { // case F0ABC/P --> return cel 0 OR case EA/FOABC --> retunr 1 (normaly not exist) // - if (in_array(strtoupper($split_callsign[1]), array('P','M','MM','QRP','0','1','2','3','4','5','6','7','8','9'))) { - $lookupcall = $split_callsign[0]; - } else if (strlen($split_callsign[1])>3) { // Last Element longer than 3 chars? Take that as call - $lookupcall = $split_callsign[1]; - } else { // Last Element up to 3 Chars? Take first element as Call - $lookupcall = $split_callsign[0]; - } - } - return $lookupcall; - } + print("$count updated\n"); + } + public function update_distances() + { + $this->db->select("COL_PRIMARY_KEY, COL_GRIDSQUARE, station_gridsquare"); + $this->db->join('station_profile', 'station_profile.station_id = ' . $this->config->item('table_name') . '.station_id'); + $this->db->where("((COL_DISTANCE is NULL) or (COL_DISTANCE = 0))"); + $this->db->where("COL_GRIDSQUARE is NOT NULL"); + $this->db->where("COL_GRIDSQUARE != ''"); + $this->db->where("COL_GRIDSQUARE != station_gridsquare"); + $this->db->trans_start(); + $query = $this->db->get($this->config->item('table_name')); - public function loadCallBook($callsign, $use_fullname=false) - { - $callbook = null; - try { - if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null) { - // Lookup using QRZ - $this->load->library('qrz'); + $count = 0; + if ($query->num_rows() > 0) { + print("Affected QSOs: " . $this->db->affected_rows() . "
"); + $this->load->library('Qra'); + foreach ($query->result() as $row) { + $distance = $this->qra->distance($row->station_gridsquare, $row->COL_GRIDSQUARE, 'K'); + $data = array( + 'COL_DISTANCE' => $distance, + ); - if (!$this->session->userdata('qrz_session_key')) { - $qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password')); - $this->session->set_userdata('qrz_session_key', $qrz_session_key); - } - - $callbook = $this->qrz->search($callsign, $this->session->userdata('qrz_session_key'), $use_fullname); - - // if we got nothing, it's probably because our session key is invalid, try again - if (($callbook['callsign'] ?? '') == '') - { - $qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password')); - $this->session->set_userdata('qrz_session_key', $qrz_session_key); - $callbook = $this->qrz->search($callsign, $this->session->userdata('qrz_session_key'), $use_fullname); - // if we still got nothing, and it's a compound callsign, then try a search for the base call - if (($callbook['callsign'] ?? '') == '' && strpos($callsign,"/")!==false){ - $callbook = $this->qrz->search($this->get_plaincall($callsign), $this->session->userdata('qrz_session_key'), $use_fullname); - } - } - } - - if ($this->config->item('callbook') == "hamqth" && $this->config->item('hamqth_username') != null && $this->config->item('hamqth_password') != null) { - // Load the HamQTH library - $this->load->library('hamqth'); - - if (!$this->session->userdata('hamqth_session_key')) { - $hamqth_session_key = $this->hamqth->session($this->config->item('hamqth_username'), $this->config->item('hamqth_password')); - $this->session->set_userdata('hamqth_session_key', $hamqth_session_key); - } - - $callbook = $this->hamqth->search($callsign, $this->session->userdata('hamqth_session_key')); - - // If HamQTH session has expired, start a new session and retry the search. - if ($callbook['error'] == "Session does not exist or expired") { - $hamqth_session_key = $this->hamqth->session($this->config->item('hamqth_username'), $this->config->item('hamqth_password')); - $this->session->set_userdata('hamqth_session_key', $hamqth_session_key); - $callbook = $this->hamqth->search($callsign, $this->session->userdata('hamqth_session_key')); - } - } - } finally { - return $callbook; - } - } - - public function update_station_ids($station_id,$station_callsign,$qsoids) { - - if (! empty($qsoids)) { - $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; - } - } - - public function parse_frequency($frequency) - { - if (is_int($frequency)) - return $frequency; - - if (is_string($frequency)) - { - $frequency = strtoupper($frequency); - $frequency = str_replace(" ", "", $frequency); - $frequency = str_replace("HZ", "", $frequency); - $frequency = str_replace(["K", "M", "G", "T"], ["E3", "E6", "E9", "E12"], $frequency); - - // this double conversion will take a string like "3700e3" and convert it into 3700000 - return (int)(float) $frequency; + $this->db->where(array('COL_PRIMARY_KEY' => $row->COL_PRIMARY_KEY)); + $this->db->update($this->config->item('table_name'), $data); + $count++; } + print("QSOs updated: " . $count); + } else { + print "No QSOs affected."; + } + $this->db->trans_complete(); + } + public function calls_without_station_id() + { + $query = $this->db->query("select distinct COL_STATION_CALLSIGN from " . $this->config->item('table_name') . " where station_id is null or station_id = ''"); + $result = $query->result_array(); + return $result; + } + + public function check_for_station_id() + { + $this->db->select('COL_PRIMARY_KEY, COL_TIME_ON, COL_CALL, COL_MODE, COL_BAND'); + $this->db->where('station_id =', NULL); + $query = $this->db->get($this->config->item('table_name')); + if ($query->num_rows() >= 1) { + return $query->result(); + } else { return 0; } + } - /* + // This should be in a helper? copied from Logbook controller + function get_plaincall($callsign) + { + $split_callsign = explode('/', $callsign); + if (count($split_callsign) == 1) { // case F0ABC --> return cel 0 // + $lookupcall = $split_callsign[0]; + } else if (count($split_callsign) == 3) { // case EA/F0ABC/P --> return cel 1 // + $lookupcall = $split_callsign[1]; + } else { // case F0ABC/P --> return cel 0 OR case EA/FOABC --> retunr 1 (normaly not exist) // + if (in_array(strtoupper($split_callsign[1]), array('P', 'M', 'MM', 'QRP', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'))) { + $lookupcall = $split_callsign[0]; + } else if (strlen($split_callsign[1]) > 3) { // Last Element longer than 3 chars? Take that as call + $lookupcall = $split_callsign[1]; + } else { // Last Element up to 3 Chars? Take first element as Call + $lookupcall = $split_callsign[0]; + } + } + return $lookupcall; + } + + + public function loadCallBook($callsign, $use_fullname = false) + { + $callbook = null; + try { + if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null) { + // Lookup using QRZ + $this->load->library('qrz'); + + if (!$this->session->userdata('qrz_session_key')) { + $qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password')); + $this->session->set_userdata('qrz_session_key', $qrz_session_key); + } + + $callbook = $this->qrz->search($callsign, $this->session->userdata('qrz_session_key'), $use_fullname); + + // if we got nothing, it's probably because our session key is invalid, try again + if (($callbook['callsign'] ?? '') == '') { + $qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password')); + $this->session->set_userdata('qrz_session_key', $qrz_session_key); + $callbook = $this->qrz->search($callsign, $this->session->userdata('qrz_session_key'), $use_fullname); + // if we still got nothing, and it's a compound callsign, then try a search for the base call + if (($callbook['callsign'] ?? '') == '' && strpos($callsign, "/") !== false) { + $callbook = $this->qrz->search($this->get_plaincall($callsign), $this->session->userdata('qrz_session_key'), $use_fullname); + } + } + } + + if ($this->config->item('callbook') == "hamqth" && $this->config->item('hamqth_username') != null && $this->config->item('hamqth_password') != null) { + // Load the HamQTH library + $this->load->library('hamqth'); + + if (!$this->session->userdata('hamqth_session_key')) { + $hamqth_session_key = $this->hamqth->session($this->config->item('hamqth_username'), $this->config->item('hamqth_password')); + $this->session->set_userdata('hamqth_session_key', $hamqth_session_key); + } + + $callbook = $this->hamqth->search($callsign, $this->session->userdata('hamqth_session_key')); + + // If HamQTH session has expired, start a new session and retry the search. + if ($callbook['error'] == "Session does not exist or expired") { + $hamqth_session_key = $this->hamqth->session($this->config->item('hamqth_username'), $this->config->item('hamqth_password')); + $this->session->set_userdata('hamqth_session_key', $hamqth_session_key); + $callbook = $this->hamqth->search($callsign, $this->session->userdata('hamqth_session_key')); + } + } + } finally { + return $callbook; + } + } + + public function update_station_ids($station_id, $station_callsign, $qsoids) + { + + if (!empty($qsoids)) { + $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; + } + } + + public function parse_frequency($frequency) + { + if (is_int($frequency)) + return $frequency; + + if (is_string($frequency)) { + $frequency = strtoupper($frequency); + $frequency = str_replace(" ", "", $frequency); + $frequency = str_replace("HZ", "", $frequency); + $frequency = str_replace(["K", "M", "G", "T"], ["E3", "E6", "E9", "E12"], $frequency); + + // this double conversion will take a string like "3700e3" and convert it into 3700000 + return (int)(float) $frequency; + } + + return 0; + } + + /* * This function returns the the whole list of dxcc_entities used in various places */ - function fetchDxcc() { - $sql = "select adif, prefix, name, date(end) Enddate, date(start) Startdate from dxcc_entities"; + function fetchDxcc() + { + $sql = "select adif, prefix, name, date(end) Enddate, date(start) Startdate from dxcc_entities"; - $sql .= ' order by prefix'; - $query = $this->db->query($sql); + $sql .= ' order by prefix'; + $query = $this->db->query($sql); - return $query->result(); - } + return $query->result(); + } - /* + /* * This function returns the whole list of iotas used in various places */ - function fetchIota() { - $sql = "select tag, name from iota"; + function fetchIota() + { + $sql = "select tag, name from iota"; - $sql .= ' order by tag'; - $query = $this->db->query($sql); + $sql .= ' order by tag'; + $query = $this->db->query($sql); - return $query->result(); - } + return $query->result(); + } - function get_lotw_qsos_to_upload($station_id, $start_date, $end_date) { + function get_lotw_qsos_to_upload($station_id, $start_date, $end_date) + { $this->db->select('COL_PRIMARY_KEY,COL_CALL, COL_BAND, COL_BAND_RX, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_SUBMODE, COL_FREQ, COL_FREQ_RX, COL_GRIDSQUARE, COL_SAT_NAME, COL_PROP_MODE, COL_LOTW_QSL_SENT, station_id'); @@ -4542,12 +4614,13 @@ function lotw_last_qsl_date($user_id) { return $query; } - function mark_lotw_sent($qso_id) { + function mark_lotw_sent($qso_id) + { - $data = array( - 'COL_LOTW_QSLSDATE' => date("Y-m-d H:i:s"), - 'COL_LOTW_QSL_SENT' => 'Y', - ); + $data = array( + 'COL_LOTW_QSLSDATE' => date("Y-m-d H:i:s"), + 'COL_LOTW_QSL_SENT' => 'Y', + ); $this->db->where('COL_PRIMARY_KEY', $qso_id); @@ -4557,94 +4630,96 @@ function lotw_last_qsl_date($user_id) { return "Updated"; } - function county_qso_details($state, $county) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + function county_qso_details($state, $county) + { + $CI = &get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); - $this->db->join('lotw_users', 'lotw_users.callsign = '.$this->config->item('table_name').'.col_call', 'left outer'); - $this->db->where_in($this->config->item('table_name').'.station_id', $logbooks_locations_array); - $this->db->where('COL_STATE', $state); - $this->db->where('COL_CNTY', $county); - $this->db->where('COL_PROP_MODE !=', 'SAT'); + $this->db->join('station_profile', 'station_profile.station_id = ' . $this->config->item('table_name') . '.station_id'); + $this->db->join('lotw_users', 'lotw_users.callsign = ' . $this->config->item('table_name') . '.col_call', 'left outer'); + $this->db->where_in($this->config->item('table_name') . '.station_id', $logbooks_locations_array); + $this->db->where('COL_STATE', $state); + $this->db->where('COL_CNTY', $county); + $this->db->where('COL_PROP_MODE !=', 'SAT'); - return $this->db->get($this->config->item('table_name')); + return $this->db->get($this->config->item('table_name')); + } + + public function check_qso_is_accessible($id) + { + // check if qso belongs to user + $this->db->select($this->config->item('table_name') . '.COL_PRIMARY_KEY'); + $this->db->join('station_profile', $this->config->item('table_name') . '.station_id = station_profile.station_id'); + $this->db->where('station_profile.user_id', $this->session->userdata('user_id')); + $this->db->where($this->config->item('table_name') . '.COL_PRIMARY_KEY', $id); + $query = $this->db->get($this->config->item('table_name')); + if ($query->num_rows() == 1) { + return true; } + return false; + } - public function check_qso_is_accessible($id) { - // check if qso belongs to user - $this->db->select($this->config->item('table_name').'.COL_PRIMARY_KEY'); - $this->db->join('station_profile', $this->config->item('table_name').'.station_id = station_profile.station_id'); - $this->db->where('station_profile.user_id', $this->session->userdata('user_id')); - $this->db->where($this->config->item('table_name').'.COL_PRIMARY_KEY', $id); - $query = $this->db->get($this->config->item('table_name')); - if ($query->num_rows() == 1) { - return true; + // [JSON PLOT] return array for plot qso for map // + public function get_plot_array_for_map($qsos_result, $isVisitor = false) + { + $this->load->library('qra'); + + $json["markers"] = array(); + + foreach ($qsos_result as $row) { + $plot = array('lat' => 0, 'lng' => 0, 'html' => '', 'label' => '', 'confirmed' => 'N'); + + $plot['label'] = $row->COL_CALL; + + $plot['html'] = "Callsign: " . $row->COL_CALL . "
Date/Time: " . $row->COL_TIME_ON . "
"; + $plot['html'] .= ($row->COL_SAT_NAME != null) ? ("SAT: " . $row->COL_SAT_NAME . "
") : ("Band: " . $row->COL_BAND . "
"); + $plot['html'] .= "Mode: " . ($row->COL_SUBMODE == null ? $row->COL_MODE : $row->COL_SUBMODE) . "
"; + + // check if qso is confirmed // + if (!$isVisitor) { + if (($row->COL_EQSL_QSL_RCVD == 'Y') || ($row->COL_LOTW_QSL_RCVD == 'Y') || ($row->COL_QSL_RCVD == 'Y')) { + $plot['confirmed'] = "Y"; } - return false; - } - - // [JSON PLOT] return array for plot qso for map // - public function get_plot_array_for_map($qsos_result, $isVisitor=false) { - $this->load->library('qra'); - - $json["markers"] = array(); - - foreach ($qsos_result as $row) { - $plot = array('lat'=>0, 'lng'=>0, 'html'=>'', 'label'=>'', 'confirmed'=>'N'); - - $plot['label'] = $row->COL_CALL; - - $plot['html'] = "Callsign: ".$row->COL_CALL."
Date/Time: ".$row->COL_TIME_ON."
"; - $plot['html'] .= ($row->COL_SAT_NAME != null) ? ("SAT: ".$row->COL_SAT_NAME."
") : ("Band: ".$row->COL_BAND."
"); - $plot['html'] .= "Mode: ".($row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE)."
"; - - // check if qso is confirmed // - if (!$isVisitor) { - if (($row->COL_EQSL_QSL_RCVD=='Y') || ($row->COL_LOTW_QSL_RCVD=='Y') || ($row->COL_QSL_RCVD=='Y')) { - $plot['confirmed'] = "Y"; - } - } - // check lat / lng (depend info source) // - if ($row->COL_GRIDSQUARE != null) { - $stn_loc = $this->qra->qra2latlong($row->COL_GRIDSQUARE); - - } elseif ($row->COL_VUCC_GRIDS != null) { - $grids = explode(",", $row->COL_VUCC_GRIDS); - if (count($grids) == 2) { - $grid1 = $this->qra->qra2latlong(trim($grids[0])); - $grid2 = $this->qra->qra2latlong(trim($grids[1])); - - $coords[]=array('lat' => $grid1[0],'lng'=> $grid1[1]); - $coords[]=array('lat' => $grid2[0],'lng'=> $grid2[1]); - - $stn_loc = $this->qra->get_midpoint($coords); - } - if (count($grids) == 4) { - $grid1 = $this->qra->qra2latlong(trim($grids[0])); - $grid2 = $this->qra->qra2latlong(trim($grids[1])); - $grid3 = $this->qra->qra2latlong(trim($grids[2])); - $grid4 = $this->qra->qra2latlong(trim($grids[3])); - - $coords[]=array('lat' => $grid1[0],'lng'=> $grid1[1]); - $coords[]=array('lat' => $grid2[0],'lng'=> $grid2[1]); - $coords[]=array('lat' => $grid3[0],'lng'=> $grid3[1]); - $coords[]=array('lat' => $grid4[0],'lng'=> $grid4[1]); - - $stn_loc = $this->qra->get_midpoint($coords); - } - } else { - if (isset($row->lat) && isset($row->long)) { - $stn_loc = array($row->lat, $row->long); - } - } - list($plot['lat'], $plot['lng']) = $stn_loc; - // add plot // - $json["markers"][] = $plot; } - return $json; + // check lat / lng (depend info source) // + if ($row->COL_GRIDSQUARE != null) { + $stn_loc = $this->qra->qra2latlong($row->COL_GRIDSQUARE); + } elseif ($row->COL_VUCC_GRIDS != null) { + $grids = explode(",", $row->COL_VUCC_GRIDS); + if (count($grids) == 2) { + $grid1 = $this->qra->qra2latlong(trim($grids[0])); + $grid2 = $this->qra->qra2latlong(trim($grids[1])); + + $coords[] = array('lat' => $grid1[0], 'lng' => $grid1[1]); + $coords[] = array('lat' => $grid2[0], 'lng' => $grid2[1]); + + $stn_loc = $this->qra->get_midpoint($coords); + } + if (count($grids) == 4) { + $grid1 = $this->qra->qra2latlong(trim($grids[0])); + $grid2 = $this->qra->qra2latlong(trim($grids[1])); + $grid3 = $this->qra->qra2latlong(trim($grids[2])); + $grid4 = $this->qra->qra2latlong(trim($grids[3])); + + $coords[] = array('lat' => $grid1[0], 'lng' => $grid1[1]); + $coords[] = array('lat' => $grid2[0], 'lng' => $grid2[1]); + $coords[] = array('lat' => $grid3[0], 'lng' => $grid3[1]); + $coords[] = array('lat' => $grid4[0], 'lng' => $grid4[1]); + + $stn_loc = $this->qra->get_midpoint($coords); + } + } else { + if (isset($row->lat) && isset($row->long)) { + $stn_loc = array($row->lat, $row->long); + } + } + list($plot['lat'], $plot['lng']) = $stn_loc; + // add plot // + $json["markers"][] = $plot; } + return $json; + } } function validateADIFDate($date, $format = 'Ymd') @@ -4652,4 +4727,3 @@ function validateADIFDate($date, $format = 'Ymd') $d = DateTime::createFromFormat($format, $date); return $d && $d->format($format) == $date; } -?> From 96d63f49aa959136cfef686ea2493cdc08b7f35b Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Sat, 3 Feb 2024 14:12:40 +0000 Subject: [PATCH 13/30] Cleaned up the code better for #2947 --- application/models/Logbook_model.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 48fefee7..8b1d06b3 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -294,11 +294,8 @@ class Logbook_model extends CI_Model $data['COL_STATION_CALLSIGN'] = strtoupper(trim($station['station_callsign'])); $data['COL_MY_DXCC'] = strtoupper(trim($station['station_dxcc'])); - if (isset($station['station_country'])) { - $data['COL_MY_COUNTRY'] = strtoupper(trim($station['station_country'])); - } else { - $data['COL_MY_COUNTRY'] = null; - } + $data['COL_MY_COUNTRY'] = $station['station_country'] == null ? '' : strtoupper(trim($station['station_country'])); + $data['COL_MY_CNTY'] = strtoupper(trim($station['station_cnty'])); $data['COL_MY_CQ_ZONE'] = strtoupper(trim($station['station_cq'])); $data['COL_MY_ITU_ZONE'] = strtoupper(trim($station['station_itu'])); From c1c5d9357d7d83f05af2030d8d7a01070a1b5975 Mon Sep 17 00:00:00 2001 From: cats-shadow Date: Sun, 4 Feb 2024 16:06:16 +0300 Subject: [PATCH 14/30] Russian translation update --- application/language/russian/account_lang.php | 22 +++--- application/language/russian/adif_lang.php | 4 +- application/language/russian/admin_lang.php | 22 +++--- .../language/russian/contesting_lang.php | 6 +- .../language/russian/general_words_lang.php | 20 ++--- application/language/russian/menu_lang.php | 8 +- application/language/russian/options_lang.php | 48 ++++++------ application/language/russian/qslcard_lang.php | 26 +++---- application/language/russian/qso_lang.php | 16 ++-- application/language/russian/station_lang.php | 76 +++++++++---------- .../language/russian/statistics_lang.php | 18 ++--- 11 files changed, 133 insertions(+), 133 deletions(-) diff --git a/application/language/russian/account_lang.php b/application/language/russian/account_lang.php index fb94eb67..3022af13 100644 --- a/application/language/russian/account_lang.php +++ b/application/language/russian/account_lang.php @@ -77,10 +77,10 @@ $lang['account_logbook_of_the_world_lotw_username'] = 'Логин'; $lang['account_logbook_of_the_world_lotw_password'] = 'Пароль'; $lang['account_leave_blank_to_keep_existing_password'] = 'Оставьте пустым для сохранения текущего пароля'; -$lang['account_clublog'] = 'Club Log'; +$lang['account_clublog'] = 'Clublog'; $lang['account_clublog_email_callsign'] = 'Емэйл/позывной'; $lang['account_clublog_password'] = 'Пароль'; -$lang['account_the_email_or_callsign_you_use_to_login_to_club_log'] = 'Емэйл или позывной, которые вы используете для логина в Club Log'; +$lang['account_the_email_or_callsign_you_use_to_login_to_club_log'] = 'Емэйл или позывной, которые вы используете для логина в Clublog'; $lang['account_eqsl'] = 'eQSL'; $lang['account_eqslcc_username'] = 'Логин'; @@ -117,13 +117,13 @@ $lang['account_winkeyer'] = 'Winkeyer'; $lang['account_winkeyer_hint'] = "Поддержка Winkeyer в Cloudlog в стадии эксперимента, прочитайте сначала вики (https://github.com/magicbug/Cloudlog/wiki/Winkey) перед включением."; $lang['account_winkeyer_enabled'] = "Функционал Winkeyer включен"; -$lang['account_map_params'] = "Map Settings"; -$lang['account_map_qso_by_default'] = "QSO (by default)"; -$lang['account_map_qso_confirm'] = "QSO (confirmed)"; -$lang['account_map_qso_confirm_same_qso'] = "(If 'No', displayed as ".$lang['account_map_qso_by_default'].")"; +$lang['account_map_params'] = "Настройки карты"; +$lang['account_map_qso_by_default'] = "QSO (по умолчанию)"; +$lang['account_map_qso_confirm'] = "QSO (подтверждённые)"; +$lang['account_map_qso_confirm_same_qso'] = "(Если 'Нет', отображаются как ".$lang['account_map_qso_by_default'].")"; -$lang['account_general_information'] = "General Information"; -$lang['account_qso_logging_options'] = "QSO Logging Options"; -$lang['account_third_party_services'] = "Third Party Services"; -$lang['account_default_values'] = "Default Values"; -$lang['account_miscellaneous'] = "Miscellaneous"; \ No newline at end of file +$lang['account_general_information'] = "Основные данные"; +$lang['account_qso_logging_options'] = "Настройки записи QSO"; +$lang['account_third_party_services'] = "Сторонние сервисы"; +$lang['account_default_values'] = "Значения по умолчанию"; +$lang['account_miscellaneous'] = "Разное"; \ No newline at end of file diff --git a/application/language/russian/adif_lang.php b/application/language/russian/adif_lang.php index f00129e2..04f5bae2 100644 --- a/application/language/russian/adif_lang.php +++ b/application/language/russian/adif_lang.php @@ -26,7 +26,7 @@ $lang['adif_alert_log_files_type'] = "Лог-файлы должны иметь // $lang['general_word_warning'] --> application/language/english/general_words_lang.php "PHP Upload Warning" // $lang['gen_max_file_upload_size'] --> application/language/english/general_words_lang.php "PHP Upload Warning" -$lang['adif_select_stationlocation'] = "Выберите расположение станции"; +$lang['adif_select_stationlocation'] = "Выберите местоположение станции"; // $lang['gen_hamradio_callsign'] --> application/language/english/general_words_lang.php // The File Input is translated by the Browser @@ -46,7 +46,7 @@ $lang['adif_dxcc_from_adif_hint'] = "Если не отмечено, Cloudlog б $lang['adif_always_use_login_call_as_op'] = "Всегда использовать позывной (логин) как имя оператора при импорте"; $lang['adif_ignore_station_call'] = "Игнорировать позывной станции при импорте"; -$lang['adif_ignore_station_call_hint'] = "Если отмечено, Cloudlog попытается импортировать все QSO из ADIF, независимо от соответствия из выбранному расположению станции."; +$lang['adif_ignore_station_call_hint'] = "Если отмечено, Cloudlog попытается импортировать все QSO из ADIF, независимо от соответствия из выбранному местоположению станции."; $lang['adif_upload'] = "Загрузить"; diff --git a/application/language/russian/admin_lang.php b/application/language/russian/admin_lang.php index 2cd36711..40457dd4 100644 --- a/application/language/russian/admin_lang.php +++ b/application/language/russian/admin_lang.php @@ -5,32 +5,32 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $lang['admin_user_line1'] = 'Для работы Cloudlog требуется хотя наличие хотя бы одного пользовательского аккаунта.'; $lang['admin_user_line2'] = 'Пользователям могут быть назначены роли, которые предоставляют им различные права, например, добавление QSO в журнал и доступ к API Cloudlog.'; $lang['admin_user_line3'] = 'Текущий вошедший в систему пользователь отображается в правом верхнем углу каждой страницы.'; -$lang['admin_user_line4'] = "With the password reset button, you can send a user an email containing a link to reset their password. To achieve this, ensure that the email settings in the global options are configured correctly."; +$lang['admin_user_line4'] = "При помощи кнопки сброса пароля вы можете отправить пользователю емэйл с ссылкой для сброса пароля. Для правильной работы необходима корректная конфигурация емэйл в общих настройках."; $lang['admin_user_list'] = 'Список пользователей'; $lang['admin_user'] = 'Пользователь'; $lang['admin_email'] = 'Емэйл'; $lang['admin_type'] = 'Роль'; -$lang['admin_last_login'] = "Last Login"; +$lang['admin_last_login'] = "Последний логин"; $lang['admin_options'] = 'Опции'; $lang['admin_create_user'] = 'Создать пользователя'; $lang['admin_delete'] = 'Удалить'; -$lang['admin_remove'] = "Remove"; +$lang['admin_remove'] = "Убрать"; $lang['admin_edit'] = 'Редактировать'; -$lang['admin_create'] = 'Create'; -$lang['admin_update'] = 'Update'; -$lang['admin_copy'] = 'Copy'; -$lang['admin_save'] = 'Save'; -$lang['admin_close'] = 'Close'; +$lang['admin_create'] = 'Создать'; +$lang['admin_update'] = 'Обновить'; +$lang['admin_copy'] = 'Скопировать'; +$lang['admin_save'] = 'Сохранить'; +$lang['admin_close'] = 'Закрыть'; $lang['admin_user_accounts'] = 'Аккаунты пользователей'; $lang['admin_danger'] = 'ОПАСНО!'; $lang['admin_experimental'] = "Экспериментально"; -$lang['admin_password_reset'] = "Password Reset"; +$lang['admin_password_reset'] = "Сброс пароля"; -$lang['admin_email_settings_incorrect'] = "Email settings are incorrect."; -$lang['admin_password_reset_processed'] = "Password Reset E-Mail sent."; +$lang['admin_email_settings_incorrect'] = "Настройки емэйл некорректны."; +$lang['admin_password_reset_processed'] = "Емэйл для сброса пароля отправлен."; // Contest Menu diff --git a/application/language/russian/contesting_lang.php b/application/language/russian/contesting_lang.php index 63726a31..416abda6 100644 --- a/application/language/russian/contesting_lang.php +++ b/application/language/russian/contesting_lang.php @@ -9,10 +9,10 @@ $lang['contesting_operator_callsign'] = 'Позывной оператора'; $lang['contesting_exchange_type'] = 'Тип обмена'; $lang['contesting_exchange_type_serial'] = 'Номер'; $lang['contesting_exchange_type_none'] = 'нет'; -$lang['contesting_exchange_type_exchange'] = 'Обмен'; +$lang['contesting_exchange_type_exchange'] = 'Контроль'; $lang['contesting_exchange_type_gridsquare'] = 'Квадрат'; $lang['contesting_exchange_type_other'] = 'Другой'; -$lang['contesting_exchange_type_serial_exchange'] = 'Номер + Обмен'; +$lang['contesting_exchange_type_serial_exchange'] = 'Номер + контроль'; $lang['contesting_exchange_type_serial_gridsquare'] = 'Номер + Квадрат'; $lang['contesting_exchange_serial_s'] = 'Номер (TX)'; $lang['contesting_exchange_serial_r'] = 'Номер (RX)'; @@ -27,6 +27,6 @@ $lang['contesting_btn_save_qso'] = 'Сохранить QSO'; $lang['contesting_title_callsign_suggestions'] = 'Предложение позывных'; $lang['contesting_title_contest_logbook'] = 'Журнал контеста'; -$lang['contesting_copy_exch_to_dok'] = 'Копировать принятый обмен в поле DOK базы данных!'; +$lang['contesting_copy_exch_to_dok'] = 'Копировать принятую контроль в поле DOK базы данных!'; diff --git a/application/language/russian/general_words_lang.php b/application/language/russian/general_words_lang.php index a9a7159a..41eebd51 100644 --- a/application/language/russian/general_words_lang.php +++ b/application/language/russian/general_words_lang.php @@ -2,7 +2,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); -$lang['error_no_active_station_profile'] = 'Внимание: вам нужно назначить активный профиль месторасположения станции.'; +$lang['error_no_active_station_profile'] = 'Внимание: вам нужно назначить активное местоположение станции.'; $lang['notice_turn_the_radio_on'] = 'За сегодня ни одного QSO, время вернуться к радио!'; @@ -23,9 +23,9 @@ $lang['general_word_export'] = "Экспорт"; $lang['general_word_import'] = "Импорт"; $lang['general_word_count'] = "Счётчик"; $lang['general_word_filtering_on'] = "Отфильтровано по"; -$lang['general_word_not_display'] = "Not display"; -$lang['general_word_icon'] = "Icon"; -$lang['general_word_never'] = "Never"; +$lang['general_word_not_display'] = "Не отображать"; +$lang['general_word_icon'] = "Иконка"; +$lang['general_word_never'] = "Никогда"; $lang['general_word_date'] = 'Дата'; $lang['general_word_startdate'] = "Дата начала"; @@ -43,13 +43,13 @@ $lang['general_word_satellite'] = 'Спутник'; $lang['general_word_satellite_short'] = 'Спутн.'; $lang['general_word_notes'] = 'Заметки'; $lang['general_word_country'] = 'Страна'; -$lang['general_word_city'] = 'City'; +$lang['general_word_city'] = 'Город'; $lang['general_word_total'] = 'Всего'; $lang['general_word_year'] = 'Год'; $lang['general_word_month'] = 'Месяц'; -$lang['general_word_day'] = "Day"; -$lang['general_word_days'] = "Days"; +$lang['general_word_day'] = "День"; +$lang['general_word_days'] = "Дней"; $lang['general_word_colors'] = "Цвета"; $lang['general_word_light'] = "Свет/лазер"; @@ -57,7 +57,7 @@ $lang['general_word_worked'] = 'Сработано'; $lang['general_word_worked_not_confirmed'] = "Сработано, не подтверждено"; $lang['general_word_not_worked'] = "Не сработано"; $lang['general_word_confirmed'] = 'Подтверждено'; -$lang['general_word_confirmation'] = "Пожтверждение"; +$lang['general_word_confirmation'] = "Подтверждение"; $lang['general_word_needed'] = 'Необходимо'; $lang['general_word_all'] = 'Все'; @@ -111,12 +111,12 @@ $lang['general_total_distance'] = 'Суммарная дистанция'; $lang['gen_max_file_upload_size'] = 'Максимальный размер загружаемого файла '; // Cloudlog Terms -$lang['cloudlog_station_profile'] = 'Месторасположение станции'; +$lang['cloudlog_station_profile'] = 'Местоположение станции'; $lang['gen_hamradio_cq'] = "CQ"; // ham radio terms $lang['gen_hamradio_qso'] = 'QSO'; -$lang['gen_hamradio_station'] = 'Станция'; +$lang['gen_hamradio_station'] = ''; $lang['gen_hamradio_call'] = 'Позывной'; $lang['gen_hamradio_prefix'] = "Префикс"; diff --git a/application/language/russian/menu_lang.php b/application/language/russian/menu_lang.php index 2c15ae60..a5e674e5 100644 --- a/application/language/russian/menu_lang.php +++ b/application/language/russian/menu_lang.php @@ -62,15 +62,15 @@ $lang['menu_update_country_files'] = 'Обновить файлы стран'; $lang['menu_debug_information'] = 'Отладочная информация'; $lang['menu_search_text'] = 'Поиск позывного'; -$lang['menu_search_text_quicklog'] = "Add/Search Callsign"; +$lang['menu_search_text_quicklog'] = "Добавить/Найти позывной"; $lang['menu_search_button'] = 'Поиск'; -$lang['menu_search_button_qicksearch_log'] = "Log"; +$lang['menu_search_button_qicksearch_log'] = "Журнал"; $lang['menu_login_button'] = 'Вход'; $lang['menu_account'] = 'Аккаунт'; -$lang['menu_station_logbooks'] = 'Аппаратные журналы'; -$lang['menu_station_locations'] = 'Расположения станции'; +$lang['menu_station_logbooks'] = 'Журналы'; +$lang['menu_station_locations'] = 'Местоположения станции'; $lang['menu_bands'] = 'Диапазоны'; $lang['menu_adif_import_export'] = 'Импорт / экспорт ADIF'; $lang['menu_kml_export'] = 'Экспорт KML'; diff --git a/application/language/russian/options_lang.php b/application/language/russian/options_lang.php index 9c881978..1903d41b 100644 --- a/application/language/russian/options_lang.php +++ b/application/language/russian/options_lang.php @@ -75,30 +75,30 @@ $lang['options_dxcluster_maxage_changed_to']='Максимальный возр $lang['options_dxcluster_decont_changed_to']='континент изменён на '; $lang['options_dxcluster_decont_hint']='Бубт показаны споты только от споттеров с указанного континента'; -$lang['options_version_dialog'] = "Version Info"; -$lang['options_version_dialog_close'] = "Close"; -$lang['options_version_dialog_dismiss'] = "Don't show again"; -$lang['options_version_dialog_settings'] = "Version Info Settings"; -$lang['options_version_dialog_header'] = "Version Info Header"; -$lang['options_version_dialog_header_hint'] = "You can change the header of the version info dialog."; -$lang['options_version_dialog_header_changed_to'] = "Version Info Header changed to"; -$lang['options_version_dialog_mode'] = "Version Info Mode"; -$lang['options_version_dialog_mode_release_notes'] = "Only Release Notes"; -$lang['options_version_dialog_mode_custom_text'] = "Only Custom Text"; -$lang['options_version_dialog_mode_both'] = "Release Notes and Custom Text"; -$lang['options_version_dialog_mode_disabled'] = "Disabled"; -$lang['options_version_dialog_mode_hint'] = "The Version Info is shown to every user. The user has the option to dismiss the dialog after he read it. Select if you want to show only release notes (fetched from github), only custom text or both."; -$lang['options_version_dialog_custom_text'] = "Version Info Custom Text"; -$lang['options_version_dialog_custom_text_hint'] = "This is the custom text which is shown in the dialog."; -$lang['options_version_dialog_mode_changed_to'] = "Version Info Mode changed to"; -$lang['options_version_dialog_custom_text_saved'] = "Version Info Custom Text saved!"; -$lang['options_version_dialog_success_show_all'] = "Version Info will be shown to all users again"; -$lang['options_version_dialog_success_hide_all'] = "Version Info will not be shown to any user"; -$lang['options_version_dialog_show_hide'] = "Show/Hide Version Info Dialog for all Users"; -$lang['options_version_dialog_show_all'] = "Show for all Users"; -$lang['options_version_dialog_hide_all'] = "Hide for all Users"; -$lang['options_version_dialog_show_all_hint'] = "This will show the version dialog automatically to all users on their next page reload."; -$lang['options_version_dialog_hide_all_hint'] = "This will deactivate the automatic popup of the version dialog for all users."; +$lang['options_version_dialog'] = "Информация о версии"; +$lang['options_version_dialog_close'] = "Закрыть"; +$lang['options_version_dialog_dismiss'] = "Не показывать сновва"; +$lang['options_version_dialog_settings'] = "Настройики отображения информации о версии"; +$lang['options_version_dialog_header'] = "Заголовок диалога отображения информации о версии"; +$lang['options_version_dialog_header_hint'] = "Вы можете изменить заголовок диалога отображения информации о версии."; +$lang['options_version_dialog_header_changed_to'] = "Заголовок диалога отображения информации о версии изменён на"; +$lang['options_version_dialog_mode'] = "Режим отображения информации о версии"; +$lang['options_version_dialog_mode_release_notes'] = "Только информация о релизе"; +$lang['options_version_dialog_mode_custom_text'] = "Только настраиваемый текст"; +$lang['options_version_dialog_mode_both'] = "Информация о релизе и настраиваемый текст"; +$lang['options_version_dialog_mode_disabled'] = "Отключено"; +$lang['options_version_dialog_mode_hint'] = "Информация о версии показывается каждому пользователю. Пользователь имеет возможность отключить диалог после прочтения. Выберите что вы хотите показывать: только информацию о релизе (полученную с Github), только настраиваемый текст или оба варианта."; +$lang['options_version_dialog_custom_text'] = "Настраиваемый текст об информации о версии"; +$lang['options_version_dialog_custom_text_hint'] = "Это настраиваемый текст, который будет отображаться в диалоге."; +$lang['options_version_dialog_mode_changed_to'] = "Режим отображения информации о версии изменён на"; +$lang['options_version_dialog_custom_text_saved'] = "Настраиваемый текст сохранён!"; +$lang['options_version_dialog_success_show_all'] = "Информация о версии будет показана всем пользователям снова"; +$lang['options_version_dialog_success_hide_all'] = "Информация о версии не будет показана никому"; +$lang['options_version_dialog_show_hide'] = "Показать/скрыть отображение диалога информации о версии для всех пользователей"; +$lang['options_version_dialog_show_all'] = "Показать всем пользователям"; +$lang['options_version_dialog_hide_all'] = "Скрыть от всех пользователей"; +$lang['options_version_dialog_show_all_hint'] = "Это покажет диалог информации о версии всем пользователям автоматически при обновлении ими страницы."; +$lang['options_version_dialog_hide_all_hint'] = "Это отключит автоматическое отображение диалога информации о версии для всех пользователей."; $lang['options_save'] = 'Сохранить'; diff --git a/application/language/russian/qslcard_lang.php b/application/language/russian/qslcard_lang.php index f46a23d9..a571760b 100644 --- a/application/language/russian/qslcard_lang.php +++ b/application/language/russian/qslcard_lang.php @@ -23,17 +23,17 @@ $lang['qslcard_upload_back'] = 'Загруженное изображение о $lang['qslcard_upload_button'] = 'Загрузить изображение для QSL карточки'; -$lang['qslcard_qslprint_header'] = "Export Requested QSLs for Printing"; -$lang['qslcard_qslprint_text_line1'] = "Here you can export requested QSLs as CSV or ADIF files for printing and, optionally, mark them as sent."; -$lang['qslcard_qslprint_text_line2'] = "Requested QSLs are any QSOs with a value of 'Requested' or 'Queued' in their 'QSL Sent' field."; -$lang['qslcard_qslprint_send_method'] = "Send Method"; -$lang['qslcard_qslprint_mark_as_sent'] = "Mark as sent"; -$lang['qslcard_qslprint_mark_selected_as_printed'] = "Mark selected QSOs as printed"; -$lang['qslcard_qslprint_remove_selected_from_queue'] = "Remove selected QSOs from the queue"; -$lang['qslcard_qslprint_export_csv'] = "Export requested QSLs to CSV-file"; -$lang['qslcard_qslprint_export_adif'] = "Export requested QSLs to ADIF-file"; -$lang['qslcard_qslprint_mark_requested_as_sent'] = "Mark requested QSLs as sent"; -$lang['qslcard_qslprint_no_qsls_found'] = "No QSLs to print were found!"; -$lang['qslcard_qslprint_add_to_queue'] = "Add to print queue"; -$lang['qslcard_qslprint_no_additional_qso_found'] = "No additional QSO's were found. That means they are probably already in the queue."; +$lang['qslcard_qslprint_header'] = "Экспортировать запрошенные QSL для печати"; +$lang['qslcard_qslprint_text_line1'] = "Здесь вы можете экспортировать запрошенные QSL в файлы формата CSV или ADIF для печати и, при желании, отметить их, как отправленные."; +$lang['qslcard_qslprint_text_line2'] = "Запрошенные QSL это QSOs c значениями 'Запрошено' или 'В очереди' в поле 'QSL отправлено'"; +$lang['qslcard_qslprint_send_method'] = "Метод отправки"; +$lang['qslcard_qslprint_mark_as_sent'] = "Отметить как отправленное"; +$lang['qslcard_qslprint_mark_selected_as_printed'] = "Отметить выбранные QSO как отпечатанные"; +$lang['qslcard_qslprint_remove_selected_from_queue'] = "Убрать выбранные QSO из очереди"; +$lang['qslcard_qslprint_export_csv'] = "Экспортировать запрошенные QSL в файл CSV"; +$lang['qslcard_qslprint_export_adif'] = "Экспортировать запрошенные QSL в файл ADIF"; +$lang['qslcard_qslprint_mark_requested_as_sent'] = "Отметить запрошенные QSL как отправденные"; +$lang['qslcard_qslprint_no_qsls_found'] = "QSL для печати не найдены!"; +$lang['qslcard_qslprint_add_to_queue'] = "Добавить в очередь печати"; +$lang['qslcard_qslprint_no_additional_qso_found'] = "Дополнительных QSO не найдено, возможно они уже в очереди печати."; diff --git a/application/language/russian/qso_lang.php b/application/language/russian/qso_lang.php index e0efcc36..6f576991 100644 --- a/application/language/russian/qso_lang.php +++ b/application/language/russian/qso_lang.php @@ -6,12 +6,12 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $lang['qso_title_qso_map'] = 'Карта QSO'; $lang['qso_title_suggestions'] = 'Предложения'; $lang['qso_title_previous_contacts'] = 'Предыдущие контакты'; -$lang['qso_title_times_worked_before'] = "times worked before"; -$lang['qso_title_image'] = 'Profile Picture'; -$lang['qso_previous_max_shown'] = "Max. 5 previous contacts are shown"; +$lang['qso_title_times_worked_before'] = "раз сработано раньше"; +$lang['qso_title_image'] = 'Изображение профиля'; +$lang['qso_previous_max_shown'] = "Отображается до 5 предыдущих QSO"; // Quicklog on Dashboard -$lang['qso_quicklog_enter_callsign'] = 'QUICKLOG Enter Callsign'; +$lang['qso_quicklog_enter_callsign'] = 'Для быстрой записи в журнал введите позывной'; // Input Help Text on the /QSO Display $lang['qso_transmit_power_helptext'] = 'Укажите мощность в Ваттах (только цифры).'; @@ -28,10 +28,10 @@ $lang['qso_dok_helptext'] = 'Например: Q03'; $lang['qso_notes_helptext'] = 'Содержание заметки используется только Cloudlog и не экспортируется на другие сервисы.'; $lang['qsl_notes_helptext'] = 'СОдержимое этой заметки экспортируется в QSL сервисы, к примеру, eqsl.cc и т.п.'; -$lang['qso_eqsl_qslmsg_helptext'] = "Get the default message for eQSL, for this station."; +$lang['qso_eqsl_qslmsg_helptext'] = "Сообщение в eQSL по умолчанию для этой станции."; // error text // -$lang['qso_error_timeoff_less_timeon'] = "TimeOff is less than TimeOn"; +$lang['qso_error_timeoff_less_timeon'] = "Время окончания раньше, чем время начала"; // Button Text on /qso Display @@ -61,8 +61,8 @@ $lang['qso_simplefle_qso_list_total'] = "Всего"; $lang['qso_simplefle_qso_date'] = "Дата QSO"; $lang['qso_simplefle_operator'] = "Оператор"; $lang['qso_simplefle_operator_hint'] = "к примеру, OK2CQR"; -$lang['qso_simplefle_station_call_location'] = "Позывной/расположение станции"; -$lang['qso_simplefle_station_call_location_hint'] = "Если вы работаете из нового расположения станции, сначала создайте его здесь: Расположение станции"; +$lang['qso_simplefle_station_call_location'] = "Позывной/Местоположение станции"; +$lang['qso_simplefle_station_call_location_hint'] = "Если вы работаете из нового местоположения станции, сначала создайте его здесь: Местоположение станции"; $lang['qso_simplefle_utc_time'] = "Текущее время UTC"; $lang['qso_simplefle_enter_the_data'] = "Введите данные"; $lang['qso_simplefle_syntax_help_close_w_sample'] = "Закройте и загрузите образец данных"; diff --git a/application/language/russian/station_lang.php b/application/language/russian/station_lang.php index 00f1460c..c478af52 100644 --- a/application/language/russian/station_lang.php +++ b/application/language/russian/station_lang.php @@ -8,22 +8,22 @@ Station Logbooks ___________________________________________________________________________________________ */ -$lang['station_logbooks'] = "Журналы станции"; -$lang['station_logbooks_description_header'] = "Что такое журнал станции"; -$lang['station_logbooks_description_text'] = "Журналы станции позволяют вам группировать расположения станции, это позволяет вам видеть все расположения станции в одном журнале для аналитики. Удобно если вы работает из нескольких расположений, но все они -- часть одного и того же DXCC или VUCC Circle."; -$lang['station_logbooks_create'] = "Создать журнал станции"; +$lang['station_logbooks'] = "Журналы"; +$lang['station_logbooks_description_header'] = "Что такое журнал"; +$lang['station_logbooks_description_text'] = "Журналы позволяют вам группировать местоположения станции, это позволяет вам видеть все местоположения станции в одном журнале для аналитики. Удобно если вы работает из нескольких местоположений, но все они -- часть одного и того же DXCC или VUCC Circle."; +$lang['station_logbooks_create'] = "Создать журнал"; $lang['station_logbooks_status'] = "Статус"; $lang['station_logbooks_link'] = "Ссылка"; $lang['station_logbooks_public_search'] = "Публичный поиск"; $lang['station_logbooks_set_active'] = "Установить как активный журнал"; $lang['station_logbooks_active_logbook'] = "Активный журнал"; $lang['station_logbooks_edit_logbook'] = "Редактировать журнал"; // Full sentence will be generated 'Edit Station Logbook: [Logbook Name]' -$lang['station_logbooks_confirm_delete'] = "Вы уверены, что хотите удалить следующий журнал? Вы должны связать все привязанные к нему расположения станций к другим журналам.: "; +$lang['station_logbooks_confirm_delete'] = "Вы уверены, что хотите удалить следующий журнал? Вы должны связать все привязанные к нему местоположения станций к другим журналам.: "; $lang['station_logbooks_view_public'] = "Просмотр публичной страницы журнала: "; $lang['station_logbooks_create_name'] = "Имя журнала"; -$lang['station_logbooks_create_name_hint'] = "Вы можете назвать журнал станции как угодно."; -$lang['station_logbooks_edit_name_hint'] = "Короткое название для журнала станции, например: Home Log (IO87IP)"; -$lang['station_logbooks_edit_name_update'] = "Обновить имя журнала станции"; +$lang['station_logbooks_create_name_hint'] = "Вы можете назвать журнал как угодно."; +$lang['station_logbooks_edit_name_hint'] = "Короткое название для журнала, например: Home Log (IO87IP)"; +$lang['station_logbooks_edit_name_update'] = "Обновить имя журнала"; $lang['station_logbooks_public_slug'] = "Публичная метка"; $lang['station_logbooks_public_slug_hint'] = "Установка публичной метки позволит вам поделиться вашим журналом, используя веб-ссылку, это имя должно содержать только буквы и цифры."; $lang['station_logbooks_public_slug_format1'] = "Ссылка будет выглядеть так:"; @@ -32,11 +32,11 @@ $lang['station_logbooks_public_slug_input'] = "Введите публичную $lang['station_logbooks_public_slug_visit'] = "Посетите публичную страницу"; $lang['station_logbooks_public_search_hint'] = "Включение функции публичного поиска открывает поле ввода для поиска на странице публичного журнала, доступ к которой осуществляется по публичной метке. Поиск производится только в данном журнале."; $lang['station_logbooks_public_search_enabled'] = "Публичный поиск включен"; -$lang['station_logbooks_select_avail_loc'] = "Выберите доступное расположение станции"; -$lang['station_logbooks_link_loc'] = "Привяжите расположение"; -$lang['station_logbooks_linked_loc'] = "Привязанные расположения"; -$lang['station_logbooks_no_linked_loc'] = "Нет привязанных расположений"; -$lang['station_logbooks_unlink_station_location'] = "Unlink Station Location"; +$lang['station_logbooks_select_avail_loc'] = "Выберите доступное местоположение станции"; +$lang['station_logbooks_link_loc'] = "Привяжите местоположение станции"; +$lang['station_logbooks_linked_loc'] = "Привязанные местоположения станции"; +$lang['station_logbooks_no_linked_loc'] = "Нет привязанных местоположений станции"; +$lang['station_logbooks_unlink_station_location'] = "Отвязать местоположение станции"; @@ -46,32 +46,32 @@ Station Locations ___________________________________________________________________________________________ */ -$lang['station_location'] = 'Расположение станции'; -$lang['station_location_plural'] = "Расположения станции"; -$lang['station_location_header_ln1'] = 'Расположения станции определяют места работы, например, ваш QTH, QTH друзей или портативная станция.'; -$lang['station_location_header_ln2'] = 'Также, как и журнал, профиль станции хранит в одном месте набор QSO.'; -$lang['station_location_header_ln3'] = 'Только одна станция может быть активно в каждый момент. В таблице ниже она отмечена меткой -Активная станция-.'; -$lang['station_location_create_header'] = 'Создать расположение станции'; -$lang['station_location_create'] = 'Создать расположение станции'; -$lang['station_location_edit'] = 'Редактировать расположение станции: '; +$lang['station_location'] = 'Местоположение станции'; +$lang['station_location_plural'] = "Местоположения станции"; +$lang['station_location_header_ln1'] = 'Местоположения станции определяют места работы, например, ваш QTH, QTH друзей или портативная станция.'; +$lang['station_location_header_ln2'] = 'Местоположение станции хранит в одном месте набор QSO, журнал хранит набор местоположений станции.'; +$lang['station_location_header_ln3'] = 'Только одно местоположение станция может быть активно в каждый момент. В таблице ниже она отмечена меткой "Активное".'; +$lang['station_location_create_header'] = 'Создать местоположение станции'; +$lang['station_location_create'] = 'Создать местоположение станции'; +$lang['station_location_edit'] = 'Редактировать местоположение станции: '; $lang['station_location_updated_suff'] = ' Обновлено.'; -$lang['station_location_warning'] = 'Внимание. Вам нужно установить активное расположение станции. Перейдите в меню Позывной->Расположение станции, чтобы выбрать.'; +$lang['station_location_warning'] = 'Внимание. Вам нужно установить активное местоположение станции. Перейдите в меню Позывной->Местоположение станции, чтобы выбрать.'; $lang['station_location_reassign_at'] = 'Пожалуйста, переназначьте их в '; -$lang['station_location_warning_reassign'] = 'Из-за недавних изменений в Cloudlog вам нужно переназначить QSO вашим профилям станции.'; +$lang['station_location_warning_reassign'] = 'Из-за недавних изменений в Cloudlog вам нужно переназначить QSO вашим сестоположениям станции.'; $lang['station_location_name'] = 'Название профиля'; -$lang['station_location_name_hint'] = 'Короткое название профиля расположения станции, к примеру: Home (IO87IP)'; +$lang['station_location_name_hint'] = 'Короткое название местоположения станции, к примеру: Home (IO87IP)'; $lang['station_location_callsign'] = 'Позывной станции'; $lang['station_location_callsign_hint'] = 'Позывной станции, например: 2M0SQL/P'; $lang['station_location_power'] = 'Мощность станции (Вт)'; $lang['station_location_power_hint'] = 'Мощность станции по умолчанию в Вт. Перезаписывается данными из CAT.'; $lang['station_location_emptylog'] = 'Очистить лог'; -$lang['station_location_confirm_active'] = 'Вы уверены, что хотите сделать эту станцию активой: '; -$lang['station_location_set_active'] = 'Установить активной'; -$lang['station_location_active'] = 'Активная станция'; +$lang['station_location_confirm_active'] = 'Вы уверены, что хотите сделать это местоположение станции активным: '; +$lang['station_location_set_active'] = 'Установить активным'; +$lang['station_location_active'] = 'Активное'; $lang['station_location_claim_ownership'] = 'Заявить собственность'; -$lang['station_location_confirm_del_qso'] = 'Вы уверены, что хотите удалить все QSO из этого профиля станции?'; -$lang['station_location_confirm_del_stationlocation'] = 'Вы уверены, что хотите удалить профиль станции '; -$lang['station_location_confirm_del_stationlocation_qso'] = ', это удалит все QSO, содержащиеся в этом профиле станции?'; +$lang['station_location_confirm_del_qso'] = 'Вы уверены, что хотите удалить все QSO из этого местоположения станции?'; +$lang['station_location_confirm_del_stationlocation'] = 'Вы уверены, что хотите удалить местоположение станции '; +$lang['station_location_confirm_del_stationlocation_qso'] = ', это удалит все QSO, содержащиеся в этом местоположении станции?'; $lang['station_location_dxcc'] = 'DXCC'; $lang['station_location_dxcc_hint'] = 'DXCC станции, к примеру: Scotland'; $lang['station_location_dxcc_warning'] = "Остановитесь на мгновение. Выбранный вами DXCC устарел и больше не действителен. Проверьте, какой DXCC для данного конкретного места является правильным. Если вы уверены, проигнорируйте это предупреждение."; @@ -93,23 +93,23 @@ $lang['station_location_signature'] = "Подпись"; $lang['station_location_signature_name'] = "Имя подписи"; $lang['station_location_signature_name_hint'] = "Подпись станции (т.е. GMA).."; $lang['station_location_signature_info'] = "Информация о подписи"; -$lang['station_location_signature_info_hint'] = "Информация о подписис станции (т.е. DA/NW-357)."; +$lang['station_location_signature_info_hint'] = "Информация о подписи станции (т.е. DA/NW-357)."; $lang['station_location_eqsl_hint'] = 'Название профиля, который сконфигурирован в eQSL для данного QTH'; -$lang['station_location_eqsl_defaultqslmsg'] = "Default QSLMSG"; -$lang['station_location_eqsl_defaultqslmsg_hint'] = "Define a default message that will be populated and sent for each QSO for this station location."; +$lang['station_location_eqsl_defaultqslmsg'] = "Сообшение в eQSL по умолчанию"; +$lang['station_location_eqsl_defaultqslmsg_hint'] = "Задайте сообщение по умолчанию, которое будет отправлено в eQSL для данного местоположения станции."; $lang['station_location_qrz_subscription'] = 'Требуется подписка'; $lang['station_location_qrz_hint'] = "Ваш ключ API находится на странице настроек журнала QRZ.com"; $lang['station_location_qrz_realtime_upload'] = 'Загрузка в журнал QRZ.com в реальном времени'; -$lang['station_location_hrdlog_username'] = "HRDLog.net Username"; -$lang['station_location_hrdlog_username_hint'] = "The username you are registered with at HRDlog.net (usually your callsign)."; -$lang['station_location_hrdlog_code'] = "HRDLog.net API Key"; +$lang['station_location_hrdlog_username'] = "Имя пользователя HRDLog.net"; +$lang['station_location_hrdlog_username_hint'] = "Имя пользователя, под которым вы зарегистрированы на HRDlog.net (обычно это -- ваш позывной)."; +$lang['station_location_hrdlog_code'] = "Ключ API HRDLog.net"; $lang['station_location_hrdlog_realtime_upload'] = "Загрузка в журнал HRDLog.net в реальном времени"; $lang['station_location_hrdlog_code_hint'] = "Создайте свой код к API наn странице профиля пользователя HRDLog.net"; $lang['station_location_qo100_hint'] = "Создайте свой ключ API на странице вашего профиля в QO-100 Dx Club"; $lang['station_location_qo100_realtime_upload'] = "Загрузка QO-100 Dx Club в реальном времени"; $lang['station_location_oqrs_enabled'] = "OQRS включен"; -$lang['station_location_oqrs_email_alert'] = "Оповещение о OQRS о емэйл"; +$lang['station_location_oqrs_email_alert'] = "Оповещение о OQRS по емэйл"; $lang['station_location_oqrs_email_hint'] = "Убедитесь, что емэйл сконфигурирован администратором в общих настройках."; $lang['station_location_oqrs_text'] = "Текст OQRS"; $lang['station_location_oqrs_text_hint'] = "Информация, которую вы хотите добавить, касающаяся QSL."; -$lang['station_location_clublog_realtime_upload']='ClubLog Realtime Upload'; +$lang['station_location_clublog_realtime_upload']="Загрузка в ClubLog в реальном времени"; diff --git a/application/language/russian/statistics_lang.php b/application/language/russian/statistics_lang.php index 2e9efab2..ba34b9fd 100644 --- a/application/language/russian/statistics_lang.php +++ b/application/language/russian/statistics_lang.php @@ -48,13 +48,13 @@ $lang['statistics_timeline'] = "Лента времени"; * */ -$lang['statistics_days_with_qso'] = "Number of days with QSOs each year"; -$lang['statistics_days_with_qso_short'] = "Days with QSOs"; -$lang['statistics_dwq_longest_streak_in_log'] = "Longest streak with QSOs in the log"; -$lang['statistics_dwq_longest_streak_in_log_hint'] = "A maximum of the 10 longest streaks are shown!"; -$lang['statistics_dwq_streak_continuous_days'] = "Streak (continuous days with QSOs)"; -$lang['statistics_dwq_current_streak_in_log'] = "Current streak with QSOs in the log"; -$lang['statistics_dwq_current_streak_continuous_days'] = "Current streak (continuous days with QSOs)"; -$lang['statistics_dwq_make_qso_to_extend_streak'] = "If you make a QSO today, you can continue to extend your streak... or else your current streak will be broken!"; -$lang['statistics_dwq_no_current_streak'] = "No current streak found!"; +$lang['statistics_days_with_qso'] = "Количество дней с QSO в каждом году"; +$lang['statistics_days_with_qso_short'] = "Дней с QSO"; +$lang['statistics_dwq_longest_streak_in_log'] = "Самый длинный интервал дней с QSO в журнале"; +$lang['statistics_dwq_longest_streak_in_log_hint'] = "Отображаются 10 самых длинных интервалов!"; +$lang['statistics_dwq_streak_continuous_days'] = "Интервал (непрерывных дней с QSO)"; +$lang['statistics_dwq_current_streak_in_log'] = "Текущий интервал дней с QSO в журнале"; +$lang['statistics_dwq_current_streak_continuous_days'] = "Текущий интервал (непрерывных дней с QSO)"; +$lang['statistics_dwq_make_qso_to_extend_streak'] = "Если вы проведёте QSO сегодня, вы можете удлинить текущий интерывл дней с QSO... иначе текущий интервал будет прерван!"; +$lang['statistics_dwq_no_current_streak'] = "Текущий интервал не найден!"; From 900b164d38e20ceb0e7bf5a11e6769dbfe0e5d03 Mon Sep 17 00:00:00 2001 From: phl0 Date: Mon, 5 Feb 2024 08:03:57 +0100 Subject: [PATCH 15/30] Show IOTA/SOTA ref on station location tab --- application/views/view_log/qso.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/application/views/view_log/qso.php b/application/views/view_log/qso.php index 2620fb5f..2d7196c1 100644 --- a/application/views/view_log/qso.php +++ b/application/views/view_log/qso.php @@ -499,6 +499,20 @@ + COL_MY_IOTA) { ?> + + + COL_MY_IOTA; ?> + + + + COL_MY_SOTA_REF) { ?> + + + COL_MY_SOTA_REF; ?> + + + COL_MY_WWFF_REF) { ?> From 03ae7bb60f4ceb4d86addc515ff63978d1f49fd6 Mon Sep 17 00:00:00 2001 From: phl0 Date: Mon, 5 Feb 2024 13:10:32 +0100 Subject: [PATCH 16/30] Copy xOTA refs upon QSO edit --- application/models/Logbook_model.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 8b1d06b3..9c19aa94 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -1059,6 +1059,10 @@ class Logbook_model extends CI_Model $station_profile = $CI->stations->profile_clean($stationId); $stationCallsign = $station_profile->station_callsign; + $iotaRef = $station_profile->station_iota; + $sotaRef = $station_profile->station_sota; + $wwffRef = $station_profile->station_wwff; + $potaRef = $station_profile->station_pota; $mode = $this->get_main_mode_if_submode($this->input->post('mode')); if ($mode == null) { @@ -1233,6 +1237,10 @@ class Logbook_model extends CI_Model 'COL_QSL_VIA' => $this->input->post('qsl_via_callsign'), 'station_id' => $stationId, 'COL_STATION_CALLSIGN' => $stationCallsign, + 'COL_MY_IOTA' => $iotaRef, + 'COL_MY_SOTA_REF' => $sotaRef, + 'COL_MY_WWFF_REF' => $wwffRef, + 'COL_MY_POTA_REF' => $potaRef, 'COL_OPERATOR' => $this->input->post('operator_callsign'), 'COL_STATE' => $this->input->post('usa_state'), 'COL_CNTY' => $uscounty From 05ac36579ca91282653711d566309eada360658a Mon Sep 17 00:00:00 2001 From: cats-shadow Date: Mon, 5 Feb 2024 16:43:06 +0300 Subject: [PATCH 17/30] Russian translation mistakes correction. --- application/language/russian/general_words_lang.php | 4 ++-- application/language/russian/qso_lang.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/application/language/russian/general_words_lang.php b/application/language/russian/general_words_lang.php index 41eebd51..21394662 100644 --- a/application/language/russian/general_words_lang.php +++ b/application/language/russian/general_words_lang.php @@ -86,7 +86,7 @@ $lang['general_word_lotw'] = 'Logbook of the World'; $lang['general_word_lotw_short'] = 'LoTW'; $lang['general_word_qso_data'] = 'Данные QSO'; -$lang['general_word_details'] = 'Подробно'; +$lang['general_word_details'] = 'детально'; $lang['general_edit_qso'] = 'Редактировать QSO'; $lang['general_mark_qsl_rx_bureau'] = 'Отметить QSL полученной (через бюро)'; @@ -116,7 +116,7 @@ $lang['cloudlog_station_profile'] = 'Местоположение станции $lang['gen_hamradio_cq'] = "CQ"; // ham radio terms $lang['gen_hamradio_qso'] = 'QSO'; -$lang['gen_hamradio_station'] = ''; +$lang['gen_hamradio_station'] = 'Местоположение'; $lang['gen_hamradio_call'] = 'Позывной'; $lang['gen_hamradio_prefix'] = "Префикс"; diff --git a/application/language/russian/qso_lang.php b/application/language/russian/qso_lang.php index 6f576991..66ae5c59 100644 --- a/application/language/russian/qso_lang.php +++ b/application/language/russian/qso_lang.php @@ -42,7 +42,7 @@ $lang['qso_delete_warning'] = "Предупреждение! Вы уверены // QSO Details -$lang['qso_details'] = 'Детали QSO'; +$lang['qso_details'] = 'Основная информация'; $lang['fav_add'] = 'Добавить диапазон/вид модуляции в избранное'; $lang['qso_operator_callsign'] = 'Позывной оператора'; From 1d11d00ea83c32f971eac4ddd6102028416d7362 Mon Sep 17 00:00:00 2001 From: Christoph Kottke Date: Tue, 26 Sep 2023 11:39:15 +0200 Subject: [PATCH 18/30] add stations_id to eqsl functions --- application/controllers/Eqsl.php | 10 +++++---- application/libraries/EqslImporter.php | 26 ++++++++++++++---------- application/models/Eqslmethods_model.php | 11 ++++++---- application/models/Logbook_model.php | 9 +++++--- 4 files changed, 34 insertions(+), 22 deletions(-) diff --git a/application/controllers/Eqsl.php b/application/controllers/Eqsl.php index 76c266b6..4e6561d8 100644 --- a/application/controllers/Eqsl.php +++ b/application/controllers/Eqsl.php @@ -74,10 +74,11 @@ class eqsl extends CI_Controller { $this->eqslimporter->from_callsign_and_QTH( $eqsl_location['station_callsign'], $eqsl_location['eqslqthnickname'], - $config['upload_path'] + $config['upload_path'], + $eqsl_location['station_id'] ); - $eqsl_results[] = $this->eqslimporter->fetch($eqsl_password,$eqsl_force_from_date); + $eqsl_results[] = $this->eqslimporter->fetch($eqsl_password, $eqsl_force_from_date); } } elseif ($this->input->post('eqslimport') == 'upload') { $station_id4upload=$this->input->post('station_profile'); @@ -97,7 +98,7 @@ class eqsl extends CI_Controller { $data = array('upload_data' => $this->upload->data()); $this->load->library('EqslImporter'); - $this->eqslimporter->from_file('./uploads/'.$data['upload_data']['file_name'],$station_callsign); + $this->eqslimporter->from_file('./uploads/'.$data['upload_data']['file_name'], $station_callsign, $station_id4upload); $eqsl_results[] = $this->eqslimporter->import(); } @@ -728,7 +729,8 @@ class eqsl extends CI_Controller { $this->eqslimporter->from_callsign_and_QTH( $eqsl_location['station_callsign'], $eqsl_location['eqslqthnickname'], - $config['upload_path'] + $config['upload_path'], + $eqsl_location['station_id'] ); $eqsl_results[] = $this->eqslimporter->fetch($password); diff --git a/application/libraries/EqslImporter.php b/application/libraries/EqslImporter.php index d84ad812..7a057fce 100644 --- a/application/libraries/EqslImporter.php +++ b/application/libraries/EqslImporter.php @@ -8,6 +8,7 @@ class EqslImporter private $callsign; private $qth_nickname; private $adif_file; + private $station_id; // CodeIgniter super-ojbect private $CI; @@ -26,24 +27,26 @@ class EqslImporter $this->adif_file = $adif_file; } - public function from_callsign_and_QTH($callsign, $qth, $upload_path) { + public function from_callsign_and_QTH($callsign, $qth, $upload_path, $station_id) { $this->init( $qth . " - " . $callsign, - self::safe_filepath($callsign, $qth, $upload_path) + self::safe_filepath($callsign, $qth, $upload_path, $station_id) ); $this->callsign = $callsign; $this->qth_nickname = $qth; + $this->station_id = $station_id; } - public function from_file($adif_file,$station_callsign) { + public function from_file($adif_file, $station_callsign, $station_id) { $this->init('ADIF upload', $adif_file); - $this->callsign=$station_callsign; + $this->callsign = $station_callsign; + $this->station_id = $station_id; } // generate a sanitized file name from a callsign and a QTH nickname - private static function safe_filepath($callsign, $qth, $upload_path) { - $eqsl_id = $callsign . '-' . $qth; + private static function safe_filepath($callsign, $qth, $upload_path, $station_id) { + $eqsl_id = sprintf('%s-%s_%03d', $callsign, $qth, $station_id); // Replace anything which isn't a word, whitespace, number or any of the following caracters -_~,;[](). with a '.' $eqsl_id = mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '.', $eqsl_id); @@ -53,7 +56,7 @@ class EqslImporter } // Download confirmed QSO from eQSL inbox and import them - public function fetch($password, $eqsl_force_from_date="") { + public function fetch($password, $eqsl_force_from_date = false) { if (empty($password) || empty($this->callsign)) { return $this->result('Missing username and/or password'); } @@ -137,7 +140,8 @@ class EqslImporter $query = $this->CI->db->query('SELECT eqsl_rcvd_mark FROM config'); $q = $query->row(); $config['eqsl_rcvd_mark'] = $q->eqsl_rcvd_mark; - $station_callsign=$this->callsign; + $station_callsign = $this->callsign; + $station_id = $this->station_id; $this->CI->adif_parser->load_from_file($this->adif_file); $this->CI->adif_parser->initialize(); @@ -156,14 +160,14 @@ class EqslImporter $record['qsl_sent'] = $config['eqsl_rcvd_mark']; } - $status = $this->CI->logbook_model->import_check($time_on, $record['call'], $record['band'], $record['mode'],$station_callsign); + $status = $this->CI->logbook_model->import_check($time_on, $record['call'], $record['band'], $record['mode'], $station_callsign, $station_id); $qsoid = 0; if ($status[0] == "Found") { $qsoid = $status[1]; - $dupe = $this->CI->eqslmethods_model->eqsl_dupe_check($time_on, $record['call'], $record['band'], $record['mode'],$config['eqsl_rcvd_mark'],$station_callsign); + $dupe = $this->CI->eqslmethods_model->eqsl_dupe_check($time_on, $record['call'], $record['band'], $record['mode'], $config['eqsl_rcvd_mark'], $station_callsign, $station_id); if ($dupe == false) { $updated += 1; - $eqsl_status = $this->CI->eqslmethods_model->eqsl_update($time_on, $record['call'], $record['band'], $record['mode'], $config['eqsl_rcvd_mark'],$station_callsign); + $eqsl_status = $this->CI->eqslmethods_model->eqsl_update($time_on, $record['call'], $record['band'], $record['mode'], $config['eqsl_rcvd_mark'], $station_callsign, $station_id); } else { $dupes += 1; $eqsl_status = "Already received an eQSL for this QSO."; diff --git a/application/models/Eqslmethods_model.php b/application/models/Eqslmethods_model.php index 13e05dc6..4d782f5b 100644 --- a/application/models/Eqslmethods_model.php +++ b/application/models/Eqslmethods_model.php @@ -122,7 +122,7 @@ class Eqslmethods_model extends CI_Model { $this->db->where('eqslqthnickname IS NOT NULL'); $this->db->where('eqslqthnickname !=', ''); $this->db->from('station_profile'); - $this->db->select('station_callsign, eqslqthnickname'); + $this->db->select('station_callsign, eqslqthnickname, station_id'); $this->db->distinct(TRUE); return $this->db->get(); @@ -156,9 +156,10 @@ class Eqslmethods_model extends CI_Model { } // Update a QSO with eQSL QSL info - // We could also probably use this use this: https://eqsl.cc/qslcard/VerifyQSO.txt + // We could also probably use this: + // https://eqsl.cc/qslcard/VerifyQSO.txt // https://www.eqsl.cc/qslcard/ImportADIF.txt - function eqsl_update($datetime, $callsign, $band, $mode, $qsl_status,$station_callsign) { + function eqsl_update($datetime, $callsign, $band, $mode, $qsl_status, $station_callsign, $station_id) { $data = array( 'COL_EQSL_QSLRDATE' => date('Y-m-d H:i:s'), // eQSL doesn't give us a date, so let's use current 'COL_EQSL_QSL_RCVD' => $qsl_status @@ -170,6 +171,7 @@ class Eqslmethods_model extends CI_Model { $this->db->where('COL_STATION_CALLSIGN', $station_callsign); $this->db->where('COL_BAND', $band); $this->db->where('COL_MODE', $mode); + $this->db->where('station_id', $station_id); $this->db->update($this->config->item('table_name'), $data); @@ -177,7 +179,7 @@ class Eqslmethods_model extends CI_Model { } // Determine if we've already received an eQSL for this QSO - function eqsl_dupe_check($datetime, $callsign, $band, $mode, $qsl_status,$station_callsign) { + function eqsl_dupe_check($datetime, $callsign, $band, $mode, $qsl_status, $station_callsign, $station_id) { $this->db->select('COL_EQSL_QSLRDATE'); $this->db->where('COL_TIME_ON >= DATE_ADD(DATE_FORMAT("'.$datetime.'", \'%Y-%m-%d %H:%i\' ), INTERVAL -15 MINUTE )'); $this->db->where('COL_TIME_ON <= DATE_ADD(DATE_FORMAT("'.$datetime.'", \'%Y-%m-%d %H:%i\' ), INTERVAL 15 MINUTE )'); @@ -186,6 +188,7 @@ class Eqslmethods_model extends CI_Model { $this->db->where('COL_MODE', $mode); $this->db->where('COL_STATION_CALLSIGN', $station_callsign); $this->db->where('COL_EQSL_QSL_RCVD', $qsl_status); + $this->db->where('station_id', $station_id); $this->db->limit(1); $query = $this->db->get($this->config->item('table_name')); diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 8b1d06b3..08459fd2 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -2976,9 +2976,8 @@ class Logbook_model extends CI_Model } /* Used to check if the qso is already in the database */ - function import_check($datetime, $callsign, $band, $mode, $station_callsign) - { - $mode = $this->get_main_mode_from_mode($mode); + function import_check($datetime, $callsign, $band, $mode, $station_callsign, $station_id = null) { + $mode=$this->get_main_mode_from_mode($mode); $this->db->select('COL_PRIMARY_KEY, COL_TIME_ON, COL_CALL, COL_BAND'); $this->db->where('COL_TIME_ON >= DATE_ADD(DATE_FORMAT("' . $datetime . '", \'%Y-%m-%d %H:%i\' ), INTERVAL -15 MINUTE )'); @@ -2988,6 +2987,10 @@ class Logbook_model extends CI_Model $this->db->where('COL_BAND', $band); $this->db->where('COL_MODE', $mode); + if(isset($station_id) && $station_id > 0) { + $this->db->where('station_id', $station_id); + } + $query = $this->db->get($this->config->item('table_name')); if ($query->num_rows() > 0) { From c4df1467fc7e0ad7c9db774ca6d35c8a85070ee7 Mon Sep 17 00:00:00 2001 From: Christoph Kottke Date: Mon, 5 Feb 2024 21:30:23 +0100 Subject: [PATCH 19/30] add same fixes * add proper error message * improve usability --- application/controllers/Eqsl.php | 3 +-- application/views/eqsl/import.php | 12 ++++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/application/controllers/Eqsl.php b/application/controllers/Eqsl.php index 76c266b6..c325884b 100644 --- a/application/controllers/Eqsl.php +++ b/application/controllers/Eqsl.php @@ -40,8 +40,7 @@ class eqsl extends CI_Controller { $this->load->model('eqslmethods_model'); $eqsl_locations = $this->eqslmethods_model->all_of_user_with_eqsl_nick_defined(); if($eqsl_locations->num_rows() == 0) { - show_error("eQSL Nicknames in Station Profiles aren't defined"); - exit; + $this->session->set_flashdata('error', 'eQSL Nicknames in Station Profiles aren\'t defined!'); } ini_set('memory_limit', '-1'); diff --git a/application/views/eqsl/import.php b/application/views/eqsl/import.php index 2a24e17d..c6801e89 100644 --- a/application/views/eqsl/import.php +++ b/application/views/eqsl/import.php @@ -31,9 +31,6 @@

Upload the Exported ADIF file from eQSL from the Download Inbox page, to mark QSOs as confirmed on eQSL.

-

Important Log files must have the file type .adi

- -

Choose Station(location) eQSL File belongs to:

+

ImportantLog files must have the file type .adi

+ - -

- +
@@ -59,8 +56,7 @@
- -
+
From 0ab0df76f386a0a86a473b3ed1a32551de2b2ad1 Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Sat, 3 Feb 2024 00:42:51 +0100 Subject: [PATCH 20/30] show flashdata if no station has eqsl nick --- application/controllers/Eqsl.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/application/controllers/Eqsl.php b/application/controllers/Eqsl.php index c325884b..a70b1e5f 100644 --- a/application/controllers/Eqsl.php +++ b/application/controllers/Eqsl.php @@ -128,8 +128,7 @@ class eqsl extends CI_Controller { // Check if eQSL Nicknames have been defined $this->load->model('stations'); if($this->stations->are_eqsl_nicks_defined() == 0) { - show_error('eQSL Nicknames in Station Profiles arent defined'); - exit; + $this->session->set_flashdata('error', 'eQSL Nicknames in Station Profiles aren\'t defined!'); } ini_set('memory_limit', '-1'); From fe2ee9d6594fa9318b63d34ff608f3ffa242f2a5 Mon Sep 17 00:00:00 2001 From: electricEngineer <58144377+electricEngineer@users.noreply.github.com> Date: Wed, 7 Feb 2024 12:44:44 +0100 Subject: [PATCH 21/30] fixed error message while logging that trim() was called with argument NULL --- application/models/Logbook_model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 9c19aa94..0f3ccee9 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -289,7 +289,7 @@ class Logbook_model extends CI_Model $data['COL_MY_CITY'] = strtoupper(trim($station['station_city'])); $data['COL_MY_IOTA'] = strtoupper(trim($station['station_iota'])); $data['COL_MY_SOTA_REF'] = strtoupper(trim($station['station_sota'])); - $data['COL_MY_WWFF_REF'] = strtoupper(trim($station['station_wwff'])); + $data['COL_MY_WWFF_REF'] = $station['station_wwff'] ? strtoupper(trim($station['station_wwff'])) : ''; $data['COL_MY_POTA_REF'] = $station['station_pota'] == null ? '' : strtoupper(trim($station['station_pota'])); $data['COL_STATION_CALLSIGN'] = strtoupper(trim($station['station_callsign'])); From db3c5e9f246272f365dbe7449f26a39fcdc00e02 Mon Sep 17 00:00:00 2001 From: xssfox Date: Thu, 8 Feb 2024 16:13:03 +1100 Subject: [PATCH 22/30] remove gendered language --- application/controllers/User.php | 2 +- application/language/bulgarian/options_lang.php | 2 +- application/language/czech/options_lang.php | 2 +- application/language/dutch/options_lang.php | 2 +- application/language/english/options_lang.php | 2 +- application/language/finnish/options_lang.php | 2 +- application/language/french/options_lang.php | 2 +- application/language/greek/options_lang.php | 2 +- application/language/italian/options_lang.php | 2 +- application/language/polish/options_lang.php | 2 +- application/language/swedish/options_lang.php | 2 +- application/language/turkish/options_lang.php | 2 +- system/libraries/Email.php | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/application/controllers/User.php b/application/controllers/User.php index 927ceffd..dbff5ef4 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -839,7 +839,7 @@ class User extends CI_Controller { // Send email with reset code and first Name of the User $this->data['reset_code'] = $reset_code; - $this->data['user_firstname'] = $data->user_firstname; // We can call the user by his first name in the E-Mail + $this->data['user_firstname'] = $data->user_firstname; // We can call the user by their first name in the E-Mail $this->data['user_callsign'] = $data->user_callsign; $this->data['user_name'] = $data->user_name; $this->load->library('email'); diff --git a/application/language/bulgarian/options_lang.php b/application/language/bulgarian/options_lang.php index 837fe329..c9efc480 100644 --- a/application/language/bulgarian/options_lang.php +++ b/application/language/bulgarian/options_lang.php @@ -87,7 +87,7 @@ $lang['options_version_dialog_mode_release_notes'] = "Only Release Notes"; $lang['options_version_dialog_mode_custom_text'] = "Only Custom Text"; $lang['options_version_dialog_mode_both'] = "Release Notes and Custom Text"; $lang['options_version_dialog_mode_disabled'] = "Disabled"; -$lang['options_version_dialog_mode_hint'] = "The Version Info is shown to every user. The user has the option to dismiss the dialog after he read it. Select if you want to show only release notes (fetched from github), only custom text or both."; +$lang['options_version_dialog_mode_hint'] = "The Version Info is shown to every user. The user has the option to dismiss the dialog after they read it. Select if you want to show only release notes (fetched from github), only custom text or both."; $lang['options_version_dialog_custom_text'] = "Version Info Custom Text"; $lang['options_version_dialog_custom_text_hint'] = "This is the custom text which is shown in the dialog."; $lang['options_version_dialog_mode_changed_to'] = "Version Info Mode changed to"; diff --git a/application/language/czech/options_lang.php b/application/language/czech/options_lang.php index b1bde503..52b79271 100644 --- a/application/language/czech/options_lang.php +++ b/application/language/czech/options_lang.php @@ -87,7 +87,7 @@ $lang['options_version_dialog_mode_release_notes'] = "Only Release Notes"; $lang['options_version_dialog_mode_custom_text'] = "Only Custom Text"; $lang['options_version_dialog_mode_both'] = "Release Notes and Custom Text"; $lang['options_version_dialog_mode_disabled'] = "Disabled"; -$lang['options_version_dialog_mode_hint'] = "The Version Info is shown to every user. The user has the option to dismiss the dialog after he read it. Select if you want to show only release notes (fetched from github), only custom text or both."; +$lang['options_version_dialog_mode_hint'] = "The Version Info is shown to every user. The user has the option to dismiss the dialog after they read it. Select if you want to show only release notes (fetched from github), only custom text or both."; $lang['options_version_dialog_custom_text'] = "Version Info Custom Text"; $lang['options_version_dialog_custom_text_hint'] = "This is the custom text which is shown in the dialog."; $lang['options_version_dialog_mode_changed_to'] = "Version Info Mode changed to"; diff --git a/application/language/dutch/options_lang.php b/application/language/dutch/options_lang.php index c26ac382..be13274e 100644 --- a/application/language/dutch/options_lang.php +++ b/application/language/dutch/options_lang.php @@ -87,7 +87,7 @@ $lang['options_version_dialog_mode_release_notes'] = "Only Release Notes"; $lang['options_version_dialog_mode_custom_text'] = "Only Custom Text"; $lang['options_version_dialog_mode_both'] = "Release Notes and Custom Text"; $lang['options_version_dialog_mode_disabled'] = "Disabled"; -$lang['options_version_dialog_mode_hint'] = "The Version Info is shown to every user. The user has the option to dismiss the dialog after he read it. Select if you want to show only release notes (fetched from github), only custom text or both."; +$lang['options_version_dialog_mode_hint'] = "The Version Info is shown to every user. The user has the option to dismiss the dialog after they read it. Select if you want to show only release notes (fetched from github), only custom text or both."; $lang['options_version_dialog_custom_text'] = "Version Info Custom Text"; $lang['options_version_dialog_custom_text_hint'] = "This is the custom text which is shown in the dialog."; $lang['options_version_dialog_mode_changed_to'] = "Version Info Mode changed to"; diff --git a/application/language/english/options_lang.php b/application/language/english/options_lang.php index a4f8b3cd..64803a6e 100644 --- a/application/language/english/options_lang.php +++ b/application/language/english/options_lang.php @@ -87,7 +87,7 @@ $lang['options_version_dialog_mode_release_notes'] = "Only Release Notes"; $lang['options_version_dialog_mode_custom_text'] = "Only Custom Text"; $lang['options_version_dialog_mode_both'] = "Release Notes and Custom Text"; $lang['options_version_dialog_mode_disabled'] = "Disabled"; -$lang['options_version_dialog_mode_hint'] = "The Version Info is shown to every user. The user has the option to dismiss the dialog after he read it. Select if you want to show only release notes (fetched from github), only custom text or both."; +$lang['options_version_dialog_mode_hint'] = "The Version Info is shown to every user. The user has the option to dismiss the dialog after they read it. Select if you want to show only release notes (fetched from github), only custom text or both."; $lang['options_version_dialog_custom_text'] = "Version Info Custom Text"; $lang['options_version_dialog_custom_text_hint'] = "This is the custom text which is shown in the dialog."; $lang['options_version_dialog_mode_changed_to'] = "Version Info Mode changed to"; diff --git a/application/language/finnish/options_lang.php b/application/language/finnish/options_lang.php index ce1763c6..d26fe0ee 100644 --- a/application/language/finnish/options_lang.php +++ b/application/language/finnish/options_lang.php @@ -87,7 +87,7 @@ $lang['options_version_dialog_mode_release_notes'] = "Only Release Notes"; $lang['options_version_dialog_mode_custom_text'] = "Only Custom Text"; $lang['options_version_dialog_mode_both'] = "Release Notes and Custom Text"; $lang['options_version_dialog_mode_disabled'] = "Disabled"; -$lang['options_version_dialog_mode_hint'] = "The Version Info is shown to every user. The user has the option to dismiss the dialog after he read it. Select if you want to show only release notes (fetched from github), only custom text or both."; +$lang['options_version_dialog_mode_hint'] = "The Version Info is shown to every user. The user has the option to dismiss the dialog after they read it. Select if you want to show only release notes (fetched from github), only custom text or both."; $lang['options_version_dialog_custom_text'] = "Version Info Custom Text"; $lang['options_version_dialog_custom_text_hint'] = "This is the custom text which is shown in the dialog."; $lang['options_version_dialog_mode_changed_to'] = "Version Info Mode changed to"; diff --git a/application/language/french/options_lang.php b/application/language/french/options_lang.php index a4f8b3cd..64803a6e 100644 --- a/application/language/french/options_lang.php +++ b/application/language/french/options_lang.php @@ -87,7 +87,7 @@ $lang['options_version_dialog_mode_release_notes'] = "Only Release Notes"; $lang['options_version_dialog_mode_custom_text'] = "Only Custom Text"; $lang['options_version_dialog_mode_both'] = "Release Notes and Custom Text"; $lang['options_version_dialog_mode_disabled'] = "Disabled"; -$lang['options_version_dialog_mode_hint'] = "The Version Info is shown to every user. The user has the option to dismiss the dialog after he read it. Select if you want to show only release notes (fetched from github), only custom text or both."; +$lang['options_version_dialog_mode_hint'] = "The Version Info is shown to every user. The user has the option to dismiss the dialog after they read it. Select if you want to show only release notes (fetched from github), only custom text or both."; $lang['options_version_dialog_custom_text'] = "Version Info Custom Text"; $lang['options_version_dialog_custom_text_hint'] = "This is the custom text which is shown in the dialog."; $lang['options_version_dialog_mode_changed_to'] = "Version Info Mode changed to"; diff --git a/application/language/greek/options_lang.php b/application/language/greek/options_lang.php index a4f8b3cd..64803a6e 100644 --- a/application/language/greek/options_lang.php +++ b/application/language/greek/options_lang.php @@ -87,7 +87,7 @@ $lang['options_version_dialog_mode_release_notes'] = "Only Release Notes"; $lang['options_version_dialog_mode_custom_text'] = "Only Custom Text"; $lang['options_version_dialog_mode_both'] = "Release Notes and Custom Text"; $lang['options_version_dialog_mode_disabled'] = "Disabled"; -$lang['options_version_dialog_mode_hint'] = "The Version Info is shown to every user. The user has the option to dismiss the dialog after he read it. Select if you want to show only release notes (fetched from github), only custom text or both."; +$lang['options_version_dialog_mode_hint'] = "The Version Info is shown to every user. The user has the option to dismiss the dialog after they read it. Select if you want to show only release notes (fetched from github), only custom text or both."; $lang['options_version_dialog_custom_text'] = "Version Info Custom Text"; $lang['options_version_dialog_custom_text_hint'] = "This is the custom text which is shown in the dialog."; $lang['options_version_dialog_mode_changed_to'] = "Version Info Mode changed to"; diff --git a/application/language/italian/options_lang.php b/application/language/italian/options_lang.php index a4f8b3cd..64803a6e 100644 --- a/application/language/italian/options_lang.php +++ b/application/language/italian/options_lang.php @@ -87,7 +87,7 @@ $lang['options_version_dialog_mode_release_notes'] = "Only Release Notes"; $lang['options_version_dialog_mode_custom_text'] = "Only Custom Text"; $lang['options_version_dialog_mode_both'] = "Release Notes and Custom Text"; $lang['options_version_dialog_mode_disabled'] = "Disabled"; -$lang['options_version_dialog_mode_hint'] = "The Version Info is shown to every user. The user has the option to dismiss the dialog after he read it. Select if you want to show only release notes (fetched from github), only custom text or both."; +$lang['options_version_dialog_mode_hint'] = "The Version Info is shown to every user. The user has the option to dismiss the dialog after they read it. Select if you want to show only release notes (fetched from github), only custom text or both."; $lang['options_version_dialog_custom_text'] = "Version Info Custom Text"; $lang['options_version_dialog_custom_text_hint'] = "This is the custom text which is shown in the dialog."; $lang['options_version_dialog_mode_changed_to'] = "Version Info Mode changed to"; diff --git a/application/language/polish/options_lang.php b/application/language/polish/options_lang.php index a4f8b3cd..64803a6e 100644 --- a/application/language/polish/options_lang.php +++ b/application/language/polish/options_lang.php @@ -87,7 +87,7 @@ $lang['options_version_dialog_mode_release_notes'] = "Only Release Notes"; $lang['options_version_dialog_mode_custom_text'] = "Only Custom Text"; $lang['options_version_dialog_mode_both'] = "Release Notes and Custom Text"; $lang['options_version_dialog_mode_disabled'] = "Disabled"; -$lang['options_version_dialog_mode_hint'] = "The Version Info is shown to every user. The user has the option to dismiss the dialog after he read it. Select if you want to show only release notes (fetched from github), only custom text or both."; +$lang['options_version_dialog_mode_hint'] = "The Version Info is shown to every user. The user has the option to dismiss the dialog after they read it. Select if you want to show only release notes (fetched from github), only custom text or both."; $lang['options_version_dialog_custom_text'] = "Version Info Custom Text"; $lang['options_version_dialog_custom_text_hint'] = "This is the custom text which is shown in the dialog."; $lang['options_version_dialog_mode_changed_to'] = "Version Info Mode changed to"; diff --git a/application/language/swedish/options_lang.php b/application/language/swedish/options_lang.php index 4003275f..1c736954 100644 --- a/application/language/swedish/options_lang.php +++ b/application/language/swedish/options_lang.php @@ -87,7 +87,7 @@ $lang['options_version_dialog_mode_release_notes'] = "Only Release Notes"; $lang['options_version_dialog_mode_custom_text'] = "Only Custom Text"; $lang['options_version_dialog_mode_both'] = "Release Notes and Custom Text"; $lang['options_version_dialog_mode_disabled'] = "Disabled"; -$lang['options_version_dialog_mode_hint'] = "The Version Info is shown to every user. The user has the option to dismiss the dialog after he read it. Select if you want to show only release notes (fetched from github), only custom text or both."; +$lang['options_version_dialog_mode_hint'] = "The Version Info is shown to every user. The user has the option to dismiss the dialog after they read it. Select if you want to show only release notes (fetched from github), only custom text or both."; $lang['options_version_dialog_custom_text'] = "Version Info Custom Text"; $lang['options_version_dialog_custom_text_hint'] = "This is the custom text which is shown in the dialog."; $lang['options_version_dialog_mode_changed_to'] = "Version Info Mode changed to"; diff --git a/application/language/turkish/options_lang.php b/application/language/turkish/options_lang.php index a4f8b3cd..64803a6e 100644 --- a/application/language/turkish/options_lang.php +++ b/application/language/turkish/options_lang.php @@ -87,7 +87,7 @@ $lang['options_version_dialog_mode_release_notes'] = "Only Release Notes"; $lang['options_version_dialog_mode_custom_text'] = "Only Custom Text"; $lang['options_version_dialog_mode_both'] = "Release Notes and Custom Text"; $lang['options_version_dialog_mode_disabled'] = "Disabled"; -$lang['options_version_dialog_mode_hint'] = "The Version Info is shown to every user. The user has the option to dismiss the dialog after he read it. Select if you want to show only release notes (fetched from github), only custom text or both."; +$lang['options_version_dialog_mode_hint'] = "The Version Info is shown to every user. The user has the option to dismiss the dialog after they read it. Select if you want to show only release notes (fetched from github), only custom text or both."; $lang['options_version_dialog_custom_text'] = "Version Info Custom Text"; $lang['options_version_dialog_custom_text_hint'] = "This is the custom text which is shown in the dialog."; $lang['options_version_dialog_mode_changed_to'] = "Version Info Mode changed to"; diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 01f513b2..489e82d5 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -1059,7 +1059,7 @@ class CI_Email { * * Provides the raw message for use in plain-text headers of * HTML-formatted emails. - * If the user hasn't specified his own alternative message + * If the user hasn't specified their own alternative message * it creates one by stripping the HTML * * @return string From 424a98c54056796ad33dfb1734947eb5ebcd2326 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 8 Feb 2024 12:08:24 +0100 Subject: [PATCH 23/30] iOptical support for SAT directions and elevation --- application/views/sattimers/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/views/sattimers/index.php b/application/views/sattimers/index.php index 53a494aa..ab42bead 100644 --- a/application/views/sattimers/index.php +++ b/application/views/sattimers/index.php @@ -49,9 +49,9 @@ var custom_date_format = ""; ... - ° - ° - ° + ° + ° + ° min Date: Thu, 8 Feb 2024 12:19:56 +0100 Subject: [PATCH 24/30] visitor: Hide map when used without JavaScript (e.g. on qrz.com) --- README.md | 2 +- application/views/visitor/index.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5763c353..66870894 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ When submitting PRs please make sure code is commented and includes one feature ## Credits -Thanks to Andy (VE7CXZ), Gavin (M1BXF), Graham (W5ISP), Robert (M0VFC), Corby (K0SKW), Andy (GI0VGV), Tobias (DL4TMA), Tony (G0WFV), Kim (DG9VH), Michael (G7VJR), Andreas (LA8AJA), Matthias (DL9MJ), Thomas (DO2TWE), Pat (KT3PJ), Flo (DF2ET), Joerg (DJ7NT) and Fabian (HB9HIL) for contributing code or help to Cloudlog. +Thanks to Andy (VE7CXZ), Gavin (M1BXF), Graham (W5ISP), Robert (M0VFC), Corby (K0SKW), Andy (GI0VGV), Sarah (DM4NA), Tony (G0WFV), Kim (DG9VH), Michael (G7VJR), Andreas (LA8AJA), Matthias (DL9MJ), Thomas (DO2TWE), Pat (KT3PJ), Flo (DF2ET), Joerg (DJ7NT) and Fabian (HB9HIL) for contributing code or help to Cloudlog. ## Patreons & Donors diff --git a/application/views/visitor/index.php b/application/views/visitor/index.php index f8974ac5..898e9fcd 100644 --- a/application/views/visitor/index.php +++ b/application/views/visitor/index.php @@ -48,6 +48,8 @@ function echoQrbCalcLink($mygrid, $grid, $vucc) { + +
From 18d17fdd0faa5553ed8044e28a39e3f5ca1f6de0 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 8 Feb 2024 18:02:34 +0100 Subject: [PATCH 25/30] Make numbers align a little nicer --- application/views/sattimers/index.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/application/views/sattimers/index.php b/application/views/sattimers/index.php index ab42bead..3a05c895 100644 --- a/application/views/sattimers/index.php +++ b/application/views/sattimers/index.php @@ -32,10 +32,10 @@ var custom_date_format = ""; Time(d)-Out AOS LOS - AOS Azimuth - LOS Azimuth - Max Elevation - Duration + AOS Azimuth + LOS Azimuth + Max Elevation + Duration @@ -49,10 +49,10 @@ var custom_date_format = ""; ... - ° - ° - ° - min + ° + ° + ° + min Date: Wed, 14 Feb 2024 08:49:51 +0100 Subject: [PATCH 26/30] Handle incorrect CQ zones --- application/models/Cq.php | 31 ++++++++----------------------- src/QSLManager/QSO.php | 14 +++++++++++++- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/application/models/Cq.php b/application/models/Cq.php index 4ae15de7..bf0fa515 100644 --- a/application/models/Cq.php +++ b/application/models/Cq.php @@ -2,21 +2,6 @@ class CQ extends CI_Model{ - function get_zones(){ - $CI =& get_instance(); - $CI->load->model('Stations'); - $station_id = $CI->Stations->find_active(); - - $data = $this->db->query( - "select COL_CQZ, count(COL_CQZ) - from ".$this->config->item('table_name')." - where COL_CQZ is not null and station_id = ".$station_id." - group by COL_CQZ order by COL_CQZ" - ); - - return $data->result(); - } - function get_cq_array($bands, $postdata, $location_list) { $cqZ = array(); // Used for keeping track of which states that are not worked @@ -95,7 +80,7 @@ class CQ extends CI_Model{ */ function getCQWorked($location_list, $band, $postdata) { $sql = "SELECT distinct col_cqz FROM " . $this->config->item('table_name') . " thcv - where station_id in (" . $location_list . ") and col_cqz <> ''"; + where station_id in (" . $location_list . ") and col_cqz <= 40 and col_cqz <> ''"; if ($postdata['mode'] != 'All') { $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; @@ -128,7 +113,7 @@ class CQ extends CI_Model{ */ function getCQConfirmed($location_list, $band, $postdata) { $sql = "SELECT distinct col_cqz FROM " . $this->config->item('table_name') . " thcv - where station_id in (" . $location_list . ") and col_cqz <> ''"; + where station_id in (" . $location_list . ") and col_cqz <= 40 and col_cqz <> ''"; if ($postdata['mode'] != 'All') { $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; @@ -199,7 +184,7 @@ class CQ extends CI_Model{ function getSummaryByBand($band, $postdata, $location_list) { $sql = "SELECT count(distinct thcv.col_cqz) as count FROM " . $this->config->item('table_name') . " thcv"; - $sql .= " where station_id in (" . $location_list . ') and col_cqz > 0'; + $sql .= " where station_id in (" . $location_list . ') and col_cqz <= 40 and col_cqz > 0'; if ($band == 'SAT') { $sql .= " and thcv.col_prop_mode ='" . $band . "'"; @@ -207,9 +192,9 @@ class CQ extends CI_Model{ $this->load->model('bands'); $bandslots = $this->bands->get_worked_bands('cq'); - + $bandslots_list = "'".implode("','",$bandslots)."'"; - + $sql .= " and thcv.col_band in (" . $bandslots_list . ")" . " and thcv.col_prop_mode !='SAT'"; } else { @@ -229,7 +214,7 @@ class CQ extends CI_Model{ function getSummaryByBandConfirmed($band, $postdata, $location_list){ $sql = "SELECT count(distinct thcv.col_cqz) as count FROM " . $this->config->item('table_name') . " thcv"; - $sql .= " where station_id in (" . $location_list . ') and col_cqz > 0'; + $sql .= " where station_id in (" . $location_list . ') and col_cqz <= 40 and col_cqz > 0'; if ($band == 'SAT') { $sql .= " and thcv.col_prop_mode ='" . $band . "'"; @@ -237,9 +222,9 @@ class CQ extends CI_Model{ $this->load->model('bands'); $bandslots = $this->bands->get_worked_bands('cq'); - + $bandslots_list = "'".implode("','",$bandslots)."'"; - + $sql .= " and thcv.col_band in (" . $bandslots_list . ")" . " and thcv.col_prop_mode !='SAT'"; } else { diff --git a/src/QSLManager/QSO.php b/src/QSLManager/QSO.php index 5296a9d5..53b57623 100644 --- a/src/QSLManager/QSO.php +++ b/src/QSLManager/QSO.php @@ -194,7 +194,7 @@ class QSO $this->lotw = $this->getLotwString($data, $custom_date_format); $this->eqsl = $this->getEqslString($data, $custom_date_format); - $this->cqzone = ($data['COL_CQZ'] === null) ? '' : ''.$data['COL_CQZ'].''; + $this->cqzone = ($data['COL_CQZ'] === null) ? '' : $this->geCqLink($data['COL_CQZ']); $this->state = ($data['COL_STATE'] === null) ? '' :$data['COL_STATE']; $this->dxcc = (($data['name'] ?? null) === null) ? '- NONE -' : ''.ucwords(strtolower($data['name']), "- (/").''; $this->iota = ($data['COL_IOTA'] === null) ? '' : $this->getIotaLink($data['COL_IOTA']); @@ -209,6 +209,18 @@ class QSO $this->operator = ($data['COL_OPERATOR'] === null) ? '' :$data['COL_OPERATOR']; } + /** + * @return string + */ + function geCqLink($cqz): string + { + $cqz_link = ''; + if ($cqz <= '40') { + return ''.$cqz.''; + } + return $cqz; + } + /** * @return string */ From 95e5007d8f61b753fc7a6e5a3e7c98c5f64e25e9 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 14 Feb 2024 13:19:37 +0100 Subject: [PATCH 27/30] Migrate to hams.at native API --- application/controllers/Components.php | 2 +- application/views/components/hamsat/table.php | 50 +++++++++---------- 2 files changed, 25 insertions(+), 27 deletions(-) diff --git a/application/controllers/Components.php b/application/controllers/Components.php index 7fc0e27a..94fdd0f9 100644 --- a/application/controllers/Components.php +++ b/application/controllers/Components.php @@ -15,7 +15,7 @@ class Components extends CI_Controller { public function index() { $this->load->model('stations'); - $url = 'https://oscarwatch.org/scripts/hamsat_json.php'; + $url = 'https://hams.at/api/alerts/upcoming'; $json = file_get_contents($url); $data['rovedata'] = json_decode($json, true); $data['gridsquare'] = strtoupper($this->stations->find_gridsquare()); diff --git a/application/views/components/hamsat/table.php b/application/views/components/hamsat/table.php index 80dad90b..bc2b7714 100644 --- a/application/views/components/hamsat/table.php +++ b/application/views/components/hamsat/table.php @@ -21,7 +21,7 @@ - + - - + load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $CI->load->model('logbook_model'); $call_worked = $CI->logbook_model->check_if_callsign_worked_in_logbook($rove['callsign'], $logbooks_locations_array, "SAT"); if ($call_worked != 0) { @@ -60,48 +60,46 @@ - + + "> logbook_model->check_if_grid_worked_in_logbook($grid, null, "SAT"); - if ($worked != 0) { - echo " " . $grid . ""; - } else { - echo " " . $grid . ""; - } - } - } else { - $worked = $CI->logbook_model->check_if_grid_worked_in_logbook($rove['gridsquare'], null, "SAT"); + foreach ($rove['grids'] as $grid) { + $worked = $CI->logbook_model->check_if_grid_worked_in_logbook($grid, null, "SAT"); if ($worked != 0) { - echo " " . $rove['gridsquare'] . ""; + echo " " . $grid . ""; } else { - echo " " . $rove['gridsquare'] . ""; + echo " " . $grid . ""; } } ?> - Track + Track - Sked + Sked From ef361e8aa0c01b77cf717f1344c41d2c968fc488 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 14 Feb 2024 13:44:11 +0100 Subject: [PATCH 28/30] Add mode badges --- application/views/components/hamsat/table.php | 10 +++++++++- assets/css/default/overrides.css | 2 +- assets/css/general.css | 17 ++++++++++++++++- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/application/views/components/hamsat/table.php b/application/views/components/hamsat/table.php index bc2b7714..0d4ec264 100644 --- a/application/views/components/hamsat/table.php +++ b/application/views/components/hamsat/table.php @@ -70,9 +70,17 @@ } else if ($row['mhz_direction'] == 'down') { $direction = '↓'; } + $modeclass = ''; + if ($rove['mode'] == 'SSB') { + $modeclass = 'hamsatBgLin'; + } else if ($rove['mode'] == 'Data') { + $modeclass = 'hamsatBgData'; + } else if ($rove['mode'] == 'FM') { + $modeclass = 'hamsatBgFm'; + } ?> - "> + "> diff --git a/assets/css/default/overrides.css b/assets/css/default/overrides.css index 943d0165..ae07e3e7 100644 --- a/assets/css/default/overrides.css +++ b/assets/css/default/overrides.css @@ -60,4 +60,4 @@ thead > tr > td { .dxccsummaryheader:after { background-image: linear-gradient(to right, black 0, black 12ch, black 12ch, black 100%); -} \ No newline at end of file +} diff --git a/assets/css/general.css b/assets/css/general.css index 1443a1e8..4f17f87b 100644 --- a/assets/css/general.css +++ b/assets/css/general.css @@ -767,4 +767,19 @@ label { .dxccsummaryheaderopened:after { content: "\2796"; /* Unicode character for "minus" sign (-) */ -} \ No newline at end of file +} + +.hamsatBgLin { + background-color: rgb(224 242 254) !important; + --bs-badge-color: rgb(2 132 199) !important; +} + +.hamsatBgData { + background-color: rgb(250 232 255) !important; + --bs-badge-color: rgb(192 38 211) !important; +} + +.hamsatBgFm { + background-color: rgb(254 243 199) !important; + --bs-badge-color: rgb(217 119 6) !important; +} From dee4ce2835242b64ab9c36694bdf40357704a697 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 14 Feb 2024 13:48:38 +0100 Subject: [PATCH 29/30] Fix typo and also categorize CW as linear mode --- application/views/components/hamsat/table.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/views/components/hamsat/table.php b/application/views/components/hamsat/table.php index 0d4ec264..0a76fade 100644 --- a/application/views/components/hamsat/table.php +++ b/application/views/components/hamsat/table.php @@ -67,11 +67,11 @@ $direction = ''; if ($rove['mhz_direction'] == 'up') { $direction = '↑'; - } else if ($row['mhz_direction'] == 'down') { + } else if ($rove['mhz_direction'] == 'down') { $direction = '↓'; } $modeclass = ''; - if ($rove['mode'] == 'SSB') { + if ($rove['mode'] == 'SSB' || $rove['mode'] == 'CW') { $modeclass = 'hamsatBgLin'; } else if ($rove['mode'] == 'Data') { $modeclass = 'hamsatBgData'; From ba1d4fce0932de5492e7c9d1b9b8bf7b2def1f83 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Thu, 15 Feb 2024 13:35:17 +0000 Subject: [PATCH 30/30] tag 2.6.4 --- application/config/migration.php | 2 +- application/migrations/171_tag_2_6_4 | 30 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 application/migrations/171_tag_2_6_4 diff --git a/application/config/migration.php b/application/config/migration.php index 0fec41af..7ba70516 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE; | */ -$config['migration_version'] = 170; +$config['migration_version'] = 171; /* |-------------------------------------------------------------------------- diff --git a/application/migrations/171_tag_2_6_4 b/application/migrations/171_tag_2_6_4 new file mode 100644 index 00000000..20650548 --- /dev/null +++ b/application/migrations/171_tag_2_6_4 @@ -0,0 +1,30 @@ +db->where('option_name', 'version'); + $this->db->update('options', array('option_value' => '2.6.4')); + + // 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.3')); + } +} \ No newline at end of file