Added Data suffix where applicable.
This commit is contained in:
parent
6c7568e261
commit
d462ee0594
44 changed files with 133 additions and 133 deletions
public-legacy/manage
src
AuditLog
Auth
AuthContext.phpAuthInfo.phpLoginAttemptsData.phpRecoveryTokensData.phpSessionsData.phpTwoFactorAuthSessionsData.php
Changelog
Comments
Counters
Emoticons
Forum
ForumCategoriesData.phpForumContext.phpForumPostsData.phpForumPostsRoutes.phpForumTopicRedirectsData.phpForumTopicsData.phpForumTopicsRoutes.php
Home
Messages
MisuzuContext.phpNews
Perms
Profile
Satori
SharpChat
Users
|
@ -3,7 +3,7 @@ namespace Misuzu;
|
|||
|
||||
use DateTimeInterface;
|
||||
use RuntimeException;
|
||||
use Misuzu\Changelog\Changelog;
|
||||
use Misuzu\Changelog\ChangelogData;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Index\{XArray,XDateTime};
|
||||
|
||||
|
@ -14,8 +14,8 @@ if(!$msz->authInfo->getPerms('global')->check(Perm::G_CL_CHANGES_MANAGE))
|
|||
Template::throwError(403);
|
||||
|
||||
$changeActions = [];
|
||||
foreach(Changelog::ACTIONS as $action)
|
||||
$changeActions[$action] = Changelog::actionText($action);
|
||||
foreach(ChangelogData::ACTIONS as $action)
|
||||
$changeActions[$action] = ChangelogData::actionText($action);
|
||||
|
||||
$changeId = (string)filter_input(INPUT_GET, 'c', FILTER_SANITIZE_NUMBER_INT);
|
||||
$changeInfo = null;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
namespace Misuzu;
|
||||
|
||||
use Misuzu\Users\Roles;
|
||||
use Misuzu\Users\RolesData;
|
||||
|
||||
if(!isset($msz) || !($msz instanceof \Misuzu\MisuzuContext))
|
||||
die('Script must be called through the Misuzu route dispatcher.');
|
||||
|
@ -18,7 +18,7 @@ $userInfos = $msz->usersCtx->users->getUsers(pagination: $pagination, orderBy: '
|
|||
$roleInfos = [];
|
||||
|
||||
foreach($userInfos as $userInfo) {
|
||||
$displayRoleId = $userInfo->displayRoleId ?? Roles::DEFAULT_ROLE;
|
||||
$displayRoleId = $userInfo->displayRoleId ?? RolesData::DEFAULT_ROLE;
|
||||
if(array_key_exists($displayRoleId, $roleInfos))
|
||||
$roleInfo = $roleInfos[$displayRoleId];
|
||||
else
|
||||
|
|
|
@ -6,7 +6,7 @@ use Index\Db\{DbConnection,DbStatementCache};
|
|||
use Misuzu\Pagination;
|
||||
use Misuzu\Users\UserInfo;
|
||||
|
||||
class AuditLog {
|
||||
class AuditLogData {
|
||||
private DbStatementCache $cache;
|
||||
|
||||
public function __construct(DbConnection $dbConn) {
|
|
@ -5,19 +5,19 @@ use Index\Config\Config;
|
|||
use Index\Db\DbConnection;
|
||||
|
||||
class AuthContext {
|
||||
public private(set) Sessions $sessions;
|
||||
public private(set) LoginAttempts $loginAttempts;
|
||||
public private(set) RecoveryTokens $recoveryTokens;
|
||||
public private(set) TwoFactorAuthSessions $tfaSessions;
|
||||
public private(set) SessionsData $sessions;
|
||||
public private(set) LoginAttemptsData $loginAttempts;
|
||||
public private(set) RecoveryTokensData $recoveryTokens;
|
||||
public private(set) TwoFactorAuthSessionsData $tfaSessions;
|
||||
|
||||
private Config $config;
|
||||
|
||||
public function __construct(DbConnection $dbConn, Config $config) {
|
||||
$this->config = $config;
|
||||
$this->sessions = new Sessions($dbConn);
|
||||
$this->loginAttempts = new LoginAttempts($dbConn);
|
||||
$this->recoveryTokens = new RecoveryTokens($dbConn);
|
||||
$this->tfaSessions = new TwoFactorAuthSessions($dbConn);
|
||||
$this->sessions = new SessionsData($dbConn);
|
||||
$this->loginAttempts = new LoginAttemptsData($dbConn);
|
||||
$this->recoveryTokens = new RecoveryTokensData($dbConn);
|
||||
$this->tfaSessions = new TwoFactorAuthSessionsData($dbConn);
|
||||
}
|
||||
|
||||
public function createAuthTokenPacker(): AuthTokenPacker {
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace Misuzu\Auth;
|
|||
use Misuzu\Auth\SessionInfo;
|
||||
use Misuzu\Forum\ForumCategoryInfo;
|
||||
use Misuzu\Perms\IPermissionResult;
|
||||
use Misuzu\Perms\{Permissions,PermissionResult};
|
||||
use Misuzu\Perms\{PermissionsData,PermissionResult};
|
||||
use Misuzu\Users\UserInfo;
|
||||
|
||||
class AuthInfo {
|
||||
|
@ -17,7 +17,7 @@ class AuthInfo {
|
|||
public private(set) array $perms;
|
||||
|
||||
public function __construct(
|
||||
private Permissions $permissions
|
||||
private PermissionsData $permissions
|
||||
) {
|
||||
$this->removeInfo();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ use Misuzu\ClientInfo;
|
|||
use Misuzu\Pagination;
|
||||
use Misuzu\Users\UserInfo;
|
||||
|
||||
class LoginAttempts {
|
||||
class LoginAttemptsData {
|
||||
public const REMAINING_MAX = 5;
|
||||
public const REMAINING_WINDOW = 60 * 60;
|
||||
|
|
@ -9,7 +9,7 @@ use Misuzu\ClientInfo;
|
|||
use Misuzu\Pagination;
|
||||
use Misuzu\Users\UserInfo;
|
||||
|
||||
class RecoveryTokens {
|
||||
class RecoveryTokensData {
|
||||
private DbStatementCache $cache;
|
||||
|
||||
public function __construct(DbConnection $dbConn) {
|
|
@ -9,7 +9,7 @@ use Misuzu\ClientInfo;
|
|||
use Misuzu\Pagination;
|
||||
use Misuzu\Users\UserInfo;
|
||||
|
||||
class Sessions {
|
||||
class SessionsData {
|
||||
private DbStatementCache $cache;
|
||||
|
||||
public function __construct(
|
|
@ -5,7 +5,7 @@ use Index\XString;
|
|||
use Index\Db\{DbConnection,DbStatementCache};
|
||||
use Misuzu\Users\UserInfo;
|
||||
|
||||
class TwoFactorAuthSessions {
|
||||
class TwoFactorAuthSessionsData {
|
||||
private DbStatementCache $cache;
|
||||
|
||||
public function __construct(DbConnection $dbConn) {
|
|
@ -26,11 +26,11 @@ class ChangeInfo {
|
|||
}
|
||||
|
||||
public string $action {
|
||||
get => Changelog::convertFromActionId($this->actionId);
|
||||
get => ChangelogData::convertFromActionId($this->actionId);
|
||||
}
|
||||
|
||||
public string $actionText {
|
||||
get => Changelog::actionText($this->actionId);
|
||||
get => ChangelogData::actionText($this->actionId);
|
||||
}
|
||||
|
||||
public CarbonImmutable $createdAt {
|
||||
|
|
|
@ -8,7 +8,7 @@ use Index\Db\{DbConnection,DbStatementCache,DbTools};
|
|||
use Misuzu\Pagination;
|
||||
use Misuzu\Users\UserInfo;
|
||||
|
||||
class Changelog {
|
||||
class ChangelogData {
|
||||
// not a strict list but useful to have
|
||||
public const ACTIONS = ['add', 'remove', 'update', 'fix', 'import', 'revert'];
|
||||
|
|
@ -9,7 +9,7 @@ use Index\Syndication\FeedBuilder;
|
|||
use Index\Urls\{UrlFormat,UrlRegistry,UrlSource,UrlSourceCommon};
|
||||
use Misuzu\{Pagination,SiteInfo,Template};
|
||||
use Misuzu\Auth\AuthInfo;
|
||||
use Misuzu\Comments\{Comments,CommentsEx};
|
||||
use Misuzu\Comments\{CommentsData,CommentsEx};
|
||||
use Misuzu\Users\UsersContext;
|
||||
|
||||
final class ChangelogRoutes implements RouteHandler, UrlSource {
|
||||
|
@ -18,10 +18,10 @@ final class ChangelogRoutes implements RouteHandler, UrlSource {
|
|||
public function __construct(
|
||||
private SiteInfo $siteInfo,
|
||||
private UrlRegistry $urls,
|
||||
private Changelog $changelog,
|
||||
private ChangelogData $changelog,
|
||||
private UsersContext $usersCtx,
|
||||
private AuthInfo $authInfo,
|
||||
private Comments $comments
|
||||
private CommentsData $comments
|
||||
) {}
|
||||
|
||||
private function getCommentsInfo(string $categoryName): object {
|
||||
|
|
|
@ -7,7 +7,7 @@ use Index\Db\{DbConnection,DbStatementCache};
|
|||
use Misuzu\Pagination;
|
||||
use Misuzu\Users\UserInfo;
|
||||
|
||||
class Comments {
|
||||
class CommentsData {
|
||||
private DbStatementCache $cache;
|
||||
|
||||
public function __construct(DbConnection $dbConn) {
|
|
@ -11,7 +11,7 @@ use Misuzu\Users\UsersContext;
|
|||
class CommentsEx {
|
||||
public function __construct(
|
||||
private AuthInfo $authInfo,
|
||||
private Comments $comments,
|
||||
private CommentsData $comments,
|
||||
private UsersContext $usersCtx
|
||||
) {}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ use Misuzu\Pagination;
|
|||
|
||||
// insert increment and decrement calls in places someday
|
||||
|
||||
class Counters {
|
||||
class CountersData {
|
||||
private DbStatementCache $cache;
|
||||
|
||||
public function __construct(DbConnection $dbConn) {
|
|
@ -5,7 +5,7 @@ use InvalidArgumentException;
|
|||
use RuntimeException;
|
||||
use Index\Db\{DbConnection,DbStatementCache};
|
||||
|
||||
class Emotes {
|
||||
class EmotesData {
|
||||
private const EMOTE_ORDER = [
|
||||
'order' => 'emote_order',
|
||||
'id' => 'emote_id',
|
|
@ -8,7 +8,7 @@ final class EmotesRpcHandler implements RpcHandler {
|
|||
use RpcHandlerCommon;
|
||||
|
||||
public function __construct(
|
||||
private Emotes $emotes
|
||||
private EmotesData $emotes
|
||||
) {}
|
||||
|
||||
/** @return array<array{url: string, strings: string[], id?: string, order?: int, min_rank?: int}> */
|
||||
|
|
|
@ -9,7 +9,7 @@ use Index\Db\{DbConnection,DbStatementCache,DbTools};
|
|||
use Misuzu\Pagination;
|
||||
use Misuzu\Users\UserInfo;
|
||||
|
||||
class ForumCategories {
|
||||
class ForumCategoriesData {
|
||||
private DbStatementCache $cache;
|
||||
|
||||
public function __construct(DbConnection $dbConn) {
|
|
@ -6,10 +6,10 @@ use Index\Db\DbConnection;
|
|||
use Misuzu\Users\UserInfo;
|
||||
|
||||
class ForumContext {
|
||||
public private(set) ForumCategories $categories;
|
||||
public private(set) ForumTopics $topics;
|
||||
public private(set) ForumTopicRedirects $topicRedirects;
|
||||
public private(set) ForumPosts $posts;
|
||||
public private(set) ForumCategoriesData $categories;
|
||||
public private(set) ForumTopicsData $topics;
|
||||
public private(set) ForumTopicRedirectsData $topicRedirects;
|
||||
public private(set) ForumPostsData $posts;
|
||||
|
||||
/** @var array<string, int> */
|
||||
private array $totalUserTopics = [];
|
||||
|
@ -18,10 +18,10 @@ class ForumContext {
|
|||
private array $totalUserPosts = [];
|
||||
|
||||
public function __construct(DbConnection $dbConn) {
|
||||
$this->categories = new ForumCategories($dbConn);
|
||||
$this->topics = new ForumTopics($dbConn);
|
||||
$this->topicRedirects = new ForumTopicRedirects($dbConn);
|
||||
$this->posts = new ForumPosts($dbConn);
|
||||
$this->categories = new ForumCategoriesData($dbConn);
|
||||
$this->topics = new ForumTopicsData($dbConn);
|
||||
$this->topicRedirects = new ForumTopicRedirectsData($dbConn);
|
||||
$this->posts = new ForumPostsData($dbConn);
|
||||
}
|
||||
|
||||
// should be replaced by a static counter
|
||||
|
|
|
@ -9,7 +9,7 @@ use Index\Db\{DbConnection,DbStatementCache,DbTools};
|
|||
use Misuzu\Pagination;
|
||||
use Misuzu\Users\UserInfo;
|
||||
|
||||
class ForumPosts {
|
||||
class ForumPostsData {
|
||||
private DbStatementCache $cache;
|
||||
|
||||
public function __construct(DbConnection $dbConn) {
|
|
@ -6,7 +6,7 @@ use Index\Http\{HttpRequest,HttpResponseBuilder};
|
|||
use Index\Http\Routing\{HttpDelete,HttpGet,HttpPost,RouteHandler,RouteHandlerCommon};
|
||||
use Index\Urls\{UrlFormat,UrlRegistry,UrlSource,UrlSourceCommon};
|
||||
use Misuzu\{CSRF,Perm};
|
||||
use Misuzu\AuditLog\AuditLog;
|
||||
use Misuzu\AuditLog\AuditLogData;
|
||||
use Misuzu\Auth\AuthInfo;
|
||||
use Misuzu\Users\UsersContext;
|
||||
|
||||
|
@ -17,7 +17,7 @@ class ForumPostsRoutes implements RouteHandler, UrlSource {
|
|||
private UrlRegistry $urls,
|
||||
private ForumContext $forum,
|
||||
private UsersContext $usersCtx,
|
||||
private AuditLog $auditLog,
|
||||
private AuditLogData $auditLog,
|
||||
private AuthInfo $authInfo,
|
||||
) {}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ use Index\Db\{DbConnection,DbStatementCache};
|
|||
use Misuzu\Pagination;
|
||||
use Misuzu\Users\UserInfo;
|
||||
|
||||
class ForumTopicRedirects {
|
||||
class ForumTopicRedirectsData {
|
||||
private DbStatementCache $cache;
|
||||
|
||||
public function __construct(DbConnection $dbConn) {
|
|
@ -8,7 +8,7 @@ use Index\Db\{DbConnection,DbStatementCache,DbTools};
|
|||
use Misuzu\Pagination;
|
||||
use Misuzu\Users\UserInfo;
|
||||
|
||||
class ForumTopics {
|
||||
class ForumTopicsData {
|
||||
private DbStatementCache $cache;
|
||||
|
||||
public function __construct(DbConnection $dbConn) {
|
|
@ -7,7 +7,7 @@ use Index\Http\{HttpRequest,HttpResponseBuilder};
|
|||
use Index\Http\Routing\{HttpDelete,HttpGet,HttpPost,RouteHandler,RouteHandlerCommon};
|
||||
use Index\Urls\{UrlFormat,UrlRegistry,UrlSource,UrlSourceCommon};
|
||||
use Misuzu\{CSRF,Pagination,Perm,Template};
|
||||
use Misuzu\AuditLog\AuditLog;
|
||||
use Misuzu\AuditLog\AuditLogData;
|
||||
use Misuzu\Auth\AuthInfo;
|
||||
use Misuzu\Users\UsersContext;
|
||||
|
||||
|
@ -17,7 +17,7 @@ class ForumTopicsRoutes implements RouteHandler, UrlSource {
|
|||
public function __construct(
|
||||
private ForumContext $forum,
|
||||
private UsersContext $usersCtx,
|
||||
private AuditLog $auditLog,
|
||||
private AuditLogData $auditLog,
|
||||
private AuthInfo $authInfo,
|
||||
) {}
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ use Index\Http\Routing\{HttpGet,RouteHandler,RouteHandlerCommon};
|
|||
use Index\Urls\{UrlFormat,UrlSource,UrlSourceCommon};
|
||||
use Misuzu\{Pagination,SiteInfo,Template};
|
||||
use Misuzu\Auth\AuthInfo;
|
||||
use Misuzu\Changelog\Changelog;
|
||||
use Misuzu\Comments\Comments;
|
||||
use Misuzu\Counters\Counters;
|
||||
use Misuzu\News\{News,NewsCategoryInfo,NewsPostInfo};
|
||||
use Misuzu\Changelog\ChangelogData;
|
||||
use Misuzu\Comments\CommentsData;
|
||||
use Misuzu\Counters\CountersData;
|
||||
use Misuzu\News\{NewsData,NewsCategoryInfo,NewsPostInfo};
|
||||
use Misuzu\Users\{UsersContext,UserInfo};
|
||||
|
||||
class HomeRoutes implements RouteHandler, UrlSource {
|
||||
|
@ -25,10 +25,10 @@ class HomeRoutes implements RouteHandler, UrlSource {
|
|||
private DbConnection $dbConn,
|
||||
private SiteInfo $siteInfo,
|
||||
private AuthInfo $authInfo,
|
||||
private Changelog $changelog,
|
||||
private Comments $comments,
|
||||
private Counters $counters,
|
||||
private News $news,
|
||||
private ChangelogData $changelog,
|
||||
private CommentsData $comments,
|
||||
private CountersData $counters,
|
||||
private NewsData $news,
|
||||
private UsersContext $usersCtx
|
||||
) {}
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ namespace Misuzu\Messages;
|
|||
use Index\Db\DbConnection;
|
||||
|
||||
class MessagesContext {
|
||||
public private(set) MessagesDatabase $database;
|
||||
public private(set) MessagesData $database;
|
||||
|
||||
public function __construct(DbConnection $dbConn) {
|
||||
$this->database = new MessagesDatabase($dbConn);
|
||||
$this->database = new MessagesData($dbConn);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ use Index\Db\{DbConnection,DbStatementCache,DbTools};
|
|||
use Misuzu\Pagination;
|
||||
use Misuzu\Users\UserInfo;
|
||||
|
||||
class MessagesDatabase {
|
||||
class MessagesData {
|
||||
private DbStatementCache $cache;
|
||||
|
||||
public function __construct(DbConnection $dbConn) {
|
|
@ -13,7 +13,7 @@ use Index\Urls\{UrlFormat,UrlRegistry,UrlSource,UrlSourceCommon};
|
|||
use Misuzu\{CSRF,Pagination,Perm,Template};
|
||||
use Misuzu\Auth\AuthInfo;
|
||||
use Misuzu\Parsers\Parser;
|
||||
use Misuzu\Perms\Permissions;
|
||||
use Misuzu\Perms\PermissionsData;
|
||||
use Misuzu\Users\{UsersContext,UserInfo};
|
||||
|
||||
class MessagesRoutes implements RouteHandler, UrlSource {
|
||||
|
@ -32,7 +32,7 @@ class MessagesRoutes implements RouteHandler, UrlSource {
|
|||
private AuthInfo $authInfo,
|
||||
private MessagesContext $msgsCtx,
|
||||
private UsersContext $usersCtx,
|
||||
private Permissions $perms
|
||||
private PermissionsData $perms
|
||||
) {}
|
||||
|
||||
private bool $canSendMessages;
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
<?php
|
||||
namespace Misuzu;
|
||||
|
||||
use Misuzu\Template;
|
||||
use Misuzu\Auth\{AuthContext,AuthInfo};
|
||||
use Misuzu\AuditLog\AuditLog;
|
||||
use Misuzu\Changelog\Changelog;
|
||||
use Misuzu\Comments\Comments;
|
||||
use Misuzu\Counters\Counters;
|
||||
use Misuzu\Emoticons\Emotes;
|
||||
use Misuzu\Forum\ForumContext;
|
||||
use Misuzu\Messages\MessagesContext;
|
||||
use Misuzu\News\News;
|
||||
use Misuzu\Perms\Permissions;
|
||||
use Misuzu\Profile\ProfileFields;
|
||||
use Misuzu\Redirects\RedirectsContext;
|
||||
use Misuzu\Routing\BackedRoutingContext;
|
||||
use Misuzu\Users\{UsersContext,UserInfo};
|
||||
use RPCii\HmacVerificationProvider;
|
||||
use RPCii\Server\HttpRpcServer;
|
||||
use Index\Config\Config;
|
||||
use Index\Db\DbConnection;
|
||||
use Index\Db\Migration\{DbMigrationManager,DbMigrationRepo,FsDbMigrationRepo};
|
||||
use Index\Http\HttpRequest;
|
||||
use Index\Templating\TplEnvironment;
|
||||
use Index\Urls\UrlRegistry;
|
||||
use Misuzu\Template;
|
||||
use Misuzu\Auth\{AuthContext,AuthInfo};
|
||||
use Misuzu\AuditLog\AuditLogData;
|
||||
use Misuzu\Changelog\ChangelogData;
|
||||
use Misuzu\Comments\CommentsData;
|
||||
use Misuzu\Counters\CountersData;
|
||||
use Misuzu\Emoticons\EmotesData;
|
||||
use Misuzu\Forum\ForumContext;
|
||||
use Misuzu\Messages\MessagesContext;
|
||||
use Misuzu\News\NewsData;
|
||||
use Misuzu\Perms\PermissionsData;
|
||||
use Misuzu\Profile\ProfileFieldsData;
|
||||
use Misuzu\Redirects\RedirectsContext;
|
||||
use Misuzu\Routing\BackedRoutingContext;
|
||||
use Misuzu\Users\{UsersContext,UserInfo};
|
||||
use RPCii\HmacVerificationProvider;
|
||||
use RPCii\Server\HttpRpcServer;
|
||||
|
||||
// this class should function as the root for everything going forward
|
||||
// no more magical static classes that are just kind of assumed to exist
|
||||
|
@ -34,13 +34,13 @@ use Index\Urls\UrlRegistry;
|
|||
class MisuzuContext {
|
||||
private TplEnvironment $templating;
|
||||
|
||||
public private(set) AuditLog $auditLog;
|
||||
public private(set) Counters $counters;
|
||||
public private(set) AuditLogData $auditLog;
|
||||
public private(set) CountersData $counters;
|
||||
|
||||
public private(set) Emotes $emotes;
|
||||
public private(set) Changelog $changelog;
|
||||
public private(set) News $news;
|
||||
public private(set) Comments $comments;
|
||||
public private(set) EmotesData $emotes;
|
||||
public private(set) ChangelogData $changelog;
|
||||
public private(set) NewsData $news;
|
||||
public private(set) CommentsData $comments;
|
||||
|
||||
public private(set) AuthContext $authCtx;
|
||||
public private(set) ForumContext $forumCtx;
|
||||
|
@ -48,9 +48,9 @@ class MisuzuContext {
|
|||
public private(set) UsersContext $usersCtx;
|
||||
public private(set) RedirectsContext $redirectsCtx;
|
||||
|
||||
public private(set) ProfileFields $profileFields;
|
||||
public private(set) ProfileFieldsData $profileFields;
|
||||
|
||||
public private(set) Permissions $perms;
|
||||
public private(set) PermissionsData $perms;
|
||||
public private(set) AuthInfo $authInfo;
|
||||
public private(set) SiteInfo $siteInfo;
|
||||
|
||||
|
@ -62,7 +62,7 @@ class MisuzuContext {
|
|||
public private(set) Config $config,
|
||||
public private(set) Config $env
|
||||
) {
|
||||
$this->perms = new Permissions($dbConn);
|
||||
$this->perms = new PermissionsData($dbConn);
|
||||
$this->authInfo = new AuthInfo($this->perms);
|
||||
$this->siteInfo = new SiteInfo($config->scopeTo('site'));
|
||||
|
||||
|
@ -72,13 +72,13 @@ class MisuzuContext {
|
|||
$this->usersCtx = new UsersContext($dbConn);
|
||||
$this->redirectsCtx = new RedirectsContext($dbConn, $config->scopeTo('redirects'));
|
||||
|
||||
$this->auditLog = new AuditLog($dbConn);
|
||||
$this->changelog = new Changelog($dbConn);
|
||||
$this->comments = new Comments($dbConn);
|
||||
$this->counters = new Counters($dbConn);
|
||||
$this->emotes = new Emotes($dbConn);
|
||||
$this->news = new News($dbConn);
|
||||
$this->profileFields = new ProfileFields($dbConn);
|
||||
$this->auditLog = new AuditLogData($dbConn);
|
||||
$this->changelog = new ChangelogData($dbConn);
|
||||
$this->comments = new CommentsData($dbConn);
|
||||
$this->counters = new CountersData($dbConn);
|
||||
$this->emotes = new EmotesData($dbConn);
|
||||
$this->news = new NewsData($dbConn);
|
||||
$this->profileFields = new ProfileFieldsData($dbConn);
|
||||
}
|
||||
|
||||
public function getDbQueryCount(): int {
|
||||
|
|
|
@ -9,7 +9,7 @@ use Misuzu\Pagination;
|
|||
use Misuzu\Comments\CommentsCategoryInfo;
|
||||
use Misuzu\Users\UserInfo;
|
||||
|
||||
class News {
|
||||
class NewsData {
|
||||
private DbStatementCache $cache;
|
||||
|
||||
public function __construct(DbConnection $dbConn) {
|
|
@ -9,7 +9,7 @@ use Index\Syndication\FeedBuilder;
|
|||
use Index\Urls\{UrlFormat,UrlRegistry,UrlSource,UrlSourceCommon};
|
||||
use Misuzu\{Pagination,SiteInfo,Template};
|
||||
use Misuzu\Auth\AuthInfo;
|
||||
use Misuzu\Comments\{Comments,CommentsCategory,CommentsEx};
|
||||
use Misuzu\Comments\{CommentsData,CommentsCategory,CommentsEx};
|
||||
use Misuzu\Parsers\Parser;
|
||||
use Misuzu\Users\{UsersContext,UserInfo};
|
||||
|
||||
|
@ -20,9 +20,9 @@ class NewsRoutes implements RouteHandler, UrlSource {
|
|||
private SiteInfo $siteInfo,
|
||||
private AuthInfo $authInfo,
|
||||
private UrlRegistry $urls,
|
||||
private News $news,
|
||||
private NewsData $news,
|
||||
private UsersContext $usersCtx,
|
||||
private Comments $comments
|
||||
private CommentsData $comments
|
||||
) {}
|
||||
|
||||
/** @var array<string, NewsCategoryInfo> */
|
||||
|
|
|
@ -6,10 +6,10 @@ use InvalidArgumentException;
|
|||
use RuntimeException;
|
||||
use Index\XDateTime;
|
||||
use Index\Db\{DbConnection,DbStatement,DbStatementCache,DbTools};
|
||||
use Misuzu\Forum\{ForumCategories,ForumCategoryInfo};
|
||||
use Misuzu\Forum\{ForumCategoriesData,ForumCategoryInfo};
|
||||
use Misuzu\Users\{RoleInfo,UserInfo};
|
||||
|
||||
class Permissions {
|
||||
class PermissionsData {
|
||||
// limiting this to 53-bit in case it ever has to be sent to javascript or any other implicit float language
|
||||
// For More Information: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER
|
||||
// it's still a ways up from the 31-bit of the old permission system which only existed because i developed on a 32-bit laptop for a bit
|
||||
|
@ -228,7 +228,7 @@ class Permissions {
|
|||
*
|
||||
* @param string[] $userIds
|
||||
*/
|
||||
public function precalculatePermissions(ForumCategories $forumCategories, array $userIds = []): void {
|
||||
public function precalculatePermissions(ForumCategoriesData $forumCategories, array $userIds = []): void {
|
||||
$suppliedUsers = !empty($userIds);
|
||||
$doGuest = !$suppliedUsers;
|
||||
|
|
@ -6,7 +6,7 @@ use RuntimeException;
|
|||
use Index\Db\{DbConnection,DbStatementCache,DbTools};
|
||||
use Misuzu\Users\UserInfo;
|
||||
|
||||
class ProfileFields {
|
||||
class ProfileFieldsData {
|
||||
private DbStatementCache $cache;
|
||||
|
||||
public function __construct(DbConnection $dbConn) {
|
|
@ -8,7 +8,7 @@ use Index\Http\{HttpRequest,HttpResponseBuilder};
|
|||
use Index\Http\Routing\{HttpGet,HttpMiddleware,RouteHandler,RouteHandlerCommon};
|
||||
use Misuzu\Pagination;
|
||||
use Misuzu\Forum\ForumContext;
|
||||
use Misuzu\Profile\ProfileFields;
|
||||
use Misuzu\Profile\ProfileFieldsData;
|
||||
use Misuzu\Users\UsersContext;
|
||||
|
||||
final class SatoriRoutes implements RouteHandler {
|
||||
|
@ -18,7 +18,7 @@ final class SatoriRoutes implements RouteHandler {
|
|||
private Config $config,
|
||||
private UsersContext $usersCtx,
|
||||
private ForumContext $forumCtx,
|
||||
private ProfileFields $profileFields
|
||||
private ProfileFieldsData $profileFields
|
||||
) {}
|
||||
|
||||
/** @return void|int */
|
||||
|
|
|
@ -3,10 +3,10 @@ namespace Misuzu\SharpChat;
|
|||
|
||||
use RuntimeException;
|
||||
use Misuzu\Auth\{AuthContext,AuthInfo,Sessions};
|
||||
use Misuzu\Counters\Counters;
|
||||
use Misuzu\Emoticons\Emotes;
|
||||
use Misuzu\Perms\Permissions;
|
||||
use Misuzu\Users\{Bans,UsersContext,UserInfo};
|
||||
use Misuzu\Counters\CountersData;
|
||||
use Misuzu\Emoticons\EmotesData;
|
||||
use Misuzu\Perms\PermissionsData;
|
||||
use Misuzu\Users\{BansData,UsersContext,UserInfo};
|
||||
use Index\Colour\Colour;
|
||||
use Index\Config\Config;
|
||||
use Index\Http\{FormHttpContent,HttpRequest,HttpResponseBuilder};
|
||||
|
@ -24,10 +24,10 @@ final class SharpChatRoutes implements RouteHandler {
|
|||
private UrlRegistry $urls,
|
||||
private UsersContext $usersCtx,
|
||||
private AuthContext $authCtx,
|
||||
private Emotes $emotes,
|
||||
private Permissions $perms,
|
||||
private EmotesData $emotes,
|
||||
private PermissionsData $perms,
|
||||
private AuthInfo $authInfo,
|
||||
private Counters $counters
|
||||
private CountersData $counters
|
||||
) {
|
||||
$this->hashKey = $this->config->getString('hashKey', 'woomy');
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ use DateTimeInterface;
|
|||
use Misuzu\Pagination;
|
||||
use Index\Db\{DbConnection,DbStatementCache,DbTools};
|
||||
|
||||
class Bans {
|
||||
class BansData {
|
||||
public const SEVERITY_MAX = 10;
|
||||
public const SEVERITY_MIN = -10;
|
||||
public const SEVERITY_DEFAULT = 0;
|
|
@ -6,7 +6,7 @@ use RuntimeException;
|
|||
use Index\Db\{DbConnection,DbStatementCache,DbTools};
|
||||
use Misuzu\Pagination;
|
||||
|
||||
class ModNotes {
|
||||
class ModNotesData {
|
||||
private DbStatementCache $cache;
|
||||
|
||||
public function __construct(DbConnection $dbConn) {
|
|
@ -36,7 +36,7 @@ class RoleInfo implements Stringable {
|
|||
}
|
||||
|
||||
public bool $default {
|
||||
get => $this->id === Roles::DEFAULT_ROLE;
|
||||
get => $this->id === RolesData::DEFAULT_ROLE;
|
||||
}
|
||||
|
||||
public bool $hasColour {
|
||||
|
|
|
@ -7,7 +7,7 @@ use Index\Colour\Colour;
|
|||
use Index\Db\{DbConnection,DbStatementCache,DbTools};
|
||||
use Misuzu\Pagination;
|
||||
|
||||
class Roles {
|
||||
class RolesData {
|
||||
public const DEFAULT_ROLE = '1';
|
||||
|
||||
private DbStatementCache $cache;
|
|
@ -62,7 +62,7 @@ class UserInfo {
|
|||
}
|
||||
|
||||
public bool $passwordNeedsRehash {
|
||||
get => $this->hasPasswordHash && Users::passwordNeedsRehash($this->passwordHash);
|
||||
get => $this->hasPasswordHash && UsersData::passwordNeedsRehash($this->passwordHash);
|
||||
}
|
||||
|
||||
public function verifyPassword(string $password): bool {
|
||||
|
|
|
@ -5,11 +5,11 @@ use Index\Colour\Colour;
|
|||
use Index\Db\DbConnection;
|
||||
|
||||
class UsersContext {
|
||||
public private(set) Users $users;
|
||||
public private(set) Roles $roles;
|
||||
public private(set) Bans $bans;
|
||||
public private(set) Warnings $warnings;
|
||||
public private(set) ModNotes $modNotes;
|
||||
public private(set) UsersData $users;
|
||||
public private(set) RolesData $roles;
|
||||
public private(set) BansData $bans;
|
||||
public private(set) WarningsData $warnings;
|
||||
public private(set) ModNotesData $modNotes;
|
||||
|
||||
/** @var array<string, UserInfo> */
|
||||
private array $userInfos = [];
|
||||
|
@ -24,16 +24,16 @@ class UsersContext {
|
|||
private array $activeBans = [];
|
||||
|
||||
public function __construct(DbConnection $dbConn) {
|
||||
$this->users = new Users($dbConn);
|
||||
$this->roles = new Roles($dbConn);
|
||||
$this->bans = new Bans($dbConn);
|
||||
$this->warnings = new Warnings($dbConn);
|
||||
$this->modNotes = new ModNotes($dbConn);
|
||||
$this->users = new UsersData($dbConn);
|
||||
$this->roles = new RolesData($dbConn);
|
||||
$this->bans = new BansData($dbConn);
|
||||
$this->warnings = new WarningsData($dbConn);
|
||||
$this->modNotes = new ModNotesData($dbConn);
|
||||
}
|
||||
|
||||
public function getUserInfo(string $value, int|string|null $select = null): UserInfo {
|
||||
$select = Users::resolveGetUserSelectAlias($select ?? Users::GET_USER_ID);
|
||||
if(($select & Users::GET_USER_ID) > 0 && array_key_exists($value, $this->userInfos))
|
||||
$select = UsersData::resolveGetUserSelectAlias($select ?? UsersData::GET_USER_ID);
|
||||
if(($select & UsersData::GET_USER_ID) > 0 && array_key_exists($value, $this->userInfos))
|
||||
return $this->userInfos[$value];
|
||||
|
||||
$userInfo = $this->users->getUser($value, $select);
|
||||
|
@ -67,7 +67,7 @@ class UsersContext {
|
|||
|
||||
public function tryGetActiveBan(
|
||||
UserInfo|string|null $userInfo = null,
|
||||
int $minimumSeverity = Bans::SEVERITY_MIN
|
||||
int $minimumSeverity = BansData::SEVERITY_MIN
|
||||
): ?BanInfo {
|
||||
if($userInfo === null)
|
||||
return null;
|
||||
|
@ -82,7 +82,7 @@ class UsersContext {
|
|||
|
||||
public function hasActiveBan(
|
||||
UserInfo|string|null $userInfo = null,
|
||||
int $minimumSeverity = Bans::SEVERITY_MIN
|
||||
int $minimumSeverity = BansData::SEVERITY_MIN
|
||||
): bool {
|
||||
return $this->tryGetActiveBan($userInfo, $minimumSeverity) !== null;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ use Misuzu\Pagination;
|
|||
use Misuzu\Tools;
|
||||
use Misuzu\Parsers\Parser;
|
||||
|
||||
class Users {
|
||||
class UsersData {
|
||||
private DbStatementCache $cache;
|
||||
|
||||
public function __construct(DbConnection $dbConn) {
|
||||
|
@ -285,7 +285,7 @@ class Users {
|
|||
if($displayRoleInfo instanceof RoleInfo)
|
||||
$displayRoleInfo = $displayRoleInfo->id;
|
||||
elseif($displayRoleInfo === null)
|
||||
$displayRoleInfo = Roles::DEFAULT_ROLE;
|
||||
$displayRoleInfo = RolesData::DEFAULT_ROLE;
|
||||
|
||||
$password = self::passwordHash($password);
|
||||
|
|
@ -41,7 +41,7 @@ final class UsersRpcHandler implements RpcHandler {
|
|||
#[RpcQuery('misuzu:users:getUser')]
|
||||
public function queryGetUser(string $userId, bool $includeEMailAddress = false): array {
|
||||
try {
|
||||
$userInfo = $this->usersCtx->getUserInfo($userId, Users::GET_USER_ID);
|
||||
$userInfo = $this->usersCtx->getUserInfo($userId, UsersData::GET_USER_ID);
|
||||
} catch(RuntimeException) {
|
||||
return ['error' => 'notfound'];
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ use Misuzu\Pagination;
|
|||
// this system is currently kinda useless because it only silently shows up on profiles
|
||||
// planning a notification system anyway so that should probably hook into
|
||||
|
||||
class Warnings {
|
||||
class WarningsData {
|
||||
public const VISIBLE_BACKLOG = 90 * 24 * 60 * 60;
|
||||
|
||||
private DbStatementCache $cache;
|
Loading…
Add table
Add a link
Reference in a new issue