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

29 lines
1003 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
2023-01-15 23:52:38 +00:00
$delete_form = new UOJForm('delete');
2022-11-06 02:26:21 +00:00
$delete_form->handle = function () {
UOJBlog::cur()->delete();
};
2023-01-15 23:52:38 +00:00
$delete_form->config['submit_button']['class'] = 'btn btn-danger';
$delete_form->config['submit_button']['text'] = '是的,我确定要删除';
2022-11-06 02:26:21 +00:00
$delete_form->succ_href = HTML::blog_url(UOJBlog::info('poster'), '/archive');
$delete_form->runAtServer();
?>
<?php echoUOJPageHeader('删除博客 - ' . HTML::stripTags(UOJBlog::info('title'))) ?>
2022-11-06 02:26:21 +00:00
<h1 class="h2 text-center">
2023-01-15 23:52:38 +00:00
您真的要删除博客 <?= 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() ?>