reduced upload code

This commit is contained in:
Roland Gruber 2014-04-18 18:29:51 +00:00
parent 1372c4645a
commit 9b0e712317
6 changed files with 66 additions and 262 deletions

View File

@ -3,7 +3,7 @@
$Id$ $Id$
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) 2005 - 2013 Roland Gruber Copyright (C) 2005 - 2014 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
@ -560,70 +560,24 @@ class sambaDomain extends baseModule {
// add object class // add object class
if (!in_array("sambaDomain", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "sambaDomain"; if (!in_array("sambaDomain", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "sambaDomain";
// domain name // domain name
if (get_preg($rawAccounts[$i][$ids['sambaDomain_domainName']], 'domainname')) { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'sambaDomain_domainName', 'sambaDomainName',
$partialAccounts[$i]['sambaDomainName'] = $rawAccounts[$i][$ids['sambaDomain_domainName']]; 'domainname', $this->messages['domainName'][1], $messages);
}
else {
$errMsg = $this->messages['domainName'][1];
array_push($errMsg, array($i));
$messages[] = $errMsg;
}
// domain SID // domain SID
if (get_preg($rawAccounts[$i][$ids['sambaDomain_domainSID']], 'domainSID')) { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'sambaDomain_domainSID', 'sambaSID',
$partialAccounts[$i]['sambaSID'] = $rawAccounts[$i][$ids['sambaDomain_domainSID']]; 'domainSID', $this->messages['domainSID'][1], $messages);
}
else {
$errMsg = $this->messages['domainSID'][1];
array_push($errMsg, array($i));
$messages[] = $errMsg;
}
// RID base // RID base
if ($rawAccounts[$i][$ids['sambaDomain_RIDbase']]) {
if (get_preg($rawAccounts[$i][$ids['sambaDomain_RIDbase']], 'digit')) {
$partialAccounts[$i]['sambaAlgorithmicRidBase'] = $rawAccounts[$i][$ids['sambaDomain_RIDbase']];
}
else {
$errMsg = $this->messages['RIDbase'][1];
array_push($errMsg, array($i));
$messages[] = $errMsg;
}
}
else {
$partialAccounts[$i]['sambaAlgorithmicRidBase'] = '1000'; $partialAccounts[$i]['sambaAlgorithmicRidBase'] = '1000';
} $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'sambaDomain_RIDbase', 'sambaAlgorithmicRidBase',
'digit', $this->messages['RIDbase'][1], $messages);
// next RID // next RID
if ($rawAccounts[$i][$ids['sambaDomain_nextRID']]) { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'sambaDomain_nextRID', 'sambaNextRid',
if (get_preg($rawAccounts[$i][$ids['sambaDomain_nextRID']], 'digit')) { 'digit', $this->messages['nextRID'][1], $messages);
$partialAccounts[$i]['sambaNextRid'] = $rawAccounts[$i][$ids['sambaDomain_nextRID']];
}
else {
$errMsg = $this->messages['nextRID'][1];
array_push($errMsg, array($i));
$messages[] = $errMsg;
}
}
// next user RID // next user RID
if ($rawAccounts[$i][$ids['sambaDomain_nextUserRID']]) { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'sambaDomain_nextUserRID', 'sambaNextUserRid',
if (get_preg($rawAccounts[$i][$ids['sambaDomain_nextUserRID']], 'digit')) { 'digit', $this->messages['nextUserRID'][1], $messages);
$partialAccounts[$i]['sambaNextUserRid'] = $rawAccounts[$i][$ids['sambaDomain_nextUserRID']];
}
else {
$errMsg = $this->messages['nextUserRID'][1];
array_push($errMsg, array($i));
$messages[] = $errMsg;
}
}
// next group RID // next group RID
if ($rawAccounts[$i][$ids['sambaDomain_nextGroupRID']]) { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'sambaDomain_nextGroupRID', 'sambaNextGroupRid',
if (get_preg($rawAccounts[$i][$ids['sambaDomain_nextGroupRID']], 'digit')) { 'digit', $this->messages['nextGroupRID'][1], $messages);
$partialAccounts[$i]['sambaNextGroupRid'] = $rawAccounts[$i][$ids['sambaDomain_nextGroupRID']];
}
else {
$errMsg = $this->messages['nextGroupRID'][1];
array_push($errMsg, array($i));
$messages[] = $errMsg;
}
}
} }
return $messages; return $messages;
} }

