use extended upload function

This commit is contained in:
Roland Gruber 2015-08-15 18:11:54 +00:00
parent 65f43d9fcd
commit b8f7d87864
4 changed files with 38 additions and 128 deletions

View File

@ -132,22 +132,11 @@ class ieee802device extends baseModule {
$messages = array(); $messages = array();
for ($i = 0; $i < sizeof($rawAccounts); $i++) { for ($i = 0; $i < sizeof($rawAccounts); $i++) {
// add object class // add object class
if (!in_array("ieee802Device", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "ieee802Device"; if (!in_array("ieee802Device", $partialAccounts[$i]['objectClass'])) {
$partialAccounts[$i]['objectClass'][] = "ieee802Device";
}
// add MACs // add MACs
if ($rawAccounts[$i][$ids['ieee802Device_mac']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'ieee802Device_mac', 'macAddress', 'macAddress', $this->messages['macAddress'][1], $messages, '/,[ ]*/');
$macs = explode(',', $rawAccounts[$i][$ids['ieee802Device_mac']]);
// check format
for ($m = 0; $m < sizeof($macs); $m++) {
if (get_preg($macs[$m], 'macAddress')) {
$partialAccounts[$i]['macAddress'][] = $macs[$m];
}
else {
$errMsg = $this->messages['macAddress'][1];
array_push($errMsg, array($i));
$messages[] = $errMsg;
}
}
}
} }
return $messages; return $messages;
} }

View File

@ -258,20 +258,7 @@ class inetLocalMailRecipient extends baseModule {
// add object class // add object class
if (!in_array("inetLocalMailRecipient", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "inetLocalMailRecipient"; if (!in_array("inetLocalMailRecipient", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "inetLocalMailRecipient";
// add local addresses // add local addresses
if ($rawAccounts[$i][$ids['inetLocalMailRecipient_localAdr']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetLocalMailRecipient_localAdr', 'mailLocalAddress', 'mailLocalAddress', $this->messages['localAdr'][1], $messages, '/,[ ]*/');
$adrs = explode(',', $rawAccounts[$i][$ids['inetLocalMailRecipient_localAdr']]);
// check format
for ($a = 0; $a < sizeof($adrs); $a++) {
if (get_preg($adrs[$a], 'mailLocalAddress')) {
$partialAccounts[$i]['mailLocalAddress'][] = $adrs[$a];
}
else {
$errMsg = $this->messages['localAdr'][1];
array_push($errMsg, array($i));
$messages[] = $errMsg;
}
}
}
// add routing address // add routing address
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetLocalMailRecipient_routingAdr', 'mailRoutingAddress', $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetLocalMailRecipient_routingAdr', 'mailRoutingAddress',
'email', $this->messages['mailRoutingAddress'][1], $messages); 'email', $this->messages['mailRoutingAddress'][1], $messages);

View File

@ -382,35 +382,9 @@ class kolabGroup extends baseModule {
} }
} }
// allowed recipients // allowed recipients
if (!empty($rawAccounts[$i][$ids['kolabGroup_kolabAllowSMTPRecipient']])) { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'kolabGroup_kolabAllowSMTPRecipient', 'kolabAllowSMTPRecipient', 'kolabEmailPrefix', $this->messages['kolabAllowSMTPRecipient'][1], $messages, '/;[ ]*/');
$mails = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['kolabGroup_kolabAllowSMTPRecipient']]);
for ($m = 0; $m < sizeof($mails); $m++) {
if (get_preg($mails[$m], 'kolabEmailPrefix')) {
$partialAccounts[$i]['kolabAllowSMTPRecipient'][] = $mails[$m];
}
else {
$errMsg = $this->messages['kolabAllowSMTPRecipient'][1];
array_push($errMsg, array($i));
$messages[] = $errMsg;
break;
}
}
}
// allowed senders // allowed senders
if (!empty($rawAccounts[$i][$ids['kolabGroup_kolabAllowSMTPSender']])) { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'kolabGroup_kolabAllowSMTPSender', 'kolabAllowSMTPSender', 'kolabEmailPrefix', $this->messages['kolabAllowSMTPSender'][1], $messages, '/;[ ]*/');
$mails = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['kolabGroup_kolabAllowSMTPSender']]);
for ($m = 0; $m < sizeof($mails); $m++) {
if (get_preg($mails[$m], 'kolabEmailPrefix')) {
$partialAccounts[$i]['kolabAllowSMTPSender'][] = $mails[$m];
}
else {
$errMsg = $this->messages['kolabAllowSMTPSender'][1];
array_push($errMsg, array($i));
$messages[] = $errMsg;
break;
}
}
}
} }
return $messages; return $messages;
} }

