131 lines
3.6 KiB
PHP
131 lines
3.6 KiB
PHP
<?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());
|
||
}
|
||
}
|
||
}
|