various minor bugfixes; composer requirements update

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-08-10 00:17:11 +02:00
parent 31500522ce
commit 50e35e149c
45 changed files with 397 additions and 354 deletions

View File

@@ -35,6 +35,7 @@ use Froxlor\Settings;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Response;
use Froxlor\PhpHelper;
use Froxlor\User;
if (Settings::Get('2fa.enabled') != '1') {
Response::dynamicError('2fa.2fa_not_activated');

View File

@@ -37,6 +37,7 @@ use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;
use Froxlor\Validate\Validate;
use Froxlor\CurrentUser;
$id = (int)Request::get('id');
$subjectid = intval(Request::get('subjectid'));

View File

@@ -26,11 +26,12 @@
const AREA = 'admin';
require __DIR__ . '/lib/init.php';
use Exception;
use Froxlor\Cron\TaskId;
use Froxlor\Database\Database;
use Froxlor\Froxlor;
use Froxlor\FroxlorLogger;
use Froxlor\Install\Preconfig;
use Froxlor\Install\Update;
use Froxlor\Settings;
use Froxlor\System\Cronjob;
use Froxlor\UI\Panel\UI;
@@ -40,32 +41,8 @@ use Froxlor\User;
if ($page == 'overview') {
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_updates");
/**
* this is a dirty hack but syscp 1.4.2.1 does not
* have any version/dbversion in the database (don't know why)
* so we have to set them both to run a correct upgrade
*/
if (!Froxlor::isFroxlor()) {
if (Settings::Get('panel.version') == null || Settings::Get('panel.version') == '') {
Settings::Set('panel.version', '1.4.2.1');
}
if (Settings::Get('system.dbversion') == null || Settings::Get('system.dbversion') == '') {
/**
* for syscp-stable (1.4.2.1) this value has to be 0
* so the required table-fields are added correctly
* and the svn-version has its value in the database
* -> bug #54
*/
$result_stmt = Database::query("
SELECT `value` FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `varname` = 'dbversion'");
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if (isset($result['value'])) {
Settings::Set('system.dbversion', (int)$result['value'], false);
} else {
Settings::Set('system.dbversion', 0, false);
}
}
throw new Exception('SysCP/customized upgrades are not supported');
}
if (Froxlor::hasDbUpdates() || Froxlor::hasUpdates()) {
@@ -81,7 +58,7 @@ if ($page == 'overview') {
@chmod(Froxlor::getInstallDir() . '/lib/userdata.inc.php', 0400);
UI::view('install/update.html.twig', [
'checks' => $update_tasks
'checks' => Update::getUpdateTasks()
]);
exit;
} else {

View File

@@ -19,7 +19,6 @@
"email": "team@froxlor.org",
"issues": "https://github.com/Froxlor/Froxlor/issues",
"forum": "https://forum.froxlor.org/",
"irc": "irc://irc.libera.chat/froxlor",
"source": "https://github.com/Froxlor/Froxlor",
"docs": "https://docs.froxlor.org/",
"chat": "https://discord.froxlor.org/"
@@ -64,7 +63,8 @@
"sebastian/phpcpd": "^6.0",
"phploc/phploc": "^7.0",
"phpmd/phpmd": "^2.10",
"phpunit/php-timer" : "^5"
"phpunit/php-timer" : "^5",
"phpstan/phpstan": "^1.8"
},
"suggest": {
"ext-bcmath": "*",

359
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "050664b27120307bec7721bac4ecb395",
"content-hash": "f8370edea3c85bcb7b681926a1fff04e",
"packages": [
{
"name": "erusev/parsedown",
@@ -114,16 +114,16 @@
},
{
"name": "monolog/monolog",
"version": "1.27.0",
"version": "1.27.1",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "52ebd235c1f7e0d5e1b16464b695a28335f8e44a"
"reference": "904713c5929655dc9b97288b69cfeedad610c9a1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/52ebd235c1f7e0d5e1b16464b695a28335f8e44a",
"reference": "52ebd235c1f7e0d5e1b16464b695a28335f8e44a",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/904713c5929655dc9b97288b69cfeedad610c9a1",
"reference": "904713c5929655dc9b97288b69cfeedad610c9a1",
"shasum": ""
},
"require": {
@@ -184,7 +184,7 @@
],
"support": {
"issues": "https://github.com/Seldaek/monolog/issues",
"source": "https://github.com/Seldaek/monolog/tree/1.27.0"
"source": "https://github.com/Seldaek/monolog/tree/1.27.1"
},
"funding": [
{
@@ -196,20 +196,20 @@
"type": "tidelift"
}
],
"time": "2022-03-13T20:29:46+00:00"
"time": "2022-06-09T08:53:42+00:00"
},
{
"name": "phpmailer/phpmailer",
"version": "v6.6.0",
"version": "v6.6.3",
"source": {
"type": "git",
"url": "https://github.com/PHPMailer/PHPMailer.git",
"reference": "e43bac82edc26ca04b36143a48bde1c051cfd5b1"
"reference": "9400f305a898f194caff5521f64e5dfa926626f3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/e43bac82edc26ca04b36143a48bde1c051cfd5b1",
"reference": "e43bac82edc26ca04b36143a48bde1c051cfd5b1",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/9400f305a898f194caff5521f64e5dfa926626f3",
"reference": "9400f305a898f194caff5521f64e5dfa926626f3",
"shasum": ""
},
"require": {
@@ -221,8 +221,8 @@
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"doctrine/annotations": "^1.2",
"php-parallel-lint/php-console-highlighter": "^0.5.0",
"php-parallel-lint/php-parallel-lint": "^1.3.1",
"php-parallel-lint/php-console-highlighter": "^1.0.0",
"php-parallel-lint/php-parallel-lint": "^1.3.2",
"phpcompatibility/php-compatibility": "^9.3.5",
"roave/security-advisories": "dev-latest",
"squizlabs/php_codesniffer": "^3.6.2",
@@ -266,7 +266,7 @@
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
"support": {
"issues": "https://github.com/PHPMailer/PHPMailer/issues",
"source": "https://github.com/PHPMailer/PHPMailer/tree/v6.6.0"
"source": "https://github.com/PHPMailer/PHPMailer/tree/v6.6.3"
},
"funding": [
{
@@ -274,7 +274,7 @@
"type": "github"
}
],
"time": "2022-02-28T15:31:21+00:00"
"time": "2022-06-20T09:21:02+00:00"
},
{
"name": "psr/container",
@@ -446,16 +446,16 @@
},
{
"name": "symfony/console",
"version": "v5.4.7",
"version": "v5.4.11",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "900275254f0a1a2afff1ab0e11abd5587a10e1d6"
"reference": "535846c7ee6bc4dd027ca0d93220601456734b10"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/900275254f0a1a2afff1ab0e11abd5587a10e1d6",
"reference": "900275254f0a1a2afff1ab0e11abd5587a10e1d6",
"url": "https://api.github.com/repos/symfony/console/zipball/535846c7ee6bc4dd027ca0d93220601456734b10",
"reference": "535846c7ee6bc4dd027ca0d93220601456734b10",
"shasum": ""
},
"require": {
@@ -525,7 +525,7 @@
"terminal"
],
"support": {
"source": "https://github.com/symfony/console/tree/v5.4.7"
"source": "https://github.com/symfony/console/tree/v5.4.11"
},
"funding": [
{
@@ -541,11 +541,11 @@
"type": "tidelift"
}
],
"time": "2022-03-31T17:09:19+00:00"
"time": "2022-07-22T10:42:43+00:00"
},
{
"name": "symfony/deprecation-contracts",
"version": "v2.5.1",
"version": "v2.5.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
@@ -592,7 +592,7 @@
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.1"
"source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2"
},
"funding": [
{
@@ -612,16 +612,16 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.25.0",
"version": "v1.26.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "30885182c981ab175d4d034db0f6f469898070ab"
"reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab",
"reference": "30885182c981ab175d4d034db0f6f469898070ab",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4",
"reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4",
"shasum": ""
},
"require": {
@@ -636,7 +636,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
"dev-main": "1.26-dev"
},
"thanks": {
"name": "symfony/polyfill",
@@ -674,7 +674,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.26.0"
},
"funding": [
{
@@ -690,20 +690,20 @@
"type": "tidelift"
}
],
"time": "2021-10-20T20:35:02+00:00"
"time": "2022-05-24T11:49:31+00:00"
},
{
"name": "symfony/polyfill-iconv",
"version": "v1.25.0",
"version": "v1.26.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-iconv.git",
"reference": "f1aed619e28cb077fc83fac8c4c0383578356e40"
"reference": "143f1881e655bebca1312722af8068de235ae5dc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/f1aed619e28cb077fc83fac8c4c0383578356e40",
"reference": "f1aed619e28cb077fc83fac8c4c0383578356e40",
"url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/143f1881e655bebca1312722af8068de235ae5dc",
"reference": "143f1881e655bebca1312722af8068de235ae5dc",
"shasum": ""
},
"require": {
@@ -718,7 +718,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
"dev-main": "1.26-dev"
},
"thanks": {
"name": "symfony/polyfill",
@@ -757,7 +757,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-iconv/tree/v1.25.0"
"source": "https://github.com/symfony/polyfill-iconv/tree/v1.26.0"
},
"funding": [
{
@@ -773,20 +773,20 @@
"type": "tidelift"
}
],
"time": "2022-01-04T09:04:05+00:00"
"time": "2022-05-24T11:49:31+00:00"
},
{
"name": "symfony/polyfill-intl-grapheme",
"version": "v1.25.0",
"version": "v1.26.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-grapheme.git",
"reference": "81b86b50cf841a64252b439e738e97f4a34e2783"
"reference": "433d05519ce6990bf3530fba6957499d327395c2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/81b86b50cf841a64252b439e738e97f4a34e2783",
"reference": "81b86b50cf841a64252b439e738e97f4a34e2783",
"url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/433d05519ce6990bf3530fba6957499d327395c2",
"reference": "433d05519ce6990bf3530fba6957499d327395c2",
"shasum": ""
},
"require": {
@@ -798,7 +798,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
"dev-main": "1.26-dev"
},
"thanks": {
"name": "symfony/polyfill",
@@ -838,7 +838,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.25.0"
"source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.26.0"
},
"funding": [
{
@@ -854,20 +854,20 @@
"type": "tidelift"
}
],
"time": "2021-11-23T21:10:46+00:00"
"time": "2022-05-24T11:49:31+00:00"
},
{
"name": "symfony/polyfill-intl-normalizer",
"version": "v1.25.0",
"version": "v1.26.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
"reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8"
"reference": "219aa369ceff116e673852dce47c3a41794c14bd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8",
"reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8",
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/219aa369ceff116e673852dce47c3a41794c14bd",
"reference": "219aa369ceff116e673852dce47c3a41794c14bd",
"shasum": ""
},
"require": {
@@ -879,7 +879,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
"dev-main": "1.26-dev"
},
"thanks": {
"name": "symfony/polyfill",
@@ -922,7 +922,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.25.0"
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.26.0"
},
"funding": [
{
@@ -938,20 +938,20 @@
"type": "tidelift"
}
],
"time": "2021-02-19T12:13:01+00:00"
"time": "2022-05-24T11:49:31+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.25.0",
"version": "v1.26.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825"
"reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825",
"reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e",
"reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e",
"shasum": ""
},
"require": {
@@ -966,7 +966,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
"dev-main": "1.26-dev"
},
"thanks": {
"name": "symfony/polyfill",
@@ -1005,7 +1005,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0"
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0"
},
"funding": [
{
@@ -1021,20 +1021,20 @@
"type": "tidelift"
}
],
"time": "2021-11-30T18:21:41+00:00"
"time": "2022-05-24T11:49:31+00:00"
},
{
"name": "symfony/polyfill-php72",
"version": "v1.25.0",
"version": "v1.26.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php72.git",
"reference": "9a142215a36a3888e30d0a9eeea9766764e96976"
"reference": "bf44a9fd41feaac72b074de600314a93e2ae78e2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9a142215a36a3888e30d0a9eeea9766764e96976",
"reference": "9a142215a36a3888e30d0a9eeea9766764e96976",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/bf44a9fd41feaac72b074de600314a93e2ae78e2",
"reference": "bf44a9fd41feaac72b074de600314a93e2ae78e2",
"shasum": ""
},
"require": {
@@ -1043,7 +1043,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
"dev-main": "1.26-dev"
},
"thanks": {
"name": "symfony/polyfill",
@@ -1081,7 +1081,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php72/tree/v1.25.0"
"source": "https://github.com/symfony/polyfill-php72/tree/v1.26.0"
},
"funding": [
{
@@ -1097,20 +1097,20 @@
"type": "tidelift"
}
],
"time": "2021-05-27T09:17:38+00:00"
"time": "2022-05-24T11:49:31+00:00"
},
{
"name": "symfony/polyfill-php73",
"version": "v1.25.0",
"version": "v1.26.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php73.git",
"reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5"
"reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5",
"reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5",
"url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/e440d35fa0286f77fb45b79a03fedbeda9307e85",
"reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85",
"shasum": ""
},
"require": {
@@ -1119,7 +1119,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
"dev-main": "1.26-dev"
},
"thanks": {
"name": "symfony/polyfill",
@@ -1160,7 +1160,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php73/tree/v1.25.0"
"source": "https://github.com/symfony/polyfill-php73/tree/v1.26.0"
},
"funding": [
{
@@ -1176,20 +1176,20 @@
"type": "tidelift"
}
],
"time": "2021-06-05T21:20:04+00:00"
"time": "2022-05-24T11:49:31+00:00"
},
{
"name": "symfony/polyfill-php80",
"version": "v1.25.0",
"version": "v1.26.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c"
"reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c",
"reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace",
"reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace",
"shasum": ""
},
"require": {
@@ -1198,7 +1198,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
"dev-main": "1.26-dev"
},
"thanks": {
"name": "symfony/polyfill",
@@ -1243,7 +1243,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.25.0"
"source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0"
},
"funding": [
{
@@ -1259,20 +1259,20 @@
"type": "tidelift"
}
],
"time": "2022-03-04T08:16:47+00:00"
"time": "2022-05-10T07:21:04+00:00"
},
{
"name": "symfony/service-contracts",
"version": "v2.5.1",
"version": "v2.5.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/service-contracts.git",
"reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c"
"reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/24d9dc654b83e91aa59f9d167b131bc3b5bea24c",
"reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c",
"reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c",
"shasum": ""
},
"require": {
@@ -1326,7 +1326,7 @@
"standards"
],
"support": {
"source": "https://github.com/symfony/service-contracts/tree/v2.5.1"
"source": "https://github.com/symfony/service-contracts/tree/v2.5.2"
},
"funding": [
{
@@ -1342,20 +1342,20 @@
"type": "tidelift"
}
],
"time": "2022-03-13T20:07:29+00:00"
"time": "2022-05-30T19:17:29+00:00"
},
{
"name": "symfony/string",
"version": "v5.4.3",
"version": "v5.4.11",
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
"reference": "92043b7d8383e48104e411bc9434b260dbeb5a10"
"reference": "5eb661e49ad389e4ae2b6e4df8d783a8a6548322"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/92043b7d8383e48104e411bc9434b260dbeb5a10",
"reference": "92043b7d8383e48104e411bc9434b260dbeb5a10",
"url": "https://api.github.com/repos/symfony/string/zipball/5eb661e49ad389e4ae2b6e4df8d783a8a6548322",
"reference": "5eb661e49ad389e4ae2b6e4df8d783a8a6548322",
"shasum": ""
},
"require": {
@@ -1412,7 +1412,7 @@
"utf8"
],
"support": {
"source": "https://github.com/symfony/string/tree/v5.4.3"
"source": "https://github.com/symfony/string/tree/v5.4.11"
},
"funding": [
{
@@ -1428,20 +1428,20 @@
"type": "tidelift"
}
],
"time": "2022-01-02T09:53:40+00:00"
"time": "2022-07-24T16:15:25+00:00"
},
{
"name": "twig/twig",
"version": "v3.3.10",
"version": "v3.4.1",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "8442df056c51b706793adf80a9fd363406dd3674"
"reference": "e939eae92386b69b49cfa4599dd9bead6bf4a342"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/8442df056c51b706793adf80a9fd363406dd3674",
"reference": "8442df056c51b706793adf80a9fd363406dd3674",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/e939eae92386b69b49cfa4599dd9bead6bf4a342",
"reference": "e939eae92386b69b49cfa4599dd9bead6bf4a342",
"shasum": ""
},
"require": {
@@ -1456,7 +1456,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
"dev-master": "3.4-dev"
}
},
"autoload": {
@@ -1492,7 +1492,7 @@
],
"support": {
"issues": "https://github.com/twigphp/Twig/issues",
"source": "https://github.com/twigphp/Twig/tree/v3.3.10"
"source": "https://github.com/twigphp/Twig/tree/v3.4.1"
},
"funding": [
{
@@ -1504,7 +1504,7 @@
"type": "tidelift"
}
],
"time": "2022-04-06T06:47:41+00:00"
"time": "2022-05-17T05:48:52+00:00"
},
{
"name": "voku/anti-xss",
@@ -2032,16 +2032,16 @@
},
{
"name": "nikic/php-parser",
"version": "v4.13.2",
"version": "v4.14.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "210577fe3cf7badcc5814d99455df46564f3c077"
"reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077",
"reference": "210577fe3cf7badcc5814d99455df46564f3c077",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/34bea19b6e03d8153165d8f30bba4c3be86184c1",
"reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1",
"shasum": ""
},
"require": {
@@ -2082,9 +2082,9 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2"
"source": "https://github.com/nikic/PHP-Parser/tree/v4.14.0"
},
"time": "2021-11-30T19:35:32+00:00"
"time": "2022-05-31T20:59:12+00:00"
},
{
"name": "pdepend/pdepend",
@@ -2687,6 +2687,65 @@
},
"time": "2021-12-08T12:19:24+00:00"
},
{
"name": "phpstan/phpstan",
"version": "1.8.2",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "c53312ecc575caf07b0e90dee43883fdf90ca67c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/c53312ecc575caf07b0e90dee43883fdf90ca67c",
"reference": "c53312ecc575caf07b0e90dee43883fdf90ca67c",
"shasum": ""
},
"require": {
"php": "^7.2|^8.0"
},
"conflict": {
"phpstan/phpstan-shim": "*"
},
"bin": [
"phpstan",
"phpstan.phar"
],
"type": "library",
"autoload": {
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHPStan - PHP Static Analysis Tool",
"support": {
"issues": "https://github.com/phpstan/phpstan/issues",
"source": "https://github.com/phpstan/phpstan/tree/1.8.2"
},
"funding": [
{
"url": "https://github.com/ondrejmirtes",
"type": "github"
},
{
"url": "https://github.com/phpstan",
"type": "github"
},
{
"url": "https://www.patreon.com/phpstan",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan",
"type": "tidelift"
}
],
"time": "2022-07-20T09:57:31+00:00"
},
{
"name": "phpunit/php-code-coverage",
"version": "9.2.15",
@@ -3007,16 +3066,16 @@
},
{
"name": "phpunit/phpunit",
"version": "9.5.20",
"version": "9.5.21",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba"
"reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/12bc8879fb65aef2138b26fc633cb1e3620cffba",
"reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0e32b76be457de00e83213528f6bb37e2a38fcb1",
"reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1",
"shasum": ""
},
"require": {
@@ -3050,7 +3109,6 @@
"sebastian/version": "^3.0.2"
},
"require-dev": {
"ext-pdo": "*",
"phpspec/prophecy-phpunit": "^2.0.1"
},
"suggest": {
@@ -3094,7 +3152,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.20"
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.21"
},
"funding": [
{
@@ -3106,7 +3164,7 @@
"type": "github"
}
],
"time": "2022-04-01T12:37:26+00:00"
"time": "2022-06-19T12:14:25+00:00"
},
{
"name": "sebastian/cli-parser",
@@ -4135,16 +4193,16 @@
},
{
"name": "squizlabs/php_codesniffer",
"version": "3.6.2",
"version": "3.7.1",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "5e4e71592f69da17871dba6e80dd51bce74a351a"
"reference": "1359e176e9307e906dc3d890bcc9603ff6d90619"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a",
"reference": "5e4e71592f69da17871dba6e80dd51bce74a351a",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619",
"reference": "1359e176e9307e906dc3d890bcc9603ff6d90619",
"shasum": ""
},
"require": {
@@ -4187,20 +4245,20 @@
"source": "https://github.com/squizlabs/PHP_CodeSniffer",
"wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
},
"time": "2021-12-12T21:44:58+00:00"
"time": "2022-06-18T07:21:10+00:00"
},
{
"name": "symfony/config",
"version": "v5.4.7",
"version": "v5.4.11",
"source": {
"type": "git",
"url": "https://github.com/symfony/config.git",
"reference": "05624c386afa1b4ccc1357463d830fade8d9d404"
"reference": "ec79e03125c1d2477e43dde8528535d90cc78379"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/config/zipball/05624c386afa1b4ccc1357463d830fade8d9d404",
"reference": "05624c386afa1b4ccc1357463d830fade8d9d404",
"url": "https://api.github.com/repos/symfony/config/zipball/ec79e03125c1d2477e43dde8528535d90cc78379",
"reference": "ec79e03125c1d2477e43dde8528535d90cc78379",
"shasum": ""
},
"require": {
@@ -4250,7 +4308,7 @@
"description": "Helps you find, load, combine, autofill and validate configuration values of any kind",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/config/tree/v5.4.7"
"source": "https://github.com/symfony/config/tree/v5.4.11"
},
"funding": [
{
@@ -4266,20 +4324,20 @@
"type": "tidelift"
}
],
"time": "2022-03-21T13:42:03+00:00"
"time": "2022-07-20T13:00:38+00:00"
},
{
"name": "symfony/dependency-injection",
"version": "v5.4.7",
"version": "v5.4.11",
"source": {
"type": "git",
"url": "https://github.com/symfony/dependency-injection.git",
"reference": "35588b2afb08ea3a142d62fefdcad4cb09be06ed"
"reference": "a8b9251016e9476db73e25fa836904bc0bf74c62"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/35588b2afb08ea3a142d62fefdcad4cb09be06ed",
"reference": "35588b2afb08ea3a142d62fefdcad4cb09be06ed",
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/a8b9251016e9476db73e25fa836904bc0bf74c62",
"reference": "a8b9251016e9476db73e25fa836904bc0bf74c62",
"shasum": ""
},
"require": {
@@ -4339,7 +4397,7 @@
"description": "Allows you to standardize and centralize the way objects are constructed in your application",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/dependency-injection/tree/v5.4.7"
"source": "https://github.com/symfony/dependency-injection/tree/v5.4.11"
},
"funding": [
{
@@ -4355,20 +4413,20 @@
"type": "tidelift"
}
],
"time": "2022-03-08T15:43:06+00:00"
"time": "2022-07-20T13:00:38+00:00"
},
{
"name": "symfony/filesystem",
"version": "v5.4.7",
"version": "v5.4.11",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "3a4442138d80c9f7b600fb297534ac718b61d37f"
"reference": "6699fb0228d1bc35b12aed6dd5e7455457609ddd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/3a4442138d80c9f7b600fb297534ac718b61d37f",
"reference": "3a4442138d80c9f7b600fb297534ac718b61d37f",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/6699fb0228d1bc35b12aed6dd5e7455457609ddd",
"reference": "6699fb0228d1bc35b12aed6dd5e7455457609ddd",
"shasum": ""
},
"require": {
@@ -4403,7 +4461,7 @@
"description": "Provides basic utilities for the filesystem",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/filesystem/tree/v5.4.7"
"source": "https://github.com/symfony/filesystem/tree/v5.4.11"
},
"funding": [
{
@@ -4419,20 +4477,20 @@
"type": "tidelift"
}
],
"time": "2022-04-01T12:33:59+00:00"
"time": "2022-07-20T13:00:38+00:00"
},
{
"name": "symfony/polyfill-php81",
"version": "v1.25.0",
"version": "v1.26.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php81.git",
"reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f"
"reference": "13f6d1271c663dc5ae9fb843a8f16521db7687a1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/5de4ba2d41b15f9bd0e19b2ab9674135813ec98f",
"reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f",
"url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/13f6d1271c663dc5ae9fb843a8f16521db7687a1",
"reference": "13f6d1271c663dc5ae9fb843a8f16521db7687a1",
"shasum": ""
},
"require": {
@@ -4441,7 +4499,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
"dev-main": "1.26-dev"
},
"thanks": {
"name": "symfony/polyfill",
@@ -4482,7 +4540,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php81/tree/v1.25.0"
"source": "https://github.com/symfony/polyfill-php81/tree/v1.26.0"
},
"funding": [
{
@@ -4498,7 +4556,7 @@
"type": "tidelift"
}
],
"time": "2021-09-13T13:58:11+00:00"
"time": "2022-05-24T11:49:31+00:00"
},
{
"name": "theseer/tokenizer",
@@ -4552,21 +4610,21 @@
},
{
"name": "webmozart/assert",
"version": "1.10.0",
"version": "1.11.0",
"source": {
"type": "git",
"url": "https://github.com/webmozarts/assert.git",
"reference": "6964c76c7804814a842473e0c8fd15bab0f18e25"
"reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25",
"reference": "6964c76c7804814a842473e0c8fd15bab0f18e25",
"url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991",
"reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0",
"symfony/polyfill-ctype": "^1.8"
"ext-ctype": "*",
"php": "^7.2 || ^8.0"
},
"conflict": {
"phpstan/phpstan": "<0.12.20",
@@ -4604,9 +4662,9 @@
],
"support": {
"issues": "https://github.com/webmozarts/assert/issues",
"source": "https://github.com/webmozarts/assert/tree/1.10.0"
"source": "https://github.com/webmozarts/assert/tree/1.11.0"
},
"time": "2021-03-09T10:59:23+00:00"
"time": "2022-06-03T18:03:27+00:00"
}
],
"aliases": [],
@@ -4628,7 +4686,8 @@
"ext-curl": "*",
"ext-json": "*",
"ext-openssl": "*",
"ext-fileinfo": "*"
"ext-fileinfo": "*",
"ext-gmp": "*"
},
"platform-dev": {
"ext-pcntl": "*"

View File

@@ -51,12 +51,7 @@ try {
if (Froxlor::isFroxlor()) {
// will be filled and increased by the update include-files below
$update_tasks = [];
$task_counter = 0;
include_once(FileDir::makeCorrectFile(dirname(__FILE__) . '/updates/froxlor/update_0.10.inc.php'));
include_once(FileDir::makeCorrectFile(dirname(__FILE__) . '/updates/froxlor/update_0.11.inc.php'));
// Check Froxlor - database integrity (only happens after all updates are done, so we know the db-layout is okay)

View File

@@ -105,7 +105,7 @@ abstract class ApiCommand extends ApiParameter
*
* @throws Exception
*/
public function __construct($header = null, $params = null, $userinfo = null, $internal = false)
final public function __construct($header = null, $params = null, $userinfo = null, $internal = false)
{
parent::__construct($params);

View File

@@ -117,7 +117,7 @@ class Admins extends ApiCommand implements ResourceEntity
* returns the total number of admins for the given admin
*
* @access admin
* @return string json-encoded array
* @return string json-encoded response message
* @throws Exception
*/
public function listingCount()
@@ -131,6 +131,7 @@ class Admins extends ApiCommand implements ResourceEntity
if ($result) {
return $this->response($result['num_admins']);
}
$this->response(0);
}
throw new Exception("Not allowed to execute given command.", 403);
}

View File

@@ -371,7 +371,7 @@ class Certificates extends ApiCommand implements ResourceEntity
* returns the total number of certificates for the given user
*
* @access admin, customer
* @return string json-encoded array
* @return string json-encoded response message
* @throws Exception
*/
public function listingCount()
@@ -399,6 +399,7 @@ class Certificates extends ApiCommand implements ResourceEntity
if ($result) {
return $this->response($result['num_certs']);
}
return $this->response(0);
}
/**

View File

@@ -185,7 +185,7 @@ class Cronjobs extends ApiCommand implements ResourceEntity
* returns the total number of cronjobs
*
* @access admin
* @return string json-encoded array
* @return string json-encoded response message
* @throws Exception
*/
public function listingCount()
@@ -198,6 +198,7 @@ class Cronjobs extends ApiCommand implements ResourceEntity
if ($result) {
return $this->response($result['num_crons']);
}
return $this->response(0);
}
throw new Exception("Not allowed to execute given command.", 403);
}

