]> git.mxchange.org Git - friendica.git/blobdiff - mod/message.php
More usage of dbm::is_result($r) instead of count($r):
[friendica.git] / mod / message.php
index ef5dce826ec5c62e3d54007ea25802d2ef49cca8..d3153de05a13a1d4d378a4a7a3e1da9f10f4c8ab 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'];
 
@@ -321,7 +321,7 @@ function message_content(&$a) {
                                        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 +373,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 +405,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'];
 
@@ -562,7 +564,7 @@ function get_messages($user, $lstart, $lend) {
        );
 }
 
-function render_messages($msg, $t) {
+function render_messages(array $msg, $t) {
 
        $a = get_app();