Add option to en-/disable showing of qrz.com images to user account menu

这个提交包含在:
phl0 2022-04-04 13:17:33 +02:00
父节点 73ce098676
当前提交 828429312e
找不到此签名对应的密钥
GPG 密钥 ID: 48EA1E640798CA9A
共有 7 个文件被更改,包括 55 次插入10 次删除

查看文件

@ -151,7 +151,7 @@ class Logbook extends CI_Controller {
$return['callsign_state'] = $this->logbook_model->call_state($callsign);
$return['bearing'] = $this->bearing($return['callsign_qra'], $measurement_base, $station_id);
$return['workedBefore'] = $this->worked_grid_before($return['callsign_qra'], $type, $band, $mode);
if ($this->config->item('show_qrz_image')) {
if ($this->session->userdata('user_show_qrz_image')) {
if (isset($callbook)) {
if ($callbook['image'] == "") {
$return['image'] = "n/a";
@ -179,7 +179,7 @@ class Logbook extends CI_Controller {
$return['callsign_iota'] = $callbook['iota'];
$return['callsign_state'] = $callbook['state'];
$return['callsign_us_county'] = $callbook['us_county'];
if ($this->config->item('show_qrz_image')) {
if ($this->session->userdata('user_show_qrz_image')) {
if ($callbook['image'] == "") {
$return['image'] = "n/a";
} else {

查看文件

@ -74,6 +74,7 @@ class User extends CI_Controller {
$data['user_column3'] = $this->input->post('user_column3');
$data['user_column4'] = $this->input->post('user_column4');
$data['user_column5'] = $this->input->post('user_column5');
$data['user_show_qrz_image'] = $this->input->post('user_show_qrz_image');
$this->load->view('user/add', $data);
} else {
$this->load->view('user/add', $data);
@ -100,7 +101,8 @@ class User extends CI_Controller {
$this->input->post('user_column2'),
$this->input->post('user_column3'),
$this->input->post('user_column4'),
$this->input->post('user_column5'))) {
$this->input->post('user_column5'),
$this->input->post('user_show_qrz_image'))) {
// Check for errors
case EUSERNAMEEXISTS:
$data['username_error'] = 'Username <b>'.$this->input->post('user_name').'</b> already in use!';
@ -137,6 +139,7 @@ class User extends CI_Controller {
$data['user_column3'] = $this->input->post('user_column3');
$data['user_column4'] = $this->input->post('user_column4');
$data['user_column5'] = $this->input->post('user_column5');
$data['user_show_qrz_image'] = $this->input->post('user_show_qrz_image');
$this->load->view('user/add', $data);
$this->load->view('interface_assets/footer');
}
@ -308,6 +311,12 @@ class User extends CI_Controller {
$data['user_show_notes'] = $q->user_show_notes;
}
if($this->input->post('user_show_qrz_image')) {
$data['user_show_qrz_image'] = $this->input->post('user_show_qrz_image', false);
} else {
$data['user_show_qrz_image'] = $q->user_show_qrz_image;
}
if($this->input->post('user_column1')) {
$data['user_column1'] = $this->input->post('user_column1', true);
} else {
@ -387,6 +396,7 @@ class User extends CI_Controller {
$data['user_column4'] = $this->input->post('user_column4');
$data['user_column4'] = $this->input->post('user_column4');
$data['user_column5'] = $this->input->post('user_column5');
$data['user_show_qrz_image'] = $this->input->post('user_show_qrz_image');
$this->load->view('user/edit');
$this->load->view('interface_assets/footer');
}
@ -599,4 +609,4 @@ class User extends CI_Controller {
redirect('user/login');
}
}
}
}

查看文件

@ -14,16 +14,16 @@ class Migration_add_qrz_image_option extends CI_Migration {
public function up()
{
if (!$this->db->field_exists('show_qrz_image', 'users')) {
if (!$this->db->field_exists('user_show_qrz_image', 'users')) {
$fields = array(
'show_qrz_image BOOLEAN DEFAULT FALSE',
'user_show_qrz_image BOOLEAN DEFAULT FALSE',
);
$this->dbforge->add_column('users', $fields);
$this->dbforge->add_column('users', $fields, 'user_column5');
}
}
public function down()
{
$this->dbforge->drop_column('users', 'show_qrz_image');
$this->dbforge->drop_column('users', 'user_show_qrz_image');
}
}

查看文件

@ -113,7 +113,7 @@ class User_Model extends CI_Model {
// Add a user
function add($username, $password, $email, $type, $firstname, $lastname, $callsign, $locator, $timezone,
$measurement, $user_date_format, $user_stylesheet, $user_sota_lookup, $user_show_notes,
$user_column1, $user_column2, $user_column3, $user_column4, $user_column5) {
$user_column1, $user_column2, $user_column3, $user_column4, $user_column5, $user_show_qrz_image) {
// Check that the user isn't already used
if(!$this->exists($username)) {
$data = array(
@ -136,6 +136,7 @@ class User_Model extends CI_Model {
'user_column3' => xss_clean($user_column3),
'user_column4' => xss_clean($user_column4),
'user_column5' => xss_clean($user_column5),
'user_show_qrz_image' => xss_clean($user_show_qrz_image),
);
// Check the password is valid
@ -184,6 +185,7 @@ class User_Model extends CI_Model {
'user_column3' => xss_clean($fields['user_column3']),
'user_column4' => xss_clean($fields['user_column4']),
'user_column5' => xss_clean($fields['user_column5']),
'user_show_qrz_image' => xss_clean($fields['user_show_qrz_image']),
);
// Check to see if the user is allowed to change user levels
@ -293,6 +295,7 @@ class User_Model extends CI_Model {
'user_stylesheet' => $u->row()->user_stylesheet,
'user_sota_lookup' => isset($u->row()->user_sota_lookup) ? $u->row()->user_sota_lookup : 0,
'user_show_notes' => isset($u->row()->user_show_notes) ? $u->row()->user_show_notes : 1,
'user_show_qrz_image' => isset($u->row()->user_show_qrz_image) ? $u->row()->user_show_qrz_image : 0,
'user_column1' => isset($u->row()->user_column1) ? $u->row()->user_column1: 'Mode',
'user_column2' => isset($u->row()->user_column2) ? $u->row()->user_column2: 'RSTS',
'user_column3' => isset($u->row()->user_column3) ? $u->row()->user_column3: 'RSTR',

查看文件

@ -521,7 +521,7 @@
<div class="card-body callsign-suggestions"></div>
</div>
<?php if ($this->config->item('show_qrz_image')) { ?>
<?php if ($this->session->userdata('user_show_qrz_image')) { ?>
<div class="card callsign-image" id="callsign-image" style="display: none;">
<div class="card-header"><h4 style="font-size: 16px; font-weight: bold;" class="card-title"><?php echo $this->lang->line('qso_title_image'); ?></h4></div>

查看文件

@ -227,6 +227,15 @@
</div>
</div>
<div class="form-group">
<label for="showqrzimages"> Show profile picture of qrz.com in the log QSO section.</label>
<select class="custom-select" id="showqrzimages" name="user_show_qrz_image">
<option value="0"><?php echo $this->lang->line('general_word_no'); ?></option>
<option value="1"><?php echo $this->lang->line('general_word_yes'); ?></option>
</select>
<div class="small form-text text-muted">Please set your qrz.com credentials in the station locations configuration (XML subscription required).</div></td>
</div>
<input type="hidden" name="id" value="<?php echo $this->uri->segment(3); ?>" />
<button type="submit" class="btn btn-primary">Create Account</button>
</form>

查看文件

@ -414,6 +414,29 @@
</div>
</div>
</div>
<br>
<div class="row">
<!-- Club Log -->
<div class="col-md">
<div class="card">
<div class="card-header">
qrz.com Images
</div>
<div class="card-body">
<div class="form-group">
<label for="showqrzimages">Show profile picture of qrz.com in the log QSO section.</label>
<select class="custom-select" id="showqrzimages" name="user_show_qrz_image">
<option value="1" <?php if ($user_show_qrz_image == 1) { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_yes'); ?></option>
<option value="0" <?php if ($user_show_qrz_image == 0) { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_no'); ?></option>
</select>
<div class="small form-text text-muted">Please set your qrz.com credentials in the station locations configuration (XML subscription required).</div></td>
</div>
</div>
</div>
</div>
</div>
<input type="hidden" name="id" value="<?php echo $this->uri->segment(3); ?>" />
<br>