View File

@@ -210,7 +210,7 @@ class CustomerBackups extends ApiCommand implements ResourceEntity
* optional, admin-only, select backup-jobs of a specific customer by loginname
*
* @access admin, customer
* @return string json-encoded array
* @return string json-encoded response message
* @throws Exception
*/
public function listingCount()

View File

@@ -143,7 +143,7 @@ class Customers extends ApiCommand implements ResourceEntity
* returns the total number of customers for the given admin
*
* @access admin
* @return string json-encoded array
* @return string json-encoded response message
* @throws Exception
*/
public function listingCount()
@@ -163,6 +163,7 @@ class Customers extends ApiCommand implements ResourceEntity
if ($result) {
return $this->response($result['num_customers']);
}
return $this->response(0);
}
throw new Exception("Not allowed to execute given command.", 403);
}

View File

@@ -396,7 +396,7 @@ class DirOptions extends ApiCommand implements ResourceEntity
* optional, admin-only, select directory-protections of a specific customer by loginname
*
* @access admin, customer
* @return string json-encoded array count|list
* @return string json-encoded response message
* @throws Exception
*/
public function listingCount()
@@ -415,6 +415,7 @@ class DirOptions extends ApiCommand implements ResourceEntity
if ($result) {
return $this->response($result['num_htaccess']);
}
return $this->response(0);
}
/**

View File

@@ -339,7 +339,7 @@ class DirProtections extends ApiCommand implements ResourceEntity
* optional, admin-only, select directory-protections of a specific customer by loginname
*
* @access admin, customer
* @return string json-encoded array count|list
* @return string json-encoded response message
* @throws Exception
*/
public function listingCount()
@@ -358,6 +358,7 @@ class DirProtections extends ApiCommand implements ResourceEntity
if ($result) {
return $this->response($result['num_htpasswd']);
}
return $this->response(0);
}
/**

View File

@@ -491,7 +491,7 @@ class DomainZones extends ApiCommand implements ResourceEntity
* optional, the domain name
*
* @access admin, customer
* @return bool
* @return string json-encoded response message
* @throws Exception
*/
public function listingCount()
@@ -522,6 +522,7 @@ class DomainZones extends ApiCommand implements ResourceEntity
if ($result) {
return $this->response($result['num_dns']);
}
return $this->response(0);
}
/**

View File

@@ -1743,9 +1743,6 @@ class Domains extends ApiCommand implements ResourceEntity
$upd_specialsettings = ", `specialsettings` = :specialsettings, `ssl_specialsettings` = :ssl_specialsettings, `include_specialsettings` = :include_specialsettings ";
} else {
$upd_specialsettings = '';
unset($_update_data['specialsettings']);
unset($_update_data['ssl_specialsettings']);
unset($_update_data['include_specialsettings']);
$upd_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `specialsettings`='', `ssl_specialsettings`='', `include_specialsettings`='0' WHERE `parentdomainid` = :id
");

View File

@@ -216,7 +216,6 @@ class EmailAccounts extends ApiCommand implements ResourceEntity
// replacer array for mail to create account on server
$replace_arr = [
'EMAIL' => $email_full,
'USERNAME' => $username,
'PASSWORD' => htmlentities(htmlentities($password)),
'SALUTATION' => User::getCorrectUserSalutation($customer),
'NAME' => $customer['name'],

View File

@@ -206,7 +206,7 @@ class EmailForwarders extends ApiCommand implements ResourceEntity
* optional, admin-only, the loginname
*
* @access admin,customer
* @return string json-encoded array
* @return string json-encoded response message
* @throws Exception
*/
public function listingCount()

