S2OJ/web/app/controllers/subdomain/blog/blog_delete.php

30 lines
1006 B
PHP
Raw Normal View History

2016-07-18 16:39:37 +00:00
<?php
2022-11-06 02:26:21 +00:00
requireLib('bootstrap5');
requirePHPLib('form');
2022-03-17 04:00:03 +00:00
2022-11-06 02:26:21 +00:00
Auth::check() || redirectToLogin();
2022-10-08 06:10:14 +00:00
2022-11-06 02:26:21 +00:00
UOJBlog::init(UOJRequest::get('id')) || UOJResponse::page404();
UOJBlog::cur()->belongsToUserBlog() || UOJResponse::page404();
UOJBlog::cur()->userCanManage(Auth::user()) || UOJResponse::page403();
2022-10-08 06:28:02 +00:00
2022-11-06 02:26:21 +00:00
$delete_form = new UOJBs4Form('delete');
$delete_form->handle = function () {
UOJBlog::cur()->delete();
};
$delete_form->submit_button_config['class_str'] = 'btn btn-danger';
$delete_form->submit_button_config['text'] = '是的,我确定要删除';
$delete_form->succ_href = HTML::blog_url(UOJBlog::info('poster'), '/archive');
2022-11-06 02:26:21 +00:00
$delete_form->runAtServer();
?>
<?php echoUOJPageHeader('删除博客 - ' . HTML::stripTags(UOJBlog::info('title'))) ?>
2022-11-06 02:26:21 +00:00
<h1 class="h2 text-center">
您真的要删除博客 <?= UOJBlog::info('title') ?>” <span class="fs-5">(博客 ID<?= UOJBlog::info('id') ?></span>吗?该操作不可逆!
2022-10-08 06:28:02 +00:00
</h1>
2022-11-06 02:26:21 +00:00
2016-07-18 16:39:37 +00:00
<?php $delete_form->printHTML(); ?>
2022-11-06 02:26:21 +00:00
2016-07-18 16:39:37 +00:00
<?php echoUOJPageFooter() ?>