[0] | 1 | <?php |
---|
[3731] | 2 | /** |
---|
| 3 | * @package Dotclear |
---|
| 4 | * @subpackage Backend |
---|
| 5 | * |
---|
| 6 | * @copyright Olivier Meunier & Association Dotclear |
---|
| 7 | * @copyright GPL-2.0-only |
---|
| 8 | */ |
---|
[0] | 9 | |
---|
[3699] | 10 | require dirname(__FILE__) . '/../inc/admin/prepend.php'; |
---|
[0] | 11 | |
---|
| 12 | dcPage::checkSuper(); |
---|
| 13 | |
---|
[3699] | 14 | $blog_id = ''; |
---|
[500] | 15 | $blog_name = ''; |
---|
[0] | 16 | |
---|
[3699] | 17 | if (!empty($_POST['blog_id'])) { |
---|
| 18 | try { |
---|
| 19 | $rs = $core->getBlog($_POST['blog_id']); |
---|
| 20 | } catch (Exception $e) { |
---|
| 21 | $core->error->add($e->getMessage()); |
---|
| 22 | } |
---|
[2566] | 23 | |
---|
[3699] | 24 | if ($rs->isEmpty()) { |
---|
| 25 | $core->error->add(__('No such blog ID')); |
---|
| 26 | } else { |
---|
| 27 | $blog_id = $rs->blog_id; |
---|
| 28 | $blog_name = $rs->blog_name; |
---|
| 29 | } |
---|
[0] | 30 | } |
---|
| 31 | |
---|
| 32 | # Delete the blog |
---|
[3699] | 33 | if (!$core->error->flag() && $blog_id && !empty($_POST['del'])) { |
---|
| 34 | if (!$core->auth->checkPassword($_POST['pwd'])) { |
---|
| 35 | $core->error->add(__('Password verification failed')); |
---|
| 36 | } else { |
---|
| 37 | try { |
---|
| 38 | $core->delBlog($blog_id); |
---|
| 39 | dcPage::addSuccessNotice(sprintf(__('Blog "%s" successfully deleted'), html::escapeHTML($blog_name))); |
---|
[2189] | 40 | |
---|
[3699] | 41 | $core->adminurl->redirect("admin.blogs"); |
---|
| 42 | } catch (Exception $e) { |
---|
| 43 | $core->error->add($e->getMessage()); |
---|
| 44 | } |
---|
| 45 | } |
---|
[0] | 46 | } |
---|
| 47 | |
---|
[3699] | 48 | dcPage::open(__('Delete a blog'), '', |
---|
| 49 | dcPage::breadcrumb( |
---|
[3874] | 50 | [ |
---|
[3699] | 51 | __('System') => '', |
---|
| 52 | __('Blogs') => $core->adminurl->get("admin.blogs"), |
---|
| 53 | __('Delete a blog') => '' |
---|
[3874] | 54 | ]) |
---|
[1358] | 55 | ); |
---|
[1332] | 56 | |
---|
[3699] | 57 | if (!$core->error->flag()) { |
---|
| 58 | echo |
---|
| 59 | '<div class="warning-msg"><p><strong>' . __('Warning') . '</strong></p>' . |
---|
| 60 | '<p>' . sprintf(__('You are about to delete the blog %s. Every entry, comment and category will be deleted.'), |
---|
| 61 | '<strong>' . $blog_id . ' (' . $blog_name . ')</strong>') . '</p></div>' . |
---|
| 62 | '<p>' . __('Please give your password to confirm the blog deletion.') . '</p>'; |
---|
[2566] | 63 | |
---|
[3699] | 64 | echo |
---|
| 65 | '<form action="' . $core->adminurl->get("admin.blog.del") . '" method="post">' . |
---|
| 66 | '<div>' . $core->formNonce() . '</div>' . |
---|
| 67 | '<p><label for="pwd">' . __('Your password:') . '</label> ' . |
---|
[3874] | 68 | form::password('pwd', 20, 255, ['autocomplete' => 'current-password']) . '</p>' . |
---|
[3699] | 69 | '<p><input type="submit" class="delete" name="del" value="' . __('Delete this blog') . '" />' . |
---|
| 70 | form::hidden('blog_id', $blog_id) . '</p>' . |
---|
| 71 | '</form>'; |
---|
[0] | 72 | } |
---|
| 73 | |
---|
| 74 | dcPage::close(); |
---|