View File

@@ -356,7 +356,7 @@ class Emails extends ApiCommand implements ResourceEntity
* optional, admin-only, select email addresses of a specific customer by loginname
*
* @access admin, customer
* @return string json-encoded array
* @return string json-encoded response message
* @throws Exception
*/
public function listingCount()
@@ -373,6 +373,7 @@ class Emails extends ApiCommand implements ResourceEntity
if ($result) {
return $this->response($result['num_emails']);
}
return $this->response(0);
}
/**

View File

@@ -105,7 +105,7 @@ class FpmDaemons extends ApiCommand implements ResourceEntity
* returns the total number of accessible fpm daemons
*
* @access admin
* @return string json-encoded array
* @return string json-encoded response message
* @throws Exception
*/
public function listingCount()
@@ -118,6 +118,7 @@ class FpmDaemons extends ApiCommand implements ResourceEntity
if ($result) {
return $this->response($result['num_fpms']);
}
return $this->response(0);
}
throw new Exception("Not allowed to execute given command.", 403);
}

View File

@@ -549,7 +549,7 @@ class Ftps extends ApiCommand implements ResourceEntity
* optional, admin-only, select ftp-users of a specific customer by loginname
*
* @access admin, customer
* @return string json-encoded array
* @return string json-encoded response message
* @throws Exception
*/
public function listingCount()
@@ -564,6 +564,7 @@ class Ftps extends ApiCommand implements ResourceEntity
if ($result) {
return $this->response($result['num_ftps']);
}
return $this->response(0);
}
/**

View File

@@ -89,7 +89,7 @@ class HostingPlans extends ApiCommand implements ResourceEntity
* returns the total number of accessible hosting plans
*
* @access admin
* @return string json-encoded array
* @return string json-encoded response message
* @throws Exception
*/
public function listingCount()
@@ -107,6 +107,7 @@ class HostingPlans extends ApiCommand implements ResourceEntity
if ($result) {
return $this->response($result['num_plans']);
}
return $this->response(0);
}
throw new Exception("Not allowed to execute given command.", 403);
}

