+
diff --git a/application/config/migration.php b/application/config/migration.php index ce5a1727..2eb36735 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE; | */ -$config['migration_version'] = 196; +$config['migration_version'] = 199; /* |-------------------------------------------------------------------------- diff --git a/application/controllers/Activated_gridmap.php b/application/controllers/Activated_gridmap.php index ba41858f..2a498f6e 100644 --- a/application/controllers/Activated_gridmap.php +++ b/application/controllers/Activated_gridmap.php @@ -1,16 +1,19 @@ -load->model('bands'); - $this->load->model('activated_gridmap_model'); + $this->load->model('bands'); + $this->load->model('activated_gridmap_model'); $this->load->model('stations'); $data['visitor'] = false; @@ -32,25 +35,26 @@ class Activated_gridmap extends CI_Controller { $data['gridsquares_gridsquares_not_confirmed'] = lang('gridsquares_gridsquares_not_confirmed'); $data['gridsquares_gridsquares_total_activated'] = lang('gridsquares_gridsquares_total_activated'); - $footerData = []; + $footerData = []; $footerData['scripts'] = [ 'assets/js/leaflet/geocoding.js', 'assets/js/leaflet/L.MaidenheadColouredGridMap.js', 'assets/js/sections/gridmap.js?' ]; - + $this->load->view('interface_assets/header', $data); $this->load->view('activated_gridmap/index'); $this->load->view('interface_assets/footer', $footerData); - } + } - public function getGridsjs() { - $band = $this->security->xss_clean($this->input->post('band')); - $mode = $this->security->xss_clean($this->input->post('mode')); - $qsl = $this->security->xss_clean($this->input->post('qsl')); - $lotw = $this->security->xss_clean($this->input->post('lotw')); - $eqsl = $this->security->xss_clean($this->input->post('eqsl')); - $qrz = $this->security->xss_clean($this->input->post('qrz')); + public function getGridsjs() + { + $band = $this->security->xss_clean($this->input->post('band')); + $mode = $this->security->xss_clean($this->input->post('mode')); + $qsl = $this->security->xss_clean($this->input->post('qsl')); + $lotw = $this->security->xss_clean($this->input->post('lotw')); + $eqsl = $this->security->xss_clean($this->input->post('eqsl')); + $qrz = $this->security->xss_clean($this->input->post('qrz')); $sat = $this->security->xss_clean($this->input->post('sat')); $this->load->model('activated_gridmap_model'); @@ -73,27 +77,27 @@ class Activated_gridmap extends CI_Controller { $query = $this->activated_gridmap_model->get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat); if ($query && $query->num_rows() > 0) { - foreach ($query->result() as $row) { + foreach ($query->result() as $row) { $gridlist = explode(',', $row->GRID_SQUARES); foreach ($gridlist as $grid) { - $grid_2char_confirmed = strtoupper(substr($grid,0,2)); - $grid_4char_confirmed = strtoupper(substr($grid,0,4)); + $grid_2char_confirmed = strtoupper(substr($grid, 0, 2)); + $grid_4char_confirmed = strtoupper(substr($grid, 0, 4)); if ($this->config->item('map_6digit_grids')) { - $grid_6char_confirmed = strtoupper(substr($grid,0,6)); + $grid_6char_confirmed = strtoupper(substr($grid, 0, 6)); } // Check if 2 Char is in array - if(!in_array($grid_2char_confirmed, $array_grid_2char_confirmed)){ - array_push($array_grid_2char_confirmed, $grid_2char_confirmed); + if (!in_array($grid_2char_confirmed, $array_grid_2char_confirmed)) { + array_push($array_grid_2char_confirmed, $grid_2char_confirmed); } - if(!in_array($grid_4char_confirmed, $array_grid_4char_confirmed)){ - array_push($array_grid_4char_confirmed, $grid_4char_confirmed); + if (!in_array($grid_4char_confirmed, $array_grid_4char_confirmed)) { + array_push($array_grid_4char_confirmed, $grid_4char_confirmed); } if ($this->config->item('map_6digit_grids')) { - if(!in_array($grid_6char_confirmed, $array_grid_6char_confirmed)){ - array_push($array_grid_6char_confirmed, $grid_6char_confirmed); + if (!in_array($grid_6char_confirmed, $array_grid_6char_confirmed)) { + array_push($array_grid_6char_confirmed, $grid_6char_confirmed); } } } @@ -107,24 +111,24 @@ class Activated_gridmap extends CI_Controller { $gridlist = explode(',', $row->GRID_SQUARES); foreach ($gridlist as $grid) { - $grid_two = strtoupper(substr($grid,0,2)); - $grid_four = strtoupper(substr($grid,0,4)); + $grid_two = strtoupper(substr($grid, 0, 2)); + $grid_four = strtoupper(substr($grid, 0, 4)); if ($this->config->item('map_6digit_grids')) { - $grid_six = strtoupper(substr($grid,0,6)); + $grid_six = strtoupper(substr($grid, 0, 6)); } // Check if 2 Char is in array - if(!in_array($grid_two, $array_grid_2char)){ - array_push($array_grid_2char, $grid_two); + if (!in_array($grid_two, $array_grid_2char)) { + array_push($array_grid_2char, $grid_two); } - if(!in_array($grid_four, $array_grid_4char)){ - array_push($array_grid_4char, $grid_four); + if (!in_array($grid_four, $array_grid_4char)) { + array_push($array_grid_4char, $grid_four); } if ($this->config->item('map_6digit_grids')) { - if(!in_array($grid_six, $array_grid_6char)){ - array_push($array_grid_6char, $grid_six); + if (!in_array($grid_six, $array_grid_6char)) { + array_push($array_grid_6char, $grid_six); } } } @@ -137,18 +141,18 @@ class Activated_gridmap extends CI_Controller { $grids = explode(",", $row->COL_VUCC_GRIDS); - foreach($grids as $key) { - $grid_two = strtoupper(substr($key,0,2)); - $grid_four = strtoupper(substr($key,0,4)); + foreach ($grids as $key) { + $grid_two = strtoupper(substr($key, 0, 2)); + $grid_four = strtoupper(substr($key, 0, 4)); // Check if 2 Char is in array - if(!in_array($grid_two, $array_grid_2char)){ - array_push($array_grid_2char, $grid_two); + if (!in_array($grid_two, $array_grid_2char)) { + array_push($array_grid_2char, $grid_two); } - if(!in_array($grid_four, $array_grid_4char)){ - array_push($array_grid_4char, $grid_four); + if (!in_array($grid_four, $array_grid_4char)) { + array_push($array_grid_4char, $grid_four); } } } @@ -158,28 +162,28 @@ class Activated_gridmap extends CI_Controller { $query_vucc = $this->activated_gridmap_model->get_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat); if ($query_vucc && $query_vucc->num_rows() > 0) { - foreach ($query_vucc->result() as $row) { + foreach ($query_vucc->result() as $row) { $grids = explode(",", $row->COL_VUCC_GRIDS); - foreach($grids as $key) { - $grid_2char_confirmed = strtoupper(substr($key,0,2)); - $grid_4char_confirmed = strtoupper(substr($key,0,4)); + foreach ($grids as $key) { + $grid_2char_confirmed = strtoupper(substr($key, 0, 2)); + $grid_4char_confirmed = strtoupper(substr($key, 0, 4)); // Check if 2 Char is in array - if(!in_array($grid_2char_confirmed, $array_grid_2char_confirmed)){ - array_push($array_grid_2char_confirmed, $grid_2char_confirmed); + if (!in_array($grid_2char_confirmed, $array_grid_2char_confirmed)) { + array_push($array_grid_2char_confirmed, $grid_2char_confirmed); } - if(!in_array($grid_4char_confirmed, $array_grid_4char_confirmed)){ - array_push($array_grid_4char_confirmed, $grid_4char_confirmed); + if (!in_array($grid_4char_confirmed, $array_grid_4char_confirmed)) { + array_push($array_grid_4char_confirmed, $grid_4char_confirmed); } } } } - $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); @@ -187,7 +191,7 @@ class Activated_gridmap extends CI_Controller { $data['grid_4char'] = ($array_grid_4char); $data['grid_6char'] = ($array_grid_6char); - header('Content-Type: application/json'); - echo json_encode($data); - } + header('Content-Type: application/json'); + echo json_encode($data); + } } diff --git a/application/controllers/Clublog.php b/application/controllers/Clublog.php index 74801237..f8c7b5bd 100644 --- a/application/controllers/Clublog.php +++ b/application/controllers/Clublog.php @@ -37,27 +37,33 @@ class Clublog extends CI_Controller { $this->load->model('clublog_model'); + // Retrieve all station profiles for the user with their QSO counts $station_profiles = $this->clublog_model->all_with_count($clean_userid); if($station_profiles->num_rows()){ foreach ($station_profiles->result() as $station_row) { + // Only process stations that have QSOs to upload if($station_row->qso_total > 0) { + // Get QSOs for this station that haven't been uploaded to Clublog yet $data['qsos'] = $this->clublog_model->get_clublog_qsos($station_row->station_id); if($data['qsos']->num_rows()){ + // Generate ADIF file content from the view template $string = $this->load->view('adif/data/clublog', $data, TRUE); + // Generate a unique ID for the temporary file $ranid = uniqid(); + // Write the ADIF data to a temporary file if ( ! write_file('uploads/clublog'.$ranid.$station_row->station_id.'.adi', $string)) { echo 'Unable to write the file - Make the folder Upload folder has write permissions.'; } else { - + // Get details of the created ADIF file $file_info = get_file_info('uploads/clublog'.$ranid.$station_row->station_id.'.adi'); - // initialise the curl request + // Initialize the CURL request to Clublog's API endpoint $request = curl_init('https://clublog.org/putlogs.php'); if($this->config->item('directory') != "") { @@ -138,13 +144,12 @@ class Clublog extends CI_Controller { $this->clublog_model->mark_qsos_sent($clean_station_id); } - function markallnotsent() { + function markallnotsent($station_id) { $clean_station_id = $this->security->xss_clean($station_id); $this->load->model('clublog_model'); $this->clublog_model->mark_all_qsos_notsent($clean_station_id); } - // Find DXCC function find_dxcc($callsign) { $clean_callsign = $this->security->xss_clean($callsign); diff --git a/application/controllers/User.php b/application/controllers/User.php index d3b91646..42c6808b 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -22,7 +22,7 @@ class User extends CI_Controller public function index() { $this->load->model('user_model'); - + // Check if the user is authorized if (!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); @@ -215,7 +215,7 @@ class User extends CI_Controller $this->input->post('user_callbook_username'), $this->input->post('user_callbook_password') )) { - // Check for errors + // Check for errors case EUSERNAMEEXISTS: $data['username_error'] = 'Username ' . $this->input->post('user_name') . ' already in use!'; break; @@ -225,7 +225,7 @@ class User extends CI_Controller case EPASSWORDINVALID: $data['password_error'] = 'Invalid password!'; break; - // All okay, return to user screen + // All okay, return to user screen case OK: $this->session->set_flashdata('notice', 'User ' . $this->input->post('user_name') . ' added'); redirect('user'); @@ -576,6 +576,12 @@ class User extends CI_Controller $data['user_winkey'] = $q->winkey; } + if ($this->input->post('user_winkey_websocket')) { + $data['user_winkey_websocket'] = $this->input->post('user_winkey_websocket', true); + } else { + $data['user_winkey_websocket'] = $q->winkey_websocket; + } + $this->load->model('user_options_model'); $callbook_type_object = $this->user_options_model->get_options('callbook')->result(); @@ -730,8 +736,14 @@ class User extends CI_Controller $this->load->view('interface_assets/footer'); } else { unset($data); - switch ($this->user_model->edit($this->input->post())) { - // Check for errors + + + $post_data = $this->input->post(); + if (!isset($post_data['user_winkey_websocket'])) { + $post_data['user_winkey_websocket'] = '0'; + } + switch ($this->user_model->edit($post_data)) { + // Check for errors case EUSERNAMEEXISTS: $data['username_error'] = 'Username ' . $this->input->post('user_name', true) . ' already in use!'; break; @@ -741,7 +753,7 @@ class User extends CI_Controller case EPASSWORDINVALID: $data['password_error'] = 'Invalid password!'; break; - // All okay, return to user screen + // All okay, return to user screen case OK: if ($this->session->userdata('user_id') == $this->uri->segment(3)) { // Editing own User? Set cookie! $cookie = array( @@ -755,25 +767,25 @@ class User extends CI_Controller $this->input->set_cookie($cookie); } if ($this->session->userdata('user_id') == $this->input->post('id', true)) { - + // Handle user_callbook_password if (isset($_POST['user_callbook_password']) && !empty($_POST['user_callbook_password'])) { - + // Handle user_callbook_type if (isset($_POST['user_callbook_type'])) { $this->user_options_model->set_option('callbook', 'callbook_type', array('value' => $_POST['user_callbook_type'])); } else { $this->user_options_model->set_option('callbook', 'callbook_type', array('value' => '')); } - + // Handle user_callbook_username if (isset($_POST['user_callbook_username'])) { $this->user_options_model->set_option('callbook', 'callbook_username', array('value' => $_POST['user_callbook_username'])); } else { $this->user_options_model->set_option('callbook', 'callbook_username', array('value' => '')); } - + // Load the encryption library $this->load->library('encryption'); @@ -892,6 +904,7 @@ class User extends CI_Controller $data['user_quicklog_enter'] = $this->input->post('user_quicklog_enter'); $data['language'] = $this->input->post('language'); $data['user_winkey'] = $this->input->post('user_winkey'); + $data['user_winkey_websocket'] = $this->input->post('user_winkey_websocket'); $data['user_hamsat_key'] = $this->input->post('user_hamsat_key'); $data['user_hamsat_workable_only'] = $this->input->post('user_hamsat_workable_only'); diff --git a/application/migrations/197_add_winkey_websocket.php b/application/migrations/197_add_winkey_websocket.php new file mode 100644 index 00000000..a38b9a75 --- /dev/null +++ b/application/migrations/197_add_winkey_websocket.php @@ -0,0 +1,30 @@ +db->field_exists('winkey_websocket', 'users')) { + $fields = array( + 'winkey_websocket boolean default 0', + ); + + $this->dbforge->add_column('users', $fields); + } + } + + public function down() + { + if ($this->db->field_exists('winkey_websocket', 'users')) { + $this->dbforge->drop_column('users', 'winkey_websocket'); + } + } +} diff --git a/application/migrations/198_sat_name_change_hadesicm_so125.php b/application/migrations/198_sat_name_change_hadesicm_so125.php new file mode 100644 index 00000000..e5b42e71 --- /dev/null +++ b/application/migrations/198_sat_name_change_hadesicm_so125.php @@ -0,0 +1,36 @@ +db->set('COL_SAT_NAME', 'SO-125'); + $this->db->where('COL_SAT_NAME', 'HADES-ICM'); + $this->db->update($this->config->item('table_name')); + log_message('info', 'Migration: Updated COL_SAT_NAME to SO-125 for HADES-ICM'); + + // update column COL_LOTW_QSL_SENT to N if its SO-125 + $this->db->set('COL_LOTW_QSL_SENT', 'N'); + $this->db->where('COL_SAT_NAME', 'SO-125'); + $this->db->update($this->config->item('table_name')); + log_message('info', 'Migration: Set COL_LOTW_QSL_SENT to N for SO-125'); + + } + + public function down() + { + //Change back to HADES-ICM + $this->db->set('COL_SAT_NAME', 'HADES-ICM'); + $this->db->where('COL_SAT_NAME', 'SO-125'); + $this->db->update($this->config->item('table_name')); + log_message('info', 'Migration: Reverted COL_SAT_NAME back to HADES-ICM'); + + // Set COL_LOTW_QSL_SENT back to N for HADES-ICM + $this->db->set('COL_LOTW_QSL_SENT', 'N'); + $this->db->where('COL_SAT_NAME', 'HADES-ICM'); + $this->db->update($this->config->item('table_name')); + log_message('info', 'Migration: Reverted COL_LOTW_QSL_SENT back to N for HADES-ICM'); + } +} diff --git a/application/migrations/199_tag_2_6_19.php b/application/migrations/199_tag_2_6_19.php new file mode 100644 index 00000000..2f8c2c45 --- /dev/null +++ b/application/migrations/199_tag_2_6_19.php @@ -0,0 +1,30 @@ +db->where('option_name', 'version'); + $this->db->update('options', array('option_value' => '2.6.19')); + + // 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.18')); + } +} \ No newline at end of file diff --git a/application/models/User_model.php b/application/models/User_model.php index 3a12405b..ea93efdf 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -267,6 +267,7 @@ class User_Model extends CI_Model { 'user_quicklog_enter' => xss_clean($fields['user_quicklog_enter']), 'language' => xss_clean($fields['language']), 'winkey' => xss_clean($fields['user_winkey']), + 'winkey_websocket' => xss_clean($fields['user_winkey_websocket']), ); $this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'hamsat','hamsat_key','api','".xss_clean($fields['user_hamsat_key'])."');"); @@ -426,6 +427,7 @@ class User_Model extends CI_Model { 'active_station_logbook' => $u->row()->active_station_logbook, 'language' => isset($u->row()->language) ? $u->row()->language: 'english', 'isWinkeyEnabled' => $u->row()->winkey, + 'isWinkeyWebsocketEnabled' => (bool)$u->row()->winkey_websocket, 'hasQrzKey' => $this->hasQrzKey($u->row()->user_id), 'callbook_type' => $callbook_type, 'callbook_username' => $callbook_username, diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index d7152fc2..17d81303 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -1125,11 +1125,222 @@ if ($this->session->userdata('user_id') != null) { uri->segment(1) == "qso") { ?> - session->userdata('isWinkeyEnabled')) { ?> + session->userdata('isWinkeyEnabled') && !$this->session->userdata('isWinkeyWebsocketEnabled')) { ?> - session->userdata('isWinkeyEnabled') && $this->session->userdata('isWinkeyWebsocketEnabled')) { ?> + - if ($this->optionslib->get_option('dxcache_url') != '') { ?> + + + + + optionslib->get_option('dxcache_url') != '') { ?> - + diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 56b1700c..5993a1a3 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -673,9 +673,49 @@ + session->userdata('isWinkeyEnabled') && $this->session->userdata('isWinkeyWebsocketEnabled')) { ?> +
Here you can update QSOs with missing distance information.
- +?
+?
- -
+