Skip to content

Commit

Permalink
Merge pull request #1831 from magicbug/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
magicbug authored Dec 7, 2022
2 parents a048f08 + 9b8e23f commit 394597a
Show file tree
Hide file tree
Showing 77 changed files with 40,958 additions and 271 deletions.
2 changes: 1 addition & 1 deletion application/config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/

$config['app_name'] = "Cloudlog";
$config['app_version'] = "1.7";
$config['app_version'] = "2.1";
$config['directory'] = "logbook";

$config['callbook'] = "hamqth"; // Options are hamqth or qrz
Expand Down
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'] = 105;
$config['migration_version'] = 109;

/*
|--------------------------------------------------------------------------
Expand Down
17 changes: 17 additions & 0 deletions application/controllers/Awards.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,23 @@ public function wwff() {
$this->load->view('interface_assets/footer');
}

/*
Handles showing worked POTAs
Comment field - POTA:#
*/
public function pota() {

// Grab all worked pota stations
$this->load->model('pota');
$data['pota_all'] = $this->pota->get_all();

// Render page
$data['page_title'] = "Awards - POTA";
$this->load->view('interface_assets/header', $data);
$this->load->view('awards/pota/index');
$this->load->view('interface_assets/footer');
}

public function cq() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
Expand Down
14 changes: 11 additions & 3 deletions application/controllers/Eqsl.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public function export() {
$this->load->model('logbook_model');

$data['page_title'] = "eQSL QSO Upload";
$custom_date_format = $this->session->userdata('user_date_format');

if ($this->input->post('eqslexport') == "export")
{
Expand All @@ -122,9 +123,10 @@ public function export() {
// perform an HTTP get on each one, and grab the status back
$qslsnotsent = $this->logbook_model->eqsl_not_yet_sent();

$table = "<table>";
$table = "<table width=\"100%\">";
$table .= "<tr class=\"titles\">";
$table .= "<td>Date</td>";
$table .= "<td>Time</td>";
$table .= "<td>Call</td>";
$table .= "<td>Mode</td>";
$table .= "<td>Submode</td>";
Expand Down Expand Up @@ -336,6 +338,7 @@ public function export() {
$result = curl_exec($ch);
$chi = curl_getinfo($ch);
curl_close($ch);


/* Time for some error handling
Things we might get back
Expand Down Expand Up @@ -401,7 +404,9 @@ public function export() {
}
}
$table .= "<tr>";
$table .= "<td>".$qsl['COL_TIME_ON']."</td>";
$timestamp = strtotime($qsl['COL_TIME_ON']);
$table .= "<td>".date($custom_date_format, $timestamp)."</td>";
$table .= "<td>".date('H:i', $timestamp)."</td>";
$table .= "<td>".str_replace("0","&Oslash;",$qsl['COL_CALL'])."</td>";
$table .= "<td>".$qsl['COL_MODE']."</td>";
if(isset($qsl['COL_SUBMODE'])) {
Expand All @@ -428,6 +433,7 @@ public function export() {
$table = "<table width=\"100%\">";
$table .= "<tr class=\"titles\">";
$table .= "<td>Date</td>";
$table .= "<td>Time</td>";
$table .= "<td>Call</td>";
$table .= "<td>Mode</td>";
$table .= "<td>Submode</td>";
Expand All @@ -438,7 +444,9 @@ public function export() {
foreach ($qslsnotsent->result_array() as $qsl)
{
$table .= "<tr>";
$table .= "<td>".$qsl['COL_TIME_ON']."</td>";
$timestamp = strtotime($qsl['COL_TIME_ON']);
$table .= "<td>".date($custom_date_format, $timestamp)."</td>";
$table .= "<td>".date('H:i', $timestamp)."</td>";
$table .= "<td><a href=\"javascript:displayQso(" . $qsl['COL_PRIMARY_KEY'] . ")\">" . str_replace("0","&Oslash;",strtoupper($qsl['COL_CALL'])) . "</a></td>";
$table .= "<td>".$qsl['COL_MODE']."</td>";

Expand Down
134 changes: 96 additions & 38 deletions application/controllers/Logbook.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ function json($callsign, $type, $band, $mode, $station_id = null)
$this->load->model('logbook_model');

$return = [
"callsign" => strtoupper($callsign),
"dxcc" => false,
"callsign_name" => "",
"callsign_qra" => "",
Expand Down Expand Up @@ -533,7 +534,20 @@ function partial($id) {
$html .= "<td>RST (R)</td>";
$html .= "<td>Band</td>";
$html .= "<td>Mode</td>";
$html .= "<td>QSL</td>";
switch($this->session->userdata('user_previous_qsl_type')) {
case 0:
$html .= "<td>".$this->lang->line('gen_hamradio_qsl')."</td>";
break;
case 1:
$html .= "<td>".$this->lang->line('lotw_short')."</td>";
break;
case 2:
$html .= "<td>".$this->lang->line('eqsl_short')."</td>";
break;
default:
$html .= "<td>".$this->lang->line('gen_hamradio_qsl')."</td>";
break;
}
$html .= "<td></td>";
$html .= "</tr>";

Expand Down Expand Up @@ -565,44 +579,88 @@ function partial($id) {
$html .= "<td>".$row->COL_MODE."</td>";
else
$html .= "<td>".$row->COL_SUBMODE."</td>";
$html .= "<td class=\"qsl\">";
$html .= "<span class=\"qsl-";
switch ($row->COL_QSL_SENT) {
case "Y":
$html .= "green";
break;
case "Q":
$html .= "yellow";
break;
case "R":
$html .= "yellow";
break;
case "I":
$html .= "grey";
break;
default:
$html .= "red";
}
$html .= "\">&#9650;</span>";
$html .= "<span class=\"qsl-";
switch ($row->COL_QSL_RCVD) {
case "Y":
$html .= "green";
break;
case "Q":
$html .= "yellow";
break;
case "R":
$html .= "yellow";
break;
case "I":
$html .= "grey";
break;
default:
$html .= "red";
if ($this->session->userdata('user_previous_qsl_type') == 1) {
$html .= "<td class=\"lotw\">";
$html .= "<span class=\"qsl-";
switch ($row->COL_LOTW_QSL_SENT) {
case "Y":
$html .= "green";
break;
default:
$html .= "red";
}
$html .= "\">&#9650;</span>";
$html .= "<span class=\"qsl-";
switch ($row->COL_LOTW_QSL_RCVD) {
case "Y":
$html .= "green";
break;
default:
$html .= "red";
}
$html .= "\">&#9660;</span>";
$html .= "</td>";
} else if ($this->session->userdata('user_previous_qsl_type') == 2) {
$html .= "<td class=\"eqsl\">";
$html .= "<span class=\"qsl-";
switch ($row->COL_EQSL_QSL_SENT) {
case "Y":
$html .= "green";
break;
default:
$html .= "red";
}
$html .= "\">&#9650;</span>";
$html .= "<span class=\"qsl-";
switch ($row->COL_EQSL_QSL_RCVD) {
case "Y":
$html .= "green";
break;
default:
$html .= "red";
}
$html .= "\">&#9660;</span>";
$html .= "</td>";
} else {
$html .= "<td class=\"qsl\">";
$html .= "<span class=\"qsl-";
switch ($row->COL_QSL_SENT) {
case "Y":
$html .= "green";
break;
case "Q":
$html .= "yellow";
break;
case "R":
$html .= "yellow";
break;
case "I":
$html .= "grey";
break;
default:
$html .= "red";
}
$html .= "\">&#9650;</span>";
$html .= "<span class=\"qsl-";
switch ($row->COL_QSL_RCVD) {
case "Y":
$html .= "green";
break;
case "Q":
$html .= "yellow";
break;
case "R":
$html .= "yellow";
break;
case "I":
$html .= "grey";
break;
default:
$html .= "red";
}
$html .= "\">&#9660;</span>";
$html .= "</td>";
}
$html .= "\">&#9660;</span>";
$html .= "</td>";
$html .= "<td><span class=\"badge badge-info\">".$row->station_callsign."</span></td>";
$html .= "</tr>";
}
Expand Down
1 change: 1 addition & 0 deletions application/controllers/Lotw.php
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,7 @@ function lotw_satellite_map($satname) {
"AISAT1" => "AISAT-1",
'UVSQ' => "UVSQ-SAT",
'CAS-3H' => "LILACSAT-2",
'IO-117' => "GREENCUBE",
);

return array_search(strtoupper($satname),$arr,true);
Expand Down
29 changes: 29 additions & 0 deletions application/controllers/Qso.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,35 @@ public function get_wwff() {
echo json_encode($json);
}

public function get_pota() {
$json = [];

if(!empty($this->input->get("query"))) {
$query = isset($_GET['query']) ? $_GET['query'] : FALSE;
$pota = strtoupper($query);

$file = 'assets/json/pota.txt';

if (is_readable($file)) {
$lines = file($file, FILE_IGNORE_NEW_LINES);
$input = preg_quote($pota, '~');
$reg = '~^'. $input .'(.*)$~';
$result = preg_grep($reg, $lines);
$json = [];
$i = 0;
foreach ($result as &$value) {
// Limit to 100 as to not slowdown browser too much
if (count($json) <= 100) {
$json[] = ["name"=>$value];
}
}
}
}

header('Content-Type: application/json');
echo json_encode($json);
}

/*
* Function is used for autocompletion of DOK in the QSO entry form
*/
Expand Down
37 changes: 37 additions & 0 deletions application/controllers/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,43 @@ public function update_wwff() {
}
}

public function update_pota() {
$csvfile = 'https://pota.app/all_parks.csv';

$potafile = './assets/json/pota.txt';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $csvfile);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_USERAGENT, 'Cloudlog Updater');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$csv = curl_exec($ch);
curl_close($ch);

$potafilehandle = fopen($potafile, 'w');
$data = str_getcsv($csv,"\n");
foreach ($data as $idx => $row) {
if ($idx == 0) continue; // Skip line we are not interested in
$row = str_getcsv($row, ',');
if ($row[0]) {
fwrite($potafilehandle, $row[0].PHP_EOL);
}
}

fclose($potafilehandle);
if (file_exists($potafile))
{
$nCount = count(file($potafile));
if ($nCount > 0)
{
echo "DONE: " . number_format($nCount) . " POTA's saved";
} else {
echo"FAILED: Empty file";
}
} else {
echo"FAILED: Could not create pota.txt file locally";
}
}

}
?>
14 changes: 13 additions & 1 deletion application/controllers/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ function __construct()
// Load language files
$this->lang->load(array(
'account',
'lotw',
'eqsl',
));
}