View File

@@ -92,7 +92,7 @@ class IpsAndPorts extends ApiCommand implements ResourceEntity
* returns the total number of accessible ip/port entries
*
* @access admin
* @return string json-encoded array
* @return string json-encoded response message
* @throws Exception
*/
public function listingCount()
@@ -108,6 +108,7 @@ class IpsAndPorts extends ApiCommand implements ResourceEntity
if ($result) {
return $this->response($result['num_ips']);
}
return $this->response(0);
}
throw new Exception("Not allowed to execute given command.", 403);
}

View File

@@ -124,6 +124,9 @@ class MysqlServer extends ApiCommand implements ResourceEntity
}
}
$sql = [];
$sql_root = [];
// get all data from lib/userdata
require Froxlor::getInstallDir() . "/lib/userdata.inc.php";
@@ -222,6 +225,8 @@ class MysqlServer extends ApiCommand implements ResourceEntity
*/
public function listing()
{
$sql = [];
$sql_root = [];
// get all data from lib/userdata
require Froxlor::getInstallDir() . "/lib/userdata.inc.php";
@@ -255,7 +260,7 @@ class MysqlServer extends ApiCommand implements ResourceEntity
* returns the total number of mysql servers
*
* @access admin, customer
* @return string json-encoded array
* @return string json-encoded response message
*/
public function listingCount()
{
@@ -266,6 +271,7 @@ class MysqlServer extends ApiCommand implements ResourceEntity
}
return $this->response(0);
}
$sql_root = [];
// get all data from lib/userdata
require Froxlor::getInstallDir() . "/lib/userdata.inc.php";
return $this->response(count($sql_root));
@@ -290,9 +296,14 @@ class MysqlServer extends ApiCommand implements ResourceEntity
$dbserver = (int) $this->getParam('dbserver', $dn_optional, -1);
$dbserver = $id >= 0 ? $id : $dbserver;
$sql_root = [];
// get all data from lib/userdata
require Froxlor::getInstallDir() . "/lib/userdata.inc.php";
if (!isset($sql_root[$dbserver])) {
throw new Exception('Mysql server not found', 404);
}
// limit customer to its allowed servers
if ($this->isAdmin() == false) {
$allowed_mysqls = json_decode($this->getUserDetail('allowed_mysqlserver'), true);
@@ -300,11 +311,7 @@ class MysqlServer extends ApiCommand implements ResourceEntity
throw new Exception("You cannot access this resource", 405);
}
// no usernames required for non-admins
unset($sqlrootdata['user']);
}
if (!isset($sql_root[$dbserver])) {
throw new Exception('Mysql server not found', 404);
unset($sql_root[$dbserver]['user']);
}
unset($sql_root[$dbserver]['password']);

