Skip to content

Commit a364734

Browse files
authored
Merge pull request #1758 from magicbug/dev
2 parents d73d000 + 147b757 commit a364734

File tree

90 files changed

+58136
-249
lines changed

Some content is hidden

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

90 files changed

+58136
-249
lines changed

application/config/cloudlog.php

-16
Original file line numberDiff line numberDiff line change
@@ -110,19 +110,3 @@
110110
*/
111111

112112
$config['map_6digit_grids'] = FALSE;
113-
114-
115-
/*
116-
|--------------------------------------------------------------------------
117-
| Automatically populate the QTH
118-
|--------------------------------------------------------------------------
119-
|
120-
| Setting this to TRUE allows the QTH locator to be pre-filled
121-
| based on the person's location when creating new QSO.
122-
| OSM's Nominatim API is being used for that purpose
123-
|
124-
| Default is: FALSE
125-
|
126-
*/
127-
128-
$config['qso_auto_qth'] = FALSE;

application/config/migration.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
| be upgraded / downgraded to.
2222
|
2323
*/
24-
$config['migration_version'] = 102;
24+
$config['migration_version'] = 105;
2525

2626
/*
2727
|--------------------------------------------------------------------------

application/controllers/Dashboard.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ public function index()
7979
$QSLStatsBreakdownArray =$this->logbook_model->get_QSLStats($logbooks_locations_array);
8080

8181
$data['total_qsl_sent'] = $QSLStatsBreakdownArray['QSL_Sent'];
82-
$data['total_qsl_recv'] = $QSLStatsBreakdownArray['QSL_Received'];
82+
$data['total_qsl_rcvd'] = $QSLStatsBreakdownArray['QSL_Received'];
8383
$data['total_qsl_requested'] = $QSLStatsBreakdownArray['QSL_Requested'];
8484

8585
$data['total_eqsl_sent'] = $QSLStatsBreakdownArray['eQSL_Sent'];
86-
$data['total_eqsl_recv'] = $QSLStatsBreakdownArray['eQSL_Received'];
86+
$data['total_eqsl_rcvd'] = $QSLStatsBreakdownArray['eQSL_Received'];
8787

8888
$data['total_lotw_sent'] = $QSLStatsBreakdownArray['LoTW_Sent'];
89-
$data['total_lotw_recv'] = $QSLStatsBreakdownArray['LoTW_Received'];
89+
$data['total_lotw_rcvd'] = $QSLStatsBreakdownArray['LoTW_Received'];
9090

9191
$data['last_five_qsos'] = $this->logbook_model->get_last_qsos('18', $logbooks_locations_array);
9292

application/controllers/Gridsquares.php

+52
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,58 @@ public function band($band)
295295

296296
}
297297
}
298+
$query_vucc = $this->gridsquares_model->get_band_worked_vucc_squares($band);
299+
300+
if ($query && $query_vucc->num_rows() > 0)
301+
{
302+
foreach ($query_vucc->result() as $row)
303+
{
304+
305+
$grids = explode(",", $row->COL_VUCC_GRIDS);
306+
307+
foreach($grids as $key) {
308+
$grid_two = strtoupper(substr($key,0,2));
309+
$grid_four = strtoupper(substr($key,0,4));
310+
311+
// Check if 2 Char is in array
312+
if(!in_array($grid_two, $array_grid_2char)){
313+
array_push($array_grid_2char, $grid_two);
314+
}
315+
316+
317+
if(!in_array($grid_four, $array_grid_4char)){
318+
array_push($array_grid_4char, $grid_four);
319+
}
320+
}
321+
}
322+
}
323+
324+
// Confirmed Squares
325+
$query_vucc = $this->gridsquares_model->get_band_confirmed_vucc_squares($band);
326+
327+
if ($query && $query_vucc->num_rows() > 0)
328+
{
329+
foreach ($query_vucc->result() as $row)
330+
{
331+
332+
$grids = explode(",", $row->COL_VUCC_GRIDS);
333+
334+
foreach($grids as $key) {
335+
$grid_2char_confirmed = strtoupper(substr($key,0,2));
336+
$grid_4char_confirmed = strtoupper(substr($key,0,4));
337+
338+
// Check if 2 Char is in array
339+
if(!in_array($grid_2char_confirmed, $array_grid_2char_confirmed)){
340+
array_push($array_grid_2char_confirmed, $grid_2char_confirmed);
341+
}
342+
343+
344+
if(!in_array($grid_4char_confirmed, $array_grid_4char_confirmed)){
345+
array_push($array_grid_4char_confirmed, $grid_4char_confirmed);
346+
}
347+
}
348+
}
349+
}
298350

299351
function js_str($s)
300352
{

application/controllers/Logbook.php

100755100644
+120-36
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,13 @@ function index()
5858
if($this->session->userdata('user_locator')) {
5959
$this->load->library('qra');
6060
$qra_position = $this->qra->qra2latlong($this->session->userdata('user_locator'));
61-
$data['qra'] = "set";
62-
$data['qra_lat'] = $qra_position[0];
63-
$data['qra_lng'] = $qra_position[1];
61+
if (isset($qra_position[0]) and isset($qra_position[1])) {
62+
$data['qra'] = "set";
63+
$data['qra_lat'] = $qra_position[0];
64+
$data['qra_lng'] = $qra_position[1];
65+
} else {
66+
$data['qra'] = "none";
67+
}
6468
} else {
6569
$data['qra'] = "none";
6670
}
@@ -638,13 +642,65 @@ function partial($id) {
638642
}
639643
}
640644

641-
function search_result($id="") {
645+
function search_result($id="", $id2="") {
642646
$this->load->model('user_model');
643-
647+
644648
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
649+
650+
$fixedid = $id;
651+
652+
if ($id2 != "") {
653+
$fixedid = $id . '/' . $id2;
654+
}
655+
656+
$query = $this->querydb($fixedid);
657+
658+
if ($query->num_rows() == 0) {
659+
$query = $this->querydb($id);
660+
661+
if ($query->num_rows() > 0) {
662+
$data['results'] = $query;
663+
$this->load->view('view_log/partial/log_ajax.php', $data);
664+
}
665+
else {
666+
$this->load->model('search');
667+
668+
$iota_search = $this->search->callsign_iota($id);
669+
670+
if ($iota_search->num_rows() > 0)
671+
{
672+
$data['results'] = $iota_search;
673+
$this->load->view('view_log/partial/log_ajax.php', $data);
674+
} else {
675+
if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null) {
676+
// Lookup using QRZ
677+
$this->load->library('qrz');
645678

646-
//$this->db->select(''.$this->config->item('table_name').'.COL_CALL, '.$this->config->item('table_name').'.COL_BAND, '.$this->config->item('table_name').'.COL_TIME_ON, '.$this->config->item('table_name').'.COL_RST_RCVD, '.$this->config->item('table_name').'.COL_RST_SENT, '.$this->config->item('table_name').'.COL_MODE, '.$this->config->item('table_name').'.COL_SUBMODE, '.$this->config->item('table_name').'.COL_NAME, '.$this->config->item('table_name').'.COL_COUNTRY, '.$this->config->item('table_name').'.COL_PRIMARY_KEY, '.$this->config->item('table_name').'.COL_SAT_NAME, '.$this->config->item('table_name').'.COL_GRIDSQUARE, '.$this->config->item('table_name').'.COL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_SENT, '.$this->config->item('table_name').'.COL_QSL_SENT, '.$this->config->item('table_name').'.COL_STX, '.$this->config->item('table_name').'.COL_STX_STRING, '.$this->config->item('table_name').'.COL_SRX, '.$this->config->item('table_name').'.COL_SRX_STRING, '.$this->config->item('table_name').'.COL_LOTW_QSL_SENT, '.$this->config->item('table_name').'.COL_LOTW_QSL_RCVD, '.$this->config->item('table_name').'.COL_VUCC_GRIDS, station_profile.*');
679+
if(!$this->session->userdata('qrz_session_key')) {
680+
$qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password'));
681+
$this->session->set_userdata('qrz_session_key', $qrz_session_key);
682+
}
647683

684+
$data['callsign'] = $this->qrz->search($id, $this->session->userdata('qrz_session_key'), $this->config->item('use_fullname'));
685+
} /*else {
686+
// Lookup using hamli
687+
$this->load->library('hamli');
688+
689+
$data['callsign'] = $this->hamli->callsign($id);
690+
}*/
691+
692+
$data['id'] = strtoupper($id);
693+
694+
$this->load->view('search/result', $data);
695+
}
696+
}
697+
} else {
698+
$data['results'] = $query;
699+
$this->load->view('view_log/partial/log_ajax.php', $data);
700+
}
701+
}
702+
703+
function querydb($id) {
648704
$this->db->from($this->config->item('table_name'));
649705
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
650706
$this->db->group_start();
@@ -654,47 +710,75 @@ function search_result($id="") {
654710
$this->db->group_end();
655711
$this->db->where('station_profile.user_id', $this->session->userdata('user_id'));
656712
$this->db->order_by(''.$this->config->item('table_name').'.COL_TIME_ON', 'desc');
657-
$query = $this->db->get();
713+
return $this->db->get();
714+
}
658715

659-
if ($query->num_rows() > 0)
660-
{
661-
$data['results'] = $query;
662-
$this->load->view('view_log/partial/log_ajax.php', $data);
663-
} else {
664-
$this->load->model('search');
716+
function search_duplicates($station_id) {
717+
$station_id = $this->security->xss_clean($station_id);
665718

666-
$iota_search = $this->search->callsign_iota($id);
719+
$this->load->model('user_model');
667720

668-
if ($iota_search->num_rows() > 0)
669-
{
670-
$data['results'] = $iota_search;
671-
$this->load->view('view_log/partial/log_ajax.php', $data);
672-
} else {
673-
if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null) {
674-
// Lookup using QRZ
675-
$this->load->library('qrz');
721+
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
722+
723+
$CI =& get_instance();
724+
$CI->load->model('logbooks_model');
725+
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
726+
727+
if (!$logbooks_locations_array) {
728+
return null;
729+
}
676730

677-
if(!$this->session->userdata('qrz_session_key')) {
678-
$qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password'));
679-
$this->session->set_userdata('qrz_session_key', $qrz_session_key);
680-
}
731+
$location_list = "'".implode("','",$logbooks_locations_array)."'";
732+
733+
$sql = 'select count(*) as occurence, COL_CALL, COL_MODE, COL_SUBMODE, station_callsign, COL_SAT_NAME, COL_BAND, min(col_time_on) Mintime, max(col_time_on) Maxtime from ' . $this->config->item('table_name') .
734+
' join station_profile on ' . $this->config->item('table_name') . '.station_id = station_profile.station_id where ' . $this->config->item('table_name') .'.station_id in ('. $location_list . ')';
735+
736+
if ($station_id != 'All') {
737+
$sql .= ' and station_profile.station_id = ' . $station_id;
738+
}
739+
740+
$sql .= ' group by col_call, col_mode, COL_SUBMODE, STATION_CALLSIGN, col_band, COL_SAT_NAME having count(*) > 1 and timediff(maxtime, mintime) < 3000';
681741

682-
$data['callsign'] = $this->qrz->search($id, $this->session->userdata('qrz_session_key'), $this->config->item('use_fullname'));
683-
} /*else {
684-
// Lookup using hamli
685-
$this->load->library('hamli');
742+
$query = $this->db->query($sql);
686743

687-
$data['callsign'] = $this->hamli->callsign($id);
688-
}*/
744+
$data['qsos'] = $query;
689745

690-
$data['id'] = strtoupper($id);
746+
$this->load->view('search/duplicates_result.php', $data);
691747

692-
$this->load->view('search/result', $data);
693-
}
694-
}
695748
}
696749

