summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/addressbook/func.inc10
-rw-r--r--program/steps/addressbook/photo.inc8
-rw-r--r--program/steps/mail/show.inc4
3 files changed, 16 insertions, 6 deletions
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index d4c57cc9d..38de93d05 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -816,11 +816,15 @@ function rcmail_contact_photo($attrib)
}
$photo_img = $RCMAIL->url($url);
}
- else
+ else {
$ff_value = '-del-'; // will disable delete-photo action
+ }
- $img = html::img(array('src' => $photo_img, 'border' => 1, 'alt' => $RCMAIL->gettext('contactphoto')));
- $content = html::div($attrib, $img);
+ $content = html::div($attrib, html::img(array(
+ 'src' => $photo_img,
+ 'alt' => $RCMAIL->gettext('contactphoto'),
+ 'onerror' => 'this.src = rcmail.env.photo_placeholder',
+ )));
if ($CONTACT_COLTYPES['photo'] && ($RCMAIL->action == 'edit' || $RCMAIL->action == 'add')) {
$RCMAIL->output->add_gui_object('contactphoto', $attrib['id']);
diff --git a/program/steps/addressbook/photo.inc b/program/steps/addressbook/photo.inc
index 482185735..30d09ffcc 100644
--- a/program/steps/addressbook/photo.inc
+++ b/program/steps/addressbook/photo.inc
@@ -72,8 +72,12 @@ $plugin = $RCMAIL->plugins->exec_hook('contact_photo',
if ($plugin['url']) {
$RCMAIL->output->redirect($plugin['url']);
}
-else {
- $data = $plugin['data'];
+
+$data = $plugin['data'];
+
+// detect if photo data is an URL
+if (strlen($data) < 1024 && filter_var($data, FILTER_VALIDATE_URL)) {
+ $RCMAIL->output->redirect($data);
}
// deliver alt image
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index 4b2d78d31..d4121fdd8 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -349,8 +349,10 @@ function rcmail_message_contactphoto($attrib)
'_task' => 'addressbook',
'_action' => 'photo',
'_email' => $MESSAGE->sender['mailto'],
- '_alt' => $placeholder
+ '_alt' => $placeholder,
));
+
+ $attrib['onerror'] = "this.src = '" . ($placeholder ? $placeholder : 'program/resources/blank.gif') . "'";
}
else {
$photo_img = $placeholder ? $placeholder : 'program/resources/blank.gif';