Changeset 2258
- Timestamp:
- 02/11/2005 01:52:19 AM (20 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/moderation.php
r2233 r2258 5 5 $parent_file = 'edit.php'; 6 6 7 $wpvarstoreset = array('action', 'item_ignored', 'item_deleted', 'item_approved', ' feelinglucky');7 $wpvarstoreset = array('action', 'item_ignored', 'item_deleted', 'item_approved', 'item_spam', 'feelinglucky'); 8 8 for ($i=0; $i<count($wpvarstoreset); $i += 1) { 9 9 $wpvar = $wpvarstoreset[$i]; … … 39 39 $item_deleted = 0; 40 40 $item_approved = 0; 41 41 $item_spam = 0; 42 42 43 foreach($comment as $key => $value) { 43 44 if ($feelinglucky && 'later' == $value) … … 49 50 ++$item_ignored; 50 51 break; 51 52 52 case 'delete': 53 53 wp_set_comment_status($key, 'delete'); 54 54 ++$item_deleted; 55 55 break; 56 56 case 'spam': 57 wp_set_comment_status($key, 'spam'); 58 ++$item_spam; 59 break; 57 60 case 'approve': 58 61 wp_set_comment_status($key, 'approve'); 59 if ( get_settings('comments_notify') == true) {62 if ( get_settings('comments_notify') == true ) { 60 63 wp_notify_postauthor($key); 61 64 } … … 66 69 67 70 $file = basename(__FILE__); 68 header("Location: $file?ignored=$item_ignored&deleted=$item_deleted&approved=$item_approved ");71 header("Location: $file?ignored=$item_ignored&deleted=$item_deleted&approved=$item_approved&spam=$item_spam"); 69 72 exit(); 70 73 … … 78 81 echo "<div class='updated'>\n<p>"; 79 82 $approved = (int) $_GET['approved']; 80 $deleted = (int) $_GET['deleted']; 81 $ignored = (int) $_GET['ignored']; 83 $deleted = (int) $_GET['deleted']; 84 $ignored = (int) $_GET['ignored']; 85 $spam = (int) $_GET['spam']; 82 86 if ($approved) { 83 87 if ('1' == $approved) { … … 94 98 } 95 99 } 100 if ($spam) { 101 if ('1' == $spam) { 102 echo __("1 comment marked as spam <br />") . "\n"; 103 } else { 104 echo sprintf(__("%s comments marked as spam <br />"), $spam) . "\n"; 105 } 106 } 96 107 if ($ignored) { 97 108 if ('1' == $ignored) { … … 140 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) . "')\">" . __('Delete just this comment') . "</a> | "; ?> <?php _e('Bulk action:') ?> 141 152 <input type="radio" name="comment[<?php echo $comment->comment_ID; ?>]" id="comment[<?php echo $comment->comment_ID; ?>]-approve" value="approve" /> <label for="comment[<?php echo $comment->comment_ID; ?>]-approve"><?php _e('Approve') ?></label> 153 <input type="radio" name="comment[<?php echo $comment->comment_ID; ?>]" id="comment[<?php echo $comment->comment_ID; ?>]-spam" value="spam" /> <label for="comment[<?php echo $comment->comment_ID; ?>]-spam"><?php _e('Spam') ?></label> 142 154 <input type="radio" name="comment[<?php echo $comment->comment_ID; ?>]" id="comment[<?php echo $comment->comment_ID; ?>]-delete" value="delete" /> <label for="comment[<?php echo $comment->comment_ID; ?>]-delete"><?php _e('Delete') ?></label> 143 155 <input type="radio" name="comment[<?php echo $comment->comment_ID; ?>]" id="comment[<?php echo $comment->comment_ID; ?>]-nothing" value="later" checked="checked" /> <label for="comment[<?php echo $comment->comment_ID; ?>]-nothing"><?php _e('Defer until later') ?></label> … … 174 186 } 175 187 } 176 document.write('<ul><li><a href="javascript:markAllForApprove()"><?php _e('Mark all for approval'); ?></a></li><li><a href="javascript:markAllForDelete()"><?php _e('Mark all for deletion'); ?></a></li><li><a href="javascript:markAllForDefer()"><?php _e('Mark all for later'); ?></a></li></ul>'); 188 function markAllAsSpam() { 189 for (var i=0; i< document.approval.length; i++) { 190 if (document.approval[i].value == "spam") { 191 document.approval[i].checked = true; 192 } 193 } 194 } 195 document.write('<ul><li><a href="javascript:markAllForApprove()"><?php _e('Mark all for approval'); ?></a></li><li><a href="javascript:markAllAsSpam()"><?php _e('Mark all as spam'); ?></a></li><li><a href="javascript:markAllForDelete()"><?php _e('Mark all for deletion'); ?></a></li><li><a href="javascript:markAllForDefer()"><?php _e('Mark all for later'); ?></a></li></ul>'); 177 196 // ]]> 178 197 </script> -
trunk/wp-includes/comment-functions.php
r2239 r2258 569 569 570 570 571 /* wp_set_comment_status:572 part of otaku42's comment moderation hack573 changes the status of a comment according to $comment_status.574 allowed values:575 hold : set comment_approve field to 0576 approve: set comment_approve field to 1577 delete : remove comment out of database578 579 returns true if change could be applied580 returns false on database error or invalid value for $comment_status581 */582 571 function wp_set_comment_status($comment_id, $comment_status) { 583 572 global $wpdb; … … 590 579 $query = "UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1"; 591 580 break; 581 case 'spam': 582 $query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1"; 583 break; 592 584 case 'delete': 593 585 $query = "DELETE FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1"; … … 606 598 607 599 608 /* wp_get_comment_status609 part of otaku42's comment moderation hack610 gets the current status of a comment611 612 returned values:613 "approved" : comment has been approved614 "unapproved": comment has not been approved615 "deleted ": comment not found in database616 617 a (boolean) false signals an error618 */619 600 function wp_get_comment_status($comment_id) { 620 global $wpdb; 621 622 $result = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1"); 623 if ($result == NULL) { 624 return "deleted"; 625 } else if ($result == "1") { 626 return "approved"; 627 } else if ($result == "0") { 628 return "unapproved"; 629 } else { 630 return false; 631 } 601 global $wpdb; 602 603 $result = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1"); 604 if ($result == NULL) { 605 return 'deleted'; 606 } else if ($result == '1') { 607 return 'approved'; 608 } else if ($result == '0') { 609 return 'unapproved'; 610 } else if ($result == 'spam') { 611 return 'spam'; 612 } else { 613 return false; 614 } 632 615 } 633 616
Note: See TracChangeset
for help on using the changeset viewer.