View File

@ -4,7 +4,7 @@ $Id$
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
2005 - 2013 Roland Gruber 2005 - 2014 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
@ -1993,16 +1993,8 @@ class sambaSamAccount extends baseModule implements passwordService {
for ($i = 0; $i < sizeof($rawAccounts); $i++) { for ($i = 0; $i < sizeof($rawAccounts); $i++) {
if (!in_array("sambaSamAccount", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "sambaSamAccount"; if (!in_array("sambaSamAccount", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "sambaSamAccount";
// displayName // displayName
if ($rawAccounts[$i][$ids['sambaSamAccount_displayName']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'sambaSamAccount_displayName', 'displayName',
if (get_preg($rawAccounts[$i][$ids['sambaSamAccount_displayName']], 'realname')) { 'realname', $this->messages['displayName'][0], $errors);
$partialAccounts[$i]['displayName'] = $rawAccounts[$i][$ids['sambaSamAccount_displayName']];
}
else {
$errMsg = $this->messages['displayName'][0];
array_push($errMsg, array($i));
$errors[] = $errMsg;
}
}
// password // password
$partialAccounts[$i]['sambaPwdLastSet'] = time(); $partialAccounts[$i]['sambaPwdLastSet'] = time();
if (!get_preg($rawAccounts[$i][$ids['sambaSamAccount_password']], 'password')) { if (!get_preg($rawAccounts[$i][$ids['sambaSamAccount_password']], 'password')) {
@ -2114,49 +2106,17 @@ class sambaSamAccount extends baseModule implements passwordService {
} }
} }
// home path // home path
if ($rawAccounts[$i][$ids['sambaSamAccount_homePath']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'sambaSamAccount_homePath', 'sambaHomePath',
if (get_preg($rawAccounts[$i][$ids['sambaSamAccount_homePath']], 'UNC')) { 'UNC', $this->messages['homePath'][2], $errors);
$partialAccounts[$i]['sambaHomePath'] = $rawAccounts[$i][$ids['sambaSamAccount_homePath']];
}
else {
$errMsg = $this->messages['homePath'][2];
array_push($errMsg, array($i));
$errors[] = $errMsg;
}
}
// profile path // profile path
if ($rawAccounts[$i][$ids['sambaSamAccount_profilePath']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'sambaSamAccount_profilePath', 'sambaProfilePath',
if (get_preg($rawAccounts[$i][$ids['sambaSamAccount_profilePath']], 'UNC')) { 'UNC', $this->messages['profilePath'][2], $errors);
$partialAccounts[$i]['sambaProfilePath'] = $rawAccounts[$i][$ids['sambaSamAccount_profilePath']];
}
else {
$errMsg = $this->messages['profilePath'][2];
array_push($errMsg, array($i));
$errors[] = $errMsg;
}
}
// logon script // logon script
if ($rawAccounts[$i][$ids['sambaSamAccount_logonScript']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'sambaSamAccount_logonScript', 'sambaLogonScript',
if (get_preg($rawAccounts[$i][$ids['sambaSamAccount_logonScript']], 'logonscript')) { 'logonscript', $this->messages['logonScript'][2], $errors);
$partialAccounts[$i]['sambaLogonScript'] = $rawAccounts[$i][$ids['sambaSamAccount_logonScript']];
}
else {
$errMsg = $this->messages['logonScript'][2];
array_push($errMsg, array($i));
$errors[] = $errMsg;
}
}
// workstations // workstations
if ($rawAccounts[$i][$ids['sambaSamAccount_workstations']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'sambaSamAccount_workstations', 'sambaUserWorkstations',
if (get_preg($rawAccounts[$i][$ids['sambaSamAccount_workstations']], 'workstations')) { 'workstations', $this->messages['workstations'][1], $errors);
$partialAccounts[$i]['sambaUserWorkstations'] = $rawAccounts[$i][$ids['sambaSamAccount_workstations']];
}
else {
$errMsg = $this->messages['workstations'][1];
array_push($errMsg, array($i));
$errors[] = $errMsg;
}
}
// domain // domain
$domIndex = -1; $domIndex = -1;
for ($d = 0; $d < sizeof($domains); $d++) { for ($d = 0; $d < sizeof($domains); $d++) {
@ -2219,19 +2179,9 @@ class sambaSamAccount extends baseModule implements passwordService {
$partialAccounts[$i]['sambaSID'] .= '-' . ($partialAccounts[$i]['uidNumber']*2 + $domains[$domIndex]->RIDbase); $partialAccounts[$i]['sambaSID'] .= '-' . ($partialAccounts[$i]['uidNumber']*2 + $domains[$domIndex]->RIDbase);
} }
// logon hours // logon hours
if ($rawAccounts[$i][$ids['sambaSamAccount_logonHours']] != "") {
if (get_preg($rawAccounts[$i][$ids['sambaSamAccount_logonHours']], 'sambaLogonHours')) {
$partialAccounts[$i]['sambaLogonHours'] = $rawAccounts[$i][$ids['sambaSamAccount_logonHours']];
}
else {
$errMsg = $this->messages['logonHours'][1];
array_push($errMsg, array($i));
$errors[] = $errMsg;
}
}
else {
$partialAccounts[$i]['sambaLogonHours'] = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"; $partialAccounts[$i]['sambaLogonHours'] = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF";
} $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'sambaSamAccount_logonHours', 'sambaLogonHours',
'sambaLogonHours', $this->messages['logonHours'][1], $errors);
} }
} }
else { // hosts else { // hosts

View File

@ -4,7 +4,7 @@ $Id$
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 - 2013 Roland Gruber Copyright (C) 2007 - 2014 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
@ -515,49 +515,17 @@ class shadowAccount extends baseModule implements passwordService {
// shadow last change // shadow last change
$partialAccounts[$i]['shadowLastChange'] = array(intval(time()/3600/24)); $partialAccounts[$i]['shadowLastChange'] = array(intval(time()/3600/24));
// password warning // password warning
if ($rawAccounts[$i][$ids['shadowAccount_warning']] != '') { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'shadowAccount_warning', 'shadowWarning',
if (get_preg($rawAccounts[$i][$ids['shadowAccount_warning']], 'digit')) { 'digit', $this->messages['shadowWarning'][1], $messages);
$partialAccounts[$i]['shadowWarning'][] = $rawAccounts[$i][$ids['shadowAccount_warning']];
}
else {
$errMsg = $this->messages['shadowWarning'][1];
array_push($errMsg, array($i));
$messages[] = $errMsg;
}
}
// password expire ignoration // password expire ignoration
if ($rawAccounts[$i][$ids['shadowAccount_ignoreExpire']] != '') { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'shadowAccount_ignoreExpire', 'shadowInactive',
if (get_preg($rawAccounts[$i][$ids['shadowAccount_ignoreExpire']], 'digit2')) { 'digit2', $this->messages['inactive'][1], $messages);
$partialAccounts[$i]['shadowInactive'][] = $rawAccounts[$i][$ids['shadowAccount_ignoreExpire']];
}
else {
$errMsg = $this->messages['inactive'][1];
array_push($errMsg, array($i));
$messages[] = $errMsg;
}
}
// password minAge // password minAge
if ($rawAccounts[$i][$ids['shadowAccount_minAge']] != '') { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'shadowAccount_minAge', 'shadowMin',
if (get_preg($rawAccounts[$i][$ids['shadowAccount_minAge']], 'digit')) { 'digit', $this->messages['shadowMin'][1], $messages);
$partialAccounts[$i]['shadowMin'][] = $rawAccounts[$i][$ids['shadowAccount_minAge']];
}
else {
$errMsg = $this->messages['shadowMin'][1];
array_push($errMsg, array($i));
$messages[] = $errMsg;
}
}
// password maxAge // password maxAge
if ($rawAccounts[$i][$ids['shadowAccount_maxAge']] != '') { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'shadowAccount_maxAge', 'shadowMax',
if (get_preg($rawAccounts[$i][$ids['shadowAccount_maxAge']], 'digit')) { 'digit', $this->messages['shadowMax'][1], $messages);
$partialAccounts[$i]['shadowMax'][] = $rawAccounts[$i][$ids['shadowAccount_maxAge']];
}
else {
$errMsg = $this->messages['shadowMax'][1];
array_push($errMsg, array($i));
$messages[] = $errMsg;
}
}
// minAge <= maxAge // minAge <= maxAge
if ((($rawAccounts[$i][$ids['shadowAccount_minAge']] != '') || ($rawAccounts[$i][$ids['shadowAccount_maxAge']] != '')) && // if at least one is set if ((($rawAccounts[$i][$ids['shadowAccount_minAge']] != '') || ($rawAccounts[$i][$ids['shadowAccount_maxAge']] != '')) && // if at least one is set
(($rawAccounts[$i][$ids['shadowAccount_minAge']] == '') || ($rawAccounts[$i][$ids['shadowAccount_maxAge']] == '') || ( // and one is not set (($rawAccounts[$i][$ids['shadowAccount_minAge']] == '') || ($rawAccounts[$i][$ids['shadowAccount_maxAge']] == '') || ( // and one is not set

View File

@ -661,27 +661,17 @@ class windowsGroup extends baseModule {
} }
} }
// description // description
if ($rawAccounts[$i][$ids['windowsGroup_description']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'windowsGroup_description', 'description');
$partialAccounts[$i]['description'] = $rawAccounts[$i][$ids['windowsGroup_description']];
}
// notes // notes
if ($rawAccounts[$i][$ids['windowsGroup_notes']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'windowsGroup_notes', 'info');
$partialAccounts[$i]['info'] = $rawAccounts[$i][$ids['windowsGroup_notes']];
}
// email // email
if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemail') && ($rawAccounts[$i][$ids['windowsGroup_mail']] != "")) { if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemail')) {
if (get_preg($rawAccounts[$i][$ids['windowsGroup_mail']], 'email')) { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'windowsGroup_mail', 'mail',
$partialAccounts[$i]['mail'] = $rawAccounts[$i][$ids['windowsGroup_mail']]; 'email', $this->messages['mail'][1], $errors);
}
else {
$errMsg = $this->messages['mail'][1];
array_push($errMsg, array($i));
$errors[] = $errMsg;
}
} }
// managed by // managed by
if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemanagedBy') && $rawAccounts[$i][$ids['windowsGroup_managedBy']] != "") { if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemanagedBy')) {
$partialAccounts[$i]['managedBy'] = $rawAccounts[$i][$ids['windowsGroup_managedBy']]; $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'windowsGroup_managedBy', 'managedBy');
} }
// add members // add members
if ($rawAccounts[$i][$ids['windowsGroup_members']] != "") { if ($rawAccounts[$i][$ids['windowsGroup_members']] != "") {
@ -729,22 +719,12 @@ class windowsGroup extends baseModule {
} }
// NIS name // NIS name
if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemsSFU30Name', true)) { if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemsSFU30Name', true)) {
if (!empty($rawAccounts[$i][$ids['windowsGroup_msSFU30Name']])) { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'windowsGroup_msSFU30Name', 'msSFU30Name',
if (get_preg($rawAccounts[$i][$ids['windowsGroup_msSFU30Name']], 'groupname')) { 'groupname', $this->messages['msSFU30Name'][1], $errors);
$partialAccounts[$i]['msSFU30Name'] = $rawAccounts[$i][$ids['windowsGroup_msSFU30Name']];
}
else {
$errMsg = $this->messages['msSFU30Name'][1];
array_push($errMsg, array($i));
$errors[] = $errMsg;
}
}
} }
// NIS domain // NIS domain
if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemsSFU30NisDomain', true)) { if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemsSFU30NisDomain', true)) {
if (!empty($rawAccounts[$i][$ids['windowsGroup_msSFU30NisDomain']])) { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'windowsGroup_msSFU30NisDomain', 'msSFU30NisDomain');
$partialAccounts[$i]['msSFU30NisDomain'] = $rawAccounts[$i][$ids['windowsGroup_msSFU30NisDomain']];
}
} }
} }
return $errors; return $errors;

