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

@ -36,7 +36,7 @@ class ieee802device extends baseModule {
/** /**
* Returns true if this module can manage accounts of the current type, otherwise false. * Returns true if this module can manage accounts of the current type, otherwise false.
* *
* @return boolean true if module fits * @return boolean true if module fits
*/ */
public function can_manage() { public function can_manage() {
@ -47,7 +47,7 @@ class ieee802device extends baseModule {
* Returns meta data that is interpreted by parent class * Returns meta data that is interpreted by parent class
* *
* @return array array with meta data * @return array array with meta data
* *
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
function get_metaData() { function get_metaData() {
@ -98,7 +98,7 @@ class ieee802device extends baseModule {
/** /**
* Returns the HTML meta data for the main account page. * Returns the HTML meta data for the main account page.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_attributes() { function display_html_attributes() {
@ -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'])) {
// add MACs $partialAccounts[$i]['objectClass'][] = "ieee802Device";
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;
}
}
} }
// add MACs
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'ieee802Device_mac', 'macAddress', 'macAddress', $this->messages['macAddress'][1], $messages, '/,[ ]*/');
} }
return $messages; return $messages;
} }

View File

@ -36,7 +36,7 @@ class inetLocalMailRecipient extends baseModule {
/** /**
* Returns true if this module can manage accounts of the current type, otherwise false. * Returns true if this module can manage accounts of the current type, otherwise false.
* *
* @return boolean true if module fits * @return boolean true if module fits
*/ */
public function can_manage() { public function can_manage() {
@ -47,7 +47,7 @@ class inetLocalMailRecipient extends baseModule {
* Returns meta data that is interpreted by parent class * Returns meta data that is interpreted by parent class
* *
* @return array array with meta data * @return array array with meta data
* *
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
function get_metaData() { function get_metaData() {
@ -137,7 +137,7 @@ class inetLocalMailRecipient extends baseModule {
/** /**
* Returns the HTML meta data for the main account page. * Returns the HTML meta data for the main account page.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_attributes() { function display_html_attributes() {
@ -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

@ -33,12 +33,12 @@ $Id$
* @package modules * @package modules
*/ */
class kolabGroup extends baseModule { class kolabGroup extends baseModule {
/** cache for mail attribute */ /** cache for mail attribute */
private $mailCache = null; private $mailCache = null;
/** cache for mailHost values */ /** cache for mailHost values */
private $mailHostCache = null; private $mailHostCache = null;
/** /**
* Creates a new kolabGroup object. * Creates a new kolabGroup object.
* *
@ -52,7 +52,7 @@ class kolabGroup extends baseModule {
/** /**
* Returns true if this module can manage accounts of the current type, otherwise false. * Returns true if this module can manage accounts of the current type, otherwise false.
* *
* @return boolean true if module fits * @return boolean true if module fits
*/ */
public function can_manage() { public function can_manage() {
@ -63,7 +63,7 @@ class kolabGroup extends baseModule {
* Returns meta data that is interpreted by parent class * Returns meta data that is interpreted by parent class
* *
* @return array array with meta data * @return array array with meta data
* *
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
function get_metaData() { function get_metaData() {
@ -186,7 +186,7 @@ class kolabGroup extends baseModule {
/** /**
* Returns the HTML meta data for the main account page. * Returns the HTML meta data for the main account page.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_attributes() { function display_html_attributes() {
@ -277,7 +277,7 @@ class kolabGroup extends baseModule {
/** /**
* This function will create the meta HTML code to show a page to mark an account for deletion. * This function will create the meta HTML code to show a page to mark an account for deletion.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_deleteFlag() { function display_html_deleteFlag() {
@ -341,7 +341,7 @@ class kolabGroup extends baseModule {
} }
} }
} }
/** /**
* In this function the LDAP account is built up. * In this function the LDAP account is built up.
* *
@ -382,39 +382,13 @@ 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;
} }
/** /**
* Returns a list of possible PDF entries for this account. * Returns a list of possible PDF entries for this account.
* *
@ -428,10 +402,10 @@ class kolabGroup extends baseModule {
$this->addSimplePDFField($return, 'kolabAllowSMTPSender', _('Allowed senders')); $this->addSimplePDFField($return, 'kolabAllowSMTPSender', _('Allowed senders'));
return $return; return $return;
} }
/** /**
* Returns if the mail attribute should be managed. * Returns if the mail attribute should be managed.
* *
* @return boolean manage mail attribute * @return boolean manage mail attribute
*/ */
private function manageMail() { private function manageMail() {
@ -462,7 +436,7 @@ class kolabGroup extends baseModule {
} }
} }
} }
/** /**
* Loads the list of mail hosts into the cache. * Loads the list of mail hosts into the cache.
*/ */
@ -478,7 +452,7 @@ class kolabGroup extends baseModule {
} }
} }
} }
} }

View File

@ -33,13 +33,13 @@ $Id$
* @package modules * @package modules
*/ */
class kolabSharedFolder extends baseModule { // TODO folder type class kolabSharedFolder extends baseModule { // TODO folder type
/** cache for mailHost values */ /** cache for mailHost values */
private $mailHostCache = null; private $mailHostCache = null;
/** list of folder types (label => id) */ /** list of folder types (label => id) */
private $folderTypes = array(); private $folderTypes = array();
/** /**
* Creates a new kolabSharedFolder object. * Creates a new kolabSharedFolder object.
* *
@ -60,7 +60,7 @@ class kolabSharedFolder extends baseModule { // TODO folder type
/** /**
* Returns true if this module can manage accounts of the current type, otherwise false. * Returns true if this module can manage accounts of the current type, otherwise false.
* *
* @return boolean true if module fits * @return boolean true if module fits
*/ */
public function can_manage() { public function can_manage() {
@ -71,7 +71,7 @@ class kolabSharedFolder extends baseModule { // TODO folder type
* Returns meta data that is interpreted by parent class * Returns meta data that is interpreted by parent class
* *
* @return array array with meta data * @return array array with meta data
* *
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
function get_metaData() { function get_metaData() {
@ -264,7 +264,7 @@ class kolabSharedFolder extends baseModule { // TODO folder type
/** /**
* Returns the HTML meta data for the main account page. * Returns the HTML meta data for the main account page.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_attributes() { function display_html_attributes() {
@ -417,7 +417,7 @@ class kolabSharedFolder extends baseModule { // TODO folder type
/** /**
* This function will create the meta HTML code to show a page to mark an account for deletion. * This function will create the meta HTML code to show a page to mark an account for deletion.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_deleteFlag() { function display_html_deleteFlag() {
@ -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']]);
@ -548,7 +508,7 @@ class kolabSharedFolder extends baseModule { // TODO folder type
} }
return $messages; return $messages;
} }
/** /**
* Returns a list of possible PDF entries for this account. * Returns a list of possible PDF entries for this account.
* *
@ -575,7 +535,7 @@ class kolabSharedFolder extends baseModule { // TODO folder type
} }
return $return; return $return;
} }
/** /**
* Loads the list of mail hosts into the cache. * Loads the list of mail hosts into the cache.
*/ */
@ -591,7 +551,7 @@ class kolabSharedFolder extends baseModule { // TODO folder type
} }
} }
} }
} }