Skip to content

Commit e2728ba

Browse files
committed
Merge remote-tracking branch 'froxlor/main'
2 parents c1408fc + 1f5982e commit e2728ba

File tree

86 files changed

+5209
-697
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+5209
-697
lines changed

.github/workflows/build-mysql.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,7 @@ jobs:
3939
- name: Wait for database
4040
run: sleep 15
4141

42-
- name: Setup database (8.0)
43-
if: matrix.mysql-version == '8.0'
44-
run: |
45-
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "CREATE USER 'froxlor010'@'%' IDENTIFIED WITH mysql_native_password BY 'fr0xl0r.TravisCI';"
46-
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "GRANT ALL ON froxlor010.* TO 'froxlor010'@'%';"
47-
php -r "echo include('install/froxlor.sql.php');" > /tmp/froxlor.sql
48-
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI froxlor010 < /tmp/froxlor.sql
49-
50-
- name: Setup database (5.7)
51-
if: matrix.mysql-version == '5.7'
42+
- name: Setup database
5243
run: |
5344
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "CREATE USER 'froxlor010'@'%' IDENTIFIED BY 'fr0xl0r.TravisCI';"
5445
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "GRANT ALL ON froxlor010.* TO 'froxlor010'@'%';"

2fa.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
use Froxlor\FroxlorTwoFactorAuth;
3434
use Froxlor\Settings;
3535
use Froxlor\UI\Panel\UI;
36+
use Froxlor\UI\Request;
3637
use Froxlor\UI\Response;
3738
use Froxlor\PhpHelper;
3839
use Froxlor\User;
@@ -63,7 +64,7 @@
6364
]);
6465
Response::standardSuccess('2fa.2fa_removed');
6566
} elseif ($action == 'preadd') {
66-
$type = isset($_POST['type_2fa']) ? $_POST['type_2fa'] : '0';
67+
$type = Request::post('type_2fa', '0');
6768

6869
$data = "";
6970
if ($type > 0) {
@@ -107,9 +108,9 @@
107108
Response::dynamicError('Select one of the possible values for 2FA');
108109
}
109110
} elseif ($action == 'add') {
110-
$type = isset($_POST['type_2fa']) ? $_POST['type_2fa'] : '0';
111-
$data = isset($_POST['data_2fa']) ? $_POST['data_2fa'] : '';
112-
$code = isset($_POST['codevalidation']) ? $_POST['codevalidation'] : '';
111+
$type = Request::post('type_2fa', '0');
112+
$data = Request::post('data_2fa', '');
113+
$code = Request::post('codevalidation', '');
113114

114115
// validate
115116
$result = $tfa->verifyCode($data, $code, 3);

actions/admin/settings/110.accounts.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
'varname' => 'sessiontimeout',
3636
'type' => 'number',
3737
'min' => 60,
38+
'max' => 31536000,
3839
'default' => 600,
3940
'save_method' => 'storeSettingField'
4041
],

admin_admins.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
Response::standardError('youcantdeleteyourself');
107107
}
108108

