From 3a6c38996a5737b1c97969794b8b5b74569c04b6 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Tue, 15 Apr 2014 19:49:47 +0000 Subject: [PATCH] reduced upload code --- lam/lib/modules/nisMailAlias.inc | 10 ++-------- lam/lib/modules/nisnetgroup.inc | 4 +--- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/lam/lib/modules/nisMailAlias.inc b/lam/lib/modules/nisMailAlias.inc index f2d0d82f..c565e037 100644 --- a/lam/lib/modules/nisMailAlias.inc +++ b/lam/lib/modules/nisMailAlias.inc @@ -437,14 +437,8 @@ class nisMailAlias extends baseModule { if (!in_array("nisMailAlias", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "nisMailAlias"; // add alias name // check format - if (get_preg($rawAccounts[$i][$ids['nisMailAlias_alias']], 'nis_alias')) { - $partialAccounts[$i]['cn'] = $rawAccounts[$i][$ids['nisMailAlias_alias']]; - } - else { - $errMsg = $this->messages['alias'][1]; - array_push($errMsg, array($i)); - $messages[] = $errMsg; - } + $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'nisMailAlias_alias', 'cn', + 'nis_alias', $this->messages['alias'][1], $messages); // add recipients if ($rawAccounts[$i][$ids['nisMailAlias_recipients']] != "") { $aliases = explode(',', $rawAccounts[$i][$ids['nisMailAlias_recipients']]); diff --git a/lam/lib/modules/nisnetgroup.inc b/lam/lib/modules/nisnetgroup.inc index 76198487..66933853 100644 --- a/lam/lib/modules/nisnetgroup.inc +++ b/lam/lib/modules/nisnetgroup.inc @@ -526,9 +526,7 @@ class nisnetgroup extends baseModule { // add cn $partialAccounts[$i]['cn'] = $rawAccounts[$i][$ids['nisnetgroup_cn']]; // description (UTF-8, no regex check needed) - if ($rawAccounts[$i][$ids['nisnetgroup_description']] != "") { - $partialAccounts[$i]['description'] = $rawAccounts[$i][$ids['nisnetgroup_description']]; - } + $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'nisnetgroup_description', 'description'); // additional groups if ($rawAccounts[$i][$ids['nisnetgroup_subgroups']] != "") { $groups = explode(",", $rawAccounts[$i][$ids['nisnetgroup_subgroups']]);