FIX: Доступ к Посту по ссылке

См. https://libarea.ru/post/1541/add-dostup-po-ssylke
This commit is contained in:
Evg 2023-09-26 19:54:05 +03:00
parent b94879f6bb
commit 8844eca665
2 changed files with 21 additions and 0 deletions

View file

@ -44,4 +44,20 @@ class CommentController extends Controller
]
);
}
// On the home page
// На главной странице
public function lastComment()
{
$comments = CommentModel::getComments(1, 5, 'all');
$result = [];
foreach ($comments as $ind => $row) {
$row['content'] = fragment($row['comment_content'], 98);
$row['date'] = Html::langDate($row['comment_date']);
$result[$ind] = $row;
}
return json_encode($result, JSON_PRETTY_PRINT);
}
}

View file

@ -11,6 +11,11 @@ use Hleb\Constructor\Handlers\Request; ?>
<?php endif; ?>
<?php $post_url = post_slug($post['post_id'], $post['post_slug']); ?>
<?php if ($post['post_hidden'] == 1) : ?>
<?php if ($post['post_user_id'] != UserData::getUserId() && !UserData::checkAdmin()) continue; ?>
<?php endif; ?>
<div class="box shadow-bottom article_<?= $post['post_id']; ?>">
<div class="flex justify-between">