]> git.mxchange.org Git - friendica.git/blobdiff - mod/message.php
Cleanup for #3010 - added spaces, thanks to @annando .
[friendica.git] / mod / message.php
index f0ab7d2ac907683519cfa1bd1a7bb1d12a8089bf..9bd5b0d72278bf0367cf79f4c3c7c59454924c17 100644 (file)
@@ -9,7 +9,7 @@ function message_init(&$a) {
        $tabs = '';
 
        if ($a->argc >1 && is_numeric($a->argv[1])) {
-        $tabs = render_messages(get_messages(local_user(),0,5), 'mail_list.tpl');
+               $tabs = render_messages(get_messages(local_user(),0,5), 'mail_list.tpl');
        }
 
        $new = array(
@@ -242,7 +242,7 @@ function message_content(&$a) {
                                intval($a->argv[2]),
                                intval(local_user())
                        );
-                       if(count($r)) {
+                       if (dbm::is_result($r)) {
                                $parent = $r[0]['parent-uri'];
                                $convid = $r[0]['convid'];
 
@@ -309,19 +309,21 @@ function message_content(&$a) {
                                intval(local_user()),
                                intval($a->argv[2])
                        );
-                       if(!$r) {
+                       if (!dbm::is_result($r)) {
                                $r = q("SELECT `name`, `url`, `id` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' LIMIT 1",
                                        intval(local_user()),
                                        dbesc(normalise_link(base64_decode($a->argv[2])))
                                );
                        }
-                       if(!$r) {
+
+                       if (!dbm::is_result($r)) {
                                $r = q("SELECT `name`, `url`, `id` FROM `contact` WHERE `uid` = %d AND `addr` = '%s' LIMIT 1",
                                        intval(local_user()),
                                        dbesc(base64_decode($a->argv[2]))
                                );
                        }
-                       if(count($r)) {
+
+                       if (dbm::is_result($r)) {
                                $prename = $r[0]['name'];
                                $preurl = $r[0]['url'];
                                $preid = $r[0]['id'];
@@ -373,11 +375,13 @@ function message_content(&$a) {
                        intval(local_user())
                );
 
-               if(count($r)) $a->set_pager_total($r[0]['total']);
+               if (dbm::is_result($r)) {
+                       $a->set_pager_total($r[0]['total']);
+               }
 
                $r = get_messages(local_user(), $a->pager['start'], $a->pager['itemspage']);
 
-               if(! count($r)) {
+               if(! dbm::is_result($r)) {
                        info( t('No messages.') . EOL);
                        return $o;
                }
@@ -403,7 +407,7 @@ function message_content(&$a) {
                        intval(local_user()),
                        intval($a->argv[1])
                );
-               if(count($r)) {
+               if (dbm::is_result($r)) {
                        $contact_id = $r[0]['contact-id'];
                        $convid = $r[0]['convid'];
 
@@ -484,12 +488,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' => $message['from-photo'],
+                               'from_photo' => proxy_url($from_photo, false, PROXY_SIZE_THUMB),
                                'subject' => $subject_e,
                                'body' => $body_e,
                                'delete' => t('Delete message'),
@@ -556,7 +566,7 @@ function get_messages($user, $lstart, $lend) {
        );
 }
 
-function render_messages($msg, $t) {
+function render_messages(array $msg, $t) {
 
        $a = get_app();
 
@@ -585,12 +595,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,