Check station callsign in station profile

这个提交包含在:
phl0 2023-09-06 00:02:07 +02:00
父节点 e74a949b07
当前提交 c5e050f548
找不到此签名对应的密钥
GPG 密钥 ID: 48EA1E640798CA9A
共有 2 个文件被更改,包括 19 次插入2 次删除

查看文件

@ -185,8 +185,6 @@ class API extends CI_Controller {
die();
}
$this->api_model->update_last_used($obj['key']);
if($obj['type'] == "adif" && $obj['string'] != "") {
// Load the logbook model for adding QSO records
$this->load->model('logbook_model');
@ -207,6 +205,14 @@ class API extends CI_Controller {
if(isset($obj['station_profile_id'])) {
if(isset($record['station_callsign']) && $this->stations->check_station_against_callsign($obj['station_profile_id'], $record['station_callsign']) == false) {
http_response_code(401);
echo json_encode(['status' => 'failed', 'reason' => "station callsign does not match station callsign in station profile."]);
die();
}
$this->api_model->update_last_used($obj['key']);
$this->logbook_model->import($record, $obj['station_profile_id'], NULL, NULL, NULL, NULL, NULL, NULL, false, false, true);
}

查看文件

@ -485,6 +485,17 @@ class Stations extends CI_Model {
}
return false;
}
public function check_station_against_callsign($stationid, $callsign) {
$this->db->select('station_id');
$this->db->where('station_callsign', $callsign);
$this->db->where('station_id', $stationid);
$query = $this->db->get('station_profile');
if ($query->num_rows() == 1) {
return true;
}
return false;
}
}
?>