Fixed various oversights.

This commit is contained in:
Pachira 2024-03-30 03:19:08 +00:00
parent 107d16cf46
commit 9bb943bacf
6 changed files with 16 additions and 12 deletions

View file

@ -12,11 +12,9 @@ use Misuzu\Pagination;
use Misuzu\Users\UserInfo;
class ForumCategories {
private IDbConnection $dbConn;
private DbStatementCache $cache;
public function __construct(IDbConnection $dbConn) {
$this->dbConn = $dbConn;
$this->cache = new DbStatementCache($dbConn);
}

View file

@ -11,7 +11,7 @@ use Misuzu\Users\UserInfo;
class MessagesDatabase {
private DbStatementCache $cache;
public function __construct(private IDbConnection $dbConn) {
public function __construct(IDbConnection $dbConn) {
$this->cache = new DbStatementCache($dbConn);
}

View file

@ -556,9 +556,9 @@ class MessagesRoutes extends RouteHandler {
return 400;
$content = $request->getContent();
$messages = explode(',', (string)$content->getParam('messages'));
if(empty($messages))
$messages = (string)$content->getParam('messages');
if($messages === '')
return [
'error' => [
'name' => 'msgs:empty',
@ -566,6 +566,8 @@ class MessagesRoutes extends RouteHandler {
],
];
$messages = explode(',', $messages);
$this->msgsCtx->getDatabase()->deleteMessages(
$this->authInfo->getUserInfo(),
$messages
@ -581,9 +583,9 @@ class MessagesRoutes extends RouteHandler {
return 400;
$content = $request->getContent();
$messages = explode(',', (string)$content->getParam('messages'));
if(empty($messages))
$messages = (string)$content->getParam('messages');
if($messages === '')
return [
'error' => [
'name' => 'msgs:empty',
@ -591,6 +593,8 @@ class MessagesRoutes extends RouteHandler {
],
];
$messages = explode(',', $messages);
$this->msgsCtx->getDatabase()->restoreMessages(
$this->authInfo->getUserInfo(),
$messages
@ -606,9 +610,9 @@ class MessagesRoutes extends RouteHandler {
return 400;
$content = $request->getContent();
$messages = explode(',', (string)$content->getParam('messages'));
if(empty($messages))
$messages = (string)$content->getParam('messages');
if($messages === '')
return [
'error' => [
'name' => 'msgs:empty',
@ -616,6 +620,8 @@ class MessagesRoutes extends RouteHandler {
],
];
$messages = explode(',', $messages);
$this->msgsCtx->getDatabase()->nukeMessages(
$this->authInfo->getUserInfo(),
$messages

View file

@ -14,7 +14,7 @@ class RoutingErrorHandler extends HtmlErrorHandler {
if($code === 500 || $code === 503) {
$response->setTypeHTML();
$response->setContent(file_get_contents('%s/%03d.html', MSZ_TEMPLATES, $code));
$response->setContent(file_get_contents(sprintf('%s/%03d.html', MSZ_TEMPLATES, $code)));
return;
}

View file

@ -18,7 +18,7 @@ class ModNoteInfo {
return new ModNoteInfo(
noteId: $result->getString(0),
userId: $result->getString(1),
authorId: $result->getIntegerOrNull(2),
authorId: $result->getStringOrNull(2),
created: $result->getInteger(3),
title: $result->getString(4),
body: $result->getString(5)

View file

@ -47,7 +47,7 @@ class UserInfo {
created: $result->getInteger(9),
lastActive: $result->getIntegerOrNull(10),
deleted: $result->getIntegerOrNull(11),
displayRoleId: $result->getIntegerOrNull(12),
displayRoleId: $result->getStringOrNull(12),
totpKey: $result->getStringOrNull(13),
aboutContent: $result->getStringOrNull(14),
aboutParser: $result->getInteger(15),