[ Index ] |
|
Code source de WordPress 2.1.2 |
1 <?php 2 require_once ('admin.php'); 3 4 $parent_file = 'edit-comments.php'; 5 $submenu_file = 'edit-comments.php'; 6 7 wp_reset_vars(array('action')); 8 9 if ( isset( $_POST['deletecomment'] ) ) 10 $action = 'deletecomment'; 11 12 switch($action) { 13 case 'editcomment': 14 $title = __('Edit Comment'); 15 16 require_once ('admin-header.php'); 17 18 $comment = (int) $_GET['c']; 19 20 if ( ! $comment = get_comment($comment) ) 21 wp_die(__('Oops, no comment with this ID.').sprintf(' <a href="%s">'.__('Go back').'</a>!', 'javascript:history.go(-1)')); 22 23 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 24 wp_die( __('You are not allowed to edit comments on this post.') ); 25 26 $comment = get_comment_to_edit($comment); 27 28 include ('edit-form-comment.php'); 29 30 break; 31 32 case 'cdc': 33 case 'mac': 34 35 require_once ('./admin-header.php'); 36 37 $comment = (int) $_GET['c']; 38 $formaction = 'cdc' == $action ? 'deletecomment' : 'approvecomment'; 39 $nonce_action = 'cdc' == $action ? 'delete-comment_' : 'approve-comment_'; 40 $nonce_action .= $comment; 41 42 if ( ! $comment = get_comment($comment) ) 43 wp_die(__('Oops, no comment with this ID.').sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit.php')); 44 45 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 46 wp_die( 'cdc' == $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.') ); 47 ?> 48 <div class='wrap'> 49 50 <div class="narrow"> 51 <?php if ( 'spam' == $_GET['dt'] ) { ?> 52 <p><?php echo '<strong>'.__('Caution:').'</strong> '.__('You are about to mark the following comment as spam:'); ?></p> 53 <?php } elseif ( 'cdc' == $action ) { ?> 54 <p><?php echo '<strong>'.__('Caution:').'</strong> '.__('You are about to delete the following comment:'); ?></p> 55 <?php } else { ?> 56 <p><?php echo '<strong>'.__('Caution:').'</strong> '.__('You are about to approve the following comment:'); ?></p> 57 <?php } ?> 58 59 <p><?php _e('Are you sure you want to do that?'); ?></p> 60 61 <form action='<?php echo get_option('siteurl'); ?>/wp-admin/comment.php' method='get'> 62 63 <table width="100%"> 64 <tr> 65 <td><input type='button' value='<?php _e('No'); ?>' onclick="self.location='<?php echo get_option('siteurl'); ?>/wp-admin/edit-comments.php';" /></td> 66 <td align="right"><input type='submit' value='<?php _e('Yes'); ?>' /></td> 67 </tr> 68 </table> 69 70 <?php wp_nonce_field($nonce_action); ?> 71 <input type='hidden' name='action' value='<?php echo $formaction; ?>' /> 72 <?php if ( 'spam' == $_GET['dt'] ) { ?> 73 <input type='hidden' name='dt' value='spam' /> 74 <?php } ?> 75 <input type='hidden' name='p' value='<?php echo $comment->comment_post_ID; ?>' /> 76 <input type='hidden' name='c' value='<?php echo $comment->comment_ID; ?>' /> 77 <input type='hidden' name='noredir' value='1' /> 78 </form> 79 80 <table class="editform" cellpadding="5"> 81 <tr class="alt"> 82 <th scope="row"><?php _e('Author:'); ?></th> 83 <td><?php echo $comment->comment_author; ?></td> 84 </tr> 85 <?php if ( $comment->comment_author_email ) { ?> 86 <tr> 87 <th scope="row"><?php _e('E-mail:'); ?></th> 88 <td><?php echo $comment->comment_author_email; ?></td> 89 </tr> 90 <?php } ?> 91 <?php if ( $comment->comment_author_url ) { ?> 92 <tr> 93 <th scope="row"><?php _e('URL:'); ?></th> 94 <td><?php echo $comment->comment_author_url; ?></td> 95 </tr> 96 <?php } ?> 97 <tr> 98 <th scope="row" valign="top"><p><?php _e('Comment:'); ?></p></th> 99 <td><?php echo apply_filters( 'comment_text', $comment->comment_content ); ?></td> 100 </tr> 101 </table> 102 103 </div> 104 </div> 105 <?php 106 break; 107 108 case 'deletecomment': 109 $comment = (int) $_REQUEST['c']; 110 check_admin_referer('delete-comment_' . $comment); 111 112 if ( isset($_REQUEST['noredir']) ) { 113 $noredir = true; 114 } else { 115 $noredir = false; 116 } 117 118 if ( ! $comment = get_comment($comment) ) 119 wp_die(__('Oops, no comment with this ID.').sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit-comments.php')); 120 121 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 122 wp_die( __('You are not allowed to edit comments on this post.') ); 123 124 if ( 'spam' == $_REQUEST['dt'] ) 125 wp_set_comment_status($comment->comment_ID, 'spam'); 126 else 127 wp_delete_comment($comment->comment_ID); 128 129 if ((wp_get_referer() != '') && (false == $noredir)) { 130 wp_redirect(wp_get_referer()); 131 } else { 132 wp_redirect(get_option('siteurl') .'/wp-admin/edit-comments.php'); 133 } 134 exit(); 135 break; 136 137 case 'unapprovecomment': 138 $comment = (int) $_GET['c']; 139 check_admin_referer('unapprove-comment_' . $comment); 140 141 if (isset($_GET['noredir'])) { 142 $noredir = true; 143 } else { 144 $noredir = false; 145 } 146 147 if ( ! $comment = get_comment($comment) ) 148 wp_die(__('Oops, no comment with this ID.').sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit.php')); 149 150 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 151 wp_die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') ); 152 153 wp_set_comment_status($comment->comment_ID, "hold"); 154 155 if ((wp_get_referer() != "") && (false == $noredir)) { 156 wp_redirect(wp_get_referer()); 157 } else { 158 wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p='.$comment->comment_post_ID.'&c=1#comments'); 159 } 160 exit(); 161 break; 162 163 case 'approvecomment': 164 $comment = (int) $_GET['c']; 165 check_admin_referer('approve-comment_' . $comment); 166 167 if (isset($_GET['noredir'])) { 168 $noredir = true; 169 } else { 170 $noredir = false; 171 } 172 173 if ( ! $comment = get_comment($comment) ) 174 wp_die(__('Oops, no comment with this ID.').sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit.php')); 175 176 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 177 wp_die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') ); 178 179 wp_set_comment_status($comment->comment_ID, "approve"); 180 if (get_option("comments_notify") == true) { 181 wp_notify_postauthor($comment->comment_ID); 182 } 183 184 185 if ((wp_get_referer() != "") && (false == $noredir)) { 186 wp_redirect(wp_get_referer()); 187 } else { 188 wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p='.$comment->comment_post_ID.'&c=1#comments'); 189 } 190 exit(); 191 break; 192 193 case 'editedcomment': 194 195 $comment_ID = (int) $_POST['comment_ID']; 196 $comment_post_ID = (int) $_POST['comment_post_id']; 197 198 check_admin_referer('update-comment_' . $comment_ID); 199 200 edit_comment(); 201 202 $location = ( empty($_POST['referredby']) ? "edit.php?p=$comment_post_ID&c=1" : $_POST['referredby'] ) . '#comment-' . $comment_ID; 203 $location = apply_filters('comment_edit_redirect', $location, $comment_ID); 204 wp_redirect($location); 205 exit(); 206 break; 207 default: 208 break; 209 } // end switch 210 211 include ('admin-footer.php'); 212 213 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 30 19:41:27 2007 | par Balluche grâce à PHPXref 0.7 |