mirror of
https://github.com/LDAPAccountManager/lam.git
synced 2025-10-03 17:59:21 +02:00
refactoring
This commit is contained in:
parent
72b99d2f3f
commit
a567ab0e7e
5 changed files with 26 additions and 28 deletions
|
@ -11,7 +11,7 @@ use htmlStatusMessage;
|
||||||
/*
|
/*
|
||||||
|
|
||||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||||
Copyright (C) 2020 - 2021 Roland Gruber
|
Copyright (C) 2020 - 2022 Roland Gruber
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -11,7 +11,7 @@ use \htmlStatusMessage;
|
||||||
|
|
||||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||||
Copyright (C) 2003 - 2006 Tilo Lutz
|
Copyright (C) 2003 - 2006 Tilo Lutz
|
||||||
Copyright (C) 2007 - 2021 Roland Gruber
|
Copyright (C) 2007 - 2022 Roland Gruber
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -207,26 +207,24 @@ if (isset($_POST['delete'])) {
|
||||||
$attributes = array();
|
$attributes = array();
|
||||||
$errors = array();
|
$errors = array();
|
||||||
// predelete actions
|
// predelete actions
|
||||||
if (!$stopprocessing) {
|
foreach ($moduleNames as $singlemodule) {
|
||||||
foreach ($moduleNames as $singlemodule) {
|
$success = true;
|
||||||
$success = true;
|
$messages = $modules[$singlemodule]->preDeleteActions();
|
||||||
$messages = $modules[$singlemodule]->preDeleteActions();
|
foreach ($messages as $message) {
|
||||||
foreach ($messages as $message) {
|
$errors[] = $message;
|
||||||
$errors[] = $message;
|
if ($message[0] == 'ERROR') {
|
||||||
if ($message[0] == 'ERROR') {
|
$success = false;
|
||||||
$success = false;
|
$allOk = false;
|
||||||
$allOk = false;
|
}
|
||||||
}
|
elseif ($message[0] == 'WARN') {
|
||||||
elseif ($message[0] == 'WARN') {
|
$allOk = false;
|
||||||
$allOk = false;
|
}
|
||||||
}
|
}
|
||||||
}
|
if (!$success) {
|
||||||
if (!$success) {
|
$stopprocessing = true;
|
||||||
$stopprocessing = true;
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!$stopprocessing) {
|
if (!$stopprocessing) {
|
||||||
// load attributes
|
// load attributes
|
||||||
foreach ($moduleNames as $singlemodule) {
|
foreach ($moduleNames as $singlemodule) {
|
||||||
|
@ -260,7 +258,7 @@ if (isset($_POST['delete'])) {
|
||||||
}
|
}
|
||||||
if (!$stopprocessing) {
|
if (!$stopprocessing) {
|
||||||
// modify attributes
|
// modify attributes
|
||||||
if (isset($attributes[$dn]['modify']) && !$stopprocessing) {
|
if (isset($attributes[$dn]['modify'])) {
|
||||||
$success = ldap_mod_replace($_SESSION['ldap']->server(), $dn, $attributes[$dn]['modify']);
|
$success = ldap_mod_replace($_SESSION['ldap']->server(), $dn, $attributes[$dn]['modify']);
|
||||||
if (!$success) {
|
if (!$success) {
|
||||||
$errors[] = array ('ERROR', sprintf(_('Was unable to modify attributes from DN: %s.'), $dn), getDefaultLDAPErrorString($_SESSION['ldap']->server()));
|
$errors[] = array ('ERROR', sprintf(_('Was unable to modify attributes from DN: %s.'), $dn), getDefaultLDAPErrorString($_SESSION['ldap']->server()));
|
||||||
|
|
|
@ -294,7 +294,7 @@ function displayAttributeList(htmlResponsiveRow $row) {
|
||||||
if (isset($_GET['sel']) && (empty($_GET['sel']) || array_key_exists(strtolower($_GET['sel']), $attributes))) {
|
if (isset($_GET['sel']) && (empty($_GET['sel']) || array_key_exists(strtolower($_GET['sel']), $attributes))) {
|
||||||
$selectedAttribute[0] = $_GET['sel'];
|
$selectedAttribute[0] = $_GET['sel'];
|
||||||
}
|
}
|
||||||
if (empty($selectedAttribute) && (sizeof($availableAttributes) > 0)) {
|
if (empty($selectedAttribute) && (sizeof($availableAttributes) > 1)) {
|
||||||
// select first attribute by default
|
// select first attribute by default
|
||||||
$attributeNames = array_keys($availableAttributes);
|
$attributeNames = array_keys($availableAttributes);
|
||||||
$selectedAttribute[0] = $attributeNames[1];
|
$selectedAttribute[0] = $attributeNames[1];
|
||||||
|
|
|
@ -156,10 +156,10 @@ display_main($message, $error);
|
||||||
/**
|
/**
|
||||||
* Displays the main page of the OU editor
|
* Displays the main page of the OU editor
|
||||||
*
|
*
|
||||||
* @param String $message info message
|
* @param string|null $message info message
|
||||||
* @param String $error error message
|
* @param string|null $error error message
|
||||||
*/
|
*/
|
||||||
function display_main($message, $error) {
|
function display_main(?string $message, ?string $error): void {
|
||||||
// display main page
|
// display main page
|
||||||
include __DIR__ . '/../../lib/adminHeader.inc';
|
include __DIR__ . '/../../lib/adminHeader.inc';
|
||||||
echo '<div class="smallPaddingContent">';
|
echo '<div class="smallPaddingContent">';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
parameters:
|
parameters:
|
||||||
level: 3
|
level: 4
|
||||||
scanDirectories:
|
scanDirectories:
|
||||||
- lam/lib
|
- lam/lib
|
||||||
- lam/templates
|
- lam/templates
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue