S2OJ/web/app/controllers/subdomain/blog/blog_delete.php
Baoshuo 692c512adc
All checks were successful
continuous-integration/drone/push Build is passing
refactor: goodbye, bootstrap 4
2023-02-05 20:55:14 +08:00

28 lines
977 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
requirePHPLib('form');
Auth::check() || redirectToLogin();
UOJBlog::init(UOJRequest::get('id')) || UOJResponse::page404();
UOJBlog::cur()->belongsToUserBlog() || UOJResponse::page404();
UOJBlog::cur()->userCanManage(Auth::user()) || UOJResponse::page403();
$delete_form = new UOJForm('delete');
$delete_form->handle = function () {
UOJBlog::cur()->delete();
};
$delete_form->config['submit_button']['class'] = 'btn btn-danger';
$delete_form->config['submit_button']['text'] = '是的,我确定要删除';
$delete_form->succ_href = HTML::blog_url(UOJBlog::info('poster'), '/archive');
$delete_form->runAtServer();
?>
<?php echoUOJPageHeader('删除博客 - ' . HTML::stripTags(UOJBlog::info('title'))) ?>
<h1 class="h2 text-center">
您真的要删除博客 “<?= UOJBlog::info('title') ?>” <span class="fs-5">(博客 ID: <?= UOJBlog::info('id') ?></span>吗?该操作不可逆!
</h1>
<?php $delete_form->printHTML(); ?>
<?php echoUOJPageFooter() ?>