]> git.mxchange.org Git - friendica.git/blobdiff - mod/message.php
Don't cache account probing for empty networks
[friendica.git] / mod / message.php
index 734bf3471017dd49560daa474f68a718ed3d466c..433da08a88f61b5ca510687a71c1441fc5ad8983 100644 (file)
@@ -2,13 +2,14 @@
 
 require_once('include/acl_selectors.php');
 require_once('include/message.php');
+require_once('include/Smilies.php');
 
 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(
@@ -360,11 +361,13 @@ function message_content(&$a) {
                        dbesc($myprofile)
                );
 
-               if(count($r)) $a->set_pager_total($r[0]['total']);
+               if (dba::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(! dba::is_result($r)) {
                        info( t('No messages.') . EOL);
                        return $o;
                }
@@ -460,13 +463,13 @@ function message_content(&$a) {
                        if($a->theme['template_engine'] === 'internal') {
                                $from_name_e = template_escape($message['from-name']);
                                $subject_e = template_escape($message['title']);
-                               $body_e = template_escape(smilies(bbcode($message['body'])));
+                               $body_e = template_escape(Smilies::replace(bbcode($message['body'])));
                                $to_name_e = template_escape($message['name']);
                        }
                        else {
                                $from_name_e = $message['from-name'];
                                $subject_e = $message['title'];
-                               $body_e = smilies(bbcode($message['body']));
+                               $body_e = Smilies::replace(bbcode($message['body']));
                                $to_name_e = $message['name'];
                        }
 
@@ -542,7 +545,7 @@ function get_messages($user, $lstart, $lend) {
        );
 }
 
-function render_messages($msg, $t) {
+function render_messages(array $msg, $t) {
 
        $a = get_app();