]> git.mxchange.org Git - friendica.git/blobdiff - mod/message.php
Return the actor, not the array
[friendica.git] / mod / message.php
index 7324840a0e3acb4d1183246dd673416f27e9a960..a007de8d84f5037201b9a8a4bc1b6eb0948d2dbc 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -70,10 +70,10 @@ function message_post(App $a)
                return;
        }
 
-       $replyto   = !empty($_REQUEST['replyto'])   ? Strings::escapeTags(trim($_REQUEST['replyto'])) : '';
-       $subject   = !empty($_REQUEST['subject'])   ? Strings::escapeTags(trim($_REQUEST['subject'])) : '';
-       $body      = !empty($_REQUEST['body'])      ? Strings::escapeHtml(trim($_REQUEST['body']))    : '';
-       $recipient = !empty($_REQUEST['recipient']) ? intval($_REQUEST['recipient'])                  : 0;
+       $replyto   = !empty($_REQUEST['replyto'])   ? trim($_REQUEST['replyto'])                   : '';
+       $subject   = !empty($_REQUEST['subject'])   ? trim($_REQUEST['subject'])                   : '';
+       $body      = !empty($_REQUEST['body'])      ? Strings::escapeHtml(trim($_REQUEST['body'])) : '';
+       $recipient = !empty($_REQUEST['recipient']) ? intval($_REQUEST['recipient'])               : 0;
 
        $ret = Mail::send($recipient, $body, $subject, $replyto);
        $norecip = false;
@@ -212,14 +212,7 @@ function message_content(App $a)
 
                $o .= $header;
 
-               $total = 0;
-               $r = q("SELECT count(*) AS `total`, ANY_VALUE(`created`) AS `created` FROM `mail`
-                       WHERE `mail`.`uid` = %d GROUP BY `parent-uri` ORDER BY `created` DESC",
-                       intval(local_user())
-               );
-               if (DBA::isResult($r)) {
-                       $total = $r[0]['total'];
-               }
+               $total = DBA::count('mail', ['uid' => local_user()], ['distinct' => true, 'expression' => 'parent-uri']);
 
                $pager = new Pager(DI::l10n(), DI::args()->getQueryString());