diff --git a/application/controllers/Debug.php b/application/controllers/Debug.php
index 793d53567..0b341f016 100644
--- a/application/controllers/Debug.php
+++ b/application/controllers/Debug.php
@@ -1,21 +1,38 @@
-load->model('user_model');
- if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
+ if (!$this->user_model->authorize(2)) {
+ $this->session->set_flashdata('notice', 'You\'re not allowed to do that!');
+ redirect('dashboard');
+ }
+
+ $this->load->library('Permissions');
}
/* User Facing Links to Backup URLs */
public function index()
{
- $this->load->library('Permissions');
$this->load->helper('file');
$this->load->model('MigrationVersion');
+ $this->load->model('Logbook_model');
+ $this->load->model('Stations');
+
+ $footerData = [];
+ $footerData['scripts'] = ['assets/js/sections/debug.js'];
+
+ $data['stations'] = $this->Stations->all();
+
+ $data['qsos_with_no_station_id'] = $this->Logbook_model->check_for_station_id();
+ if ($data['qsos_with_no_station_id']) {
+ $data['calls_wo_sid'] = $this->Logbook_model->calls_without_station_id();
+ }
$data['migration_version'] = $this->MigrationVersion->getMigrationVersion();
@@ -31,11 +48,130 @@ class Debug extends CI_Controller {
$uploads_folder = $this->permissions->is_really_writable('uploads');
$data['uploads_folder'] = $uploads_folder;
+ // Check if userdata config is enabled
+ $userdata_enabled = $this->config->item('userdata');
+ $data['userdata_enabled'] = $userdata_enabled;
+
+ if (isset($userdata_enabled)) {
+ // Test writing to userdata folder if option is enabled
+ $userdata_folder = $this->permissions->is_really_writable('userdata');
+ $data['userdata_folder'] = $userdata_folder;
+
+ // run the status check and return the array to the view
+ $userdata_status = $this->check_userdata_status($userdata_folder);
+ $data['userdata_status'] = $userdata_status;
+ }
+
$data['page_title'] = "Debug";
$this->load->view('interface_assets/header', $data);
- $this->load->view('debug/main');
- $this->load->view('interface_assets/footer');
+ $this->load->view('debug/index');
+ $this->load->view('interface_assets/footer', $footerData);
}
+ function check_userdata_status($userdata_folder)
+ {
+ $this->load->model('debug_model');
+
+ $status = array();
+
+ // Check if the folder is writable
+ if ($userdata_folder === true) {
+
+ // Check if the qsl and eqsl folders are accessible and if there is any data the user could migrate
+ $qsl_dir = $this->permissions->is_really_writable('assets/qslcard');
+ $eqsl_dir = $this->permissions->is_really_writable('images/eqsl_card_images');
+
+ $flag_file = $this->debug_model->check_migrated_flag();
+
+ if ($qsl_dir && $eqsl_dir) {
+
+ // Check for content of the qsl card folder other than *.html files
+ $qsl_files = glob('assets/qslcard/*');
+ $qsl_files_filtered = array_filter($qsl_files, function ($file) {
+ return !is_dir($file) && pathinfo($file, PATHINFO_EXTENSION) !== 'html';
+ });
+
+ // Check for content of the eqsl card folder other than *.html files
+ $eqsl_files = glob('images/eqsl_card_images/*');
+ $eqsl_files_filtered = array_filter($eqsl_files, function ($file) {
+ return !is_dir($file) && pathinfo($file, PATHINFO_EXTENSION) !== 'html';
+ });
+
+ // Set the status info
+ if (!empty($qsl_files_filtered) || !empty($eqsl_files_filtered)) {
+ if (!$flag_file) {
+ $status['btn_class'] = '';
+ $status['btn_text'] = 'Migrate data now';
+ } else {
+ $status['btn_class'] = '';
+ $status['btn_text'] = 'Migration already done. Run again?';
+ }
+ } else {
+ $status['btn_class'] = 'disabled';
+ $status['btn_text'] = 'No data to migrate';
+ }
+ } else {
+ $status['btn_class'] = 'disabled';
+ $status['btn_text'] = 'No migration possible';
+ }
+ } else {
+ // If the folder is not writable, we don't need to continue
+ $status['btn_class'] = 'disabled';
+ $status['btn_text'] = 'No migration possible';
+ }
+
+ return $status;
+ }
+
+ public function reassign()
+ {
+ $this->load->model('Logbook_model');
+ $this->load->model('Stations');
+
+ $call = xss_clean(($this->input->post('call')));
+ $qsoids = xss_clean(($this->input->post('qsoids')));
+ $station_profile_id = xss_clean(($this->input->post('station_id')));
+
+ log_message('debug', 'station_profile_id:', $station_profile_id);
+ // Check if target-station-id exists
+ $allowed = false;
+ $status = false;
+ $stations = $this->Stations->all();
+ foreach ($stations->result() as $station) {
+ if ($station->station_id == $station_profile_id) {
+ $allowed = true;
+ }
+ }
+ if ($allowed) {
+ $status = $this->Logbook_model->update_station_ids($station_profile_id, $call, $qsoids);
+ } else {
+ $status = false;
+ }
+
+ header('Content-Type: application/json');
+ echo json_encode(array('status' => $status));
+ return;
+ }
+
+ public function migrate_userdata()
+ {
+ // Check if users logged in
+ $this->load->model('user_model');
+ if ($this->user_model->validate_session() == 0) {
+ // user is not logged in
+ redirect('user/login');
+ } else {
+ $this->load->model('debug_model');
+ $migrate = $this->debug_model->migrate_userdata();
+
+ if ($migrate == true) {
+ $this->session->set_flashdata('success', 'File Migration was successfull, but please check also manually. If everything seems right you can delete the folders "assets/qslcard" and "images/eqsl_card_images".');
+ redirect('debug');
+ } else {
+ $this->session->set_flashdata('error', 'File Migration failed. Please check the Error Log.');
+ redirect('debug');
+ }
+ }
+ }
}
diff --git a/application/controllers/Maintenance.php b/application/controllers/Maintenance.php
deleted file mode 100644
index cb509c139..000000000
--- a/application/controllers/Maintenance.php
+++ /dev/null
@@ -1,54 +0,0 @@
-load->model('user_model');
- if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
- }
-
- /* User Facing Links to Maintenance URLs */
- public function index() {
- $this->load->model('Logbook_model');
- $this->load->model('Stations');
- $data['stations']=$this->Stations->all();
- $data['page_title'] = "Maintenance";
- $data['qsos_with_no_station_id'] = $this->Logbook_model->check_for_station_id();
- if ($data['qsos_with_no_station_id']) {
- $data['calls_wo_sid']=$this->Logbook_model->calls_without_station_id();
- }
- $this->load->view('interface_assets/header', $data);
- $this->load->view('maintenance/main');
- $this->load->view('interface_assets/footer');
- }
-
- public function reassign() {
- $this->load->model('Logbook_model');
- $this->load->model('Stations');
- $call = xss_clean(($this->input->post('call')));
- $qsoids = xss_clean(($this->input->post('qsoids')));
- $station_profile_id = xss_clean(($this->input->post('station_id')));
-
- // Check if target-station-id exists
- $allowed=false;
- $status=false;
- $stations=$this->Stations->all();
- foreach ($stations->result() as $station) {
- if ($station->station_id == $station_profile_id) { $allowed=true; }
- }
- if ($allowed) {
- $status=$this->Logbook_model->update_station_ids($station_profile_id,$call,$qsoids);
- } else {
- $status=false;
- }
-
- header('Content-Type: application/json');
- echo json_encode(array('status' => $status));
- return;
-
- }
-
-}
-
-/* End of file Backup.php */
diff --git a/application/language/bulgarian/menu_lang.php b/application/language/bulgarian/menu_lang.php
index 910d8f3cd..b60f4ad2d 100644
--- a/application/language/bulgarian/menu_lang.php
+++ b/application/language/bulgarian/menu_lang.php
@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logout';
$lang['menu_extras'] = "Extras";
-$lang['menu_maintenance']='Maintenance';
diff --git a/application/language/chinese_simplified/menu_lang.php b/application/language/chinese_simplified/menu_lang.php
index dcb068fca..08640518e 100644
--- a/application/language/chinese_simplified/menu_lang.php
+++ b/application/language/chinese_simplified/menu_lang.php
@@ -106,4 +106,3 @@ $lang['menu_forum'] = '论坛';
$lang['menu_logout'] = '注销';
$lang['menu_extras'] = "Extras";
-$lang['menu_maintenance']='维护';
diff --git a/application/language/czech/menu_lang.php b/application/language/czech/menu_lang.php
index 739d8f7df..2131110af 100644
--- a/application/language/czech/menu_lang.php
+++ b/application/language/czech/menu_lang.php
@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Fórum';
$lang['menu_logout'] = 'Odhlásit se';
$lang['menu_extras'] = "Extras";
-$lang['menu_maintenance']='Maintenance';
diff --git a/application/language/dutch/menu_lang.php b/application/language/dutch/menu_lang.php
index 7de91ada9..cbfc52f66 100644
--- a/application/language/dutch/menu_lang.php
+++ b/application/language/dutch/menu_lang.php
@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logout';
$lang['menu_extras'] = "Extras";
-$lang['menu_maintenance']='Maintenance';
diff --git a/application/language/english/menu_lang.php b/application/language/english/menu_lang.php
index e876c1d73..ee57473ba 100644
--- a/application/language/english/menu_lang.php
+++ b/application/language/english/menu_lang.php
@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logout';
$lang['menu_extras'] = "Extras";
-$lang['menu_maintenance']='Maintenance';
diff --git a/application/language/finnish/menu_lang.php b/application/language/finnish/menu_lang.php
index cf35083ef..beace7606 100644
--- a/application/language/finnish/menu_lang.php
+++ b/application/language/finnish/menu_lang.php
@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Foorumi';
$lang['menu_logout'] = 'Kirjaudu ulos';
$lang['menu_extras'] = "Extras";
-$lang['menu_maintenance']='Maintenance';
diff --git a/application/language/french/menu_lang.php b/application/language/french/menu_lang.php
index e876c1d73..ee57473ba 100644
--- a/application/language/french/menu_lang.php
+++ b/application/language/french/menu_lang.php
@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logout';
$lang['menu_extras'] = "Extras";
-$lang['menu_maintenance']='Maintenance';
diff --git a/application/language/german/menu_lang.php b/application/language/german/menu_lang.php
index 1af4842d8..e967676bd 100644
--- a/application/language/german/menu_lang.php
+++ b/application/language/german/menu_lang.php
@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logout';
$lang['menu_extras'] = "Extras";
-$lang['menu_maintenance']='Wartung';
diff --git a/application/language/greek/menu_lang.php b/application/language/greek/menu_lang.php
index e876c1d73..ee57473ba 100644
--- a/application/language/greek/menu_lang.php
+++ b/application/language/greek/menu_lang.php
@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logout';
$lang['menu_extras'] = "Extras";
-$lang['menu_maintenance']='Maintenance';
diff --git a/application/language/italian/menu_lang.php b/application/language/italian/menu_lang.php
index e876c1d73..ee57473ba 100644
--- a/application/language/italian/menu_lang.php
+++ b/application/language/italian/menu_lang.php
@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logout';
$lang['menu_extras'] = "Extras";
-$lang['menu_maintenance']='Maintenance';
diff --git a/application/language/polish/menu_lang.php b/application/language/polish/menu_lang.php
index e876c1d73..ee57473ba 100644
--- a/application/language/polish/menu_lang.php
+++ b/application/language/polish/menu_lang.php
@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logout';
$lang['menu_extras'] = "Extras";
-$lang['menu_maintenance']='Maintenance';
diff --git a/application/language/russian/menu_lang.php b/application/language/russian/menu_lang.php
index 6d7de7f09..bce605cea 100644
--- a/application/language/russian/menu_lang.php
+++ b/application/language/russian/menu_lang.php
@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Форум';
$lang['menu_logout'] = 'Выход';
$lang['menu_extras'] = "Extras";
-$lang['menu_maintenance']='Обслуживание';
diff --git a/application/language/spanish/menu_lang.php b/application/language/spanish/menu_lang.php
index 1880ecb3a..c2838d597 100644
--- a/application/language/spanish/menu_lang.php
+++ b/application/language/spanish/menu_lang.php
@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logout';
$lang['menu_extras'] = "Extras";
-$lang['menu_maintenance']='Maintenance';
diff --git a/application/language/swedish/menu_lang.php b/application/language/swedish/menu_lang.php
index 5576642bf..7e21a4c06 100644
--- a/application/language/swedish/menu_lang.php
+++ b/application/language/swedish/menu_lang.php
@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logga ut';
$lang['menu_extras'] = "Extras";
-$lang['menu_maintenance']='Underhåll';
diff --git a/application/language/turkish/menu_lang.php b/application/language/turkish/menu_lang.php
index e876c1d73..ee57473ba 100644
--- a/application/language/turkish/menu_lang.php
+++ b/application/language/turkish/menu_lang.php
@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logout';
$lang['menu_extras'] = "Extras";
-$lang['menu_maintenance']='Maintenance';
diff --git a/application/models/Debug_model.php b/application/models/Debug_model.php
new file mode 100644
index 000000000..1253543b0
--- /dev/null
+++ b/application/models/Debug_model.php
@@ -0,0 +1,156 @@
+userdata_dir = $this->config->item('userdata');
+ $this->flag_file = '.migrated'; // we use this flag file to determine if the migration already run through
+
+ $this->src_eqsl = 'images/eqsl_card_images';
+ $this->eqsl_dir = 'eqsl_card'; // make sure this is the same as in Eqsl_images.php function get_imagePath()
+
+ $this->src_qsl = 'assets/qslcard';
+ $this->qsl_dir = 'qsl_card'; // make sure this is the same as in Qsl_model.php function get_imagePath()
+ }
+
+ function migrate_userdata()
+ {
+
+ $this->load->model('Logbook_model');
+
+ $allowed_file_extensions = ['jpg', 'jpeg', 'gif', 'png'];
+
+ // ***** EQSL ***** //
+
+ // Let's scan the whole folder and get necessary data for each file
+ foreach (scandir($this->src_eqsl) as $file) {
+ // Ignore files if they are not jpg, png or gif
+ $file_extension = strtolower(pathinfo($file, PATHINFO_EXTENSION));
+ if (!in_array($file_extension, $allowed_file_extensions)) continue;
+
+ if (!is_readable($this->src_eqsl . '/' . $file)) continue;
+ if ($file != '.' && $file != '..') {
+
+ // we need the qso_id from the database to get the necessary user_id
+ $qso_id = $this->get_qsoid_from_eqsl_filename($file) ?? '';
+
+ // check if the qso_id is empty, if yes we create a folder 'not assigned' instead of 'user_id'
+ if (!empty($qso_id)) {
+ // get the user_id for this qso_id
+ $get_user_id = $this->Logbook_model->get_user_id_from_qso($qso_id);
+
+ // it can happen that the user_id is empty even there is a qso_id (deleted qso or deleted user)
+ if(!empty($get_user_id)) {
+ $user_id = $get_user_id;
+ } else {
+ $user_id = 'not_assigned';
+ }
+ } else {
+ $user_id = 'not_assigned';
+ }
+
+ // make sure the target path exists
+ $target = $this->userdata_dir . '/' . $user_id . '/' . $this->eqsl_dir;
+ if (!file_exists(realpath(APPPATH . '../') . '/' . $target)) {
+ mkdir(realpath(APPPATH . '../') . '/' . $target, 0755, true);
+ }
+
+ // then copy the file
+ if (!copy($this->src_eqsl . '/' . $file, $target . '/' . $file)) {
+ return false; // Failed to copy file
+ }
+ }
+ }
+
+ // ***** QSL Cards ***** //
+
+ // Let's scan the whole folder and get necessary data for each file
+ foreach (scandir($this->src_qsl) as $file) {
+ // Ignore files if they are not jpg, png or gif
+ $file_extension = strtolower(pathinfo($file, PATHINFO_EXTENSION));
+ if (!in_array($file_extension, $allowed_file_extensions)) continue;
+
+ if (!is_readable($this->src_qsl . '/' . $file)) continue;
+ if ($file != '.' && $file != '..') {
+
+ // we need the qso_id from the database to get the necessary user_id
+ $qso_id = $this->get_qsoid_from_qsl_filename($file) ?? '';
+
+ // check if the qso_id is empty, if yes we create a folder 'not assigned' instead of 'user_id'
+ if (!empty($qso_id)) {
+ // get the user_id for this qso_id
+ $get_user_id = $this->Logbook_model->get_user_id_from_qso($qso_id);
+
+ // it can happen that the user_id is empty even there is a qso_id (deleted qso or deleted user)
+ if(!empty($get_user_id)) {
+ $user_id = $get_user_id;
+ } else {
+ $user_id = 'not_assigned';
+ }
+ } else {
+ $user_id = 'not_assigned';
+ }
+
+ // make sure the target path exists
+ $target = $this->userdata_dir . '/' . $user_id . '/' . $this->qsl_dir;
+ if (!file_exists(realpath(APPPATH . '../') . '/' . $target)) {
+ mkdir(realpath(APPPATH . '../') . '/' . $target, 0755, true);
+ }
+
+ // then copy the file
+ if (!copy($this->src_qsl . '/' . $file, $target . '/' . $file)) {
+ return false; // Failed to copy file
+ }
+ }
+ }
+
+ // here we create the 'migrated' flag
+ if (!file_exists(realpath(APPPATH . '../') . '/' . $this->userdata_dir . '/' . $this->flag_file)) {
+ touch(realpath(APPPATH . '../') . '/' . $this->userdata_dir . '/' . $this->flag_file);
+ }
+
+ return true;
+ }
+
+ function check_migrated_flag()
+ {
+ if (!file_exists(realpath(APPPATH . '../') . '/' . $this->userdata_dir . '/' . $this->flag_file)) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ function get_qsoid_from_eqsl_filename($filename)
+ {
+
+ $sql = "SELECT qso_id FROM eQSL_images WHERE image_file = ?";
+
+ $result = $this->db->query($sql, $filename);
+
+ $row = $result->row();
+ return $row->qso_id;
+ }
+
+ function get_qsoid_from_qsl_filename($filename)
+ {
+
+ $sql = "SELECT qsoid FROM qsl_images WHERE filename = ?";
+
+ $result = $this->db->query($sql, $filename);
+
+ $row = $result->row();
+ return $row->qsoid;
+ }
+}
diff --git a/application/models/Eqsl_images.php b/application/models/Eqsl_images.php
index ab18f05f5..b94e0309f 100644
--- a/application/models/Eqsl_images.php
+++ b/application/models/Eqsl_images.php
@@ -43,7 +43,7 @@ class Eqsl_images extends CI_Model {
if (isset($userdata_dir)) {
- $eqsl_dir = "eqsl_card";
+ $eqsl_dir = "eqsl_card"; // make sure this is the same as in Debug_model.php function migrate_userdata()
$user_id = $this->session->userdata('user_id');
diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php
index cf76d68fc..1a297c3bf 100755
--- a/application/models/Logbook_model.php
+++ b/application/models/Logbook_model.php
@@ -4511,7 +4511,7 @@ function lotw_last_qsl_date($user_id) {
}
public function check_for_station_id() {
- $this->db->select('COL_PRIMARY_KEY, COL_TIME_ON, COL_CALL, COL_MODE, COL_BAND');
+ $this->db->select('COL_PRIMARY_KEY, COL_TIME_ON, COL_CALL, COL_MODE, COL_BAND, COL_STATION_CALLSIGN');
$this->db->where('station_id =', NULL);
$query = $this->db->get($this->config->item('table_name'));
if($query->num_rows() >= 1) {
@@ -4785,6 +4785,21 @@ function lotw_last_qsl_date($user_id) {
}
return $confirmed;
}
+
+ public function get_user_id_from_qso($qso_id) {
+
+ $clean_qsoid = $this->security->xss_clean($qso_id);
+
+ $sql = 'SELECT station_profile.user_id
+ FROM '.$this->config->item('table_name').'
+ INNER JOIN station_profile ON ('.$this->config->item('table_name').'.station_id = station_profile.station_id)
+ WHERE '.$this->config->item('table_name').'.COL_PRIMARY_KEY = ?';
+
+ $result = $this->db->query($sql, $clean_qsoid);
+ $row = $result->row();
+
+ return $row->user_id;
+ }
}
function validateADIFDate($date, $format = 'Ymd')
diff --git a/application/models/Qsl_model.php b/application/models/Qsl_model.php
index 8f22abb2e..6a8e26f00 100644
--- a/application/models/Qsl_model.php
+++ b/application/models/Qsl_model.php
@@ -1,9 +1,8 @@
load->model('logbooks_model');
- $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
+ $this->load->model('logbooks_model');
+ $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->db->select('*');
$this->db->from($this->config->item('table_name'));
@@ -19,9 +18,8 @@ class Qsl_model extends CI_Model {
$clean_id = $this->security->xss_clean($id);
// be sure that QSO belongs to user
- $CI =& get_instance();
- $CI->load->model('logbook_model');
- if (!$CI->logbook_model->check_qso_is_accessible($clean_id)) {
+ $this->load->model('logbook_model');
+ if (!$this->logbook_model->check_qso_is_accessible($clean_id)) {
return;
}
@@ -37,9 +35,8 @@ class Qsl_model extends CI_Model {
$clean_id = $this->security->xss_clean($qsoid);
// be sure that QSO belongs to user
- $CI =& get_instance();
- $CI->load->model('logbook_model');
- if (!$CI->logbook_model->check_qso_is_accessible($clean_id)) {
+ $this->load->model('logbook_model');
+ if (!$this->logbook_model->check_qso_is_accessible($clean_id)) {
return;
}
@@ -58,13 +55,12 @@ class Qsl_model extends CI_Model {
$clean_id = $this->security->xss_clean($id);
// be sure that QSO belongs to user
- $CI =& get_instance();
- $CI->load->model('logbook_model');
+ $this->load->model('logbook_model');
$this->db->select('qsoid');
$this->db->from('qsl_images');
$this->db->where('id', $clean_id);
$qsoid = $this->db->get()->row()->qsoid;
- if (!$CI->logbook_model->check_qso_is_accessible($qsoid)) {
+ if (!$this->logbook_model->check_qso_is_accessible($qsoid)) {
return;
}
@@ -77,13 +73,12 @@ class Qsl_model extends CI_Model {
$clean_id = $this->security->xss_clean($id);
// be sure that QSO belongs to user
- $CI =& get_instance();
- $CI->load->model('logbook_model');
+ $this->load->model('logbook_model');
$this->db->select('qsoid');
$this->db->from('qsl_images');
$this->db->where('id', $clean_id);
$qsoid = $this->db->get()->row()->qsoid;
- if (!$CI->logbook_model->check_qso_is_accessible($qsoid)) {
+ if (!$this->logbook_model->check_qso_is_accessible($qsoid)) {
return;
}
@@ -95,9 +90,8 @@ class Qsl_model extends CI_Model {
}
function searchQsos($callsign) {
- $CI =& get_instance();
- $CI->load->model('logbooks_model');
- $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
+ $this->load->model('logbooks_model');
+ $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->db->select('*');
$this->db->from($this->config->item('table_name'));
@@ -112,15 +106,14 @@ class Qsl_model extends CI_Model {
$clean_filename = $this->security->xss_clean($filename);
// be sure that QSO belongs to user
- $CI =& get_instance();
- $CI->load->model('logbook_model');
- if (!$CI->logbook_model->check_qso_is_accessible($clean_qsoid)) {
+ $this->load->model('logbook_model');
+ if (!$this->logbook_model->check_qso_is_accessible($clean_qsoid)) {
return;
}
$data = array(
'qsoid' => $clean_qsoid,
- 'filename' => $filename
+ 'filename' => $clean_filename
);
$this->db->insert('qsl_images', $data);
@@ -136,7 +129,7 @@ class Qsl_model extends CI_Model {
if (isset($userdata_dir)) {
- $qsl_dir = "qsl_card";
+ $qsl_dir = "qsl_card"; // make sure this is the same as in Debug_model.php function migrate_userdata()
$user_id = $this->session->userdata('user_id');
diff --git a/application/views/debug/index.php b/application/views/debug/index.php
new file mode 100644
index 000000000..dba2c7f92
--- /dev/null
+++ b/application/views/debug/index.php
@@ -0,0 +1,459 @@
+
+
+ session->flashdata('success')) { ?>
+
+
+
session->flashdata('success'); ?>
+
+
+
+ session->flashdata('error')) { ?>
+
+
+
session->flashdata('error'); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Version
+ optionslib->get_option('version') . "\n"; ?>
+
+
+ Language
+ config->item('language')) . "\n"; ?>
+
+
+ Base URL
+ config->item('base_url'); ?> ")'>
+
+
+ Migration
+ There is something wrong with your Migration in Database!"); ?>
+
+
+
+
+
+
+
+
+
+
+
+ Server Software
+
+
+
+
+ PHP Version
+
+
+
+
+ MySQL Version
+ db->version(); ?>
+
+
+
+
+
+
+
+
+
+
+
This checks the folders Wavelog uses are read and writeable by PHP.
+
+
+ /backup
+
+
+ Success
+
+ Failed
+
+
+
+
+
+ /updates
+
+
+ Success
+
+ Failed
+
+
+
+
+
+ /uploads
+
+
+ Success
+
+ Failed
+
+
+
+
+
+
+ /userdata
+
+
+ Success
+
+ Failed
+
+
+
+
+
+
+
+
+
+
+
+
Here you can migrate existing QSL cards and eQSL cards to the new userdata folder.
+
+
+
+
+
+
+
+
+
+
+
+
+ curl
+
+
+ Installed
+
+ Not Installed
+
+
+
+
+
+ MySQL
+
+
+ Installed
+
+ Not Installed
+
+
+
+
+
+ mbstring
+
+
+ Installed
+
+ Not Installed
+
+
+
+
+
+ xml
+
+
+ Installed
+
+ Not Installed
+
+
+
+
+
+ zip
+
+
+ Installed
+
+ Not Installed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Branch
+
+
+
+
+
+
+
+
+
+
+ n/a
+
+
+
+
+
+ Commit
+
+
+
+
+ n/a
+
+
+
+
+ Tag
+
+
+
+
+ n/a
+
+
+
+
+ Last Fetch
+
+ format(\DateTime::RFC850)); ?>
+
+
+
+
+
+
+ session->userdata('user_date_format')) {
+ // If Logged in and session exists
+ $custom_date_format = $this->session->userdata('user_date_format');
+ } else {
+ // Get Default date format from /config/wavelog.php
+ $custom_date_format = $this->config->item('qso_date_format');
+ }
+ ?>
+
+
+
+
+
+ File
+ Last update
+
+
+
+ DXCC update from Club Log
+ optionslib->get_option('dxcc_clublog_update') ?? '') == '' ? '' : date($custom_date_format, strtotime($this->optionslib->get_option('dxcc_clublog_update') ?? '')) . ' ' . date("h:i", strtotime($this->optionslib->get_option('dxcc_clublog_update') ?? ''))) ?>
+ Update
+
+
+
+ DOK file download
+ optionslib->get_option('dok_file_update') ?? '') == '' ? '' : date($custom_date_format, strtotime($this->optionslib->get_option('dok_file_update') ?? '')) . ' ' . date("h:i", strtotime($this->optionslib->get_option('dok_file_update') ?? ''))) ?>
+ Update
+
+
+ LoTW users download
+ optionslib->get_option('lotw_users_update') ?? '') == '' ? '' : date($custom_date_format, strtotime($this->optionslib->get_option('lotw_users_update') ?? '')) . ' ' . date("h:i", strtotime($this->optionslib->get_option('lotw_users_update') ?? ''))) ?>
+ Update
+
+
+ POTA file download
+ optionslib->get_option('pota_file_update') ?? '') == '' ? '' : date($custom_date_format, strtotime($this->optionslib->get_option('pota_file_update') ?? '')) . ' ' . date("h:i", strtotime($this->optionslib->get_option('pota_file_update') ?? ''))) ?>
+ Update
+
+
+ SCP file download
+ optionslib->get_option('scp_update') ?? '') == '' ? '' : date($custom_date_format, strtotime($this->optionslib->get_option('scp_update') ?? '')) . ' ' . date("h:i", strtotime($this->optionslib->get_option('scp_update') ?? ''))) ?>
+ Update
+
+
+ SOTA file download
+ optionslib->get_option('sota_file_update') ?? '') == '' ? '' : date($custom_date_format, strtotime($this->optionslib->get_option('sota_file_update') ?? '')) . ' ' . date("h:i", strtotime($this->optionslib->get_option('sota_file_update') ?? ''))) ?>
+ Update
+
+
+ WWFF file download
+ optionslib->get_option('wwff_file_update') ?? '') == '' ? '' : date($custom_date_format, strtotime($this->optionslib->get_option('wwff_file_update') ?? '')) . ' ' . date("h:i", strtotime($this->optionslib->get_option('wwff_file_update') ?? ''))) ?>
+ Update
+
+
+
+
+
+
+
+
+ Warning The Database contains QSO 1 ? 's' : '' ?> without a station-profile (location)
+
+
+
+
Please mark QSOs and reassign them to an existing station location:
+
+
+
+
+
+
+ Call
+ Target Location
+ Reassign
+
+
+
+ ' . $call['COL_STATION_CALLSIGN'] . '
';
+ $options = '';
+ foreach ($stations->result() as $station) {
+ $options .= '' . $station->station_profile_name . ' (' . $station->station_callsign . ') ';
+ }
+ echo $options . ' Reassign ';
+ } ?>
+
+
+
+
+
+
+ Everything ok Every QSO in your Database is assigned to a station-profile (location)
+
+
+
+
+
+
+ config->item('cl_multilanguage')) { ?>
+
+ Warning You didn't enabled Multilanguage support in your config.php
+
+
+
Please edit your ./application/config/config.php File and add some rows to it:
+ Go to your application/config Folder and compare config.sample.php with your config.php
+ You'll probably find a block with language-settings. Please include this block into your current config.php
+
+
+
+
+
+ Everything ok You have enabled Multuser-Language support
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/views/debug/main.php b/application/views/debug/main.php
deleted file mode 100644
index 592038655..000000000
--- a/application/views/debug/main.php
+++ /dev/null
@@ -1,324 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- Version
- optionslib->get_option('version')."\n"; ?>
-
-
- Language
- config->item('language'))."\n"; ?>
-
-
- Base URL
- config->item('base_url'); ?> ")'>
-
-
- Migration
- There is something wrong with your Migration in Database!"); ?>
-
-
-
-
-
-
-
-
-
-
-
- Server Software
-
-
-
-
- PHP Version
-
-
-
-
- MySQL Version
- db->version(); ?>
-
-
-
-
-
-
-
-
-
-
-
This checks the folders Wavelog uses are read and writeable by PHP.
-
-
- /backup
-
-
- Success
-
- Failed
-
-
-
-
-
- /updates
-
-
- Success
-
- Failed
-
-
-
-
-
- /uploads
-
-
- Success
-
- Failed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- curl
-
-
- Installed
-
- Not Installed
-
-
-
-
-
- MySQL
-
-
- Installed
-
- Not Installed
-
-
-
-
-
- mbstring
-
-
- Installed
-
- Not Installed
-
-
-
-
-
- xml
-
-
- Installed
-
- Not Installed
-
-
-
-
-
- zip
-
-
- Installed
-
- Not Installed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Branch
-
-
-
-
-
-
-
-
-
-
- n/a
-
-
-
-
-
- Commit
-
-
-
-
- n/a
-
-
-
-
- Tag
-
-
-
-
- n/a
-
-
-
-
- Last Fetch
-
- format(\DateTime::RFC850)); ?>
-
-
-
-
-
-
- session->userdata('user_date_format')) {
- // If Logged in and session exists
- $custom_date_format = $this->session->userdata('user_date_format');
- } else {
- // Get Default date format from /config/wavelog.php
- $custom_date_format = $this->config->item('qso_date_format');
- }
- ?>
-
-
-
-
-
- File
- Last update
-
-
-
- DXCC update from Club Log
- optionslib->get_option('dxcc_clublog_update') ?? '') == '' ? '' : date($custom_date_format, strtotime($this->optionslib->get_option('dxcc_clublog_update') ?? '')) . ' ' . date("h:i", strtotime($this->optionslib->get_option('dxcc_clublog_update') ?? ''))) ?>
- Update
-
-
-
- DOK file download
- optionslib->get_option('dok_file_update') ?? '') == '' ? '' : date($custom_date_format, strtotime($this->optionslib->get_option('dok_file_update') ?? '')) . ' ' . date("h:i", strtotime($this->optionslib->get_option('dok_file_update') ?? ''))) ?>
- Update
-
-
- LoTW users download
- optionslib->get_option('lotw_users_update') ?? '') == '' ? '' : date($custom_date_format, strtotime($this->optionslib->get_option('lotw_users_update') ?? '')) . ' ' . date("h:i", strtotime($this->optionslib->get_option('lotw_users_update') ?? ''))) ?>
- Update
-
-
- POTA file download
- optionslib->get_option('pota_file_update') ?? '') == '' ? '' : date($custom_date_format, strtotime($this->optionslib->get_option('pota_file_update') ?? '')) . ' ' . date("h:i", strtotime($this->optionslib->get_option('pota_file_update') ?? ''))) ?>
- Update
-
-
- SCP file download
- optionslib->get_option('scp_update') ?? '') == '' ? '' : date($custom_date_format, strtotime($this->optionslib->get_option('scp_update') ?? '')) . ' ' . date("h:i", strtotime($this->optionslib->get_option('scp_update') ?? ''))) ?>
- Update
-
-
- SOTA file download
- optionslib->get_option('sota_file_update') ?? '') == '' ? '' : date($custom_date_format, strtotime($this->optionslib->get_option('sota_file_update') ?? '')) . ' ' . date("h:i", strtotime($this->optionslib->get_option('sota_file_update') ?? ''))) ?>
- Update
-
-
- WWFF file downlaod
- optionslib->get_option('wwff_file_update') ?? '') == '' ? '' : date($custom_date_format, strtotime($this->optionslib->get_option('wwff_file_update') ?? '')) . ' ' . date("h:i", strtotime($this->optionslib->get_option('wwff_file_update') ?? ''))) ?>
- Update
-
-
-
-
-
-
-
-
-
diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php
index d5d5b601a..0ff09946b 100644
--- a/application/views/interface_assets/footer.php
+++ b/application/views/interface_assets/footer.php
@@ -145,10 +145,6 @@ if($this->session->userdata('user_id') != null) {
-uri->segment(1) == "maintenance" ) { ?>
-
-
-
uri->segment(1) == "adif" ) { ?>
diff --git a/application/views/interface_assets/header.php b/application/views/interface_assets/header.php
index 1eb5e9d38..0673f45a9 100644
--- a/application/views/interface_assets/header.php
+++ b/application/views/interface_assets/header.php
@@ -223,8 +223,6 @@
-
-
diff --git a/application/views/maintenance/main.php b/application/views/maintenance/main.php
deleted file mode 100644
index 7b36560a2..000000000
--- a/application/views/maintenance/main.php
+++ /dev/null
@@ -1,111 +0,0 @@
-
-
- session->flashdata('message')) { ?>
-
-
-
session->flashdata('message'); ?>
-
-
-
-
-
-
-
-
-
- Warning The Database contains QSO 1 ? 's' : '' ?> without a station-profile (location)
-
-
-
-
Please reassign those QSOs to an existing station location:
-
-
-
-
-
-
- Call
- Target Location
- Reassign
-
-
-
- '.$call['COL_STATION_CALLSIGN'].'
';
- $options='';
- foreach ($stations->result() as $station) {
- $options.=''.$station->station_profile_name.' ('.$station->station_callsign.') ';
- }
- echo $options.' Reassign ';
- } ?>
-
-
-
-
-
-
- Everything ok Every QSO in your Database is assigned to a station-profile (location)
-
-
-
-
-
-
- config->item('cl_multilanguage')) { ?>
-
- Warning You didn't enabled Multilanguage support in your config.php
-
-
-
Please edit your ./application/config/config.php File and add some rows to it:
- Go to your application/config Folder and compare config.sample.php with your config.php
- You'll probably find a block with language-settings. Please include this block into your current config.php
-
-
-
-
-
- Everything ok You have enabled Multuser-Language support
-
-
-
-
-
diff --git a/application/views/station_profile/index.php b/application/views/station_profile/index.php
index cd4b5df77..6e6c09a30 100644
--- a/application/views/station_profile/index.php
+++ b/application/views/station_profile/index.php
@@ -30,7 +30,7 @@
diff --git a/assets/js/sections/maintenance.js b/assets/js/sections/debug.js
similarity index 65%
rename from assets/js/sections/maintenance.js
rename to assets/js/sections/debug.js
index 9c66af94a..6f9ca63fe 100644
--- a/assets/js/sections/maintenance.js
+++ b/assets/js/sections/debug.js
@@ -1,4 +1,4 @@
-function reassign(call,target_profile_id) {
+function reassign(call, target_profile_id) {
let qsoids = [];
let elements = document.getElementsByName("cBox[]");
elements.forEach((item) => {
@@ -7,37 +7,40 @@ function reassign(call,target_profile_id) {
}
});
$.ajax({
- url: base_url + 'index.php/maintenance/reassign',
- type: 'post',
- data: {'call': call, 'station_id': target_profile_id, 'qsoids' : qsoids},
+ url: base_url + "index.php/debug/reassign",
+ type: "post",
+ data: { call: call, station_id: target_profile_id, qsoids: qsoids },
success: function (resu) {
if (resu.status) {
location.reload();
}
- }
+ },
});
}
function toggleAll(source) {
- console.log('test');
if (source.checked) {
let elements = document.getElementsByName("cBox[]");
elements.forEach((item) => {
item.checked = true;
- })
+ });
source.checked = true;
}
if (!source.checked) {
let elements = document.getElementsByName("cBox[]");
elements.forEach((item) => {
item.checked = false;
- })
+ });
source.checked = false;
}
}
function updateCallsign(item) {
- let text = item.options[item.selectedIndex].text
- let call = text.substr(text.lastIndexOf('(')+1,(text.lastIndexOf(')')-text.lastIndexOf('(')-1));
+ let text = item.options[item.selectedIndex].text;
+ let call = text.substr(
+ text.lastIndexOf("(") + 1,
+ text.lastIndexOf(")") - text.lastIndexOf("(") - 1
+ );
document.getElementById("station_call").innerHTML = call;
}
+
diff --git a/images/eqsl_card_images/index.html b/images/eqsl_card_images/index.html
new file mode 100644
index 000000000..c942a79ce
--- /dev/null
+++ b/images/eqsl_card_images/index.html
@@ -0,0 +1,10 @@
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
\ No newline at end of file
diff --git a/images/eqsl_card_images/readme.txt b/images/eqsl_card_images/readme.txt
deleted file mode 100644
index d53bdb81d..000000000
--- a/images/eqsl_card_images/readme.txt
+++ /dev/null
@@ -1 +0,0 @@
-This folders used to store downloaded eqsl card images.
\ No newline at end of file