下書き記事
This commit is contained in:
@@ -7,7 +7,7 @@ class BlogPost {
|
||||
*
|
||||
* @return array 投稿の配列
|
||||
*/
|
||||
public function getPosts(string $section, ?\stdClass $user): array {
|
||||
public function getPosts(string $section, ?\stdClass $user = null): array {
|
||||
$path = ROOT.$section;
|
||||
$posts = [];
|
||||
$isMember = $user !== NULL && $user->role !== \Roles::BANNED;
|
||||
@@ -45,6 +45,7 @@ class BlogPost {
|
||||
$articleBody = trim($parts[1]);
|
||||
$preview = mb_substr(strip_tags($articleBody), 0, 50).'...';
|
||||
$slug = basename($file, '.md');
|
||||
if (isset($metadata['draft']) && !$isStaff) continue;
|
||||
|
||||
$posts[] = [
|
||||
'title' => $metadata['title'] ?? '',
|
||||
|
||||
@@ -134,6 +134,7 @@ class Home extends BlogPost {
|
||||
|
||||
if (!$isMember && in_array('memberonly', $meta->category)) goto denyaccess;
|
||||
if (!$isStaff && in_array('staffonly', $meta->category)) goto denyaccess;
|
||||
if (isset($meta->draft) && !$isStaff) goto denyaccess;
|
||||
|
||||
showpage:
|
||||
$tmpl->addCss('news-article');
|
||||
|
||||
@@ -6,7 +6,6 @@ class Auth {
|
||||
|
||||
/**
|
||||
* 性別: -1 = 不明, 0 = 男性, 1 = 女性
|
||||
* ロール: -1 = BAN, 0 = ユーザー, 1 = スタッフ
|
||||
*/
|
||||
private \stdClass $user;
|
||||
private \stdClass $pubUser;
|
||||
|
||||
Reference in New Issue
Block a user