diff --git a/blog/draft-post.md b/blog/draft-post.md new file mode 100644 index 0000000..ac04b5d --- /dev/null +++ b/blog/draft-post.md @@ -0,0 +1,11 @@ +title: 書き込み中・・・ +uuid: fd0d879a-20e9-41b1-bee9-2729452c9a4c +author: 諏訪子 +date: 2025-12-29 07:50:11 +thumbnail: +thumborient: center +draft: true +category: test +---- +これは下書きの記事です。\ +Roles::ADMINやRoles::STAFFを持っている方以外誰もこの記事をアクセス出来ません。 \ No newline at end of file diff --git a/src/Site/Lib/Auth.php b/src/Site/Lib/Auth.php index c0e1671..549c69b 100644 --- a/src/Site/Lib/Auth.php +++ b/src/Site/Lib/Auth.php @@ -44,7 +44,7 @@ class Auth { } $user->name = namecolor($user); $user->regDate = date('Y年m月d日', $user->regDate); - $user->gender = $user->gender === 0 ? '男' : ($user->gender === 1 ? '女' : '不明'); + $user->gender = $user->gender === \Gender::MALE ? '男' : ($user->gender === \Gender::FEMALE ? '女' : '不明'); $user->role = $user->role & (\Roles::ADMIN | \Roles::STAFF) ? '管理者' : ($user->role === \Roles::BANNED ? 'BANされた' : 'ユーザー'); $user->avatar = '/static/user/'.($user->avatar === '' ? 'noicon.png' : $user->username.'/'.$user->avatar); $user->altName = $user->displayname ?: $user->username; @@ -197,7 +197,7 @@ class Auth { $user->regDate = time(); $user->namecolor = ''; $user->displayname = ''; - $user->gender = -1; + $user->gender = \Gender::UNKNOWN; $user->role = \Roles::MEMBER; $user->tokens = []; diff --git a/util.php b/util.php index f3ba8c3..efe6858 100644 --- a/util.php +++ b/util.php @@ -33,8 +33,19 @@ class Roles { public const int MEMBER = 1 << 0; // 1 public const int NINTENDONDA = 1 << 1; // 2 public const int PLAYSTATIONNDA = 1 << 2; // 4 - public const int STAFF = 1 << 3; // 8 - public const int ADMIN = 1 << 7; // 128 + public const int FULLNDA = 1 << 3; // 8 (NINTENDONDA + PLAYSTATIONNDA) + public const int SUBSCRIBER = 1 << 4; // 16 + public const int NSUBSCRIBER = 1 << 5; // 32 (NINTENDNDA + SUBSCRIBER) + public const int PSUBSCRIBER = 1 << 6; // 64 (PLAYSTATIONNDA + SUBSCRIBER) + public const int FSUBSCRIBER = 1 << 7; // 128 (NINTENDNDA + PLAYSTATIONNDA + SUBSCRIBER) + public const int STAFF = 1 << 8; // 256 + public const int ADMIN = 1 << 9; // 512 +} + +class Gender { + public const int UNKNOWN = -1; // 不明 + public const int MALE = 0; // 男性 + public const int FEMALE = 1; // 女性 } $colorPalette = [ @@ -296,7 +307,7 @@ function namecolor(\stdClass $userData): string { $female = "#F185C9"; $ungender = "#7C60B0"; - $gender = 'color: '.($userData->gender === 0 ? $male : ($userData->gender === 1 ? $female : $ungender)).';'; + $gender = 'color: '.($userData->gender === Gender::MALE ? $male : ($userData->gender === Gender::FEMALE ? $female : $ungender)).';'; $style = $userData->namecolor ?: ($userData->role !== Roles::BANNED ? $gender : 'color: '.$ban.';'); $showname = $userData->displayname ?: $userData->username; @@ -304,7 +315,7 @@ function namecolor(\stdClass $userData): string { $color = "{$showname}"; if ($userData->role & (Roles::ADMIN | Roles::STAFF)) $color .= ""; - $suffix = $userData->gender === 0 ? 'くん' : ($userData->gender === 1 ? 'ちゃん' : 'さん'); + $suffix = $userData->gender === Gender::MALE ? 'くん' : ($userData->gender === Gender::FEMALE ? 'ちゃん' : 'さん'); return $color.$suffix; }