]> git.mxchange.org Git - friendica.git/blobdiff - mod/wallmessage.php
Improved support for Mastodon style content warnings
[friendica.git] / mod / wallmessage.php
index 3f9d24ac35cffd65b1b3b19fd2c754a852b86672..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) {
@@ -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;