Skip to content
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/application/config/database.php
/application/config/config.php
/application/config/managed.php
/application/config/managed.sample.php
/application/logs/*.php
/uploads/*.adi
/uploads/*.ADI
Expand Down
2 changes: 1 addition & 1 deletion application/config/migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
|
*/

$config['migration_version'] = 236;
$config['migration_version'] = 238;

/*
|--------------------------------------------------------------------------
Expand Down
61 changes: 61 additions & 0 deletions application/controllers/Award.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/*
Handles Displaying of award preference information
*/

class Award extends CI_Controller {

function __construct()
{
parent::__construct();
$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'); }
}

public function index()
{
$this->load->model('awards_model');

$data['user_awards'] = $this->awards_model->get_user_awards();

// Render Page
$data['page_title'] = "Award Settings";
$this->load->view('interface_assets/header', $data);
$this->load->view('awards/settings');
$this->load->view('interface_assets/footer');
}

public function saveAward() {
// Get the award type and value from POST
$award_type = $this->security->xss_clean($this->input->post('award_type'));
$award_value = $this->security->xss_clean($this->input->post('award_value'));

$this->load->model('awards_model');
$result = $this->awards_model->save_single_award($award_type, $award_value);

header('Content-Type: application/json');
echo json_encode(array('message' => 'OK'));
return;
}

public function activateall() {
$this->load->model('awards_model');
$this->awards_model->activateall();

header('Content-Type: application/json');
echo json_encode(array('message' => 'OK'));
return;
}

public function deactivateall() {
$this->load->model('awards_model');
$this->awards_model->deactivateall();

header('Content-Type: application/json');
echo json_encode(array('message' => 'OK'));
return;
}
}
46 changes: 46 additions & 0 deletions application/controllers/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ function __construct()

$this->load->model('user_model');
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }

// Note: Managed deployments may hide specific subsections (e.g. registration)
// but should still allow access to the Options area in general.

