From 9d42ec4ee5db0437e9ad14b793f044fa0f5de8fe Mon Sep 17 00:00:00 2001 From: donncha Date: Wed, 7 Jun 2006 14:28:14 +0000 Subject: WP Merge and new features git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@550 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-inst/wp-admin/comment.php | 82 +++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 43 deletions(-) (limited to 'wp-inst/wp-admin/comment.php') diff --git a/wp-inst/wp-admin/comment.php b/wp-inst/wp-admin/comment.php index 2a97d91..a8be39e 100644 --- a/wp-inst/wp-admin/comment.php +++ b/wp-inst/wp-admin/comment.php @@ -1,6 +1,8 @@ Go back!'), 'edit.php')); if ( !current_user_can('edit_post', $comment->comment_post_ID) ) - die( __('You are not allowed to delete comments on this post.') ); + die( 'confirmdeletecomment' == $action ? __('You are not allowed to delete comments on this post.') : __('You are not allowed to edit comments on this post, so you cannot approve this comment.') ); echo "
\n"; if ( 'spam' == $_GET['delete_type'] ) echo "

" . __('Caution: You are about to mark the following comment as spam:') . "

\n"; - else + elseif ( 'confirmdeletecomment' == $action ) echo "

" . __('Caution: You are about to delete the following comment:') . "

\n"; + else + echo "

" . __('Caution: You are about to approve the following comment:') . "

\n"; echo "\n"; echo "\n"; echo "\n"; @@ -69,7 +77,8 @@ case 'confirmdeletecomment': echo "

" . __('Are you sure you want to do that?') . "

\n"; echo "\n"; - echo "\n"; + wp_nonce_field($nonce_action); + echo "\n"; if ( 'spam' == $_GET['delete_type'] ) echo "\n"; echo "\n"; @@ -77,25 +86,25 @@ case 'confirmdeletecomment': echo "\n"; echo ""; echo "  "; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; break; case 'deletecomment': + $comment = (int) $_REQUEST['comment']; + check_admin_referer('delete-comment_' . $comment); - check_admin_referer(); - - $comment = (int) $_GET['comment']; - $p = (int) $_GET['p']; - if (isset($_GET['noredir'])) { + $p = (int) $_REQUEST['p']; + if ( isset($_REQUEST['noredir']) ) { $noredir = true; } else { $noredir = false; } - $postdata = get_post($p) or die(sprintf(__('Oops, no post with this ID. Go back!'), 'edit.php')); + $postdata = get_post($p) or + die(sprintf(__('Oops, no post with this ID. Go back!'), 'edit.php')); if ( ! $comment = get_comment($comment) ) die(sprintf(__('Oops, no comment with this ID. Go back!'), 'edit-comments.php')); @@ -103,24 +112,23 @@ case 'deletecomment': if ( !current_user_can('edit_post', $comment->comment_post_ID) ) die( __('You are not allowed to edit comments on this post.') ); - if ( 'spam' == $_GET['delete_type'] ) + if ( 'spam' == $_REQUEST['delete_type'] ) wp_set_comment_status($comment->comment_ID, 'spam'); else wp_delete_comment($comment->comment_ID); - if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) { + if (($_SERVER['HTTP_REFERER'] != '') && (false == $noredir)) { header('Location: ' . $_SERVER['HTTP_REFERER']); } else { - header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments'); + header('Location: '. get_settings('siteurl') .'/wp-admin/edit-comments.php'); } exit(); break; case 'unapprovecomment': - - check_admin_referer(); - $comment = (int) $_GET['comment']; + check_admin_referer('unapprove-comment_' . $comment); + $p = (int) $_GET['p']; if (isset($_GET['noredir'])) { $noredir = true; @@ -144,29 +152,10 @@ case 'unapprovecomment': exit(); break; -case 'mailapprovecomment': - - $comment = (int) $_GET['comment']; - - if ( ! $comment = get_comment($comment) ) - die(sprintf(__('Oops, no comment with this ID. Go back!'), 'edit.php')); - - if ( !current_user_can('edit_post', $comment->comment_post_ID) ) - die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') ); - - if ('1' != $comment->comment_approved) { - wp_set_comment_status($comment->comment_ID, 'approve'); - if (true == get_option('comments_notify')) - wp_notify_postauthor($comment->comment_ID); - } - - header('Location: ' . get_option('siteurl') . '/wp-admin/moderation.php?approved=1'); - exit(); - break; - case 'approvecomment': - $comment = (int) $_GET['comment']; + check_admin_referer('approve-comment_' . $comment); + $p = (int) $_GET['p']; if (isset($_GET['noredir'])) { $noredir = true; @@ -196,6 +185,11 @@ case 'approvecomment': case 'editedcomment': + $comment_ID = (int) $_POST['comment_ID']; + $comment_post_ID = (int) $_POST['comment_post_id']; + + check_admin_referer('update-comment_' . $comment_ID); + edit_comment(); $referredby = $_POST['referredby']; @@ -209,5 +203,7 @@ case 'editedcomment': default: break; } // end switch + include('admin-footer.php'); -?> \ No newline at end of file + +?> -- cgit
" . __('Author:') . "$comment->comment_author
" . __('E-mail:') . "$comment->comment_author_email