From ba33f69c6ac9269b88780bd10cf83f586bed1fb6 Mon Sep 17 00:00:00 2001
From: Matt Melling
Date: Tue, 1 Sep 2020 20:16:21 +0100
Subject: [PATCH 001/102] configurable updates folder
---
application/config/config.sample.php | 2 ++
application/controllers/Update.php | 27 ++++++++++++++++++++-------
2 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/application/config/config.sample.php b/application/config/config.sample.php
index 1f596a03a..0a168739c 100644
--- a/application/config/config.sample.php
+++ b/application/config/config.sample.php
@@ -19,6 +19,8 @@ $config['directory'] = "logbook";
$config['callbook'] = "hamqth"; // Options are hamqth or qrz
+$config['datadir'] = null; // default to install directory
+
/*
|--------------------------------------------------------------------------
| Logbook Options
diff --git a/application/controllers/Update.php b/application/controllers/Update.php
index 57b78338c..62fd454cc 100644
--- a/application/controllers/Update.php
+++ b/application/controllers/Update.php
@@ -17,6 +17,19 @@ class Update extends CI_Controller {
}
+ /*
+ * Create a path to a file in the updates folder, respecting the datadir
+ * configuration option.
+ */
+ private function make_update_path($path) {
+ $path = "updates/" . $path;
+ $datadir = $this->config->item('datadir');
+ if(!$datadir) {
+ return $path;
+ }
+ return $datadir . "/" . $path;
+ }
+
/*
* Load the dxcc entities
*/
@@ -25,7 +38,7 @@ class Update extends CI_Controller {
$this->load->model('dxcc_entities');
// Load the cty file
- $xml_data = simplexml_load_file("updates/cty.xml");
+ $xml_data = simplexml_load_file($this->make_update_path("cty.xml"));
//$xml_data->entities->entity->count();
@@ -74,7 +87,7 @@ class Update extends CI_Controller {
// Load Database connectors
$this->load->model('dxcc_exceptions');
// Load the cty file
- $xml_data = simplexml_load_file("updates/cty.xml");
+ $xml_data = simplexml_load_file($this->make_update_path("cty.xml"));
$count = 0;
foreach ($xml_data->exceptions->exception as $record) {
@@ -114,7 +127,7 @@ class Update extends CI_Controller {
// Load Database connectors
$this->load->model('dxcc_prefixes');
// Load the cty file
- $xml_data = simplexml_load_file("updates/cty.xml");
+ $xml_data = simplexml_load_file($this->make_update_path("cty.xml"));
$count = 0;
foreach ($xml_data->prefixes->prefix as $record) {
@@ -169,8 +182,8 @@ class Update extends CI_Controller {
$data .= gzgetc($gz);
}
gzclose($gz);
-
- file_put_contents('./updates/cty.xml', $data);
+
+ file_put_contents($this->make_update_path("cty.xml"), $data);
// Clear the tables, ready for new data
$this->db->empty_table("dxcc_entities");
@@ -203,7 +216,7 @@ class Update extends CI_Controller {
$html = $done."....
";
}
- file_put_contents('./updates/status.html', $html);
+ file_put_contents($this->make_update_path("status.html"), $html);
}
@@ -226,7 +239,7 @@ class Update extends CI_Controller {
}
public function update_clublog_scp() {
- $strFile = "./updates/clublog_scp.txt";
+ $strFile = $this->make_update_path("clublog_scp.txt");
$url = "https://cdn.clublog.org/clublog.scp.gz";
set_time_limit(300);
$this->update_status("Downloading Club Log SCP file");
From ad572219ec9a66f66f24c30e0a28ad21c2c5bceb Mon Sep 17 00:00:00 2001
From: abarrau
Date: Sat, 10 Apr 2021 04:41:49 +0200
Subject: [PATCH 002/102] load class from controller path from third_party
---
system/core/CodeIgniter.php | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index 0d03293f6..d8318f2da 100644
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -402,13 +402,17 @@ if ( ! is_php('5.4'))
$class = ucfirst($RTR->class);
$method = $RTR->method;
- if (empty($class) OR ! file_exists(APPPATH.'controllers/'.$RTR->directory.$class.'.php'))
+ if (empty($class) OR !(file_exists(APPPATH.'controllers/'.$RTR->directory.$class.'.php') OR file_exists(APPPATH.'third_party/controllers/'.$RTR->directory.$class.'.php')))
{
$e404 = TRUE;
}
else
{
- require_once(APPPATH.'controllers/'.$RTR->directory.$class.'.php');
+ if (file_exists(APPPATH.'third_party/controllers/'.$RTR->directory.$class.'.php')) {
+ require_once(APPPATH.'third_party/controllers/'.$RTR->directory.$class.'.php');
+ } else {
+ require_once(APPPATH.'controllers/'.$RTR->directory.$class.'.php');
+ }
if ( ! class_exists($class, FALSE) OR $method[0] === '_' OR method_exists('CI_Controller', $method))
{
From 5c9fd1a3e6a7ade6a96bd1a1571c28f5f63b9208 Mon Sep 17 00:00:00 2001
From: abarrau
Date: Sat, 10 Apr 2021 05:02:01 +0200
Subject: [PATCH 003/102] load custom.css file from third_party
---
application/views/interface_assets/header.php | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/application/views/interface_assets/header.php b/application/views/interface_assets/header.php
index 088d02da0..8040cf578 100644
--- a/application/views/interface_assets/header.php
+++ b/application/views/interface_assets/header.php
@@ -39,7 +39,10 @@
uri->segment(1) == "adif") { ?>
-
+
+ '; } ?>
+
+
- Cloudlog
From de52e91cde241c2db95e30a77d68b6eab1d21782 Mon Sep 17 00:00:00 2001
From: abarrau
Date: Sat, 10 Apr 2021 05:03:44 +0200
Subject: [PATCH 004/102] load custom.css file from third_party
---
application/views/interface_assets/mini_header.php | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/application/views/interface_assets/mini_header.php b/application/views/interface_assets/mini_header.php
index 4e93e899d..450b0b465 100644
--- a/application/views/interface_assets/mini_header.php
+++ b/application/views/interface_assets/mini_header.php
@@ -18,8 +18,10 @@
-
+ '; } ?>
+
+
- Cloudlog
-
\ No newline at end of file
+
From 1ca1bc13e90807c80197445bd027ff04f15356c3 Mon Sep 17 00:00:00 2001
From: abarrau
Date: Sat, 10 Apr 2021 05:20:42 +0200
Subject: [PATCH 005/102] load custom.css from assets path
---
application/views/interface_assets/header.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/application/views/interface_assets/header.php b/application/views/interface_assets/header.php
index 8040cf578..fb5e33e4e 100644
--- a/application/views/interface_assets/header.php
+++ b/application/views/interface_assets/header.php
@@ -40,7 +40,7 @@
- '; } ?>
+ '; } ?>
From 7ed5a89253b7301ad1559d69241cbf3fac7795ad Mon Sep 17 00:00:00 2001
From: abarrau
Date: Sat, 10 Apr 2021 05:21:22 +0200
Subject: [PATCH 006/102] load custom.css from assets path
---
application/views/interface_assets/mini_header.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/application/views/interface_assets/mini_header.php b/application/views/interface_assets/mini_header.php
index 450b0b465..826745453 100644
--- a/application/views/interface_assets/mini_header.php
+++ b/application/views/interface_assets/mini_header.php
@@ -18,7 +18,7 @@
- '; } ?>
+ '; } ?>
From 62e2562cef0db7cff0d8ab442168f93b106dd917 Mon Sep 17 00:00:00 2001
From: abarrau
Date: Sun, 11 Apr 2021 08:34:55 +0200
Subject: [PATCH 007/102] add to use english language if ask not found
add to use the english language file, if the ask language not found
---
system/core/Lang.php | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/system/core/Lang.php b/system/core/Lang.php
index 569b02368..cc371cd4c 100644
--- a/system/core/Lang.php
+++ b/system/core/Lang.php
@@ -146,8 +146,22 @@ class CI_Lang {
break;
}
}
+ // try to load in default language (english) //
+ if (($found !== TRUE)&&($idiom != 'english')) {
+ $idiom = 'english';
+ foreach (get_instance()->load->get_package_paths(TRUE) as $package_path)
+ {
+ $package_path .= 'language/'.$idiom.'/'.$langfile;
+ if ($basepath !== $package_path && file_exists($package_path))
+ {
+ include($package_path);
+ $found = TRUE;
+ break;
+ }
+ }
+ }
}
-
+
if ($found !== TRUE)
{
show_error('Unable to load the requested language file: language/'.$idiom.'/'.$langfile);
From 15e42355c864f476a6bf47b1bb5c136d95443ae8 Mon Sep 17 00:00:00 2001
From: Andreas <6977712+AndreasK79@users.noreply.github.com>
Date: Sun, 11 Apr 2021 21:50:01 +0200
Subject: [PATCH 008/102] [QSO entry] Blanking satellite blanks mode and
propagation mode. Fixes #983
---
assets/js/sections/qso.js | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js
index c92a103fe..99db8aeaf 100644
--- a/assets/js/sections/qso.js
+++ b/assets/js/sections/qso.js
@@ -1,4 +1,11 @@
$( document ).ready(function() {
+ $("#sat_name").change(function(){
+ var sat = $("#sat_name").val();
+ if (sat == "") {
+ $("#sat_mode").val("");
+ $("#selectPropagation").val("");
+ }
+ });
$('#input_usa_state').change(function(){
var state = $("#input_usa_state option:selected").text();
From 614452b07e83828ea5c9d27d0a9ea823b4188c87 Mon Sep 17 00:00:00 2001
From: KT3PJ
Date: Tue, 27 Jul 2021 18:49:54 -0400
Subject: [PATCH 009/102] Add the gridsquare from LotW QSL to the logbook
The gridsquare from the QSL will now update the log if the gridsquare
was not previously populated, or if the LotW gridsquare is more
specific than what previously existed. Previously the gridsquare was
not being used from the LotW QSL record.
This will enable the map above the logbook to more accurately display
where the QSL was with instead of default values.
- Add 'qsl_gridsquare' to the logbook_model.php:lotw_update
implementation.
- Refactor code in lotw_update to remove duplicate code.
- Add gridsquare into the LotW output table on what is imported.
---
application/controllers/Lotw.php | 11 ++++++-
application/models/Logbook_model.php | 47 +++++++++++++++++++---------
2 files changed, 42 insertions(+), 16 deletions(-)
diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php
index 084b83b2d..49be4a47c 100644
--- a/application/controllers/Lotw.php
+++ b/application/controllers/Lotw.php
@@ -466,6 +466,7 @@ class Lotw extends CI_Controller {
$tableheaders .= "LoTW QSL Received | ";
$tableheaders .= "Date LoTW Confirmed | ";
$tableheaders .= "State | ";
+ $tableheaders .= "Gridsquare | ";
$tableheaders .= "Log Status | ";
$tableheaders .= "LoTW Status | ";
$tableheaders .= "";
@@ -512,8 +513,15 @@ class Lotw extends CI_Controller {
} else {
$state = "";
}
+ // Present only if the QSLing station specified a single valid grid square value in its station location uploaded to LoTW.
+ if (isset($record['gridsquare'])) {
+ $qsl_gridsquare = $record['gridsquare'];
+ } else {
+ $qsl_gridsquare = "";
+ }
- $lotw_status = $this->logbook_model->lotw_update($time_on, $record['call'], $record['band'], $qsl_date, $record['qsl_rcvd'], $state);
+
+ $lotw_status = $this->logbook_model->lotw_update($time_on, $record['call'], $record['band'], $qsl_date, $record['qsl_rcvd'], $state, $qsl_gridsquare);
}
@@ -525,6 +533,7 @@ class Lotw extends CI_Controller {
$table .= "".$record['qsl_rcvd']." | ";
$table .= "".$qsl_date." | ";
$table .= "".$state." | ";
+ $table .= "".$qsl_gridsquare." | ";
$table .= "QSO Record: ".$status." | ";
$table .= "LoTW Record: ".$lotw_status." | ";
$table .= "";
diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php
index f6d773c20..7bdba991f 100755
--- a/application/models/Logbook_model.php
+++ b/application/models/Logbook_model.php
@@ -1401,28 +1401,45 @@ class Logbook_model extends CI_Model {
}
}
- function lotw_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $state) {
+ function lotw_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $state, $qsl_gridsquare) {
- if($state != "") {
- $data = array(
- 'COL_LOTW_QSLRDATE' => $qsl_date,
- 'COL_LOTW_QSL_RCVD' => $qsl_status,
- 'COL_LOTW_QSL_SENT' => 'Y',
- 'COL_STATE' => $state
- );
- } else {
- $data = array(
- 'COL_LOTW_QSLRDATE' => $qsl_date,
- 'COL_LOTW_QSL_RCVD' => $qsl_status,
- 'COL_LOTW_QSL_SENT' => 'Y'
- );
- }
+ $data = array(
+ 'COL_LOTW_QSLRDATE' => $qsl_date,
+ 'COL_LOTW_QSL_RCVD' => $qsl_status,
+ 'COL_LOTW_QSL_SENT' => 'Y'
+ );
+ if($state != "") {
+ $data['COL_STATE'] = $state;
+ }
$this->db->where('date_format(COL_TIME_ON, \'%Y-%m-%d %H:%i\') = "'.$datetime.'"');
$this->db->where('COL_CALL', $callsign);
$this->db->where('COL_BAND', $band);
$this->db->update($this->config->item('table_name'), $data);
+ unset($data);
+
+ if($qsl_gridsquare != "") {
+ $data = array(
+ 'COL_GRIDSQUARE' => $qsl_gridsquare
+ );
+ $this->db->where('date_format(COL_TIME_ON, \'%Y-%m-%d %H:%i\') = "'.$datetime.'"');
+ $this->db->where('COL_CALL', $callsign);
+ $this->db->where('COL_BAND', $band);
+ if(strlen($qsl_gridsquare) > 4) {
+ $this->db->group_start();
+ $this->db->where('COL_GRIDSQUARE', "");
+ $this->db->or_where('COL_GRIDSQUARE', substr($qsl_gridsquare, 0, 4));
+ if(strlen($qsl_gridsquare) > 6) {
+ $this->db->or_where('COL_GRIDSQUARE', substr($qsl_gridsquare, 0, 6));
+ }
+ $this->db->group_end();
+ } else {
+ $this->db->where('COL_GRIDSQUARE', "");
+ }
+
+ $this->db->update($this->config->item('table_name'), $data);
+ }
return "Updated";
}
From 0015d4a1cf85c81047044f559bd92e3ecd2d53c7 Mon Sep 17 00:00:00 2001
From: Andreas <6977712+AndreasK79@users.noreply.github.com>
Date: Thu, 29 Jul 2021 12:05:52 +0200
Subject: [PATCH 010/102] [DX Atlas Gridsquare Export] Initial work begun for
export
---
application/controllers/Dxatlas.php | 104 +++++++++++++++
application/views/dxatlas/index.php | 119 ++++++++++++++++++
application/views/interface_assets/header.php | 2 +
3 files changed, 225 insertions(+)
create mode 100644 application/controllers/Dxatlas.php
create mode 100644 application/views/dxatlas/index.php
diff --git a/application/controllers/Dxatlas.php b/application/controllers/Dxatlas.php
new file mode 100644
index 000000000..ac8c46ff8
--- /dev/null
+++ b/application/controllers/Dxatlas.php
@@ -0,0 +1,104 @@
+load->model('user_model');
+ $this->load->model('modes');
+ $this->load->model('dxcc');
+ $this->load->model('logbook_model');
+
+ if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
+
+ $data['worked_bands'] = $this->dxcc->get_worked_bands(); // Used in the view for band select
+ $data['modes'] = $this->modes->active(); // Used in the view for mode select
+ $data['dxcc'] = $this->logbook_model->fetchDxcc(); // Used in the view for dxcc select
+
+ $data['page_title'] = "DX Atlas Gridsquare Export";
+
+ $this->load->view('interface_assets/header', $data);
+ $this->load->view('dxatlas/index');
+ $this->load->view('interface_assets/footer');
+
+ }
+
+ public function export()
+ {
+ // Load Librarys
+ $this->load->library('qra');
+ $this->load->helper('file');
+
+ // Load Database connections
+ $this->load->model('logbook_model');
+
+ // Parameters
+ $band = $this->input->post('band');
+ $mode = $this->input->post('mode');
+ $dxcc = $this->input->post('dxcc_id');
+ $cqz = $this->input->post('cqz');
+ $propagation = $this->input->post('prop_mode');
+ $fromdate = $this->input->post('fromdate');
+ $todate = $this->input->post('todate');
+
+ // Get QSOs with Valid QRAs
+ $qsos = $this->logbook_model->kml_get_all_qsos($band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate);
+
+ $output = "";
+ $output .= "";
+
+ $output .= "";
+
+ foreach ($qsos->result() as $row)
+ {
+ $output .= "";
+
+ if($row->COL_GRIDSQUARE != null) {
+ $stn_loc = $this->qra->qra2latlong($row->COL_GRIDSQUARE);
+
+ $lat = $stn_loc[0];
+ $lng = $stn_loc[1];
+ } else {
+ $query = $this->db->query('
+ SELECT *
+ FROM dxcc_entities
+ WHERE prefix = SUBSTRING( \''.$row->COL_CALL.'\', 1, LENGTH( prefix ) )
+ ORDER BY LENGTH( prefix ) DESC
+ LIMIT 1
+ ');
+
+ foreach ($query->result() as $dxcc) {
+ $lat = $dxcc->lat;
+ $lng = $dxcc->long;
+ }
+ }
+
+ $timestamp = strtotime($row->COL_TIME_ON);
+
+ $output .= "".$row->COL_CALL."";
+ $output .= "Date/Time: ".date('Y-m-d H:i:s', ($timestamp))."
Band: ".$row->COL_BAND."
]]>";
+ $output .= "";
+ $output .= "".$lng.",".$lat.",0";
+ $output .= "";
+ $output .= "";
+ }
+
+ $output .= "";
+ $output .= "";
+
+ if (!file_exists('kml')) {
+ mkdir('kml', 0755, true);
+ }
+
+ if ( ! write_file('kml/qsos.kml', $output))
+ {
+ echo 'Unable to write the file. Make sure the folder KML has write permissions.';
+ }
+ else
+ {
+ header("Content-Disposition: attachment; filename=\"qsos.kml\"");
+ echo $output;
+ }
+
+ }
+}
diff --git a/application/views/dxatlas/index.php b/application/views/dxatlas/index.php
new file mode 100644
index 000000000..7e7f3521c
--- /dev/null
+++ b/application/views/dxatlas/index.php
@@ -0,0 +1,119 @@
+
+
+
+
+
+
+
+
+ Only QSOs with a gridsquare defined will be exported!
+
+
+
+
+
diff --git a/application/views/interface_assets/header.php b/application/views/interface_assets/header.php
index 088d02da0..aa2644588 100644
--- a/application/views/interface_assets/header.php
+++ b/application/views/interface_assets/header.php
@@ -195,6 +195,8 @@
KML Export
+ DX Atlas Gridsquare Export
+
Logbook of the World
From c05d8f8fe06114b1984d2d602589827b0c0aecda Mon Sep 17 00:00:00 2001
From: Peter Goodhall
Date: Fri, 6 Aug 2021 17:52:04 +0100
Subject: [PATCH 011/102] [Migration] Creates station_logbook table in
database.
---
application/config/migration.php | 2 +-
.../071_create_station_logbook_table.php | 52 +++++++++++++++++++
2 files changed, 53 insertions(+), 1 deletion(-)
create mode 100644 application/migrations/071_create_station_logbook_table.php
diff --git a/application/config/migration.php b/application/config/migration.php
index 5b216f923..227bc690e 100644
--- a/application/config/migration.php
+++ b/application/config/migration.php
@@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
| be upgraded / downgraded to.
|
*/
-$config['migration_version'] = 70;
+$config['migration_version'] = 71;
/*
|--------------------------------------------------------------------------
diff --git a/application/migrations/071_create_station_logbook_table.php b/application/migrations/071_create_station_logbook_table.php
new file mode 100644
index 000000000..762ef81b5
--- /dev/null
+++ b/application/migrations/071_create_station_logbook_table.php
@@ -0,0 +1,52 @@
+dbforge->add_field(array(
+ 'logbook_id' => array(
+ 'type' => 'BIGINT',
+ 'constraint' => 20,
+ 'unsigned' => TRUE,
+ 'auto_increment' => TRUE,
+ 'unique' => TRUE
+ ),
+
+ 'user_id' => array(
+ 'type' => 'BIGINT',
+ 'constraint' => 20,
+ 'unsigned' => TRUE,
+ 'auto_increment' => FALSE
+ ),
+
+ 'logbook_name' => array(
+ 'type' => 'VARCHAR',
+ 'constraint' => '191',
+ 'null' => TRUE
+ ),
+
+ 'modified' => array(
+ 'type' => 'timestamp',
+ 'null' => TRUE,
+ )
+ ));
+
+ $this->dbforge->add_key('logbook_id', TRUE);
+ $this->dbforge->add_key('user_id', TRUE);
+
+ $this->dbforge->create_table('station_logbooks');
+ }
+
+ public function down()
+ {
+ $this->dbforge->drop_table('station_logbooks');
+ }
+}
\ No newline at end of file
From e254753bec7365269837fc768bce17de710f08b0 Mon Sep 17 00:00:00 2001
From: Peter Goodhall
Date: Fri, 6 Aug 2021 17:57:40 +0100
Subject: [PATCH 012/102] [Migration] Creates table
station_logbook_relationship table for many to many setup
---
application/config/migration.php | 2 +-
...ate_station_logbook_relationship_table.php | 54 +++++++++++++++++++
2 files changed, 55 insertions(+), 1 deletion(-)
create mode 100644 application/migrations/072_create_station_logbook_relationship_table.php
diff --git a/application/config/migration.php b/application/config/migration.php
index 227bc690e..e0cf1bd4a 100644
--- a/application/config/migration.php
+++ b/application/config/migration.php
@@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
| be upgraded / downgraded to.
|
*/
-$config['migration_version'] = 71;
+$config['migration_version'] = 72;
/*
|--------------------------------------------------------------------------
diff --git a/application/migrations/072_create_station_logbook_relationship_table.php b/application/migrations/072_create_station_logbook_relationship_table.php
new file mode 100644
index 000000000..02ed7a4bd
--- /dev/null
+++ b/application/migrations/072_create_station_logbook_relationship_table.php
@@ -0,0 +1,54 @@
+dbforge->add_field(array(
+ 'logbook_relation_id' => array(
+ 'type' => 'BIGINT',
+ 'constraint' => 20,
+ 'unsigned' => TRUE,
+ 'auto_increment' => TRUE,
+ 'unique' => TRUE
+ ),
+
+ 'station_logbook_id' => array(
+ 'type' => 'BIGINT',
+ 'constraint' => 20,
+ 'unsigned' => TRUE,
+ 'auto_increment' => FALSE
+ ),
+
+ 'station_location_id' => array(
+ 'type' => 'BIGINT',
+ 'constraint' => 20,
+ 'unsigned' => TRUE,
+ 'auto_increment' => FALSE
+ ),
+
+ 'modified' => array(
+ 'type' => 'timestamp',
+ 'null' => TRUE,
+ )
+ ));
+
+ $this->dbforge->add_key('logbook_relation_id', TRUE);
+ $this->dbforge->add_key('station_logbook_id', TRUE);
+ $this->dbforge->add_key('station_location_id', TRUE);
+
+ $this->dbforge->create_table('station_logbooks_relationship');
+ }
+
+ public function down()
+ {
+ $this->dbforge->drop_table('station_logbooks_relationship');
+ }
+}
\ No newline at end of file
From a512a984aaf24e4b576a20966595078e037acdad Mon Sep 17 00:00:00 2001
From: Andreas <6977712+AndreasK79@users.noreply.github.com>
Date: Mon, 9 Aug 2021 13:13:41 +0200
Subject: [PATCH 013/102] [Custom CSS Theme Support] Added support for fetching
list of themes from database.
---
application/controllers/User.php | 6 ++++++
application/models/User_model.php | 8 ++++++++
application/views/user/add.php | 15 +++++++++------
application/views/user/edit.php | 15 +++++++++------
4 files changed, 32 insertions(+), 12 deletions(-)
diff --git a/application/controllers/User.php b/application/controllers/User.php
index 976ea38e9..97059f73e 100644
--- a/application/controllers/User.php
+++ b/application/controllers/User.php
@@ -42,6 +42,9 @@ class User extends CI_Controller {
$this->form_validation->set_rules('user_locator', 'Locator', 'required');
$this->form_validation->set_rules('user_timezone', 'Timezone', 'required');
+ // Get themes list
+ $data['themes'] = $this->user_model->getThemes();
+
// Get timezones
$data['timezones'] = $this->user_model->timezones();
@@ -158,6 +161,9 @@ class User extends CI_Controller {
$this->form_validation->set_rules('user_locator', 'Locator', 'required|xss_clean');
$this->form_validation->set_rules('user_timezone', 'Timezone', 'required');
+ // Get themes list
+ $data['themes'] = $this->user_model->getThemes();
+
// Get timezones
$data['timezones'] = $this->user_model->timezones();
diff --git a/application/models/User_model.php b/application/models/User_model.php
index ab368d511..ece9bc8c4 100644
--- a/application/models/User_model.php
+++ b/application/models/User_model.php
@@ -370,6 +370,14 @@ class User_Model extends CI_Model {
return $ts;
}
+ // FUNCTION: array getThemes()
+ // Returns a list of themes
+ function getThemes() {
+ $result = $this->db->query('SELECT * FROM themes order by name');
+
+ return $result->result();
+ }
+
// FUNCTION: bool _auth($password, $hash)
// Checks a password against the stored hash
private function _auth($password, $hash) {
diff --git a/application/views/user/add.php b/application/views/user/add.php
index 7157053fe..f6b9f09b5 100644
--- a/application/views/user/add.php
+++ b/application/views/user/add.php
@@ -111,12 +111,15 @@
diff --git a/application/views/user/edit.php b/application/views/user/edit.php
index 3b879e719..20f7c3794 100644
--- a/application/views/user/edit.php
+++ b/application/views/user/edit.php
@@ -94,12 +94,15 @@
From 5995b169c62c2bbdaa224bdbd5ff73e34b42ae45 Mon Sep 17 00:00:00 2001
From: Andreas <6977712+AndreasK79@users.noreply.github.com>
Date: Mon, 9 Aug 2021 13:26:04 +0200
Subject: [PATCH 014/102] [Custom CSS Theme Support] Added migration script for
creating the theme table
---
application/config/migration.php | 2 +-
application/migrations/071_theme_table.php | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
create mode 100644 application/migrations/071_theme_table.php
diff --git a/application/config/migration.php b/application/config/migration.php
index 5b216f923..227bc690e 100644
--- a/application/config/migration.php
+++ b/application/config/migration.php
@@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
| be upgraded / downgraded to.
|
*/
-$config['migration_version'] = 70;
+$config['migration_version'] = 71;
/*
|--------------------------------------------------------------------------
diff --git a/application/migrations/071_theme_table.php b/application/migrations/071_theme_table.php
new file mode 100644
index 000000000..9bcf6ce8b
--- /dev/null
+++ b/application/migrations/071_theme_table.php
@@ -0,0 +1,21 @@
+db->query("create table themes (id integer not null auto_increment, name varchar(256) not null, foldername varchar(256) not null, primary key (id)) ENGINE=myisam DEFAULT CHARSET=utf8;");
+ $this->db->query("INSERT INTO themes (name, foldername) values ('Blue','blue');");
+ $this->db->query("INSERT INTO themes (name, foldername) values ('Cosmo','cosmo');");
+ $this->db->query("INSERT INTO themes (name, foldername) values ('Cyborg (Dark)','cyborg');");
+ $this->db->query("INSERT INTO themes (name, foldername) values ('Darkly (Dark)','darkly');");
+ $this->db->query("INSERT INTO themes (name, foldername) values ('Default','default');");
+ $this->db->query("INSERT INTO themes (name, foldername) values ('Superhero (Dark)','superhero');");
+ }
+
+ public function down(){
+ $this->db->query("");
+
+ }
+}
From d24eeafcdf5271773bf9b59a0b16138c3215fe59 Mon Sep 17 00:00:00 2001
From: Andreas <6977712+AndreasK79@users.noreply.github.com>
Date: Mon, 9 Aug 2021 14:29:53 +0200
Subject: [PATCH 015/102] [Custom CSS Theme Support] Added user interface for
add/edit/delete theme
---
application/controllers/Themes.php | 89 +++++++++++++++++++
application/models/Themes_model.php | 56 ++++++++++++
application/views/interface_assets/footer.php | 65 ++++++++++++++
application/views/interface_assets/header.php | 4 +
application/views/themes/add.php | 38 ++++++++
application/views/themes/edit.php | 50 +++++++++++
application/views/themes/index.php | 51 +++++++++++
7 files changed, 353 insertions(+)
create mode 100644 application/controllers/Themes.php
create mode 100644 application/models/Themes_model.php
create mode 100644 application/views/themes/add.php
create mode 100644 application/views/themes/edit.php
create mode 100644 application/views/themes/index.php
diff --git a/application/controllers/Themes.php b/application/controllers/Themes.php
new file mode 100644
index 000000000..2420e6896
--- /dev/null
+++ b/application/controllers/Themes.php
@@ -0,0 +1,89 @@
+lang->load('contesting');
+
+ $this->load->model('user_model');
+ if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
+ }
+
+ public function index()
+ {
+ $this->load->model('Themes_model');
+
+ $data['themes'] = $this->Themes_model->getThemes();
+
+ // Render Page
+ $data['page_title'] = "Themes";
+ $this->load->view('interface_assets/header', $data);
+ $this->load->view('themes/index.php');
+ $this->load->view('interface_assets/footer');
+ }
+
+ public function add()
+ {
+ $this->load->model('Themes_model');
+ $this->load->library('form_validation');
+
+ $this->form_validation->set_rules('name', 'Theme Name', 'required');
+ $this->form_validation->set_rules('foldername', 'Folder Name', 'required');
+
+ if ($this->form_validation->run() == FALSE)
+ {
+ $data['page_title'] = "Create Theme";
+ $this->load->view('themes/add', $data);
+ }
+ else
+ {
+ $this->Themes_model->add();
+ }
+ }
+
+ public function edit($id)
+ {
+ $this->load->library('form_validation');
+
+ $this->load->model('Themes_model');
+
+ $item_id_clean = $this->security->xss_clean($id);
+
+ $data['theme'] = $this->Themes_model->theme($item_id_clean);
+
+ $data['page_title'] = "Edit Theme";
+
+ $this->form_validation->set_rules('name', 'Theme Name', 'required');
+ $this->form_validation->set_rules('foldername', 'Folder Name', 'required');
+
+ if ($this->form_validation->run() == FALSE)
+ {
+ $this->load->view('interface_assets/header', $data);
+ $this->load->view('themes/edit');
+ $this->load->view('interface_assets/footer');
+ }
+ else
+ {
+ $this->Themes_model->edit($item_id_clean);
+
+ $data['notice'] = "Theme ".$this->security->xss_clean($this->input->post('name', true))." Updated";
+
+ redirect('themes');
+ }
+ }
+
+ public function delete() {
+ $id = $this->input->post('id');
+ $this->load->model('Themes_model');
+ $this->Themes_model->delete($id);
+ }
+}
diff --git a/application/models/Themes_model.php b/application/models/Themes_model.php
new file mode 100644
index 000000000..8f34435c5
--- /dev/null
+++ b/application/models/Themes_model.php
@@ -0,0 +1,56 @@
+db->query('SELECT * FROM themes order by name');
+
+ return $result->result();
+ }
+
+ function delete($id) {
+ // Clean ID
+ $clean_id = $this->security->xss_clean($id);
+
+ // Delete Theme
+ $this->db->delete('themes', array('id' => $clean_id));
+ }
+
+ function add() {
+ $data = array(
+ 'name' => xss_clean($this->input->post('name', true)),
+ 'foldername' => xss_clean($this->input->post('foldername', true)),
+ );
+
+ $this->db->insert('themes', $data);
+ }
+
+
+ function theme($id) {
+ // Clean ID
+ $clean_id = $this->security->xss_clean($id);
+
+ $sql = "SELECT * FROM themes where id =" . $clean_id;
+
+ $data = $this->db->query($sql);
+
+ return ($data->row());
+ }
+
+ function edit($id) {
+ $data = array(
+ 'name' => xss_clean($this->input->post('name', true)),
+ 'foldername' => xss_clean($this->input->post('foldername', true)),
+ );
+
+ $this->db->where('id', $id);
+ $this->db->update('themes', $data);
+ }
+}
diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php
index c8195c332..d6a6e15d3 100644
--- a/application/views/interface_assets/footer.php
+++ b/application/views/interface_assets/footer.php
@@ -2025,6 +2025,71 @@ function deleteQsl(id) {
+uri->segment(1) == "themes") { ?>
+
+
uri->segment(1) == "qslprint") { ?>
+uri->segment(1) == "dxatlas") { ?>
+
+
+
+
+
uri->segment(1) == "qslprint") { ?>