From 96d7a2537d4235ff8cb8211c89b3acada7c0a396 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Mon, 24 Jan 2022 16:13:25 +0000 Subject: [PATCH] [API][QSO] Skips check_station_is_accessible() if import is coming from API Skips check_station_is_accessible() if import is coming from API this is because api qso import doesn't have a session thus automatically fails. Extra checks must be done on the api calls to make sure things are safe. Fixes #1381 Co-Authored-By: Florian (DF2ET) --- application/controllers/Api.php | 4 ++-- application/models/Logbook_model.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/application/controllers/Api.php b/application/controllers/Api.php index d440fe32..0993d809 100644 --- a/application/controllers/Api.php +++ b/application/controllers/Api.php @@ -450,9 +450,9 @@ class API extends CI_Controller { if(isset($obj['station_profile_id'])) { - $this->logbook_model->import($record, $obj['station_profile_id'], NULL, NULL, NULL, NULL, false, false); + $this->logbook_model->import($record, $obj['station_profile_id'], NULL, NULL, NULL, NULL, false, false, true); } else { - $this->logbook_model->import($record, 0, NULL, NULL, NULL, NULL, false, false); + $this->logbook_model->import($record, 0, NULL, NULL, NULL, NULL, false, false, true); } }; diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index c3d89236..95cc9f88 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -1879,11 +1879,11 @@ class Logbook_model extends CI_Model { * $markQrz - used in ADIF import to mark QSOs as exported to QRZ Logbook when importing QSOs * $skipexport - used in ADIF import to skip the realtime upload to QRZ Logbook when importing QSOs from ADIF */ - function import($record, $station_id = "0", $skipDuplicate = false, $markLotw = false, $dxccAdif = false, $markQrz = false, $skipexport = false, $operatorName = false) { + function import($record, $station_id = "0", $skipDuplicate = false, $markLotw = false, $dxccAdif = false, $markQrz = false, $skipexport = false, $operatorName = false, $apicall = false) { // be sure that station belongs to user $CI =& get_instance(); $CI->load->model('Stations'); - if (!$CI->Stations->check_station_is_accessible($station_id)) { + if (!$CI->Stations->check_station_is_accessible($station_id) && $apicall == false ) { return 'Station not accessible
'; }