From 807fbe173be3b3b1ed60ef872b2ab2a5a3ad587a Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Fri, 10 Jun 2016 07:44:32 +0200 Subject: [PATCH] Some more places where the avatar picture is taken from the database --- mod/message.php | 16 ++++++++++++++-- mod/ping.php | 7 ++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/mod/message.php b/mod/message.php index b5c6c064dc..ef5dce826e 100644 --- a/mod/message.php +++ b/mod/message.php @@ -484,12 +484,18 @@ function message_content(&$a) { $to_name_e = $message['name']; } + $contact = get_contact_details_by_url($message['from-url']); + if (isset($contact["thumb"])) + $from_photo = $contact["thumb"]; + else + $from_photo = $message['from-photo']; + $mails[] = array( 'id' => $message['id'], 'from_name' => $from_name_e, 'from_url' => $from_url, 'sparkle' => $sparkle, - 'from_photo' => proxy_url($message['from-photo'], false, PROXY_SIZE_THUMB), + 'from_photo' => proxy_url($from_photo, false, PROXY_SIZE_THUMB), 'subject' => $subject_e, 'body' => $body_e, 'delete' => t('Delete message'), @@ -585,12 +591,18 @@ function render_messages($msg, $t) { $to_name_e = $rr['name']; } + $contact = get_contact_details_by_url($rr['url']); + if (isset($contact["thumb"])) + $from_photo = $contact["thumb"]; + else + $from_photo = (($rr['thumb']) ? $rr['thumb'] : $rr['from-photo']); + $rslt .= replace_macros($tpl, array( '$id' => $rr['id'], '$from_name' => $participants, '$from_url' => (($rr['network'] === NETWORK_DFRN) ? 'redir/' . $rr['contact-id'] : $rr['url']), '$sparkle' => ' sparkle', - '$from_photo' => (($rr['thumb']) ? $rr['thumb'] : $rr['from-photo']), + '$from_photo' => proxy_url($from_photo, false, PROXY_SIZE_THUMB), '$subject' => $subject_e, '$delete' => t('Delete conversation'), '$body' => $body_e, diff --git a/mod/ping.php b/mod/ping.php index 544aa446bb..c12da56131 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -189,7 +189,12 @@ function ping_init(&$a) { * 'message' => notification message. "{0}" will be replaced by subject name **/ function xmlize($n){ - $n['photo'] = proxy_url($n['photo'], false, PROXY_SIZE_MICRO); + + $contact = get_contact_details_by_url($n['url']); + if (isset($contact["thumb"])) + $n['photo'] = proxy_url($contact["thumb"], false, PROXY_SIZE_MICRO); + else + $n['photo'] = proxy_url($n['photo'], false, PROXY_SIZE_MICRO); $n['message'] = html_entity_decode($n['message'], ENT_COMPAT | ENT_HTML401, "UTF-8"); $n['name'] = html_entity_decode($n['name'], ENT_COMPAT | ENT_HTML401, "UTF-8"); -- 2.39.5