Make WordPress Core

Changeset 3671


Ignore:
Timestamp:
03/31/2006 08:32:30 AM (19 years ago)
Author:
ryan
Message:

Prompt for confirmation for mailapprovecomment action. Props mdawaffe. fixes #2615

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/comment.php

    r3665 r3671  
    4242
    4343case 'confirmdeletecomment':
     44case 'mailapprovecomment':
    4445
    4546    require_once('./admin-header.php');
     
    4748    $comment = (int) $_GET['comment'];
    4849    $p = (int) $_GET['p'];
     50    $formaction = 'confirmdeletecomment' == $action ? 'deletecomment' : 'approvecomment';
    4951
    5052    if ( ! $comment = get_comment($comment) )
     
    5254
    5355    if ( !current_user_can('edit_post', $comment->comment_post_ID) )
    54         die( __('You are not allowed to delete comments on this post.') );
     56        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.') );
    5557
    5658    echo "<div class='wrap'>\n";
    5759    if ( 'spam' == $_GET['delete_type'] )
    5860        echo "<p>" . __('<strong>Caution:</strong> You are about to mark the following comment as spam:') . "</p>\n";
     61    elseif ( 'confirmdeletecomment' == $action )
     62        echo "<p>" . __('<strong>Caution:</strong> You are about to delete the following comment:') . "</p>\n";
    5963    else
    60         echo "<p>" . __('<strong>Caution:</strong> You are about to delete the following comment:') . "</p>\n";
     64        echo "<p>" . __('<strong>Caution:</strong> You are about to approve the following comment:') . "</p>\n";
    6165    echo "<table border='0'>\n";
    6266    echo "<tr><td>" . __('Author:') . "</td><td>$comment->comment_author</td></tr>\n";
     
    6872
    6973    echo "<form action='".get_settings('siteurl')."/wp-admin/comment.php' method='get'>\n";
    70     echo "<input type='hidden' name='action' value='deletecomment' />\n";
     74    echo "<input type='hidden' name='action' value='$formaction' />\n";
    7175    if ( 'spam' == $_GET['delete_type'] )
    7276        echo "<input type='hidden' name='delete_type' value='spam' />\n";
     
    143147    break;
    144148
    145 case 'mailapprovecomment':
    146 
    147     $comment = (int) $_GET['comment'];
    148 
    149     if ( ! $comment = get_comment($comment) )
    150              die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
    151 
    152     if ( !current_user_can('edit_post', $comment->comment_post_ID) )
    153         die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
    154 
    155     if ('1' != $comment->comment_approved) {
    156         wp_set_comment_status($comment->comment_ID, 'approve');
    157         if (true == get_option('comments_notify'))
    158             wp_notify_postauthor($comment->comment_ID);
    159     }
    160 
    161     header('Location: ' . get_option('siteurl') . '/wp-admin/moderation.php?approved=1');
    162     exit();
    163     break;
    164 
    165149case 'approvecomment':
    166150
  • trunk/wp-admin/edit.php

    r3660 r3671  
    250250    if ($comments) {
    251251    ?>
    252 <h3><?php _e('Comments') ?></h3>
     252<h3 id="comments"><?php _e('Comments') ?></h3>
    253253<ol id="the-list">
    254254<?php
  • trunk/wp-includes/functions-formatting.php

    r3660 r3671  
    9999function wp_specialchars( $text, $quotes = 0 ) {
    100100    // Like htmlspecialchars except don't double-encode HTML entities
    101     $text = preg_replace('/&([^#])(?![a-z1-4]{1,8};)/', '&#038;$1', $text);-
     101    $text = preg_replace('/&([^#])(?![a-z1-4]{1,8};)/', '&#038;$1', $text);
    102102    $text = str_replace('<', '&lt;', $text);
    103103    $text = str_replace('>', '&gt;', $text);
Note: See TracChangeset for help on using the changeset viewer.