Expand Down Expand Up @@ -78,6 +80,7 @@ function add() {
$data['user_column4'] = $this->input->post('user_column4');
$data['user_column5'] = $this->input->post('user_column5');
$data['user_show_profile_image'] = $this->input->post('user_show_profile_image');
$data['user_previous_qsl_type'] = $this->input->post('user_previous_qsl_type');
$this->load->view('user/add', $data);
} else {
$this->load->view('user/add', $data);
Expand Down Expand Up @@ -107,7 +110,8 @@ function add() {
$this->input->post('user_column3'),
$this->input->post('user_column4'),
$this->input->post('user_column5'),
$this->input->post('user_show_profile_image'))) {
$this->input->post('user_show_profile_image'),
$this->input->post('user_previous_qsl_type'))) {
// Check for errors
case EUSERNAMEEXISTS:
$data['username_error'] = 'Username <b>'.$this->input->post('user_name').'</b> already in use!';
Expand Down Expand Up @@ -147,6 +151,7 @@ function add() {
$data['user_column4'] = $this->input->post('user_column4');
$data['user_column5'] = $this->input->post('user_column5');
$data['user_show_profile_image'] = $this->input->post('user_show_profile_image');
$data['user_previous_qsl_type'] = $this->input->post('user_previous_qsl_type');
$this->load->view('user/add', $data);
$this->load->view('interface_assets/footer');
}
Expand Down Expand Up @@ -336,6 +341,12 @@ function edit() {
$data['user_show_profile_image'] = $q->user_show_profile_image;
}

if($this->input->post('user_previous_qsl_type')) {
$data['user_previous_qsl_type'] = $this->input->post('user_previous_qsl_type', false);
} else {
$data['user_previous_qsl_type'] = $q->user_previous_qsl_type;
}

if($this->input->post('user_column1')) {
$data['user_column1'] = $this->input->post('user_column1', true);
} else {
Expand Down Expand Up @@ -418,6 +429,7 @@ function edit() {
$data['user_column4'] = $this->input->post('user_column4');
$data['user_column5'] = $this->input->post('user_column5');
$data['user_show_profile_image'] = $this->input->post('user_show_profile_image');
$data['user_previous_qsl_type'] = $this->input->post('user_previous_qsl_type');
$this->load->view('user/edit');
$this->load->view('interface_assets/footer');
}
Expand Down
Loading

0 comments on commit 394597a

Please sign in to comment.