// Load language files
$this->lang->load(array(
Expand Down Expand Up @@ -59,6 +62,43 @@ function appearance() {
$this->load->view('interface_assets/footer');
}

// Registration options
function registration() {

$data['page_title'] = $this->lang->line('options_cloudlog_options');
$data['sub_heading'] = $this->lang->line('options_registration');

// If open registration is managed-disabled, keep page hidden
if ($this->config->item('disable_open_registration')) {
$this->session->set_flashdata('notice', 'This setting is managed and cannot be changed.');
redirect('options');
}

$this->load->view('interface_assets/header', $data);
$this->load->view('options/registration');
$this->load->view('interface_assets/footer');
}

function registration_save() {
$data['page_title'] = $this->lang->line('options_cloudlog_options');
$data['sub_heading'] = $this->lang->line('options_registration');

if ($this->config->item('disable_open_registration')) {
$this->session->set_flashdata('notice', 'This setting is managed and cannot be changed.');
redirect('/options');
return;
}

// Save the open registration option
$open_registration = $this->input->post('open_registration');
$update = $this->optionslib->update('open_registration', $open_registration, 'yes');
if ($update == TRUE) {
$this->session->set_flashdata('success', $this->lang->line('options_registration_settings_saved'));
}

redirect('/options/registration');
}

// Handles saving the appreance options to the options system.
function appearance_save() {

Expand Down Expand Up @@ -234,6 +274,7 @@ function email() {

$data['page_title'] = $this->lang->line('options_cloudlog_options');
$data['sub_heading'] = $this->lang->line('options_email');
$data['is_managed'] = ($this->config->item('managed_service') || $this->config->item('managed_email_protocol')) ? true : false;

$this->load->view('interface_assets/header', $data);
$this->load->view('options/email');
Expand All @@ -242,6 +283,11 @@ function email() {

// Handles saving the radio options to the options system.
function email_save() {
// Check if email is managed - if so, redirect with message
if ($this->config->item('managed_service') || $this->config->item('managed_email_protocol')) {
$this->session->set_flashdata('notice', 'Email settings are centrally managed and cannot be changed here.');
redirect('options');
}

// Get Language Options

Expand Down
8 changes: 1 addition & 7 deletions application/controllers/Qrz.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,7 @@ public function import_qrz() {

$this->load->model('logbook_model');

$customDate = $this->input->post('from');
if ($customDate != NULL) {
$qrz_last_date = date($customDate);
} else {
// Query the logbook to determine when the last LoTW confirmation was
$qrz_last_date = null;
}
// Download all QRZ data regardless of date selection
$this->download($this->session->userdata('user_id'),true);
} // end function

Expand Down
58 changes: 33 additions & 25 deletions application/controllers/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,10 @@ public function lotw_users() {
// Only truncate table AFTER we've validated the remote file
$this->db->query("TRUNCATE TABLE lotw_users");

$i = 0;
$i = 0; // raw rows read
$batch_count = 0;
$lotwdata = array();
// Use a map to deduplicate by callsign and keep the latest timestamp
$lotw_map = array();
$batch_size = 500; // Smaller batch size for better performance and memory usage

// Skip CSV header row
Expand All @@ -403,36 +404,42 @@ public function lotw_users() {
$callsign = strtoupper($data[0]);
// Validate callsign format (basic check)
if (preg_match('/^[A-Z0-9\/]+$/', $callsign)) {
$lotwdata[] = array(
'callsign' => $callsign,
'lastupload' => $data[1] . ' ' . $data[2]
);
$i++;

// Insert batch when we reach batch_size
if (count($lotwdata) >= $batch_size) {
if (!$this->db->insert_batch('lotw_users', $lotwdata)) {
echo "FAILED: Database error during batch insert";
log_message('error', 'Database error during LoTW batch insert');
fclose($handle);
return;
}
$batch_count++;
$lotwdata = array(); // Reset array
// Compose timestamp string and compare; keep the latest per callsign
$ts = $data[1] . ' ' . $data[2];
// If we haven't seen this callsign, or this row is newer, store it
if (!isset($lotw_map[$callsign]) || strtotime($ts) > strtotime($lotw_map[$callsign])) {
$lotw_map[$callsign] = $ts;
}
}
}
}
fclose($handle);

// Insert any remaining records in final batch
if (!empty($lotwdata)) {
if (!$this->db->insert_batch('lotw_users', $lotwdata)) {
echo "FAILED: Database error during final batch insert";
log_message('error', 'Database error during LoTW final batch insert');
return;
// Insert deduplicated records in batches
if (!empty($lotw_map)) {
$lotwdata = array();
foreach ($lotw_map as $cs => $lu) {
$lotwdata[] = array('callsign' => $cs, 'lastupload' => $lu);
if (count($lotwdata) >= $batch_size) {
if (!$this->db->insert_batch('lotw_users', $lotwdata)) {
echo "FAILED: Database error during batch insert";
log_message('error', 'Database error during LoTW batch insert while inserting deduped map');
return;
}
$batch_count++;
$lotwdata = array();
}
}
// Final batch
if (!empty($lotwdata)) {
if (!$this->db->insert_batch('lotw_users', $lotwdata)) {
echo "FAILED: Database error during final batch insert";
log_message('error', 'Database error during LoTW final batch insert while inserting deduped map');
return;
}
$batch_count++;
}
$batch_count++;
}

// Verify we actually imported data
Expand All @@ -454,7 +461,8 @@ public function lotw_users() {
$endtime = $mtime;
$totaltime = ($endtime - $starttime);
echo "This page was created in ".$totaltime." seconds <br />";
echo "Records inserted: " . $i . " <br/>";
echo "Records read: " . $i . " <br/>";
echo "Unique callsigns inserted: " . $final_count . " <br/>";
}

public function lotw_check() {
Expand Down
Loading