Changeset 2165

Show
Ignore:
Timestamp:
01/31/05 04:22:01 (4 years ago)
Author:
saxmatt
Message:

Moderation confirmation from Ryan, some other template and comment editing improvements.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/edit-form-comment.php

    r1631 r2165  
    11<?php 
    2  
    32$submitbutton_text = __('Edit Comment &raquo;'); 
    43$toprow_title = sprintf(__('Editing Comment # %s'), $commentdata['comment_ID']); 
     
    65$form_extra = "' />\n<input type='hidden' name='comment_ID' value='$comment' />\n<input type='hidden' name='comment_post_ID' value='".$commentdata["comment_post_ID"]; 
    76?> 
    8 <div class="wrap"> 
    97 
    108<form name="post" action="post.php" method="post" id="post"> 
     9<div class="wrap"> 
    1110<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" /> 
    1211<input type="hidden" name="action" value='<?php echo $form_action . $form_extra ?>' /> 
     
    6059</p> 
    6160 
     61</div> 
    6262 
    63 <?php 
     63<div class="wrap"> 
     64<h2><?php _e('Advanced'); ?></h2> 
    6465 
     66<table width="100%" cellspacing="2" cellpadding="5" class="editform"> 
     67    <tr> 
     68        <th scope="row" valign="top"><?php _e('Comment Status') ?>:</th> 
     69        <td><label for="comment_status_approved" class="selectit"><input id="comment_status_approved" name="comment_status" type="radio" value="1" <?php checked($comment_status, '1'); ?> /> <?php _e('Approved') ?></label><br /> 
     70      <label for="comment_status_moderated" class="selectit"><input id="comment_status_moderated" name="comment_status" type="radio" value="0" <?php checked($comment_status, '0'); ?> /> <?php _e('Moderated') ?></label><br /> 
     71      <label for="comment_status_spam" class="selectit"><input id="comment_status_spam" name="comment_status" type="radio" value="spam" <?php checked($comment_status, 'spam'); ?> /> <?php _e('Spam') ?></label></td> 
     72    </tr> 
    6573 
    66 // if the level is 5+, allow user to edit the timestamp - not on 'new post' screen though 
    67 // if (($user_level > 4) && ($action != "post")) 
    68 if ($user_level > 4) { 
    69     touch_time(($action == 'edit')); 
    70 
    71 ?> 
     74<?php if ($user_level > 4) : ?> 
     75    <tr> 
     76        <th scope="row"><?php _e('Edit time'); ?>:</th> 
     77        <td><?php touch_time(($action == 'edit')); ?></td> 
     78    </tr> 
     79<?php endif; ?> 
     80 
     81    <tr> 
     82        <th scope="row"><?php _e('Delete'); ?>:</th> 
     83        <td><p><a class="delete" href="post.php?action=confirmdeletecomment&amp;noredir=true&amp;comment=<?php echo $commentdata['comment_ID']; ?>&amp;p=<?php echo $commentdata['comment_post_ID']; ?>"><?php _e('Delete comment') ?></a></p></td> 
     84    </tr> 
     85</table> 
     86 
     87</div> 
    7288 
    7389</form> 
    74 <p><a class="delete" href="post.php?action=confirmdeletecomment&amp;noredir=true&amp;comment=<?php echo $commentdata['comment_ID']; ?>&amp;p=<?php echo $commentdata['comment_post_ID']; ?>"><?php _e('Delete comment') ?></a></p> 
    75 </div> 
  • trunk/wp-admin/post.php

    r2122 r2165  
    430430    $content = format_to_edit($content); 
    431431    $content = apply_filters('comment_edit_pre', $content); 
     432     
     433    $comment_status = $commentdata['comment_approved']; 
    432434 
    433435    include('edit-form-comment.php'); 
     
    586588    $newcomment_author_email = $_POST['newcomment_author_email']; 
    587589    $newcomment_author_url = $_POST['newcomment_author_url']; 
     590    $comment_status = $_POST['comment_status']; 
    588591 
    589592    if (!user_can_edit_post_comments($user_ID, $comment_post_ID)) { 
     
    613616            comment_author = '$newcomment_author', 
    614617            comment_author_email = '$newcomment_author_email', 
     618            comment_approved = '$comment_status', 
    615619            comment_author_url = '$newcomment_author_url'".$datemodif." 
    616620        WHERE comment_ID = $comment_ID" 
  • trunk/wp-content/themes/default/comments.php

    r2135 r2165  
    2828 
    2929        <li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>"> 
    30             <cite><?php comment_author_link() ?></cite> Says:<br /> 
    31             <!--<small class="commentmetadata"><a href="#comment-<?php comment_ID() ?>" title="<?php comment_date('l, F jS, Y') ?> at <?php comment_time() ?>"><?php /* $entry_datetime = abs(strtotime($post->post_date)); $comment_datetime = abs(strtotime($comment->comment_date)); echo time_since($entry_datetime, $comment_datetime) */ ?></a> after publication. <?php edit_comment_link('e','',''); ?></small>--> 
     30            <cite><?php comment_author_link() ?></cite> Says: 
     31            <?php if ($comment->comment_approved == '0') : ?> 
     32            <em>Your comment is awaiting moderation.</em> 
     33            <?php endif; ?> 
     34            <br /> 
     35 
     36             
     37             
    3238            <small class="commentmetadata"><a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('F jS, Y') ?> at <?php comment_time() ?></a> <?php edit_comment_link('e','',''); ?></small> 
    3339             
  • trunk/wp-includes/comment-functions.php

    r2144 r2165  
    88    if ( is_single() || is_page() || $withcomments ) : 
    99        $req = get_settings('require_name_email'); 
    10         $comment_author = isset($_COOKIE['comment_author_'.COOKIEHASH]) ? trim(stripslashes($_COOKIE['comment_author_'.COOKIEHASH])) : ''; 
     10       $comment_author = isset($_COOKIE['comment_author_'.COOKIEHASH]) ? trim(stripslashes($_COOKIE['comment_author_'.COOKIEHASH])) : ''; 
    1111        $comment_author_email = isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ? trim(stripslashes($_COOKIE['comment_author_email_'.COOKIEHASH])) : ''; 
    1212        $comment_author_url = isset($_COOKIE['comment_author_url_'.COOKIEHASH]) ? trim(stripslashes($_COOKIE['comment_author_url_'.COOKIEHASH])) : ''; 
     13    if ( empty($comment_author) ) { 
    1314        $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND comment_approved = '1' ORDER BY comment_date"); 
     15    } else { 
     16        $author_db = addslashes($comment_author); 
     17        $email_db  = addslashes($comment_author_email); 
     18        $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND ( comment_approved = '1' OR ( comment_author = '$author_db' AND comment_author_email = '$email_db' AND comment_approved = '0' ) ) ORDER BY comment_date"); 
     19    } 
    1420 
    1521    if ( file_exists( TEMPLATEPATH . '/comments.php') ) 
     
    662668    } 
    663669    $notify_message .= get_permalink($comment->comment_post_ID) . '#comments'; 
    664     $notify_message .= "\r\n\r\nTo delete this comment, visit: " . get_settings('siteurl') . "/wp-admin/post.php?action=confirmdeletecomment&p=".$comment->comment_post_ID."&comment=$comment_id"; 
     670    $notify_message .= "\r\n\r\nTo delete this comment:\r\n" . get_settings('siteurl') . "/wp-admin/post.php?action=confirmdeletecomment&p=".$comment->comment_post_ID."&comment=$comment_id"; 
    665671 
    666672    if ('' == $comment->comment_author_email || '' == $comment->comment_author) { 
     
    733739        return false; // Check # of external links 
    734740 
    735     // Comment whitelisting: 
    736     if ( 1 == get_settings('comment_whitelist')) { 
    737         if ( 'trackback' == $comment_type || 'pingback' == $comment_type ) { // check if domain is in blogroll 
    738             $uri = parse_url($url); 
    739             $domain = $uri['host']; 
    740             $in_blogroll = $wpdb->get_var("SELECT link_id FROM $wpdb->links WHERE link_url LIKE ('%$domain%') LIMIT 1"); 
    741             if ( $in_blogroll ) 
    742                 return true; 
    743         } elseif( $author != '' && $email != '' ) { 
    744             $ok_to_comment = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_author = '$author' AND comment_author_email = '$email' and comment_approved = '1' "); 
    745             if ( 1 == $ok_to_comment && false === strpos( $email, get_settings('moderation_keys')) ) 
    746                 return true; 
    747             else 
    748                 return false; 
    749         } else { 
    750             return false; 
    751         } 
    752     } 
    753  
    754741    $mod_keys = trim( get_settings('moderation_keys') ); 
    755742    if ('' == $mod_keys ) 
     
    776763    } 
    777764 
     765    // Comment whitelisting: 
     766    if ( 1 == get_settings('comment_whitelist')) { 
     767        if ( 'trackback' == $comment_type || 'pingback' == $comment_type ) { // check if domain is in blogroll 
     768            $uri = parse_url($url); 
     769            $domain = $uri['host']; 
     770            if ( $wpdb->get_var("SELECT link_id FROM $wpdb->links WHERE link_url LIKE ('%$domain%') LIMIT 1") ) 
     771                return true; 
     772        } elseif( $author != '' && $email != '' ) { 
     773            $ok_to_comment = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_author = '$author' AND comment_author_email = '$email' and comment_approved = '1' "); 
     774            if ( 1 == $ok_to_comment && false === strpos( $email, get_settings('moderation_keys')) ) 
     775                return true; 
     776            else 
     777                return false; 
     778        } else { 
     779            return false; 
     780        } 
     781    } 
     782 
    778783    return true; 
    779784} 
  • trunk/wp-rdf.php

    r2068 r2165  
    4444    <link><?php permalink_single_rss() ?></link> 
    4545    <dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', $post->post_date_gmt); ?></dc:date> 
    46     <dc:creator><?php the_author() ?> (mailto:<?php the_author_email() ?>)</dc:creator> 
     46    <dc:creator><?php the_author() ?></dc:creator> 
    4747    <?php the_category_rss('rdf') ?> 
    4848<?php if (get_settings('rss_use_excerpt')) : ?>