diff --git a/application/config/migration.php b/application/config/migration.php index a84fafcf..4a7774a3 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE; | */ -$config['migration_version'] = 152; +$config['migration_version'] = 153; /* |-------------------------------------------------------------------------- diff --git a/application/controllers/Components.php b/application/controllers/Components.php index 942dcbc3..7fc0e27a 100644 --- a/application/controllers/Components.php +++ b/application/controllers/Components.php @@ -14,11 +14,13 @@ class Components extends CI_Controller { } public function index() { + $this->load->model('stations'); $url = 'https://oscarwatch.org/scripts/hamsat_json.php'; $json = file_get_contents($url); $data['rovedata'] = json_decode($json, true); + $data['gridsquare'] = strtoupper($this->stations->find_gridsquare()); // load view $this->load->view('components/hamsat/table', $data); } -} \ No newline at end of file +} diff --git a/application/controllers/Debug.php b/application/controllers/Debug.php index 5d8d2a9c..1d60cbd5 100644 --- a/application/controllers/Debug.php +++ b/application/controllers/Debug.php @@ -52,9 +52,11 @@ class Debug extends CI_Controller { // Check if the subdirectories are writable (recursive check) $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); foreach ($iterator as $item) { - if (!is_writable($item->getPathname())) { - return false; - } + if ($item->isDir() && basename($item->getPathName()) != '..') { + if (!is_writable($item->getRealPath())) { + return false; + } + } } return true; diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index f0ff8f12..3fa7c0f7 100644 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -168,7 +168,7 @@ class Logbook extends CI_Controller { $return['confirmed'] = $this->confirmed_grid_before($return['callsign_qra'], $type, $band, $mode); if ($this->session->userdata('user_show_profile_image')) { - if (isset($callbook)) { + if (isset($callbook) && isset($callbook['image'])) { if ($callbook['image'] == "") { $return['image'] = "n/a"; } else { @@ -851,14 +851,40 @@ function worked_grid_before($gridsquare, $type, $band, $mode) $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); } - $data= $this->qrz->search($id, $this->session->userdata('qrz_session_key'), $this->config->item('use_fullname')); + $callsign['callsign'] = $this->qrz->search($id, $this->session->userdata('qrz_session_key'), $this->config->item('use_fullname')); - if (empty($data['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); - $data = $this->qrz->search($id, $this->session->userdata('qrz_session_key'), $this->config->item('use_fullname')); - } + if (empty($callsign['callsign']['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); + $callsign['callsign'] = $this->qrz->search($id, $this->session->userdata('qrz_session_key'), $this->config->item('use_fullname')); + } + } else 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); + } + + $callsign['callsign'] = $this->hamqth->search($id, $this->session->userdata('hamqth_session_key')); + + // If HamQTH session has expired, start a new session and retry the search. + if($callsign['callsign']['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); + $callsign['callsign'] = $this->hamqth->search($callsign, $this->session->userdata('hamqth_session_key')); + } + if (isset($data['callsign']['gridsquare'])) { + $CI = &get_instance(); + $CI->load->model('logbook_model'); + $callsign['grid_worked'] = $CI->logbook_model->check_if_grid_worked_in_logbook(strtoupper(substr($data['callsign']['gridsquare'],0,4)), 0, $this->session->userdata('user_default_band')); + } + if (isset($callsign['callsign']['error'])) { + $callsign['error'] = $callsign['callsign']['error']; + } + } else { + $callsign['error'] = 'Lookup not configured. Please review configuration.'; } // There's no hamli integration? Disabled for now. @@ -866,12 +892,20 @@ function worked_grid_before($gridsquare, $type, $band, $mode) // Lookup using hamli $this->load->library('hamli'); - $data['callsign'] = $this->hamli->callsign($id); + $callsign['callsign'] = $this->hamli->callsign($id); }*/ - $data['id'] = strtoupper($id); + if (isset($callsign['callsign']['gridsquare'])) { + $CI = &get_instance(); + $CI->load->model('logbook_model'); + $callsign['grid_worked'] = $CI->logbook_model->check_if_grid_worked_in_logbook(strtoupper(substr($callsign['callsign']['gridsquare'],0,4)), 0, $this->session->userdata('user_default_band')); + } + if (isset($callsign['callsign']['error'])) { + $callsign['error'] = $callsign['callsign']['error']; + } + $callsign['id'] = strtoupper($id); - return $this->load->view('search/result', $data, true); + return $this->load->view('search/result', $callsign, true); } } @@ -927,8 +961,33 @@ function worked_grid_before($gridsquare, $type, $band, $mode) if (isset($data['callsign']['error'])) { $data['error'] = $data['callsign']['error']; } + } else 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); + } + + $data['callsign'] = $this->hamqth->search($id, $this->session->userdata('hamqth_session_key')); + + // If HamQTH session has expired, start a new session and retry the search. + if($data['callsign']['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); + $data['callsign'] = $this->hamqth->search($callsign, $this->session->userdata('hamqth_session_key')); + } + if (isset($data['callsign']['gridsquare'])) { + $CI = &get_instance(); + $CI->load->model('logbook_model'); + $data['grid_worked'] = $CI->logbook_model->check_if_grid_worked_in_logbook(strtoupper(substr($data['callsign']['gridsquare'],0,4)), 0, $this->session->userdata('user_default_band')); + } + if (isset($data['callsign']['error'])) { + $data['error'] = $data['callsign']['error']; + } } else { - $data['error'] = 'No result (qrz not configured)'; + $data['error'] = 'Lookup not configured. Please review configuration.'; } /*else { // Lookup using hamli $this->load->library('hamli'); diff --git a/application/libraries/Curl.php b/application/libraries/Curl.php index 106df120..35a75524 100644 --- a/application/libraries/Curl.php +++ b/application/libraries/Curl.php @@ -27,7 +27,6 @@ class Curl { function __construct($url = '') { $this->_ci = & get_instance(); - log_message('debug', 'cURL Class Initialized'); if ( ! $this->is_enabled()) { @@ -369,4 +368,4 @@ class Curl { } /* End of file Curl.php */ -/* Location: ./application/libraries/Curl.php */ \ No newline at end of file +/* Location: ./application/libraries/Curl.php */ diff --git a/application/libraries/Hamqth.php b/application/libraries/Hamqth.php index f2646735..1b71449b 100644 --- a/application/libraries/Hamqth.php +++ b/application/libraries/Hamqth.php @@ -71,7 +71,7 @@ class Hamqth { // Create XML object $xml = simplexml_load_string($xml); - if (empty($xml)) return; + if (!empty($xml->session->error)) return $data['error'] = $xml->session->error; // Return Required Fields $data['callsign'] = (string)$xml->search->callsign; diff --git a/application/migrations/153_tag_2_5_2.php b/application/migrations/153_tag_2_5_2.php new file mode 100644 index 00000000..9be710c1 --- /dev/null +++ b/application/migrations/153_tag_2_5_2.php @@ -0,0 +1,24 @@ +db->where('option_name', 'version'); + $this->db->update('options', array('option_value' => '2.5.2')); + } + + public function down() + { + $this->db->where('option_name', 'version'); + $this->db->update('options', array('option_value' => '2.5.1')); + } +} \ No newline at end of file diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index fdeef86e..2e399f4e 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -433,8 +433,7 @@ class Logbook_model extends CI_Model { $this->db->limit(500); $result = $this->db->get($this->config->item('table_name')); - log_message('debug', 'SQL: '.$this->db->last_query()); - return $result; + return $result; //return $this->db->get($this->config->item('table_name')); } @@ -501,6 +500,7 @@ class Logbook_model extends CI_Model { $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') { @@ -4083,6 +4083,7 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray = $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')); @@ -4117,7 +4118,6 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray = $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')); - log_message('debug','SQL: '.$this->db->last_query()); if($query->num_rows() >= 1) { return $query->result(); } else { diff --git a/application/views/components/hamsat/table.php b/application/views/components/hamsat/table.php index e218916f..0792824d 100644 --- a/application/views/components/hamsat/table.php +++ b/application/views/components/hamsat/table.php @@ -17,6 +17,7 @@ Satellite Gridsquare(s) + @@ -92,6 +93,15 @@ Track + + Sked diff --git a/application/views/hamsat/index.php b/application/views/hamsat/index.php index aba617d2..f5f033f2 100644 --- a/application/views/hamsat/index.php +++ b/application/views/hamsat/index.php @@ -1,3 +1,3 @@
-
\ No newline at end of file + diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 18970412..40597e06 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -1000,37 +1000,6 @@ $(document).on('keypress',function(e) { } ); }); - $('#reset_time').click(function() { - var now = new Date(); - var localTime = now.getTime(); - var utc = localTime + (now.getTimezoneOffset() * 60000); - $('#start_time').val(("0" + now.getUTCHours()).slice(-2)+':'+("0" + now.getUTCMinutes()).slice(-2)+':'+("0" + now.getUTCSeconds()).slice(-2)); - $("[id='start_time']").each(function() { - $(this).attr("value", ("0" + now.getUTCHours()).slice(-2)+':'+("0" + now.getUTCMinutes()).slice(-2)+':'+("0" + now.getUTCSeconds()).slice(-2)); - }); - }); - $('#reset_start_time').click(function() { - var now = new Date(); - var localTime = now.getTime(); - var utc = localTime + (now.getTimezoneOffset() * 60000); - $('#start_time').val(("0" + now.getUTCHours()).slice(-2)+':'+("0" + now.getUTCMinutes()).slice(-2)); - $("[id='start_time']").each(function() { - $(this).attr("value", ("0" + now.getUTCHours()).slice(-2)+':'+("0" + now.getUTCMinutes()).slice(-2)+':'+("0" + now.getUTCSeconds()).slice(-2)); - }); - $('#end_time').val(("0" + now.getUTCHours()).slice(-2)+':'+("0" + now.getUTCMinutes()).slice(-2)); - $("[id='end_time']").each(function() { - $(this).attr("value", ("0" + now.getUTCHours()).slice(-2)+':'+("0" + now.getUTCMinutes()).slice(-2)+':'+("0" + now.getUTCSeconds()).slice(-2)); - }); - }); - $('#reset_end_time').click(function() { - var now = new Date(); - var localTime = now.getTime(); - var utc = localTime + (now.getTimezoneOffset() * 60000); - $('#end_time').val(("0" + now.getUTCHours()).slice(-2)+':'+("0" + now.getUTCMinutes()).slice(-2)); - $("[id='end_time']").each(function() { - $(this).attr("value", ("0" + now.getUTCHours()).slice(-2)+':'+("0" + now.getUTCMinutes()).slice(-2)+':'+("0" + now.getUTCSeconds()).slice(-2)); - }); - }); }); diff --git a/application/views/qslprint/qsolist.php b/application/views/qslprint/qsolist.php index 3cbf6699..45710446 100644 --- a/application/views/qslprint/qsolist.php +++ b/application/views/qslprint/qsolist.php @@ -37,7 +37,7 @@ if ($qsos->result() != NULL) { echo ''; $timestamp = strtotime($qsl->COL_TIME_ON); echo date($custom_date_format, $timestamp); echo ''; echo ''; $timestamp = strtotime($qsl->COL_TIME_ON); echo date('H:i', $timestamp); echo ''; echo ''; echo $qsl->COL_SUBMODE==null?$qsl->COL_MODE:$qsl->COL_SUBMODE; echo ''; - echo ''; if($qsl->COL_SAT_NAME != null) { echo $qsl->COL_SAT_NAME; } else { echo strtolower($qsl->COL_BAND); }; echo ''; + echo ''; if($qsl->COL_SAT_NAME != null) { echo $qsl->COL_SAT_NAME; } else { echo strtolower($qsl->COL_BAND ?? ""); }; echo ''; echo '' . $qsl->station_callsign . ''; echo '' . $qsl->COL_QSL_VIA . ''; echo ''; echo_qsl_sent_via($qsl->COL_QSL_SENT_VIA); echo ''; diff --git a/application/views/qso/edit_ajax.php b/application/views/qso/edit_ajax.php index f7e7d097..dc81bf0a 100644 --- a/application/views/qso/edit_ajax.php +++ b/application/views/qso/edit_ajax.php @@ -55,12 +55,12 @@
- +
- +
@@ -187,7 +187,7 @@
- +
diff --git a/application/views/view_log/partial/log_ajax.php b/application/views/view_log/partial/log_ajax.php index cf246c0b..fb99eed8 100644 --- a/application/views/view_log/partial/log_ajax.php +++ b/application/views/view_log/partial/log_ajax.php @@ -102,7 +102,7 @@ function echoQrbCalcLink($mygrid, $grid, $vucc) { COL_CALL)); ?> lastupload) { + if (isset($row->lastupload) && ($row->lastupload)) { $lotw_hint = ''; $diff = (time() - strtotime($row->lastupload)) / 86400; if ($diff > 365) { diff --git a/assets/css/general.css b/assets/css/general.css index 0118e5cf..fbf81e99 100644 --- a/assets/css/general.css +++ b/assets/css/general.css @@ -552,10 +552,6 @@ div#station_logbooks_linked_table_paginate { margin-right: 30px; } -input:invalid { - border-color: red; -} - .sfletable{ height: 470px; } diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js index a1146772..b3090454 100644 --- a/assets/js/sections/qso.js +++ b/assets/js/sections/qso.js @@ -1,12 +1,43 @@ $( document ).ready(function() { setTimeout(function() { var callsignValue = localStorage.getItem("quicklogCallsign"); - if (callsignValue !== "") { + if (callsignValue !== null && callsignValue !== undefined) { $("#callsign").val(callsignValue); $("#mode").focus(); localStorage.removeItem("quicklogCallsign"); } - }, 100); + }, 100); + $('#reset_time').click(function() { + var now = new Date(); + var localTime = now.getTime(); + var utc = localTime + (now.getTimezoneOffset() * 60000); + $('#start_time').val(("0" + now.getUTCHours()).slice(-2)+':'+("0" + now.getUTCMinutes()).slice(-2)+':'+("0" + now.getUTCSeconds()).slice(-2)); + $("[id='start_time']").each(function() { + $(this).attr("value", ("0" + now.getUTCHours()).slice(-2)+':'+("0" + now.getUTCMinutes()).slice(-2)+':'+("0" + now.getUTCSeconds()).slice(-2)); + }); + }); + $('#reset_start_time').click(function() { + var now = new Date(); + var localTime = now.getTime(); + var utc = localTime + (now.getTimezoneOffset() * 60000); + $('#start_time').val(("0" + now.getUTCHours()).slice(-2)+':'+("0" + now.getUTCMinutes()).slice(-2)); + $("[id='start_time']").each(function() { + $(this).attr("value", ("0" + now.getUTCHours()).slice(-2)+':'+("0" + now.getUTCMinutes()).slice(-2)+':'+("0" + now.getUTCSeconds()).slice(-2)); + }); + $('#end_time').val(("0" + now.getUTCHours()).slice(-2)+':'+("0" + now.getUTCMinutes()).slice(-2)); + $("[id='end_time']").each(function() { + $(this).attr("value", ("0" + now.getUTCHours()).slice(-2)+':'+("0" + now.getUTCMinutes()).slice(-2)+':'+("0" + now.getUTCSeconds()).slice(-2)); + }); + }); + $('#reset_end_time').click(function() { + var now = new Date(); + var localTime = now.getTime(); + var utc = localTime + (now.getTimezoneOffset() * 60000); + $('#end_time').val(("0" + now.getUTCHours()).slice(-2)+':'+("0" + now.getUTCMinutes()).slice(-2)); + $("[id='end_time']").each(function() { + $(this).attr("value", ("0" + now.getUTCHours()).slice(-2)+':'+("0" + now.getUTCMinutes()).slice(-2)+':'+("0" + now.getUTCSeconds()).slice(-2)); + }); + }); var favs={}; get_fav();