mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Fixing qrg unit saving, and only load on login or change
This commit is contained in:
@@ -379,7 +379,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 {
|
||||
@@ -591,12 +591,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";
|
||||
@@ -613,7 +613,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');
|
||||
@@ -651,7 +651,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));
|
||||
}
|
||||
@@ -853,7 +853,7 @@ class User extends CI_Controller {
|
||||
$this->session->set_flashdata('error', __("Login failed. Try again."));
|
||||
redirect('user/login');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
@@ -866,7 +866,7 @@ 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);
|
||||
$this->user_model->update_session($data['user']->user_id, null, true);
|
||||
$cookie= array(
|
||||
|
||||
'name' => $this->config->item('gettext_cookie', 'gettext'),
|
||||
@@ -934,7 +934,7 @@ class User extends CI_Controller {
|
||||
redirect('user/login');
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
$this->load->helper(array('form', 'url'));
|
||||
|
||||
$this->load->library('form_validation');
|
||||
@@ -1013,7 +1013,7 @@ 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')) {
|
||||
|
||||
|
||||
@@ -407,12 +407,12 @@ class User_Model extends CI_Model {
|
||||
// FUNCTION: void update_session()
|
||||
// Updates a user's login session after they've logged in
|
||||
// TODO: This should return bool TRUE/FALSE or 0/1
|
||||
function update_session($id, $u = null) {
|
||||
function update_session($id, $u = null, $login = false) {
|
||||
|
||||
if ($u == null) {
|
||||
$u = $this->get_by_id($id);
|
||||
}
|
||||
|
||||
|
||||
$userdata = array(
|
||||
'user_id' => $u->row()->user_id,
|
||||
'user_name' => $u->row()->user_name,
|
||||
@@ -454,14 +454,18 @@ class User_Model extends CI_Model {
|
||||
'isWinkeyEnabled' => $u->row()->winkey,
|
||||
'hasQrzKey' => $this->hasQrzKey($u->row()->user_id)
|
||||
);
|
||||
|
||||
|
||||
foreach (array_keys($this->frequency->defaultFrequencies) as $band) {
|
||||
$qrg_unit = $this->session->userdata("qrgunit_$band") ?? ($this->user_options_model->get_options('frequency', array('option_name' => 'unit', 'option_key' => $band))->row()->option_value ?? '');
|
||||
if ($login) {
|
||||
$qrg_unit = $this->user_options_model->get_options('frequency', array('option_name' => 'unit', 'option_key' => $band))->row()->option_value;
|
||||
} else {
|
||||
$qrg_unit = $this->session->userdata("qrgunit_$band") ?? '';
|
||||
}
|
||||
if ($qrg_unit !== '') {
|
||||
$userdata['qrgunit_'.$band] = $qrg_unit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->session->set_userdata($userdata);
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ $wwff = 0;
|
||||
<td style="text-align: center; vertical-align: middle;" ><?php echo $band->ssb;?></td>
|
||||
<td style="text-align: center; vertical-align: middle;" ><?php echo $band->data;?></td>
|
||||
<td style="text-align: center; vertical-align: middle;" ><?php echo $band->cw;?></td>
|
||||
<td style="text-align: center; vertical-align: middle;" class='band_<?php echo $band->id ?>'>
|
||||
<td style="text-align: center; vertical-align: middle;" class='band_<?php echo $band->bandid ?>'>
|
||||
<select class="form-select unitselect" name="unit_<?php echo $band->id; ?>">
|
||||
<option value="Hz" <?php if ($this->frequency->qrg_unit($band->band) == 'Hz') { echo 'selected';} ?>><?= __("Hz"); ?></option>
|
||||
<option value="kHz" <?php if ($this->frequency->qrg_unit($band->band) == 'kHz') { echo 'selected';} ?>><?= __("kHz"); ?></option>
|
||||
@@ -161,4 +161,4 @@ $wwff = 0;
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -682,7 +682,7 @@ $('#dxcc_id').ready(function() {
|
||||
|
||||
$('#dxcc_id').on('change', function() {
|
||||
printWarning();
|
||||
<?php if ($dxcc_list && $dxcc_list->result() > 0) { ?>
|
||||
<?php if (isset($dxcc_list) && $dxcc_list->result() > 0) { ?>
|
||||
let dxccadif = $('#dxcc_id').val();
|
||||
let dxccinfo = dxccarray.filter(function(dxcc) {
|
||||
return dxcc.adif == dxccadif;
|
||||
|
||||
Reference in New Issue
Block a user