Skip to content

Commit

Permalink
Merge remote-tracking branch 'froxlor/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
boonkerz committed May 27, 2024
2 parents c1408fc + 1f5982e commit e2728ba
Show file tree
Hide file tree
Showing 86 changed files with 5,209 additions and 697 deletions.
11 changes: 1 addition & 10 deletions .github/workflows/build-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,7 @@ jobs:
- name: Wait for database
run: sleep 15

- name: Setup database (8.0)
if: matrix.mysql-version == '8.0'
run: |
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "CREATE USER 'froxlor010'@'%' IDENTIFIED WITH mysql_native_password BY 'fr0xl0r.TravisCI';"
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "GRANT ALL ON froxlor010.* TO 'froxlor010'@'%';"
php -r "echo include('install/froxlor.sql.php');" > /tmp/froxlor.sql
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI froxlor010 < /tmp/froxlor.sql
- name: Setup database (5.7)
if: matrix.mysql-version == '5.7'
- name: Setup database
run: |
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "CREATE USER 'froxlor010'@'%' IDENTIFIED BY 'fr0xl0r.TravisCI';"
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "GRANT ALL ON froxlor010.* TO 'froxlor010'@'%';"
Expand Down
9 changes: 5 additions & 4 deletions 2fa.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use Froxlor\FroxlorTwoFactorAuth;
use Froxlor\Settings;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;
use Froxlor\PhpHelper;
use Froxlor\User;
Expand Down Expand Up @@ -63,7 +64,7 @@
]);
Response::standardSuccess('2fa.2fa_removed');
} elseif ($action == 'preadd') {
$type = isset($_POST['type_2fa']) ? $_POST['type_2fa'] : '0';
$type = Request::post('type_2fa', '0');

$data = "";
if ($type > 0) {
Expand Down Expand Up @@ -107,9 +108,9 @@
Response::dynamicError('Select one of the possible values for 2FA');
}
} elseif ($action == 'add') {
$type = isset($_POST['type_2fa']) ? $_POST['type_2fa'] : '0';
$data = isset($_POST['data_2fa']) ? $_POST['data_2fa'] : '';
$code = isset($_POST['codevalidation']) ? $_POST['codevalidation'] : '';
$type = Request::post('type_2fa', '0');
$data = Request::post('data_2fa', '');
$code = Request::post('codevalidation', '');

// validate
$result = $tfa->verifyCode($data, $code, 3);
Expand Down
1 change: 1 addition & 0 deletions actions/admin/settings/110.accounts.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
'varname' => 'sessiontimeout',
'type' => 'number',
'min' => 60,
'max' => 31536000,
'default' => 600,
'save_method' => 'storeSettingField'
],
Expand Down
10 changes: 5 additions & 5 deletions admin_admins.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
Response::standardError('youcantdeleteyourself');
}

