Dotclear

source: admin/blog_del.php @ 3:cf375f1e7b0f

Revision 3:cf375f1e7b0f, 1.8 KB checked in by Dsls <dsls@…>, 13 years ago (diff)

Ported Franck & Kozlika updates for user prefs, dedicated branch

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Dotclear 2.
5#
6# Copyright (c) 2003-2010 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
13require dirname(__FILE__).'/../inc/admin/prepend.php';
14
15dcPage::checkSuper();
16
17$blog_id = '';
18
19if (!empty($_POST['blog_id']))
20{
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     }
32}
33
34# Delete the blog
35if (!$core->error->flag() && $blog_id && !empty($_POST['del']))
36{
37     if (!$core->auth->checkPassword(crypt::hmac(DC_MASTER_KEY,$_POST['pwd']))) {
38          $core->error->add(__('Password verification failed'));
39     } else {
40          try {
41               $core->delBlog($blog_id);
42               http::redirect('blogs.php?del=1');
43          } catch (Exception $e) {
44               $core->error->add($e->getMessage());
45          }
46     }
47}
48
49dcPage::open('Delete a blog');
50
51if (!$core->error->flag())
52{
53     echo
54     '<h2>'.__('Delete a blog').'</h2>'.
55     '<p class="message">'.__('Warning').'</p>'.
56     '<p>'.sprintf(__('You are about to delete the blog %s. Every entry, comment and category will be deleted.'),
57     '<strong>'.$blog_id.'</strong>').'</p>'.
58     '<p>'.__('Please give your password to confirm the blog deletion.').'</p>';
59     
60     echo
61     '<form action="blog_del.php" method="post">'.
62     '<div>'.$core->formNonce().'</div>'.
63     '<p><label>'.__('Your password:').' '.
64     form::password('pwd',20,255).'</label></p>'.
65     '<p><input type="submit" class="delete" name="del" value="'.__('Delete this blog').'" />'.
66     form::hidden('blog_id',$blog_id).'</p>'.
67     '</form>';
68}
69
70dcPage::close();
71?>
Note: See TracBrowser for help on using the repository browser.

Sites map