109-
if (isset($_POST['send']) && $_POST['send'] == 'send') {
109+
if (Request::post('send') == 'send') {
110110
Admins::getLocal($userinfo, [
111111
'id' => $id
112112
])->delete();
@@ -122,9 +122,9 @@
122122
}
123123
}
124124
} elseif ($action == 'add') {
125-
if (isset($_POST['send']) && $_POST['send'] == 'send') {
125+
if (Request::post('send') == 'send') {
126126
try {
127-
Admins::getLocal($userinfo, $_POST)->add();
127+
Admins::getLocal($userinfo, Request::postAll())->add();
128128
} catch (Exception $e) {
129129
Response::dynamicError($e->getMessage());
130130
}
@@ -159,9 +159,9 @@
159159
$result = json_decode($json_result, true)['data'];
160160

161161
if ($result['loginname'] != '') {
162-
if (isset($_POST['send']) && $_POST['send'] == 'send') {
162+
if (Request::post('send') == 'send') {
163163
try {
164-
Admins::getLocal($userinfo, $_POST)->update();
164+
Admins::getLocal($userinfo, Request::postAll())->update();
165165
} catch (Exception $e) {
166166
Response::dynamicError($e->getMessage());
167167
}

admin_apcuinfo.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
use Froxlor\FroxlorLogger;
3535
use Froxlor\UI\Panel\UI;
36+
use Froxlor\UI\Request;
3637
use Froxlor\UI\Response;
3738
use Froxlor\UI\HTML;
3839

@@ -42,7 +43,7 @@
4243
$horizontal_bar_size = 950; // 1280px window width
4344

4445
if ($action == 'delete' && function_exists('apcu_clear_cache') && $userinfo['change_serversettings'] == '1') {
45-
if ($_POST['send'] == 'send') {
46+
if (Request::post('send') == 'send') {
4647
apcu_clear_cache();
4748
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_INFO, "cleared APCu cache");
4849
header('Location: ' . $linker->getLink([

admin_autoupdate.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
use Froxlor\Install\AutoUpdate;
3333
use Froxlor\Settings;
3434
use Froxlor\UI\Panel\UI;
35+
use Froxlor\UI\Request;
3536
use Froxlor\UI\Response;
3637

3738
if ($page != 'error') {
@@ -110,7 +111,7 @@
110111
} // download the new archive
111112
elseif ($page == 'getdownload') {
112113
// retrieve the new version from the form
113-
$newversion = isset($_POST['newversion']) ? $_POST['newversion'] : null;
114+
$newversion = Request::post('newversion');
114115

115116
$result = 6;
116117
// valid?
@@ -130,8 +131,8 @@
130131
]);
131132
} // extract and install new version
132133
elseif ($page == 'extract') {
133-
if (isset($_POST['send']) && $_POST['send'] == 'send') {
134-
$toExtract = isset($_POST['archive']) ? $_POST['archive'] : null;
134+
if (Request::post('send') == 'send') {
135+
$toExtract = Request::post('archive');
135136
$localArchive = FileDir::makeCorrectFile(Froxlor::getInstallDir() . '/updates/' . $toExtract);
136137
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "Extracting " . $localArchive . " to " . Froxlor::getInstallDir());
137138
$result = AutoUpdate::extractZip($localArchive);
@@ -145,7 +146,7 @@
145146
// redirect to update-page
146147
Response::redirectTo('admin_updates.php');
147148
} else {
148-
$toExtract = isset($_GET['archive']) ? $_GET['archive'] : null;
149+
$toExtract = Request::get('archive');
149150
$localArchive = FileDir::makeCorrectFile(Froxlor::getInstallDir() . '/updates/' . $toExtract);
150151
}
151152

@@ -192,7 +193,7 @@
192193
} // display error
193194
elseif ($page == 'error') {
194195
// retrieve error-number via url-parameter
195-
$errno = isset($_GET['errno']) ? (int)$_GET['errno'] : 0;
196+
$errno = Request::get('errno', 0);
196197

197198
// 2 = no Zlib
198199
// 3 = custom version detected

admin_configfiles.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,14 @@
9393
asort($distributions_select);
9494
}
9595

96-
if ($distribution != "" && isset($_POST['finish'])) {
96+
if ($distribution != "" && !empty(Request::post('finish'))) {
9797
$valid_keys = ['http', 'dns', 'smtp', 'mail', 'antispam', 'ftp', 'system', 'distro'];
9898
unset($_POST['finish']);
9999
unset($_POST['csrf_token']);
100-
$params = $_POST;
100+
$params = Request::postAll();
101101
$params['distro'] = $distribution;
102102
$params['system'] = [];
103-
foreach ($_POST['system'] as $sysdaemon) {
103+
foreach (Request::post('system', []) as $sysdaemon) {
104104
$params['system'][] = $sysdaemon;
105105
}
106106
// validate params

admin_cronjobs.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@
6868
}
6969
$result = json_decode($json_result, true)['data'];
7070
if ($result['cronfile'] != '') {
71-
if (isset($_POST['send']) && $_POST['send'] == 'send') {
71+
if (Request::post('send') == 'send') {
7272
try {
73-
Cronjobs::getLocal($userinfo, $_POST)->update();
73+
Cronjobs::getLocal($userinfo, Request::postAll())->update();
7474
} catch (Exception $e) {
7575
Response::dynamicError($e->getMessage());
7676
}

admin_customers.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898

9999
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_INFO, "switched user and is now '" . $destination_user . "'");
100100

101-
$target = (isset($_GET['target']) ? $_GET['target'] : 'index');
101+
$target = Request::get('target', 'index');
102102
$redirect = "customer_" . $target . ".php";
103103
if (!file_exists(Froxlor::getInstallDir() . "/" . $redirect)) {
104104
$redirect = "customer_index.php";
@@ -119,7 +119,7 @@
119119
}
120120
$result = json_decode($json_result, true)['data'];
121121

122-
if (isset($_POST['send']) && $_POST['send'] == 'send') {
122+
if (Request::post('send') == 'send') {
123123
try {
124124
$json_result = Customers::getLocal($userinfo, [
125125
'id' => $id
@@ -147,11 +147,11 @@
147147
}
148148
$result = json_decode($json_result, true)['data'];
149149

150-
if (isset($_POST['send']) && $_POST['send'] == 'send') {
150+
if (Request::post('send') == 'send') {
151151
try {
152152
$json_result = Customers::getLocal($userinfo, [
153153
'id' => $id,
154-
'delete_userfiles' => (isset($_POST['delete_userfiles']) ? (int)$_POST['delete_userfiles'] : 0)
154+
'delete_userfiles' => Request::post('delete_userfiles', 0)
155155
])->delete();
156156
} catch (Exception $e) {
157157
Response::dynamicError($e->getMessage());
@@ -167,9 +167,9 @@
167167
], $result['loginname']);
168168
}
169169
} elseif ($action == 'add') {
170-
if (isset($_POST['send']) && $_POST['send'] == 'send') {
170+
if (Request::post('send') == 'send') {
171171
try {
172-
Customers::getLocal($userinfo, $_POST)->add();
172+
Customers::getLocal($userinfo, Request::postAll())->add();
173173
} catch (Exception $e) {
174174
Response::dynamicError($e->getMessage());
175175
}
@@ -243,9 +243,9 @@
243243
$result = json_decode($json_result, true)['data'];
244244

245245
if ($result['loginname'] != '') {
246-
if (isset($_POST['send']) && $_POST['send'] == 'send') {
246+
if (Request::post('send') == 'send') {
247247
try {
248-
Customers::getLocal($userinfo, $_POST)->update();
248+
Customers::getLocal($userinfo, Request::postAll())->update();
249249
} catch (Exception $e) {
250250
Response::dynamicError($e->getMessage());
251251
}

admin_domains.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@
100100
]);
101101

102102
if ($result['domain'] != '') {
103-
if (isset($_POST['send']) && $_POST['send'] == 'send' && $alias_check['count'] == 0) {
103+
if (Request::post('send') == 'send' && $alias_check['count'] == 0) {
104104
try {
105-
Domains::getLocal($userinfo, $_POST)->delete();
105+
Domains::getLocal($userinfo, Request::postAll())->delete();
106106
} catch (Exception $e) {
107107
Response::dynamicError($e->getMessage());
108108
}
@@ -113,17 +113,17 @@
113113
} elseif ($alias_check['count'] > 0) {
114114
Response::standardError('domains_cantdeletedomainwithaliases');
115115
} else {
116-
HTML::askYesNo('admin_domain_reallydelete', $filename, [
116+
HTML::askYesNoWithCheckbox('admin_domain_reallydelete', 'admin_customer_alsoremovemail', $filename, [
117117
'id' => $id,
118118
'page' => $page,
119119
'action' => $action
120120
], $idna_convert->decode($result['domain']));
121121
}
122122
}
123123
} elseif ($action == 'add') {
124-
if (isset($_POST['send']) && $_POST['send'] == 'send') {
124+
if (Request::post('send') == 'send') {
125125
try {
126-
Domains::getLocal($userinfo, $_POST)->add();
126+
Domains::getLocal($userinfo, Request::postAll())->add();
127127
} catch (Exception $e) {
128128
Response::dynamicError($e->getMessage());
129129
}
@@ -355,13 +355,13 @@
355355
$usedips[] = $ipsresultrow['id_ipandports'];
356356
}
357357

358-
if (isset($_POST['send']) && $_POST['send'] == 'send') {
358+
if (Request::post('send') == 'send') {
359359
try {
360360
// remove ssl ip/ports if set is empty
361-
if (!isset($_POST['ssl_ipandport']) || empty($_POST['ssl_ipandport'])) {
361+
if (empty(Request::post('ssl_ipandport'))) {
362362
$_POST['remove_ssl_ipandport'] = true;
363363
}
364-
Domains::getLocal($userinfo, $_POST)->update();
364+
Domains::getLocal($userinfo, Request::postAll())->update();
365365
} catch (Exception $e) {
366366
Response::dynamicError($e->getMessage());
367367
}
@@ -572,13 +572,13 @@
572572
}
573573
}
574574
} elseif ($action == 'jqGetCustomerPHPConfigs') {
575-
$customerid = intval($_POST['customerid']);
575+
$customerid = intval(Request::post('customerid'));
576576
$allowed_phpconfigs = Customer::getCustomerDetail($customerid, 'allowed_phpconfigs');
577577
echo !empty($allowed_phpconfigs) ? $allowed_phpconfigs : json_encode([]);
578578
exit();
579579
} elseif ($action == 'jqSpeciallogfileNote') {
580-
$domainid = intval($_POST['id']);
581-
$newval = intval($_POST['newval']);
580+
$domainid = intval(Request::post('id'));
581+
$newval = intval(Request::post('newval'));
582582
try {
583583
$json_result = Domains::getLocal($userinfo, [
584584
'id' => $domainid
@@ -594,9 +594,9 @@
594594
echo 0;
595595
exit();
596596
} elseif ($action == 'import') {
597-
if (isset($_POST['send']) && $_POST['send'] == 'send') {
598-
$separator = Validate::validate($_POST['separator'], 'separator');
599-
$offset = (int)Validate::validate($_POST['offset'], 'offset', "/[0-9]/i");
597+
if (Request::post('send') == 'send') {
598+
$separator = Validate::validate(Request::post('separator'), 'separator');
599+
$offset = (int)Validate::validate(Request::post('offset'), 'offset', "/[0-9]/i");
600600

601601
$file_name = $_FILES['file']['tmp_name'];
602602

@@ -636,9 +636,9 @@
636636
]);
637637
}
638638
} elseif ($action == 'duplicate') {
639-
if (isset($_POST['send']) && $_POST['send'] == 'send') {
639+
if (Request::post('send') == 'send') {
640640
try {
641-
Domains::getLocal($userinfo, $_POST)->duplicate();
641+
Domains::getLocal($userinfo, Request::postAll())->duplicate();
642642
} catch (Exception $e) {
643643
Response::dynamicError($e->getMessage());
644644
}

0 commit comments

Comments
 (0)