Merge pull request #2582 from annando/1606-more-avatar-stuff

Some more places where the avatar picture is taken from the database
This commit is contained in:
Tobias Diekershoff 2016-06-10 09:39:01 +02:00 committed by GitHub
commit ee06d2fa3c
2 changed files with 20 additions and 3 deletions

View file

@ -484,12 +484,18 @@ function message_content(&$a) {
$to_name_e = $message['name']; $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( $mails[] = array(
'id' => $message['id'], 'id' => $message['id'],
'from_name' => $from_name_e, 'from_name' => $from_name_e,
'from_url' => $from_url, 'from_url' => $from_url,
'sparkle' => $sparkle, '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, 'subject' => $subject_e,
'body' => $body_e, 'body' => $body_e,
'delete' => t('Delete message'), 'delete' => t('Delete message'),
@ -585,12 +591,18 @@ function render_messages($msg, $t) {
$to_name_e = $rr['name']; $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( $rslt .= replace_macros($tpl, array(
'$id' => $rr['id'], '$id' => $rr['id'],
'$from_name' => $participants, '$from_name' => $participants,
'$from_url' => (($rr['network'] === NETWORK_DFRN) ? 'redir/' . $rr['contact-id'] : $rr['url']), '$from_url' => (($rr['network'] === NETWORK_DFRN) ? 'redir/' . $rr['contact-id'] : $rr['url']),
'$sparkle' => ' sparkle', '$sparkle' => ' sparkle',
'$from_photo' => (($rr['thumb']) ? $rr['thumb'] : $rr['from-photo']), '$from_photo' => proxy_url($from_photo, false, PROXY_SIZE_THUMB),
'$subject' => $subject_e, '$subject' => $subject_e,
'$delete' => t('Delete conversation'), '$delete' => t('Delete conversation'),
'$body' => $body_e, '$body' => $body_e,

View file

@ -189,7 +189,12 @@ function ping_init(&$a) {
* 'message' => notification message. "{0}" will be replaced by subject name * 'message' => notification message. "{0}" will be replaced by subject name
**/ **/
function xmlize($n){ 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['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"); $n['name'] = html_entity_decode($n['name'], ENT_COMPAT | ENT_HTML401, "UTF-8");