use wcf\system\exception\NamedUserException;
use wcf\system\exception\PermissionDeniedException;
use wcf\system\exception\UserInputException;
+use wcf\system\flood\FloodControl;
use wcf\system\message\quote\MessageQuoteManager;
use wcf\system\page\PageLocationManager;
use wcf\system\WCF;
MessageQuoteManager::getInstance()->saved();
+ FloodControl::getInstance()->registerContent('com.woltlab.wcf.conversation');
+
$this->saved();
// forward
use wcf\system\database\util\PreparedStatementConditionBuilder;
use wcf\system\exception\NamedUserException;
use wcf\system\exception\PermissionDeniedException;
+use wcf\system\flood\FloodControl;
use wcf\system\user\storage\UserStorageHandler;
use wcf\system\SingletonFactory;
use wcf\system\WCF;
throw new PermissionDeniedException();
}
- $sql = "SELECT COUNT(*) AS count, MIN(time) AS oldestDate
- FROM wcf" . WCF_N . "_conversation
- WHERE userID = ?
- AND time > ?";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute([
- WCF::getUser()->userID,
- TIME_NOW - 86400,
- ]);
- $row = $statement->fetchSingleRow();
-
- if ($row['count'] >= $limit) {
+ $count = FloodControl::getInstance()->countContent('com.woltlab.wcf.conversation', new \DateInterval('P1D'));
+ if ($count['count'] >= $limit) {
throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.conversation.error.floodControl', [
- 'limit' => $limit,
- 'notBefore' => $row['oldestDate'] + 86400,
+ 'limit' => $count['count'],
+ 'notBefore' => $count['earliestTime'] + 86400,
]));
}
}
<classname>wcf\system\user\content\provider\ConversationMessageUserContentProvider</classname>
</type>
<!-- /user content provider -->
+ <type>
+ <name>com.woltlab.wcf.conversation</name>
+ <definitionname>com.woltlab.wcf.floodControl</definitionname>
+ </type>
</import>
</data>