Skip to content

Commit d84977f

Browse files
authored
Tag 2.8.2
2 parents 047b651 + 3acfa64 commit d84977f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1680
-89
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/application/config/database.php
22
/application/config/config.php
3+
/application/config/managed.php
4+
/application/config/managed.sample.php
35
/application/logs/*.php
46
/uploads/*.adi
57
/uploads/*.ADI

application/config/migration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
|
2323
*/
2424

25-
$config['migration_version'] = 236;
25+
$config['migration_version'] = 238;
2626

2727
/*
2828
|--------------------------------------------------------------------------

application/controllers/Award.php

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2+
3+
/*
4+
Handles Displaying of award preference information
5+
*/
6+
7+
class Award extends CI_Controller {
8+
9+
function __construct()
10+
{
11+
parent::__construct();
12+
$this->load->helper(array('form', 'url'));
13+
14+
$this->load->model('user_model');
15+
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
16+
}
17+
18+
public function index()
19+
{
20+
$this->load->model('awards_model');
21+
22+
$data['user_awards'] = $this->awards_model->get_user_awards();
23+
24+
// Render Page
25+
$data['page_title'] = "Award Settings";
26+
$this->load->view('interface_assets/header', $data);
27+
$this->load->view('awards/settings');
28+
$this->load->view('interface_assets/footer');
29+
}
30+
31+
public function saveAward() {
32+
// Get the award type and value from POST
33+
$award_type = $this->security->xss_clean($this->input->post('award_type'));
34+
$award_value = $this->security->xss_clean($this->input->post('award_value'));
35+
36+
$this->load->model('awards_model');
37+
$result = $this->awards_model->save_single_award($award_type, $award_value);
38+
39+
header('Content-Type: application/json');
40+
echo json_encode(array('message' => 'OK'));
41+
return;
42+
}
43+
44+
public function activateall() {
45+
$this->load->model('awards_model');
46+
$this->awards_model->activateall();
47+
48+
header('Content-Type: application/json');
49+
echo json_encode(array('message' => 'OK'));
50+
return;
51+
}
52+
53+
public function deactivateall() {
54+
$this->load->model('awards_model');
55+
$this->awards_model->deactivateall();
56+
57+
header('Content-Type: application/json');
58+
echo json_encode(array('message' => 'OK'));
59+
return;
60+
}
61+
}

application/controllers/Options.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ function __construct()
1313

1414
$this->load->model('user_model');
1515
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
16+
17+
// Note: Managed deployments may hide specific subsections (e.g. registration)
18+
// but should still allow access to the Options area in general.
1619

1720
// Load language files
1821
$this->lang->load(array(
@@ -59,6 +62,43 @@ function appearance() {
5962
$this->load->view('interface_assets/footer');
6063
}
6164

65+
// Registration options
66+
function registration() {
67+
68+
$data['page_title'] = $this->lang->line('options_cloudlog_options');
69+
$data['sub_heading'] = $this->lang->line('options_registration');
70+
71+
// If open registration is managed-disabled, keep page hidden
72+
if ($this->config->item('disable_open_registration')) {
73+
$this->session->set_flashdata('notice', 'This setting is managed and cannot be changed.');
74+
redirect('options');
75+
}
76+
77+
$this->load->view('interface_assets/header', $data);
78+
$this->load->view('options/registration');
79+
$this->load->view('interface_assets/footer');
80+
}
81+
82+
function registration_save() {
83+
$data['page_title'] = $this->lang->line('options_cloudlog_options');
84+
$data['sub_heading'] = $this->lang->line('options_registration');
85+
86+
if ($this->config->item('disable_open_registration')) {
87+
$this->session->set_flashdata('notice', 'This setting is managed and cannot be changed.');
88+
redirect('/options');
89+
return;
90+
}
91+
92+
// Save the open registration option
93+
$open_registration = $this->input->post('open_registration');
94+
$update = $this->optionslib->update('open_registration', $open_registration, 'yes');
95+
if ($update == TRUE) {
96+
$this->session->set_flashdata('success', $this->lang->line('options_registration_settings_saved'));
97+
}
98+
99+
redirect('/options/registration');
100+
}
101+
62102
// Handles saving the appreance options to the options system.
63103
function appearance_save() {
64104

@@ -234,6 +274,7 @@ function email() {
234274

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

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

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

246292
// Get Language Options
247293

application/controllers/Qrz.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,7 @@ public function import_qrz() {
212212

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

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

application/controllers/Update.php

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,10 @@ public function lotw_users() {
389389
// Only truncate table AFTER we've validated the remote file
390390
$this->db->query("TRUNCATE TABLE lotw_users");
391391

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

397398
// Skip CSV header row
@@ -403,36 +404,42 @@ public function lotw_users() {
403404
$callsign = strtoupper($data[0]);
404405
// Validate callsign format (basic check)
405406
if (preg_match('/^[A-Z0-9\/]+$/', $callsign)) {
406-
$lotwdata[] = array(
407-
'callsign' => $callsign,
408-
'lastupload' => $data[1] . ' ' . $data[2]
409-
);
410407
$i++;
411-
412-
// Insert batch when we reach batch_size
413-
if (count($lotwdata) >= $batch_size) {
414-
if (!$this->db->insert_batch('lotw_users', $lotwdata)) {
415-
echo "FAILED: Database error during batch insert";
416-
log_message('error', 'Database error during LoTW batch insert');
417-
fclose($handle);
418-
return;
419-
}
420-
$batch_count++;
421-
$lotwdata = array(); // Reset array
408+
// Compose timestamp string and compare; keep the latest per callsign
409+
$ts = $data[1] . ' ' . $data[2];
410+
// If we haven't seen this callsign, or this row is newer, store it
411+
if (!isset($lotw_map[$callsign]) || strtotime($ts) > strtotime($lotw_map[$callsign])) {
412+
$lotw_map[$callsign] = $ts;
422413
}
423414
}
424415
}
425416
}
426417
fclose($handle);
427418

428-
// Insert any remaining records in final batch
429-
if (!empty($lotwdata)) {
430-
if (!$this->db->insert_batch('lotw_users', $lotwdata)) {
431-
echo "FAILED: Database error during final batch insert";
432-
log_message('error', 'Database error during LoTW final batch insert');
433-
return;
419+
// Insert deduplicated records in batches
420+
if (!empty($lotw_map)) {
421+
$lotwdata = array();
422+
foreach ($lotw_map as $cs => $lu) {
423+
$lotwdata[] = array('callsign' => $cs, 'lastupload' => $lu);
424+
if (count($lotwdata) >= $batch_size) {
425+
if (!$this->db->insert_batch('lotw_users', $lotwdata)) {
426+
echo "FAILED: Database error during batch insert";
427+
log_message('error', 'Database error during LoTW batch insert while inserting deduped map');
428+
return;
429+
}
430+
$batch_count++;
431+
$lotwdata = array();
432+
}
433+
}
434+
// Final batch
435+
if (!empty($lotwdata)) {
436+
if (!$this->db->insert_batch('lotw_users', $lotwdata)) {
437+
echo "FAILED: Database error during final batch insert";
438+
log_message('error', 'Database error during LoTW final batch insert while inserting deduped map');
439+
return;
440+
}
441+
$batch_count++;
434442
}
435-
$batch_count++;
436443
}
437444

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

460468
public function lotw_check() {

0 commit comments

Comments
 (0)