View File

@ -484,51 +484,11 @@ class kolabSharedFolder extends baseModule { // TODO folder type
// folder type // folder type
$partialAccounts[$i]['kolabFolderType'] = $rawAccounts[$i][$ids['kolabSharedFolder_kolabFolderType']]; $partialAccounts[$i]['kolabFolderType'] = $rawAccounts[$i][$ids['kolabSharedFolder_kolabFolderType']];
// allowed recipients // allowed recipients
if (!empty($rawAccounts[$i][$ids['kolabSharedFolder_kolabAllowSMTPRecipient']])) { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'kolabSharedFolder_kolabAllowSMTPRecipient', 'kolabAllowSMTPRecipient', 'kolabEmailPrefix', $this->messages['kolabAllowSMTPRecipient'][1], $messages, '/;[ ]*/');
$mails = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['kolabSharedFolder_kolabAllowSMTPRecipient']]);
for ($m = 0; $m < sizeof($mails); $m++) {
if (get_preg($mails[$m], 'kolabEmailPrefix')) {
$partialAccounts[$i]['kolabAllowSMTPRecipient'][] = $mails[$m];
}
else {
$errMsg = $this->messages['kolabAllowSMTPRecipient'][1];
array_push($errMsg, array($i));
$messages[] = $errMsg;
break;
}
}
}
// allowed senders // allowed senders
if (!empty($rawAccounts[$i][$ids['kolabSharedFolder_kolabAllowSMTPSender']])) { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'kolabSharedFolder_kolabAllowSMTPSender', 'kolabAllowSMTPSender', 'kolabEmailPrefix', $this->messages['kolabAllowSMTPSender'][1], $messages, '/;[ ]*/');
$mails = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['kolabSharedFolder_kolabAllowSMTPSender']]);
for ($m = 0; $m < sizeof($mails); $m++) {
if (get_preg($mails[$m], 'kolabEmailPrefix')) {
$partialAccounts[$i]['kolabAllowSMTPSender'][] = $mails[$m];
}
else {
$errMsg = $this->messages['kolabAllowSMTPSender'][1];
array_push($errMsg, array($i));
$messages[] = $errMsg;
break;
}
}
}
// add mail aliases // add mail aliases
if ($rawAccounts[$i][$ids['kolabSharedFolder_aliases']] != "") { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'kolabSharedFolder_aliases', 'alias', 'email', $this->messages['alias'][1], $messages, '/,[ ]*/');
$aliases = explode(',', $rawAccounts[$i][$ids['kolabSharedFolder_aliases']]);
// check format
for ($a = 0; $a < sizeof($aliases); $a++) {
if (get_preg($aliases[$a], 'email')) {
$partialAccounts[$i]['alias'][] = $aliases[$a];
}
// invalid format
else {
$errMsg = $this->messages['alias'][1];
array_push($errMsg, array($i));
$messages[] = $errMsg;
}
}
}
// add delegates // add delegates
if ($rawAccounts[$i][$ids['kolabSharedFolder_delegates']] != "") { if ($rawAccounts[$i][$ids['kolabSharedFolder_delegates']] != "") {
$newDelegates = explode(',', $rawAccounts[$i][$ids['kolabSharedFolder_delegates']]); $newDelegates = explode(',', $rawAccounts[$i][$ids['kolabSharedFolder_delegates']]);