Disable download function if disabled in config

This commit is contained in:
Andreas Kristiansen
2025-01-31 07:51:59 +01:00
parent a25132d5cb
commit 90b1377685

View File

@@ -137,32 +137,37 @@ class Clublog extends CI_Controller
}
public function importlog() {
$this->load->model('user_model');
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); }
if (!($this->config->item('disable_manual_clublog'))) {
$data['page_title'] = __("Clublog QSL Import");
$this->load->model('user_model');
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); }
$this->load->model('clublog_model');
$data['page_title'] = __("Clublog QSL Import");
$customDate = $this->input->post('date');
if ($customDate != NULL) {
$clublog_last_date = date($customDate);
} else {
// Query the logbook to determine when the last LoTW confirmation was
$clublog_last_date = null;
}
$users = $this->clublog_model->get_clublog_users($this->session->userdata('user_id'));
$this->load->model('clublog_model');
if (!empty($users)) {
foreach ($users as $user) {
$r = $this->clublog_model->downloadUser($user->user_id, $user->user_clublog_name, $user->user_clublog_password, $clublog_last_date);
$customDate = $this->input->post('date');
if ($customDate != NULL) {
$clublog_last_date = date($customDate);
} else {
// Query the logbook to determine when the last LoTW confirmation was
$clublog_last_date = null;
}
} else {
$r = __("No user has configured Clublog.");
}
$users = $this->clublog_model->get_clublog_users($this->session->userdata('user_id'));
header('Content-type: application/json');
echo json_encode($r);
if (!empty($users)) {
foreach ($users as $user) {
$r = $this->clublog_model->downloadUser($user->user_id, $user->user_clublog_name, $user->user_clublog_password, $clublog_last_date);
}
} else {
$r = __("No user has configured Clublog.");
}
header('Content-type: application/json');
echo json_encode($r);
} else {
redirect('dashboard');
}
}
}