refactoring

This commit is contained in:
Roland Gruber 2022-09-11 20:05:45 +02:00
parent 68f88a2cc8
commit f4a280c633
4 changed files with 21 additions and 7 deletions

View file

@ -1,5 +1,6 @@
<?php
namespace LAM\LOGIN;
use LAM\ENV\LAMLicenseValidator;
use LAM\LIB\TWO_FACTOR\TwoFactorProviderService;
use \LAMConfig;
use \LAMCfgMain;
@ -189,13 +190,13 @@ setlanguage(); // setting correct language
/**
* Displays the login window.
*
* @param \LAM\ENV\LAMLicenseValidator $licenseValidator license validator
* @param string $error_message error message to display
* @param string $errorDetails error details
* @param string $extraMessage extra message that is shown as info
* @param LAMLicenseValidator|null $licenseValidator license validator
* @param string|null $error_message error message to display
* @param string|null $errorDetails error details
* @param string|null $extraMessage extra message that is shown as info
* @throws LAMException error rendering login page
*/
function display_LoginPage($licenseValidator, $error_message, $errorDetails = null, $extraMessage = null): void {
function display_LoginPage(?LAMLicenseValidator $licenseValidator, ?string $error_message, ?string $errorDetails = null, ?string $extraMessage = null): void {
$config_object = $_SESSION['config'];
$cfgMain = $_SESSION["cfgMain"];
logNewMessage(LOG_DEBUG, "Display login page");

View file

@ -409,7 +409,7 @@ class Ajax {
$dn = trim($_POST['dn']);
if (empty($dn) || !get_preg($dn, 'dn')) {
$dnList = $this->getDefaultDns();
$dn = null;
return '';
}
else {
$dnList = $this->getSubDns($dn);

View file

@ -74,6 +74,9 @@ if (isset($_POST['showldif'])) {
header('Content-Type: text/plain');
header('Content-disposition: attachment; filename=lam.ldif');
$accounts = unserialize(lamDecrypt($_SESSION['mass_accounts']));
if ($accounts === false) {
exit;
}
foreach ($accounts as $account) {
echo "DN: " . $account['dn'] . "\n";
unset($account['dn']);

View file

@ -1,5 +1,5 @@
parameters:
level: 8
level: 9
scanDirectories:
- lam/lib
- lam/templates
@ -38,3 +38,13 @@ parameters:
- '#Parameter \#1 \$ldap of function ldap_get_entries expects LDAP\\Connection, resource given.#'
- '#Parameter \#1 \$string of function htmlspecialchars expects string, array\|string given.#'
- '#Parameter \#1 \$name of function LAM\\ACCOUNTLIST\\search_username expects string, array\|string given.#'
- '#Cannot access offset int\|string on mixed.#'
- '#Parameter \#1 \$array of function array_keys expects array, mixed given.#'
- '#Cannot access offset .+ on mixed.#'
- '#Argument of an invalid type mixed supplied for foreach, only iterables are supported.#'
- '#Parameter \#1 \$string of function htmlspecialchars expects string, mixed given.#'
- '#Parameter \#2 \$args of function call_user_func_array expects array<int\|string, mixed>, mixed given.#'
- '#Parameter \#2 \$user of function LAM\\ACCOUNTLIST\\setSpecifiedPassword expects array, array\|null given.#'
- '#Parameter \#2 \$user of function LAM\\ACCOUNTLIST\\generatePassword expects array, array\|null given.#'
- '#Parameter \#2 \$attributes of function LAM\\ACCOUNTLIST\\unlock expects array, array\|null given.#'
- '#Parameter \#2 \$attributes of function LAM\\ACCOUNTLIST\\lock expects array, array\|null given.#'