Changes in trunk/wp-admin/edit-comments.php [4267:3422]
- File:
-
- 1 edited
-
trunk/wp-admin/edit-comments.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-comments.php
r4267 r3422 4 4 $title = __('Edit Comments'); 5 5 $parent_file = 'edit.php'; 6 wp_enqueue_script( 'admin-comments' );6 $list_js = true; 7 7 8 8 require_once('admin-header.php'); … … 24 24 } 25 25 } 26 27 function getNumChecked(form)28 {29 var num = 0;30 for (i = 0, n = form.elements.length; i < n; i++) {31 if(form.elements[i].type == "checkbox") {32 if(form.elements[i].checked == true)33 num++;34 }35 }36 return num;37 }38 26 //--> 39 27 </script> 40 28 <div class="wrap"> 41 29 <h2><?php _e('Comments'); ?></h2> 42 <form name="searchform" action="" method="get" id="editcomments">30 <form name="searchform" action="" method="get"> 43 31 <fieldset> 44 32 <legend><?php _e('Show Comments That Contain...') ?></legend> … … 46 34 <input type="submit" name="submit" value="<?php _e('Search') ?>" /> 47 35 <input type="hidden" name="mode" value="<?php echo $mode; ?>" /> 48 <?php _e('(Searches within comment text, e-mail, UR L, and IP address.)') ?>36 <?php _e('(Searches within comment text, e-mail, URI, and IP address.)') ?> 49 37 </fieldset> 50 38 </form> … … 52 40 <?php 53 41 if ( !empty( $_POST['delete_comments'] ) ) : 54 check_admin_referer('bulk-comments');55 56 42 $i = 0; 57 43 foreach ($_POST['delete_comments'] as $comment) : // Check the permissions on each 58 44 $comment = (int) $comment; 59 45 $post_id = $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment"); 60 // $authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") ); 61 if ( current_user_can('edit_post', $post_id) ) { 62 if ( !empty( $_POST['spam_button'] ) ) 63 wp_set_comment_status($comment, 'spam'); 64 else 65 wp_set_comment_status($comment, 'delete'); 46 $authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") ); 47 if ( current_user_can('edit_post', $post_id) ) : 48 wp_set_comment_status($comment, "delete"); 66 49 ++$i; 67 }50 endif; 68 51 endforeach; 69 echo '<div style="background-color: rgb(207, 235, 247);" id="message" class="updated fade"><p>'; 70 if ( !empty( $_POST['spam_button'] ) ) 71 printf(__('%s comments marked as spam.'), $i); 72 else 73 printf(__('%s comments deleted.'), $i); 74 echo '</p></div>'; 52 echo "<div class='wrap'><p>" . sprintf(__('%s comments deleted.'), $i) . "</p></div>"; 75 53 endif; 76 54 … … 100 78 $start = ''; 101 79 102 echo "<ol id='the- comment-list' class='commentlist' $start>";80 echo "<ol id='the-list' class='commentlist' $start>"; 103 81 $i = 0; 104 82 foreach ($comments as $comment) { … … 111 89 $class .= ' alternate'; 112 90 echo "<li id='comment-$comment->comment_ID' class='$class'>"; 113 ?> 114 <p><strong><?php comment_author() ?></strong> <?php if ($comment->comment_author_email) { ?>| <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <?php comment_author_url_link() ?> <?php } ?>| <?php _e('IP:') ?> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p> 91 ?> 92 <p><strong><?php _e('Name:') ?></strong> <?php comment_author() ?> <?php if ($comment->comment_author_email) { ?>| <strong><?php _e('E-mail:') ?></strong> <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url ) { ?> | <strong><?php _e('URI:') ?></strong> <?php comment_author_url_link() ?> <?php } ?>| <strong><?php _e('IP:') ?></strong> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p> 93 94 <?php comment_text() ?> 115 95 116 <?php comment_text() ?> 117 118 <p><?php comment_date('M j, g:i A'); ?> — [ 119 <?php 120 if ( current_user_can('edit_post', $comment->comment_post_ID) ) { 121 echo " <a href='comment.php?action=editcomment&comment=".$comment->comment_ID."'>" . __('Edit') . '</a>'; 122 echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&p=' . $comment->comment_post_ID . '&comment=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . sprintf(__("You are about to delete this comment by "%s".\\n"Cancel" to stop, "OK" to delete."), js_escape($comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> '; 123 if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) { 124 echo '<span class="unapprove"> | <a href="' . wp_nonce_url('comment.php?action=unapprovecomment&p=' . $comment->comment_post_ID . '&comment=' . $comment->comment_ID, 'unapprove-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Unapprove') . '</a> </span>'; 125 echo '<span class="approve"> | <a href="' . wp_nonce_url('comment.php?action=approvecomment&p=' . $comment->comment_post_ID . '&comment=' . $comment->comment_ID, 'approve-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Approve') . '</a> </span>'; 126 } 127 echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&delete_type=spam&p=" . $comment->comment_post_ID . "&comment=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . sprintf(__("You are about to mark as spam this comment by "%s".\\n"Cancel" to stop, "OK" to mark as spam."), js_escape( $comment->comment_author)) . "', theCommentList );\">" . __('Spam') . "</a> "; 128 } 129 $post = get_post($comment->comment_post_ID); 130 $post_title = wp_specialchars( $post->post_title, 'double' ); 131 $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title; 132 ?> 133 | <a href="<?php echo get_permalink($comment->comment_post_ID); ?>" title="<?php echo $post_title; ?>"><?php _e('View Post') ?></a> ]</p> 96 <p><?php _e('Posted'); echo ' '; comment_date('M j, g:i A'); 97 if ( current_user_can('edit_post', $comment->comment_post_ID) ) { 98 echo " | <a href=\"post.php?action=editcomment&comment=".$comment->comment_ID."\">" . __('Edit Comment') . "</a>"; 99 echo " | <a href=\"post.php?action=deletecomment&p=".$comment->comment_post_ID."&comment=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . sprintf(__("You are about to delete this comment by "%s".\\n"Cancel" to stop, "OK" to delete."), wp_specialchars( $comment->comment_author, 1 )) . "' );\">" . __('Delete Comment') . "</a> — "; 100 } // end if any comments to show 101 // Get post title 102 if ( current_user_can('edit_post', $comment->comment_post_ID) ) { 103 $post_title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"); 104 $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title; 105 ?> <a href="post.php?action=edit&post=<?php echo $comment->comment_post_ID; ?>"><?php printf(__('Edit Post “%s”'), stripslashes($post_title)); ?></a> 106 <?php } ?> 107 | <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php _e('View Post') ?></a></p> 134 108 </li> 135 109 136 <?php } // end foreach ($comment)?>110 <?php } // end foreach ?> 137 111 </ol> 138 112 … … 140 114 141 115 <?php 142 } else { //no comments to show116 } else { 143 117 144 118 ?> 145 119 <p> 146 120 <strong><?php _e('No comments found.') ?></strong></p> 147 121 148 122 <?php 149 123 } // end if ($comments) … … 151 125 152 126 if ($comments) { 153 echo '<form name="deletecomments" id="deletecomments" action="" method="post"> '; 154 wp_nonce_field('bulk-comments'); 155 echo '<table class="widefat"> 156 <thead> 127 echo '<form name="deletecomments" id="deletecomments" action="" method="post"> 128 <table width="100%" cellpadding="3" cellspacing="3"> 157 129 <tr> 158 <th scope="col" style="text-align: center"><input type="checkbox" onclick="checkAll(document.getElementById(\'deletecomments\'));" /></th>130 <th scope="col">*</th> 159 131 <th scope="col">' . __('Name') . '</th> 160 132 <th scope="col">' . __('E-mail') . '</th> 161 133 <th scope="col">' . __('IP') . '</th> 162 134 <th scope="col">' . __('Comment Excerpt') . '</th> 163 <th scope="col" colspan="3" style="text-align: center">' . __('Actions') . '</th> 164 </tr> 165 </thead>'; 135 <th scope="col" colspan="3">' . __('Actions') . '</th> 136 </tr>'; 166 137 foreach ($comments as $comment) { 167 138 $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID")); 168 $comment_status = wp_get_comment_status($comment->comment_ID);169 139 $class = ('alternate' == $class) ? '' : 'alternate'; 170 $class .= ('unapproved' == $comment_status) ? ' unapproved' : '';171 140 ?> 172 <tr id="comment-<?php echo $comment->comment_ID; ?>"class='<?php echo $class; ?>'>141 <tr class='<?php echo $class; ?>'> 173 142 <td><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td> 174 143 <td><?php comment_author_link() ?></td> … … 176 145 <td><a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></td> 177 146 <td><?php comment_excerpt(); ?></td> 178 <td> 179 <?php if ('unapproved' == $comment_status) { ?> 180 (Unapproved) 181 <?php } else { ?> 182 <a href="<?php echo get_permalink($comment->comment_post_ID); ?>#comment-<?php comment_ID() ?>" class="edit"><?php _e('View') ?></a> 183 <?php } ?> 184 </td> 147 <td><a href="<?php echo get_permalink($comment->comment_post_ID); ?>#comment-<?php comment_ID() ?>" class="edit"><?php _e('View') ?></a></td> 185 148 <td><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { 186 echo "<a href=' comment.php?action=editcomment&comment=$comment->comment_ID' class='edit'>" . __('Edit') . "</a>"; } ?></td>149 echo "<a href='post.php?action=editcomment&comment=$comment->comment_ID' class='edit'>" . __('Edit') . "</a>"; } ?></td> 187 150 <td><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { 188 echo "<a href=\"comment.php?action=deletecomment&p=".$comment->comment_post_ID."&comment=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . sprintf(__("You are about to delete this comment by "%s".\\n"Cancel" to stop, "OK" to delete."), js_escape( $comment->comment_author )) . "', theCommentList );\" class='delete'>" . __('Delete') . "</a> "; 189 } ?></td> 151 echo "<a href=\"post.php?action=deletecomment&p=".$comment->comment_post_ID."&comment=".$comment->comment_ID."\" onclick=\"return confirm('" . sprintf(__("You are about to delete this comment by \'%s\'\\n \'Cancel\' to stop, \'OK\' to delete."), $comment->comment_author) . "')\" class='delete'>" . __('Delete') . "</a>"; } ?></td> 190 152 </tr> 191 153 <?php 192 154 } // end foreach 193 155 ?></table> 194 <p class="submit"><input type="submit" name="delete_button" class="delete" value="<?php _e('Delete Checked Comments »') ?>" onclick="var numchecked = getNumChecked(document.getElementById('deletecomments')); if(numchecked < 1) { alert('<?php _e("Please select some comments to delete"); ?>'); return false } return confirm('<?php printf(__("You are about to delete %s comments permanently \\n \'Cancel\' to stop, \'OK\' to delete."), "' + numchecked + '"); ?>')" />195 <input type="submit" name="spam_button" value="<?php _e('Mark Checked Comments as Spam »') ?>" onclick="return confirm('<?php _e("You are about to mark these comments as spam \\n \'Cancel\' to stop, \'OK\' to mark as spam.") ?>')" /></p>156 <p><a href="javascript:;" onclick="checkAll(document.getElementById('deletecomments')); return false; "><?php _e('Invert Checkbox Selection') ?></a></p> 157 <p class="submit"><input type="submit" name="Submit" value="<?php _e('Delete Checked Comments') ?> »" onclick="return confirm('<?php _e("You are about to delete these comments permanently \\n \'Cancel\' to stop, \'OK\' to delete.") ?>')" /> </p> 196 158 </form> 197 <div id="ajax-response"></div>198 159 <?php 199 160 } else {
Note: See TracChangeset
for help on using the changeset viewer.