mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-10 07:37:50 +02:00
- fixed not stored email-address-policy
- removing quotes and space from email-addresses
This commit is contained in:
@ -1562,22 +1562,26 @@
|
|||||||
* @param string $first firstname
|
* @param string $first firstname
|
||||||
* @param string $last lastname
|
* @param string $last lastname
|
||||||
* @param string $account account-name (lid)
|
* @param string $account account-name (lid)
|
||||||
|
* @param string $domain=null domain-name or null to use eGW's default domain $GLOBALS['egw_info']['server']['mail_suffix]
|
||||||
* @return string with email address
|
* @return string with email address
|
||||||
*/
|
*/
|
||||||
function email_address($first,$last,$account)
|
function email_address($first,$last,$account,$domain=null)
|
||||||
{
|
{
|
||||||
|
//echo "<p align=right>common::email_address('$first','$last','$account')";
|
||||||
// convert all european special chars to ascii, (c) RalfBecker-AT-egroupware.org ;-)
|
// convert all european special chars to ascii, (c) RalfBecker-AT-egroupware.org ;-)
|
||||||
static $extra = array(
|
static $extra = array(
|
||||||
'ß' => 'ss',
|
'ß' => 'ss',
|
||||||
|
' ' => '',
|
||||||
);
|
);
|
||||||
foreach (array('first','last','account') as $name)
|
foreach (array('first','last','account') as $name)
|
||||||
{
|
{
|
||||||
$$name = htmlentities($$name,ENT_NOQUOTES,$GLOBALS['egw']->translation->charset());
|
$$name = htmlentities($$name,ENT_QUOTES,$GLOBALS['egw']->translation->charset());
|
||||||
$$name = str_replace(array_keys($extra),array_values($extra),$$name);
|
$$name = str_replace(array_keys($extra),array_values($extra),$$name);
|
||||||
$$name = preg_replace('/&([aAuUoO])uml;/','\\1e',$$name); // replace german umlauts with the letter plus one 'e'
|
$$name = preg_replace('/&([aAuUoO])uml;/','\\1e',$$name); // replace german umlauts with the letter plus one 'e'
|
||||||
$$name = preg_replace('/&([a-zA-Z])(grave|acute|circ|ring|cedil|tilde|slash|uml);/','\\1',$$name); // remove all types of acents
|
$$name = preg_replace('/&([a-zA-Z])(grave|acute|circ|ring|cedil|tilde|slash|uml);/','\\1',$$name); // remove all types of acents
|
||||||
$$name = preg_replace('/&([a-zA-Z]+|#[0-9]+);/','',$$name); // remove all other entities
|
$$name = preg_replace('/&([a-zA-Z]+|#[0-9]+|);/','',$$name); // remove all other entities
|
||||||
}
|
}
|
||||||
|
//echo " --> ('$first', '$last', '$account')";
|
||||||
if (!$first && !$last) // fallback to the account-name, if real names contain only special chars
|
if (!$first && !$last) // fallback to the account-name, if real names contain only special chars
|
||||||
{
|
{
|
||||||
$first = '';
|
$first = '';
|
||||||
@ -1592,10 +1596,14 @@
|
|||||||
$dot = '.';
|
$dot = '.';
|
||||||
$underscore = '_';
|
$underscore = '_';
|
||||||
}
|
}
|
||||||
return str_replace(array('first','last','initial','account','dot','underscore','_'),
|
if (!$domain) $domain = $GLOBALS['egw_info']['server']['mail_suffix'];
|
||||||
|
|
||||||
|
$email = str_replace(array('first','last','initial','account','dot','underscore','-'),
|
||||||
array($first,$last,substr($first,0,1),$account,$dot,$underscore,''),
|
array($first,$last,substr($first,0,1),$account,$dot,$underscore,''),
|
||||||
$GLOBALS['egw_info']['server']['email_address_format'] ? $GLOBALS['egw_info']['server']['email_address_format'] : 'first_dot_last').
|
$GLOBALS['egw_info']['server']['email_address_format'] ? $GLOBALS['egw_info']['server']['email_address_format'] : 'first-dot-last').
|
||||||
'@'.$GLOBALS['egw_info']['server']['mail_suffix'];
|
'@'.$domain;
|
||||||
|
//echo " = '$email'</p>\n";
|
||||||
|
return $email;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is not the best place for it, but it needs to be shared bewteen Aeromail and SM
|
// This is not the best place for it, but it needs to be shared bewteen Aeromail and SM
|
||||||
|
Reference in New Issue
Block a user