Changeset 3721 for trunk/wp-admin/comment.php
- Timestamp:
- 04/19/2006 08:02:16 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/comment.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/comment.php
r3671 r3721 18 18 } 19 19 } 20 21 if ( isset( $_POST['deletecomment'] ) ) 22 $action = 'deletecomment'; 20 23 21 24 switch($action) { … … 80 83 echo "<input type='submit' value='" . __('Yes') . "' />"; 81 84 echo " "; 82 echo "<input type='button' value='" . __('No') . "' onclick=\"self.location='". get_settings('siteurl') ."/wp-admin/edit .php?p=$p&c=1#comments';\" />\n";85 echo "<input type='button' value='" . __('No') . "' onclick=\"self.location='". get_settings('siteurl') ."/wp-admin/edit-comments.php';\" />\n"; 83 86 echo "</form>\n"; 84 87 echo "</div>\n"; … … 87 90 88 91 case 'deletecomment': 92 93 check_admin_referer(); 94 95 $comment = (int) $_REQUEST['comment']; 96 $p = (int) $_REQUEST['p']; 97 if ( isset($_REQUEST['noredir']) ) { 98 $noredir = true; 99 } else { 100 $noredir = false; 101 } 102 103 $postdata = get_post($p) or 104 die(sprintf(__('Oops, no post with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 105 106 if ( ! $comment = get_comment($comment) ) 107 die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit-comments.php')); 108 109 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 110 die( __('You are not allowed to edit comments on this post.') ); 111 112 if ( 'spam' == $_REQUEST['delete_type'] ) 113 wp_set_comment_status($comment->comment_ID, 'spam'); 114 else 115 wp_delete_comment($comment->comment_ID); 116 117 if (($_SERVER['HTTP_REFERER'] != '') && (false == $noredir)) { 118 header('Location: ' . $_SERVER['HTTP_REFERER']); 119 } else { 120 header('Location: '. get_settings('siteurl') .'/wp-admin/edit-comments.php'); 121 } 122 exit(); 123 break; 124 125 case 'unapprovecomment': 89 126 90 127 check_admin_referer(); … … 98 135 } 99 136 100 $postdata = get_post($p) or die(sprintf(__('Oops, no post with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 101 102 if ( ! $comment = get_comment($comment) ) 103 die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit-comments.php')); 104 105 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 106 die( __('You are not allowed to edit comments on this post.') ); 107 108 if ( 'spam' == $_GET['delete_type'] ) 109 wp_set_comment_status($comment->comment_ID, 'spam'); 110 else 111 wp_delete_comment($comment->comment_ID); 137 if ( ! $comment = get_comment($comment) ) 138 die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 139 140 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 141 die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') ); 142 143 wp_set_comment_status($comment->comment_ID, "hold"); 112 144 113 145 if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) { … … 119 151 break; 120 152 121 case ' unapprovecomment':153 case 'approvecomment': 122 154 123 155 check_admin_referer(); … … 135 167 136 168 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 137 die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') );138 139 wp_set_comment_status($comment->comment_ID, "hold");140 141 if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) {142 header('Location: ' . $_SERVER['HTTP_REFERER']);143 } else {144 header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments');145 }146 exit();147 break;148 149 case 'approvecomment':150 151 check_admin_referer();152 153 $comment = (int) $_GET['comment'];154 $p = (int) $_GET['p'];155 if (isset($_GET['noredir'])) {156 $noredir = true;157 } else {158 $noredir = false;159 }160 161 if ( ! $comment = get_comment($comment) )162 die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));163 164 if ( !current_user_can('edit_post', $comment->comment_post_ID) )165 169 die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') ); 166 170 … … 196 200 break; 197 201 } // end switch 202 198 203 include('admin-footer.php'); 204 199 205 ?>
Note: See TracChangeset
for help on using the changeset viewer.