Merge remote-tracking branch 'upstream/dev' into impersonate

This commit is contained in:
HB9HIL
2024-08-16 20:07:50 +02:00
83 changed files with 2578 additions and 1148 deletions

View File

@@ -10,7 +10,7 @@ class User extends CI_Controller {
$this->load->library('encryption');
}
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); }
$data['results'] = $this->user_model->users();
$data['session_uid'] = $this->session->userdata('user_id');
@@ -24,7 +24,7 @@ class User extends CI_Controller {
function add() {
$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'); }
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); }
$data['existing_languages'] = $this->config->item('languages');
@@ -209,8 +209,8 @@ class User extends CI_Controller {
function edit() {
$this->load->model('user_model');
if ( ($this->session->userdata('user_id') == '') || ((!$this->user_model->authorize(99)) && ($this->session->userdata('user_id') != $this->uri->segment(3))) ) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
if ( $this->config->item('special_callsign') && $this->session->userdata('user_type') != '99' && $this->config->item('sc_hide_usermenu') ) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
if ( ($this->session->userdata('user_id') == '') || ((!$this->user_model->authorize(99)) && ($this->session->userdata('user_id') != $this->uri->segment(3))) ) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); }
if ( $this->config->item('special_callsign') && $this->session->userdata('user_type') != '99' && $this->config->item('sc_hide_usermenu') ) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); }
$query = $this->user_model->get_by_id($this->uri->segment(3));
$data['existing_languages'] = $this->config->item('languages');
@@ -385,7 +385,7 @@ class User extends CI_Controller {
$data['user_language'] = $q->user_language;
}
if($this->input->post('user_stylesheet')) {
$data['user_stylesheet'] = $this->input->post('user_stylesheet', true);
} else {
@@ -597,12 +597,12 @@ class User extends CI_Controller {
$data['user_map_'.$row->option_key.'_'.$ktype] = $this->input->post('user_map_'.$row->option_key.'_'.$ktype, true);
} else {
$data['user_map_'.$row->option_key.'_'.$ktype] = $vtype;
}
}
}
} else {
$data['user_map_'.$row->option_name.'_'.$row->option_key] = $row->option_value;
}
}
}
} else {
$data['user_map_qso_icon'] = "fas fa-dot-circle";
$data['user_map_qso_color'] = "#FF0000";
@@ -619,7 +619,7 @@ class User extends CI_Controller {
$data['user_locations_quickswitch'] = ($this->user_options_model->get_options('header_menu', array('option_name'=>'locations_quickswitch'), $this->uri->segment(3))->row()->option_value ?? 'false');
$data['user_utc_headermenu'] = ($this->user_options_model->get_options('header_menu', array('option_name'=>'utc_headermenu'), $this->uri->segment(3))->row()->option_value ?? 'false');
$this->load->view('interface_assets/header', $data);
$this->load->view('user/edit', $data);
$this->load->view('interface_assets/footer');
@@ -657,7 +657,7 @@ class User extends CI_Controller {
$data_options['user_map_'.$icon.'_color'] = xss_clean($this->input->post('user_map_'.$icon.'_color', true));
}
if (!empty($data_options['user_map_qso_icon'])) {
foreach ($array_icon as $icon) {
foreach ($array_icon as $icon) {
$json = json_encode(array('icon'=>$data_options['user_map_'.$icon.'_icon'], 'color'=>$data_options['user_map_'.$icon.'_color']));
$this->user_options_model->set_option('map_custom','icon',array($icon=>$json));
}
@@ -722,7 +722,7 @@ class User extends CI_Controller {
function profile() {
$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('error', __("You're not allowed to do that!")); redirect('dashboard'); }
$query = $this->user_model->get_by_id($this->session->userdata('user_id'));
$q = $query->row();
$data['page_title'] = __("Profile");
@@ -741,7 +741,7 @@ class User extends CI_Controller {
function delete() {
$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'); }
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); }
$query = $this->user_model->get_by_id($this->uri->segment(3));
$this->load->library('form_validation');
@@ -859,7 +859,7 @@ class User extends CI_Controller {
$this->session->set_flashdata('error', __("Login failed. Try again."));
redirect('user/login');
}
}
if ($this->form_validation->run() == FALSE) {
@@ -871,7 +871,6 @@ class User extends CI_Controller {
} else {
if($this->user_model->login() == 1) {
$this->session->set_flashdata('notice', __("User logged in"));
$this->user_model->update_session($data['user']->user_id);
$cookie= array(
@@ -940,7 +939,7 @@ class User extends CI_Controller {
redirect('user/login');
} else {
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
@@ -1019,13 +1018,13 @@ class User extends CI_Controller {
public function admin_send_password_reset() {
header('Content-Type: application/json');
if ($this->input->is_ajax_request()) { // just additional, to make sure request is from ajax
if ($this->input->post('submit_allowed')) {
$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'); }
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); }
$query = $this->user_model->get_by_id($this->input->post('user_id'));