Skip to content

Commit ff3738e

Browse files
authored
Merge pull request #2711 from magicbug/dev
2.5.2
2 parents c0c2998 + fb23301 commit ff3738e

16 files changed

Lines changed: 159 additions & 67 deletions

File tree

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'] = 152;
25+
$config['migration_version'] = 153;
2626

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

application/controllers/Components.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ function __construct() {
1414
}
1515

1616
public function index() {
17+
$this->load->model('stations');
1718
$url = 'https://oscarwatch.org/scripts/hamsat_json.php';
1819
$json = file_get_contents($url);
1920
$data['rovedata'] = json_decode($json, true);
21+
$data['gridsquare'] = strtoupper($this->stations->find_gridsquare());
2022

2123
// load view
2224
$this->load->view('components/hamsat/table', $data);
2325
}
24-
}
26+
}

application/controllers/Debug.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ private function is_really_writable($folder)
5252
// Check if the subdirectories are writable (recursive check)
5353
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));
5454
foreach ($iterator as $item) {
55-
if (!is_writable($item->getPathname())) {
56-
return false;
57-
}
55+
if ($item->isDir() && basename($item->getPathName()) != '..') {
56+
if (!is_writable($item->getRealPath())) {
57+
return false;
58+
}
59+
}
5860
}
5961

6062
return true;

application/controllers/Logbook.php

