~canonical-sysadmins/wordpress/3.9.x

« back to all changes in this revision

Viewing changes to wp-admin/includes/comment.php

  • Committer: Andrew Glen-Young
  • Date: 2011-03-08 14:47:51 UTC
  • Revision ID: andrew.glen-young@canonical.com-20110308144751-1n6spqgayztf9h77
[AGY] import 3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
/**
10
10
 * {@internal Missing Short Description}}
11
11
 *
12
 
 * @since unknown
 
12
 * @since 2.0.0
13
13
 * @uses $wpdb
14
14
 *
15
 
 * @param string $comment_author
16
 
 * @param string $comment_date
 
15
 * @param string $comment_author Author of the comment
 
16
 * @param string $comment_date Date of the comment
17
17
 * @return mixed Comment ID on success.
18
18
 */
19
19
function comment_exists($comment_author, $comment_date) {
27
27
}
28
28
 
29
29
/**
30
 
 * {@internal Missing Short Description}}
 
30
 * Update a comment with values provided in $_POST.
31
31
 *
32
 
 * @since unknown
 
32
 * @since 2.0.0
33
33
 */
34
34
function edit_comment() {
35
35
 
36
 
        $comment_post_ID = (int) $_POST['comment_post_ID'];
37
 
 
38
 
        if (!current_user_can( 'edit_post', $comment_post_ID ))
39
 
                wp_die( __('You are not allowed to edit comments on this post, so you cannot edit this comment.' ));
 
36
        if ( ! current_user_can( 'edit_comment', (int) $_POST['comment_ID'] ) )
 
37
                wp_die ( __( 'You are not allowed to edit comments on this post.' ) );
40
38
 
41
39
        $_POST['comment_author'] = $_POST['newcomment_author'];
42
40
        $_POST['comment_author_email'] = $_POST['newcomment_author_email'];
52
50
                }
53
51
        }
54
52
 
55
 
        if (!empty ( $_POST['edit_date'] ) ) {
 
53
        if ( !empty ( $_POST['edit_date'] ) ) {
56
54
                $aa = $_POST['aa'];
57
55
                $mm = $_POST['mm'];
58
56
                $jj = $_POST['jj'];
66
64
                $_POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
67
65
        }
68
66
 
69
 
        wp_update_comment( $_POST);
 
67
        wp_update_comment( $_POST );
70
68
}
71
69
 
72
70
/**
73
71
 * {@internal Missing Short Description}}
74
72
 *
75
 
 * @since unknown
 
73
 * @since 2.0.0
76
74
 *
77
 
 * @param unknown_type $id
78
 
 * @return unknown
 
75
 * @param int $id ID of comment to retrieve
 
76
 * @return bool|object Comment if found. False on failure.
79
77
 */
80
78
function get_comment_to_edit( $id ) {
81
79
        if ( !$comment = get_comment($id) )
98
96
/**
99
97
 * Get the number of pending comments on a post or posts
100
98
 *
101
 
 * @since unknown
 
99
 * @since 2.3.0
102
100
 * @uses $wpdb
103
101
 *
104
102
 * @param int|array $post_id Either a single Post ID or an array of Post IDs
158
156
        if ( 'true' == get_user_option( 'comment_shortcuts' ) )
159
157
                wp_enqueue_script( 'jquery-table-hotkeys' );
160
158
}
161
 
 
162
 
if ( is_admin() && isset($pagenow) && ('edit-comments.php' == $pagenow || 'edit.php' == $pagenow) ) {
163
 
        if ( get_option('show_avatars') )
164
 
                add_filter( 'comment_author', 'floated_admin_avatar' );
165
 
}
166
 
 
167
159
?>