mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-06 16:07:03 +03:00
minor changes
This commit is contained in:
parent
0763f3d1c6
commit
20f6dea345
1 changed files with 36 additions and 36 deletions
|
|
@ -280,49 +280,49 @@ class LdapIdentities implements IIdentities
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function CleanupMailAddresses(): If a prefix is given this function removes addresses without / with the wrong prefix and then the prefix itself from all remaining values.
|
// Function CleanupMailAddresses(): If a prefix is given this function removes addresses without / with the wrong prefix and then the prefix itself from all remaining values.
|
||||||
// This is usefull for example for importing Active Directory LDAP entry "proxyAddresses" which can hold different address types with prefixes like "X400:", "smtp:" "sip:" and others.
|
// This is usefull for example for importing Active Directory LDAP entry "proxyAddresses" which can hold different address types with prefixes like "X400:", "smtp:" "sip:" and others.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@param array $entries
|
@param array $entries
|
||||||
@param string $mailField
|
@param string $mailField
|
||||||
@paraam string $mailPrefix
|
@paraam string $mailPrefix
|
||||||
@return array
|
@return array
|
||||||
*/
|
*/
|
||||||
private function CleanupMailAddresses(array $entries, string $mailField, string $mailPrefix)
|
private function CleanupMailAddresses(array $entries, string $mailField, string $mailPrefix)
|
||||||
{
|
{
|
||||||
if (!empty($mailPrefix)) {
|
if (!empty($mailPrefix)) {
|
||||||
for ($i = 0; $i < $entries["count"]; $i++) {
|
for ($i = 0; $i < $entries["count"]; $i++) {
|
||||||
// Remove addresses without the given prefix
|
// Remove addresses without the given prefix
|
||||||
$entries[$i]["$mailField"] = array_filter($entries[$i]["$mailField"],
|
$entries[$i]["$mailField"] = array_filter($entries[$i]["$mailField"],
|
||||||
function($prefixMail)
|
function($prefixMail)
|
||||||
{
|
{
|
||||||
// $mailPrefix can't be used here, because it's nailed to the CleanupMailAddresses function and can't be passed to the array_filter function afaik.
|
// $mailPrefix can't be used here, because it's nailed to the CleanupMailAddresses function and can't be passed to the array_filter function afaik.
|
||||||
// Ideas to avoid this are welcome.
|
// Ideas to avoid this are welcome.
|
||||||
if (stripos($prefixMail, $this->config->mail_prefix) === 0) {
|
if (stripos($prefixMail, $this->config->mail_prefix) === 0) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
);
|
return FALSE;
|
||||||
// Set "count" to new value
|
}
|
||||||
$newcount = count($entries[$i]["$mailField"]);
|
);
|
||||||
if (array_key_exists("count", $entries[$i]["$mailField"])) {
|
// Set "count" to new value
|
||||||
$newcount = $newcount - 1;
|
$newcount = count($entries[$i]["$mailField"]);
|
||||||
}
|
if (array_key_exists("count", $entries[$i]["$mailField"])) {
|
||||||
$entries[$i]["$mailField"]["count"] = $newcount;
|
$newcount = $newcount - 1;
|
||||||
|
}
|
||||||
|
$entries[$i]["$mailField"]["count"] = $newcount;
|
||||||
|
|
||||||
// Remove the prefix
|
// Remove the prefix
|
||||||
for ($j = 0; $j < $entries[$i]["$mailField"]["count"]; $j++) {
|
for ($j = 0; $j < $entries[$i]["$mailField"]["count"]; $j++) {
|
||||||
$mailPrefixLen = mb_strlen($mailPrefix);
|
$mailPrefixLen = mb_strlen($mailPrefix);
|
||||||
$entries[$i]["$mailField"][$j] = substr($entries[$i]["$mailField"][$j], $mailPrefixLen);
|
$entries[$i]["$mailField"][$j] = substr($entries[$i]["$mailField"][$j], $mailPrefixLen);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $entries;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $entries;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $entry
|
* @param array $entry
|
||||||
* @param string $attribute
|
* @param string $attribute
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue