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