750+
function search_incorrect_cq_zones($station_id) {
751+
$station_id = $this->security->xss_clean($station_id);
697752

753+
$this->load->model('user_model');
754+
755+
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
756+
757+
$CI =& get_instance();
758+
$CI->load->model('logbooks_model');
759+
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
760+
761+
if (!$logbooks_locations_array) {
762+
return null;
763+
}
764+
765+
$location_list = "'".implode("','",$logbooks_locations_array)."'";
766+
767+
$sql = 'select *, (select group_concat(distinct cqzone order by cqzone) from dxcc_master where countrycode = thcv.col_dxcc and cqzone <> \'\' order by cqzone asc) as correctcqzone from ' . $this->config->item('table_name') .
768+
' thcv join station_profile on thcv.station_id = station_profile.station_id where thcv.station_id in ('. $location_list . ')
769+
and not exists (select 1 from dxcc_master where countrycode = thcv.col_dxcc and cqzone = col_cqz) and col_dxcc > 0
770+
';
771+
772+
if ($station_id != 'All') {
773+
$sql .= ' and station_profile.station_id = ' . $station_id;
774+
}
775+
776+
$query = $this->db->query($sql);
777+
778+
$data['qsos'] = $query;
779+
780+
$this->load->view('search/cqzones_result.php', $data);
781+
}
698782

