Improved Callbook user entry

Improved callbook user information entry, logout dance no longer required
This commit is contained in:
Peter Goodhall 2024-10-30 15:15:11 +00:00 committed by GitHub
commit 0d37cb7181
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 77 additions and 23 deletions

View File

@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE;
|
*/
$config['migration_version'] = 188;
$config['migration_version'] = 190;
/*
|--------------------------------------------------------------------------

View File

@ -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);

View File

@ -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'])) {

View File

@ -0,0 +1,17 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Migration_set_MO122_lotw_upload extends CI_Migration
{
public function up()
{
$this->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
}
}

View File

@ -0,0 +1,17 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Migration_set_SONATE_lotw_upload extends CI_Migration
{
public function up()
{
$this->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
}
}

View File

@ -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 '';
}
/*