From 40028805abf266a933f651cc8e5be199f48fb50b Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Wed, 27 Nov 2024 22:31:02 +0100 Subject: [PATCH] add qrzcq to the installer --- install/config/config.php | 19 ++++++++++++++---- install/includes/core/core_class.php | 30 +++++++++++++++++++--------- install/index.php | 1 + 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/install/config/config.php b/install/config/config.php index e0c563524..8d53bb998 100644 --- a/install/config/config.php +++ b/install/config/config.php @@ -9,12 +9,12 @@ defined('BASEPATH') OR exit('No direct script access allowed'); | | 'app_name' Name of the App 'Wavelog' | 'directory' directory where wavelog is installed eg "logger" -| 'callbook' Selects which Callbook lookup to use defaults "hamqth" but supports "qrz" +| 'callbook' Selects which Callbook lookup to use defaults "hamqth" but supports "qrz" and "qrzcq" */ $config['app_name'] = 'Wavelog'; $config['directory'] = '/%directory%'; -$config['callbook'] = '%callbook%'; // Options are hamqth or qrz +$config['callbook'] = '%callbook%'; // Options are hamqth, qrz or qrzcq $config['datadir'] = null; // default to install directory @@ -24,8 +24,8 @@ $config['datadir'] = null; // default to install directory |-------------------------------------------------------------------------- | | 'table_name' SQL table where log can be found -| 'locator' Default locator used to calculate bearings/distance -| 'display_freq' Show or Hide frequnecy info +| 'locator' Default locator used to calculate bearings/distance +| 'display_freq' Show or Hide frequency info */ $config['table_name'] = 'TABLE_HRD_CONTACTS_V01'; @@ -57,6 +57,17 @@ $config['use_fullname'] = false; $config['hamqth_username'] = '%hamqth_username%'; $config['hamqth_password'] = '%hamqth_password%'; +/* +|-------------------------------------------------------------------------- +| QRZcq Login Options +|-------------------------------------------------------------------------- +| +| 'qrzcq_username' QRZcq.com user login +| 'qrzcq_password' QRZcq.com user password +*/ +$config['qrzcq_username'] = '%qrzcq_username%'; +$config['qrzcq_password'] = '%qrzcq_password%'; + /* |-------------------------------------------------------------------------- | Authentication diff --git a/install/includes/core/core_class.php b/install/includes/core/core_class.php index 0b11544d9..a62ecce27 100644 --- a/install/includes/core/core_class.php +++ b/install/includes/core/core_class.php @@ -165,17 +165,29 @@ class Core $new = str_replace("%websiteurl%", $data['websiteurl'], $new); $new = str_replace("%directory%", $data['directory'], $new); $new = str_replace("%callbook%", $data['global_call_lookup'], $new); - if ($data['global_call_lookup'] == 'qrz') { - $new = str_replace("%qrz_username%", $data['callbook_username'], $new); - $new = str_replace("%qrz_password%", $data['callbook_password'], $new); - $new = str_replace("%hamqth_username%", '', $new); - $new = str_replace("%hamqth_password%", '', $new); + + $callbooks = ['qrz', 'hamqth', 'qrzcq']; + + if (in_array($data['global_call_lookup'], $callbooks)) { + $c_username = '%' . $data['global_call_lookup'] . '_username%'; + $c_password = '%' . $data['global_call_lookup'] . '_password%'; + + $rest_callbooks = array_diff($callbooks, [$data['global_call_lookup']]); + + foreach ($rest_callbooks as $callbook) { + $new = str_replace('%' . $callbook . '_username%', '', $new); + $new = str_replace('%' . $callbook . '_password%', '', $new); + } + + $new = str_replace($c_username, $data['callbook_username'], $new); + $new = str_replace($c_password, $data['callbook_password'], $new); } else { - $new = str_replace("%qrz_username%", '', $new); - $new = str_replace("%qrz_password%", '', $new); - $new = str_replace("%hamqth_username%", $data['callbook_username'], $new); - $new = str_replace("%hamqth_password%", $data['callbook_password'], $new); + foreach ($callbooks as $callbook) { + $new = str_replace('%' . $callbook . '_username%', '', $new); + $new = str_replace('%' . $callbook . '_password%', '', $new); + } } + $new = str_replace("%encryptionkey%", $encryptionkey, $new); $new = str_replace("'%log_threshold%'", $data['log_threshold'], $new); diff --git a/install/index.php b/install/index.php index 179c5d970..52384055f 100644 --- a/install/index.php +++ b/install/index.php @@ -368,6 +368,7 @@ if (!file_exists('.lock')) {