Skip to content

Commit d2bb80f

Browse files
authored
2.6.8
2 parents 5f9d33c + bb64d68 commit d2bb80f

Some content is hidden

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

67 files changed

+1146
-405
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
/images/eqsl_card_images/*.jpg
1212
/updates/clublog_scp.txt
1313
/assets/qslcard/*
14+
/assets/sstvimages/*
1415
/assets/js/sections/custom.js
1516
.idea/*
1617
.DS_Store

.vscode/settings.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"cSpell.words": [
3+
"callsign",
4+
"cloudlog",
5+
"hamradio",
6+
"qslcard",
7+
"sstv",
8+
"sstvimages",
9+
"sstvtable",
10+
"SUBMODE",
11+
"userdata"
12+
]
13+
}

application/config/migration.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
|
2323
*/
2424

25-
$config['migration_version'] = 174;
25+
$config['migration_version'] = 176;
2626

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

application/controllers/Eqsl.php

+2-46
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ function __construct() {
1212
public function index() {
1313

1414
$this->lang->load('qslcard');
15+
$this->load->helper('storage');
1516
$folder_name = "images/eqsl_card_images";
16-
$data['storage_used'] = $this->sizeFormat($this->folderSize($folder_name));
17+
$data['storage_used'] = sizeFormat(folderSize($folder_name));
1718

1819

1920
// Render Page
@@ -749,49 +750,4 @@ function uploadUser($userid, $username, $password) {
749750
$status = $this->uploadQso($adif, $qsl);
750751
}
751752
}
752-
753-
// Functions for storage, these need shifted to a libary to use across Cloudlog
754-
function folderSize($dir){
755-
$count_size = 0;
756-
$count = 0;
757-
$dir_array = scandir($dir);
758-
foreach($dir_array as $key=>$filename){
759-
if($filename!=".." && $filename!="."){
760-
if(is_dir($dir."/".$filename)){
761-
$new_foldersize = $this->foldersize($dir."/".$filename);
762-
$count_size = $count_size+ $new_foldersize;
763-
}else if(is_file($dir."/".$filename)){
764-
$count_size = $count_size + filesize($dir."/".$filename);
765-
$count++;
766-
}
767-
}
768-
}
769-
return $count_size;
770-
}
771-
772-
function sizeFormat($bytes){
773-
$kb = 1024;
774-
$mb = $kb * 1024;
775-
$gb = $mb * 1024;
776-
$tb = $gb * 1024;
777-
778-
if (($bytes >= 0) && ($bytes < $kb)) {
779-
return $bytes . ' B';
780-
781-
} elseif (($bytes >= $kb) && ($bytes < $mb)) {
782-
return ceil($bytes / $kb) . ' KB';
783-
784-
} elseif (($bytes >= $mb) && ($bytes < $gb)) {
785-
return ceil($bytes / $mb) . ' MB';
786-
787-
} elseif (($bytes >= $gb) && ($bytes < $tb)) {
788-
return ceil($bytes / $gb) . ' GB';
789-
790-
} elseif ($bytes >= $tb) {
791-
return ceil($bytes / $tb) . ' TB';
792-
} else {
793-
return $bytes . ' B';
794-
}
795-
}
796-
797753
} // end class

