]> git.mxchange.org Git - friendica.git/blobdiff - mod/wallmessage.php
RU translations THX Alexander An
[friendica.git] / mod / wallmessage.php
index 6e0ea0caf2019d720e55ceeef5019fffc39bf898..e8f7d24e31e37abc4b2e45d60537a389972bbbbc 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
  *
@@ -27,6 +27,7 @@ use Friendica\DI;
 use Friendica\Model\Mail;
 use Friendica\Model\Profile;
 use Friendica\Model\User;
+use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Strings;
 
 function wallmessage_post(App $a) {
@@ -37,10 +38,10 @@ function wallmessage_post(App $a) {
                return;
        }
 
-       $subject   = (!empty($_REQUEST['subject'])   ? Strings::escapeTags(trim($_REQUEST['subject']))   : '');
-       $body      = (!empty($_REQUEST['body'])      ? Strings::escapeHtml(trim($_REQUEST['body'])) : '');
+       $subject   = trim($_REQUEST['subject'] ?? '');
+       $body      = Strings::escapeHtml(trim($_REQUEST['body'] ?? ''));
 
-       $recipient = ((DI::args()->getArgc() > 1) ? Strings::escapeTags(DI::args()->getArgv()[1]) : '');
+       $recipient = ((DI::args()->getArgc() > 1) ? DI::args()->getArgv()[1] : '');
        if ((! $recipient) || (! $body)) {
                return;
        }
@@ -56,7 +57,7 @@ function wallmessage_post(App $a) {
                return;
        }
 
-       $total = DBA::count('mail', ["`uid` = ? AND `created` > UTC_TIMESTAMP() - INTERVAL 1 DAY AND `unknown`", $user['uid']]);
+       $total = DBA::count('mail', ["`uid` = ? AND `created` > ? AND `unknown`", $user['uid'], DateTimeFormat::utc('now - 1 day')]);
        if ($total > $user['cntunkmail']) {
                notice(DI::l10n()->t('Number of daily wall messages for %s exceeded. Message failed.', $user['username']));
                return;
@@ -110,7 +111,7 @@ function wallmessage_content(App $a) {
                return;
        }
 
-       $total = DBA::count('mail', ["`uid` = ? AND `created` > UTC_TIMESTAMP() - INTERVAL 1 DAY AND `unknown`", $user['uid']]);
+       $total = DBA::count('mail', ["`uid` = ? AND `created` > ? AND `unknown`", $user['uid'], DateTimeFormat::utc('now - 1 day')]);
        if ($total > $user['cntunkmail']) {
                notice(DI::l10n()->t('Number of daily wall messages for %s exceeded. Message failed.', $user['username']));
                return;