Changeset 2662 for trunk/wp-admin/post.php
- Timestamp:
- 06/26/2005 07:55:12 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/post.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/post.php
r2654 r2662 141 141 get_currentuserinfo(); 142 142 143 $comment = $_GET['comment']; 144 $commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'javascript:history.go(-1)')); 145 146 if (!user_can_edit_post_comments($user_ID, $commentdata['comment_post_ID'])) { 143 $comment = (int) $_GET['comment']; 144 145 if ( ! $comment = get_comment($comment) ) 146 die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'javascript:history.go(-1)')); 147 148 if ( !user_can_edit_post_comments($user_ID, $comment->comment_post_ID) ) 147 149 die( __('You are not allowed to edit comments on this post.') ); 148 } 149 150 $content = $commentdata['comment_content']; 151 $content = format_to_edit($content); 152 $content = apply_filters('comment_edit_pre', $content); 153 154 $comment_status = $commentdata['comment_approved']; 150 151 $comment = get_comment_to_edit($comment); 155 152 156 153 include('edit-form-comment.php'); … … 162 159 require_once('./admin-header.php'); 163 160 164 $comment = $_GET['comment'];161 $comment = (int) $_GET['comment']; 165 162 $p = (int) $_GET['p']; 166 $commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 167 168 if (!user_can_delete_post_comments($user_ID, $commentdata['comment_post_ID'])) { 163 164 if ( ! $comment = get_comment($comment) ) 165 die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 166 167 if ( !user_can_delete_post_comments($user_ID, $comment->comment_post_ID) ) 169 168 die( __('You are not allowed to delete comments on this post.') ); 170 }171 169 172 170 echo "<div class=\"wrap\">\n"; 173 171 echo "<p>" . __('<strong>Caution:</strong> You are about to delete the following comment:') . "</p>\n"; 174 172 echo "<table border=\"0\">\n"; 175 echo "<tr><td>" . __('Author:') . "</td><td>" . $comment data["comment_author"]. "</td></tr>\n";176 echo "<tr><td>" . __('E-mail:') . "</td><td>" . $comment data["comment_author_email"]. "</td></tr>\n";177 echo "<tr><td>". __('URL:') . "</td><td>" . $comment data["comment_author_url"]. "</td></tr>\n";178 echo "<tr><td>". __('Comment:') . "</td><td>" . stripslashes($commentdata["comment_content"]). "</td></tr>\n";173 echo "<tr><td>" . __('Author:') . "</td><td>" . $comment->comment_author . "</td></tr>\n"; 174 echo "<tr><td>" . __('E-mail:') . "</td><td>" . $comment->comment_author_email . "</td></tr>\n"; 175 echo "<tr><td>". __('URL:') . "</td><td>" . $comment->comment_author_url . "</td></tr>\n"; 176 echo "<tr><td>". __('Comment:') . "</td><td>" . $comment->comment_content . "</td></tr>\n"; 179 177 echo "</table>\n"; 180 178 echo "<p>" . __('Are you sure you want to do that?') . "</p>\n"; … … 197 195 check_admin_referer(); 198 196 199 $comment = $_GET['comment'];200 $p = $_GET['p'];197 $comment = (int) $_GET['comment']; 198 $p = (int) $_GET['p']; 201 199 if (isset($_GET['noredir'])) { 202 200 $noredir = true; … … 206 204 207 205 $postdata = get_post($p) or die(sprintf(__('Oops, no post with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 208 $commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'post.php')); 209 210 if (!user_can_delete_post_comments($user_ID, $commentdata['comment_post_ID'])) { 206 207 if ( ! $comment = get_comment($comment) ) 208 die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'post.php')); 209 210 if (!user_can_delete_post_comments($user_ID, $commentdata['comment_post_ID'])) 211 211 die( __('You are not allowed to edit comments on this post.') ); 212 } 213 214 wp_set_comment_status($comment, "delete"); 215 do_action('delete_comment', $comment); 212 213 wp_set_comment_status($comment->comment_ID, "delete"); 214 do_action('delete_comment', $comment->comment_ID); 216 215 217 216 if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) { … … 229 228 check_admin_referer(); 230 229 231 $comment = $_GET['comment'];232 $p = $_GET['p'];230 $comment = (int) $_GET['comment']; 231 $p = (int) $_GET['p']; 233 232 if (isset($_GET['noredir'])) { 234 233 $noredir = true; … … 237 236 } 238 237 239 $commentdata = get_commentdata($comment) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 240 241 if (!user_can_edit_post_comments($user_ID, $commentdata['comment_post_ID'])) { 238 if ( ! $comment = get_comment($comment) ) 239 die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 240 241 if ( !user_can_edit_post_comments($user_ID, $comment->comment_post_ID) ) 242 242 die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') ); 243 } 244 245 wp_set_comment_status($comment, "hold"); 243 244 wp_set_comment_status($comment->comment_ID, "hold"); 246 245 247 246 if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) { … … 257 256 $comment = (int) $_GET['comment']; 258 257 259 $commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 260 261 if (!user_can_edit_post_comments($user_ID, $commentdata['comment_post_ID'])) { 258 if ( ! $comment = get_comment($comment) ) 259 die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 260 261 if ( !user_can_edit_post_comments($user_ID, $comment->comment_post_ID) ) 262 262 die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') ); 263 } 264 265 if ('1' != $commentdata['comment_approved']) { 266 wp_set_comment_status($comment, 'approve'); 263 264 if ('1' != $comment->comment_approved) { 265 wp_set_comment_status($comment->comment_ID, 'approve'); 267 266 if (true == get_option('comments_notify')) 268 wp_notify_postauthor($comment );267 wp_notify_postauthor($comment->comment_ID); 269 268 } 270 269 … … 275 274 case 'approvecomment': 276 275 277 $comment = $_GET['comment'];278 $p = $_GET['p'];276 $comment = (int) $_GET['comment']; 277 $p = (int) $_GET['p']; 279 278 if (isset($_GET['noredir'])) { 280 279 $noredir = true; … … 282 281 $noredir = false; 283 282 } 284 $commentdata = get_commentdata($comment) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 285 286 if (!user_can_edit_post_comments($user_ID, $commentdata['comment_post_ID'])) { 283 284 if ( ! $comment = get_comment($comment) ) 285 die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 286 287 if ( !user_can_edit_post_comments($user_ID, $commentdata['comment_post_ID'])) 287 288 die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') ); 288 } 289 290 wp_set_comment_status($comment, "approve"); 289 290 wp_set_comment_status($comment->comment_ID, "approve"); 291 291 if (get_settings("comments_notify") == true) { 292 wp_notify_postauthor($comment );292 wp_notify_postauthor($comment->comment_ID); 293 293 } 294 294 … … 304 304 case 'editedcomment': 305 305 306 $comment_ID = $_POST['comment_ID']; 307 $comment_post_ID = $_POST['comment_post_ID']; 308 $newcomment_author = $_POST['newcomment_author']; 309 $newcomment_author_email = $_POST['newcomment_author_email']; 310 $newcomment_author_url = $_POST['newcomment_author_url']; 311 $comment_status = $_POST['comment_status']; 312 313 if (!user_can_edit_post_comments($user_ID, $comment_post_ID)) { 314 die( __('You are not allowed to edit comments on this post, so you cannot edit this comment.') ); 315 } 316 317 if (user_can_edit_post_date($user_ID, $post_ID) && (!empty($_POST['edit_date']))) { 318 $aa = $_POST['aa']; 319 $mm = $_POST['mm']; 320 $jj = $_POST['jj']; 321 $hh = $_POST['hh']; 322 $mn = $_POST['mn']; 323 $ss = $_POST['ss']; 324 $jj = ($jj > 31) ? 31 : $jj; 325 $hh = ($hh > 23) ? $hh - 24 : $hh; 326 $mn = ($mn > 59) ? $mn - 60 : $mn; 327 $ss = ($ss > 59) ? $ss - 60 : $ss; 328 $datemodif = ", comment_date = '$aa-$mm-$jj $hh:$mn:$ss'"; 329 } else { 330 $datemodif = ''; 331 } 332 $content = apply_filters('comment_save_pre', $_POST['content']); 333 334 $result = $wpdb->query(" 335 UPDATE $wpdb->comments SET 336 comment_content = '$content', 337 comment_author = '$newcomment_author', 338 comment_author_email = '$newcomment_author_email', 339 comment_approved = '$comment_status', 340 comment_author_url = '$newcomment_author_url'".$datemodif." 341 WHERE comment_ID = $comment_ID" 342 ); 306 edit_comment(); 343 307 344 308 $referredby = $_POST['referredby']; … … 348 312 header ("Location: edit.php?p=$comment_post_ID&c=1#comments"); 349 313 } 350 do_action('edit_comment', $comment_ID); 314 351 315 break; 352 316
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)