2022-09-13 13:14:49 +00:00
|
|
|
<?php
|
|
|
|
namespace Misuzu;
|
|
|
|
|
2023-08-04 20:51:02 +00:00
|
|
|
use Index\Data\IDbConnection;
|
|
|
|
use Index\Data\Migration\IDbMigrationRepo;
|
|
|
|
use Index\Data\Migration\DbMigrationManager;
|
|
|
|
use Index\Data\Migration\FsDbMigrationRepo;
|
|
|
|
use Index\Http\HttpFx;
|
|
|
|
use Index\Http\HttpRequest;
|
|
|
|
use Index\Routing\Router;
|
2022-09-13 13:14:49 +00:00
|
|
|
use Misuzu\Template;
|
2023-08-03 01:35:08 +00:00
|
|
|
use Misuzu\Auth\AuthInfo;
|
|
|
|
use Misuzu\Auth\AuthTokenPacker;
|
2023-07-22 16:37:57 +00:00
|
|
|
use Misuzu\Auth\LoginAttempts;
|
2023-07-22 21:20:03 +00:00
|
|
|
use Misuzu\Auth\RecoveryTokens;
|
2023-07-28 20:06:12 +00:00
|
|
|
use Misuzu\Auth\Sessions;
|
2023-07-27 12:44:50 +00:00
|
|
|
use Misuzu\Auth\TwoFactorAuthSessions;
|
2023-07-17 17:43:17 +00:00
|
|
|
use Misuzu\AuditLog\AuditLog;
|
2023-07-15 02:05:49 +00:00
|
|
|
use Misuzu\Changelog\Changelog;
|
2023-08-04 20:51:02 +00:00
|
|
|
use Misuzu\Changelog\ChangelogRoutes;
|
2023-07-15 23:58:17 +00:00
|
|
|
use Misuzu\Comments\Comments;
|
2023-01-01 20:33:32 +00:00
|
|
|
use Misuzu\Config\IConfig;
|
2023-07-28 23:17:33 +00:00
|
|
|
use Misuzu\Counters\Counters;
|
2023-07-12 21:52:55 +00:00
|
|
|
use Misuzu\Emoticons\Emotes;
|
2023-08-28 01:17:34 +00:00
|
|
|
use Misuzu\Forum\Forum;
|
2023-08-04 20:51:02 +00:00
|
|
|
use Misuzu\Home\HomeRoutes;
|
|
|
|
use Misuzu\Info\InfoRoutes;
|
2023-07-15 17:02:46 +00:00
|
|
|
use Misuzu\News\News;
|
2023-08-04 20:51:02 +00:00
|
|
|
use Misuzu\News\NewsRoutes;
|
2023-07-29 22:18:20 +00:00
|
|
|
use Misuzu\Profile\ProfileFields;
|
|
|
|
use Misuzu\Satori\SatoriRoutes;
|
2022-09-13 13:14:49 +00:00
|
|
|
use Misuzu\SharpChat\SharpChatRoutes;
|
2023-07-26 18:19:46 +00:00
|
|
|
use Misuzu\Users\Bans;
|
|
|
|
use Misuzu\Users\BanInfo;
|
2023-07-25 14:40:31 +00:00
|
|
|
use Misuzu\Users\ModNotes;
|
2023-07-27 23:26:05 +00:00
|
|
|
use Misuzu\Users\Roles;
|
|
|
|
use Misuzu\Users\Users;
|
2023-08-02 22:12:47 +00:00
|
|
|
use Misuzu\Users\UserInfo;
|
2023-07-26 22:43:50 +00:00
|
|
|
use Misuzu\Users\Warnings;
|
2023-08-04 20:51:02 +00:00
|
|
|
use Misuzu\Users\Assets\AssetsRoutes;
|
2022-09-13 13:14:49 +00:00
|
|
|
|
|
|
|
// this class should function as the root for everything going forward
|
|
|
|
// no more magical static classes that are just kind of assumed to exist
|
|
|
|
// it currently looks Pretty Messy, but most everything else will be holding instances of other classes
|
2023-07-22 16:37:57 +00:00
|
|
|
// instances of certain classes should only be made as needed,
|
|
|
|
// dunno if i want null checks some maybe some kind of init func should be called first like is the case
|
|
|
|
// with the http shit
|
2023-01-06 20:35:03 +00:00
|
|
|
class MisuzuContext {
|
2023-01-01 19:06:01 +00:00
|
|
|
private IDbConnection $dbConn;
|
2023-01-01 20:23:53 +00:00
|
|
|
private IConfig $config;
|
2022-09-13 13:14:49 +00:00
|
|
|
private HttpFx $router;
|
2023-07-17 17:43:17 +00:00
|
|
|
private AuditLog $auditLog;
|
2023-07-12 21:52:55 +00:00
|
|
|
private Emotes $emotes;
|
2023-07-15 02:05:49 +00:00
|
|
|
private Changelog $changelog;
|
2023-07-15 17:02:46 +00:00
|
|
|
private News $news;
|
2023-07-15 23:58:17 +00:00
|
|
|
private Comments $comments;
|
2023-07-22 16:37:57 +00:00
|
|
|
private LoginAttempts $loginAttempts;
|
2023-07-22 21:20:03 +00:00
|
|
|
private RecoveryTokens $recoveryTokens;
|
2023-07-25 14:40:31 +00:00
|
|
|
private ModNotes $modNotes;
|
2023-07-26 18:19:46 +00:00
|
|
|
private Bans $bans;
|
2023-07-26 22:43:50 +00:00
|
|
|
private Warnings $warnings;
|
2023-07-27 12:44:50 +00:00
|
|
|
private TwoFactorAuthSessions $tfaSessions;
|
2023-07-27 23:26:05 +00:00
|
|
|
private Roles $roles;
|
|
|
|
private Users $users;
|
2023-07-28 20:06:12 +00:00
|
|
|
private Sessions $sessions;
|
2023-07-28 23:17:33 +00:00
|
|
|
private Counters $counters;
|
2023-07-29 22:18:20 +00:00
|
|
|
private ProfileFields $profileFields;
|
2023-08-28 01:17:34 +00:00
|
|
|
private Forum $forum;
|
2023-08-03 01:35:08 +00:00
|
|
|
private AuthInfo $authInfo;
|
2022-09-13 13:14:49 +00:00
|
|
|
|
2023-01-01 20:23:53 +00:00
|
|
|
public function __construct(IDbConnection $dbConn, IConfig $config) {
|
2023-01-01 19:06:01 +00:00
|
|
|
$this->dbConn = $dbConn;
|
2023-01-01 20:23:53 +00:00
|
|
|
$this->config = $config;
|
2023-07-17 17:43:17 +00:00
|
|
|
$this->auditLog = new AuditLog($this->dbConn);
|
2023-08-28 01:17:34 +00:00
|
|
|
$this->authInfo = new AuthInfo;
|
|
|
|
$this->bans = new Bans($this->dbConn);
|
2023-07-15 02:05:49 +00:00
|
|
|
$this->changelog = new Changelog($this->dbConn);
|
2023-07-15 23:58:17 +00:00
|
|
|
$this->comments = new Comments($this->dbConn);
|
2023-08-28 01:17:34 +00:00
|
|
|
$this->counters = new Counters($this->dbConn);
|
|
|
|
$this->emotes = new Emotes($this->dbConn);
|
|
|
|
$this->forum = new Forum($this->dbConn);
|
2023-07-22 16:37:57 +00:00
|
|
|
$this->loginAttempts = new LoginAttempts($this->dbConn);
|
2023-07-25 14:40:31 +00:00
|
|
|
$this->modNotes = new ModNotes($this->dbConn);
|
2023-08-28 01:17:34 +00:00
|
|
|
$this->news = new News($this->dbConn);
|
|
|
|
$this->profileFields = new ProfileFields($this->dbConn);
|
|
|
|
$this->recoveryTokens = new RecoveryTokens($this->dbConn);
|
2023-07-27 23:26:05 +00:00
|
|
|
$this->roles = new Roles($this->dbConn);
|
2023-07-28 20:06:12 +00:00
|
|
|
$this->sessions = new Sessions($this->dbConn);
|
2023-08-28 01:17:34 +00:00
|
|
|
$this->tfaSessions = new TwoFactorAuthSessions($this->dbConn);
|
|
|
|
$this->users = new Users($this->dbConn);
|
|
|
|
$this->warnings = new Warnings($this->dbConn);
|
2023-01-01 19:06:01 +00:00
|
|
|
}
|
|
|
|
|
2023-07-10 22:52:30 +00:00
|
|
|
public function getDbConn(): IDbConnection {
|
|
|
|
return $this->dbConn;
|
|
|
|
}
|
|
|
|
|
2023-01-01 19:06:01 +00:00
|
|
|
public function getDbQueryCount(): int {
|
|
|
|
$result = $this->dbConn->query('SHOW SESSION STATUS LIKE "Questions"');
|
2023-07-15 17:15:40 +00:00
|
|
|
return $result->next() ? $result->getInteger(1) : 0;
|
2022-09-13 13:14:49 +00:00
|
|
|
}
|
|
|
|
|
2023-01-07 04:15:19 +00:00
|
|
|
public function createMigrationManager(): DbMigrationManager {
|
|
|
|
return new DbMigrationManager($this->dbConn, 'msz_' . DbMigrationManager::DEFAULT_TABLE);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function createMigrationRepo(): IDbMigrationRepo {
|
|
|
|
return new FsDbMigrationRepo(MSZ_MIGRATIONS);
|
|
|
|
}
|
|
|
|
|
2023-01-01 20:23:53 +00:00
|
|
|
public function getConfig(): IConfig {
|
|
|
|
return $this->config;
|
|
|
|
}
|
|
|
|
|
2022-09-13 13:14:49 +00:00
|
|
|
public function getRouter(): Router {
|
|
|
|
return $this->router->getRouter();
|
|
|
|
}
|
|
|
|
|
2023-07-12 21:52:55 +00:00
|
|
|
public function getEmotes(): Emotes {
|
|
|
|
return $this->emotes;
|
|
|
|
}
|
|
|
|
|
2023-07-15 02:05:49 +00:00
|
|
|
public function getChangelog(): Changelog {
|
|
|
|
return $this->changelog;
|
|
|
|
}
|
|
|
|
|
2023-07-15 17:02:46 +00:00
|
|
|
public function getNews(): News {
|
|
|
|
return $this->news;
|
|
|
|
}
|
|
|
|
|
2023-07-15 23:58:17 +00:00
|
|
|
public function getComments(): Comments {
|
|
|
|
return $this->comments;
|
|
|
|
}
|
|
|
|
|
2023-07-17 17:43:17 +00:00
|
|
|
public function getAuditLog(): AuditLog {
|
|
|
|
return $this->auditLog;
|
|
|
|
}
|
|
|
|
|
2023-07-22 16:37:57 +00:00
|
|
|
public function getLoginAttempts(): LoginAttempts {
|
|
|
|
return $this->loginAttempts;
|
|
|
|
}
|
|
|
|
|
2023-07-22 21:20:03 +00:00
|
|
|
public function getRecoveryTokens(): RecoveryTokens {
|
|
|
|
return $this->recoveryTokens;
|
|
|
|
}
|
|
|
|
|
2023-07-25 14:40:31 +00:00
|
|
|
public function getModNotes(): ModNotes {
|
|
|
|
return $this->modNotes;
|
|
|
|
}
|
|
|
|
|
2023-07-26 18:19:46 +00:00
|
|
|
public function getBans(): Bans {
|
|
|
|
return $this->bans;
|
|
|
|
}
|
|
|
|
|
2023-07-26 22:43:50 +00:00
|
|
|
public function getWarnings(): Warnings {
|
|
|
|
return $this->warnings;
|
|
|
|
}
|
|
|
|
|
2023-07-27 12:44:50 +00:00
|
|
|
public function getTFASessions(): TwoFactorAuthSessions {
|
|
|
|
return $this->tfaSessions;
|
|
|
|
}
|
|
|
|
|
2023-07-27 23:26:05 +00:00
|
|
|
public function getRoles(): Roles {
|
|
|
|
return $this->roles;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getUsers(): Users {
|
|
|
|
return $this->users;
|
|
|
|
}
|
|
|
|
|
2023-07-28 20:06:12 +00:00
|
|
|
public function getSessions(): Sessions {
|
|
|
|
return $this->sessions;
|
|
|
|
}
|
|
|
|
|
2023-07-28 23:17:33 +00:00
|
|
|
public function getCounters(): Counters {
|
|
|
|
return $this->counters;
|
|
|
|
}
|
|
|
|
|
2023-07-29 22:18:20 +00:00
|
|
|
public function getProfileFields(): ProfileFields {
|
|
|
|
return $this->profileFields;
|
|
|
|
}
|
|
|
|
|
2023-08-28 01:17:34 +00:00
|
|
|
public function getForum(): Forum {
|
|
|
|
return $this->forum;
|
|
|
|
}
|
|
|
|
|
2023-08-03 01:35:08 +00:00
|
|
|
public function createAuthTokenPacker(): AuthTokenPacker {
|
|
|
|
return new AuthTokenPacker($this->config->getString('auth.secret', 'meow'));
|
2023-08-02 22:12:47 +00:00
|
|
|
}
|
|
|
|
|
2023-08-03 01:35:08 +00:00
|
|
|
public function getAuthInfo(): AuthInfo {
|
|
|
|
return $this->authInfo;
|
2023-08-02 22:12:47 +00:00
|
|
|
}
|
|
|
|
|
2023-08-03 01:35:08 +00:00
|
|
|
// isLoggedIn and getActiveUser are proxied for convenience, supply authInfo to things in the future
|
2023-08-02 22:12:47 +00:00
|
|
|
public function isLoggedIn(): bool {
|
2023-08-03 01:35:08 +00:00
|
|
|
return $this->authInfo->isLoggedIn();
|
2023-08-02 22:12:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getActiveUser(): ?UserInfo {
|
2023-08-03 01:35:08 +00:00
|
|
|
return $this->authInfo->getUserInfo();
|
2023-08-02 22:12:47 +00:00
|
|
|
}
|
|
|
|
|
2023-07-26 18:19:46 +00:00
|
|
|
private array $activeBansCache = [];
|
|
|
|
|
2023-08-02 22:12:47 +00:00
|
|
|
public function tryGetActiveBan(UserInfo|string|null $userInfo = null): ?BanInfo {
|
2023-07-26 18:19:46 +00:00
|
|
|
if($userInfo === null) {
|
2023-08-02 22:12:47 +00:00
|
|
|
if($this->isLoggedIn())
|
|
|
|
$userInfo = $this->getActiveUser();
|
2023-07-26 18:19:46 +00:00
|
|
|
else return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
$userId = (string)$userInfo->getId();
|
|
|
|
if(array_key_exists($userId, $this->activeBansCache))
|
|
|
|
return $this->activeBansCache[$userId];
|
|
|
|
|
|
|
|
return $this->activeBansCache[$userId] = $this->bans->tryGetActiveBan($userId);
|
|
|
|
}
|
|
|
|
|
2023-08-02 22:12:47 +00:00
|
|
|
public function hasActiveBan(UserInfo|string|null $userInfo = null): bool {
|
2023-07-26 18:19:46 +00:00
|
|
|
return $this->tryGetActiveBan($userInfo) !== null;
|
|
|
|
}
|
|
|
|
|
2023-08-02 22:12:47 +00:00
|
|
|
public function createAuditLog(string $action, array $params = [], UserInfo|string|null $userInfo = null): void {
|
|
|
|
if($userInfo === null && $this->isLoggedIn())
|
|
|
|
$userInfo = $this->getActiveUser();
|
2023-07-17 17:43:17 +00:00
|
|
|
|
|
|
|
$this->auditLog->createLog(
|
|
|
|
$userInfo,
|
|
|
|
$action,
|
|
|
|
$params,
|
|
|
|
$_SERVER['REMOTE_ADDR'] ?? '::1',
|
|
|
|
$_SERVER['COUNTRY_CODE'] ?? 'XX'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-08-02 22:12:47 +00:00
|
|
|
public function getHeaderMenu(?UserInfo $userInfo): array {
|
|
|
|
$hasUserInfo = $userInfo?->isDeleted() === false;
|
|
|
|
$menu = [];
|
|
|
|
|
|
|
|
$home = [
|
|
|
|
'title' => 'Home',
|
|
|
|
'url' => url('index'),
|
|
|
|
'menu' => [],
|
|
|
|
];
|
|
|
|
|
|
|
|
if($hasUserInfo)
|
|
|
|
$home['menu'][] = [
|
|
|
|
'title' => 'Members',
|
|
|
|
'url' => url('user-list'),
|
|
|
|
];
|
|
|
|
|
|
|
|
$home['menu'][] = [
|
|
|
|
'title' => 'Changelog',
|
|
|
|
'url' => url('changelog-index'),
|
|
|
|
];
|
|
|
|
$home['menu'][] = [
|
|
|
|
'title' => 'Contact',
|
|
|
|
'url' => url('info', ['title' => 'contact']),
|
|
|
|
];
|
|
|
|
$home['menu'][] = [
|
|
|
|
'title' => 'Rules',
|
|
|
|
'url' => url('info', ['title' => 'rules']),
|
|
|
|
];
|
|
|
|
|
|
|
|
$menu[] = $home;
|
|
|
|
|
|
|
|
$menu[] = [
|
|
|
|
'title' => 'News',
|
|
|
|
'url' => url('news-index'),
|
|
|
|
];
|
|
|
|
|
|
|
|
$forum = [
|
|
|
|
'title' => 'Forum',
|
|
|
|
'url' => url('forum-index'),
|
|
|
|
'menu' => [],
|
|
|
|
];
|
|
|
|
|
|
|
|
if($hasUserInfo && perms_check_user(MSZ_PERMS_GENERAL, $userInfo->getId(), MSZ_PERM_FORUM_VIEW_LEADERBOARD))
|
|
|
|
$forum['menu'][] = [
|
|
|
|
'title' => 'Leaderboard',
|
|
|
|
'url' => url('forum-leaderboard'),
|
|
|
|
];
|
|
|
|
|
|
|
|
$menu[] = $forum;
|
|
|
|
|
|
|
|
$chatPath = $this->config->getString('sockChat.chatPath.normal');
|
|
|
|
if(!empty($chatPath))
|
|
|
|
$menu[] = [
|
|
|
|
'title' => 'Chat',
|
|
|
|
'url' => $chatPath,
|
|
|
|
];
|
|
|
|
|
|
|
|
return $menu;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getUserMenu(?UserInfo $userInfo, bool $inBroomCloset): array {
|
|
|
|
$menu = [];
|
|
|
|
|
|
|
|
if($userInfo === null) {
|
|
|
|
$menu[] = [
|
|
|
|
'title' => 'Register',
|
|
|
|
'url' => url('auth-register'),
|
|
|
|
'icon' => 'fas fa-user-plus fa-fw',
|
|
|
|
];
|
|
|
|
$menu[] = [
|
|
|
|
'title' => 'Log in',
|
|
|
|
'url' => url('auth-login'),
|
|
|
|
'icon' => 'fas fa-sign-in-alt fa-fw',
|
|
|
|
];
|
|
|
|
} else {
|
|
|
|
$menu[] = [
|
|
|
|
'title' => 'Profile',
|
|
|
|
'url' => url('user-profile', ['user' => $userInfo->getId()]),
|
|
|
|
'icon' => 'fas fa-user fa-fw',
|
|
|
|
];
|
|
|
|
$menu[] = [
|
|
|
|
'title' => 'Settings',
|
|
|
|
'url' => url('settings-index'),
|
|
|
|
'icon' => 'fas fa-cog fa-fw',
|
|
|
|
];
|
|
|
|
$menu[] = [
|
|
|
|
'title' => 'Search',
|
|
|
|
'url' => url('search-index'),
|
|
|
|
'icon' => 'fas fa-search fa-fw',
|
|
|
|
];
|
|
|
|
|
|
|
|
if(!$this->hasActiveBan($userInfo) && perms_check_user(MSZ_PERMS_GENERAL, $userInfo->getId(), MSZ_PERM_GENERAL_CAN_MANAGE)) {
|
|
|
|
// restore behaviour where clicking this button switches between
|
|
|
|
// site version and broom version
|
|
|
|
if($inBroomCloset)
|
|
|
|
$menu[] = [
|
|
|
|
'title' => 'Exit Broom Closet',
|
|
|
|
'url' => url('index'),
|
|
|
|
'icon' => 'fas fa-door-open fa-fw',
|
|
|
|
];
|
|
|
|
else
|
|
|
|
$menu[] = [
|
|
|
|
'title' => 'Enter Broom Closet',
|
|
|
|
'url' => url('manage-index'),
|
|
|
|
'icon' => 'fas fa-door-closed fa-fw',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
$menu[] = [
|
|
|
|
'title' => 'Log out',
|
|
|
|
'url' => url('auth-logout'),
|
|
|
|
'icon' => 'fas fa-sign-out-alt fa-fw',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
return $menu;
|
|
|
|
}
|
|
|
|
|
2023-08-04 20:51:02 +00:00
|
|
|
public function setUpHttp(): void {
|
2022-09-13 13:14:49 +00:00
|
|
|
$this->router = new HttpFx;
|
|
|
|
$this->router->use('/', function($response) {
|
|
|
|
$response->setPoweredBy('Misuzu');
|
|
|
|
});
|
|
|
|
|
|
|
|
$this->registerErrorPages();
|
2023-08-04 20:51:02 +00:00
|
|
|
$this->registerHttpRoutes();
|
2022-09-13 13:14:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function dispatchHttp(?HttpRequest $request = null): void {
|
|
|
|
$this->router->dispatch($request);
|
|
|
|
}
|
|
|
|
|
|
|
|
private function registerErrorPages(): void {
|
|
|
|
$this->router->addErrorHandler(400, function($response) {
|
|
|
|
$response->setContent(Template::renderRaw('errors.400'));
|
|
|
|
});
|
|
|
|
$this->router->addErrorHandler(403, function($response) {
|
|
|
|
$response->setContent(Template::renderRaw('errors.403'));
|
|
|
|
});
|
|
|
|
$this->router->addErrorHandler(404, function($response) {
|
|
|
|
$response->setContent(Template::renderRaw('errors.404'));
|
|
|
|
});
|
|
|
|
$this->router->addErrorHandler(500, function($response) {
|
|
|
|
$response->setContent(file_get_contents(MSZ_TEMPLATES . '/500.html'));
|
|
|
|
});
|
|
|
|
$this->router->addErrorHandler(503, function($response) {
|
|
|
|
$response->setContent(file_get_contents(MSZ_TEMPLATES . '/503.html'));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
private function registerHttpRoutes(): void {
|
2023-08-04 20:51:02 +00:00
|
|
|
new HomeRoutes(
|
|
|
|
$this->router, $this->config, $this->dbConn, $this->authInfo,
|
|
|
|
$this->changelog, $this->comments, $this->counters, $this->news,
|
|
|
|
$this->users
|
|
|
|
);
|
2022-09-13 13:14:49 +00:00
|
|
|
|
2023-08-04 20:51:02 +00:00
|
|
|
new AssetsRoutes($this->router, $this->authInfo, $this->bans, $this->users);
|
2022-09-13 13:14:49 +00:00
|
|
|
|
2023-08-04 20:51:02 +00:00
|
|
|
new InfoRoutes($this->router);
|
2022-09-13 13:14:49 +00:00
|
|
|
|
2023-08-04 20:51:02 +00:00
|
|
|
new NewsRoutes(
|
|
|
|
$this->router, $this->config, $this->authInfo,
|
|
|
|
$this->news, $this->users, $this->comments
|
|
|
|
);
|
2022-09-13 13:14:49 +00:00
|
|
|
|
2023-08-04 20:51:02 +00:00
|
|
|
new ChangelogRoutes(
|
|
|
|
$this->router, $this->config, $this->changelog,
|
|
|
|
$this->users, $this->authInfo, $this->comments
|
|
|
|
);
|
2022-09-13 13:14:49 +00:00
|
|
|
|
2023-08-04 20:51:02 +00:00
|
|
|
new SharpChatRoutes(
|
|
|
|
$this->router, $this->config->scopeTo('sockChat'),
|
|
|
|
$this->bans, $this->emotes, $this->users,
|
|
|
|
$this->sessions, $this->authInfo,
|
|
|
|
$this->createAuthTokenPacker(...)
|
|
|
|
);
|
2022-09-13 13:14:49 +00:00
|
|
|
|
2023-08-04 20:51:02 +00:00
|
|
|
new SatoriRoutes(
|
|
|
|
$this->dbConn, $this->config->scopeTo('satori'),
|
|
|
|
$this->router, $this->users, $this->profileFields
|
|
|
|
);
|
2022-09-13 13:14:49 +00:00
|
|
|
|
2023-08-04 20:51:02 +00:00
|
|
|
// below is still only otherwise available as stinky php files
|
2022-09-13 13:14:49 +00:00
|
|
|
|
|
|
|
$this->router->get('/auth.php', function($response, $request) {
|
|
|
|
$response->redirect(url([
|
|
|
|
'logout' => 'auth-logout',
|
|
|
|
'reset' => 'auth-reset',
|
|
|
|
'forgot' => 'auth-forgot',
|
|
|
|
'register' => 'auth-register',
|
|
|
|
][$request->getParam('m')] ?? 'auth-login'), true);
|
|
|
|
});
|
|
|
|
|
2023-08-04 20:51:02 +00:00
|
|
|
$this->router->get('/settings.php', function($response) {
|
|
|
|
$response->redirect(url('settings-index'), true);
|
2022-09-13 13:14:49 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|