Changeset 5328
- Timestamp:
- 04/27/07 03:51:36 (1 year ago)
- Files:
-
- trunk/wp-includes/comment.php (modified) (2 diffs)
- trunk/wp-includes/link-template.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-includes/comment.php
r5307 r5328 74 74 global $comment_cache, $wpdb; 75 75 76 if ( empty($comment) ) 77 return null; 78 79 if ( is_object($comment) ) { 76 if ( empty($comment) ) { 77 if ( isset($GLOBALS['comment']) ) 78 $_comment = & $GLOBALS['comment']; 79 else 80 $_comment = null; 81 } elseif ( is_object($comment) ) { 80 82 if ( !isset($comment_cache[$comment->comment_ID]) ) 81 83 $comment_cache[$comment->comment_ID] = &$comment; … … 83 85 } else { 84 86 $comment = (int) $comment; 85 if ( !isset($comment_cache[$comment]) ) { 87 if ( isset($GLOBALS['comment']) && ($GLOBALS['comment']->id == $comment) ) { 88 $_comment = & $GLOBALS['comment']; 89 } elseif ( !isset($comment_cache[$comment]) ) { 86 90 $_comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment' LIMIT 1"); 87 91 $comment_cache[$comment->comment_ID] = & $_comment; trunk/wp-includes/link-template.php
r5302 r5328 297 297 function edit_post_link( $link = 'Edit This', $before = '', $after = '' ) { 298 298 global $post; 299 299 300 if ( $post->post_type == 'attachment' ) 301 return; 302 elseif ( $post->post_type == 'page' ) { 303 if ( !current_user_can( 'edit_page', $post->ID ) ) 304 return; 305 306 $file = 'page'; 307 } else { 308 if ( !current_user_can( 'edit_post', $post->ID ) ) 309 return; 310 311 $file = 'post'; 312 } 313 300 314 $link = '<a href="' . get_edit_post_link( $post->ID ) . '" title="' . __( 'Edit post' ) . '">' . $link . '</a>'; 301 315 echo $before . apply_filters( 'edit_post_link', $link, $post->ID ) . $after; … … 320 334 321 335 function edit_comment_link( $link = 'Edit This', $before = '', $after = '' ) { 322 global $comment; 323 336 global $comment, $post; 337 338 if ( $post->post_type == 'attachment' ) 339 return; 340 elseif ( $post->post_type == 'page' ) 341 if ( !current_user_can( 'edit_page', $post->ID ) ) 342 return; 343 else 344 if ( !current_user_can( 'edit_post', $post->ID ) ) 345 return; 346 324 347 $link = '<a href="' . get_edit_comment_link( $comment->comment_ID ) . '" title="' . __( 'Edit comment' ) . '">' . $link . '</a>'; 325 348 echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID ) . $after;
