From 8cc19b0adf598fa3b70897a40bf9e09b1d81adad Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Wed, 12 Oct 2022 20:28:53 +0100 Subject: [PATCH 1/4] add @todo for php-imap.com - see also #656 --- model/MailboxHandler.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/model/MailboxHandler.php b/model/MailboxHandler.php index 2e7964b9..74bb0b55 100644 --- a/model/MailboxHandler.php +++ b/model/MailboxHandler.php @@ -740,6 +740,8 @@ class MailboxHandler extends PFAHandler * created. * * @return boolean TRUE if everything succeeds, FALSE on all errors + * + * @todo rewrite/remove dependency on php-imap and use instead something like : https://www.php-imap.com/api/client */ protected function create_mailbox_subfolders() { From 7caf25244a2cf139d3ca96bc4a38fc0c7686ff23 Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Wed, 12 Oct 2022 20:41:14 +0100 Subject: [PATCH 2/4] composer format time --- .github/workflows/php.yml | 2 +- public/editactive.php | 2 +- public/list-virtual.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 87237995..ca69fe57 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -4,7 +4,7 @@ on: [push] jobs: lint_etc: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 diff --git a/public/editactive.php b/public/editactive.php index 3d9919d6..16c49e1e 100644 --- a/public/editactive.php +++ b/public/editactive.php @@ -14,7 +14,7 @@ * File: editactive.php * Used to switch active status for admins, domains, mailboxes, aliases and aliasdomains, etc. * - * Template File: + * Template File: * list-virutal.tpl * list-virutal-alias.tpl which incl list-virutal.tpl * list-virutal-alias_domains.tpl which incl list-virutal.tpl diff --git a/public/list-virtual.php b/public/list-virtual.php index d5251644..e3868501 100644 --- a/public/list-virtual.php +++ b/public/list-virtual.php @@ -14,7 +14,7 @@ * File: list-virtual.php * List virtual users for a domain. * - * Template File: + * Template File: * list-virutal.tpl * list-virutal-alias.tpl which incl list-virutal.tpl * list-virutal-alias_domains.tpl which incl list-virutal.tpl From 3017ea3f3cb1e29fa02e20ec579bc745a4b6bb70 Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Wed, 12 Oct 2022 20:52:49 +0100 Subject: [PATCH 3/4] psalm fixes (drop safeserver() (not used), $_COOKIE always contains strings etc). --- functions.inc.php | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/functions.inc.php b/functions.inc.php index e8c43b51..64a1dfde 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -403,22 +403,6 @@ function safepost($param, $default = "") return $retval; } -/** - * safeserver - * @param string $param - * @param string $default (optional) - * @return string value from $_SERVER[$param] or $default - * @see safeget() - */ -function safeserver($param, $default = "") -{ - $retval = $default; - if (isset($_SERVER[$param])) { - $retval = $_SERVER[$param]; - } - return $retval; -} - /** * safecookie * @param string $param @@ -429,7 +413,7 @@ function safeserver($param, $default = "") function safecookie($param, $default = "") { $retval = $default; - if (isset($_COOKIE[$param]) && is_string($_COOKIE[$param])) { + if (isset($_COOKIE[$param])) { $retval = $_COOKIE[$param]; } return $retval; @@ -894,13 +878,16 @@ function generate_password($length = 12) function validate_password($password) { $result = array(); - $val_conf = Config::read_array('password_validation'); - if (Config::has('min_password_length')) { - $minlen = (int)Config::read('min_password_length'); # used up to 2.3.x - check it for backward compatibility - if ($minlen > 0) { - $val_conf['/.{' . $minlen . '}/'] = "password_too_short $minlen"; - } + $config = Config::getInstance()->getAll(); + + $val_conf = $config['password_validation'] ?? []; + + $minlen = $config['min_password_length'] ?? null; + + if (is_numeric($minlen) && $minlen > 0) { + $minlen = (int)$minlen; # used up to 2.3.x - + $val_conf['/.{' . $minlen . '}/'] = "password_too_short $minlen"; } foreach ($val_conf as $regex => $message) { From eb7e449522cb2d9ad1c5cd0d96f592454296b4e1 Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Wed, 12 Oct 2022 21:09:31 +0100 Subject: [PATCH 4/4] build_coverage_report is not important --- .github/workflows/php.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index ca69fe57..12ec59ef 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -63,6 +63,7 @@ jobs: build_coverage_report: needs: [testsuite] + continue-on-error: true runs-on: ubuntu-latest steps: - uses: actions/checkout@v2