use extended upload function
This commit is contained in:
parent
65f43d9fcd
commit
b8f7d87864
|
@ -132,22 +132,11 @@ class ieee802device extends baseModule {
|
|||
$messages = array();
|
||||
for ($i = 0; $i < sizeof($rawAccounts); $i++) {
|
||||
// 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
|
||||
if ($rawAccounts[$i][$ids['ieee802Device_mac']] != "") {
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'ieee802Device_mac', 'macAddress', 'macAddress', $this->messages['macAddress'][1], $messages, '/,[ ]*/');
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
|
|
|
@ -258,20 +258,7 @@ class inetLocalMailRecipient extends baseModule {
|
|||
// add object class
|
||||
if (!in_array("inetLocalMailRecipient", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "inetLocalMailRecipient";
|
||||
// add local addresses
|
||||
if ($rawAccounts[$i][$ids['inetLocalMailRecipient_localAdr']] != "") {
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetLocalMailRecipient_localAdr', 'mailLocalAddress', 'mailLocalAddress', $this->messages['localAdr'][1], $messages, '/,[ ]*/');
|
||||
// add routing address
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'inetLocalMailRecipient_routingAdr', 'mailRoutingAddress',
|
||||
'email', $this->messages['mailRoutingAddress'][1], $messages);
|
||||
|
|
|
@ -382,35 +382,9 @@ class kolabGroup extends baseModule {
|
|||
}
|
||||
}
|
||||
// allowed recipients
|
||||
if (!empty($rawAccounts[$i][$ids['kolabGroup_kolabAllowSMTPRecipient']])) {
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'kolabGroup_kolabAllowSMTPRecipient', 'kolabAllowSMTPRecipient', 'kolabEmailPrefix', $this->messages['kolabAllowSMTPRecipient'][1], $messages, '/;[ ]*/');
|
||||
// allowed senders
|
||||
if (!empty($rawAccounts[$i][$ids['kolabGroup_kolabAllowSMTPSender']])) {
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'kolabGroup_kolabAllowSMTPSender', 'kolabAllowSMTPSender', 'kolabEmailPrefix', $this->messages['kolabAllowSMTPSender'][1], $messages, '/;[ ]*/');
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
|
|
|
@ -484,51 +484,11 @@ class kolabSharedFolder extends baseModule { // TODO folder type
|
|||
// folder type
|
||||
$partialAccounts[$i]['kolabFolderType'] = $rawAccounts[$i][$ids['kolabSharedFolder_kolabFolderType']];
|
||||
// allowed recipients
|
||||
if (!empty($rawAccounts[$i][$ids['kolabSharedFolder_kolabAllowSMTPRecipient']])) {
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'kolabSharedFolder_kolabAllowSMTPRecipient', 'kolabAllowSMTPRecipient', 'kolabEmailPrefix', $this->messages['kolabAllowSMTPRecipient'][1], $messages, '/;[ ]*/');
|
||||
// allowed senders
|
||||
if (!empty($rawAccounts[$i][$ids['kolabSharedFolder_kolabAllowSMTPSender']])) {
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'kolabSharedFolder_kolabAllowSMTPSender', 'kolabAllowSMTPSender', 'kolabEmailPrefix', $this->messages['kolabAllowSMTPSender'][1], $messages, '/;[ ]*/');
|
||||
// add mail aliases
|
||||
if ($rawAccounts[$i][$ids['kolabSharedFolder_aliases']] != "") {
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'kolabSharedFolder_aliases', 'alias', 'email', $this->messages['alias'][1], $messages, '/,[ ]*/');
|
||||
// add delegates
|
||||
if ($rawAccounts[$i][$ids['kolabSharedFolder_delegates']] != "") {
|
||||
$newDelegates = explode(',', $rawAccounts[$i][$ids['kolabSharedFolder_delegates']]);
|
||||
|
|
Loading…
Reference in New Issue