if (isset($_POST['send']) && $_POST['send'] == 'send') {
if (Request::post('send') == 'send') {
Admins::getLocal($userinfo, [
'id' => $id
])->delete();
Expand All @@ -122,9 +122,9 @@
}
}
} elseif ($action == 'add') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
if (Request::post('send') == 'send') {
try {
Admins::getLocal($userinfo, $_POST)->add();
Admins::getLocal($userinfo, Request::postAll())->add();
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
}
Expand Down Expand Up @@ -159,9 +159,9 @@
$result = json_decode($json_result, true)['data'];

if ($result['loginname'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
if (Request::post('send') == 'send') {
try {
Admins::getLocal($userinfo, $_POST)->update();
Admins::getLocal($userinfo, Request::postAll())->update();
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
}
Expand Down
3 changes: 2 additions & 1 deletion admin_apcuinfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

use Froxlor\FroxlorLogger;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;
use Froxlor\UI\HTML;

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

if ($action == 'delete' && function_exists('apcu_clear_cache') && $userinfo['change_serversettings'] == '1') {
if ($_POST['send'] == 'send') {
if (Request::post('send') == 'send') {
apcu_clear_cache();
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_INFO, "cleared APCu cache");
header('Location: ' . $linker->getLink([
Expand Down
11 changes: 6 additions & 5 deletions admin_autoupdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use Froxlor\Install\AutoUpdate;
use Froxlor\Settings;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;

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

$result = 6;
// valid?
Expand All @@ -130,8 +131,8 @@
]);
} // extract and install new version
elseif ($page == 'extract') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$toExtract = isset($_POST['archive']) ? $_POST['archive'] : null;
if (Request::post('send') == 'send') {
$toExtract = Request::post('archive');
$localArchive = FileDir::makeCorrectFile(Froxlor::getInstallDir() . '/updates/' . $toExtract);
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "Extracting " . $localArchive . " to " . Froxlor::getInstallDir());
$result = AutoUpdate::extractZip($localArchive);
Expand All @@ -145,7 +146,7 @@
// redirect to update-page
Response::redirectTo('admin_updates.php');
} else {
$toExtract = isset($_GET['archive']) ? $_GET['archive'] : null;
$toExtract = Request::get('archive');
$localArchive = FileDir::makeCorrectFile(Froxlor::getInstallDir() . '/updates/' . $toExtract);
}

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

// 2 = no Zlib
// 3 = custom version detected
Expand Down
6 changes: 3 additions & 3 deletions admin_configfiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@
asort($distributions_select);
}

if ($distribution != "" && isset($_POST['finish'])) {
if ($distribution != "" && !empty(Request::post('finish'))) {
$valid_keys = ['http', 'dns', 'smtp', 'mail', 'antispam', 'ftp', 'system', 'distro'];
unset($_POST['finish']);
unset($_POST['csrf_token']);
$params = $_POST;
$params = Request::postAll();
$params['distro'] = $distribution;
$params['system'] = [];
foreach ($_POST['system'] as $sysdaemon) {
foreach (Request::post('system', []) as $sysdaemon) {
$params['system'][] = $sysdaemon;
}
// validate params
Expand Down
4 changes: 2 additions & 2 deletions admin_cronjobs.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@
}
$result = json_decode($json_result, true)['data'];
if ($result['cronfile'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
if (Request::post('send') == 'send') {
try {
Cronjobs::getLocal($userinfo, $_POST)->update();
Cronjobs::getLocal($userinfo, Request::postAll())->update();
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
}
Expand Down
16 changes: 8 additions & 8 deletions admin_customers.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@

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

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

if (isset($_POST['send']) && $_POST['send'] == 'send') {
if (Request::post('send') == 'send') {
try {
$json_result = Customers::getLocal($userinfo, [
'id' => $id
Expand Down Expand Up @@ -147,11 +147,11 @@
}
$result = json_decode($json_result, true)['data'];

if (isset($_POST['send']) && $_POST['send'] == 'send') {
if (Request::post('send') == 'send') {
try {
$json_result = Customers::getLocal($userinfo, [
'id' => $id,
'delete_userfiles' => (isset($_POST['delete_userfiles']) ? (int)$_POST['delete_userfiles'] : 0)
'delete_userfiles' => Request::post('delete_userfiles', 0)
])->delete();
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
Expand All @@ -167,9 +167,9 @@
], $result['loginname']);
}
} elseif ($action == 'add') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
if (Request::post('send') == 'send') {
try {
Customers::getLocal($userinfo, $_POST)->add();
Customers::getLocal($userinfo, Request::postAll())->add();
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
}
Expand Down Expand Up @@ -243,9 +243,9 @@
$result = json_decode($json_result, true)['data'];

if ($result['loginname'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
if (Request::post('send') == 'send') {
try {
Customers::getLocal($userinfo, $_POST)->update();
Customers::getLocal($userinfo, Request::postAll())->update();
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
}
Expand Down
32 changes: 16 additions & 16 deletions admin_domains.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@
]);

if ($result['domain'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send' && $alias_check['count'] == 0) {
if (Request::post('send') == 'send' && $alias_check['count'] == 0) {
try {
Domains::getLocal($userinfo, $_POST)->delete();
Domains::getLocal($userinfo, Request::postAll())->delete();
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
}
Expand All @@ -113,17 +113,17 @@
} elseif ($alias_check['count'] > 0) {
Response::standardError('domains_cantdeletedomainwithaliases');
} else {
HTML::askYesNo('admin_domain_reallydelete', $filename, [
HTML::askYesNoWithCheckbox('admin_domain_reallydelete', 'admin_customer_alsoremovemail', $filename, [
'id' => $id,
'page' => $page,
'action' => $action
], $idna_convert->decode($result['domain']));
}
}
} elseif ($action == 'add') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
if (Request::post('send') == 'send') {
try {
Domains::getLocal($userinfo, $_POST)->add();
Domains::getLocal($userinfo, Request::postAll())->add();
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
}
Expand Down Expand Up @@ -355,13 +355,13 @@
$usedips[] = $ipsresultrow['id_ipandports'];
}

if (isset($_POST['send']) && $_POST['send'] == 'send') {
if (Request::post('send') == 'send') {
try {
// remove ssl ip/ports if set is empty
if (!isset($_POST['ssl_ipandport']) || empty($_POST['ssl_ipandport'])) {
if (empty(Request::post('ssl_ipandport'))) {
$_POST['remove_ssl_ipandport'] = true;
}
Domains::getLocal($userinfo, $_POST)->update();
Domains::getLocal($userinfo, Request::postAll())->update();
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
}
Expand Down Expand Up @@ -572,13 +572,13 @@
}
}
} elseif ($action == 'jqGetCustomerPHPConfigs') {
$customerid = intval($_POST['customerid']);
$customerid = intval(Request::post('customerid'));
$allowed_phpconfigs = Customer::getCustomerDetail($customerid, 'allowed_phpconfigs');
echo !empty($allowed_phpconfigs) ? $allowed_phpconfigs : json_encode([]);
exit();
} elseif ($action == 'jqSpeciallogfileNote') {
$domainid = intval($_POST['id']);
$newval = intval($_POST['newval']);
$domainid = intval(Request::post('id'));
$newval = intval(Request::post('newval'));
try {
$json_result = Domains::getLocal($userinfo, [
'id' => $domainid
Expand All @@ -594,9 +594,9 @@
echo 0;
exit();
} elseif ($action == 'import') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$separator = Validate::validate($_POST['separator'], 'separator');
$offset = (int)Validate::validate($_POST['offset'], 'offset', "/[0-9]/i");
if (Request::post('send') == 'send') {
$separator = Validate::validate(Request::post('separator'), 'separator');
$offset = (int)Validate::validate(Request::post('offset'), 'offset', "/[0-9]/i");

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

Expand Down Expand Up @@ -636,9 +636,9 @@
]);
}
} elseif ($action == 'duplicate') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
if (Request::post('send') == 'send') {
try {
Domains::getLocal($userinfo, $_POST)->duplicate();
Domains::getLocal($userinfo, Request::postAll())->duplicate();
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
}
Expand Down
20 changes: 10 additions & 10 deletions admin_index.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
$result = $result['switched_user'];
session_regenerate_id(true);
CurrentUser::setData($result);
$target = (isset($_GET['target']) ? $_GET['target'] : 'index');
$target = Request::get('target', 'index');
$redirect = "admin_" . $target . ".php";
if (!file_exists(\Froxlor\Froxlor::getInstallDir() . "/" . $redirect)) {
$redirect = "admin_index.php";
Expand Down Expand Up @@ -111,7 +111,7 @@

$overview['number_domains'] = $number_domains['number_domains'];

if ((isset($_GET['lookfornewversion']) && $_GET['lookfornewversion'] == 'yes') || (isset($lookfornewversion) && $lookfornewversion == 'yes')) {
if (Request::get('lookfornewversion') == 'yes' || (isset($lookfornewversion) && $lookfornewversion == 'yes')) {
try {
$json_result = Froxlor::getLocal($userinfo)->checkUpdate();
} catch (Exception $e) {
Expand Down Expand Up @@ -201,16 +201,16 @@
$languages = Language::getLanguages();

if (!empty($_POST)) {
if ($_POST['send'] == 'changepassword') {
$old_password = Validate::validate($_POST['old_password'], 'old password');
if (Request::post('send') == 'changepassword') {
$old_password = Validate::validate(Request::post('old_password'), 'old password');

if (!Crypt::validatePasswordLogin($userinfo, $old_password, TABLE_PANEL_ADMINS, 'adminid')) {
Response::standardError('oldpasswordnotcorrect');
}

try {
$new_password = Crypt::validatePassword($_POST['new_password'], 'new password');
$new_password_confirm = Crypt::validatePassword($_POST['new_password_confirm'], 'new password confirm');
$new_password = Crypt::validatePassword(Request::post('new_password'), 'new password');
$new_password_confirm = Crypt::validatePassword(Request::post('new_password_confirm'), 'new password confirm');
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
}
Expand Down Expand Up @@ -244,9 +244,9 @@
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'changed password');
Response::redirectTo($filename);
}
} elseif ($_POST['send'] == 'changetheme') {
} elseif (Request::post('send') == 'changetheme') {
if (Settings::Get('panel.allow_theme_change_admin') == 1) {
$theme = Validate::validate($_POST['theme'], 'theme');
$theme = Validate::validate(Request::post('theme'), 'theme');
try {
Admins::getLocal($userinfo, [
'id' => $userinfo['adminid'],
Expand All @@ -259,8 +259,8 @@
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "changed his/her theme to '" . $theme . "'");
}
Response::redirectTo($filename);
} elseif ($_POST['send'] == 'changelanguage') {
$def_language = Validate::validate($_POST['def_language'], 'default language');
} elseif (Request::post('send') == 'changelanguage') {
$def_language = Validate::validate(Request::post('def_language'), 'default language');

if (isset($languages[$def_language])) {
try {
Expand Down
Loading

0 comments on commit e2728ba

Please sign in to comment.