summaryrefslogtreecommitdiff
path: root/program/steps/mail/func.inc
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-05-01 12:26:23 +0200
committerAleksander Machniak <alec@alec.pl>2013-05-01 12:26:23 +0200
commit969cb03f9a3aa9496da68cff53fedce79acc1071 (patch)
tree12657cbf4140f5e9be7f8ec4a6efde6dc58af5b1 /program/steps/mail/func.inc
parent38c19a20641234a9a3a9a1e77e8f1202163ed13d (diff)
Add option to display email address together with a name in mail preview (#1488732)
Diffstat (limited to 'program/steps/mail/func.inc')
-rw-r--r--program/steps/mail/func.inc27
1 files changed, 18 insertions, 9 deletions
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 60db3f310..f00813ea2 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -1440,7 +1440,8 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null,
$c = count($a_parts);
$j = 0;
$out = '';
- $allvalues = array();
+ $allvalues = array();
+ $show_email = $RCMAIL->config->get('message_show_email');
if ($addicon && !isset($_SESSION['writeable_abook'])) {
$_SESSION['writeable_abook'] = $RCMAIL->get_address_sources(true) ? true : false;
@@ -1453,7 +1454,7 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null,
$string = $part['string'];
// phishing email prevention (#1488981), e.g. "valid@email.addr <phishing@email.addr>"
- if ($name && $name != $mailto && strpos($name, '@')) {
+ if (!$show_email && $name && $name != $mailto && strpos($name, '@')) {
$name = '';
}
@@ -1471,13 +1472,21 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null,
}
else if (check_email($part['mailto'], false)) {
if ($linked) {
- $address = html::a(array(
- 'href' => 'mailto:'.$mailto,
- 'onclick' => sprintf("return %s.command('compose','%s',this)", JS_OBJECT_NAME, JQ($mailto)),
- 'title' => $mailto,
- 'class' => "rcmContactAddress",
- ),
- Q($name ? $name : $mailto));
+ $attrs = array(
+ 'href' => 'mailto:' . $mailto,
+ 'onclick' => sprintf("return %s.command('compose','%s',this)", JS_OBJECT_NAME, JQ($mailto)),
+ 'class' => "rcmContactAddress",
+ );
+
+ if ($show_email && $name && $mailto) {
+ $content = Q($name ? sprintf('%s <%s>', $name, $mailto) : $mailto);
+ }
+ else {
+ $content = Q($name ? $name : $mailto);
+ $attrs['title'] = $mailto;
+ }
+
+ $address = html::a($attrs, $content);
}
else {
$address = html::span(array('title' => $mailto, 'class' => "rcmContactAddress"),