Files
LittleBeast/src/Site/Controller/Page.php
2025-12-29 16:25:29 +09:00

131 lines
3.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace Site\Controller;
use Site\Controller\Mods;
use Site\Lib\Auth;
use Site\Lib\Template;
class Page {
use Mods;
public function about(array $params): void {
try {
$tmpl = new Template('/');
$pagetit = '新ページ';
$description = 'PHPフレームワークについて';
// ユーザー
$auth = new Auth();
$user = $auth->getLoggedInUser();
$tmpl->assign('user', $user);
$tmpl->assign('pagetit', $pagetit);
$tmpl->assign('curPage', 'about');
$tmpl->assign('custCss', false);
$tmpl->assign('menu', $this->getMenu());
$tmpl->assign('description', $description);
$tmpl->render('about');
} catch (\Exception $e) {
throw new \Exception($e->getMessage());
}
}
public function monero(array $params): void {
try {
$tmpl = new Template('/');
$pagetit = 'モネロXMRで支援♡';
$description = 'テクニカル諏訪子ちゃんをモネロで支援♡';
// ユーザー
$auth = new Auth();
$user = $auth->getLoggedInUser();
$tmpl->assign('user', $user);
$tmpl->assign('pagetit', $pagetit);
$tmpl->assign('curPage', 'support');
$tmpl->assign('custCss', true);
$tmpl->assign('menu', $this->getMenu());
$tmpl->assign('description', $description);
$tmpl->addCss('code');
$tmpl->render('monero');
} catch (\Exception $e) {
throw new \Exception($e->getMessage());
}
}
public function secret(array $params): void {
try {
$tmpl = new Template('/');
$pagetit = '秘密のページ';
$description = 'ケロ';
// ユーザー
$auth = new Auth();
$user = $auth->getLoggedInUser();
$tmpl->assign('user', $user);
$tmpl->assign('pagetit', $pagetit);
$tmpl->assign('curPage', 'support');
$tmpl->assign('custCss', false);
$tmpl->assign('menu', $this->getMenu());
$tmpl->assign('description', $description);
$tmpl->render('secret');
} catch (\Exception $e) {
throw new \Exception($e->getMessage());
}
}
public function memberonly(array $params): void {
try {
$tmpl = new Template('/');
$pagetit = 'サインインしたユーザー限定';
$description = 'PHPフレームワークについて';
// ユーザー
$auth = new Auth();
$user = $auth->getLoggedInUser();
$tmpl->assign('user', $user);
$tmpl->assign('pagetit', $pagetit);
$tmpl->assign('curPage', 'memberonly');
$tmpl->assign('custCss', false);
$tmpl->assign('menu', $this->getMenu());
$tmpl->assign('description', $description);
if ($user && $user->role !== \Roles::BANNED) $tmpl->render('memberonly');
else $tmpl->render('nopermission');
} catch (\Exception $e) {
throw new \Exception($e->getMessage());
}
}
public function staffonly(array $params): void {
try {
$tmpl = new Template('/');
$pagetit = 'スタッフ限定';
$description = 'PHPフレームワークについて';
// ユーザー
$auth = new Auth();
$user = $auth->getLoggedInUser();
$tmpl->assign('user', $user);
$tmpl->assign('pagetit', $pagetit);
$tmpl->assign('curPage', 'staffonly');
$tmpl->assign('custCss', false);
$tmpl->assign('menu', $this->getMenu());
$tmpl->assign('description', $description);
if ($user && $user->role & (\Roles::ADMIN | \Roles::STAFF)) $tmpl->render('staffonly');
else $tmpl->render('nopermission');
} catch (\Exception $e) {
throw new \Exception($e->getMessage());
}
}
}