Dotclear

source: admin/blog_del.php @ 1399:cdf556efc5ea

Revision 1399:cdf556efc5ea, 2.0 KB checked in by Anne Kozlika <kozlika@…>, 11 years ago (diff)

Semantic xhtml and a11y. Let labels to be labels. Step One: admin. Plugins and Themes will come later.

Line 
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
13require dirname(__FILE__).'/../inc/admin/prepend.php';
14
15dcPage::checkSuper();
16
17$blog_id = '';
18$blog_name = '';
19
20if (!empty($_POST['blog_id']))
21{
22     try {
23          $rs = $core->getBlog($_POST['blog_id']);
24     } catch (Exception $e) {
25          $core->error->add($e->getMessage());
26     }
27     
28     if ($rs->isEmpty()) {
29          $core->error->add(__('No such blog ID'));
30     } else {
31          $blog_id = $rs->blog_id;
32          $blog_name = $rs->blog_name;
33     }
34}
35
36# Delete the blog
37if (!$core->error->flag() && $blog_id && !empty($_POST['del']))
38{
39     if (!$core->auth->checkPassword(crypt::hmac(DC_MASTER_KEY,$_POST['pwd']))) {
40          $core->error->add(__('Password verification failed'));
41     } else {
42          try {
43               $core->delBlog($blog_id);
44               http::redirect('blogs.php?del=1');
45          } catch (Exception $e) {
46               $core->error->add($e->getMessage());
47          }
48     }
49}
50
51dcPage::open(__('Delete a blog'),'',
52     dcPage::breadcrumb(
53          array(
54               __('System') => '',
55               __('Blogs') => 'blogs.php',
56               '<span class="page-title">'.__('Delete a blog').'</span>' => ''
57          ))
58);
59
60if (!$core->error->flag())
61{
62     echo
63     '<p class="message">'.__('Warning').'</p>'.
64     '<p>'.sprintf(__('You are about to delete the blog %s. Every entry, comment and category will be deleted.'),
65     '<strong>'.$blog_id.' ('.$blog_name.')</strong>').'</p>'.
66     '<p>'.__('Please give your password to confirm the blog deletion.').'</p>';
67     
68     echo
69     '<form action="blog_del.php" method="post">'.
70     '<div>'.$core->formNonce().'</div>'.
71     '<p><label for="pwd">'.__('Your password:').'</label> '.
72     form::password('pwd',20,255).'</p>'.
73     '<p><input type="submit" class="delete" name="del" value="'.__('Delete this blog').'" />'.
74     form::hidden('blog_id',$blog_id).'</p>'.
75     '</form>';
76}
77
78dcPage::close();
79?>
Note: See TracBrowser for help on using the repository browser.

Sites map