Show warnings on dashboard and set deadline to 30 days

这个提交包含在:
phl0 2022-12-23 14:49:03 +01:00
父节点 50190eb4eb
当前提交 33ed61409b
找不到此签名对应的密钥
GPG 密钥 ID: 48EA1E640798CA9A
共有 6 个文件被更改,包括 56 次插入2 次删除

查看文件

@ -8,11 +8,17 @@ class Dashboard extends CI_Controller {
if(ENVIRONMENT == 'development') {
$this->output->enable_profiler(TRUE);
}
// Load language files
$this->lang->load('lotw');
// Database connections
$this->load->model('logbook_model');
$this->load->model('user_model');
// LotW infos
$this->load->model('LotwCert');
if($this->optionslib->get_option('version2_trigger') == "false") {
redirect('welcome');
}

查看文件

@ -53,3 +53,7 @@ $lang['lotw_p12_export_step_three'] = 'Click "Save Callsign Certificate File" an
$lang['lotw_p12_export_step_four'] = 'Upload File below.';
$lang['lotw_confirmed'] = 'This QSO is confirmed on LoTW';
// LotW Expiry
$lang['lotw_cert_expiring'] = 'At least one of your LotW certificates is about to expire!';
$lang['lotw_cert_expired'] = 'At least one of your LotW certificates is expired!';

查看文件

@ -53,3 +53,7 @@ $lang['lotw_p12_export_step_three'] = 'Klick "Save Callsign Certificate File" un
$lang['lotw_p12_export_step_four'] = 'Lade untenstehende Datei hoch.';
$lang['lotw_confirmed'] = 'Dieses QSO wurde via LotW bestätigt am';
// LotW Expiry
$lang['lotw_cert_expiring'] = 'Mindestens eines deiner LotW Zertifikate läuft bald ab!';
$lang['lotw_cert_expired'] = 'Mindestens eines deiner LotW Zertifikate ist abgelaufen!';

查看文件

@ -90,5 +90,30 @@ class LotwCert extends CI_Model {
function empty_table($table) {
$this->db->empty_table($table);
}
function lotw_cert_expired($user_id, $date) {
$array = array('user_id' => $user_id, 'date_expires <' => $date);
$this->db->where($array);
$query = $this->db->get('lotw_certs');
if ($query->num_rows() > 0) {
return true;
} else {
return false;
}
}
function lotw_cert_expiring($user_id, $date) {
$array = array('user_id' => $user_id, 'DATE_SUB(date_expires, INTERVAL 30 DAY) <' => $date, 'date_expires >' => $date);
$this->db->where($array);
$query = $this->db->get('lotw_certs');
if ($query->num_rows() > 0) {
return true;
} else {
return false;
}
}
}
?>

查看文件

@ -63,6 +63,21 @@ function echoQrbCalcLink($mygrid, $grid, $vucc) {
</div>
<?php } ?>
<?php
$current_date = date('Y-m-d H:i:s');
?>
<?php if($this->LotwCert->lotw_cert_expired($this->session->userdata('user_id'), $current_date) == true) { ?>
<div class="alert alert-danger" role="alert">
<span class="badge badge-info"><?php echo $this->lang->line('general_word_important'); ?></span> <i class="fas fa-hourglass-end"></i> <?php echo $this->lang->line('lotw_cert_expired'); ?>
</div>
<?php } ?>
<?php if($this->LotwCert->lotw_cert_expiring($this->session->userdata('user_id'), $current_date) == true) { ?>
<div class="alert alert-warning" role="alert">
<span class="badge badge-info"><?php echo $this->lang->line('general_word_important'); ?></span> <i class="fas fa-hourglass-half"></i> <?php echo $this->lang->line('lotw_cert_expiring'); ?>
</div>
<?php } ?>
<?php } ?>
</div>

查看文件

@ -76,7 +76,7 @@
</td>
<td>
<?php $current_date = date('Y-m-d H:i:s'); ?>
<?php $warning_date = date('Y-m-d H:i:s', strtotime($row->date_expires.'-10 days')); ?>
<?php $warning_date = date('Y-m-d H:i:s', strtotime($row->date_expires.'-30 days')); ?>
<?php if ($current_date > $row->date_expires) { ?>
<span class="badge badge-danger"><?php echo $this->lang->line('lotw_expired'); ?></span>