| [0] | 1 | <?php | 
|---|
|  | 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- | 
|---|
|  | 3 | # | 
|---|
|  | 4 | # This file is part of Dotclear 2. | 
|---|
|  | 5 | # | 
|---|
| [1179] | 6 | # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear | 
|---|
| [0] | 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 = ''; | 
|---|
| [500] | 18 | $blog_name = ''; | 
|---|
| [0] | 19 |  | 
|---|
|  | 20 | if (!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 | } | 
|---|
| [2566] | 27 |  | 
|---|
| [0] | 28 | if ($rs->isEmpty()) { | 
|---|
|  | 29 | $core->error->add(__('No such blog ID')); | 
|---|
|  | 30 | } else { | 
|---|
|  | 31 | $blog_id = $rs->blog_id; | 
|---|
| [500] | 32 | $blog_name = $rs->blog_name; | 
|---|
| [0] | 33 | } | 
|---|
|  | 34 | } | 
|---|
|  | 35 |  | 
|---|
|  | 36 | # Delete the blog | 
|---|
|  | 37 | if (!$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); | 
|---|
| [2189] | 44 | dcPage::addSuccessNotice(sprintf(__('Blog "%s" successfully deleted'), html::escapeHTML($blog_name))); | 
|---|
|  | 45 |  | 
|---|
| [2852] | 46 | $core->adminurl->redirect("admin.blogs"); | 
|---|
| [0] | 47 | } catch (Exception $e) { | 
|---|
|  | 48 | $core->error->add($e->getMessage()); | 
|---|
|  | 49 | } | 
|---|
|  | 50 | } | 
|---|
|  | 51 | } | 
|---|
|  | 52 |  | 
|---|
| [1358] | 53 | dcPage::open(__('Delete a blog'),'', | 
|---|
| [1334] | 54 | dcPage::breadcrumb( | 
|---|
| [1332] | 55 | array( | 
|---|
|  | 56 | __('System') => '', | 
|---|
| [2720] | 57 | __('Blogs') => $core->adminurl->get("admin.blogs"), | 
|---|
| [2166] | 58 | __('Delete a blog') => '' | 
|---|
| [1358] | 59 | )) | 
|---|
|  | 60 | ); | 
|---|
| [1332] | 61 |  | 
|---|
| [1358] | 62 | if (!$core->error->flag()) | 
|---|
|  | 63 | { | 
|---|
| [0] | 64 | echo | 
|---|
| [1733] | 65 | '<div class="warning-msg"><p><strong>'.__('Warning').'</strong></p>'. | 
|---|
| [0] | 66 | '<p>'.sprintf(__('You are about to delete the blog %s. Every entry, comment and category will be deleted.'), | 
|---|
| [1733] | 67 | '<strong>'.$blog_id.' ('.$blog_name.')</strong>').'</p></div>'. | 
|---|
| [0] | 68 | '<p>'.__('Please give your password to confirm the blog deletion.').'</p>'; | 
|---|
| [2566] | 69 |  | 
|---|
| [0] | 70 | echo | 
|---|
| [2720] | 71 | '<form action="'.$core->adminurl->get("admin.blog.del").'" method="post">'. | 
|---|
| [0] | 72 | '<div>'.$core->formNonce().'</div>'. | 
|---|
| [1399] | 73 | '<p><label for="pwd">'.__('Your password:').'</label> '. | 
|---|
|  | 74 | form::password('pwd',20,255).'</p>'. | 
|---|
| [3] | 75 | '<p><input type="submit" class="delete" name="del" value="'.__('Delete this blog').'" />'. | 
|---|
| [0] | 76 | form::hidden('blog_id',$blog_id).'</p>'. | 
|---|
|  | 77 | '</form>'; | 
|---|
|  | 78 | } | 
|---|
|  | 79 |  | 
|---|
|  | 80 | dcPage::close(); | 
|---|