比较提交

...

14 提交

作者 SHA1 备注 提交日期
Peter Goodhall
d348f175ae
Merge pull request #3339 from magicbug/dev
Dev
2025-09-12 15:34:56 +01:00
Peter Goodhall
952007467d Add latitude and longitude to DXCC lookup results
Enhanced the DXCC lookup in Logbook_model to include latitude and longitude in the returned array. Updated API controller to utilize these new fields when returning recent QSOs and callsign lookups, providing more detailed location data in API responses.
2025-09-12 13:14:31 +01:00
Peter Goodhall
b7c065dbdd Add input validation for recent_qsos limit parameter
The recent_qsos API endpoint now validates and sanitizes the $limit parameter, enforcing a default of 10, a minimum of 1, and a maximum of 50. Additionally, get_last_qsos in Logbook_model ensures $num is always an integer to prevent SQL injection.
2025-09-09 14:25:40 +01:00
Peter Goodhall
11c83f5908 Update Api.php 2025-09-09 14:21:53 +01:00
Peter Goodhall
5c4c1c2cd5 Fix SQL JOIN in get_last_qsos for station_profile
Changed the SQL query in get_last_qsos to use LEFT JOIN for station_profile instead of JOIN. This ensures that QSOs are returned even if there is no matching station_profile, improving data completeness.
2025-09-09 14:21:21 +01:00
Peter Goodhall
3f8f81364b Update Logbook_model.php 2025-09-09 14:19:51 +01:00
Peter Goodhall
72ea1e3353 Remove limit validation and update SQL join in logbook
Removed the limit parameter validation and sanitization from Api.php, delegating limit handling elsewhere. Changed the SQL query in Logbook_model.php to use LEFT JOIN for station_profile, ensuring all logbook records are included even if no matching station_profile exists.
2025-09-09 14:19:15 +01:00
Peter Goodhall
7286d5b608 Add 4m band support to frequencyToBand function
Extended the frequencyToBand function to recognize frequencies between 70 MHz and 72 MHz as the 4m band.
2025-09-02 15:30:05 +01:00
Peter Goodhall
f1dbceafd3 Add 4m band support to frequencyToBand function
Extended the frequencyToBand function to recognize frequencies between 70 MHz and 72 MHz as the 4m band.
2025-09-02 12:58:01 +01:00
Peter Goodhall
04ccd0809c Refactor Adif controller for code style and readability
Improved code formatting and consistency in the Adif controller by updating brace placement, indentation, and spacing. Enhanced readability and maintainability without changing core logic or functionality.
2025-08-29 10:59:42 +01:00
Peter Goodhall
22b67fb925 Add Portuguese language support to config
Added a case for 'portuguese' in the language selection switch statement to support Portuguese in the configuration.
2025-08-27 10:46:20 +01:00
Peter Goodhall
caf5bdd70d Add Portuguese language support to config
Added a case for 'portuguese' in the language configuration switch statement to support Portuguese localization.
2025-08-27 10:44:42 +01:00
Peter Goodhall
7fb09280fc Update general_words_lang.php 2025-08-27 10:39:05 +01:00
Peter Goodhall
407792800b
tag 2.7.1 2025-08-25 13:16:55 +01:00
共有 7 个文件被更改,包括 292 次插入272 次删除

查看文件

@ -198,6 +198,9 @@ case 'finnish':
case 'russian':
$config['language'] = $lang;
break;
case 'portuguese':
$config['language'] = $lang;
break;
case 'english':
$config['language'] = $lang;
break;

查看文件

