From b2b7596bca2394b14ebcdc08eb6e1efc78f4c5ce Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 14 Dec 2022 12:45:32 +0100 Subject: [PATCH 01/24] Add Frequency to selectable colums and previous QSOs --- application/controllers/Logbook.php | 28 ++++++++++++------- application/models/Logbook_model.php | 4 +-- application/views/dashboard/index.php | 3 ++ application/views/qslcard/searchresult.php | 5 ++++ application/views/qso/index.php | 23 ++++++++++++--- .../views/search/search_result_ajax.php | 5 ++++ application/views/user/add.php | 5 ++++ application/views/user/edit.php | 5 ++++ .../views/view_log/partial/log_ajax.php | 9 ++++-- application/views/visitor/index.php | 2 ++ 10 files changed, 70 insertions(+), 19 deletions(-) diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index 1470c924..b02a208a 100644 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -509,7 +509,7 @@ class Logbook extends CI_Controller { $html = ""; if(!empty($logbooks_locations_array)) { - $this->db->select(''.$this->config->item('table_name').'.COL_CALL, '.$this->config->item('table_name').'.COL_BAND, '.$this->config->item('table_name').'.COL_TIME_ON, '.$this->config->item('table_name').'.COL_RST_RCVD, '.$this->config->item('table_name').'.COL_RST_SENT, '.$this->config->item('table_name').'.COL_MODE, '.$this->config->item('table_name').'.COL_SUBMODE, '.$this->config->item('table_name').'.COL_PRIMARY_KEY, '.$this->config->item('table_name').'.COL_SAT_NAME, '.$this->config->item('table_name').'.COL_GRIDSQUARE, '.$this->config->item('table_name').'.COL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_SENT, '.$this->config->item('table_name').'.COL_QSL_SENT, '.$this->config->item('table_name').'.COL_STX, '.$this->config->item('table_name').'.COL_STX_STRING, '.$this->config->item('table_name').'.COL_SRX, '.$this->config->item('table_name').'.COL_SRX_STRING, '.$this->config->item('table_name').'.COL_LOTW_QSL_SENT, '.$this->config->item('table_name').'.COL_LOTW_QSL_RCVD, '.$this->config->item('table_name').'.COL_VUCC_GRIDS, station_profile.*'); + $this->db->select(''.$this->config->item('table_name').'.COL_CALL, '.$this->config->item('table_name').'.COL_BAND, '.$this->config->item('table_name').'.COL_FREQ, '.$this->config->item('table_name').'.COL_TIME_ON, '.$this->config->item('table_name').'.COL_RST_RCVD, '.$this->config->item('table_name').'.COL_RST_SENT, '.$this->config->item('table_name').'.COL_MODE, '.$this->config->item('table_name').'.COL_SUBMODE, '.$this->config->item('table_name').'.COL_PRIMARY_KEY, '.$this->config->item('table_name').'.COL_SAT_NAME, '.$this->config->item('table_name').'.COL_GRIDSQUARE, '.$this->config->item('table_name').'.COL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_SENT, '.$this->config->item('table_name').'.COL_QSL_SENT, '.$this->config->item('table_name').'.COL_STX, '.$this->config->item('table_name').'.COL_STX_STRING, '.$this->config->item('table_name').'.COL_SRX, '.$this->config->item('table_name').'.COL_SRX_STRING, '.$this->config->item('table_name').'.COL_LOTW_QSL_SENT, '.$this->config->item('table_name').'.COL_LOTW_QSL_RCVD, '.$this->config->item('table_name').'.COL_VUCC_GRIDS, station_profile.*'); $this->db->from($this->config->item('table_name')); $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); @@ -530,10 +530,14 @@ class Logbook extends CI_Controller { $html .= ""; $html .= "Date"; $html .= "Callsign"; + $html .= "Mode"; $html .= "RST (S)"; $html .= "RST (R)"; - $html .= "Band"; - $html .= "Mode"; + if ($this->session->userdata('user_column1')=='Frequency' || $this->session->userdata('user_column2')=='Frequency' || $this->session->userdata('user_column3')=='Frequency' || $this->session->userdata('user_column4')=='Frequency' || $this->session->userdata('user_column5')=='Frequency') { + $html .= "Frequency"; + } else { + $html .= "Band"; + } switch($this->session->userdata('user_previous_qsl_type')) { case 0: $html .= "".$this->lang->line('gen_hamradio_qsl').""; @@ -568,17 +572,21 @@ class Logbook extends CI_Controller { $html .= ""; $html .= "".date($custom_date_format, $timestamp). date(' H:i',strtotime($row->COL_TIME_ON)) . ""; $html .= "" . str_replace('0','Ø',strtoupper($row->COL_CALL)) . ""; - $html .= "".$row->COL_RST_SENT.""; - $html .= "".$row->COL_RST_RCVD.""; - if($row->COL_SAT_NAME != null) { - $html .= "".$row->COL_SAT_NAME.""; - } else { - $html .= "".$row->COL_BAND.""; - } if ($row->COL_SUBMODE==null) $html .= "".$row->COL_MODE.""; else $html .= "".$row->COL_SUBMODE.""; + $html .= "".$row->COL_RST_SENT.""; + $html .= "".$row->COL_RST_RCVD.""; + if($row->COL_SAT_NAME != null) { + $html .= "".$row->COL_SAT_NAME.""; + } else { + if ($this->session->userdata('user_column1')=='Frequency' || $this->session->userdata('user_column2')=='Frequency' || $this->session->userdata('user_column3')=='Frequency' || $this->session->userdata('user_column4')=='Frequency' || $this->session->userdata('user_column5')=='Frequency') { + $html .= "".$this->frequency->hz_to_mhz($row->COL_FREQ).""; + } else { + $html .= "".$row->COL_BAND.""; + } + } if ($this->session->userdata('user_previous_qsl_type') == 1) { $html .= ""; $html .= "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'); + $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_PRIMARY_KEY, COL_SAT_NAME'); $this->db->where_in('station_id', $logbooks_locations_array); $this->db->order_by("COL_TIME_ON", "desc"); $this->db->limit(10); @@ -791,7 +791,7 @@ class Logbook_model extends CI_Model { $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); if(!empty($logbooks_locations_array)) { - $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'); + $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_PRIMARY_KEY, COL_SAT_NAME'); $this->db->where_in('station_id', $logbooks_locations_array); $this->db->order_by("COL_TIME_ON", "desc"); $this->db->limit($num); diff --git a/application/views/dashboard/index.php b/application/views/dashboard/index.php index 8b37b3d6..844aa5b1 100644 --- a/application/views/dashboard/index.php +++ b/application/views/dashboard/index.php @@ -12,11 +12,13 @@ function echo_table_header_col($ctx, $name) { case 'State': echo ''.$ctx->lang->line('gen_hamradio_state').''; break; case 'Grid': echo ''.$ctx->lang->line('gen_hamradio_gridsquare').''; break; case 'Band': echo ''.$ctx->lang->line('gen_hamradio_band').''; break; + case 'Frequency': echo ''.$ctx->lang->line('gen_hamradio_frequency').''; break; case 'Operator': echo ''.$ctx->lang->line('gen_hamradio_operator').''; break; } } function echo_table_col($row, $name) { + $ci =& get_instance(); switch($name) { case 'Mode': echo ''; echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE . ''; break; case 'RSTS': echo '' . $row->COL_RST_SENT; if ($row->COL_STX) { echo 'COL_CONTEST_ID:"n/a").'" class="badge badge-light">'; printf("%03d", $row->COL_STX); echo '';} if ($row->COL_STX_STRING) { echo 'COL_CONTEST_ID:"n/a").'" class="badge badge-light">' . $row->COL_STX_STRING . '';} echo ''; break; @@ -28,6 +30,7 @@ function echo_table_col($row, $name) { case 'POTA': echo '' . ($row->COL_POTA_REF) . ''; break; case 'Grid': echo ''; echoQrbCalcLink($row->station_gridsquare, $row->COL_VUCC_GRIDS, $row->COL_GRIDSQUARE); echo ''; break; case 'Band': echo ''; if($row->COL_SAT_NAME != null) { echo ''.$row->COL_SAT_NAME.''; } else { echo strtolower($row->COL_BAND); } echo ''; break; + case 'Frequency': echo ''; if($row->COL_SAT_NAME != null) { echo ''.$row->COL_SAT_NAME.''; } else { if($row->COL_FREQ != null) { echo $ci->frequency->hz_to_mhz($row->COL_FREQ); } else { echo strtolower($row->COL_BAND); } } echo ''; break; case 'State': echo '' . ($row->COL_STATE) . ''; break; case 'Operator': echo '' . ($row->COL_OPERATOR) . ''; break; } diff --git a/application/views/qslcard/searchresult.php b/application/views/qslcard/searchresult.php index 451999ed..0e5c597a 100644 --- a/application/views/qslcard/searchresult.php +++ b/application/views/qslcard/searchresult.php @@ -18,6 +18,7 @@ case 'State': echo $this->lang->line('gen_hamradio_state'); break; case 'Grid': echo $this->lang->line('gen_hamradio_gridsquare'); break; case 'Band': echo $this->lang->line('gen_hamradio_band'); break; + case 'Frequency': echo $this->lang->line('gen_hamradio_frequency'); break; case 'Operator': echo $this->lang->line('gen_hamradio_operator'); break; } echo ''; @@ -32,6 +33,7 @@ case 'State': echo $this->lang->line('gen_hamradio_state'); break; case 'Grid': echo $this->lang->line('gen_hamradio_gridsquare'); break; case 'Band': echo $this->lang->line('gen_hamradio_band'); break; + case 'Frequency': echo $this->lang->line('gen_hamradio_frequency'); break; case 'Operator': echo $this->lang->line('gen_hamradio_band'); break; } echo ''; @@ -46,6 +48,7 @@ case 'State': echo $this->lang->line('gen_hamradio_state'); break; case 'Grid': echo $this->lang->line('gen_hamradio_gridsquare'); break; case 'Band': echo $this->lang->line('gen_hamradio_band'); break; + case 'Frequency': echo $this->lang->line('gen_hamradio_frequency'); break; case 'Operator': echo $this->lang->line('gen_hamradio_operator'); break; } echo ''; @@ -60,6 +63,7 @@ case 'State': echo $this->lang->line('gen_hamradio_state'); break; case 'Grid': echo $this->lang->line('gen_hamradio_gridsquare'); break; case 'Band': echo $this->lang->line('gen_hamradio_band'); break; + case 'Frequency': echo $this->lang->line('gen_hamradio_frequency'); break; case 'Operator': echo $this->lang->line('gen_hamradio_operator'); break; } echo ''; @@ -74,6 +78,7 @@ case 'State': echo $this->lang->line('gen_hamradio_state'); break; case 'Grid': echo $this->lang->line('gen_hamradio_gridsquare'); break; case 'Band': echo $this->lang->line('gen_hamradio_band'); break; + case 'Frequency': echo $this->lang->line('gen_hamradio_frequency'); break; case 'Operator': echo $this->lang->line('gen_hamradio_operator'); break; } echo ''; diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 7f3683b6..1e504714 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -528,7 +528,12 @@ lang->line('gen_hamradio_mode'); ?> lang->line('gen_hamradio_rsts'); ?> lang->line('gen_hamradio_rstr'); ?> - lang->line('gen_hamradio_band'); ?> + session->userdata('user_column1')=='Frequency' || $this->session->userdata('user_column2')=='Frequency' || $this->session->userdata('user_column3')=='Frequency' || $this->session->userdata('user_column4')=='Frequency' || $this->session->userdata('user_column5')=='Frequency') { + echo ''.$this->lang->line('gen_hamradio_frequency').''; + } else { + echo ''.$this->lang->line('gen_hamradio_band').''; + } + ?> COL_RST_RCVD; ?> COL_SAT_NAME != null) { ?> COL_SAT_NAME; ?> - - COL_BAND; ?> - + session->userdata('user_column1')=='Frequency' || $this->session->userdata('user_column2')=='Frequency' || $this->session->userdata('user_column3')=='Frequency' || $this->session->userdata('user_column4')=='Frequency' || $this->session->userdata('user_column5')=='Frequency') { + echo ''; + if ($row->COL_FREQ != null) { + echo $this->frequency->hz_to_mhz($row->COL_FREQ); + } else { + echo $row->COL_BAND; + } + echo ''; + } else { + echo ''.$row->COL_BAND.''; + } + } ?> diff --git a/application/views/search/search_result_ajax.php b/application/views/search/search_result_ajax.php index 30c053b1..2ec79336 100644 --- a/application/views/search/search_result_ajax.php +++ b/application/views/search/search_result_ajax.php @@ -19,6 +19,7 @@ case 'State': echo $this->lang->line('gen_hamradio_state'); break; case 'Grid': echo $this->lang->line('gen_hamradio_gridsquare'); break; case 'Band': echo $this->lang->line('gen_hamradio_band'); break; + case 'Frequency': echo $this->lang->line('gen_hamradio_frequency'); break; case 'Operator': echo $this->lang->line('gen_hamradio_operator'); break; } echo ''; @@ -33,6 +34,7 @@ case 'SOTA': echo $this->lang->line('gen_hamradio_sota'); break; case 'Grid': echo $this->lang->line('gen_hamradio_gridsquare'); break; case 'Band': echo $this->lang->line('gen_hamradio_band'); break; + case 'Frequency': echo $this->lang->line('gen_hamradio_frequency'); break; case 'Operator': echo $this->lang->line('gen_hamradio_operator'); break; } echo ''; @@ -47,6 +49,7 @@ case 'State': echo $this->lang->line('gen_hamradio_state'); break; case 'Grid': echo $this->lang->line('gen_hamradio_gridsquare'); break; case 'Band': echo $this->lang->line('gen_hamradio_band'); break; + case 'Frequency': echo $this->lang->line('gen_hamradio_frequency'); break; case 'Operator': echo $this->lang->line('gen_hamradio_operator'); break; } echo ''; @@ -61,6 +64,7 @@ case 'State': echo $this->lang->line('gen_hamradio_state'); break; case 'Grid': echo $this->lang->line('gen_hamradio_gridsquare'); break; case 'Band': echo $this->lang->line('gen_hamradio_band'); break; + case 'Frequency': echo $this->lang->line('gen_hamradio_frequency'); break; case 'Operator': echo $this->lang->line('gen_hamradio_operator'); break; } echo ''; @@ -75,6 +79,7 @@ case 'State': echo $this->lang->line('gen_hamradio_state'); break; case 'Grid': echo $this->lang->line('gen_hamradio_gridsquare'); break; case 'Band': echo $this->lang->line('gen_hamradio_band'); break; + case 'Frequency': echo $this->lang->line('gen_hamradio_frequency'); break; case 'Operator': echo $this->lang->line('gen_hamradio_operator'); break; } echo ''; diff --git a/application/views/user/add.php b/application/views/user/add.php index 4ca651b5..76f280e3 100644 --- a/application/views/user/add.php +++ b/application/views/user/add.php @@ -170,6 +170,7 @@ + @@ -202,6 +204,7 @@ + @@ -234,6 +238,7 @@ + @@ -368,6 +369,7 @@ + @@ -404,6 +407,7 @@ + diff --git a/application/views/view_log/partial/log_ajax.php b/application/views/view_log/partial/log_ajax.php index 9500f152..666e970d 100644 --- a/application/views/view_log/partial/log_ajax.php +++ b/application/views/view_log/partial/log_ajax.php @@ -8,15 +8,17 @@ function echo_table_header_col($ctx, $name) { case 'IOTA': echo ''.$ctx->lang->line('gen_hamradio_iota').''; break; case 'SOTA': echo ''.$ctx->lang->line('gen_hamradio_sota').''; break; case 'WWFF': echo ''.$ctx->lang->line('gen_hamradio_wwff').''; break; - case 'POTA': echo ''.$ctx->lang->line('gen_hamradio_pota').''; break; + case 'POTA': echo ''.$ctx->lang->line('gen_hamradio_pota').''; break; case 'State': echo ''.$ctx->lang->line('gen_hamradio_state').''; break; case 'Grid': echo ''.$ctx->lang->line('gen_hamradio_gridsquare').''; break; case 'Band': echo ''.$ctx->lang->line('gen_hamradio_band').''; break; - case 'Operator': echo ''.$ctx->lang->line('gen_hamradio_operator').''; break; + case 'Frequency': echo ''.$ctx->lang->line('gen_hamradio_frequency').''; break; + case 'Operator': echo ''.$ctx->lang->line('gen_hamradio_operator').''; break; } } function echo_table_col($row, $name) { + $ci =& get_instance(); switch($name) { case 'Mode': echo ''; echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE . ''; break; case 'RSTS': echo '' . $row->COL_RST_SENT; if ($row->COL_STX) { echo 'COL_CONTEST_ID:"n/a").'" class="badge badge-light">'; printf("%03d", $row->COL_STX); echo '';} if ($row->COL_STX_STRING) { echo 'COL_CONTEST_ID:"n/a").'" class="badge badge-light">' . $row->COL_STX_STRING . '';} echo ''; break; @@ -27,7 +29,8 @@ function echo_table_col($row, $name) { case 'WWFF': echo '' . ($row->COL_WWFF_REF) . ''; break; case 'POTA': echo '' . ($row->COL_POTA_REF) . ''; break; case 'Grid': echo ''; echoQrbCalcLink($row->station_gridsquare, $row->COL_VUCC_GRIDS, $row->COL_GRIDSQUARE); echo ''; break; - case 'Band': echo ''; if($row->COL_SAT_NAME != null) { echo ''.$row->COL_SAT_NAME.''; } else { echo strtolower($row->COL_BAND); } echo ''; break; + case 'Band': echo ''; if($row->COL_SAT_NAME != null) { echo ''.$row->COL_SAT_NAME.''; } else { if ($row->COL_FREQ != null) { echo ''. strtolower($row->COL_BAND).''; } else { echo strtolower($row->COL_BAND); } } echo ''; break; + case 'Frequency': echo ''; if($row->COL_SAT_NAME != null) { echo ''; if ($row->COL_FREQ != null) { echo ''.$row->COL_SAT_NAME.''; } else { echo $row->COL_SAT_NAME; } echo ''; } else { if ($row->COL_FREQ != null) { echo ''.$ci->frequency->hz_to_mhz($row->COL_FREQ).''; } else { echo strtolower($row->COL_BAND); } } echo ''; break; case 'State': echo '' . ($row->COL_STATE) . ''; break; case 'Operator':echo '' . ($row->COL_OPERATOR) . ''; break; } diff --git a/application/views/visitor/index.php b/application/views/visitor/index.php index ddc4cb2b..1915f86c 100644 --- a/application/views/visitor/index.php +++ b/application/views/visitor/index.php @@ -10,6 +10,7 @@ function echo_table_header_col($ctx, $name) { case 'State': echo ''.$ctx->lang->line('gen_hamradio_state').''; break; case 'Grid': echo ''.$ctx->lang->line('gen_hamradio_gridsquare').''; break; case 'Band': echo ''.$ctx->lang->line('gen_hamradio_band').''; break; + case 'Frequency': echo ''.$ctx->lang->line('gen_hamradio_frequency').''; break; case 'Operator': echo ''.$ctx->lang->line('gen_hamradio_operator').''; break; } } @@ -26,6 +27,7 @@ function echo_table_col($row, $name) { case 'POTA': echo '' . ($row->COL_POTA_REF) . ''; break; case 'Grid': echo ''; echoQrbCalcLink($row->station_gridsquare, $row->COL_VUCC_GRIDS, $row->COL_GRIDSQUARE); echo ''; break; case 'Band': echo ''; if($row->COL_SAT_NAME != null) { echo ''.$row->COL_SAT_NAME.''; } else { echo strtolower($row->COL_BAND); } echo ''; break; + case 'Frequency': echo ''; if($row->COL_FREQ != null) { echo $row->COL_FREQ; } else { echo strtolower($row->COL_BAND); } echo ''; break; case 'State': echo '' . ($row->COL_STATE) . ''; break; case 'Operator': echo '' . ($row->COL_OPERATOR) . ''; break; } From 8384d7d421cff6e1d04c5df91cb7f62ed7a219b3 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Wed, 14 Dec 2022 12:48:56 +0100 Subject: [PATCH 02/24] [PHP8.1] Added some fixes for PHP 8.1 --- system/core/Common.php | 3 +++ system/libraries/Profiler.php | 3 ++- system/libraries/Session/drivers/Session_files_driver.php | 7 ++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/system/core/Common.php b/system/core/Common.php index 03f62c09..158213c0 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -727,6 +727,9 @@ if ( ! function_exists('remove_invisible_characters')) do { + if ($str == null) { + $str = ""; + } $str = preg_replace($non_displayables, '', $str, -1, $count); } while ($count); diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index 5531f336..0ef908bc 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -490,10 +490,10 @@ class CI_Profiler { if (is_array($val) OR is_object($val)) { $val = print_r($val, TRUE); - $pre = '
' ;
 				$pre_close = '
'; } + $val = $val == null ? "" : $val; $output .= '' .$config.'  '.$pre.htmlspecialchars($val, ENT_QUOTES, config_item('charset')).$pre_close."\n"; @@ -522,6 +522,7 @@ class CI_Profiler { foreach ($this->CI->session->userdata() as $key => $val) { + $val = $val == null ? "" : $val; $pre = ''; $pre_close = ''; diff --git a/system/libraries/Session/drivers/Session_files_driver.php b/system/libraries/Session/drivers/Session_files_driver.php index 49bf5b78..af380524 100644 --- a/system/libraries/Session/drivers/Session_files_driver.php +++ b/system/libraries/Session/drivers/Session_files_driver.php @@ -129,7 +129,7 @@ class CI_Session_files_driver extends CI_Session_driver implements SessionHandle * @param string $name Session cookie name * @return bool */ - public function open($save_path, $name) + public function open($save_path, $name): bool { if ( ! is_dir($save_path)) { @@ -165,6 +165,7 @@ class CI_Session_files_driver extends CI_Session_driver implements SessionHandle * @param string $session_id Session ID * @return string Serialized session data */ + #[\ReturnTypeWillChange] public function read($session_id) { // This might seem weird, but PHP 5.6 introduces session_reset(), @@ -238,6 +239,7 @@ class CI_Session_files_driver extends CI_Session_driver implements SessionHandle * @param string $session_data Serialized session data * @return bool */ + #[\ReturnTypeWillChange] public function write($session_id, $session_data) { // If the two IDs don't match, we have a session_regenerate_id() call @@ -295,6 +297,7 @@ class CI_Session_files_driver extends CI_Session_driver implements SessionHandle * * @return bool */ + #[\ReturnTypeWillChange] public function close() { if (is_resource($this->_file_handle)) @@ -318,6 +321,7 @@ class CI_Session_files_driver extends CI_Session_driver implements SessionHandle * @param string $session_id Session ID * @return bool */ + #[\ReturnTypeWillChange] public function destroy($session_id) { if ($this->close() === $this->_success) @@ -359,6 +363,7 @@ class CI_Session_files_driver extends CI_Session_driver implements SessionHandle * @param int $maxlifetime Maximum lifetime of sessions * @return bool */ + #[\ReturnTypeWillChange] public function gc($maxlifetime) { if ( ! is_dir($this->_config['save_path']) OR ($directory = opendir($this->_config['save_path'])) === FALSE) From 1a786f88e8ec7523e15a279a50776473b4ddcd6d Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 14 Dec 2022 13:24:00 +0100 Subject: [PATCH 03/24] Fix strlen stuff --- application/views/dashboard/index.php | 4 ++-- application/views/view_log/partial/log_ajax.php | 4 ++-- application/views/visitor/index.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/application/views/dashboard/index.php b/application/views/dashboard/index.php index 8b37b3d6..534ef2a0 100644 --- a/application/views/dashboard/index.php +++ b/application/views/dashboard/index.php @@ -34,9 +34,9 @@ function echo_table_col($row, $name) { } function echoQrbCalcLink($mygrid, $grid, $vucc) { - if (strlen($grid) != 0) { + if (!empty($grid)) { echo $grid . ' '; - } else if (strlen($vucc) != 0) { + } else if (!empty($vucc)) { echo $vucc .' '; } } diff --git a/application/views/view_log/partial/log_ajax.php b/application/views/view_log/partial/log_ajax.php index 9500f152..5091b647 100644 --- a/application/views/view_log/partial/log_ajax.php +++ b/application/views/view_log/partial/log_ajax.php @@ -34,9 +34,9 @@ function echo_table_col($row, $name) { } function echoQrbCalcLink($mygrid, $grid, $vucc) { - if (strlen($grid) != 0) { + if (!empty($grid)) { echo $grid . ' '; - } else if (strlen($vucc) != 0) { + } else if (!empty($vucc)) { echo $vucc .' '; } } diff --git a/application/views/visitor/index.php b/application/views/visitor/index.php index ddc4cb2b..1bd73907 100644 --- a/application/views/visitor/index.php +++ b/application/views/visitor/index.php @@ -32,9 +32,9 @@ function echo_table_col($row, $name) { } function echoQrbCalcLink($mygrid, $grid, $vucc) { - if (strlen($grid) != 0) { + if (!empty($grid)) { echo $grid . ' '; - } else if (strlen($vucc) != 0) { + } else if (!empty($vucc)) { echo $vucc .' '; } } From 85ca34bf801ae22169aef724ff8d7bcc65f1bee3 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Wed, 14 Dec 2022 13:53:14 +0100 Subject: [PATCH 04/24] [PHP8.1] Replaced output.php with a newer one --- system/core/Output.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/system/core/Output.php b/system/core/Output.php index c56aff4b..02f3933f 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2019, British Columbia Institute of Technology + * Copyright (c) 2019 - 2022, CodeIgniter Foundation * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -30,6 +30,7 @@ * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) * @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/) + * @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/) * @license https://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 @@ -55,7 +56,7 @@ class CI_Output { * * @var string */ - public $final_output; + public $final_output = ''; /** * Cache expiration time @@ -145,7 +146,7 @@ class CI_Output { && extension_loaded('zlib') ); - isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload')); + isset(self::$func_overload) OR self::$func_overload = ( ! is_php('8.0') && extension_loaded('mbstring') && @ini_get('mbstring.func_overload')); // Get mime types for later $this->mimes =& get_mimes(); @@ -299,10 +300,14 @@ class CI_Output { */ public function get_header($header) { - // Combine headers already sent with our batched headers + // We only need [x][0] from our multi-dimensional array + $header_lines = array_map(function ($headers) + { + return array_shift($headers); + }, $this->headers); + $headers = array_merge( - // We only need [x][0] from our multi-dimensional array - array_map('array_shift', $this->headers), + $header_lines, headers_list() ); From ee14821e59a81bc88b74fd3b1ebb3c1d06485b10 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Fri, 16 Dec 2022 11:37:53 +0000 Subject: [PATCH 05/24] [Satellites] changed cas5a to FO-118 in the satellite_data.json file --- assets/json/satellite_data.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/json/satellite_data.json b/assets/json/satellite_data.json index 13ac63db..2dc73a2a 100644 --- a/assets/json/satellite_data.json +++ b/assets/json/satellite_data.json @@ -143,7 +143,7 @@ ] } }, - "CAS-5A":{ + "FO-118":{ "Modes":{ "H/U":[ { From c93a32da8bd15514b8879f7ef29ad106614807ac Mon Sep 17 00:00:00 2001 From: phl0 Date: Sun, 18 Dec 2022 09:21:21 +0100 Subject: [PATCH 06/24] Rename CAS-5A to FO-118 --- application/config/migration.php | 2 +- application/migrations/110_rename_cas5a.php | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 application/migrations/110_rename_cas5a.php diff --git a/application/config/migration.php b/application/config/migration.php index bb486284..fc8056f6 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE; | be upgraded / downgraded to. | */ -$config['migration_version'] = 109; +$config['migration_version'] = 110; /* |-------------------------------------------------------------------------- diff --git a/application/migrations/110_rename_cas5a.php b/application/migrations/110_rename_cas5a.php new file mode 100644 index 00000000..d3cf1fab --- /dev/null +++ b/application/migrations/110_rename_cas5a.php @@ -0,0 +1,19 @@ +db->set('COL_SAT_NAME', 'FO-118'); + $this->db->where('COL_SAT_NAME', 'CAS-5A'); + $this->db->update($this->config->item('table_name')); + } + + public function down() + { + $this->db->set('COL_SAT_NAME', 'CAS-5A'); + $this->db->where('COL_SAT_NAME', 'FO-118'); + $this->db->update($this->config->item('table_name')); + } +} From 96219b634a22224559ff5f7d7f8e672bd45b1b3b Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Sun, 18 Dec 2022 14:54:37 +0000 Subject: [PATCH 07/24] [Satellites] Adds CAS-10 XW-4 support to dropdowns --- assets/json/satellite_data.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/assets/json/satellite_data.json b/assets/json/satellite_data.json index 2dc73a2a..41676d4c 100644 --- a/assets/json/satellite_data.json +++ b/assets/json/satellite_data.json @@ -143,6 +143,18 @@ ] } }, + "CAS-10":{ + "Modes":{ + "V/U":[ + { + "Uplink_Mode":"LSB", + "Uplink_Freq":"145870000", + "Downlink_Mode":"USB", + "Downlink_Freq":"435180000" + } + ] + } + }, "FO-118":{ "Modes":{ "H/U":[ From dbc8a5451a5de8cb2589d8c3825142fd340a9b2f Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Sun, 18 Dec 2022 16:49:54 +0100 Subject: [PATCH 08/24] [Logbookadvanced] First version of a logbook with filtering and batchprocessing of QSL handling. --- application/controllers/Logbookadvanced.php | 170 +++++ .../helpers/psr4_autoloader_helper.php | 21 + application/models/Logbookadvanced_model.php | 184 +++++ application/views/interface_assets/footer.php | 9 + application/views/interface_assets/header.php | 4 +- application/views/logbookadvanced/index.php | 193 ++++++ assets/js/sections/logbookadvanced.js | 345 +++++++++ src/QSLManager/QSO.php | 652 ++++++++++++++++++ 8 files changed, 1576 insertions(+), 2 deletions(-) create mode 100644 application/controllers/Logbookadvanced.php create mode 100644 application/helpers/psr4_autoloader_helper.php create mode 100644 application/models/Logbookadvanced_model.php create mode 100644 application/views/logbookadvanced/index.php create mode 100644 assets/js/sections/logbookadvanced.js create mode 100644 src/QSLManager/QSO.php diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php new file mode 100644 index 00000000..1a0c8226 --- /dev/null +++ b/application/controllers/Logbookadvanced.php @@ -0,0 +1,170 @@ +load->helper(array('form', 'url', 'psr4_autoloader')); + + $this->load->model('user_model'); + if (!$this->user_model->authorize(2)) { + $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + redirect('dashboard'); + } + } + + function index() { + $this->load->model('stations'); + $this->load->model('logbookadvanced_model'); + $this->load->model('logbook_model'); + $this->load->model('bands'); + $this->load->model('iota'); + $this->load->model('dxcc'); + + $stationIds = []; + + $deOptions = []; + foreach ($this->stations->all_of_user()->result() as $station) { + $deOptions[$station->station_callsign] = 1; + $stationIds[] = $station->station_id; + } + ksort($deOptions); + $deOptions = array_keys($deOptions); + + $modes = []; + if ($stationIds !== []) { + foreach ($this->logbookadvanced_model->get_worked_modes($stationIds) as $mode) { + $key = $mode['mode']; + if ($mode['submode'] !== null) { + $key .= "|" . $mode['submode']; + } + if ($mode['submode'] == null) { + $modes[$key] = $mode['mode']; + } else { + $modes[$key] = $mode['submode']; + } + } + } + + $data = []; + $data['page_title'] = "Advanced logbook"; + $data['hasDatePicker'] = true; + + $pageData = []; + $pageData['datePlaceholder'] = 'DD/MM/YYYY'; + $pageData['deOptions'] = $deOptions; + $pageData['modes'] = $modes; + $pageData['dxccarray'] = $this->logbook_model->fetchDxcc(); + $pageData['iotaarray'] = $this->logbook_model->fetchIota(); + + $pageData['bands'] = $this->bands->get_worked_bands(); + + $footerData = []; + $footerData['scripts'] = [ + 'assets/js/moment.min.js', + 'assets/js/tempusdominus-bootstrap-4.min.js', + 'assets/js/sections/logbookadvanced.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/logbookadvanced.js")) + ]; + + $this->load->view('interface_assets/header', $data); + $this->load->view('logbookadvanced/index', $pageData); + $this->load->view('interface_assets/footer', $footerData); + } + + public function search() { + $this->load->model('logbookadvanced_model'); + + $searchCriteria = array( + 'user_id' => (int)$this->session->userdata('user_id'), + 'dateFrom' => xss_clean($this->input->post('dateFrom')), + 'dateTo' => xss_clean($this->input->post('dateTo')), + 'de' => xss_clean($this->input->post('de')), + 'dx' => xss_clean($this->input->post('dx')), + 'mode' => xss_clean($this->input->post('mode')), + 'band' => xss_clean($this->input->post('band')), + 'qslSent' => xss_clean($this->input->post('qslSent')), + 'qslReceived' => xss_clean($this->input->post('qslReceived')), + 'iota' => xss_clean($this->input->post('iota')), + 'dxcc' => xss_clean($this->input->post('dxcc')), + 'propmode' => xss_clean($this->input->post('propmode')), + 'gridsquare' => xss_clean($this->input->post('gridsquare')), + 'state' => xss_clean($this->input->post('state')), + ); + + $qsos = []; + foreach ($this->logbookadvanced_model->searchQsos($searchCriteria) as $qso) { + $qsos[] = $qso->toArray(); + } + + header("Content-Type: application/json"); + print json_encode($qsos); + } + + public function updateFromCallbook() { + $this->load->model('logbook_model'); + + $qsoID = xss_clean($this->input->post('qsoID')); + $qso = $this->logbook_model->qso_info($qsoID)->row_array(); + if ($qso === null) { + header("Content-Type: application/json"); + echo json_encode([]); + return; + } + + $callbook = $this->logbook_model->loadCallBook($qso['COL_CALL'], $this->config->item('use_fullname')); + + if ($callbook['callsign'] !== "") { + $qso['COL_NAME'] = trim($callbook['name']); + $qso['COL_QSL_VIA'] = trim($callbook['qslmgr']); + } + + $qsoObj = new QSO($qso); + + header("Content-Type: application/json"); + echo json_encode($qsoObj->toArray()); + } + + function export_to_adif() { + $this->load->model('logbookadvanced_model'); + + $ids = xss_clean($this->input->post('id')); + $user_id = (int)$this->session->userdata('user_id'); + + $data['qsos'] = $this->logbookadvanced_model->getQsosForAdif($ids, $user_id); + + $this->load->view('adif/data/exportall', $data); + } + + function update_qsl() { + $this->load->model('logbookadvanced_model'); + + $ids = xss_clean($this->input->post('id')); + $user_id = (int)$this->session->userdata('user_id'); + $method = xss_clean($this->input->post('method')); + $sent = xss_clean($this->input->post('sent')); + + $status = $this->logbookadvanced_model->updateQsl($ids, $user_id, $method, $sent); + + $data = $this->logbookadvanced_model->getQsosForAdif($ids, $user_id); + + $results = $data->result('array'); + + $qsos = []; + foreach ($results as $data) { + $qsos[] = new QSO($data); + } + + $q = []; + foreach ($qsos as $qso) { + $q[] = $qso->toArray(); + } + + header("Content-Type: application/json"); + print json_encode($q); + } +} \ No newline at end of file diff --git a/application/helpers/psr4_autoloader_helper.php b/application/helpers/psr4_autoloader_helper.php new file mode 100644 index 00000000..74a00521 --- /dev/null +++ b/application/helpers/psr4_autoloader_helper.php @@ -0,0 +1,21 @@ +load->model('logbooks_model'); + + $ids = "'".implode("','",$stationIds)."'"; + + $sql = " + SELECT distinct `COL_MODE`, `COL_SUBMODE` + FROM `" . $this->config->item('table_name') . "` qsos + WHERE qsos.station_id IN (".$ids.") + ORDER BY COL_MODE, COL_SUBMODE"; + + $data = $this->db->query($sql); + + $results = []; + foreach ($data->result() as $row) { + $results[] = [ + 'mode' => $row->COL_MODE, + 'submode' => $row->COL_SUBMODE + ]; + } + return $results; + } + + /* + * @param array $searchCriteria + * @return array + */ + public function searchQsos($searchCriteria) : array { + $conditions = []; + $binding = [$searchCriteria['user_id']]; + + if ($searchCriteria['dateFrom'] !== '') { + $from = DateTime::createFromFormat('d/m/Y', $searchCriteria['dateFrom']); + $from = $from->format('Y-m-d'); + $conditions[] = "date(COL_TIME_ON) >= ?"; + $binding[] = $from; + } + if ($searchCriteria['dateTo'] !== '') { + $to = DateTime::createFromFormat('d/m/Y', $searchCriteria['dateTo']); + $to = $to->format('Y-m-d'); + $conditions[] = "date(COL_TIME_ON) <= ?"; + $binding[] = $to; + } + if ($searchCriteria['de'] !== '') { + $conditions[] = "COL_STATION_CALLSIGN = ?"; + $binding[] = trim($searchCriteria['de']); + } + if ($searchCriteria['dx'] !== '') { + $conditions[] = "COL_CALL LIKE ?"; + $binding[] = '%' . trim($searchCriteria['dx']) . '%'; + } + if ($searchCriteria['mode'] !== '') { + list ($mode, $subMode) = explode("|", trim($searchCriteria['mode'])); + $mode = trim($mode); + $subMode = trim($subMode); + $conditions[] = "COL_MODE = ?"; + $binding[] = $mode; + if ($subMode !== '') { + $conditions[] = "COL_SUBMODE = ?"; + $binding[] = $subMode; + } + } + if ($searchCriteria['band'] !== '') { + $conditions[] = "COL_BAND = ?"; + $binding[] = trim($searchCriteria['band']); + } + if ($searchCriteria['qslSent'] !== '') { + $conditions[] = "COL_QSL_SENT = ?"; + $binding[] = $searchCriteria['qslSent']; + } + if ($searchCriteria['qslReceived'] !== '') { + $conditions[] = "COL_QSL_RCVD = ?"; + $binding[] = $searchCriteria['qslReceived']; + } + + if ($searchCriteria['iota'] !== '') { + $conditions[] = "COL_IOTA = ?"; + $binding[] = $searchCriteria['iota']; + } + + if ($searchCriteria['dxcc'] !== '') { + $conditions[] = "COL_DXCC = ?"; + $binding[] = $searchCriteria['dxcc']; + } + + if ($searchCriteria['state'] !== '') { + $conditions[] = "COL_STATE = ?"; + $binding[] = $searchCriteria['state']; + } + + if ($searchCriteria['gridsquare'] !== '') { + $conditions[] = "(COL_GRIDSQUARE like ? or COL_VUCC_GRIDS like ?)"; + $binding[] = '%' . $searchCriteria['gridsquare'] . '%'; + $binding[] = '%' . $searchCriteria['gridsquare'] . '%'; + } + + if ($searchCriteria['propmode'] !== '') { + $conditions[] = "COL_PROP_MODE = ?"; + $binding[] = $searchCriteria['propmode']; + } + + $where = trim(implode(" AND ", $conditions)); + if ($where != "") { + $where = "AND $where"; + } + + if ($where === '') { + $limit = 250; + } else { + $limit = 1000; + } + + $sql = " + SELECT * + FROM " . $this->config->item('table_name') . " qsos + INNER JOIN station_profile ON qsos.station_id=station_profile.station_id + WHERE station_profile.user_id = ? + $where + ORDER BY qsos.COL_TIME_ON desc + LIMIT $limit + "; + + $data = $this->db->query($sql, $binding); + + $results = $data->result('array'); + + $qsos = []; + foreach ($results as $data) { + $qsos[] = new QSO($data); + } + + return $qsos; + } + + public function getQsosForAdif($ids, $user_id) : object { + $binding = [$user_id]; + $conditions[] = "COL_PRIMARY_KEY in ?"; + $binding[] = json_decode($ids, true); + + $where = trim(implode(" AND ", $conditions)); + if ($where != "") { + $where = "AND $where"; + } + + $sql = " + SELECT * + FROM " . $this->config->item('table_name') . " qsos + INNER JOIN station_profile ON qsos.station_id = station_profile.station_id + WHERE station_profile.user_id = ? + $where + ORDER BY qsos.COL_TIME_ON desc + "; + + return $this->db->query($sql, $binding); + } + + public function updateQsl($ids, $user_id, $method, $sent) { + $this->load->model('user_model'); + + if(!$this->user_model->authorize(2)) { + return array('message' => 'Error'); + } else { + $data = array( + 'COL_QSLSDATE' => date('Y-m-d H:i:s'), + 'COL_QSL_SENT' => $sent, + 'COL_QSL_SENT_VIA' => $method + ); + $this->db->where_in('COL_PRIMARY_KEY', json_decode($ids, true)); + $this->db->update($this->config->item('table_name'), $data); + + return array('message' => 'OK'); + } + } +} \ No newline at end of file diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 66e919e2..30042f80 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -3187,5 +3187,14 @@ function deleteQsl(id) { + + + diff --git a/application/views/interface_assets/header.php b/application/views/interface_assets/header.php index 0918e572..7900ea91 100644 --- a/application/views/interface_assets/header.php +++ b/application/views/interface_assets/header.php @@ -36,7 +36,7 @@ - uri->segment(1) == "adif") { ?> + uri->segment(1) == "adif" || (isset($hasDatePicker) && $hasDatePicker)) { ?> @@ -58,7 +58,7 @@