Merge pull request #1 from magicbug/dev

Dev
这个提交包含在:
Byt3 2023-08-03 09:27:48 +02:00 提交者 GitHub
当前提交 1f6817343b
找不到此签名对应的密钥
GPG 密钥 ID: 4AEE18F83AFDEB23
共有 21 个文件被更改,包括 1119 次插入104 次删除

查看文件

@ -9,7 +9,7 @@ Website: [http://www.cloudlog.co.uk](http://www.cloudlog.co.uk)
## Requirements
* Linux based Operating System
* Apache (Nginx should work)
* PHP Version 7.4 (PHP 8.0 is working, 8.1 might have some undetected issues, please report so we can fix)
* PHP Version 7.4 (PHP 8.2 works)
* MySQL (MySQL 5.7 or higher)
Notes

查看文件

@ -151,9 +151,62 @@ $config['url_suffix'] = '';
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language'] = 'english';
*/
$lang = 'english'; // this language will be used per default
if (isset($_COOKIE["language"])) {
$tmp_value = $_COOKIE["language"];
if (!empty($tmp_value)) { $lang = $tmp_value; }
}
switch ($lang) { // do this for security-reasons! parse only langs, which are known to us
case 'dutch':
$config['language'] = $lang;
break;
case 'chinese_simplified':
$config['language'] = $lang;
break;
case 'spanish':
$config['language'] = $lang;
break;
case 'czech':
$config['language'] = $lang;
break;
case 'bulgarian':
$config['language'] = $lang;
break;
case 'turkish':
$config['language'] = $lang;
break;
case 'swedish':
$config['language'] = $lang;
break;
case 'polish':
$config['language'] = $lang;
break;
case 'italian':
$config['language'] = $lang;
break;
case 'greek':
$config['language'] = $lang;
break;
case 'french':
$config['language'] = $lang;
break;
case 'finnish':
$config['language'] = $lang;
break;
case 'russian':
$config['language'] = $lang;
break;
case 'english':
$config['language'] = $lang;
break;
case 'german':
$config['language'] = $lang;
break;
}
$config['cl_multilanguage']=true;
/*
|--------------------------------------------------------------------------
| Default Character Set

查看文件

@ -21,7 +21,8 @@ $config['migration_enabled'] = TRUE;
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 131;
$config['migration_version'] = 133;
/*
|--------------------------------------------------------------------------

查看文件

@ -151,6 +151,72 @@ class QSO extends CI_Controller {
}
}
function winkeysettings() {
// Load model Winkey
$this->load->model('winkey');
// call settings from model winkey
$data['result'] = $this->winkey->settings($this->session->userdata('user_id'), $this->session->userdata('station_profile_id'));
if ($data['result'] == false) {
$this->load->view('qso/components/winkeysettings', $data);
} else {
$this->load->view('qso/components/winkeysettings_results', $data);
}
}
function cwmacrosave(){
// Get the data from the form
$function1_name = xss_clean($this->input->post('function1_name'));
$function1_macro = xss_clean($this->input->post('function1_macro'));
$function2_name = xss_clean($this->input->post('function2_name'));
$function2_macro = xss_clean($this->input->post('function2_macro'));
$function3_name = xss_clean($this->input->post('function3_name'));
$function3_macro = xss_clean($this->input->post('function3_macro'));
$function4_name = xss_clean($this->input->post('function4_name'));
$function4_macro = xss_clean($this->input->post('function4_macro'));
$function5_name = xss_clean($this->input->post('function5_name'));
$function5_macro = xss_clean($this->input->post('function5_macro'));
$data = [
'user_id' => $this->session->userdata('user_id'),
'station_location_id' => $this->session->userdata('station_profile_id'),
'function1_name' => $function1_name,
'function1_macro' => $function1_macro,
'function2_name' => $function2_name,
'function2_macro' => $function2_macro,
'function3_name' => $function3_name,
'function3_macro' => $function3_macro,
'function4_name' => $function4_name,
'function4_macro' => $function4_macro,
'function5_name' => $function5_name,
'function5_macro' => $function5_macro,
];
// Load model Winkey
$this->load->model('winkey');
// save the data
$this->winkey->save($data);
echo "Macros Saved, Press Close and lets get sending!";
}
function cwmacros_json() {
// Load model Winkey
$this->load->model('winkey');
header('Content-Type: application/json; charset=utf-8');
// Call settings_json from model winkey
echo $this->winkey->settings_json($this->session->userdata('user_id'), $this->session->userdata('station_profile_id'));
}
function edit_ajax() {
$this->load->model('logbook_model');

查看文件

@ -6,13 +6,12 @@ class User extends CI_Controller {
{
parent::__construct();
// Load language files
$this->lang->load(array(
'account',
'lotw',
'eqsl',
'admin',
));
$this->lang->load(array(
'account',
'lotw',
'eqsl',
'admin',
));
}
public function index()
@ -33,6 +32,8 @@ class User extends CI_Controller {
$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'); }
$data['existing_languages'] = $this->find();
$this->load->model('bands');
$this->load->library('form_validation');
@ -54,15 +55,14 @@ class User extends CI_Controller {
// Get timezones
$data['timezones'] = $this->user_model->timezones();
$data['language'] = 'english';
if ($this->form_validation->run() == FALSE)
{
if ($this->form_validation->run() == FALSE) {
$data['page_title'] = "Add User";
$data['measurement_base'] = $this->config->item('measurement_base');
$this->load->view('interface_assets/header', $data);
if($this->input->post('user_name'))
{
if($this->input->post('user_name')) {
$data['user_name'] = $this->input->post('user_name');
$data['user_email'] = $this->input->post('user_email');
$data['user_password'] = $this->input->post('user_password');
@ -90,14 +90,13 @@ class User extends CI_Controller {
$data['user_mastodon_url'] = $this->input->post('user_mastodon_url');
$data['user_gridmap_default_band'] = $this->input->post('user_gridmap_default_band');
$data['user_gridmap_confirmation'] = ($this->input->post('user_gridmap_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_gridmap_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_gridmap_confirmation_eqsl') !== null ? 'E' : '');
$data['language'] = $this->input->post('language');
$this->load->view('user/add', $data);
} else {
$this->load->view('user/add', $data);
}
$this->load->view('interface_assets/footer');
}
else
{
} else {
switch($this->user_model->add($this->input->post('user_name'),
$this->input->post('user_password'),
$this->input->post('user_email'),
@ -125,7 +124,9 @@ class User extends CI_Controller {
$this->input->post('user_amsat_status_upload'),
$this->input->post('user_mastodon_url'),
$this->input->post('user_gridmap_default_band'),
($this->input->post('user_gridmap_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_gridmap_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_gridmap_confirmation_eqsl') !== null ? 'E' : ''))) {
($this->input->post('user_gridmap_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_gridmap_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_gridmap_confirmation_eqsl') !== null ? 'E' : ''),
$this->input->post('language'),
)) {
// Check for errors
case EUSERNAMEEXISTS:
$data['username_error'] = 'Username <b>'.$this->input->post('user_name').'</b> already in use!';
@ -171,16 +172,35 @@ class User extends CI_Controller {
$data['user_mastodon_url'] = $this->input->post('user_mastodon_url');
$data['user_gridmap_default_band'] = $this->input->post('user_gridmap_default_band');
$data['user_gridmap_confirmation'] = ($this->input->post('user_gridmap_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_gridmap_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_gridmap_confirmation_eqsl') !== null ? 'E' : '');
$data['language'] = $this->input->post('language');
$this->load->view('user/add', $data);
$this->load->view('interface_assets/footer');
}
}
function find() {
$existing_langs = array();
$lang_path = APPPATH.'language';
$results = scandir($lang_path);
foreach ($results as $result) {
if ($result === '.' or $result === '..') continue;
if (is_dir(APPPATH.'language' . '/' . $result)) {
$dirs[] = $result;
}
}
return $dirs;
}
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'); }
$query = $this->user_model->get_by_id($this->uri->segment(3));
$data['existing_languages'] = $this->find();
$this->load->model('bands');
$this->load->library('form_validation');
@ -208,7 +228,6 @@ class User extends CI_Controller {
{
$data['page_title'] = "Edit User";
$this->load->view('interface_assets/header', $data);
$q = $query->row();
$data['id'] = $q->user_id;
@ -327,6 +346,13 @@ class User extends CI_Controller {
$data['user_date_format'] = $q->user_date_format;
}
if($this->input->post('language')) {
$data['language'] = $this->input->post('language', true);
} else {
$data['language'] = $q->language;
}
if($this->input->post('user_stylesheet')) {
$data['user_stylesheet'] = $this->input->post('user_stylesheet', true);
} else {
@ -429,11 +455,10 @@ class User extends CI_Controller {
$data['user_column5'] = $q->user_column5;
}
$this->load->view('interface_assets/header', $data);
$this->load->view('user/edit', $data);
$this->load->view('interface_assets/footer');
}
else
{
} else {
unset($data);
switch($this->user_model->edit($this->input->post())) {
// Check for errors
@ -448,6 +473,17 @@ class User extends CI_Controller {
break;
// All okay, return to user screen
case OK:
if ($this->session->userdata('user_id') == $this->uri->segment(3)) { // Editing own User? Set cookie!
$cookie= array(
'name' => 'language',
'value' => $this->input->post('language', true),
'expire' => time()+1000,
'secure' => FALSE
);
$this->input->set_cookie($cookie);
}
if($this->session->userdata('user_id') == $this->input->post('id', true)) {
$this->session->set_flashdata('success', 'User '.$this->input->post('user_name', true).' edited');
redirect('user/edit/'.$this->uri->segment(3));
@ -487,6 +523,7 @@ class User extends CI_Controller {
$data['user_mastodon_url'] = $this->input->post('user_mastodon_url');
$data['user_gridmap_default_band'] = $this->input->post('user_gridmap_default_band');
$data['user_gridmap_confirmation'] = ($this->input->post('user_gridmap_confirmation_qsl') !== null ? 'Q' : '').($this->input->post('user_gridmap_confirmation_lotw') !== null ? 'L' : '').($this->input->post('user_gridmap_confirmation_eqsl') !== null ? 'E' : '');
$data['language'] = $this->input->post('language');
$this->load->view('user/edit');
$this->load->view('interface_assets/footer');
}
@ -557,19 +594,26 @@ class User extends CI_Controller {
$data['user'] = $query->row();
if ($this->form_validation->run() == FALSE)
{
if ($this->form_validation->run() == FALSE) {
$data['page_title'] = "Login";
$this->load->view('interface_assets/mini_header', $data);
$this->load->view('user/login');
$this->load->view('interface_assets/footer');
}
else
{
} 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(
'name' => 'language',
'value' => $data['user']->language,
'expire' => time()+1000,
'secure' => FALSE
);
$this->input->set_cookie($cookie);
redirect('dashboard');
} else {
$this->session->set_flashdata('error', 'Incorrect username or password!');
@ -591,9 +635,9 @@ class User extends CI_Controller {
/**
* Function: forgot_password
*
*
* Allows users to input an email address and a password will be sent to that address.
*
*
*/
function forgot_password() {
@ -614,7 +658,7 @@ class User extends CI_Controller {
{
// Check email address exists
$this->load->model('user_model');
$check_email = $this->user_model->check_email_address($this->input->post('email', true));
if($check_email == TRUE) {
@ -623,7 +667,7 @@ class User extends CI_Controller {
$reset_code = random_string('alnum', 50);
$this->user_model->set_password_reset_code($this->input->post('email', true), $reset_code);
// Send email with reset code
$this->data['reset_code'] = $reset_code;
@ -676,10 +720,10 @@ class User extends CI_Controller {
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->form_validation->set_rules('password', 'Password', 'required');
$this->form_validation->set_rules('password_confirm', 'Password Confirmation', 'required|matches[password]');
if ($this->form_validation->run() == FALSE)
{
$data['page_title'] = "Reset Password";
@ -691,7 +735,7 @@ class User extends CI_Controller {
{
// Lets reset the password!
$this->load->model('user_model');
$this->user_model->reset_password($this->input->post('password', true), $reset_code);
$this->session->set_flashdata('notice', 'Password Reset.');
redirect('user/login');

查看文件

@ -44,7 +44,7 @@ $lang['account_location_auto_lookup'] = 'Automatische Ermittlung der Lokation.';
$lang['account_if_set_gridsquare_is_fetched_based_on_location_name'] = 'Wenn aktiviert, wird das Planquadrat basierend auf der Lokation ermittelt.';
$lang['account_sota_auto_lookup_gridsquare_and_name_for_summit'] = 'Automatische Ermittlung von Planquadrat und Lokation anhand des SOTA Gipfels.';
$lang['account_wwff_auto_lookup_gridsquare_and_name_for_reference'] = 'Automatische Ermittlung von Planquadrat und Lokation andhand der WWFF Referenz.';
$lang['account_pota_auto_lookup_gridsquare_and_name_for_park'] = 'Automatische Ermuttlung des Parknamens anhand der POTA Referenz.';
$lang['account_pota_auto_lookup_gridsquare_and_name_for_park'] = 'Automatische Ermittlung des Parknamens anhand der POTA Referenz.';
$lang['account_if_set_name_and_gridsquare_is_fetched_from_the_api_and_filled_in_location_and_locator'] = 'Wenn aktiviert, werden Name und Planquadrat über die API ermittelt und gesetzt.';
$lang['account_previous_qsl_type'] = 'QSL Typ der vorherigen QSOs';

查看文件

@ -0,0 +1,116 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
* This migration creates a table called thirdparty_logins
* This table is used to store third party login details
*/
class Migration_create_cwmacros_table extends CI_Migration {
public function up()
{
if (!$this->db->table_exists('cwmacros')) {
$this->dbforge->add_field(array(
'id' => array(
'type' => 'BIGINT',
'constraint' => 20,
'unsigned' => TRUE,
'auto_increment' => TRUE,
'unique' => TRUE
),
'user_id' => array(
'type' => 'BIGINT',
'constraint' => 20,
'unsigned' => TRUE,
'auto_increment' => FALSE
),
'station_location_id' => array(
'type' => 'BIGINT',
'constraint' => 20,
'unsigned' => TRUE,
'auto_increment' => FALSE
),
'function1_name' => array(
'type' => 'VARCHAR',
'constraint' => '255',
'null' => TRUE
),
'function1_macro' => array(
'type' => 'VARCHAR',
'constraint' => '255',
'null' => TRUE
),
'function2_name' => array(
'type' => 'VARCHAR',
'constraint' => '255',
'null' => TRUE
),
'function2_macro' => array(
'type' => 'VARCHAR',
'constraint' => '255',
'null' => TRUE
),
'function3_name' => array(
'type' => 'VARCHAR',
'constraint' => '255',
'null' => TRUE
),
'function3_macro' => array(
'type' => 'VARCHAR',
'constraint' => '255',
'null' => TRUE
),
'function4_name' => array(
'type' => 'VARCHAR',
'constraint' => '255',
'null' => TRUE
),
'function4_macro' => array(
'type' => 'VARCHAR',
'constraint' => '255',
'null' => TRUE
),
'function5_name' => array(
'type' => 'VARCHAR',
'constraint' => '255',
'null' => TRUE
),
'function5_macro' => array(
'type' => 'VARCHAR',
'constraint' => '255',
'null' => TRUE
),
'modified' => array(
'type' => 'timestamp',
'null' => TRUE,
)
));
$this->dbforge->add_key('id', TRUE);
$this->dbforge->add_key('user_id', TRUE);
$this->dbforge->add_key('station_location_id', TRUE);
$this->dbforge->create_table('cwmacros');
}
}
public function down()
{
$this->dbforge->drop_table('cwmacros');
}
}

查看文件

@ -0,0 +1,28 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
* This adds a field to user-table to hold/persist language-setting per user
*/
class Migration_add_user_language extends CI_Migration {
public function up()
{
if (!$this->db->field_exists('language', 'users')) {
$fields = array(
'language varchar(32) default "english"',
);
$this->dbforge->add_column('users', $fields);
}
}
public function down()
{
if ($this->db->field_exists('language', 'users')) {
$this->dbforge->drop_column('users', 'language');
}
}
}

查看文件

@ -536,7 +536,7 @@ class Logbook_model extends CI_Model {
if (isset($result->hrdlog_code) && $result->hrdlogrealtime == 1) {
$CI =& get_instance();
$CI->load->library('AdifHelper');
$qso = $this->get_qso($last_id)->result();
$qso = $this->get_qso($last_id,true)->result();
$adif = $CI->adifhelper->getAdifLine($qso[0]);
$result = $this->push_qso_to_hrdlog($result->hrdlog_code, $data['COL_STATION_CALLSIGN'], $adif);
@ -550,7 +550,7 @@ class Logbook_model extends CI_Model {
if (isset($result->qrzapikey) && $result->qrzrealtime == 1) {
$CI =& get_instance();
$CI->load->library('AdifHelper');
$qso = $this->get_qso($last_id)->result();
$qso = $this->get_qso($last_id,true)->result();
$adif = $CI->adifhelper->getAdifLine($qso[0]);
$result = $this->push_qso_to_qrz($result->qrzapikey, $adif);
@ -564,7 +564,7 @@ class Logbook_model extends CI_Model {
if (isset($result->webadifapikey) && $result->webadifrealtime == 1) {
$CI =& get_instance();
$CI->load->library('AdifHelper');
$qso = $this->get_qso($last_id)->result();
$qso = $this->get_qso($last_id,true)->result();
$adif = $CI->adifhelper->getAdifLine($qso[0]);
$result = $this->push_qso_to_webadif(
@ -1446,8 +1446,8 @@ class Logbook_model extends CI_Model {
return $this->db->get();
}
function get_qso($id) {
if ($this->logbook_model->check_qso_is_accessible($id)) {
function get_qso($id, $trusted = false) {
if ($trusted || ($this->logbook_model->check_qso_is_accessible($id))) {
$this->db->select($this->config->item('table_name').'.*, station_profile.*, dxcc_entities.*, coalesce(dxcc_entities_2.name, "- NONE -") as station_country, dxcc_entities_2.end as station_end, eQSL_images.image_file as eqsl_image_file, lotw_users.callsign as lotwuser, lotw_users.lastupload');
$this->db->from($this->config->item('table_name'));
$this->db->join('dxcc_entities', $this->config->item('table_name').'.col_dxcc = dxcc_entities.adif', 'left');

查看文件

@ -57,9 +57,9 @@ class User_Model extends CI_Model {
/*
* Function: check_email_address
*
*
* Checks if an email address is already in use
*
*
* @param string $email
*/
function check_email_address($email) {
@ -68,7 +68,7 @@ class User_Model extends CI_Model {
$this->db->where('user_email', $clean_email);
$query = $this->db->get($this->config->item('auth_table'));
if ($query->num_rows() > 0) {
return true;
} else {
@ -80,7 +80,7 @@ class User_Model extends CI_Model {
$this->db->where('station_id', $station_id);
$this->db->join('station_profile', 'station_profile.user_id = '.$this->config->item('auth_table').'.user_id');
$query = $this->db->get($this->config->item('auth_table'));
$ret = $query->row();
return $ret->user_email;
}
@ -124,7 +124,7 @@ class User_Model extends CI_Model {
$measurement, $user_date_format, $user_stylesheet, $user_qth_lookup, $user_sota_lookup, $user_wwff_lookup,
$user_pota_lookup, $user_show_notes, $user_column1, $user_column2, $user_column3, $user_column4, $user_column5,
$user_show_profile_image, $user_previous_qsl_type, $user_amsat_status_upload, $user_mastodon_url,
$user_gridmap_default_band, $user_gridmap_confirmation) {
$user_gridmap_default_band, $user_gridmap_confirmation, $language) {
// Check that the user isn't already used
if(!$this->exists($username)) {
$data = array(
@ -156,6 +156,7 @@ class User_Model extends CI_Model {
'user_mastodon_url' => xss_clean($user_mastodon_url),
'user_gridmap_default_band' => xss_clean($user_gridmap_default_band),
'user_gridmap_confirmation' => xss_clean($user_gridmap_confirmation),
'language' => xss_clean($language),
);
// Check the password is valid
@ -215,6 +216,7 @@ class User_Model extends CI_Model {
'user_mastodon_url' => xss_clean($fields['user_mastodon_url']),
'user_gridmap_default_band' => xss_clean($fields['user_gridmap_default_band']),
'user_gridmap_confirmation' => (isset($fields['user_gridmap_confirmation_qsl']) ? 'Q' : '').(isset($fields['user_gridmap_confirmation_lotw']) ? 'L' : '').(isset($fields['user_gridmap_confirmation_eqsl']) ? 'E' : ''),
'language' => xss_clean($fields['language']),
);
// Check to see if the user is allowed to change user levels
@ -339,6 +341,7 @@ class User_Model extends CI_Model {
'user_gridmap_default_band' => $u->row()->user_gridmap_default_band,
'user_gridmap_confirmation' => $u->row()->user_gridmap_confirmation,
'active_station_logbook' => $u->row()->active_station_logbook,
'language' => isset($u->row()->language) ? $u->row()->language: 'english',
);
$this->session->set_userdata($userdata);
@ -439,7 +442,7 @@ class User_Model extends CI_Model {
*
* Stores generated password reset code in the database and sets the date to exactly
* when the sql query runs.
*
*
* @param string $user_email
* @return string $reset_code
*/
@ -448,7 +451,7 @@ class User_Model extends CI_Model {
'reset_password_code' => $reset_code,
'reset_password_date' => date('Y-m-d H:i:s')
);
$this->db->where('user_email', $user_email);
$this->db->update('users', $data);
}
@ -457,7 +460,7 @@ class User_Model extends CI_Model {
* FUNCTION: reset_password
*
* Sets new password for users account where the reset code matches then clears the password reset code and password reset date.
*
*
* @param string $password
* @return string $reset_code
*/
@ -467,7 +470,7 @@ class User_Model extends CI_Model {
'reset_password_code' => NULL,
'reset_password_date' => NULL
);
$this->db->where('reset_password_code', $reset_code);
$this->db->update('users', $data);
}

查看文件

@ -0,0 +1,49 @@
<?php
class Winkey extends CI_Model
{
public function settings($user_id, $station_location_id)
{
$this->db->where('user_id', $user_id);
$this->db->where('station_location_id', $station_location_id);
$query = $this->db->get('cwmacros');
if ($query->num_rows() > 0) {
return $query->row();
} else {
return false;
}
}
public function settings_json($user_id, $station_location_id)
{
$this->db->where('user_id', $user_id);
$this->db->where('station_location_id', $station_location_id);
$query = $this->db->get('cwmacros');
if ($query->num_rows() > 0) {
// return $query->row() as json
return json_encode($query->row());
} else {
// return json with status not found
return json_encode(array('status' => 'not found'));
}
}
public function save($data)
{
$this->db->where('user_id', $data['user_id']);
$this->db->where('station_location_id', $data['station_location_id']);
$query = $this->db->get('cwmacros');
if ($query->num_rows() > 0) {
$this->db->where('user_id', $data['user_id']);
$this->db->where('station_location_id', $data['station_location_id']);
$this->db->update('cwmacros', $data);
} else {
$this->db->insert('cwmacros', $data);
}
}
}
?>

查看文件

@ -7,6 +7,8 @@
var base_url = "<?php echo base_url(); ?>"; // Base URL
var site_url = "<?php echo site_url(); ?>"; // Site URL
var icon_dot_url = "<?php echo base_url();?>assets/images/dot.png";
// get the user_callsign from session
var my_call = "<?php echo $this->session->userdata('user_callsign'); ?>".toUpperCase();
</script>
<!-- General JS Files used across Cloudlog -->
@ -936,7 +938,9 @@ $(document).on('keypress',function(e) {
<?php } ?>
<?php if ($this->uri->segment(1) == "qso") { ?>
<script src="<?php echo base_url() ;?>assets/js/sections/qso.js"></script>
<script src="<?php echo base_url() ;?>assets/js/winkey.js"></script>
<?php
if ($this->optionslib->get_option('dxcache_url') != ''){ ?>
@ -953,6 +957,7 @@ $(document).on('keypress',function(e) {
});
});
</script>
<?php
}

查看文件

@ -1,57 +1,78 @@
<div class="container">
<br>
<?php if($this->session->flashdata('message')) { ?>
<!-- Display Message -->
<div class="alert-message error">
<p><?php echo $this->session->flashdata('message'); ?></p>
</div>
<?php } ?>
<h2><?php echo $page_title; ?></h2>
<div class="card">
<div class="card-header">
Maintenance
</div>
<?php if($is_there_qsos_with_no_station_id >= 1) { ?>
<div class="alert alert-danger" role="alert">
<span class="badge badge-pill badge-warning">Warning</span> The Database contains QSOs without a station-profile (location)<br/>
</div>
<div class="card-body">
<p class="card-text">Please reassign those QSOs to an existing station location:</p>
<div class="table-responsive">
<table id="station_locations_table" class="table table-sm table-striped">
<thead>
<tr>
<th scope="col">Call</th>
<th scope="col">Target Location</th>
<th scope="col">Reassign</th>
</tr>
</thead>
<tbody>
<?php
<br>
<?php if($this->session->flashdata('message')) { ?>
<!-- Display Message -->
<div class="alert-message error">
<p><?php echo $this->session->flashdata('message'); ?></p>
</div>
<?php } ?>
<h2><?php echo $page_title; ?></h2>
<div class="card" style="margin-bottom: 15px;">
<div class="card-header">
QSO-DB Maintenance
</div>
<?php if($is_there_qsos_with_no_station_id >= 1) { ?>
<div class="alert alert-danger" role="alert" style="margin-bottom: 0px !important;">
<span class="badge badge-pill badge-warning">Warning</span> The Database contains QSOs without a station-profile (location)<br/>
</div>
<div class="card-body">
<p class="card-text">Please reassign those QSOs to an existing station location:</p>
<div class="table-responsive">
<table id="station_locations_table" class="table table-sm table-striped">
<thead>
<tr>
<th scope="col">Call</th>
<th scope="col">Target Location</th>
<th scope="col">Reassign</th>
</tr>
</thead>
<tbody>
<?php
foreach ($calls_wo_sid as $call) {
echo '<tr><td>'.$call['COL_STATION_CALLSIGN'].'</td><td><select name="station_profile" id="station_profile">';
$options='';
foreach ($stations->result() as $station) {
$options.='<option value='.$station->station_id.'>'.$station->station_profile_name.' ('.$station->station_callsign.')</option>';
}
$options='';
foreach ($stations->result() as $station) {
$options.='<option value='.$station->station_id.'>'.$station->station_profile_name.' ('.$station->station_callsign.')</option>';
}
echo $options.'</select></td><td><button class="btn btn-warning" onClick="reassign(\''.$call['COL_STATION_CALLSIGN'].'\',$(\'#station_profile option:selected\').val());"><i class="fas fa-sync"></i>Reassign</a></button></td></tr>';
} ?>
</tbody></table>
</div>
</div>
<?php
} else { ?>
<div class="alert alert-secondary" role="alert">
<span class="badge badge-pill badge-success">Everything ok</span> Every QSO in your Database is assigned to a station-profile (location)
</div>
</tbody>
</table>
</div>
</div>
<?php
} else { ?>
<div class="alert alert-secondary" role="alert" style="margin-bottom: 0px !important;">
<span class="badge badge-pill badge-success">Everything ok</span> Every QSO in your Database is assigned to a station-profile (location)
</div>
<?php } ?>
</div>
</div>
<div class="card">
<div class="card-header">
Settings Maintenance
</div>
<?php if(!$this->config->item('cl_multilanguage')) { ?>
<div class="alert alert-danger" role="alert" style="margin-bottom: 0px !important;">
<span class="badge badge-pill badge-warning">Warning</span> You didn't enabled Multilanguage support in your config.php
</div>
<div class="card-body">
<p class="card-text">Please edit your ./application/config/config.php File and add some rows to it:</br></br>
Go to your application/config Folder and compare config.sample.php with your config.php</br>
You'll probably find a block with language-settings. Please include this block into your current config.php
</p>
</div>
<?php
} else { ?>
<div class="alert alert-secondary" role="alert" style="margin-bottom: 0px !important;">
<span class="badge badge-pill badge-success">Everything ok</span> You have enabled Multuser-Language support
</div>
<?php } ?>
</div>
</div>

查看文件

@ -0,0 +1,96 @@
<div id="modal-backdrop" class="modal-backdrop fade show" style="display:block;"></div>
<div id="modal" class="modal fade show" tabindex="-1" style="display:block;">
<form hx-post="/index.php/qso/cwmacrosave" hx-target=".modal-body">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Winkey Macros</h5>
</div>
<div class="modal-body">
<div class="form-group row">
<label for="function1_name" class="col-sm-5 col-form-label">Function 1 - Name</label>
<div class="col-sm-7">
<input name="function1_name" type="text" class="form-control" id="function1_name" maxlength="6">
</div>
</div>
<div class="form-group row">
<label for="function1_macro" class="col-sm-5 col-form-label">Function 1 - Macro</label>
<div class="col-sm-7">
<input name="function1_macro" type="text" class="form-control" id="function1_macro">
</div>
</div>
<hr>
<div class="form-group row">
<label for="function2_name" class="col-sm-5 col-form-label">Function 2 - Name</label>
<div class="col-sm-7">
<input name="function2_name" type="text" class="form-control" id="function2_name" maxlength="6">
</div>
</div>
<div class="form-group row">
<label for="function2_macro" class="col-sm-5 col-form-label">Function 2 - Macro</label>
<div class="col-sm-7">
<input name="function2_macro" type="text" class="form-control" id="function2_macro">
</div>
</div>
<hr>
<div class="form-group row">
<label for="function3_name" class="col-sm-5 col-form-label">Function 3 - Name</label>
<div class="col-sm-7">
<input name="function3_name" type="text" class="form-control" id="function3_name" maxlength="6">
</div>
</div>
<div class="form-group row">
<label for="function3_macro" class="col-sm-5 col-form-label">Function 3 - Macro</label>
<div class="col-sm-7">
<input name="function3_macro" type="text" class="form-control" id="function3_macro">
</div>
</div>
<hr>
<div class="form-group row">
<label for="function4_name" class="col-sm-5 col-form-label">Function 4 - Name</label>
<div class="col-sm-7">
<input name="function4_name" type="text" class="form-control" id="function4_name" maxlength="6">
</div>
</div>
<div class="form-group row">
<label for="function4_macro" class="col-sm-5 col-form-label">Function 4 - Macro</label>
<div class="col-sm-7">
<input name="function4_macro" type="text" class="form-control" id="function4_macro">
</div>
</div>
<hr>
<div class="form-group row">
<label for="function5_name" class="col-sm-5 col-form-label">Function 5 - Name</label>
<div class="col-sm-7">
<input name="function5_name" type="text" class="form-control" id="function5_name" maxlength="6">
</div>
</div>
<div class="form-group row">
<label for="function5_macro" class="col-sm-5 col-form-label">Function 5 - Macro</label>
<div class="col-sm-7">
<input name="function5_macro" type="text" class="form-control" id="function5_macro">
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Save</button>
<button type="button" class="btn btn-secondary" onclick="closeModal()">Close</button>
</div>
</div>
</div>
</form>
</div>

查看文件

@ -0,0 +1,96 @@
<div id="modal-backdrop" class="modal-backdrop fade show" style="display:block;"></div>
<div id="modal" class="modal fade show" tabindex="-1" style="display:block;">
<form hx-post="/index.php/qso/cwmacrosave" hx-target=".modal-body">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Winkey Macros</h5>
</div>
<div class="modal-body">
<div class="form-group row">
<label for="function1_name" class="col-sm-5 col-form-label">Function 1 - Name</label>
<div class="col-sm-7">
<input name="function1_name" type="text" class="form-control" id="function1_name" maxlength="6" value="<?php echo $result->function1_name; ?>">
</div>
</div>
<div class="form-group row">
<label for="function1_macro" class="col-sm-5 col-form-label">Function 1 - Macro</label>
<div class="col-sm-7">
<input name="function1_macro" type="text" class="form-control" id="function1_macro" value="<?php echo $result->function1_macro; ?>">
</div>
</div>
<hr>
<div class="form-group row">
<label for="function2_name" class="col-sm-5 col-form-label">Function 2 - Name</label>
<div class="col-sm-7">
<input name="function2_name" type="text" class="form-control" id="function2_name" maxlength="6" value="<?php echo $result->function2_name; ?>">
</div>
</div>
<div class="form-group row">
<label for="function2_macro" class="col-sm-5 col-form-label">Function 2 - Macro</label>
<div class="col-sm-7">
<input name="function2_macro" type="text" class="form-control" id="function2_macro" value="<?php echo $result->function2_macro; ?>">
</div>
</div>
<hr>
<div class="form-group row">
<label for="function3_name" class="col-sm-5 col-form-label">Function 3 - Name</label>
<div class="col-sm-7">
<input name="function3_name" type="text" class="form-control" id="function3_name" maxlength="6" value="<?php echo $result->function3_name; ?>">
</div>
</div>
<div class="form-group row">
<label for="function3_macro" class="col-sm-5 col-form-label">Function 3 - Macro</label>
<div class="col-sm-7">
<input name="function3_macro" type="text" class="form-control" id="function3_macro" value="<?php echo $result->function3_macro; ?>">
</div>
</div>
<hr>
<div class="form-group row">
<label for="function4_name" class="col-sm-5 col-form-label">Function 4 - Name</label>
<div class="col-sm-7">
<input name="function4_name" type="text" class="form-control" id="function4_name" maxlength="6" value="<?php echo $result->function4_name; ?>">
</div>
</div>
<div class="form-group row">
<label for="function4_macro" class="col-sm-5 col-form-label">Function 4 - Macro</label>
<div class="col-sm-7">
<input name="function4_macro" type="text" class="form-control" id="function4_macro" value="<?php echo $result->function4_macro; ?>">
</div>
</div>
<hr>
<div class="form-group row">
<label for="function5_name" class="col-sm-5 col-form-label">Function 5 - Name</label>
<div class="col-sm-7">
<input name="function5_name" type="text" class="form-control" id="function5_name" maxlength="6" value="<?php echo $result->function5_name; ?>">
</div>
</div>
<div class="form-group row">
<label for="function5_macro" class="col-sm-5 col-form-label">Function 5 - Macro</label>
<div class="col-sm-7">
<input name="function5_macro" type="text" class="form-control" id="function5_macro" value="<?php echo $result->function5_macro; ?>">
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Save</button>
<button type="button" class="btn btn-secondary" onclick="closeModal()">Close</button>
</div>
</div>
</div>
</form>
</div>

查看文件

@ -518,6 +518,37 @@
<div id="qsomap" style="width: 100%; height: 200px;"></div>
</div>
<div id="winkey" class="card winkey-settings" style="margin-bottom: 10px;">
<div class="card-header">
<h4 style="font-size: 16px; font-weight: bold;" class="card-title">Winkey
<button id="connectButton" class="btn btn-primary">Connect</button>
<button type="button" class="btn btn-light"
hx-get="/index.php/qso/winkeysettings"
hx-target="#modals-here"
hx-trigger="click"
class="btn btn-primary"
_="on htmx:afterOnLoad wait 10ms then add .show to #modal then add .show to #modal-backdrop"><i class="fas fa-cog"></i> Settings</button>
</h4>
</div>
<div id="modals-here"></div>
<div id="winkey_buttons" class="card-body">
<button id="morsekey_func1" onclick="morsekey_func1()" class="btn btn-warning">F1</button>
<button id="morsekey_func2" onclick="morsekey_func2()" class="btn btn-warning">F2</button>
<button id="morsekey_func3" onclick="morsekey_func3()" class="btn btn-warning">F3</button>
<button id="morsekey_func4" onclick="morsekey_func4()" class="btn btn-warning">F4</button>
<button id="morsekey_func5" onclick="morsekey_func5()" class="btn btn-warning">F5</button>
<br><br>
<input id="sendText" type="text"><input id="sendButton" type="button" value="Send" class="btn btn-success">
<span id="statusBar"></span><br>
</div>
</div>
<div class="card callsign-suggest">
<div class="card-header"><h4 style="font-size: 16px; font-weight: bold;" class="card-title"><?php echo lang('qso_title_suggestions'); ?></h4></div>

查看文件

@ -190,6 +190,18 @@
</select>
<small id="user_measurement_base_Help" class="form-text text-muted"><?php echo lang('account_choose_which_unit_distances_will_be_shown_in'); ?></small>
</div>
<?php if ($this->config->item('cl_multilanguage')) { ?>
<div class="form-group">
<label for="language">Cloudlog Language</label>
<?php
foreach($existing_languages as $lang){
$options[$lang] = ucfirst($lang);
}
echo form_dropdown('language', $options, $language);
?>
<small id="language_Help" class="form-text text-muted">Choose Cloudlog language.</small>
</div>
<?php } ?>
</div>
</div>

查看文件

@ -73,11 +73,11 @@
$levels = $this->config->item('auth_level');
foreach ($levels as $key => $value) {
echo '<option value="'. $key . '"';
if($user_type == $key) {
echo "selected=\"selected\"";
}
if($user_type == $key) {
echo "selected=\"selected\"";
}
echo '>' . $value . '</option>';
}
}
?>
</select>
<?php } else {
@ -191,6 +191,19 @@
</select>
<small id="user_measurement_base_Help" class="form-text text-muted"><?php echo lang('account_choose_which_unit_distances_will_be_shown_in'); ?></small>
</div>
<?php if ($this->config->item('cl_multilanguage')) { ?>
<div class="form-group">
<label for="language">Cloudlog Language</label>
<?php
foreach($existing_languages as $lang){
$options[$lang] = ucfirst($lang);
}
echo form_dropdown('language', $options, $language);
?>
<small id="language_Help" class="form-text text-muted">Choose Cloudlog language.</small>
</div>
<?php } ?>
</div>
</div>
</div>

查看文件

@ -854,3 +854,17 @@ function resetDefaultQSOFields() {
$('#callsign-image-content').text("");
$('.dxccsummary').remove();
}
function closeModal() {
var container = document.getElementById("modals-here")
var backdrop = document.getElementById("modal-backdrop")
var modal = document.getElementById("modal")
modal.classList.remove("show")
backdrop.classList.remove("show")
setTimeout(function() {
container.removeChild(backdrop)
container.removeChild(modal)
}, 200)
}

313
assets/js/winkey.js 普通文件
查看文件

@ -0,0 +1,313 @@
// Lets see if CW is selected
const ModeSelected = document.getElementById('mode');
$('#winkey_buttons').hide();
if (location.protocol == 'http:') {
// Do something if the page is being served over SSL
$('#winkey').hide(); // Hide the CW buttons
}
if (ModeSelected.value == 'CW') {
// Show the CW buttons
$('#winkey').show();
} else {
// Hide the CW buttons
$('#winkey').hide();
}
ModeSelected.addEventListener('change', (event) => {
if (event.target.value == 'CW') {
// Show the CW buttons
$('#winkey').show();
} else {
// Hide the CW buttons
$('#winkey').hide();
}
});
let function1Name, function1Macro, function2Name, function2Macro, function3Name, function3Macro, function4Name, function4Macro, function5Name, function5Macro;
getMacros();
document.addEventListener('keydown', function(event) {
if (event.key === 'F1') {
event.preventDefault();
morsekey_func1();
}
if (event.key === 'F2') {
event.preventDefault();
morsekey_func2();
}
if (event.key === 'F3') {
event.preventDefault();
morsekey_func3();
}
if (event.key === 'F4') {
event.preventDefault();
morsekey_func4();
}
if (event.key === 'F5') {
event.preventDefault();
morsekey_func5();
}
});
let sendText = document.getElementById("sendText");
let sendButton = document.getElementById("sendButton");
let receiveText = document.getElementById("receiveText");
let connectButton = document.getElementById("connectButton");
let statusBar = document.getElementById("statusBar");
//Couple the elements to the Events
connectButton.addEventListener("click", clickConnect)
sendButton.addEventListener("click", clickSend)
statusButton.addEventListener("click", clickStatus)
//When the connectButton is pressed
async function clickConnect() {
if (port) {
//if already connected, disconnect
disconnect();
$('#winkey_buttons').hide();
} else {
//otherwise connect
await connect();
$('#winkey_buttons').show();
}
}
//Define outputstream, inputstream and port so they can be used throughout the sketch
var outputStream, inputStream, port;
navigator.serial.addEventListener('connect', e => {
statusBar.innerText = `Connected to ${e.port}`;
connectButton.innerText = "Disconnect"
});
navigator.serial.addEventListener('disconnect', e => {
statusBar.innerText = `Disconnected`;
connectButton.innerText = "Connect"
});
let debug = 0;
let speed = 24;
let minSpeed = 20;
let maxSpeed = 40;
//Connect to the serial
async function connect() {
//Optional filter to only see relevant boards
const filter = {
usbVendorId: 0x2341 // Arduino SA
};
//Try to connect to the Serial port
try {
port = await navigator.serial.requestPort(/*{ filters: [filter] }*/);
// Continue connecting to |port|.
// - Wait for the port to open.
await port.open({ baudRate: 1200 });
await port.setSignals({ dataTerminalReady: true });
statusBar.innerText = "Connected";
connectButton.innerText = "Disconnect"
let decoder = new TextDecoderStream();
inputDone = port.readable.pipeTo(decoder.writable);
inputStream = decoder.readable;
const encoder = new TextEncoderStream();
outputDone = encoder.readable.pipeTo(port.writable);
outputStream = encoder.writable;
writeToByte("0x00, 0x02");
writeToByte("0x02, 0x00");
$('#winkey_buttons').show();
reader = inputStream.getReader();
readLoop();
} catch (e) {
//If the pipeTo error appears; clarify the problem by giving suggestions.
if (e == "TypeError: Cannot read property 'pipeTo' of undefined") {
e += "\n Use Google Chrome and enable-experimental-web-platform-features"
}
connectButton.innerText = "Connect"
statusBar.innerText = e;
}
}
//Write to the Serial port
async function writeToStream(line) {
var enc = new TextEncoder(); // always utf-8
const writer = outputStream.getWriter();
writer.write(line);
writer.releaseLock();
}
async function writeToByte(line) {
const writer = outputStream.getWriter();
const data = new Uint8Array([line]);
writer.write(line);
writer.releaseLock();
}
//Disconnect from the Serial port
async function disconnect() {
if (reader) {
await reader.cancel();
await inputDone.catch(() => { });
reader = null;
inputDone = null;
}
if (outputStream) {
await outputStream.getWriter().close();
await outputDone;
outputStream = null;
outputDone = null;
}
statusBar.innerText = "Disconnected";
connectButton.innerText = "Connect"
//Close the port.
await port.close();
port = null;
}
//When the send button is pressed
function clickSend() {
writeToStream(sendText.value);
writeToStream("\r");
//and clear the input field, so it's clear it has been sent
sendText.value = "";
}
function morsekey_func1() {
console.log("F1: " + UpdateMacros(function1Macro));
writeToStream(UpdateMacros(function1Macro));
//and clear the input field, so it's clear it has been sent
sendText.value = "";
}
function morsekey_func2() {
console.log("F2: " + UpdateMacros(function2Macro));
writeToStream(UpdateMacros(function2Macro));
//and clear the input field, so it's clear it has been sent
sendText.value = "";
}
function morsekey_func3() {
console.log("F3: " + UpdateMacros(function3Macro));
writeToStream(UpdateMacros(function3Macro));
//and clear the input field, so it's clear it has been sent
sendText.value = "";
}
function morsekey_func4() {
console.log("F4: " + UpdateMacros(function4Macro));
writeToStream(UpdateMacros(function4Macro));
//and clear the input field, so it's clear it has been sent
sendText.value = "";
}
function morsekey_func5() {
console.log("F5: " + UpdateMacros(function5Macro));
writeToStream(UpdateMacros(function5Macro));
//and clear the input field, so it's clear it has been sent
sendText.value = "";
}
//Read the incoming data
async function readLoop() {
while (true) {
const { value, done } = await reader.read();
if (done === true){
break;
}
console.log(value);
//When recieved something add it to the big textarea
receiveText.value += value;
//Scroll to the bottom of the text field
receiveText.scrollTop = receiveText.scrollHeight;
}
}
function closeModal() {
var container = document.getElementById("modals-here")
var backdrop = document.getElementById("modal-backdrop")
var modal = document.getElementById("modal")
modal.classList.remove("show")
backdrop.classList.remove("show")
getMacros();
setTimeout(function() {
container.removeChild(backdrop)
container.removeChild(modal)
}, 200)
}
function UpdateMacros(macrotext) {
// Get the values from the form set to uppercase
let CALL = document.getElementById("callsign").value.toUpperCase();
let RSTS = document.getElementById("rst_sent").value;
let newString;
newString = macrotext.replace(/\[MYCALL\]/g, my_call);
newString = newString.replace(/\[CALL\]/g, CALL);
newString = newString.replace(/\[RSTS\]/g, RSTS);
console.log(newString);
return newString;
}
// Call url and store the returned json data as variables
function getMacros() {
fetch(base_url + 'index.php/qso/cwmacros_json')
.then(response => response.json())
.then(data => {
function1Name = data.function1_name;
function1Macro = data.function1_macro;
function2Name = data.function2_name;
function2Macro = data.function2_macro;
function3Name = data.function3_name;
function3Macro = data.function3_macro;
function4Name = data.function4_name;
function4Macro = data.function4_macro;
function5Name = data.function5_name;
function5Macro = data.function5_macro;
const morsekey_func1_Button = document.getElementById('morsekey_func1');
morsekey_func1_Button.textContent = 'F1 (' + function1Name + ')';
const morsekey_func2_Button = document.getElementById('morsekey_func2');
morsekey_func2_Button.textContent = 'F2 (' + function2Name + ')';
const morsekey_func3_Button = document.getElementById('morsekey_func3');
morsekey_func3_Button.textContent = 'F3 (' + function3Name + ')';
const morsekey_func4_Button = document.getElementById('morsekey_func4');
morsekey_func4_Button.textContent = 'F4 (' + function4Name + ')';
const morsekey_func5_Button = document.getElementById('morsekey_func5');
morsekey_func5_Button.textContent = 'F5 (' + function5Name + ')';
});
}

查看文件

@ -153,8 +153,62 @@ $config['url_suffix'] = '';
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language'] = 'english';
*/
$lang = 'english'; // this language will be used per default
if (isset($_COOKIE["language"])) {
$tmp_value = $_COOKIE["language"];
if (!empty($tmp_value)) { $lang = $tmp_value; }
}
switch ($lang) { // do this for security-reasons! parse only langs, which are known to us
case 'dutch':
$config['language'] = $lang;
break;
case 'chinese_simplified':
$config['language'] = $lang;
break;
case 'spanish':
$config['language'] = $lang;
break;
case 'czech':
$config['language'] = $lang;
break;
case 'bulgarian':
$config['language'] = $lang;
break;
case 'turkish':
$config['language'] = $lang;
break;
case 'swedish':
$config['language'] = $lang;
break;
case 'polish':
$config['language'] = $lang;
break;
case 'italian':
$config['language'] = $lang;
break;
case 'greek':
$config['language'] = $lang;
break;
case 'french':
$config['language'] = $lang;
break;
case 'finnish':
$config['language'] = $lang;
break;
case 'russian':
$config['language'] = $lang;
break;
case 'english':
$config['language'] = $lang;
break;
case 'german':
$config['language'] = $lang;
break;
}
$config['cl_multilanguage']=true;
/*
|--------------------------------------------------------------------------