diff --git a/application/config/migration.php b/application/config/migration.php index 6e6072fa..a16f0abb 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE; | */ -$config['migration_version'] = 188; +$config['migration_version'] = 190; /* |-------------------------------------------------------------------------- diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php index 8b9ccfc9..4122861c 100644 --- a/application/controllers/Lotw.php +++ b/application/controllers/Lotw.php @@ -993,6 +993,7 @@ class Lotw extends CI_Controller { "TEVEL7" => "TEVEL-7", "TEVEL8" => "TEVEL-8", "INSPR7" => "INSPIRE-SAT 7", + "SONATE" => "SONATE-2", ); return array_search(strtoupper($satname),$arr,true); diff --git a/application/controllers/User.php b/application/controllers/User.php index 5cb9da11..d3b91646 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -755,23 +755,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_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' => '')); - } // 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'); @@ -780,6 +782,24 @@ class User extends CI_Controller // Save the encrypted password $this->user_options_model->set_option('callbook', 'callbook_password', array('value' => $encrypted_password)); + + // if callbook type is QRZ + if ($_POST['user_callbook_type'] == 'QRZ') { + // Lookup using QRZ + $this->load->library('qrz'); + + $qrz_session_key = $this->qrz->session($_POST['user_callbook_username'], $_POST['user_callbook_password']); + $this->session->set_userdata('qrz_session_key', $qrz_session_key); + } elseif ($_POST['user_callbook_type'] == "HamQTH") { + $this->load->library('hamqth'); + $hamqth_session_key = $this->hamqth->session($_POST['user_callbook_username'], $_POST['user_callbook_password']); + $this->session->set_userdata('hamqth_session_key', $hamqth_session_key); + } + + // Update Session data + $this->session->set_userdata('callbook_type', $_POST['user_callbook_type']); + $this->session->set_userdata('callbook_username', $_POST['user_callbook_username']); + $this->session->set_userdata('callbook_password', $encrypted_password); } if (isset($_POST['user_dashboard_enable_dxpedition_card'])) { diff --git a/application/migrations/189_set_MO122_lotw_upload.php b/application/migrations/189_set_MO122_lotw_upload.php new file mode 100644 index 00000000..197d77b1 --- /dev/null +++ b/application/migrations/189_set_MO122_lotw_upload.php @@ -0,0 +1,17 @@ +db->set('COL_LOTW_QSL_SENT', 'N'); + $this->db->where('COL_SAT_NAME', 'MO-122'); + $this->db->update($this->config->item('table_name')); + } + + public function down() + { + // Not Possible + } +} diff --git a/application/migrations/190_set_SONATE_lotw_upload.php b/application/migrations/190_set_SONATE_lotw_upload.php new file mode 100644 index 00000000..521d090c --- /dev/null +++ b/application/migrations/190_set_SONATE_lotw_upload.php @@ -0,0 +1,17 @@ +db->set('COL_LOTW_QSL_SENT', 'N'); + $this->db->where('COL_SAT_NAME', 'SONATE-2'); + $this->db->update($this->config->item('table_name')); + } + + public function down() + { + // Not Possible + } +} diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 1eb99b36..951fb8d8 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -4340,14 +4340,13 @@ class Logbook_model extends CI_Model 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 ''; + $sql = "SELECT name, cqz, lat, `long` FROM dxcc_entities WHERE adif = ?"; + $query = $this->db->query($sql, array($dxcc)); + + if ($query->num_rows() > 0) { + return $query->row_array(); + } + return ''; } /*