mirror of
https://github.com/OPSnet/Gazelle.git
synced 2026-01-16 18:04:34 -05:00
41 lines
1010 B
PHP
41 lines
1010 B
PHP
<?php
|
|
/** @phpstan-var \Gazelle\User $Viewer */
|
|
/** @phpstan-var \Twig\Environment $Twig */
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Gazelle;
|
|
|
|
\Text::$TOC = true;
|
|
|
|
$wikiMan = new Manager\Wiki();
|
|
$article = false;
|
|
$error = false;
|
|
if (isset($_GET['id'])) {
|
|
$article = $wikiMan->findById((int)$_GET['id']);
|
|
if (is_null($article)) {
|
|
$error = 'No such wiki article found';
|
|
}
|
|
} elseif (isset($_GET['name'])) {
|
|
$article = $wikiMan->findByAlias($_GET['name']);
|
|
if (is_null($article)) {
|
|
$error = 'No such wiki article with that name found';
|
|
}
|
|
}
|
|
if (!$article) {
|
|
$article = $wikiMan->findById(INDEX_WIKI_PAGE_ID);
|
|
}
|
|
|
|
if (!$article->readable($Viewer)) {
|
|
Error403::error();
|
|
}
|
|
$classList = new Manager\User()->classLevelList();
|
|
|
|
echo $Twig->render('wiki/article.twig', [
|
|
'article' => $article,
|
|
'edit' => $classList[$article->minClassEdit()]['Name'],
|
|
'read' => $classList[$article->minClassRead()]['Name'],
|
|
'error' => $error,
|
|
'viewer' => $Viewer,
|
|
]);
|