This commit is contained in:
E. S. 2024-04-14 00:46:59 +00:00
parent d5dccdc55c
commit 1b8d5934a6
3 changed files with 3 additions and 18 deletions

View File

@ -58,8 +58,6 @@ class MainHandler extends request_handler {
function GET_post() {
global $config;
ensure_admin();
list($name, $input_lang) = input('name, lang');
$lang = null;
@ -74,7 +72,7 @@ class MainHandler extends request_handler {
$lang = PostLanguage::getDefault();
$post = posts::getByName($name);
if (!$post)
if (!$post || (!$post->visible && !is_admin()))
not_found();
if ($lang == PostLanguage::getDefault() && $input_lang == $lang->value)
@ -149,8 +147,6 @@ class MainHandler extends request_handler {
}
function GET_articles() {
ensure_admin();
list($lang) = input('lang');
if ($lang) {
$lang = PostLanguage::tryFrom($lang);

View File

@ -432,15 +432,6 @@ HTML;
}
function books($ctx) {
return <<<HTML
{$ctx->bc([
['text' => $ctx->lang('admin_title'), 'url' => '/admin/'],
['text' => $ctx->lang('admin_books')],
])}
HTML;
}
// ----------------------------------------------------
@ -700,4 +691,4 @@ return <<<HTML
<td>{$unsafe_data}</td>
</tr>
HTML;
}
}

View File

@ -221,9 +221,7 @@ function renderHeader(SkinContext $ctx,
bool $show_subtitle): string {
$icons = svg();
$items = [];
if (is_admin()) {
$items[] = ['url' => '/articles/'.($articles_lang ? '?lang='.$articles_lang : ''), 'label' => 'articles', 'selected' => $section === 'articles'];
}
$items[] = ['url' => '/articles/'.($articles_lang ? '?lang='.$articles_lang : ''), 'label' => 'articles', 'selected' => $section === 'articles'];
$items[] = ['url' => '/files/', 'label' => 'files', 'selected' => $section === 'files'];
$items[] = ['url' => '/info/', 'label' => 'about', 'selected' => $section === 'about'];
if (is_admin())