Changeset 3699:77a12236e993 for admin/blog_del.php
- Timestamp:
- 02/14/18 10:14:33 (8 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/blog_del.php
r3627 r3699 11 11 # -- END LICENSE BLOCK ----------------------------------------- 12 12 13 require dirname(__FILE__) .'/../inc/admin/prepend.php';13 require dirname(__FILE__) . '/../inc/admin/prepend.php'; 14 14 15 15 dcPage::checkSuper(); 16 16 17 $blog_id = '';17 $blog_id = ''; 18 18 $blog_name = ''; 19 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 } 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 } 27 26 28 29 30 31 $blog_id= $rs->blog_id;32 33 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 } 34 33 } 35 34 36 35 # Delete the blog 37 if (!$core->error->flag() && $blog_id && !empty($_POST['del'])) 38 { 39 if (!$core->auth->checkPassword($_POST['pwd'])) { 40 $core->error->add(__('Password verification failed')); 41 } else { 42 try { 43 $core->delBlog($blog_id); 44 dcPage::addSuccessNotice(sprintf(__('Blog "%s" successfully deleted'), html::escapeHTML($blog_name))); 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))); 45 43 46 47 48 49 50 44 $core->adminurl->redirect("admin.blogs"); 45 } catch (Exception $e) { 46 $core->error->add($e->getMessage()); 47 } 48 } 51 49 } 52 50 53 dcPage::open(__('Delete a blog'), '',54 55 56 __('System')=> '',57 __('Blogs')=> $core->adminurl->get("admin.blogs"),58 59 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 )) 60 58 ); 61 59 62 if (!$core->error->flag()) 63 { 64 echo 65 '<div class="warning-msg"><p><strong>'.__('Warning').'</strong></p>'. 66 '<p>'.sprintf(__('You are about to delete the blog %s. Every entry, comment and category will be deleted.'), 67 '<strong>'.$blog_id.' ('.$blog_name.')</strong>').'</p></div>'. 68 '<p>'.__('Please give your password to confirm the blog deletion.').'</p>'; 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>'; 69 66 70 71 '<form action="'.$core->adminurl->get("admin.blog.del").'" method="post">'.72 '<div>'.$core->formNonce().'</div>'.73 '<p><label for="pwd">'.__('Your password:').'</label> '.74 form::password('pwd',20,255).'</p>'.75 '<p><input type="submit" class="delete" name="del" value="'.__('Delete this blog').'" />'.76 form::hidden('blog_id',$blog_id).'</p>'.77 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>'; 78 75 } 79 76
Note: See TracChangeset
for help on using the changeset viewer.