refactoring

This commit is contained in:
Roland Gruber 2020-03-19 19:55:58 +01:00
parent bd7d32d2d0
commit a07c0013ae
8 changed files with 12 additions and 21 deletions

View File

@ -1543,7 +1543,7 @@ class accountContainer {
foreach ($attr_names as $i => $name) {
// find deleted attributes
if (isset($orig[$name]) && is_array($orig[$name])) {
foreach ($orig[$name] as $j => $value) {
foreach ($orig[$name] as $value) {
if (is_array($attributes[$name])) {
if (!in_array($value, $attributes[$name], true)
&& ($value !== null)
@ -1558,7 +1558,7 @@ class accountContainer {
}
// find new attributes
if (isset($attributes[$name]) && is_array($attributes[$name])) {
foreach ($attributes[$name] as $j => $value) {
foreach ($attributes[$name] as $value) {
if (isset($orig[$name]) && is_array($orig[$name])) {
if (!in_array($value, $orig[$name], true)
&& ($value !== null)
@ -1572,7 +1572,7 @@ class accountContainer {
}
// find unchanged attributes
if (isset($orig[$name]) && is_array($orig[$name]) && is_array($attributes[$name])) {
foreach ($attributes[$name] as $j => $value) {
foreach ($attributes[$name] as $value) {
if (($value !== null) && ($value !== '') && in_array($value, $orig[$name], true)) {
$notchanged[$name][] = $value;
}

View File

@ -432,17 +432,12 @@ By default, the nodes are configured as H-Nodes which fits for small networks. I
if (!empty($_POST['dns'])) {
$_POST['dns'] = trim($_POST['dns']);
$ex = explode(",", $_POST['dns']);
$dns = "";
$is_first=true;
$invalid = false;
foreach($ex AS $string) {
if ($is_first) {
$dns .= $string;
$is_first=false;
}
else {
$dns .= ",$string";
}
if (!check_ip($string)) {
$invalid = true;

View File

@ -1657,7 +1657,6 @@ class inetOrgPerson extends baseModule implements passwordService {
private function uploadPhoto() {
$messages = array();
if ($_FILES['photoFile'] && ($_FILES['photoFile']['size'] > 0)) {
$name = $_FILES['photoFile']['name'];
$handle = fopen($_FILES['photoFile']['tmp_name'], "r");
$data = fread($handle, 100000000);
if (!empty($this->moduleSettings['inetOrgPerson_jpegPhoto_maxSize'][0]) && (strlen($data) > (1024 * $this->moduleSettings['inetOrgPerson_jpegPhoto_maxSize'][0]))) {

View File

@ -5,7 +5,7 @@ use \LAM\PDF\PDFTableRow;
/*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2004 - 2018 Roland Gruber
Copyright (C) 2004 - 2020 Roland Gruber
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
@ -668,7 +668,6 @@ class kolabUser extends baseModule {
}
uksort($delegates, 'compareDN');
$_SESSION['kolabUser_kolabDelegate'] = $kolabDelegate;
$delegateFields = array();
$delegateContainer = new htmlTable();
for ($i = 0; $i < sizeof($kolabDelegate); $i++) {
$delegateContainer->addElement(new htmlOutputText($kolabDelegate[$i]));

View File

@ -2,7 +2,7 @@
/*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2013 - 2019 Roland Gruber
Copyright (C) 2013 - 2020 Roland Gruber
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
@ -273,7 +273,7 @@ class pykotaBillingCode extends baseModule {
if ($this->codeCache == null) {
$this->loadCodeCache();
}
foreach ($this->codeCache as $dn => $bCode) {
foreach ($this->codeCache as $bCode) {
if (!empty($bCode) && ($bCode == $code)) {
return true;
}

View File

@ -2,7 +2,7 @@
/*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2013 - 2019 Roland Gruber
Copyright (C) 2013 - 2020 Roland Gruber
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
@ -620,7 +620,7 @@ class pykotaPrinter extends baseModule {
if ($this->printerCache == null) {
$this->loadPrinterNameCache();
}
foreach ($this->printerCache as $dn => $attrs) {
foreach ($this->printerCache as $attrs) {
if (!empty($attrs['cn']) && ($attrs['cn'] == $cn)) {
return true;
}

View File

@ -3,7 +3,7 @@
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2008 Thomas Manninger
2009 - 2018 Roland Gruber
2009 - 2020 Roland Gruber
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
@ -189,7 +189,7 @@ class lamDHCPList extends lamList {
$entries = searchLDAP($data['dn'], 'objectClass=dhcpHost', array('dhcpstatements', 'dhcphwaddress', 'cn'));
if (sizeof($entries) > 0) {
foreach ($entries as $entry) {
foreach ($entry as $attrName => $attrValues) {
foreach ($entry as $attrValues) {
if (!is_array($attrValues)) {
continue;
}
@ -294,7 +294,7 @@ class lamDHCPList extends lamList {
$table = new htmlTable();
$table->setCSSClasses(array('nowrap'));
$ranges = array();
foreach($entry['dhcprange'] AS $id => $value) {
foreach($entry['dhcprange'] AS $value) {
if (!empty($value) && !is_numeric($value)) {
$ex = explode(" ", $value);
$row = new htmlTableRow(
@ -327,7 +327,7 @@ class lamDHCPList extends lamList {
}
}
uksort($ranges, 'strnatcasecmp');
foreach ($ranges as $text => $row) {
foreach ($ranges as $row) {
$table->addElement($row);
}
return $table;

View File

@ -3,7 +3,6 @@ namespace LAM\UPLOAD;
use ZipArchive;
use accountContainer;
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2016 - 2020 Roland Gruber
@ -309,7 +308,6 @@ class Uploader {
}
}
// load account
$typeManager = new \LAM\TYPES\TypeManager();
$_SESSION['mass_pdfAccount'] = new accountContainer($this->type, 'mass_pdfAccount');
$pdfErrors = $_SESSION['mass_pdfAccount']->load_account($dn, $infoAttributes);
if (sizeof($pdfErrors) > 0) {