reduced upload code
This commit is contained in:
parent
4c38fa8564
commit
fee3862dd2
|
@ -3,7 +3,7 @@
|
|||
$Id$
|
||||
|
||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||
Copyright (C) 2009 - 2013 Roland Gruber
|
||||
Copyright (C) 2009 - 2014 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
|
||||
|
@ -533,27 +533,11 @@ class eduPerson extends baseModule {
|
|||
$partialAccounts[$i]['eduPersonEntitlement'] = $parts;
|
||||
}
|
||||
// organisation
|
||||
if ($rawAccounts[$i][$ids['eduPerson_orgDN']] != "") {
|
||||
if (!get_preg($rawAccounts[$i][$ids['eduPerson_orgDN']], 'dn')) {
|
||||
$error = $this->messages['eduPersonOrgDN'][1];
|
||||
array_push($error, $i);
|
||||
$messages[] = $error;
|
||||
}
|
||||
else {
|
||||
$partialAccounts[$i]['eduPersonOrgDN'] = $rawAccounts[$i][$ids['eduPerson_orgDN']];
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'eduPerson_orgDN', 'eduPersonOrgDN',
|
||||
'dn', $this->messages['eduPersonOrgDN'][1], $messages);
|
||||
// primary OU
|
||||
if ($rawAccounts[$i][$ids['eduPerson_primaryOrgUnitDN']] != "") {
|
||||
if (!get_preg($rawAccounts[$i][$ids['eduPerson_primaryOrgUnitDN']], 'dn')) {
|
||||
$error = $this->messages['eduPersonPrimaryOrgUnitDN'][1];
|
||||
array_push($error, $i);
|
||||
$messages[] = $error;
|
||||
}
|
||||
else {
|
||||
$partialAccounts[$i]['eduPersonPrimaryOrgUnitDN'] = $rawAccounts[$i][$ids['eduPerson_primaryOrgUnitDN']];
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'eduPerson_primaryOrgUnitDN', 'eduPersonPrimaryOrgUnitDN',
|
||||
'dn', $this->messages['eduPersonPrimaryOrgUnitDN'][1], $messages);
|
||||
// OUs
|
||||
if ($rawAccounts[$i][$ids['eduPerson_orgUnitDN']] != "") {
|
||||
$parts = explode(', ', $rawAccounts[$i][$ids['eduPerson_orgUnitDN']]);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
$Id$
|
||||
|
||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||
Copyright (C) 2011 - 2013 Roland Gruber
|
||||
Copyright (C) 2011 - 2014 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
|
||||
|
@ -476,38 +476,14 @@ class freeRadius extends baseModule {
|
|||
// add object class
|
||||
if (!in_array("radiusprofile", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "radiusprofile";
|
||||
// IP address
|
||||
if ($rawAccounts[$i][$ids['freeRadius_radiusFramedIPAddress']] != "") {
|
||||
if (get_preg($rawAccounts[$i][$ids['freeRadius_radiusFramedIPAddress']], 'ip')) {
|
||||
$partialAccounts[$i]['radiusFramedIPAddress'] = $rawAccounts[$i][$ids['freeRadius_radiusFramedIPAddress']];
|
||||
}
|
||||
else {
|
||||
$errMsg = $this->messages['radiusFramedIPAddress'][1];
|
||||
array_push($errMsg, array($i));
|
||||
$errors[] = $errMsg;
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'freeRadius_radiusFramedIPAddress', 'radiusFramedIPAddress',
|
||||
'ip', $this->messages['radiusFramedIPAddress'][1], $errors);
|
||||
// net mask
|
||||
if ($rawAccounts[$i][$ids['freeRadius_radiusFramedIPNetmask']] != "") {
|
||||
if (get_preg($rawAccounts[$i][$ids['freeRadius_radiusFramedIPNetmask']], 'ip')) {
|
||||
$partialAccounts[$i]['radiusFramedIPNetmask'] = $rawAccounts[$i][$ids['freeRadius_radiusFramedIPNetmask']];
|
||||
}
|
||||
else {
|
||||
$errMsg = $this->messages['radiusFramedIPNetmask'][1];
|
||||
array_push($errMsg, array($i));
|
||||
$errors[] = $errMsg;
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'freeRadius_radiusFramedIPNetmask', 'radiusFramedIPNetmask',
|
||||
'ip', $this->messages['radiusFramedIPNetmask'][1], $errors);
|
||||
// realm
|
||||
if ($rawAccounts[$i][$ids['freeRadius_radiusRealm']] != "") {
|
||||
if (get_preg($rawAccounts[$i][$ids['freeRadius_radiusRealm']], 'DNSname')) {
|
||||
$partialAccounts[$i]['radiusRealm'] = $rawAccounts[$i][$ids['freeRadius_radiusRealm']];
|
||||
}
|
||||
else {
|
||||
$errMsg = $this->messages['radiusRealm'][1];
|
||||
array_push($errMsg, array($i));
|
||||
$errors[] = $errMsg;
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'freeRadius_radiusRealm', 'radiusRealm',
|
||||
'DNSname', $this->messages['radiusRealm'][1], $errors);
|
||||
// group names
|
||||
if ($rawAccounts[$i][$ids['freeRadius_radiusGroupName']] != "") {
|
||||
$groupList = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['freeRadius_radiusGroupName']]);
|
||||
|
@ -538,16 +514,8 @@ class freeRadius extends baseModule {
|
|||
}
|
||||
}
|
||||
// idle timeout
|
||||
if ($rawAccounts[$i][$ids['freeRadius_radiusIdleTimeout']] != "") {
|
||||
if (get_preg($rawAccounts[$i][$ids['freeRadius_radiusIdleTimeout']], 'digit')) {
|
||||
$partialAccounts[$i]['radiusIdleTimeout'] = $rawAccounts[$i][$ids['freeRadius_radiusIdleTimeout']];
|
||||
}
|
||||
else {
|
||||
$errMsg = $this->messages['radiusIdleTimeout'][1];
|
||||
array_push($errMsg, array($i));
|
||||
$errors[] = $errMsg;
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'freeRadius_radiusIdleTimeout', 'radiusIdleTimeout',
|
||||
'digit', $this->messages['radiusIdleTimeout'][1], $errors);
|
||||
}
|
||||
return $errors;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
$Id$
|
||||
|
||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||
Copyright (C) 2004 - 2013 Roland Gruber
|
||||
Copyright (C) 2004 - 2014 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
|
||||
|
@ -266,29 +266,11 @@ class inetLocalMailRecipient extends baseModule {
|
|||
}
|
||||
}
|
||||
// add routing address
|
||||
if ($rawAccounts[$i][$ids['inetLocalMailRecipient_routingAdr']] != "") {
|
||||
// check format
|
||||
if (get_preg($rawAccounts[$i][$ids['inetLocalMailRecipient_routingAdr']], 'email')) {
|
||||
$partialAccounts[$i]['mailRoutingAddress'][] = $rawAccounts[$i][$ids['inetLocalMailRecipient_routingAdr']];
|
||||
}
|
||||
else {
|
||||
$errMsg = $this->messages['mailRoutingAddress'][1];
|
||||
array_push($errMsg, array($i));
|
||||
$messages[] = $errMsg;
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetLocalMailRecipient_routingAdr', 'mailRoutingAddress',
|
||||
'email', $this->messages['mailRoutingAddress'][1], $messages);
|
||||
// add mail server
|
||||
if ($rawAccounts[$i][$ids['inetLocalMailRecipient_server']] != "") {
|
||||
// check format
|
||||
if (get_preg($rawAccounts[$i][$ids['inetLocalMailRecipient_server']], 'DNSname')) {
|
||||
$partialAccounts[$i]['mailHost'][] = $rawAccounts[$i][$ids['inetLocalMailRecipient_server']];
|
||||
}
|
||||
else {
|
||||
$errMsg = $this->messages['mailHost'][1];
|
||||
array_push($errMsg, array($i));
|
||||
$messages[] = $errMsg;
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetLocalMailRecipient_server', 'mailHost',
|
||||
'DNSname', $this->messages['mailHost'][1], $messages);
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
|
|
|
@ -2118,9 +2118,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
|||
$partialAccounts[$i]['initials'] = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['inetOrgPerson_initials']]);
|
||||
}
|
||||
// description
|
||||
if (isset($ids['inetOrgPerson_description']) && ($rawAccounts[$i][$ids['inetOrgPerson_description']] != "")) {
|
||||
$partialAccounts[$i]['description'] = $rawAccounts[$i][$ids['inetOrgPerson_description']];
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_description', 'description');
|
||||
// title
|
||||
if (isset($ids['inetOrgPerson_title']) && ($rawAccounts[$i][$ids['inetOrgPerson_title']] != "")) {
|
||||
$titleList = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['inetOrgPerson_title']]);
|
||||
|
@ -2135,20 +2133,10 @@ class inetOrgPerson extends baseModule implements passwordService {
|
|||
}
|
||||
}
|
||||
// employee number
|
||||
if (isset($ids['inetOrgPerson_employeeNumber']) && ($rawAccounts[$i][$ids['inetOrgPerson_employeeNumber']] != "")) {
|
||||
$partialAccounts[$i]['employeeNumber'] = $rawAccounts[$i][$ids['inetOrgPerson_employeeNumber']];
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_employeeNumber', 'employeeNumber');
|
||||
// employee type
|
||||
if (isset($ids['inetOrgPerson_type']) && ($rawAccounts[$i][$ids['inetOrgPerson_type']] != "")) {
|
||||
if (get_preg($rawAccounts[$i][$ids['inetOrgPerson_type']], 'employeeType')) {
|
||||
$partialAccounts[$i]['employeeType'] = $rawAccounts[$i][$ids['inetOrgPerson_type']];
|
||||
}
|
||||
else {
|
||||
$errMsg = $this->messages['employeeType'][1];
|
||||
array_push($errMsg, array($i));
|
||||
$errors[] = $errMsg;
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_type', 'employeeType',
|
||||
'employeeType', $this->messages['employeeType'][1], $errors);
|
||||
// business category
|
||||
if (isset($ids['inetOrgPerson_businessCategory']) && ($rawAccounts[$i][$ids['inetOrgPerson_businessCategory']] != "")) {
|
||||
$businessCategoryList = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['inetOrgPerson_businessCategory']]);
|
||||
|
@ -2193,9 +2181,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
|||
$partialAccounts[$i]['postOfficeBox'] = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['inetOrgPerson_postOfficeBox']]);
|
||||
}
|
||||
// room number
|
||||
if (isset($ids['inetOrgPerson_roomNumber']) && ($rawAccounts[$i][$ids['inetOrgPerson_roomNumber']] != "")) {
|
||||
$partialAccounts[$i]['roomNumber'] = $rawAccounts[$i][$ids['inetOrgPerson_roomNumber']];
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_roomNumber', 'roomNumber');
|
||||
// departments
|
||||
if (isset($ids['inetOrgPerson_departmentNumber']) && ($rawAccounts[$i][$ids['inetOrgPerson_departmentNumber']] != "")) {
|
||||
$partialAccounts[$i]['departmentNumber'] = explode(';', $rawAccounts[$i][$ids['inetOrgPerson_departmentNumber']]);
|
||||
|
@ -2223,9 +2209,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
|||
$partialAccounts[$i]['physicalDeliveryOfficeName'] = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['inetOrgPerson_physicalDeliveryOfficeName']]);
|
||||
}
|
||||
// carLicense
|
||||
if (isset($ids['inetOrgPerson_carLicense']) && ($rawAccounts[$i][$ids['inetOrgPerson_carLicense']] != "")) {
|
||||
$partialAccounts[$i]['carLicense'] = $rawAccounts[$i][$ids['inetOrgPerson_carLicense']];
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_carLicense', 'carLicense');
|
||||
// postal code
|
||||
if (isset($ids['inetOrgPerson_postalCode']) && ($rawAccounts[$i][$ids['inetOrgPerson_postalCode']] != "")) {
|
||||
$postalCodeList = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['inetOrgPerson_postalCode']]);
|
||||
|
@ -2240,27 +2224,11 @@ class inetOrgPerson extends baseModule implements passwordService {
|
|||
}
|
||||
}
|
||||
// postal address
|
||||
if (isset($ids['inetOrgPerson_address']) && ($rawAccounts[$i][$ids['inetOrgPerson_address']] != "")) {
|
||||
if (get_preg($rawAccounts[$i][$ids['inetOrgPerson_address']], 'postalAddress')) {
|
||||
$partialAccounts[$i]['postalAddress'] = $rawAccounts[$i][$ids['inetOrgPerson_address']];
|
||||
}
|
||||
else {
|
||||
$errMsg = $this->messages['postalAddress'][1];
|
||||
array_push($errMsg, array($i));
|
||||
$errors[] = $errMsg;
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_address', 'postalAddress',
|
||||
'postalAddress',$this->messages['postalAddress'][1] , $errors);
|
||||
// registered address
|
||||
if (isset($ids['inetOrgPerson_registeredAddress']) && ($rawAccounts[$i][$ids['inetOrgPerson_registeredAddress']] != "")) {
|
||||
if (get_preg($rawAccounts[$i][$ids['inetOrgPerson_registeredAddress']], 'postalAddress')) {
|
||||
$partialAccounts[$i]['registeredAddress'] = $rawAccounts[$i][$ids['inetOrgPerson_registeredAddress']];
|
||||
}
|
||||
else {
|
||||
$errMsg = $this->messages['registeredAddress'][1];
|
||||
array_push($errMsg, array($i));
|
||||
$errors[] = $errMsg;
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetOrgPerson_registeredAddress', 'registeredAddress',
|
||||
'postalAddress',$this->messages['registeredAddress'][1] , $errors);
|
||||
// telephone
|
||||
if (isset($ids['inetOrgPerson_telephone']) && ($rawAccounts[$i][$ids['inetOrgPerson_telephone']] != "")) {
|
||||
$telephoneList = preg_split('/;[ ]*/', trim($rawAccounts[$i][$ids['inetOrgPerson_telephone']]));
|
||||
|
|
Loading…
Reference in New Issue