699783
/*
700784
* Provide a dxcc search, returning results json encoded

application/controllers/Qso.php

+15-6
Original file line numberDiff line numberDiff line change
@@ -436,14 +436,23 @@ public function get_county() {
436436
echo json_encode($json);
437437
}
438438

439-
public function get_sota_info() {
440-
$this->load->library('sota');
439+
public function get_sota_info() {
440+
$this->load->library('sota');
441441

442-
$sota = xss_clean($this->input->post('sota'));
442+
$sota = xss_clean($this->input->post('sota'));
443443

444-
header('Content-Type: application/json');
445-
echo $this->sota->info($sota);
446-
}
444+
header('Content-Type: application/json');
445+
echo $this->sota->info($sota);
446+
}
447+
448+
public function get_wwff_info() {
449+
$this->load->library('wwff');
450+
451+
$wwff = xss_clean($this->input->post('wwff'));
452+
453+
header('Content-Type: application/json');
454+
echo $this->wwff->info($wwff);
455+
}
447456

448457
function check_locator($grid) {
449458
$grid = $this->input->post('locator');

application/controllers/Search.php

+24
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,30 @@ public function filter() {
5656
}
5757
}
5858

59+
// Searches for duplicate QSOs within 30m of time difference
60+
public function duplicates() {
61+
$this->load->model('stations');
62+
63+
$data['station_profile'] = $this->stations->all_of_user();
64+
$data['page_title'] = "Duplicate QSOs within 30m time difference";
65+
66+
$this->load->view('interface_assets/header', $data);
67+
$this->load->view('search/duplicates');
68+
$this->load->view('interface_assets/footer');
69+
}
70+
71+
// Searches for incorrect CQ Zones
72+
public function incorrect_cq_zones() {
73+
$this->load->model('stations');
74+
75+
$data['station_profile'] = $this->stations->all_of_user();
76+
$data['page_title'] = "Incorrectly logged CQ zones";
77+
78+
$this->load->view('interface_assets/header', $data);
79+
$this->load->view('search/cqzones');
80+
$this->load->view('interface_assets/footer');
81+
}
82+
5983
function json_result() {
6084
if(isset($_POST['search'])) {
6185
$result = $this->fetchQueryResult($_POST['search'], false);

0 commit comments

Comments
 (0)