application/controllers/Labels.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ function makeMultiQsoLabel($qsos, $pdf, $numberofqsos, $offset, $orientation, $g
273273
$qso_data[] = [
274274
'time' => $qso->COL_TIME_ON,
275275
'band' => $qso->COL_BAND,
276-
'mode' => $qso->COL_MODE,
276+
'mode' => (($qso->COL_SUBMODE ?? '') == '') ? $qso->COL_MODE : $qso->COL_SUBMODE,
277277
'rst' => $qso->COL_RST_SENT,
278278
'mygrid' => $qso->station_gridsquare,
279279
'via' => $qso->COL_QSL_VIA,

application/controllers/Logbook.php

+2
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,9 @@ function view($id) {
618618
}
619619

620620
$this->load->model('Qsl_model');
621+
$this->load->model('Sstv_model');
621622
$data['qslimages'] = $this->Qsl_model->getQslForQsoId($id);
623+
$data['sstvimages'] = $this->Sstv_model->getSstvForQsoId($id);
622624
$data['primary_subdivision'] = $this->subdivisions->get_primary_subdivision_name($data['query']->result()[0]->COL_DXCC);
623625
$data['secondary_subdivision'] = $this->subdivisions->get_secondary_subdivision_name($data['query']->result()[0]->COL_DXCC);
624626
$data['max_upload'] = ini_get('upload_max_filesize');

application/controllers/Qsl.php

+2-46
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function __construct() {
1515

1616
// Default view when loading controller.
1717
public function index() {
18-
18+
$this->load->helper('storage'); // Load the storage helper
1919
$folder_name = "assets/qslcard";
2020
$data['storage_used'] = sizeFormat(folderSize($folder_name));
2121

@@ -181,48 +181,4 @@ function viewQsl() {
181181
$this->load->view('qslcard/qslcarousel', $data);
182182
}
183183

184-
}
185-
186-
// Functions for storage, these need shifted to a libary to use across Cloudlog
187-
function folderSize($dir){
188-
$count_size = 0;
189-
$count = 0;
190-
$dir_array = scandir($dir);
191-
foreach($dir_array as $key=>$filename){
192-
if($filename!=".." && $filename!="."){
193-
if(is_dir($dir."/".$filename)){
194-
$new_foldersize = foldersize($dir."/".$filename);
195-
$count_size = $count_size+ $new_foldersize;
196-
}else if(is_file($dir."/".$filename)){
197-
$count_size = $count_size + filesize($dir."/".$filename);
198-
$count++;
199-
}
200-
}
201-
}
202-
return $count_size;
203-
}
204-
205-
function sizeFormat($bytes){
206-
$kb = 1024;
207-
$mb = $kb * 1024;
208-
$gb = $mb * 1024;
209-
$tb = $gb * 1024;
210-
211-
if (($bytes >= 0) && ($bytes < $kb)) {
212-
return $bytes . ' B';
213-
214-
} elseif (($bytes >= $kb) && ($bytes < $mb)) {
215-
return ceil($bytes / $kb) . ' KB';
216-
217-
} elseif (($bytes >= $mb) && ($bytes < $gb)) {
218-
return ceil($bytes / $mb) . ' MB';
219-
220-
} elseif (($bytes >= $gb) && ($bytes < $tb)) {
221-
return ceil($bytes / $gb) . ' GB';
222-
223-
} elseif ($bytes >= $tb) {
224-
return ceil($bytes / $tb) . ' TB';
225-
} else {
226-
return $bytes . ' B';
227-
}
228-
}
184+
}

application/controllers/Sattimers.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ public function index() {
1515
$footerData['scripts'] = [
1616
'assets/js/sections/sattimers.js?'
1717
];
18-
$url = 'https://www.df2et.de/tevel/api2.php?grid='.strtoupper($this->stations->find_gridsquare());
18+
$data['gridsquare'] = substr(strtoupper($this->stations->find_gridsquare()), 0, 6);
19+
$url = 'https://www.df2et.de/tevel/api2.php?grid=' . $data['gridsquare'];
1920
$json = file_get_contents($url);
2021
$data['activations'] = json_decode($json, true)['data'];
21-
$data['gridsquare'] = strtoupper($this->stations->find_gridsquare());
2222

2323
$data['page_title'] = "Satellite Timers";
2424

application/controllers/Sstv.php

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2+
3+
/*
4+
Controller for SSTV Images
5+
*/
6+
7+
class Sstv extends CI_Controller {
8+
9+
function __construct() {
10+
parent::__construct();
11+
$this->lang->load('sstv');
12+
$this->load->model('user_model');
13+
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
14+
}
15+
16+
public function index() {
17+
$this->load->helper('storage');
18+
$folder_name = "assets/sstvimages";
19+
$data['storage_used'] = sizeFormat(folderSize($folder_name));
20+
21+
// Render Page
22+
$data['page_title'] = "SSTV Images";
23+
24+
$this->load->model('sstv_model');
25+
$data['sstvArray'] = $this->sstv_model->getQsoWithSstvImageList();
26+
27+
$this->load->view('interface_assets/header', $data);
28+
$this->load->view('sstv/index');
29+
$this->load->view('interface_assets/footer');
30+
}
31+
32+
public function uploadSSTV() {
33+
$this->load->model('user_model');
34+
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
35+
36+
if (!file_exists('./assets/sstvimages')) {
37+
mkdir('./assets/sstvimages', 0755, true);
38+
}
39+
$qsoid = $this->input->post('qsoid');
40+
41+
$results = array();
42+
if (isset($_FILES['sstvimages']) && $_FILES['sstvimages']['error'][0] == 0)
43+
{
44+
for($i=0; $i<count($_FILES['sstvimages']['name']); $i++) {
45+
$file = array(
46+
'name' => $_FILES['sstvimages']['name'][$i],
47+
'type' => $_FILES['sstvimages']['type'][$i],
48+
'tmp_name' => $_FILES['sstvimages']['tmp_name'][$i],
49+
'error' => $_FILES['sstvimages']['error'][$i],
50+
'size' => $_FILES['sstvimages']['size'][$i]
51+
);
52+
$result = $this->uploadSSTVImage($qsoid, $file);
53+
array_push($results, $result);
54+
}
55+
}
56+
57+
header("Content-type: application/json");
58+
echo json_encode($results);
59+
}
60+
61+
function uploadSSTVImage($qsoid, $file) {
62+
$config['upload_path'] = './assets/sstvimages';
63+
$config['allowed_types'] = 'jpg|gif|png|jpeg|JPG|PNG|bmp';
64+
$array = explode(".", $file['name']);
65+
$ext = end($array);
66+
$config['file_name'] = $qsoid . '.sstv.' . '_' . time() . '.' . $ext;
67+
68+
$this->load->library('upload', $config);
69+
70+
$_FILES['sstvimage'] = $file;
71+
if ( ! $this->upload->do_upload('sstvimage')) {
72+
// Upload of SSTV image Failed
73+
$error = array('error' => $this->upload->display_errors());
74+
75+
return $error;
76+
}
77+
else {
78+
// Load database queries
79+
$this->load->model('Sstv_model');
80+
81+
//Upload of SSTV image was successful
82+
$data = $this->upload->data();
83+
84+
// Now we need to insert info into database about file
85+
$filename = $data['file_name'];
86+
$insertid = $this->Sstv_model->saveSstvImages($qsoid, $filename);
87+
88+
$result['status'] = 'Success';
89+
$result['insertid'] = $insertid;
90+
$result['filename'] = $filename;
91+
return $result;
92+
}
93+
}
94+
95+
96+
// Deletes SSTV Image
97+
public function delete() {
98+
$this->load->model('user_model');
99+
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
100+
101+
$id = $this->input->post('id');
102+
$this->load->model('Sstv_model');
103+
104+
$path = './assets/sstvimages/';
105+
$file = $this->Sstv_model->getSSTVFilename($id)->row();
106+
$filename = $file->filename;
107+
unlink($path.$filename);
108+
109+
$this->Sstv_model->deleteSstv($id);
110+
}
111+
}

application/controllers/Visitor.php

+34-2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,37 @@ public function index($public_slug = NULL)
7575

7676
$this->load->model('logbook_model');
7777

78+
// load config and init pagination
79+
$this->load->library('pagination');
80+
81+
//Pagination config
82+
$config['base_url'] = base_url().'index.php/visitor/'. $public_slug . '/index';
83+
$config['total_rows'] = $this->logbook_model->total_qsos($logbooks_locations_array);
84+
$config['per_page'] = '25';
85+
$config['num_links'] = $this->logbook_model->total_qsos($logbooks_locations_array) / 25;
86+
$config['full_tag_open'] = '<ul class="pagination">';
87+
$config['full_tag_close'] = '</ul>';
88+
$config['attributes'] = ['class' => 'page-link'];
89+
$config['first_link'] = false;
90+
$config['last_link'] = false;
91+
$config['first_tag_open'] = '<li class="page-item">';
92+
$config['first_tag_close'] = '</li>';
93+
$config['prev_link'] = '&laquo';
94+
$config['prev_tag_open'] = '<li class="page-item">';
95+
$config['prev_tag_close'] = '</li>';
96+
$config['next_link'] = '&raquo';
97+
$config['next_tag_open'] = '<li class="page-item">';
98+
$config['next_tag_close'] = '</li>';
99+
$config['last_tag_open'] = '<li class="page-item">';
100+
$config['last_tag_close'] = '</li>';
101+
$config['cur_tag_open'] = '<li class="page-item active"><a href="#" class="page-link">';
102+
$config['cur_tag_close'] = '<span class="visually-hidden">(current)</span></a></li>';
103+
$config['num_tag_open'] = '<li class="page-item">';
104+
$config['num_tag_close'] = '</li>';
105+
106+
$this->pagination->initialize($config);
107+
108+
78109
// Public visitor so no QRA to setup
79110
$data['qra'] = "none";
80111

@@ -107,8 +138,9 @@ public function index($public_slug = NULL)
107138

108139
$data['total_lotw_sent'] = $QSLStatsBreakdownArray['LoTW_Sent'];
109140
$data['total_lotw_rcvd'] = $QSLStatsBreakdownArray['LoTW_Received'];
110-
111-
$data['last_five_qsos'] = $this->logbook_model->get_last_qsos('18', $logbooks_locations_array);
141+
142+
// Show paginated results
143+
$data['results'] = $this->logbook_model->get_qsos($config['per_page'], $this->uri->segment(4), $logbooks_locations_array);
112144

113145
$data['page_title'] = "Dashboard";
114146
$data['slug'] = $public_slug;
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
if (!function_exists('folderSize')) {
4+
function folderSize($dir){
5+
$count_size = 0;
6+
$count = 0;
7+
$dir_array = scandir($dir);
8+
foreach($dir_array as $key=>$filename){
9+
if($filename!=".." && $filename!="."){
10+
if(is_dir($dir."/".$filename)){
11+
$new_foldersize = folderSize($dir."/".$filename);
12+
$count_size = $count_size+ $new_foldersize;
13+
}else if(is_file($dir."/".$filename)){
14+
$count_size = $count_size + filesize($dir."/".$filename);
15+
$count++;
16+
}
17+
}
18+
}
19+
return $count_size;
20+
}
21+
}
22+
23+
if (!function_exists('sizeFormat')) {
24+
function sizeFormat($bytes){
25+
$kb = 1024;
26+
$mb = $kb * 1024;
27+
$gb = $mb * 1024;
28+
$tb = $gb * 1024;
29+
30+
if (($bytes >= 0) && ($bytes < $kb)) {
31+
return $bytes . ' B';
32+
} elseif (($bytes >= $kb) && ($bytes < $mb)) {
33+
return ceil($bytes / $kb) . ' KB';
34+
} elseif (($bytes >= $mb) && ($bytes < $gb)) {
35+
return ceil($bytes / $mb) . ' MB';
36+
} elseif (($bytes >= $gb) && ($bytes < $tb)) {
37+
return ceil($bytes / $gb) . ' GB';
38+
} elseif ($bytes >= $tb) {
39+
return ceil($bytes / $tb) . ' TB';
40+
} else {
41+
return $bytes . ' B';
42+
}
43+
}
44+
}

0 commit comments

Comments
 (0)