make password sending more flexible

This commit is contained in:
Roland Gruber 2013-04-28 10:20:54 +00:00
parent 26b6505be7
commit 22c0ebe6d4
1 changed files with 6 additions and 1 deletions

View File

@ -912,7 +912,12 @@ function sendPasswordMail($pwd, $user, $recipient = null) {
$attr = str_replace('@', '', $results[0]);
$value = '';
if (isset($user[strtolower($attr)][0])) {
$value = $user[strtolower($attr)][0];
if (is_array($user[strtolower($attr)])) {
$value = $user[strtolower($attr)][0];
}
else {
$value = $user[strtolower($attr)];
}
}
$body = str_replace('@@' . $attr . '@@', $value, $body);
$found = preg_match('/\@\@[^\@]+\@\@/', $body, $results);