View File

@@ -481,7 +481,7 @@ class Mysqls extends ApiCommand implements ResourceEntity
* optional, admin-only, select dbs of a specific customer by loginname
*
* @access admin, customer
* @return string json-encoded array
* @return string json-encoded response message
* @throws Exception
*/
public function listingCount()
@@ -495,6 +495,7 @@ class Mysqls extends ApiCommand implements ResourceEntity
if ($result) {
return $this->response($result['num_dbs']);
}
return $this->response(0);
}
/**

View File

@@ -178,7 +178,7 @@ class PhpSettings extends ApiCommand implements ResourceEntity
* returns the total number of accessible php-setting entries
*
* @access admin
* @return string json-encoded array
* @return string json-encoded response message
* @throws Exception
*/
public function listingCount()
@@ -192,6 +192,7 @@ class PhpSettings extends ApiCommand implements ResourceEntity
if ($result) {
return $this->response($result['num_phps']);
}
return $this->response(0);
}
throw new Exception("Not allowed to execute given command.", 403);
}

View File

@@ -1017,7 +1017,7 @@ class SubDomains extends ApiCommand implements ResourceEntity
* optional, admin-only, select (sub)domains of a specific customer by loginname
*
* @access admin, customer
* @return string json-encoded array
* @return string json-encoded response message
* @throws Exception
*/
public function listingCount()
@@ -1069,6 +1069,7 @@ class SubDomains extends ApiCommand implements ResourceEntity
if ($result) {
return $this->response($result['num_subdom']);
}
return $this->response(0);
}
/**

View File

@@ -103,7 +103,7 @@ class SysLog extends ApiCommand implements ResourceEntity
* returns the total number of log-entries
*
* @access admin
* @return string json-encoded array
* @return string json-encoded response message
* @throws Exception
*/
public function listingCount()
@@ -150,6 +150,7 @@ class SysLog extends ApiCommand implements ResourceEntity
if ($result) {
return $this->response($result['num_logs']);
}
return $this->response(0);
}
/**

View File

@@ -76,7 +76,7 @@ abstract class BulkAction
*
* @return object BulkAction instance
*/
protected function __construct($import_file = null, $userinfo = [])
protected function __construct(string $import_file = null, array $userinfo = [])
{
if (!empty($import_file)) {
$this->impFile = FileDir::makeCorrectFile($import_file);
@@ -93,7 +93,7 @@ abstract class BulkAction
*
* @return array 'all' => amount of records processed, 'imported' => number of imported records
*/
abstract public function doImport($separator = ";", $offset = 0);
abstract public function doImport(string $separator = ";", int $offset = 0);
/**
* setter for import-file

View File

@@ -34,10 +34,12 @@ class DomainBulkAction extends BulkAction
{
/**
* @param string $import_file
* @param array $userinfo
*
* @return object DomainBulkAction instance
* @return DomainBulkAction
*/
public function __construct($import_file = null, $userinfo)
public function __construct(string $import_file = null, array $userinfo = [])
{
parent::__construct($import_file, $userinfo);
$this->setApiCall('Domains.add');
@@ -52,7 +54,7 @@ class DomainBulkAction extends BulkAction
*
* @return array 'all' => amount of records processed, 'imported' => number of imported records
*/
public function doImport($separator = ";", $offset = 0)
public function doImport(string $separator = ";", int $offset = 0)
{
if ($this->userinfo['domains'] == "-1") {
$dom_unlimited = true;

View File

@@ -28,6 +28,7 @@ namespace Froxlor\Cli;
use Exception;
use Froxlor\Froxlor;
use Froxlor\Settings;
use Froxlor\Database\Database;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@@ -72,7 +73,7 @@ class CliCommand extends Command
include_once Froxlor::getInstallDir() . '/install/updatesql.php';
ob_end_flush();
$output->writeln('<info>Automatic update done - you should check your settings to be sure everything is fine</>');
return self::SUCCCESS;
return self::SUCCESS;
}
private function cleanUpdateOutput($buffer)

View File

@@ -25,6 +25,7 @@
namespace Froxlor\Cli;
use PDO;
use Froxlor\Froxlor;
use Froxlor\FileDir;
use Froxlor\Settings;
@@ -32,6 +33,7 @@ use Froxlor\FroxlorLogger;
use Froxlor\Database\Database;
use Froxlor\System\Cronjob;
use Froxlor\Cron\TaskId;
use Froxlor\Cron\CronConfig;
use Froxlor\Cron\System\Extrausers;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@@ -142,7 +144,7 @@ final class MasterCron extends CliCommand
// we have to check the system's last guid with every cron run
// in case the admin installed new software which added a new user
//so users in the database don't conflict with system users
$this->cronlog->logAction(FroxlorLogger::CRON_ACTION, LOG_NOTICE, 'Checking system\'s last guid');
$this->cronLog->logAction(FroxlorLogger::CRON_ACTION, LOG_NOTICE, 'Checking system\'s last guid');
Cronjob::checkLastGuid();
// check for cron.d-generation task and create it if necessary
@@ -160,7 +162,7 @@ final class MasterCron extends CliCommand
{
if ($jobcount > 0) {
if (Settings::Get('system.nssextrausers') == 1) {
Extrausers::generateFiles(self::$cronlog);
Extrausers::generateFiles($this->cronLog);
return;
}

View File

@@ -143,7 +143,7 @@ final class UpdateCommand extends CliCommand
$auex = AutoUpdate::extractZip($audl);
if ($auex == 0) {
$output->writeln("<info>Froxlor files updated successfully.</>");
$result = self::SUCCCESS;
$result = self::SUCCESS;
$question = new ConfirmationQuestion('Update database? [no] ', false, '/^(y|j)/i');
if ($yestoall || $helper->ask($input, $output, $question)) {
$result = $this->updateDatabase();
@@ -193,7 +193,7 @@ final class UpdateCommand extends CliCommand
]);
include_once Froxlor::getInstallDir() . '/install/updatesql.php';
ob_end_flush();
return self::SUCCCESS;
return self::SUCCESS;
}
private function cleanUpdateOutput($buffer)

View File

@@ -127,6 +127,8 @@ class ConfigDaemon
if (is_null($this->sqldata_cache)) {
// read in sql-data (if exists)
if (file_exists(Froxlor::getInstallDir() . "/lib/userdata.inc.php")) {
$sql = [];
$sql_root = [];
require Froxlor::getInstallDir() . "/lib/userdata.inc.php";
unset($sql_root);
$this->sqldata_cache = $sql;

View File

@@ -40,16 +40,10 @@ use Froxlor\Validate\Validate;
use Froxlor\System\Crypt;
use PDO;
/**
* @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-)
*/
class Apache extends HttpConfigBase
{
// protected
protected $known_vhostfilenames = [];
protected $known_diroptionsfilenames = [];
protected $known_htpasswdsfilenames = [];
@@ -1460,8 +1454,6 @@ class Apache extends HttpConfigBase
// Write a single file for every vhost
foreach ($this->virtualhosts_data as $vhosts_filename => $vhosts_file) {
$this->known_vhostfilenames[] = basename($vhosts_filename);
// Apply header
$vhosts_file = '# ' . basename($vhosts_filename) . "\n" . '# Created ' . date('d.m.Y H:i') . "\n" . '# Do NOT manually edit this file, all changes will be deleted after the next domain change at the panel.' . "\n" . "\n" . $vhosts_file;
$vhosts_file_handler = fopen($vhosts_filename, 'w');

View File

@@ -65,10 +65,10 @@ class AcmeSh extends FroxlorCron
/**
* run the task
*
* @param boolean $internal
* @param bool $internal
* @return number
*/
public static function run($internal = false)
public static function run(bool $internal = false)
{
// usually, this is action is called from within the tasks-jobs
if (!defined('CRON_IS_FORCED') && !defined('CRON_DEBUG_FLAG') && $internal == false) {
@@ -201,6 +201,7 @@ class AcmeSh extends FroxlorCron
} else {
FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, "No new certificates or certificate updates found");
}
return 0;
}
/**

View File

@@ -29,6 +29,7 @@ use Froxlor\Cron\Http\Php\PhpInterface;
use Froxlor\Customer\Customer;
use Froxlor\Database\Database;
use Froxlor\Domain\Domain;
use Froxlor\Froxlor;
use Froxlor\FileDir;
use Froxlor\FroxlorLogger;
use Froxlor\Http\Directory;
@@ -36,14 +37,9 @@ use Froxlor\Http\Statistics;
use Froxlor\Settings;
use Froxlor\Validate\Validate;
use Froxlor\System\Crypt;
use Froxlor\Idna\IdnaWrapper;
use PDO;
/**
* @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-)
*
* @todo ssl-redirect to non-standard port
*/
class Lighttpd extends HttpConfigBase
{
@@ -81,7 +77,7 @@ class Lighttpd extends HttpConfigBase
$ipv6 = '';
}
$this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, 'lighttpd::createIpPort: creating ip/port settings for ' . $ip . ":" . $port);
FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, 'lighttpd::createIpPort: creating ip/port settings for ' . $ip . ":" . $port);
$vhost_filename = FileDir::makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/10_froxlor_ipandport_' . trim(str_replace(':', '.', $row_ipsandports['ip']), '.') . '.' . $row_ipsandports['port'] . '.conf');
if (!isset($this->lighttpd_data[$vhost_filename])) {
@@ -126,13 +122,13 @@ class Lighttpd extends HttpConfigBase
if (!$is_redirect) {
// protect lib/userdata.inc.php
$this->lighttpd_data[$vhosts_filename] .= ' $HTTP["host"] =~ "' . rtrim(Froxlor::getInstallDir(), "/") . '/lib" {' . "\n";
$this->lighttpd_data[$vhosts_filename] .= ' url.access-deny = ("userdata.inc.php")' . "\n";
$this->lighttpd_data[$vhosts_filename] .= ' }' . "\n";
$this->lighttpd_data[$vhost_filename] .= ' $HTTP["host"] =~ "' . rtrim(Froxlor::getInstallDir(), "/") . '/lib" {' . "\n";
$this->lighttpd_data[$vhost_filename] .= ' url.access-deny = ("userdata.inc.php")' . "\n";
$this->lighttpd_data[$vhost_filename] .= ' }' . "\n";
// protect bin/
$this->lighttpd_data[$vhosts_filename] .= ' $HTTP["host"] =~ "' . rtrim(Froxlor::getInstallDir(), "/") . '/bin" {' . "\n";
$this->lighttpd_data[$vhosts_filename] .= ' url.access-deny = ("")' . "\n";
$this->lighttpd_data[$vhosts_filename] .= ' }' . "\n";
$this->lighttpd_data[$vhost_filename] .= ' $HTTP["host"] =~ "' . rtrim(Froxlor::getInstallDir(), "/") . '/bin" {' . "\n";
$this->lighttpd_data[$vhost_filename] .= ' url.access-deny = ("")' . "\n";
$this->lighttpd_data[$vhost_filename] .= ' }' . "\n";
/**
* dirprotection, see #72
@@ -222,7 +218,7 @@ class Lighttpd extends HttpConfigBase
if (($row_ipsandports['ssl_cert_file'] == '' || !file_exists($row_ipsandports['ssl_cert_file'])) && (Settings::Get('system.le_froxlor_enabled') == '0' || $this->froxlorVhostHasLetsEncryptCert() == false)) {
$row_ipsandports['ssl_cert_file'] = Settings::Get('system.ssl_cert_file');
if (!file_exists($row_ipsandports['ssl_cert_file'])) {
$this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_DEBUG, 'System certificate file "' . Settings::Get('system.ssl_cert_file') . '" does not seem to exist. Creating self-signed certificate...');
FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::CRON_ACTION, LOG_DEBUG, 'System certificate file "' . Settings::Get('system.ssl_cert_file') . '" does not seem to exist. Creating self-signed certificate...');
Crypt::createSelfSignedCertificate();
}
}
@@ -264,7 +260,7 @@ class Lighttpd extends HttpConfigBase
if ($domain['ssl_cert_file'] != '') {
// check for existence, #1485
if (!file_exists($domain['ssl_cert_file'])) {
$this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_ERR, $ip . ':' . $port . ' :: certificate file "' . $domain['ssl_cert_file'] . '" does not exist! Cannot create ssl-directives');
FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::CRON_ACTION, LOG_ERR, $ip . ':' . $port . ' :: certificate file "' . $domain['ssl_cert_file'] . '" does not exist! Cannot create ssl-directives');
echo $ip . ':' . $port . ' :: certificate file "' . $domain['ssl_cert_file'] . '" does not exist! Cannot create SSL-directives' . "\n";
} else {
$this->lighttpd_data[$vhost_filename] .= 'ssl.engine = "enable"' . "\n";
@@ -286,7 +282,7 @@ class Lighttpd extends HttpConfigBase
if ($domain['ssl_ca_file'] != '') {
// check for existence, #1485
if (!file_exists($domain['ssl_ca_file'])) {
$this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_ERR, $ip . ':' . $port . ' :: certificate CA file "' . $domain['ssl_ca_file'] . '" does not exist! Cannot create ssl-directives');
FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::CRON_ACTION, LOG_ERR, $ip . ':' . $port . ' :: certificate CA file "' . $domain['ssl_ca_file'] . '" does not exist! Cannot create ssl-directives');
echo $ip . ':' . $port . ' :: certificate CA file "' . $domain['ssl_ca_file'] . '" does not exist! SSL-directives might not be working' . "\n";
} else {
$this->lighttpd_data[$vhost_filename] .= 'ssl.ca-file = "' . FileDir::makeCorrectFile($domain['ssl_ca_file']) . '"' . "\n";
@@ -571,21 +567,19 @@ class Lighttpd extends HttpConfigBase
$this->deactivated = true;
} else {
if ($ssl === false && $domain['ssl_redirect'] == '1') {
$redirect_domain = $this->idnaConvert->encode('https://' . $domain['domain']);
$webroot_text .= ' url.redirect = (' . "\n";
$webroot_text .= "\t" . '"^/(.*)" => "' . $redirect_domain . '/$1",' . "\n";
$webroot_text .= "\t" . '"" => "' . $redirect_domain . '",' . "\n";
$webroot_text .= "\t" . '"/" => "' . $redirect_domain . '"' . "\n";
$webroot_text .= ' )' . "\n";
$redirect_domain = (new IdnaWrapper)->encode('https://' . $domain['domain']);
} elseif (preg_match("#^https?://#i", $domain['documentroot'])) {
$redirect_domain = $this->idnaConvert->encode($domain['documentroot']);
$webroot_text .= ' url.redirect = (' . "\n";
$webroot_text .= "\t" . '"^/(.*)" => "' . $redirect_domain . '/$1",' . "\n";
$webroot_text .= "\t" . '"" => "' . $redirect_domain . '",' . "\n";
$webroot_text .= "\t" . '"/" => "' . $redirect_domain . '"' . "\n";
$webroot_text .= ' )' . "\n";
$redirect_domain = (new IdnaWrapper)->encode($domain['documentroot']);
} else {
$webroot_text .= ' server.document-root = "' . FileDir::makeCorrectDir($domain['documentroot']) . "\"\n";
$redirect_domain = '';
}
if (!empty($redirect_domain)) {
$webroot_text .= ' url.redirect = (' . "\n";
$webroot_text .= "\t" . '"^/(.*)" => "' . $redirect_domain . '/$1",' . "\n";
$webroot_text .= "\t" . '"" => "' . $redirect_domain . '",' . "\n";
$webroot_text .= "\t" . '"/" => "' . $redirect_domain . '"' . "\n";
$webroot_text .= ' )' . "\n";
}
$this->deactivated = false;
}
@@ -765,7 +759,7 @@ class Lighttpd extends HttpConfigBase
if (!file_exists($domain['ssl_cert_file'])) {
// explicitly disable ssl for this vhost
$domain['ssl_cert_file'] = "";
$this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_DEBUG, 'System certificate file "' . Settings::Get('system.ssl_cert_file') . '" does not seem to exist. Disabling SSL-vhost for "' . $domain['domain'] . '"');
FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::CRON_ACTION, LOG_DEBUG, 'System certificate file "' . Settings::Get('system.ssl_cert_file') . '" does not seem to exist. Disabling SSL-vhost for "' . $domain['domain'] . '"');
}
}
@@ -923,7 +917,7 @@ class Lighttpd extends HttpConfigBase
public function writeConfigs()
{
$this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, "lighttpd::writeConfigs: rebuilding " . Settings::Get('system.apacheconf_vhost'));
FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::CRON_ACTION, LOG_INFO, "lighttpd::writeConfigs: rebuilding " . Settings::Get('system.apacheconf_vhost'));
$vhostDir = new Directory(Settings::Get('system.apacheconf_vhost'));
if (!$vhostDir->isConfigDir()) {
@@ -950,14 +944,12 @@ class Lighttpd extends HttpConfigBase
fclose($vhosts_file_handler);
} else {
if (!file_exists(Settings::Get('system.apacheconf_vhost'))) {
$this->logger->logAction(FroxlorLogger::CRON_ACTION, LOG_NOTICE, 'lighttpd::writeConfigs: mkdir ' . escapeshellarg(FileDir::makeCorrectDir(Settings::Get('system.apacheconf_vhost'))));
FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::CRON_ACTION, LOG_NOTICE, 'lighttpd::writeConfigs: mkdir ' . escapeshellarg(FileDir::makeCorrectDir(Settings::Get('system.apacheconf_vhost'))));
FileDir::safe_exec('mkdir ' . escapeshellarg(FileDir::makeCorrectDir(Settings::Get('system.apacheconf_vhost'))));
}
// Write a single file for every vhost
foreach ($this->lighttpd_data as $vhosts_filename => $vhosts_file) {
$this->known_filenames[] = basename($vhosts_filename);
// Apply header
$vhosts_file = '# ' . basename($vhosts_filename) . "\n" . '# Created ' . date('d.m.Y H:i') . "\n" . '# Do NOT manually edit this file, all changes will be deleted after the next domain change at the panel.' . "\n" . "\n" . $vhosts_file;

View File

@@ -29,6 +29,7 @@ use Froxlor\Cron\Http\Php\PhpInterface;
use Froxlor\Customer\Customer;
use Froxlor\Database\Database;
use Froxlor\Domain\Domain;
use Froxlor\Froxlor;
use Froxlor\FileDir;
use Froxlor\FroxlorLogger;
use Froxlor\Http\Directory;
@@ -50,8 +51,7 @@ class Nginx extends HttpConfigBase
protected $known_htpasswdsfilenames = [];
protected $mod_accesslog_loaded = '0';
protected $vhost_root_autoindex = false;
protected $known_vhostfilenames = [];
private $nginx_server = [];
/**
* indicator whether a customer is deactivated or not
* if yes, only the webroot will be generated
@@ -60,11 +60,6 @@ class Nginx extends HttpConfigBase
*/
private $deactivated = false;
public function __construct($nginx_server = [])
{
$this->nginx_server = $nginx_server;
}
public function createVirtualHosts()
{
return;
@@ -220,14 +215,14 @@ class Nginx extends HttpConfigBase
$this->nginx_data[$vhost_filename] .= "\t" . '}' . "\n";
// protect lib/userdata.inc.php
$this->nginx_data[$vhosts_filename] .= "\t" . 'location = ' . rtrim(Froxlor::getInstallDir(), "/") . '/lib/userdata.inc.php {' . "\n";
$this->nginx_data[$vhosts_filename] .= "\t" . ' deny all;' . "\n";
$this->nginx_data[$vhosts_filename] .= "\t" . '}' . "\n";
$this->nginx_data[$vhost_filename] .= "\t" . 'location = ' . rtrim(Froxlor::getInstallDir(), "/") . '/lib/userdata.inc.php {' . "\n";
$this->nginx_data[$vhost_filename] .= "\t" . ' deny all;' . "\n";
$this->nginx_data[$vhost_filename] .= "\t" . '}' . "\n";
// protect bin/
$this->nginx_data[$vhosts_filename] .= "\t" . 'location = ' . rtrim(Froxlor::getInstallDir(), "/") . '/bin {' . "\n";
$this->nginx_data[$vhosts_filename] .= "\t" . ' deny all;' . "\n";
$this->nginx_data[$vhosts_filename] .= "\t" . '}' . "\n";
$this->nginx_data[$vhost_filename] .= "\t" . 'location = ' . rtrim(Froxlor::getInstallDir(), "/") . '/bin {' . "\n";
$this->nginx_data[$vhost_filename] .= "\t" . ' deny all;' . "\n";
$this->nginx_data[$vhost_filename] .= "\t" . '}' . "\n";
}
if ($row_ipsandports['specialsettings'] != '' && ($row_ipsandports['ssl'] == '0' || ($row_ipsandports['ssl'] == '1' && Settings::Get('system.use_ssl') == '1' && $row_ipsandports['include_specialsettings'] == '1'))) {
@@ -1252,8 +1247,6 @@ class Nginx extends HttpConfigBase
// Write a single file for every vhost
foreach ($this->nginx_data as $vhosts_filename => $vhosts_file) {
$this->known_filenames[] = basename($vhosts_filename);
// Apply header
$vhosts_file = '# ' . basename($vhosts_filename) . "\n" . '# Created ' . date('d.m.Y H:i') . "\n" . '# Do NOT manually edit this file, all changes will be deleted after the next domain change at the panel.' . "\n" . "\n" . $vhosts_file;

View File

@@ -46,11 +46,11 @@ class PhpInterface
private $interface = null;
/**
* Admin-User data array
* PHP-Config data array
*
* @var array
*/
private $admin_cache = [];
private $php_configs_cache = [];
/**
* main constructor
@@ -93,10 +93,8 @@ class PhpInterface
*
* @return array
*/
public function getPhpConfig($php_config_id)
public function getPhpConfig(int $php_config_id)
{
$php_config_id = intval($php_config_id);
// If domain has no config, we will use the default one.
if ($php_config_id == 0) {
$php_config_id = 1;
@@ -104,24 +102,26 @@ class PhpInterface
if (!isset($this->php_configs_cache[$php_config_id])) {
$stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = :id");
$this->_php_configs_cache[$php_config_id] = Database::pexecute_first($stmt, [
SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = :id
");
$this->php_configs_cache[$php_config_id] = Database::pexecute_first($stmt, [
'id' => $php_config_id
]);
if ((int)Settings::Get('phpfpm.enabled') == 1) {
$stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_FPMDAEMONS . "` WHERE `id` = :id");
$this->_php_configs_cache[$php_config_id]['fpm_settings'] = Database::pexecute_first($stmt, [
'id' => $this->_php_configs_cache[$php_config_id]['fpmsettingid']
SELECT * FROM `" . TABLE_PANEL_FPMDAEMONS . "` WHERE `id` = :id
");
$this->php_configs_cache[$php_config_id]['fpm_settings'] = Database::pexecute_first($stmt, [
'id' => $this->php_configs_cache[$php_config_id]['fpmsettingid']
]);
// override fpm daemon settings if set in php-config
if ($this->_php_configs_cache[$php_config_id]['override_fpmconfig'] == 1) {
$this->_php_configs_cache[$php_config_id]['fpm_settings']['limit_extensions'] = $this->_php_configs_cache[$php_config_id]['limit_extensions'];
$this->_php_configs_cache[$php_config_id]['fpm_settings']['idle_timeout'] = $this->_php_configs_cache[$php_config_id]['idle_timeout'];
if ($this->php_configs_cache[$php_config_id]['override_fpmconfig'] == 1) {
$this->php_configs_cache[$php_config_id]['fpm_settings']['limit_extensions'] = $this->php_configs_cache[$php_config_id]['limit_extensions'];
$this->php_configs_cache[$php_config_id]['fpm_settings']['idle_timeout'] = $this->php_configs_cache[$php_config_id]['idle_timeout'];
}
}
}
return $this->_php_configs_cache[$php_config_id];
return $this->php_configs_cache[$php_config_id];
}
}

View File

@@ -127,6 +127,9 @@ class Database
{
global $userinfo, $theme, $linker;
$sql = [];
$sql_root = [];
// include userdata.inc.php
require Froxlor::getInstallDir() . "/lib/userdata.inc.php";

View File

@@ -26,12 +26,10 @@
namespace Froxlor;
use Exception;
use Froxlor\Customer\Customer;
use Froxlor\Database\Database;
use PDO;
use RecursiveCallbackFilterIterator;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
use Froxlor\Customer\Customer;
use Froxlor\Database\Database;
class FileDir
{
@@ -550,12 +548,11 @@ class FileDir
/**
* set the immutable flag for a file
*
* @param string $filename
* the file to set the flag for
* @param string $filename the file to set the flag for
*
* @return boolean
* @return void
*/
public static function setImmutable($filename = null)
public static function setImmutable(string $filename)
{
FileDir::safe_exec(self::getImmutableFunction(false) . escapeshellarg($filename));
}
@@ -564,12 +561,11 @@ class FileDir
* internal function to check whether
* to use chattr (Linux) or chflags (FreeBSD)
*
* @param boolean $remove
* whether to use +i|schg (false) or -i|noschg (true)
* @param bool $remove whether to use +i|schg (false) or -i|noschg (true)
*
* @return string functionname + parameter (not the file)
*/
private static function getImmutableFunction($remove = false)
private static function getImmutableFunction(bool $remove = false)
{
if (self::isFreeBSD()) {
// FreeBSD style
@@ -585,12 +581,11 @@ class FileDir
* or BSD-based (NetBSD, OpenBSD, etc.
* if exact = false [default])
*
* @param boolean $exact
* whether to check explicitly for FreeBSD or *BSD
* @param bool $exact whether to check explicitly for FreeBSD or *BSD
*
* @return boolean
* @return bool
*/
public static function isFreeBSD($exact = false)
public static function isFreeBSD(bool $exact = false)
{
if (($exact && PHP_OS == 'FreeBSD') || (!$exact && stristr(PHP_OS, 'BSD'))) {
return true;
@@ -601,16 +596,19 @@ class FileDir
/**
* removes the immutable flag for a file
*
* @param string $filename
* the file to set the flag for
* @param string $filename the file to set the flag for
*
* @return boolean
* @return void
*/
public static function removeImmutable($filename = null)
public static function removeImmutable(string $filename)
{
FileDir::safe_exec(self::getImmutableFunction(true) . escapeshellarg($filename));
}
/**
*
* @return array|false
*/
public static function getFilesystemQuota()
{
// enabled at all?

View File

@@ -26,6 +26,7 @@
namespace Froxlor\Install;
use Exception;
use ZipArchive;
use Froxlor\Froxlor;
use Froxlor\Settings;
use Froxlor\Http\HttpClient;

View File

@@ -31,6 +31,9 @@ use Froxlor\Settings;
class Update
{
private static $update_tasks = [];
private static $task_counter = 0;
/**
* Function showUpdateStep
@@ -42,20 +45,18 @@ class Update
*
* @return void
*/
public static function showUpdateStep($task = null, $needs_status = true)
public static function showUpdateStep(string $task, bool $needs_status = true)
{
global $update_tasks, $task_counter;
set_time_limit(30);
// output
$update_tasks[$task_counter] = ['title' => $task, 'result' => 0];
self::$update_tasks[self::$task_counter] = ['title' => $task, 'result' => 0];
if (!$needs_status) {
$task_counter++;
self::$task_counter++;
}
FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::ADM_ACTION, LOG_WARNING, $task);
FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::ADM_ACTION, \LOG_WARNING, $task);
}
/**
@@ -67,35 +68,33 @@ class Update
* @param string $message
* @param string $additional_info
*
* @return string formatted output and log-entry
* @return void
*/
public static function lastStepStatus(int $status = -1, string $message = '', string $additional_info = '')
{
global $update_tasks, $task_counter;
$update_tasks[$task_counter]['result_txt'] = $message ?? 'OK';
$update_tasks[$task_counter]['result_desc'] = $additional_info ?? '';
self::$update_tasks[self::$task_counter]['result_txt'] = $message ?? 'OK';
self::$update_tasks[self::$task_counter]['result_desc'] = $additional_info ?? '';
switch ($status) {
case 0:
break;
case 1:
$update_tasks[$task_counter]['result'] = 2;
self::$update_tasks[self::$task_counter]['result'] = 2;
break;
case 2:
$update_tasks[$task_counter]['result'] = 1;
self::$update_tasks[self::$task_counter]['result'] = 1;
break;
default:
$update_tasks[$task_counter]['result'] = -1;
self::$update_tasks[self::$task_counter]['result'] = -1;
break;
}
$task_counter++;
self::$task_counter++;
if ($status == -1 || $status == 2) {
FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::ADM_ACTION, LOG_WARNING, 'Attention - last update task failed!!!');
FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::ADM_ACTION, \LOG_WARNING, 'Attention - last update task failed!!!');
} elseif ($status == 0 || $status == 1) {
FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::ADM_ACTION, LOG_WARNING, 'Success');
FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::ADM_ACTION, \LOG_WARNING, 'Success');
}
}
@@ -127,4 +126,14 @@ class Update
}
return null;
}
public static function getUpdateTasks(): array
{
return self::$update_tasks;
}
public static function getTaskCounter(): int
{
return self::$task_counter;
}
}

View File

@@ -60,7 +60,6 @@ class Listing
{
return [
'title' => $tabellisting['title'],
'icon' => $tabellisting['icon'],
'description' => $tabellisting['description'] ?? null,
'icon' => $tabellisting['icon'] ?? null,
'table' => [

View File

@@ -46,23 +46,19 @@ class Validate
const REGEX_YYYY_MM_DD = '/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/';
/**
* Validates the given string by matching against the pattern, prints an error on failure and exits
* Validates the given string by matching against the pattern, prints an error on failure and exits.
* If the default pattern is used and the string does not match, we try to replace the 'bad' values and log the action.
*
* @param string $str
* the string to be tested (user input)
* @param
* string the $fieldname to be used in error messages
* @param string $pattern
* the regular expression to be used for testing
* @param
* string language id for the error
* @return string the clean string
*
* If the default pattern is used and the string does not match, we try to replace the
* 'bad' values and log the action.
* @param string $str the string to be tested (user input)
* @param string $fieldname to be used in error messages
* @param string $pattern the regular expression to be used for testing
* @param string $language id for the error
* @param string|array $emptydefault fallback value
* @param bool $throw_exception whether to display error or throw an exception, default false
*
* @return string|void the clean string or error
*/
public static function validate($str, $fieldname, $pattern = '', $lng = '', $emptydefault = [], $throw_exception = false)
public static function validate($str, string $fieldname, string $pattern = '', string $lng = '', $emptydefault = [], bool $throw_exception = false)
{
if (!is_array($emptydefault)) {
$emptydefault_array = [
@@ -122,9 +118,9 @@ class Validate
* @param bool $throw_exception
* whether to throw an exception on failure
*
* @return string|bool ip address on success, false on failure
* @return string|bool|void ip address on success, false on failure (or nothing if error is displayed)
*/
public static function validate_ip2($ip, $return_bool = false, $lng = 'invalidip', $allow_localhost = false, $allow_priv = false, $allow_cidr = false, $cidr_as_netmask = false, $throw_exception = false)
public static function validate_ip2($ip, bool $return_bool = false, string $lng = 'invalidip', bool $allow_localhost = false, bool $allow_priv = false, bool $allow_cidr = false, bool $cidr_as_netmask = false, bool $throw_exception = false)
{
$cidr = "";
if ($allow_cidr) {
@@ -136,15 +132,17 @@ class Validate
$cidr_range_max = 128;
}
if (strlen($ip_cidr[1]) <= 3 && in_array((int)$ip_cidr[1], array_values(range(1, $cidr_range_max)), true) === false) {
if ($return_bool) {
return false;
}
Response::standardError($lng, $ip, $throw_exception);
}
if ($cidr_as_netmask && IPTools::is_ipv6($ip_cidr[0])) {
// MySQL does not handle CIDR of IPv6 addresses, return error
if ($return_bool) {
return false;
} else {
Response::standardError($lng, $ip, $throw_exception);
}
Response::standardError($lng, $ip, $throw_exception);
}
$ip = $ip_cidr[0];
if ($cidr_as_netmask && strlen($ip_cidr[1]) <= 3) {
@@ -157,9 +155,8 @@ class Validate
} elseif (strpos($ip, "/") !== false) {
if ($return_bool) {
return false;
} else {
Response::standardError($lng, $ip, $throw_exception);
}
Response::standardError($lng, $ip, $throw_exception);
}
$filter_lan = $allow_priv ? FILTER_FLAG_NO_RES_RANGE : (FILTER_FLAG_NO_RES_RANGE | FILTER_FLAG_NO_PRIV_RANGE);
@@ -175,9 +172,8 @@ class Validate
if ($return_bool) {
return false;
} else {
Response::standardError($lng, $ip, $throw_exception);
}
Response::standardError($lng, $ip, $throw_exception);
}
/**