Skip to content

Commit

Permalink
Merge pull request #1758 from magicbug/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
magicbug authored Nov 9, 2022
2 parents d73d000 + 147b757 commit a364734
Show file tree
Hide file tree
Showing 90 changed files with 58,136 additions and 249 deletions.
16 changes: 0 additions & 16 deletions application/config/cloudlog.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,3 @@
*/

$config['map_6digit_grids'] = FALSE;


/*
|--------------------------------------------------------------------------
| Automatically populate the QTH
|--------------------------------------------------------------------------
|
| Setting this to TRUE allows the QTH locator to be pre-filled
| based on the person's location when creating new QSO.
| OSM's Nominatim API is being used for that purpose
|
| Default is: FALSE
|
*/

$config['qso_auto_qth'] = FALSE;
2 changes: 1 addition & 1 deletion application/config/migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 102;
$config['migration_version'] = 105;

/*
|--------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions application/controllers/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ public function index()
$QSLStatsBreakdownArray =$this->logbook_model->get_QSLStats($logbooks_locations_array);

$data['total_qsl_sent'] = $QSLStatsBreakdownArray['QSL_Sent'];
$data['total_qsl_recv'] = $QSLStatsBreakdownArray['QSL_Received'];
$data['total_qsl_rcvd'] = $QSLStatsBreakdownArray['QSL_Received'];
$data['total_qsl_requested'] = $QSLStatsBreakdownArray['QSL_Requested'];

$data['total_eqsl_sent'] = $QSLStatsBreakdownArray['eQSL_Sent'];
$data['total_eqsl_recv'] = $QSLStatsBreakdownArray['eQSL_Received'];
$data['total_eqsl_rcvd'] = $QSLStatsBreakdownArray['eQSL_Received'];

$data['total_lotw_sent'] = $QSLStatsBreakdownArray['LoTW_Sent'];
$data['total_lotw_recv'] = $QSLStatsBreakdownArray['LoTW_Received'];
$data['total_lotw_rcvd'] = $QSLStatsBreakdownArray['LoTW_Received'];

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

Expand Down
52 changes: 52 additions & 0 deletions application/controllers/Gridsquares.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,58 @@ public function band($band)

}
}
$query_vucc = $this->gridsquares_model->get_band_worked_vucc_squares($band);

if ($query && $query_vucc->num_rows() > 0)
{
foreach ($query_vucc->result() as $row)
{

$grids = explode(",", $row->COL_VUCC_GRIDS);

foreach($grids as $key) {
$grid_two = strtoupper(substr($key,0,2));
$grid_four = strtoupper(substr($key,0,4));

// Check if 2 Char is in array
if(!in_array($grid_two, $array_grid_2char)){
array_push($array_grid_2char, $grid_two);
}


if(!in_array($grid_four, $array_grid_4char)){
array_push($array_grid_4char, $grid_four);
}
}
}
}

// Confirmed Squares
$query_vucc = $this->gridsquares_model->get_band_confirmed_vucc_squares($band);

if ($query && $query_vucc->num_rows() > 0)
{
foreach ($query_vucc->result() as $row)
{

$grids = explode(",", $row->COL_VUCC_GRIDS);

foreach($grids as $key) {
$grid_2char_confirmed = strtoupper(substr($key,0,2));
$grid_4char_confirmed = strtoupper(substr($key,0,4));

// Check if 2 Char is in array
if(!in_array($grid_2char_confirmed, $array_grid_2char_confirmed)){
array_push($array_grid_2char_confirmed, $grid_2char_confirmed);
}


if(!in_array($grid_4char_confirmed, $array_grid_4char_confirmed)){
array_push($array_grid_4char_confirmed, $grid_4char_confirmed);
}
}
}
}

function js_str($s)
{
Expand Down
156 changes: 120 additions & 36 deletions application/controllers/Logbook.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,13 @@ function index()
if($this->session->userdata('user_locator')) {
$this->load->library('qra');
$qra_position = $this->qra->qra2latlong($this->session->userdata('user_locator'));
$data['qra'] = "set";
$data['qra_lat'] = $qra_position[0];
$data['qra_lng'] = $qra_position[1];
if (isset($qra_position[0]) and isset($qra_position[1])) {
$data['qra'] = "set";
$data['qra_lat'] = $qra_position[0];
$data['qra_lng'] = $qra_position[1];
} else {
$data['qra'] = "none";
}
} else {
$data['qra'] = "none";
}
Expand Down Expand Up @@ -638,13 +642,65 @@ function partial($id) {
}
}

function search_result($id="") {
function search_result($id="", $id2="") {
$this->load->model('user_model');

if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }

$fixedid = $id;

if ($id2 != "") {
$fixedid = $id . '/' . $id2;
}

$query = $this->querydb($fixedid);

if ($query->num_rows() == 0) {
$query = $this->querydb($id);

if ($query->num_rows() > 0) {
$data['results'] = $query;
$this->load->view('view_log/partial/log_ajax.php', $data);
}
else {
$this->load->model('search');

$iota_search = $this->search->callsign_iota($id);

if ($iota_search->num_rows() > 0)
{
$data['results'] = $iota_search;
$this->load->view('view_log/partial/log_ajax.php', $data);
} else {
if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null) {
// Lookup using QRZ
$this->load->library('qrz');

//$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.*');
if(!$this->session->userdata('qrz_session_key')) {
$qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password'));
$this->session->set_userdata('qrz_session_key', $qrz_session_key);
}

$data['callsign'] = $this->qrz->search($id, $this->session->userdata('qrz_session_key'), $this->config->item('use_fullname'));
} /*else {
// Lookup using hamli
$this->load->library('hamli');
$data['callsign'] = $this->hamli->callsign($id);
}*/

