Skip to content

Commit 4655087

Browse files
authored
Merge pull request wavelog#212 from HB9HIL/fix_211
[Installer] DB Password
2 parents b11b724 + 28814ab commit 4655087

File tree

4 files changed

+34
-30
lines changed

4 files changed

+34
-30
lines changed

application/config/config.sample.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
| 'callbook' Selects which Callbook lookup to use defaults "hamqth" but supports "qrz"
1313
*/
1414

15-
$config['app_name'] = "Wavelog";
16-
$config['directory'] = "logbook";
17-
$config['callbook'] = "hamqth"; // Options are hamqth or qrz
15+
$config['app_name'] = 'Wavelog';
16+
$config['directory'] = 'logbook';
17+
$config['callbook'] = 'hamqth'; // Options are hamqth or qrz
1818

1919
$config['datadir'] = null; // default to install directory
2020

@@ -28,8 +28,8 @@
2828
| 'display_freq' Show or Hide frequnecy info
2929
*/
3030

31-
$config['table_name'] = "TABLE_HRD_CONTACTS_V01";
32-
$config['locator'] = "";
31+
$config['table_name'] = 'TABLE_HRD_CONTACTS_V01';
32+
$config['locator'] = '';
3333
$config['display_freq'] = true;
3434

3535
/*
@@ -42,8 +42,8 @@
4242
| 'use_fullname' Get full names from QRZ, may not be GDPR compliant
4343
*/
4444

45-
$config['qrz_username'] = "";
46-
$config['qrz_password'] = "";
45+
$config['qrz_username'] = '';
46+
$config['qrz_password'] = '';
4747
$config['use_fullname'] = false;
4848

4949
/*
@@ -54,8 +54,8 @@
5454
| 'hamqth_username' HamQTH user login
5555
| 'hamqth_password' HamQTH user password
5656
*/
57-
$config['hamqth_username'] = "";
58-
$config['hamqth_password'] = "";
57+
$config['hamqth_username'] = '';
58+
$config['hamqth_password'] = '';
5959

6060
/*
6161
|--------------------------------------------------------------------------
@@ -70,11 +70,11 @@
7070
*/
7171

7272
$config['use_auth'] = true;
73-
$config['auth_table'] = "users";
74-
$config['auth_mode'] = "3";
73+
$config['auth_table'] = 'users';
74+
$config['auth_mode'] = '3';
7575

76-
$config['auth_level'][3] = "Operator";
77-
$config['auth_level'][99] = "Administrator";
76+
$config['auth_level'][3] = 'Operator';
77+
$config['auth_level'][99] = 'Administrator';
7878

7979
/*
8080
|--------------------------------------------------------------------------
@@ -676,4 +676,4 @@
676676
|
677677
*/
678678

679-
$config['userdata'] = "userdata";
679+
$config['userdata'] = 'userdata';

install/config/config.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
| 'callbook' Selects which Callbook lookup to use defaults "hamqth" but supports "qrz"
1313
*/
1414

15-
$config['app_name'] = "Wavelog";
16-
$config['directory'] = "/%directory%";
17-
$config['callbook'] = "%callbook%"; // Options are hamqth or qrz
15+
$config['app_name'] = 'Wavelog';
16+
$config['directory'] = '/%directory%';
17+
$config['callbook'] = '%callbook%'; // Options are hamqth or qrz
1818

1919
$config['datadir'] = null; // default to install directory
2020

@@ -28,8 +28,8 @@
2828
| 'display_freq' Show or Hide frequnecy info
2929
*/
3030

31-
$config['table_name'] = "TABLE_HRD_CONTACTS_V01";
32-
$config['locator'] = "%baselocator%";
31+
$config['table_name'] = 'TABLE_HRD_CONTACTS_V01';
32+
$config['locator'] = '%baselocator%';
3333
$config['display_freq'] = true;
3434

3535
/*
@@ -42,8 +42,8 @@
4242
| 'use_fullname' Get full names from QRZ, may not be GDPR compliant
4343
*/
4444

45-
$config['qrz_username'] = "%qrz_username%";
46-
$config['qrz_password'] = "%qrz_password%";
45+
$config['qrz_username'] = '%qrz_username%';
46+
$config['qrz_password'] = '%qrz_password%';
4747
$config['use_fullname'] = false;
4848

4949
/*
@@ -54,8 +54,8 @@
5454
| 'hamqth_username' HamQTH user login
5555
| 'hamqth_password' HamQTH user password
5656
*/
57-
$config['hamqth_username'] = "%hamqth_username%";
58-
$config['hamqth_password'] = "%hamqth_password%";
57+
$config['hamqth_username'] = '%hamqth_username%';
58+
$config['hamqth_password'] = '%hamqth_password%';
5959

6060
/*
6161
|--------------------------------------------------------------------------
@@ -70,11 +70,11 @@
7070
*/
7171

7272
$config['use_auth'] = true;
73-
$config['auth_table'] = "users";
74-
$config['auth_mode'] = "3";
73+
$config['auth_table'] = 'users';
74+
$config['auth_mode'] = '3';
7575

76-
$config['auth_level'][3] = "Operator";
77-
$config['auth_level'][99] = "Administrator";
76+
$config['auth_level'][3] = 'Operator';
77+
$config['auth_level'][99] = 'Administrator';
7878

7979
/*
8080
|--------------------------------------------------------------------------
@@ -676,4 +676,4 @@
676676
|
677677
*/
678678

679-
$config['userdata'] = "userdata";
679+
$config['userdata'] = 'userdata';

install/includes/core_class.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,13 @@ function write_config($data)
117117
// Open the file
118118
$database_file = file_get_contents($template_path);
119119

120+
// Sanitize DB Password from single quotes
121+
$sanitized_db_pwd = preg_replace("/\\\\/i",'\\\\\\\\',$data['db_password']); // Escape the Escape char ( '\' becomes '\\' )
122+
$sanitized_db_pwd = preg_replace("/\'/i",'\\\\\'',$sanitized_db_pwd); // Escape the ' ( ' becomes \' )
123+
120124
$new = str_replace("%HOSTNAME%", $data['db_hostname'], $database_file);
121125
$new = str_replace("%USERNAME%", $data['db_username'], $new);
122-
$new = str_replace("%PASSWORD%", $data['db_password'], $new);
126+
$new = str_replace("%PASSWORD%", $sanitized_db_pwd, $new);
123127
$new = str_replace("%DATABASE%", $data['db_name'], $new);
124128

125129
// Write the new database.php file

install/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1462,4 +1462,4 @@ function prevTab() {
14621462

14631463
<?php endif; ?>
14641464

1465-
</html>
1465+
</html>

0 commit comments

Comments
 (0)