diff --git a/lib/Froxlor/Api/Commands/Froxlor.php b/lib/Froxlor/Api/Commands/Froxlor.php index 2ae0ab45..250c0a8e 100644 --- a/lib/Froxlor/Api/Commands/Froxlor.php +++ b/lib/Froxlor/Api/Commands/Froxlor.php @@ -259,14 +259,15 @@ class Froxlor extends ApiCommand * returns a random password based on froxlor settings for min-length, included characters, etc. * * @param int $length - * optional length of password, defaults to 10 + * optional length of password, defaults to 0 (panel.password_min_length) * * @access admin, customer * @return string + * @throws Exception */ - public function generatePassword() + public function generatePassword(): string { - $length = $this->getParam('length', true, 10); + $length = $this->getParam('length', true, 0); return $this->response(Crypt::generatePassword($length)); } diff --git a/lib/Froxlor/Cli/InstallCommand.php b/lib/Froxlor/Cli/InstallCommand.php index 443c93cc..bd8531e0 100644 --- a/lib/Froxlor/Cli/InstallCommand.php +++ b/lib/Froxlor/Cli/InstallCommand.php @@ -211,7 +211,7 @@ final class InstallCommand extends Command $ask_field = false; } $fielddata['value'] = $this->formfielddata[$fieldname] ?? ($fielddata['value'] ?? null); - $fielddata['label'] = strip_tags(str_replace("
", " ", $fielddata['label'])); + $fielddata['label'] = $this->cliTextFormat($fielddata['label'], " "); if ($ask_field) { if ($fielddata['type'] == 'password') { $this->formfielddata[$fieldname] = $this->io->askHidden($fielddata['label'], function ($value) use ($fielddata) { @@ -267,7 +267,7 @@ final class InstallCommand extends Command case 4: $section = $inst->formfield['install']['sections']['step' . $step] ?? []; $this->io->section($section['title']); - $this->io->note($section['description']); + $this->io->note($this->cliTextFormat($section['description'])); $cmdfield = $section['fields']['system']; $this->io->success([ $cmdfield['label'], @@ -320,7 +320,7 @@ final class InstallCommand extends Command $fieldval = '******'; } elseif ($field['type'] == 'select') { $fieldval = implode("|", array_keys($field['select_var'])); - } else if ($field['type'] == 'checkbox') { + } elseif ($field['type'] == 'checkbox') { $fieldval = "1|0"; } else { $fieldval = "?"; @@ -348,4 +348,10 @@ final class InstallCommand extends Command curl_close($ch); fclose($fp); } + + private function cliTextFormat(string $text, string $nl_char = "\n"): string + { + $text = str_replace(['
', '
', '
'], [$nl_char, $nl_char, $nl_char], $text); + return strip_tags($text); + } } diff --git a/lib/Froxlor/Cron/Traffic/TrafficCron.php b/lib/Froxlor/Cron/Traffic/TrafficCron.php index 30d1bd1b..421505e3 100644 --- a/lib/Froxlor/Cron/Traffic/TrafficCron.php +++ b/lib/Froxlor/Cron/Traffic/TrafficCron.php @@ -47,7 +47,7 @@ class TrafficCron extends FroxlorCron public static function run() { - self::runFork([self::class, 'handle']); + self::runFork([self::class, 'handle'], [true]); } public static function handle() diff --git a/lib/Froxlor/Validate/Validate.php b/lib/Froxlor/Validate/Validate.php index daac526a..349e6d56 100644 --- a/lib/Froxlor/Validate/Validate.php +++ b/lib/Froxlor/Validate/Validate.php @@ -176,7 +176,7 @@ class Validate } // special case where localhost ip is allowed (mysql-access-hosts for example) - if ($allow_localhost && $ip == '127.0.0.1') { + if ($allow_localhost && ($ip == '127.0.0.1' || $ip == '::1')) { return $ip . $cidr; }