QSL Files Migration (#174)

* remove unnessesary file

* prepared debug view with logic

* typo

* add additional case

* moved Maintenance Page to Debug

* copy function

* comment

* html file for eqsl card images folder

* only copy files if they have a qso_id in db

* not_assigned folder

* xss_clean

* $CI to $this

* removed status field, no need for that

* class wide variabled to reduce redundancy

* adjusted view

* allow run migration agn

* missing case if user_id is also empty (deleted user/qso)

* just commented

* only allow jpg, png and gif (same as in upload)
This commit is contained in:
HB9HIL
2024-02-26 17:42:46 +01:00
committed by GitHub
parent b20f81d0ef
commit c1325591cc
30 changed files with 814 additions and 553 deletions

View File

@@ -1,21 +1,38 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Debug extends CI_Controller { class Debug extends CI_Controller
{
function __construct() function __construct()
{ {
parent::__construct(); parent::__construct();
$this->load->model('user_model'); $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'); } 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 */ /* User Facing Links to Backup URLs */
public function index() public function index()
{ {
$this->load->library('Permissions');
$this->load->helper('file'); $this->load->helper('file');
$this->load->model('MigrationVersion'); $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(); $data['migration_version'] = $this->MigrationVersion->getMigrationVersion();
@@ -31,11 +48,130 @@ class Debug extends CI_Controller {
$uploads_folder = $this->permissions->is_really_writable('uploads'); $uploads_folder = $this->permissions->is_really_writable('uploads');
$data['uploads_folder'] = $uploads_folder; $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"; $data['page_title'] = "Debug";
$this->load->view('interface_assets/header', $data); $this->load->view('interface_assets/header', $data);
$this->load->view('debug/main'); $this->load->view('debug/index');
$this->load->view('interface_assets/footer'); $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');
}
}
}
} }

View File

@@ -1,54 +0,0 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Maintenance extends CI_Controller {
function __construct()
{
parent::__construct();
$this->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 */

View File

@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logout'; $lang['menu_logout'] = 'Logout';
$lang['menu_extras'] = "Extras"; $lang['menu_extras'] = "Extras";
$lang['menu_maintenance']='Maintenance';

View File

@@ -106,4 +106,3 @@ $lang['menu_forum'] = '论坛';
$lang['menu_logout'] = '注销'; $lang['menu_logout'] = '注销';
$lang['menu_extras'] = "Extras"; $lang['menu_extras'] = "Extras";
$lang['menu_maintenance']='维护';

View File

@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Fórum';
$lang['menu_logout'] = 'Odhlásit se'; $lang['menu_logout'] = 'Odhlásit se';
$lang['menu_extras'] = "Extras"; $lang['menu_extras'] = "Extras";
$lang['menu_maintenance']='Maintenance';

View File

@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logout'; $lang['menu_logout'] = 'Logout';
$lang['menu_extras'] = "Extras"; $lang['menu_extras'] = "Extras";
$lang['menu_maintenance']='Maintenance';

View File

@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logout'; $lang['menu_logout'] = 'Logout';
$lang['menu_extras'] = "Extras"; $lang['menu_extras'] = "Extras";
$lang['menu_maintenance']='Maintenance';

View File

@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Foorumi';
$lang['menu_logout'] = 'Kirjaudu ulos'; $lang['menu_logout'] = 'Kirjaudu ulos';
$lang['menu_extras'] = "Extras"; $lang['menu_extras'] = "Extras";
$lang['menu_maintenance']='Maintenance';

View File

@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logout'; $lang['menu_logout'] = 'Logout';
$lang['menu_extras'] = "Extras"; $lang['menu_extras'] = "Extras";
$lang['menu_maintenance']='Maintenance';

View File

@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logout'; $lang['menu_logout'] = 'Logout';
$lang['menu_extras'] = "Extras"; $lang['menu_extras'] = "Extras";
$lang['menu_maintenance']='Wartung';

View File

@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logout'; $lang['menu_logout'] = 'Logout';
$lang['menu_extras'] = "Extras"; $lang['menu_extras'] = "Extras";
$lang['menu_maintenance']='Maintenance';

View File

@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logout'; $lang['menu_logout'] = 'Logout';
$lang['menu_extras'] = "Extras"; $lang['menu_extras'] = "Extras";
$lang['menu_maintenance']='Maintenance';

View File

@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logout'; $lang['menu_logout'] = 'Logout';
$lang['menu_extras'] = "Extras"; $lang['menu_extras'] = "Extras";
$lang['menu_maintenance']='Maintenance';

View File

@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Форум';
$lang['menu_logout'] = 'Выход'; $lang['menu_logout'] = 'Выход';
$lang['menu_extras'] = "Extras"; $lang['menu_extras'] = "Extras";
$lang['menu_maintenance']='Обслуживание';

View File

@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logout'; $lang['menu_logout'] = 'Logout';
$lang['menu_extras'] = "Extras"; $lang['menu_extras'] = "Extras";
$lang['menu_maintenance']='Maintenance';

View File

@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logga ut'; $lang['menu_logout'] = 'Logga ut';
$lang['menu_extras'] = "Extras"; $lang['menu_extras'] = "Extras";
$lang['menu_maintenance']='Underhåll';

View File

@@ -106,4 +106,3 @@ $lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logout'; $lang['menu_logout'] = 'Logout';
$lang['menu_extras'] = "Extras"; $lang['menu_extras'] = "Extras";
$lang['menu_maintenance']='Maintenance';

View File

@@ -0,0 +1,156 @@
<?php
class Debug_model extends CI_Model
{
private $userdata_dir;
private $flag_file;
private $src_eqsl;
private $eqsl_dir;
private $src_qsl;
private $qsl_dir;
public function __construct()
{
$this->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;
}
}

View File

@@ -43,7 +43,7 @@ class Eqsl_images extends CI_Model {
if (isset($userdata_dir)) { 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'); $user_id = $this->session->userdata('user_id');

View File

@@ -4511,7 +4511,7 @@ function lotw_last_qsl_date($user_id) {
} }
public function check_for_station_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); $this->db->where('station_id =', NULL);
$query = $this->db->get($this->config->item('table_name')); $query = $this->db->get($this->config->item('table_name'));
if($query->num_rows() >= 1) { if($query->num_rows() >= 1) {
@@ -4785,6 +4785,21 @@ function lotw_last_qsl_date($user_id) {
} }
return $confirmed; 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') function validateADIFDate($date, $format = 'Ymd')

View File

@@ -1,9 +1,8 @@
<?php <?php
class Qsl_model extends CI_Model { class Qsl_model extends CI_Model {
function getQsoWithQslList() { function getQsoWithQslList() {
$CI =& get_instance(); $this->load->model('logbooks_model');
$CI->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->db->select('*'); $this->db->select('*');
$this->db->from($this->config->item('table_name')); $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); $clean_id = $this->security->xss_clean($id);
// be sure that QSO belongs to user // be sure that QSO belongs to user
$CI =& get_instance(); $this->load->model('logbook_model');
$CI->load->model('logbook_model'); if (!$this->logbook_model->check_qso_is_accessible($clean_id)) {
if (!$CI->logbook_model->check_qso_is_accessible($clean_id)) {
return; return;
} }
@@ -37,9 +35,8 @@ class Qsl_model extends CI_Model {
$clean_id = $this->security->xss_clean($qsoid); $clean_id = $this->security->xss_clean($qsoid);
// be sure that QSO belongs to user // be sure that QSO belongs to user
$CI =& get_instance(); $this->load->model('logbook_model');
$CI->load->model('logbook_model'); if (!$this->logbook_model->check_qso_is_accessible($clean_id)) {
if (!$CI->logbook_model->check_qso_is_accessible($clean_id)) {
return; return;
} }
@@ -58,13 +55,12 @@ class Qsl_model extends CI_Model {
$clean_id = $this->security->xss_clean($id); $clean_id = $this->security->xss_clean($id);
// be sure that QSO belongs to user // be sure that QSO belongs to user
$CI =& get_instance(); $this->load->model('logbook_model');
$CI->load->model('logbook_model');
$this->db->select('qsoid'); $this->db->select('qsoid');
$this->db->from('qsl_images'); $this->db->from('qsl_images');
$this->db->where('id', $clean_id); $this->db->where('id', $clean_id);
$qsoid = $this->db->get()->row()->qsoid; $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; return;
} }
@@ -77,13 +73,12 @@ class Qsl_model extends CI_Model {
$clean_id = $this->security->xss_clean($id); $clean_id = $this->security->xss_clean($id);
// be sure that QSO belongs to user // be sure that QSO belongs to user
$CI =& get_instance(); $this->load->model('logbook_model');
$CI->load->model('logbook_model');
$this->db->select('qsoid'); $this->db->select('qsoid');
$this->db->from('qsl_images'); $this->db->from('qsl_images');
$this->db->where('id', $clean_id); $this->db->where('id', $clean_id);
$qsoid = $this->db->get()->row()->qsoid; $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; return;
} }
@@ -95,9 +90,8 @@ class Qsl_model extends CI_Model {
} }
function searchQsos($callsign) { function searchQsos($callsign) {
$CI =& get_instance(); $this->load->model('logbooks_model');
$CI->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->db->select('*'); $this->db->select('*');
$this->db->from($this->config->item('table_name')); $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); $clean_filename = $this->security->xss_clean($filename);
// be sure that QSO belongs to user // be sure that QSO belongs to user
$CI =& get_instance(); $this->load->model('logbook_model');
$CI->load->model('logbook_model'); if (!$this->logbook_model->check_qso_is_accessible($clean_qsoid)) {
if (!$CI->logbook_model->check_qso_is_accessible($clean_qsoid)) {
return; return;
} }
$data = array( $data = array(
'qsoid' => $clean_qsoid, 'qsoid' => $clean_qsoid,
'filename' => $filename 'filename' => $clean_filename
); );
$this->db->insert('qsl_images', $data); $this->db->insert('qsl_images', $data);
@@ -136,7 +129,7 @@ class Qsl_model extends CI_Model {
if (isset($userdata_dir)) { 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'); $user_id = $this->session->userdata('user_id');

View File

@@ -0,0 +1,459 @@
<div class="container debug_main mb-4">
<br>
<?php if ($this->session->flashdata('success')) { ?>
<!-- Display Message -->
<div class="alert alert-success">
<p><?php echo $this->session->flashdata('success'); ?></p>
</div>
<?php } ?>
<?php if ($this->session->flashdata('error')) { ?>
<!-- Display Message -->
<div class="alert alert-danger">
<p><?php echo $this->session->flashdata('error'); ?></p>
</div>
<?php } ?>
<h2><?php echo $page_title; ?></h2>
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">Wavelog Information</div>
<div class="card-body">
<table width="100%">
<tr>
<td>Version</td>
<td><?php echo $this->optionslib->get_option('version') . "\n"; ?></td>
</tr>
<tr>
<td>Language</td>
<td><?php echo ucfirst($this->config->item('language')) . "\n"; ?></td>
</tr>
<tr>
<td>Base URL</td>
<td><span id="baseUrl"><a href="<?php echo $this->config->item('base_url') ?>" target="_blank"><?php echo $this->config->item('base_url'); ?></a></span> <span data-bs-toggle="tooltip" title="<?php echo lang('copy_to_clipboard'); ?>" onclick='copyURL("<?php echo $this->config->item('base_url'); ?>")'><i class="copy-icon fas fa-copy"></span></td>
</tr>
<tr>
<td>Migration</td>
<td><?php echo (isset($migration_version) ? $migration_version : "<span class='badge text-bg-danger'>There is something wrong with your Migration in Database!</span>"); ?></td>
</tr>
</table>
</div>
</div>
<div class="card">
<div class="card-header">Server Information</div>
<div class="card-body">
<table width="100%">
<tr>
<td>Server Software</td>
<td><?php echo $_SERVER['SERVER_SOFTWARE']; ?></td>
</tr>
<tr>
<td>PHP Version</td>
<td><?php echo phpversion(); ?></td>
</tr>
<tr>
<td>MySQL Version</td>
<td><?php echo $this->db->version(); ?></td>
</tr>
</table>
</div>
</div>
<div class="card">
<div class="card-header">Codeigniter</div>
<div class="card-body">
<table width="100%">
<tr>
<td>Version</td>
<td><?php echo CI_VERSION; ?></td>
</tr>
</table>
</div>
</div>
<div class="card">
<div class="card-header">Folder Permissions</div>
<div class="card-body">
<p>This checks the folders Wavelog uses are read and writeable by PHP.</p>
<table width="100%">
<tr>
<td>/backup</td>
<td>
<?php if ($backup_folder == true) { ?>
<span class="badge text-bg-success">Success</span>
<?php } else { ?>
<span class="badge text-bg-danger">Failed</span>
<?php } ?>
</td>
</tr>
<tr>
<td>/updates</td>
<td>
<?php if ($updates_folder == true) { ?>
<span class="badge text-bg-success">Success</span>
<?php } else { ?>
<span class="badge text-bg-danger">Failed</span>
<?php } ?>
</td>
</tr>
<tr>
<td>/uploads</td>
<td>
<?php if ($uploads_folder == true) { ?>
<span class="badge text-bg-success">Success</span>
<?php } else { ?>
<span class="badge text-bg-danger">Failed</span>
<?php } ?>
</td>
</tr>
<?php if (isset($userdata_enabled)) { ?>
<tr>
<td>/userdata</td>
<td>
<?php if ($userdata_folder == true) { ?>
<span class="badge text-bg-success">Success</span>
<?php } else { ?>
<span class="badge text-bg-danger">Failed</span>
<?php } ?>
</td>
</tr>
<?php } ?>
</table>
</div>
</div>
<?php if (isset($userdata_enabled)) { ?>
<div class="card">
<div class="card-header">Migrate Userdata</div>
<div class="card-body">
<p>Here you can migrate existing QSL cards and eQSL cards to the new userdata folder.</p>
<a href="<?php echo site_url('debug/migrate_userdata'); ?>" class="btn btn-primary <?php echo $userdata_status['btn_class']; ?>"><?php echo $userdata_status['btn_text']; ?></a>
</div>
</div>
<?php } ?>
</div>
<div class="col">
<div class="card">
<div class="card-header">PHP Modules</div>
<div class="card-body">
<table width="100%">
<tr>
<td>curl</td>
<td>
<?php if (in_array('curl', get_loaded_extensions())) { ?>
<span class="badge text-bg-success">Installed</span>
<?php } else { ?>
<span class="badge text-bg-danger">Not Installed</span>
<?php } ?>
</td>
</tr>
<tr>
<td>MySQL</td>
<td>
<?php if (in_array('mysqli', get_loaded_extensions())) { ?>
<span class="badge text-bg-success">Installed</span>
<?php } else { ?>
<span class="badge text-bg-danger">Not Installed</span>
<?php } ?>
</td>
</tr>
<tr>
<td>mbstring</td>
<td>
<?php if (in_array('mbstring', get_loaded_extensions())) { ?>
<span class="badge text-bg-success">Installed</span>
<?php } else { ?>
<span class="badge text-bg-danger">Not Installed</span>
<?php } ?>
</td>
</tr>
<tr>
<td>xml</td>
<td>
<?php if (in_array('xml', get_loaded_extensions())) { ?>
<span class="badge text-bg-success">Installed</span>
<?php } else { ?>
<span class="badge text-bg-danger">Not Installed</span>
<?php } ?>
</td>
</tr>
<tr>
<td>zip</td>
<td>
<?php if (in_array('zip', get_loaded_extensions())) { ?>
<span class="badge text-bg-success">Installed</span>
<?php } else { ?>
<span class="badge text-bg-danger">Not Installed</span>
<?php } ?>
</td>
</tr>
</table>
</div>
</div>
<?php if (file_exists('.git')) { ?>
<?php
//Below is a failsafe where git commands fail
try {
$commitHash = trim(exec('git log --pretty="%H" -n1 HEAD'));
$branch = '';
$remote = '';
$owner = '';
// only proceed here if git can actually be executed
if ($commitHash != "") {
$commitDate = trim(exec('git log --pretty="%ci" -n1 HEAD'));
$line = trim(exec('git log -n 1 --pretty=%D HEAD'));
$pieces = explode(', ', $line);
$lastFetch = trim(exec('stat -c %Y .git/FETCH_HEAD'));
//Below is a failsafe for systems without the stat command
try {
$dt = new DateTime("@$lastFetch");
} catch (Exception $e) {
$dt = new DateTime(date("Y-m-d H:i:s"));
}
if (isset($pieces[1])) {
$remote = substr($pieces[1], 0, strpos($pieces[1], '/'));
$branch = substr($pieces[1], strpos($pieces[1], '/') + 1);
$url = trim(exec('git remote get-url ' . $remote));
if (strpos($url, 'https://github.com') !== false) {
$owner = preg_replace('/https:\/\/github\.com\/(\w+)\/Wavelog\.git/', '$1', $url);
} else if (strpos($url, 'git@github.com') !== false) {
$owner = preg_replace('/git@github\.com:(\w+)\/Wavelog\.git/', '$1', $url);
}
}
$tag = trim(exec('git describe --tags ' . $commitHash));
}
} catch (\Throwable $th) {
$commitHash = "";
}
?>
<?php if ($commitHash != "") { ?>
<div class="card">
<div class="card-header">Git Information</div>
<div class="card-body">
<table width="100%">
<tr>
<td>Branch</td>
<td>
<?php if ($branch != "") { ?>
<?php if ($owner != "") { ?>
<a target="_blank" href="https://github.com/<?php echo $owner; ?>/Wavelog/tree/<?php echo $branch ?>">
<?php } ?>
<span class="badge text-bg-success"><?php echo $branch; ?></span>
<?php if ($owner != "") { ?>
</a>
<?php } ?>
<?php } else { ?>
<span class="badge text-bg-danger">n/a</span>
<?php } ?>
</td>
</tr>
<tr>
<tr>
<td>Commit</td>
<td>
<?php if ($commitHash != "") { ?>
<a target="_blank" href="https://github.com/wavelog/wavelog/commit/<?php echo $commitHash ?>"><span class="badge text-bg-success"><?php echo substr($commitHash, 0, 8); ?></span></a>
<?php } else { ?>
<span class="badge text-bg-danger">n/a</span>
<?php } ?>
</td>
</tr>
<tr>
<td>Tag</td>
<td>
<?php if ($commitHash != "") { ?>
<a target="_blank" href="https://github.com/wavelog/wavelog/releases/tag/<?php echo substr($tag, 0, strpos($tag, '-')); ?>"><span class="badge text-bg-success"><?php echo $tag; ?></span></a>
<?php } else { ?>
<span class="badge text-bg-danger">n/a</span>
<?php } ?>
</td>
</tr>
<tr>
<td>Last Fetch</td>
<td>
<?php echo ($dt == null ? '' : $dt->format(\DateTime::RFC850)); ?>
</td>
</tr>
</table>
</table>
</div>
</div>
<?php }
}
// Get Date format
if ($this->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');
}
?>
<div class="card">
<div class="card-header">File download date</div>
<div class="card-body">
<table width="100%" class="table-sm table table-hover table-striped">
<thead>
<th>File</th>
<th>Last update</th>
<th></th>
</thead>
<tr>
<td>DXCC update from Club Log</td>
<td><?php echo (($this->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') ?? ''))) ?></td>
<td><a class="btn btn-sm btn-primary" href="<?php echo site_url('update'); ?>">Update</a></td>
</tr>
<tr>
<td>DOK file download</td>
<td><?php echo (($this->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') ?? ''))) ?></td>
<td><a class="btn btn-sm btn-primary" href="<?php echo site_url('update/update_dok'); ?>">Update</a></td>
</tr>
<tr>
<td>LoTW users download</td>
<td><?php echo (($this->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') ?? ''))) ?></td>
<td><a class="btn btn-sm btn-primary" href="<?php echo site_url('update/lotw_users'); ?>">Update</a></td>
</tr>
<tr>
<td>POTA file download</td>
<td><?php echo (($this->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') ?? ''))) ?></td>
<td><a class="btn btn-sm btn-primary" href="<?php echo site_url('update/update_pota'); ?>">Update</a></td>
</tr>
<tr>
<td>SCP file download</td>
<td><?php echo (($this->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') ?? ''))) ?></td>
<td><a class="btn btn-sm btn-primary" href="<?php echo site_url('update/update_clublog_scp'); ?>">Update</a></td>
</tr>
<tr>
<td>SOTA file download</td>
<td><?php echo (($this->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') ?? ''))) ?></td>
<td><a class="btn btn-sm btn-primary" href="<?php echo site_url('update/update_sota'); ?>">Update</a></td>
</tr>
<tr>
<td>WWFF file download</td>
<td><?php echo (($this->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') ?? ''))) ?></td>
<td><a class="btn btn-sm btn-primary" href="<?php echo site_url('update/update_wwff'); ?>">Update</a></td>
</tr>
</table>
</div>
</div>
<div class="card" style="margin-bottom: 15px;">
<div class="card-header">
QSO-DB Maintenance
</div>
<?php if (!empty($qsos_with_no_station_id)) { ?>
<div class="alert alert-danger" role="alert" style="margin-bottom: 0px !important;">
<span class="badge rounded-pill text-bg-warning">Warning</span> The Database contains <?php echo count($qsos_with_no_station_id); ?> QSO<?php echo count($qsos_with_no_station_id) > 1 ? 's' : '' ?> without a station-profile (location)<br />
</div>
<div class="card-body">
<div class?"table-responsive">
<table id="unasigned_qsos_table" class="table table-sm table-striped">
<thead>
<tr>
<th scope="col"><input type="checkbox" onClick="toggleAll(this)"></th>
<th scope="col">Date</th>
<th scope="col">Time</th>
<th scope="col">Call</th>
<th scope="col">Mode</th>
<th scope="col">Band</th>
<th scope="col">Station Callsign</th>
</tr>
</thead>
<tbody>
<?php if ($this->session->userdata('user_date_format')) {
$custom_date_format = $this->session->userdata('user_date_format');
} else {
$custom_date_format = 'd.m.Y';
}
foreach ($qsos_with_no_station_id as $qso) {
echo '<tr>';
echo '<td><input type="checkbox" id="' . $qso->COL_PRIMARY_KEY . '" name="cBox[]" value="' . $qso->COL_PRIMARY_KEY . '"></td>';
$timestamp = strtotime($qso->COL_TIME_ON);
echo '<td>' . date($custom_date_format, $timestamp) . '</td>';
$timestamp = strtotime($qso->COL_TIME_ON);
echo '<td>' . date('H:i', $timestamp) . '</td>';
echo '<td>' . $qso->COL_CALL . '</td>';
echo '<td>' . $qso->COL_MODE . '</td>';
echo '<td>' . $qso->COL_BAND . '</td>';
echo '<td>' . $qso->COL_STATION_CALLSIGN . '</td>';
echo '</tr>';
} ?>
</tbody>
</table>
</div>
<p class="card-text">Please mark QSOs and reassign them to an existing station location:</p>
<div class="table-responsive">
<table id="station_locations_table" class="table table-sm table-striped">
<thead>
<tr>
<th scope="col">Call</th>
<th scope="col">Target Location</th>
<th scope="col">Reassign</th>
</tr>
</thead>
<tbody>
<?php
foreach ($calls_wo_sid as $call) {
echo '<tr><td><div id="station_call">' . $call['COL_STATION_CALLSIGN'] . '</div></td><td><select name="station_profile" id="station_profile" onChange="updateCallsign(this)">';
$options = '';
foreach ($stations->result() as $station) {
$options .= '<option value=' . $station->station_id . '>' . $station->station_profile_name . ' (' . $station->station_callsign . ')</option>';
}
echo $options . '</select></td><td><button class="btn btn-warning" onClick="reassign(\'' . $call['COL_STATION_CALLSIGN'] . '\',$(\'#station_profile option:selected\').val());"><i class="fas fa-sync"></i> Reassign</a></button></td></tr>';
} ?>
</tbody>
</table>
</div>
</div>
<?php
} else { ?>
<div class="alert alert-secondary" role="alert" style="margin-bottom: 0px !important;">
<span class="badge rounded-pill text-bg-success">Everything ok</span> Every QSO in your Database is assigned to a station-profile (location)
</div>
<?php } ?>
</div>
<div class="card">
<div class="card-header">
Settings Maintenance
</div>
<?php if (!$this->config->item('cl_multilanguage')) { ?>
<div class="alert alert-danger" role="alert" style="margin-bottom: 0px !important;">
<span class="badge rounded-pill text-bg-warning">Warning</span> You didn't enabled Multilanguage support in your config.php
</div>
<div class="card-body">
<p class="card-text">Please edit your ./application/config/config.php File and add some rows to it:</br></br>
Go to your application/config Folder and compare config.sample.php with your config.php</br>
You'll probably find a block with language-settings. Please include this block into your current config.php
</p>
</div>
<?php
} else { ?>
<div class="alert alert-secondary" role="alert" style="margin-bottom: 0px !important;">
<span class="badge rounded-pill text-bg-success">Everything ok</span> You have enabled Multuser-Language support
</div>
<?php } ?>
</div>
</div>
</div>
</div>

View File

@@ -1,324 +0,0 @@
<div class="container debug_main">
<h2><?php echo $page_title; ?></h2>
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">Wavelog Information</div>
<div class="card-body">
<table width="100%">
<tr>
<td>Version</td>
<td><?php echo $this->optionslib->get_option('version')."\n"; ?></td>
</tr>
<tr>
<td>Language</td>
<td><?php echo ucfirst($this->config->item('language'))."\n"; ?></td>
</tr>
<tr>
<td>Base URL</td>
<td><span id="baseUrl"><a href="<?php echo $this->config->item('base_url')?>" target="_blank"><?php echo $this->config->item('base_url'); ?></a></span> <span data-bs-toggle="tooltip" title="<?php echo lang('copy_to_clipboard'); ?>" onclick='copyURL("<?php echo $this->config->item('base_url'); ?>")'><i class="copy-icon fas fa-copy"></span></td>
</tr>
<tr>
<td>Migration</td>
<td><?php echo (isset($migration_version) ? $migration_version : "<span class='badge text-bg-danger'>There is something wrong with your Migration in Database!</span>"); ?></td>
</tr>
</table>
</div>
</div>
<div class="card">
<div class="card-header">Server Information</div>
<div class="card-body">
<table width="100%">
<tr>
<td>Server Software</td>
<td><?php echo $_SERVER['SERVER_SOFTWARE']; ?></td>
</tr>
<tr>
<td>PHP Version</td>
<td><?php echo phpversion(); ?></td>
</tr>
<tr>
<td>MySQL Version</td>
<td><?php echo $this->db->version(); ?></td>
</tr>
</table>
</div>
</div>
<div class="card">
<div class="card-header">Codeigniter</div>
<div class="card-body">
<table width="100%">
<tr>
<td>Version</td>
<td><?php echo CI_VERSION; ?></td>
</tr>
</table>
</div>
</div>
<div class="card">
<div class="card-header">Folder Permissions</div>
<div class="card-body">
<p>This checks the folders Wavelog uses are read and writeable by PHP.</p>
<table width="100%">
<tr>
<td>/backup</td>
<td>
<?php if($backup_folder == true) { ?>
<span class="badge text-bg-success">Success</span>
<?php } else { ?>
<span class="badge text-bg-danger">Failed</span>
<?php } ?>
</td>
</tr>
<tr>
<td>/updates</td>
<td>
<?php if($updates_folder == true) { ?>
<span class="badge text-bg-success">Success</span>
<?php } else { ?>
<span class="badge text-bg-danger">Failed</span>
<?php } ?>
</td>
</tr>
<tr>
<td>/uploads</td>
<td>
<?php if($uploads_folder == true) { ?>
<span class="badge text-bg-success">Success</span>
<?php } else { ?>
<span class="badge text-bg-danger">Failed</span>
<?php } ?>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="col">
<div class="card">
<div class="card-header">PHP Modules</div>
<div class="card-body">
<table width="100%">
<tr>
<td>curl</td>
<td>
<?php if(in_array ('curl', get_loaded_extensions())) { ?>
<span class="badge text-bg-success">Installed</span>
<?php } else { ?>
<span class="badge text-bg-danger">Not Installed</span>
<?php } ?>
</td>
</tr>
<tr>
<td>MySQL</td>
<td>
<?php if(in_array ('mysqli', get_loaded_extensions())) { ?>
<span class="badge text-bg-success">Installed</span>
<?php } else { ?>
<span class="badge text-bg-danger">Not Installed</span>
<?php } ?>
</td>
</tr>
<tr>
<td>mbstring</td>
<td>
<?php if(in_array ('mbstring', get_loaded_extensions())) { ?>
<span class="badge text-bg-success">Installed</span>
<?php } else { ?>
<span class="badge text-bg-danger">Not Installed</span>
<?php } ?>
</td>
</tr>
<tr>
<td>xml</td>
<td>
<?php if(in_array ('xml', get_loaded_extensions())) { ?>
<span class="badge text-bg-success">Installed</span>
<?php } else { ?>
<span class="badge text-bg-danger">Not Installed</span>
<?php } ?>
</td>
</tr>
<tr>
<td>zip</td>
<td>
<?php if(in_array ('zip', get_loaded_extensions())) { ?>
<span class="badge text-bg-success">Installed</span>
<?php } else { ?>
<span class="badge text-bg-danger">Not Installed</span>
<?php } ?>
</td>
</tr>
</table>
</div>
</div>
<?php if (file_exists('.git')) { ?>
<?php
//Below is a failsafe where git commands fail
try {
$commitHash = trim(exec('git log --pretty="%H" -n1 HEAD'));
$branch = '';
$remote = '';
$owner = '';
// only proceed here if git can actually be executed
if ($commitHash != "") {
$commitDate = trim(exec('git log --pretty="%ci" -n1 HEAD'));
$line = trim(exec('git log -n 1 --pretty=%D HEAD'));
$pieces = explode(', ', $line);
$lastFetch = trim(exec('stat -c %Y .git/FETCH_HEAD'));
//Below is a failsafe for systems without the stat command
try {
$dt = new DateTime("@$lastFetch");
} catch(Exception $e) {
$dt = new DateTime(date("Y-m-d H:i:s"));
}
if (isset($pieces[1])) {
$remote = substr($pieces[1], 0, strpos($pieces[1], '/'));
$branch = substr($pieces[1], strpos($pieces[1], '/')+1);
$url = trim(exec('git remote get-url '.$remote));
if (strpos($url, 'https://github.com') !== false) {
$owner = preg_replace('/https:\/\/github\.com\/(\w+)\/Wavelog\.git/', '$1', $url);
} else if (strpos($url, 'git@github.com') !== false) {
$owner = preg_replace('/git@github\.com:(\w+)\/Wavelog\.git/', '$1', $url);
}
}
$tag = trim(exec('git describe --tags '.$commitHash));
}
} catch (\Throwable $th) {
$commitHash = "";
}
?>
<?php if($commitHash != "") { ?>
<div class="card">
<div class="card-header">Git Information</div>
<div class="card-body">
<table width="100%">
<tr>
<td>Branch</td>
<td>
<?php if($branch != "") { ?>
<?php if($owner != "") { ?>
<a target="_blank" href="https://github.com/<?php echo $owner; ?>/Wavelog/tree/<?php echo $branch?>">
<?php } ?>
<span class="badge text-bg-success"><?php echo $branch; ?></span>
<?php if($owner != "") { ?>
</a>
<?php } ?>
<?php } else { ?>
<span class="badge text-bg-danger">n/a</span>
<?php } ?>
</td>
</tr>
<tr>
<tr>
<td>Commit</td>
<td>
<?php if($commitHash != "") { ?>
<a target="_blank" href="https://github.com/wavelog/wavelog/commit/<?php echo $commitHash?>"><span class="badge text-bg-success"><?php echo substr($commitHash,0,8); ?></span></a>
<?php } else { ?>
<span class="badge text-bg-danger">n/a</span>
<?php } ?>
</td>
</tr>
<tr>
<td>Tag</td>
<td>
<?php if($commitHash != "") { ?>
<a target="_blank" href="https://github.com/wavelog/wavelog/releases/tag/<?php echo substr($tag,0,strpos($tag, '-')); ?>"><span class="badge text-bg-success"><?php echo $tag; ?></span></a>
<?php } else { ?>
<span class="badge text-bg-danger">n/a</span>
<?php } ?>
</td>
</tr>
<tr>
<td>Last Fetch</td>
<td>
<?php echo ($dt == null ? '' : $dt->format(\DateTime::RFC850)); ?>
</td>
</tr>
</table>
</table>
</div>
</div>
<?php }
// Get Date format
if($this->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');
}
?>
<div class="card">
<div class="card-header">File download date</div>
<div class="card-body">
<table width="100%" class = "table-sm table table-hover table-striped">
<thead>
<th>File</th>
<th>Last update</th>
<th></th>
</thead>
<tr>
<td>DXCC update from Club Log</td>
<td><?php echo (($this->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') ?? ''))) ?></td>
<td><a class="btn btn-sm btn-primary" href="<?php echo site_url('update');?>">Update</a></td>
</tr>
<tr>
<td>DOK file download</td>
<td><?php echo (($this->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') ?? ''))) ?></td>
<td><a class="btn btn-sm btn-primary" href="<?php echo site_url('update/update_dok');?>">Update</a></td>
</tr>
<tr>
<td>LoTW users download</td>
<td><?php echo (($this->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') ?? ''))) ?></td>
<td><a class="btn btn-sm btn-primary" href="<?php echo site_url('update/lotw_users');?>">Update</a></td>
</tr>
<tr>
<td>POTA file download</td>
<td><?php echo (($this->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') ?? ''))) ?></td>
<td><a class="btn btn-sm btn-primary" href="<?php echo site_url('update/update_pota');?>">Update</a></td>
</tr>
<tr>
<td>SCP file download</td>
<td><?php echo (($this->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') ?? ''))) ?></td>
<td><a class="btn btn-sm btn-primary" href="<?php echo site_url('update/update_clublog_scp');?>">Update</a></td>
</tr>
<tr>
<td>SOTA file download</td>
<td><?php echo (($this->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') ?? ''))) ?></td>
<td><a class="btn btn-sm btn-primary" href="<?php echo site_url('update/update_sota');?>">Update</a></td>
</tr>
<tr>
<td>WWFF file downlaod</td>
<td><?php echo (($this->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') ?? ''))) ?></td>
<td><a class="btn btn-sm btn-primary" href="<?php echo site_url('update/update_wwff');?>">Update</a></td>
</tr>
</table>
</div>
</div>
<?php } ?>
</div>
</div>
</div>

View File

@@ -145,10 +145,6 @@ if($this->session->userdata('user_id') != null) {
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/moment.min.js"></script> <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/moment.min.js"></script>
<?php } ?> <?php } ?>
<?php if ($this->uri->segment(1) == "maintenance" ) { ?>
<script src="<?php echo base_url() ;?>assets/js/sections/maintenance.js"></script>
<?php } ?>
<?php if ($this->uri->segment(1) == "adif" ) { ?> <?php if ($this->uri->segment(1) == "adif" ) { ?>
<script src="<?php echo base_url() ;?>assets/js/sections/adif.js"></script> <script src="<?php echo base_url() ;?>assets/js/sections/adif.js"></script>
<script src="<?php echo base_url() ;?>assets/js/jszip.min.js"></script> <script src="<?php echo base_url() ;?>assets/js/jszip.min.js"></script>

View File

@@ -223,8 +223,6 @@
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item" href="<?php echo site_url('update'); ?>" title="Update Country Files"><i class="fas fa-sync"></i> <?php echo lang('menu_update_country_files'); ?></a> <a class="dropdown-item" href="<?php echo site_url('update'); ?>" title="Update Country Files"><i class="fas fa-sync"></i> <?php echo lang('menu_update_country_files'); ?></a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item" href="<?php echo site_url('maintenance'); ?>" title="maintenance"><i class="fas fa-tools"></i> <?php echo lang('menu_maintenance'); ?></a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="<?php echo site_url('debug'); ?>" title="Debug Information"><i class="fas fa-tools"></i> <?php echo lang('menu_debug_information'); ?></a> <a class="dropdown-item" href="<?php echo site_url('debug'); ?>" title="Debug Information"><i class="fas fa-tools"></i> <?php echo lang('menu_debug_information'); ?></a>
</div> </div>
</li> </li>

View File

@@ -1,111 +0,0 @@
<div class="container">
<br>
<?php if($this->session->flashdata('message')) { ?>
<!-- Display Message -->
<div class="alert-message error">
<p><?php echo $this->session->flashdata('message'); ?></p>
</div>
<?php } ?>
<h2><?php echo $page_title; ?></h2>
<div class="card" style="margin-bottom: 15px;">
<div class="card-header">
QSO-DB Maintenance
</div>
<?php if(!empty($qsos_with_no_station_id)) { ?>
<div class="alert alert-danger" role="alert" style="margin-bottom: 0px !important;">
<span class="badge rounded-pill text-bg-warning">Warning</span> The Database contains <?php echo count($qsos_with_no_station_id); ?> QSO<?php echo count($qsos_with_no_station_id) > 1 ? 's' : '' ?> without a station-profile (location)<br/>
</div>
<div class="card-body">
<div class?"table-responsive">
<table id="unasigned_qsos_table" class="table table-sm table-striped">
<thead>
<tr>
<th scope="col"><input type="checkbox" onClick="toggleAll(this)"></th>
<th scope="col">Date</th>
<th scope="col">Time</th>
<th scope="col">Call</th>
<th scope="col">Mode</th>
<th scope="col">Band</th>
</tr>
</thead>
<tbody>
<?php if($this->session->userdata('user_date_format')) {
$custom_date_format = $this->session->userdata('user_date_format');
} else {
$custom_date_format = 'd.m.Y';
}
foreach ($qsos_with_no_station_id as $qso) {
echo '<tr>';
echo '<td><input type="checkbox" id="'.$qso->COL_PRIMARY_KEY.'" name="cBox[]" value="'.$qso->COL_PRIMARY_KEY.'"></td>';
$timestamp = strtotime($qso->COL_TIME_ON);
echo '<td>'.date($custom_date_format, $timestamp).'</td>';
$timestamp = strtotime($qso->COL_TIME_ON);
echo '<td>'.date('H:i', $timestamp).'</td>';
echo '<td>'.$qso->COL_CALL.'</td>';
echo '<td>'.$qso->COL_MODE.'</td>';
echo '<td>'.$qso->COL_BAND.'</td>';
echo '</tr>';
} ?>
</tbody>
</table>
</div>
<p class="card-text">Please reassign those QSOs to an existing station location:</p>
<div class="table-responsive">
<table id="station_locations_table" class="table table-sm table-striped">
<thead>
<tr>
<th scope="col">Call</th>
<th scope="col">Target Location</th>
<th scope="col">Reassign</th>
</tr>
</thead>
<tbody>
<?php
foreach ($calls_wo_sid as $call) {
echo '<tr><td><div id="station_call">'.$call['COL_STATION_CALLSIGN'].'</div></td><td><select name="station_profile" id="station_profile" onChange="updateCallsign(this)">';
$options='';
foreach ($stations->result() as $station) {
$options.='<option value='.$station->station_id.'>'.$station->station_profile_name.' ('.$station->station_callsign.')</option>';
}
echo $options.'</select></td><td><button class="btn btn-warning" onClick="reassign(\''.$call['COL_STATION_CALLSIGN'].'\',$(\'#station_profile option:selected\').val());"><i class="fas fa-sync"></i> Reassign</a></button></td></tr>';
} ?>
</tbody>
</table>
</div>
</div>
<?php
} else { ?>
<div class="alert alert-secondary" role="alert" style="margin-bottom: 0px !important;">
<span class="badge rounded-pill text-bg-success">Everything ok</span> Every QSO in your Database is assigned to a station-profile (location)
</div>
<?php } ?>
</div>
<div class="card">
<div class="card-header">
Settings Maintenance
</div>
<?php if(!$this->config->item('cl_multilanguage')) { ?>
<div class="alert alert-danger" role="alert" style="margin-bottom: 0px !important;">
<span class="badge rounded-pill text-bg-warning">Warning</span> You didn't enabled Multilanguage support in your config.php
</div>
<div class="card-body">
<p class="card-text">Please edit your ./application/config/config.php File and add some rows to it:</br></br>
Go to your application/config Folder and compare config.sample.php with your config.php</br>
You'll probably find a block with language-settings. Please include this block into your current config.php
</p>
</div>
<?php
} else { ?>
<div class="alert alert-secondary" role="alert" style="margin-bottom: 0px !important;">
<span class="badge rounded-pill text-bg-success">Everything ok</span> You have enabled Multuser-Language support
</div>
<?php } ?>
</div>
</div>

View File

@@ -30,7 +30,7 @@
<div class="alert alert-danger" role="alert"> <div class="alert alert-danger" role="alert">
<span class="badge rounded-pill text-bg-warning"><?php echo lang('general_word_warning'); ?></span> <?php echo lang('station_location_warning_reassign'); ?> <span class="badge rounded-pill text-bg-warning"><?php echo lang('general_word_warning'); ?></span> <?php echo lang('station_location_warning_reassign'); ?>
</br> </br>
<?php echo lang('station_location_reassign_at'); ?> <a href="<?php echo site_url('maintenance/'); ?>" class="btn btn-warning"><i class="fas fa-sync"></i><?php echo lang('account_word_admin') . "/" . lang('general_word_maintenance'); ?></a> <?php echo lang('station_location_reassign_at'); ?> <a href="<?php echo site_url('debug'); ?>" class="btn btn-warning"><i class="fas fa-sync"></i> <?php echo lang('account_word_admin') . "/" . lang('general_word_maintenance'); ?></a>
</div> </div>
<?php } ?> <?php } ?>

View File

@@ -1,4 +1,4 @@
function reassign(call,target_profile_id) { function reassign(call, target_profile_id) {
let qsoids = []; let qsoids = [];
let elements = document.getElementsByName("cBox[]"); let elements = document.getElementsByName("cBox[]");
elements.forEach((item) => { elements.forEach((item) => {
@@ -7,37 +7,40 @@ function reassign(call,target_profile_id) {
} }
}); });
$.ajax({ $.ajax({
url: base_url + 'index.php/maintenance/reassign', url: base_url + "index.php/debug/reassign",
type: 'post', type: "post",
data: {'call': call, 'station_id': target_profile_id, 'qsoids' : qsoids}, data: { call: call, station_id: target_profile_id, qsoids: qsoids },
success: function (resu) { success: function (resu) {
if (resu.status) { if (resu.status) {
location.reload(); location.reload();
} }
} },
}); });
} }
function toggleAll(source) { function toggleAll(source) {
console.log('test');
if (source.checked) { if (source.checked) {
let elements = document.getElementsByName("cBox[]"); let elements = document.getElementsByName("cBox[]");
elements.forEach((item) => { elements.forEach((item) => {
item.checked = true; item.checked = true;
}) });
source.checked = true; source.checked = true;
} }
if (!source.checked) { if (!source.checked) {
let elements = document.getElementsByName("cBox[]"); let elements = document.getElementsByName("cBox[]");
elements.forEach((item) => { elements.forEach((item) => {
item.checked = false; item.checked = false;
}) });
source.checked = false; source.checked = false;
} }
} }
function updateCallsign(item) { function updateCallsign(item) {
let text = item.options[item.selectedIndex].text let text = item.options[item.selectedIndex].text;
let call = text.substr(text.lastIndexOf('(')+1,(text.lastIndexOf(')')-text.lastIndexOf('(')-1)); let call = text.substr(
text.lastIndexOf("(") + 1,
text.lastIndexOf(")") - text.lastIndexOf("(") - 1
);
document.getElementById("station_call").innerHTML = call; document.getElementById("station_call").innerHTML = call;
} }

View File

@@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -1 +0,0 @@
This folders used to store downloaded eqsl card images.