View File

@ -3,7 +3,7 @@
$Id$ $Id$
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) 2013 Roland Gruber Copyright (C) 2013 - 2014 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
@ -262,17 +262,11 @@ class windowsHost extends baseModule {
} }
} }
// description // description
if ($rawAccounts[$i][$ids['windowsHost_description']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'windowsHost_description', 'description');
$partialAccounts[$i]['description'] = $rawAccounts[$i][$ids['windowsHost_description']];
}
// location // location
if ($rawAccounts[$i][$ids['windowsHost_location']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'windowsHost_location', 'location');
$partialAccounts[$i]['location'] = $rawAccounts[$i][$ids['windowsHost_location']];
}
// managed by // managed by
if ($rawAccounts[$i][$ids['windowsHost_managedBy']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'windowsHost_managedBy', 'managedBy');
$partialAccounts[$i]['managedBy'] = $rawAccounts[$i][$ids['windowsHost_managedBy']];
}
// machine trust account, no password required // machine trust account, no password required
$partialAccounts[$i]['userAccountControl'][0] = 4128; $partialAccounts[$i]['userAccountControl'][0] = 4128;
} }

View File

@ -1268,44 +1268,22 @@ class windowsUser extends baseModule implements passwordService {
$partialAccounts[$i]['displayName'] = $partialAccounts[$i]['cn']; $partialAccounts[$i]['displayName'] = $partialAccounts[$i]['cn'];
} }
// initials // initials
if ($rawAccounts[$i][$ids['windowsUser_initials']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'windowsUser_initials', 'initials');
$partialAccounts[$i]['initials'] = $rawAccounts[$i][$ids['windowsUser_initials']];
}
// description // description
if ($rawAccounts[$i][$ids['windowsUser_description']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'windowsUser_description', 'description');
$partialAccounts[$i]['description'] = $rawAccounts[$i][$ids['windowsUser_description']];
}
// street // street
if ($rawAccounts[$i][$ids['windowsUser_streetAddress']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'windowsUser_streetAddress', 'streetAddress');
$partialAccounts[$i]['streetAddress'] = $rawAccounts[$i][$ids['windowsUser_streetAddress']];
}
// post office box // post office box
if ($rawAccounts[$i][$ids['windowsUser_postOfficeBox']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'windowsUser_postOfficeBox', 'postOfficeBox');
$partialAccounts[$i]['postOfficeBox'] = $rawAccounts[$i][$ids['windowsUser_postOfficeBox']];
}
// postal code // postal code
if ($rawAccounts[$i][$ids['windowsUser_postalCode']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'windowsUser_postalCode', 'postalCode',
if (get_preg($rawAccounts[$i][$ids['windowsUser_postalCode']], 'postalCode')) { 'postalCode', $this->messages['postalCode'][1], $errors);
$partialAccounts[$i]['postalCode'] = $rawAccounts[$i][$ids['windowsUser_postalCode']];
}
else {
$errMsg = $this->messages['postalCode'][1];
array_push($errMsg, array($i));
$errors[] = $errMsg;
}
}
// location // location
if ($rawAccounts[$i][$ids['windowsUser_l']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'windowsUser_l', 'l');
$partialAccounts[$i]['l'] = $rawAccounts[$i][$ids['windowsUser_l']];
}
// state // state
if ($rawAccounts[$i][$ids['windowsUser_state']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'windowsUser_state', 'st');
$partialAccounts[$i]['st'] = $rawAccounts[$i][$ids['windowsUser_state']];
}
// office name // office name
if ($rawAccounts[$i][$ids['windowsUser_officeName']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'windowsUser_officeName', 'physicalDeliveryOfficeName');
$partialAccounts[$i]['physicalDeliveryOfficeName'] = $rawAccounts[$i][$ids['windowsUser_officeName']];
}
// mail // mail
if ($rawAccounts[$i][$ids['windowsUser_mail']] != "") { if ($rawAccounts[$i][$ids['windowsUser_mail']] != "") {
foreach ($replacements as $wildcard => $value) { foreach ($replacements as $wildcard => $value) {
@ -1337,16 +1315,8 @@ class windowsUser extends baseModule implements passwordService {
} }
} }
// telephone // telephone
if ($rawAccounts[$i][$ids['windowsUser_telephoneNumber']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'windowsUser_telephoneNumber', 'telephoneNumber',
if (get_preg($rawAccounts[$i][$ids['windowsUser_telephoneNumber']], 'telephone')) { 'telephone', $this->messages['telephoneNumber'][1], $errors);
$partialAccounts[$i]['telephoneNumber'] = $rawAccounts[$i][$ids['windowsUser_telephoneNumber']];
}
else {
$errMsg = $this->messages['telephoneNumber'][1];
array_push($errMsg, array($i));
$errors[] = $errMsg;
}
}
// other telephone // other telephone
if (isset($ids['windowsUser_otherTelephone']) && ($rawAccounts[$i][$ids['windowsUser_otherTelephone']] != "")) { if (isset($ids['windowsUser_otherTelephone']) && ($rawAccounts[$i][$ids['windowsUser_otherTelephone']] != "")) {
$valueList = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['windowsUser_otherTelephone']]); $valueList = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['windowsUser_otherTelephone']]);
@ -1361,9 +1331,7 @@ class windowsUser extends baseModule implements passwordService {
} }
} }
// website // website
if ($rawAccounts[$i][$ids['windowsUser_webSite']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'windowsUser_webSite', 'wWWHomePage');
$partialAccounts[$i]['wWWHomePage'] = $rawAccounts[$i][$ids['windowsUser_webSite']];
}
// other websites // other websites
if (isset($ids['windowsUser_otherWebSites']) && ($rawAccounts[$i][$ids['windowsUser_otherWebSites']] != "")) { if (isset($ids['windowsUser_otherWebSites']) && ($rawAccounts[$i][$ids['windowsUser_otherWebSites']] != "")) {
$valueList = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['windowsUser_otherWebSites']]); $valueList = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['windowsUser_otherWebSites']]);
@ -1476,22 +1444,12 @@ class windowsUser extends baseModule implements passwordService {
} }
// NIS name // NIS name
if (!$this->isBooleanConfigOptionSet('windowsUser_hidemsSFU30Name', true)) { if (!$this->isBooleanConfigOptionSet('windowsUser_hidemsSFU30Name', true)) {
if (!empty($rawAccounts[$i][$ids['windowsUser_msSFU30Name']])) { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'windowsUser_msSFU30Name', 'msSFU30Name',
if (get_preg($rawAccounts[$i][$ids['windowsUser_msSFU30Name']], 'username')) { 'username', $this->messages['msSFU30Name'][1], $errors);
$partialAccounts[$i]['msSFU30Name'] = $rawAccounts[$i][$ids['windowsUser_msSFU30Name']];
}
else {
$errMsg = $this->messages['msSFU30Name'][1];
array_push($errMsg, array($i));
$errors[] = $errMsg;
}
}
} }
// NIS domain // NIS domain
if (!$this->isBooleanConfigOptionSet('windowsUser_hidemsSFU30NisDomain', true)) { if (!$this->isBooleanConfigOptionSet('windowsUser_hidemsSFU30NisDomain', true)) {
if (!empty($rawAccounts[$i][$ids['windowsUser_msSFU30NisDomain']])) { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'windowsUser_msSFU30NisDomain', 'msSFU30NisDomain');
$partialAccounts[$i]['msSFU30NisDomain'] = $rawAccounts[$i][$ids['windowsUser_msSFU30NisDomain']];
}
} }
} }
return $errors; return $errors;