$data['id'] = strtoupper($id);

$this->load->view('search/result', $data);
}
}
} else {
$data['results'] = $query;
$this->load->view('view_log/partial/log_ajax.php', $data);
}
}

function querydb($id) {
$this->db->from($this->config->item('table_name'));
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
$this->db->group_start();
Expand All @@ -654,47 +710,75 @@ function search_result($id="") {
$this->db->group_end();
$this->db->where('station_profile.user_id', $this->session->userdata('user_id'));
$this->db->order_by(''.$this->config->item('table_name').'.COL_TIME_ON', 'desc');
$query = $this->db->get();
return $this->db->get();
}

if ($query->num_rows() > 0)
{
$data['results'] = $query;
$this->load->view('view_log/partial/log_ajax.php', $data);
} else {
$this->load->model('search');
function search_duplicates($station_id) {
$station_id = $this->security->xss_clean($station_id);

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

if ($iota_search->num_rows() > 0)
{
$data['results'] = $iota_search;
$this->load->view('view_log/partial/log_ajax.php', $data);
} else {
if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null) {
// Lookup using QRZ
$this->load->library('qrz');
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }

$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));

if (!$logbooks_locations_array) {
return null;
}

if(!$this->session->userdata('qrz_session_key')) {
$qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password'));
$this->session->set_userdata('qrz_session_key', $qrz_session_key);
}
$location_list = "'".implode("','",$logbooks_locations_array)."'";

$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') .
' 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 . ')';

if ($station_id != 'All') {
$sql .= ' and station_profile.station_id = ' . $station_id;
}

$sql .= ' group by col_call, col_mode, COL_SUBMODE, STATION_CALLSIGN, col_band, COL_SAT_NAME having count(*) > 1 and timediff(maxtime, mintime) < 3000';

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

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

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

$this->load->view('search/result', $data);
}
}
}

function search_incorrect_cq_zones($station_id) {
$station_id = $this->security->xss_clean($station_id);

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

if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }

$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));

if (!$logbooks_locations_array) {
return null;
}

$location_list = "'".implode("','",$logbooks_locations_array)."'";

$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') .
' thcv join station_profile on thcv.station_id = station_profile.station_id where thcv.station_id in ('. $location_list . ')
and not exists (select 1 from dxcc_master where countrycode = thcv.col_dxcc and cqzone = col_cqz) and col_dxcc > 0
';

if ($station_id != 'All') {
$sql .= ' and station_profile.station_id = ' . $station_id;
}

$query = $this->db->query($sql);

$data['qsos'] = $query;

$this->load->view('search/cqzones_result.php', $data);
}

/*
* Provide a dxcc search, returning results json encoded
Expand Down
21 changes: 15 additions & 6 deletions application/controllers/Qso.php
Original file line number Diff line number Diff line change
Expand Up @@ -436,14 +436,23 @@ public function get_county() {
echo json_encode($json);
}

public function get_sota_info() {
$this->load->library('sota');
public function get_sota_info() {
$this->load->library('sota');

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

header('Content-Type: application/json');
echo $this->sota->info($sota);
}
header('Content-Type: application/json');
echo $this->sota->info($sota);
}

public function get_wwff_info() {
$this->load->library('wwff');

$wwff = xss_clean($this->input->post('wwff'));

header('Content-Type: application/json');
echo $this->wwff->info($wwff);
}

function check_locator($grid) {
$grid = $this->input->post('locator');
Expand Down
24 changes: 24 additions & 0 deletions application/controllers/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,30 @@ public function filter() {
}
}

// Searches for duplicate QSOs within 30m of time difference
public function duplicates() {
$this->load->model('stations');

$data['station_profile'] = $this->stations->all_of_user();
$data['page_title'] = "Duplicate QSOs within 30m time difference";

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

// Searches for incorrect CQ Zones
public function incorrect_cq_zones() {
$this->load->model('stations');

$data['station_profile'] = $this->stations->all_of_user();
$data['page_title'] = "Incorrectly logged CQ zones";

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

function json_result() {
if(isset($_POST['search'])) {
$result = $this->fetchQueryResult($_POST['search'], false);
Expand Down
Loading

0 comments on commit a364734

Please sign in to comment.