Lines changed: 72 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ function json($tempcallsign, $temptype, $tempband, $tempmode, $tempstation_id =
168168
$return['confirmed'] = $this->confirmed_grid_before($return['callsign_qra'], $type, $band, $mode);
169169

170170
if ($this->session->userdata('user_show_profile_image')) {
171-
if (isset($callbook)) {
171+
if (isset($callbook) && isset($callbook['image'])) {
172172
if ($callbook['image'] == "") {
173173
$return['image'] = "n/a";
174174
} else {
@@ -851,27 +851,61 @@ function partial($id) {
851851
$qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password'));
852852
$this->session->set_userdata('qrz_session_key', $qrz_session_key);
853853
}
854-
$data= $this->qrz->search($id, $this->session->userdata('qrz_session_key'), $this->config->item('use_fullname'));
855-
856-
if (empty($data['callsign']))
857-
{
858-
$qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password'));
859-
$this->session->set_userdata('qrz_session_key', $qrz_session_key);
860-
$data = $this->qrz->search($id, $this->session->userdata('qrz_session_key'), $this->config->item('use_fullname'));
861-
}
854+
$callsign['callsign'] = $this->qrz->search($id, $this->session->userdata('qrz_session_key'), $this->config->item('use_fullname'));
855+
856+
if (empty($callsign['callsign']['callsign'])) {
857+
$qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password'));
858+
$this->session->set_userdata('qrz_session_key', $qrz_session_key);
859+
$callsign['callsign'] = $this->qrz->search($id, $this->session->userdata('qrz_session_key'), $this->config->item('use_fullname'));
860+
}
861+
} else if ($this->config->item('callbook') == "hamqth" && $this->config->item('hamqth_username') != null && $this->config->item('hamqth_password') != null) {
862+
// Load the HamQTH library
863+
$this->load->library('hamqth');
864+
865+
if(!$this->session->userdata('hamqth_session_key')) {
866+
$hamqth_session_key = $this->hamqth->session($this->config->item('hamqth_username'), $this->config->item('hamqth_password'));
867+
$this->session->set_userdata('hamqth_session_key', $hamqth_session_key);
868+
}
869+
870+
$callsign['callsign'] = $this->hamqth->search($id, $this->session->userdata('hamqth_session_key'));
871+
872+
// If HamQTH session has expired, start a new session and retry the search.
873+
if($callsign['callsign']['error'] == "Session does not exist or expired") {
874+
$hamqth_session_key = $this->hamqth->session($this->config->item('hamqth_username'), $this->config->item('hamqth_password'));
875+
$this->session->set_userdata('hamqth_session_key', $hamqth_session_key);
876+
$callsign['callsign'] = $this->hamqth->search($callsign, $this->session->userdata('hamqth_session_key'));
877+
}
878+
if (isset($data['callsign']['gridsquare'])) {
879+
$CI = &get_instance();
880+
$CI->load->model('logbook_model');
881+
$callsign['grid_worked'] = $CI->logbook_model->check_if_grid_worked_in_logbook(strtoupper(substr($data['callsign']['gridsquare'],0,4)), 0, $this->session->userdata('user_default_band'));
882+
}
883+
if (isset($callsign['callsign']['error'])) {
884+
$callsign['error'] = $callsign['callsign']['error'];
885+
}
886+
} else {
887+
$callsign['error'] = 'Lookup not configured. Please review configuration.';
862888
}
863889

864890
// There's no hamli integration? Disabled for now.
865891
/*else {
866892
// Lookup using hamli
867893
$this->load->library('hamli');
868894
869-
$data['callsign'] = $this->hamli->callsign($id);
895+
$callsign['callsign'] = $this->hamli->callsign($id);
870896
}*/
871897

872-
$data['id'] = strtoupper($id);
898+
if (isset($callsign['callsign']['gridsquare'])) {
899+
$CI = &get_instance();
900+
$CI->load->model('logbook_model');
901+
$callsign['grid_worked'] = $CI->logbook_model->check_if_grid_worked_in_logbook(strtoupper(substr($callsign['callsign']['gridsquare'],0,4)), 0, $this->session->userdata('user_default_band'));
902+
}
903+
if (isset($callsign['callsign']['error'])) {
904+
$callsign['error'] = $callsign['callsign']['error'];
905+
}
906+
$callsign['id'] = strtoupper($id);
873907

874-
return $this->load->view('search/result', $data, true);
908+
return $this->load->view('search/result', $callsign, true);
875909
}
876910
}
877911

@@ -927,8 +961,33 @@ function search_result($id="", $id2="") {
927961
if (isset($data['callsign']['error'])) {
928962
$data['error'] = $data['callsign']['error'];
929963
}
964+
} else if ($this->config->item('callbook') == "hamqth" && $this->config->item('hamqth_username') != null && $this->config->item('hamqth_password') != null) {
965+
// Load the HamQTH library
966+
$this->load->library('hamqth');
967+
968+
if(!$this->session->userdata('hamqth_session_key')) {
969+
$hamqth_session_key = $this->hamqth->session($this->config->item('hamqth_username'), $this->config->item('hamqth_password'));
970+
$this->session->set_userdata('hamqth_session_key', $hamqth_session_key);
971+
}
972+
973+
$data['callsign'] = $this->hamqth->search($id, $this->session->userdata('hamqth_session_key'));
974+
975+
// If HamQTH session has expired, start a new session and retry the search.
976+
if($data['callsign']['error'] == "Session does not exist or expired") {
977+
$hamqth_session_key = $this->hamqth->session($this->config->item('hamqth_username'), $this->config->item('hamqth_password'));
978+
$this->session->set_userdata('hamqth_session_key', $hamqth_session_key);
979+
$data['callsign'] = $this->hamqth->search($callsign, $this->session->userdata('hamqth_session_key'));
980+
}
981+
if (isset($data['callsign']['gridsquare'])) {
982+
$CI = &get_instance();
983+
$CI->load->model('logbook_model');
984+
$data['grid_worked'] = $CI->logbook_model->check_if_grid_worked_in_logbook(strtoupper(substr($data['callsign']['gridsquare'],0,4)), 0, $this->session->userdata('user_default_band'));
985+
}
986+
if (isset($data['callsign']['error'])) {
987+
$data['error'] = $data['callsign']['error'];
988+
}
930989
} else {
931-
$data['error'] = 'No result (qrz not configured)';
990+
$data['error'] = 'Lookup not configured. Please review configuration.';
932991
} /*else {
933992
// Lookup using hamli
934993
$this->load->library('hamli');

application/libraries/Curl.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class Curl {
2727
function __construct($url = '')
2828
{
2929
$this->_ci = & get_instance();
30-
log_message('debug', 'cURL Class Initialized');
3130

3231
if ( ! $this->is_enabled())
3332
{
@@ -369,4 +368,4 @@ private function set_defaults()
369368
}
370369

371370
/* End of file Curl.php */
372-
/* Location: ./application/libraries/Curl.php */
371+
/* Location: ./application/libraries/Curl.php */

application/libraries/Hamqth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function search($callsign, $key)
7171

7272
// Create XML object
7373
$xml = simplexml_load_string($xml);
74-
if (empty($xml)) return;
74+
if (!empty($xml->session->error)) return $data['error'] = $xml->session->error;
7575

7676
// Return Required Fields
7777
$data['callsign'] = (string)$xml->search->callsign;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
defined('BASEPATH') OR exit('No direct script access allowed');
4+
5+
/*
6+
* Tag Cloudlog as 2.5.1
7+
*/
8+
9+
class Migration_tag_2_5_2 extends CI_Migration {
10+
11+
public function up()
12+
{
13+
14+
// Tag Cloudlog 2.5.1
15+
$this->db->where('option_name', 'version');
16+
$this->db->update('options', array('option_value' => '2.5.2'));
17+
}
18+
19+
public function down()
20+
{
21+
$this->db->where('option_name', 'version');
22+
$this->db->update('options', array('option_value' => '2.5.1'));
23+
}
24+
}

application/models/Logbook_model.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,7 @@ public function qso_details($searchphrase, $band, $mode, $type, $qsl, $searchmod
433433
$this->db->limit(500);
434434

435435
$result = $this->db->get($this->config->item('table_name'));
436-
log_message('debug', 'SQL: '.$this->db->last_query());
437-
return $result;
436+
return $result;
438437
//return $this->db->get($this->config->item('table_name'));
439438
}
440439

@@ -501,6 +500,7 @@ public function activator_details($call, $band, $leogeo){
501500

502501
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
503502
$this->db->join('dxcc_entities', 'dxcc_entities.adif = '.$this->config->item('table_name').'.COL_DXCC', 'left outer');
503+
$this->db->join('lotw_users', 'lotw_users.callsign = '.$this->config->item('table_name').'.col_call', 'left outer');
504504
$this->db->where('COL_CALL', $call);
505505
if ($band != 'All') {
506506
if ($band == 'SAT') {
@@ -4083,6 +4083,7 @@ public function update_distances(){
40834083
$this->db->where("((COL_DISTANCE is NULL) or (COL_DISTANCE = 0))");
40844084
$this->db->where("COL_GRIDSQUARE is NOT NULL");
40854085
$this->db->where("COL_GRIDSQUARE != ''");
4086+
$this->db->where("COL_GRIDSQUARE != station_gridsquare");
40864087
$this->db->trans_start();
40874088
$query = $this->db->get($this->config->item('table_name'));
40884089

@@ -4117,7 +4118,6 @@ public function check_for_station_id() {
41174118
$this->db->select('COL_PRIMARY_KEY, COL_TIME_ON, COL_CALL, COL_MODE, COL_BAND');
41184119
$this->db->where('station_id =', NULL);
41194120
$query = $this->db->get($this->config->item('table_name'));
4120-
log_message('debug','SQL: '.$this->db->last_query());
41214121
if($query->num_rows() >= 1) {
41224122
return $query->result();
41234123
} else {

application/views/components/hamsat/table.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<th>Satellite</th>
1818
<th>Gridsquare(s)</th>
1919
<th></th>
20+
<th></th>
2021
</tr>
2122
</thead>
2223
<tbody>
@@ -92,6 +93,15 @@
9293

9394
</td>
9495
<td><a href="<?php echo $rove['track_link']; ?>" target="_blank">Track</a></td>
96+
<?php
97+
$sat = $rove['satellite'];
98+
switch (strtoupper($rove['satellite'])) {
99+
case "GREENCUBE":
100+
$sat = 'IO-117';
101+
break;
102+
}
103+
?>
104+
<td><a href="https://sat.fg8oj.com/sked.php?s%5B%5D=<?php echo $sat; ?>&l=<?php echo strtoupper($gridsquare); ?>&el1=0&l2=<?php echo $rove['gridsquare']; ?>&el2=0&duration=1&start=0&OK=Search" target="_blank">Sked</a></td>
95105
</tr>
96106
<?php endforeach; ?>
97107
</tbody>

application/views/hamsat/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<div class="container">
22
<div id="hamsat_display" hx-get="<?php echo site_url('components'); ?>" hx-trigger="load, every 60s"></div>
3-
</div>
3+
</div>

0 commit comments

Comments
 (0)