@ -1,6 +1,7 @@
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class adif extends CI_Controller {
class adif extends CI_Controller
{
/* Controls ADIF Import/Export Functions */
@ -10,11 +11,15 @@ class adif extends CI_Controller {
$this->load->helper(array('form', 'url'));
$this->load->model('user_model');
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
if (!$this->user_model->authorize(2)) {
$this->session->set_flashdata('notice', 'You\'re not allowed to do that!');
redirect('dashboard');
}
}
/* Shows Export Views */
public function export() {
public function export()
{
$data['page_title'] = "ADIF Export";
@ -65,7 +70,8 @@ class adif extends CI_Controller {
$this->load->view('adif/data/exportsat', $data);
}
public function export_custom() {
public function export_custom()
{
// Set memory limit to unlimited to allow heavy usage
ini_set('memory_limit', '-1');
@ -87,14 +93,14 @@ class adif extends CI_Controller {
if ($this->input->post('markLotw') == 1) {
foreach ($data['qsos']->result() as $qso)
{
foreach ($data['qsos']->result() as $qso) {
$this->adif_data->mark_lotw_sent($qso->COL_PRIMARY_KEY);
}
}
}
public function mark_lotw() {
public function mark_lotw()
{
// Set memory limit to unlimited to allow heavy usage
ini_set('memory_limit', '-1');
@ -103,8 +109,7 @@ class adif extends CI_Controller {
$data['qsos'] = $this->adif_data->export_custom($this->input->post('from'), $this->input->post('to'), $station_id);
foreach ($data['qsos']->result() as $qso)
{
foreach ($data['qsos']->result() as $qso) {
$this->adif_data->mark_lotw_sent($qso->COL_PRIMARY_KEY);
}
@ -122,13 +127,13 @@ class adif extends CI_Controller {
$this->load->view('adif/data/exportall', $data);
foreach ($data['qsos']->result() as $qso)
{
foreach ($data['qsos']->result() as $qso) {
$this->adif_data->mark_lotw_sent($qso->COL_PRIMARY_KEY);
}
}
public function index() {
public function index()
{
$this->load->model('stations');
$data['page_title'] = "ADIF Import / Export";
@ -145,7 +150,8 @@ class adif extends CI_Controller {
$this->load->view('interface_assets/footer');
}
public function import() {
public function import()
{
$this->load->model('stations');
$data['station_profile'] = $this->stations->all_of_user();
log_message("debug", "Started ADIF Import");
@ -188,8 +194,7 @@ class adif extends CI_Controller {
$this->adif_parser->initialize();
$custom_errors = "";
$alladif = [];
while($record = $this->adif_parser->get_record())
{
while ($record = $this->adif_parser->get_record()) {
if (count($record) == 0) {
break;
};
@ -209,11 +214,11 @@ class adif extends CI_Controller {
$this->load->view('interface_assets/header', $data);
$this->load->view('adif/import_success');
$this->load->view('interface_assets/footer');
}
}
public function dcl() {
public function dcl()
{
$this->load->model('stations');
$data['station_profile'] = $this->stations->all_of_user();
@ -248,8 +253,7 @@ class adif extends CI_Controller {
$this->adif_parser->initialize();
$error_count = array(0, 0, 0);
$custom_errors = "";
while($record = $this->adif_parser->get_record())
{
while ($record = $this->adif_parser->get_record()) {
if (count($record) == 0) {
break;
};

查看文件

@ -1,6 +1,7 @@
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class API extends CI_Controller {
class API extends CI_Controller
{
// Do absolutely nothing
function index()
@ -31,7 +32,8 @@ class API extends CI_Controller {
}
function edit($key) {
function edit($key)
{
$this->load->model('user_model');
// Check if users logged in
@ -52,16 +54,13 @@ class API extends CI_Controller {
$data['api_info'] = $this->api_model->key_description($key);
if ($this->form_validation->run() == FALSE)
{
if ($this->form_validation->run() == FALSE) {
$data['page_title'] = "Edit API Description";
$this->load->view('interface_assets/header', $data);
$this->load->view('api/description');
$this->load->view('interface_assets/footer');
}
else
{
} else {
// Success!
$this->api_model->update_key_description($this->input->post('api_key'), $this->input->post('api_desc'));
@ -70,10 +69,10 @@ class API extends CI_Controller {
redirect('api/help');
}
}
function generate($rights) {
function generate($rights)
{
$this->load->model('user_model');
// Check if users logged in
@ -91,7 +90,8 @@ class API extends CI_Controller {
redirect('api/help');
}
function delete($key) {
function delete($key)
{
$this->load->model('user_model');
// Check if users logged in
@ -112,7 +112,8 @@ class API extends CI_Controller {
}
// Example of authing
function auth($key) {
function auth($key)
{
$this->load->model('api_model');
header("Content-type: text/xml");
if ($this->api_model->access($key) == "No Key Found" || $this->api_model->access($key) == "Key Disabled") {
@ -127,7 +128,8 @@ class API extends CI_Controller {
}
}
function check_auth($key) {
function check_auth($key)
{
$this->load->model('api_model');
header("Content-type: text/xml");
if ($this->api_model->access($key) == "No Key Found" || $this->api_model->access($key) == "Key Disabled") {
@ -150,7 +152,8 @@ class API extends CI_Controller {
}
}
function station_info($key) {
function station_info($key)
{
$this->load->model('api_model');
$this->load->model('stations');
header("Content-type: application/json");
@ -180,7 +183,8 @@ class API extends CI_Controller {
* Function: QSO
* Task: allows passing of ADIF data to Cloudlog
*/
function qso() {
function qso()
{
header('Content-type: application/json');
$this->load->model('api_model');
@ -227,10 +231,8 @@ class API extends CI_Controller {
$this->adif_parser->feed($obj['string']);
// Create QSO Record
while($record = $this->adif_parser->get_record())
{
if(count($record) == 0)
{
while ($record = $this->adif_parser->get_record()) {
if (count($record) == 0) {
break;
};
@ -258,17 +260,15 @@ class API extends CI_Controller {
$return_msg[] = $msg;
}
}
};
http_response_code(201);
echo json_encode(['status' => 'created', 'type' => $obj['type'], 'string' => $obj['string'], 'imported_count' => $return_count, 'messages' => $return_msg]);
}
}
// API function to check if a callsign is in the logbook already
function logbook_check_callsign() {
function logbook_check_callsign()
{
header('Content-type: application/json');
$this->load->model('api_model');
@ -308,8 +308,7 @@ class API extends CI_Controller {
if ($this->logbooks_model->public_slug_exists($logbook_slug)) {
$logbook_id = $this->logbooks_model->public_slug_exists_logbook_id($logbook_slug);
if($logbook_id != false)
{
if ($logbook_id != false) {
// Get associated station locations for mysql queries
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($logbook_id);
@ -331,8 +330,7 @@ class API extends CI_Controller {
$result = $this->logbook_model->check_if_callsign_worked_in_logbook($callsign, $logbooks_locations_array, $band);
http_response_code(201);
if($result > 0)
{
if ($result > 0) {
echo json_encode(['callsign' => $callsign, 'result' => 'Found']);
} else {
echo json_encode(['callsign' => $callsign, 'result' => 'Not Found']);
@ -343,13 +341,12 @@ class API extends CI_Controller {
echo json_encode(['status' => 'failed', 'reason' => "logbook not found"]);
die();
}
}
}
// API function to check if a grid is in the logbook already
function logbook_check_grid() {
function logbook_check_grid()
{
header('Content-type: application/json');
$this->load->model('api_model');
@ -387,8 +384,7 @@ class API extends CI_Controller {
if ($this->logbooks_model->public_slug_exists($logbook_slug)) {
$logbook_id = $this->logbooks_model->public_slug_exists_logbook_id($logbook_slug);
if($logbook_id != false)
{
if ($logbook_id != false) {
// Get associated station locations for mysql queries
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($logbook_id);
@ -410,8 +406,7 @@ class API extends CI_Controller {
$result = $this->logbook_model->check_if_grid_worked_in_logbook($grid, $logbooks_locations_array, $band);
http_response_code(201);
if($result > 0)
{
if ($result > 0) {
echo json_encode(['gridsquare' => strtoupper($grid), 'result' => 'Found']);
} else {
echo json_encode(['gridsquare' => strtoupper($grid), 'result' => 'Not Found']);
@ -422,9 +417,7 @@ class API extends CI_Controller {
echo json_encode(['status' => 'failed', 'reason' => "logbook not found"]);
die();
}
}
}
@ -525,8 +518,7 @@ class API extends CI_Controller {
if ($this->logbooks_model->public_slug_exists($logbook_slug)) {
$logbook_id = $this->logbooks_model->public_slug_exists_logbook_id($logbook_slug);
if($logbook_id != false)
{
if ($logbook_id != false) {
// Get associated station locations for mysql queries
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($logbook_id);
@ -604,7 +596,8 @@ class API extends CI_Controller {
/* ENDPOINT for Rig Control */
function radio() {
function radio()
{
header('Content-type: application/json');
$this->load->model('api_model');
@ -636,7 +629,6 @@ class API extends CI_Controller {
$arr = array('status' => 'success');
echo json_encode($arr);
}
/*
@ -645,7 +637,8 @@ class API extends CI_Controller {
*
*/
function statistics($key = null) {
function statistics($key = null)
{
header('Content-type: application/json');
$this->load->model('logbook_model');
@ -656,10 +649,10 @@ class API extends CI_Controller {
http_response_code(201);
echo json_encode(['Today' => $data['todays_qsos'], 'total_qsos' => $data['total_qsos'], 'month_qsos' => $data['month_qsos'], 'year_qsos' => $data['year_qsos']]);
}
function lookup() {
function lookup()
{
// start benchmarking
$this->output->enable_profiler(TRUE);
/*
@ -679,7 +672,9 @@ class API extends CI_Controller {
// Make sure users logged in
$this->load->model('user_model');
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
if (!$this->user_model->authorize($this->config->item('auth_mode'))) {
return;
}
$this->load->model("logbook_model");
@ -773,8 +768,7 @@ class API extends CI_Controller {
*/
$call_lookup_results = $this->logbook_model->call_lookup_result($lookup_callsign);
if($call_lookup_results != null)
{
if ($call_lookup_results != null) {
$return['name'] = $call_lookup_results->COL_NAME;
$return['gridsquare'] = $call_lookup_results->COL_GRIDSQUARE;
$return['location'] = $call_lookup_results->COL_QTH;
@ -786,7 +780,6 @@ class API extends CI_Controller {
if ($return['gridsquare'] != "") {
$return['latlng'] = $this->qralatlng($return['gridsquare']);
}
}
@ -809,7 +802,8 @@ class API extends CI_Controller {
$this->output->enable_profiler(FALSE);
}
function qralatlng($qra) {
function qralatlng($qra)
{
$this->load->library('Qra');
$latlng = $this->qra->qra2latlong($qra);
return $latlng;
@ -848,24 +842,28 @@ class API extends CI_Controller {
* "logbook_slug": "my-public-logbook"
* }
*/
function recent_qsos($public_slug = null, $limit = 10) {
function recent_qsos($public_slug = null, $limit = 10)
{
header('Content-type: application/json');
// Validate and sanitize $limit
if (!is_numeric($limit)) {
$limit = 10; // Default to 10 if not numeric
} else {
$limit = intval($limit);
if ($limit < 1) {
$limit = 1; // Minimum limit of 1
} elseif ($limit > 50) {
$limit = 50; // Maximum limit of 50
}
}
if ($public_slug == null) {
http_response_code(400);
echo json_encode(['status' => 'failed', 'reason' => 'missing public_slug parameter']);
return;
}
// Validate and sanitize limit parameter
$limit = intval($limit);
if ($limit <= 0) {
$limit = 10; // default
}
if ($limit > 50) {
$limit = 50; // maximum
}
$this->load->model('logbooks_model');
$this->load->model('logbook_model');
@ -920,6 +918,15 @@ class API extends CI_Controller {
$qso['name'] = $row->COL_NAME;
}
$dxcc = $this->logbook_model->check_dxcc_table(strtoupper(trim(strtoupper($row->COL_CALL))), $row->COL_TIME_ON);
if (empty($dxcc[0])) {
$dxcc_id = null;
} else {
$qso['country'] = $dxcc[1];
$qso['lat'] = $dxcc[4];
$qso['long'] = $dxcc[5];
}
$qsos[] = $qso;
}
@ -929,7 +936,6 @@ class API extends CI_Controller {
'count' => count($qsos),
'logbook_slug' => $public_slug
], JSON_PRETTY_PRINT);
} else {
http_response_code(404);
echo json_encode(['status' => 'failed', 'reason' => $public_slug . ' has no associated station locations']);

查看文件

@ -1,4 +1,3 @@
<<<<<<< HEAD
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

查看文件

@ -1932,6 +1932,8 @@ class Logbook_model extends CI_Model
function get_last_qsos($num, $StationLocationsArray = null)
{
// Ensure $num is always an integer to prevent SQL injection
$num = intval($num);
if ($StationLocationsArray == null) {
$CI = &get_instance();
@ -1949,7 +1951,7 @@ class Logbook_model extends CI_Model
order by col_time_on desc, col_primary_key desc
limit " . $num .
") hrd
JOIN station_profile ON station_profile.station_id = hrd.station_id
LEFT JOIN station_profile ON station_profile.station_id = hrd.station_id
LEFT JOIN dxcc_entities ON hrd.col_dxcc = dxcc_entities.adif
order by col_time_on desc, col_primary_key desc";
@ -4091,7 +4093,7 @@ class Logbook_model extends CI_Model
$csadditions = '/^P$|^R$|^A$|^M$/';
$dxcc_exceptions = $this->db->select('`entity`, `adif`, `cqz`, `cont`')
$dxcc_exceptions = $this->db->select('`entity`, `adif`, `cqz`, `cont`,`lat`,`long`')
->where('call', $call)
->where('(start <= ', $date)
->or_where('start is null)', NULL, false)
@ -4101,7 +4103,7 @@ class Logbook_model extends CI_Model
if ($dxcc_exceptions->num_rows() > 0) {
$row = $dxcc_exceptions->row_array();
return array($row['adif'], $row['entity'], $row['cqz'], $row['cont']);
return array($row['adif'], $row['entity'], $row['cqz'], $row['cont'], $row['lat'], $row['long']);
}
if (preg_match('/(^KG4)[A-Z09]{3}/', $call)) { // KG4/ and KG4 5 char calls are Guantanamo Bay. If 4 or 6 char, it is USA
$call = "K";
@ -4156,7 +4158,7 @@ class Logbook_model extends CI_Model
// query the table, removing a character from the right until a match
for ($i = $len; $i > 0; $i--) {
//printf("searching for %s\n", substr($call, 0, $i));
$dxcc_result = $this->db->select('`call`, `entity`, `adif`, `cqz`, `cont`')
$dxcc_result = $this->db->select('`call`, `entity`, `adif`, `cqz`, `cont`,`lat`,`long`')
->where('call', substr($call, 0, $i))
->where('(start <= ', $date)
->or_where("start is null)", NULL, false)
@ -4169,7 +4171,7 @@ class Logbook_model extends CI_Model
if ($dxcc_result->num_rows() > 0) {
$row = $dxcc_result->row_array();
return array($row['adif'], $row['entity'], $row['cqz'], $row['cont']);
return array($row['adif'], $row['entity'], $row['cqz'], $row['cont'], $row['lat'], $row['long']);
}
}

查看文件

@ -34,6 +34,9 @@ function frequencyToBand(frequency) {
else if(result >= 50000000 && result <= 56000000) {
return '6m';
}
else if(result >= 70000000 && result <= 72000000) {
return '4m';
}
else if(result >= 144000000 && result <= 148000000) {
return '2m';
}

查看文件

@ -200,6 +200,9 @@ case 'finnish':
case 'russian':
$config['language'] = $lang;
break;
case 'portuguese':
$config['language'] = $lang;
break;
case 'english':
$config['language'] = $lang;
break;