Prompt for confirmation for mailapprovecomment action. Props mdawaffe. fixes #2615
git-svn-id: http://svn.automattic.com/wordpress/trunk@3671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8a751c591d
commit
1fb3390cc2
|
@ -41,23 +41,27 @@ case 'editcomment':
|
|||
break;
|
||||
|
||||
case 'confirmdeletecomment':
|
||||
case 'mailapprovecomment':
|
||||
|
||||
require_once('./admin-header.php');
|
||||
|
||||
$comment = (int) $_GET['comment'];
|
||||
$p = (int) $_GET['p'];
|
||||
$formaction = 'confirmdeletecomment' == $action ? 'deletecomment' : 'approvecomment';
|
||||
|
||||
if ( ! $comment = get_comment($comment) )
|
||||
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), '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 "<div class='wrap'>\n";
|
||||
if ( 'spam' == $_GET['delete_type'] )
|
||||
echo "<p>" . __('<strong>Caution:</strong> You are about to mark the following comment as spam:') . "</p>\n";
|
||||
else
|
||||
elseif ( 'confirmdeletecomment' == $action )
|
||||
echo "<p>" . __('<strong>Caution:</strong> You are about to delete the following comment:') . "</p>\n";
|
||||
else
|
||||
echo "<p>" . __('<strong>Caution:</strong> You are about to approve the following comment:') . "</p>\n";
|
||||
echo "<table border='0'>\n";
|
||||
echo "<tr><td>" . __('Author:') . "</td><td>$comment->comment_author</td></tr>\n";
|
||||
echo "<tr><td>" . __('E-mail:') . "</td><td>$comment->comment_author_email</td></tr>\n";
|
||||
|
@ -67,7 +71,7 @@ case 'confirmdeletecomment':
|
|||
echo "<p>" . __('Are you sure you want to do that?') . "</p>\n";
|
||||
|
||||
echo "<form action='".get_settings('siteurl')."/wp-admin/comment.php' method='get'>\n";
|
||||
echo "<input type='hidden' name='action' value='deletecomment' />\n";
|
||||
echo "<input type='hidden' name='action' value='$formaction' />\n";
|
||||
if ( 'spam' == $_GET['delete_type'] )
|
||||
echo "<input type='hidden' name='delete_type' value='spam' />\n";
|
||||
echo "<input type='hidden' name='p' value='$p' />\n";
|
||||
|
@ -142,26 +146,6 @@ case 'unapprovecomment':
|
|||
exit();
|
||||
break;
|
||||
|
||||
case 'mailapprovecomment':
|
||||
|
||||
$comment = (int) $_GET['comment'];
|
||||
|
||||
if ( ! $comment = get_comment($comment) )
|
||||
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), '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':
|
||||
|
||||
check_admin_referer();
|
||||
|
|
|
@ -249,7 +249,7 @@ if ( 1 == count($posts) ) {
|
|||
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
|
||||
if ($comments) {
|
||||
?>
|
||||
<h3><?php _e('Comments') ?></h3>
|
||||
<h3 id="comments"><?php _e('Comments') ?></h3>
|
||||
<ol id="the-list">
|
||||
<?php
|
||||
$i = 0;
|
||||
|
|
|
@ -98,7 +98,7 @@ function seems_utf8($Str) { # by bmorel at ssi dot fr
|
|||
|
||||
function wp_specialchars( $text, $quotes = 0 ) {
|
||||
// Like htmlspecialchars except don't double-encode HTML entities
|
||||
$text = preg_replace('/&([^#])(?![a-z1-4]{1,8};)/', '&$1', $text);-
|
||||
$text = preg_replace('/&([^#])(?![a-z1-4]{1,8};)/', '&$1', $text);
|
||||
$text = str_replace('<', '<', $text);
|
||||
$text = str_replace('>', '>', $text);
|
||||
if ( 'double' === $quotes ) {
|
||||
|
|
Loading…
Reference in New Issue