case 'unspamcomment' : case 'approvecomment' : case 'unapprovecomment' : $comment_id = absint( $_REQUEST['c'] ); if ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) check_admin_referer( 'approve-comment_' . $comment_id ); else check_admin_referer( 'delete-comment_' . $comment_id ); $noredir = isset($_REQUEST['noredir']); if ( !$comment = get_comment($comment_id) ) comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">' . __('Go back') . '</a>.', 'edit-comments.php') ); if ( !current_user_can( 'edit_comment', $comment->comment_ID ) ) comment_footer_die( __('You are not allowed to edit comments on this post.') ); if ( '' != wp_get_referer() && ! $noredir && false === strpos(wp_get_referer(), 'comment.php') ) $redir = wp_get_referer(); elseif ( '' != wp_get_original_referer() && ! $noredir ) $redir = wp_get_original_referer(); elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) $redir = admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) ); else $redir = admin_url('edit-comments.php'); $redir = remove_query_arg( array('spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids', 'approved', 'unapproved'), $redir ); switch ( $action ) { case 'deletecomment' : wp_delete_comment( $comment_id );
} exit; break; case 'approvecomment': $comment_id = absint($_GET['c']); check_admin_referer('approve-comment_' . $comment_id); if (isset($_GET['noredir'])) { $noredir = true; } else { $noredir = false; } if (!($comment = get_comment($comment_id))) { comment_footer_die(__('Oops, no comment with this ID.') . sprintf(' <a href="%s">' . __('Go back') . '</a>!', 'edit.php')); } if (!current_user_can('edit_post', $comment->comment_post_ID)) { comment_footer_die(__('You are not allowed to edit comments on this post, so you cannot approve this comment.')); } wp_set_comment_status($comment->comment_ID, 'approve'); if ('' != wp_get_referer() && false == $noredir) { wp_redirect(wp_get_referer()); } else { wp_redirect(admin_url('edit-comments.php?p=' . absint($comment->comment_post_ID) . '#comments')); } exit; break; case 'editedcomment': $comment_id = absint($_POST['comment_ID']); $comment_post_id = absint($_POST['comment_post_ID']); check_admin_referer('update-comment_' . $comment_id); edit_comment(); $location = (empty($_POST['referredby']) ? "edit-comments.php?p={$comment_post_id}" : $_POST['referredby']) . '#comment-' . $comment_id;
function my_ajax() { comment_footer_die("chao the gioi"); }
/** * Process the selected action for a single contribution * * @since 1.0.0 */ public function process_contribution_action() { if (!isset($_REQUEST['action']) || !isset($_REQUEST['c'])) { return; } switch ($_REQUEST['action']) { case 'flagcomment': $comment_id = absint($_REQUEST['c']); check_admin_referer('delete-comment_' . $comment_id); $noredir = isset($_REQUEST['noredir']); if (!($comment = get_comment($comment_id))) { comment_footer_die(__('Oops, no comment with this ID.', WC_Product_Reviews_Pro::TEXT_DOMAIN) . sprintf(' <a href="%s">' . __('Go back', WC_Product_Reviews_Pro::TEXT_DOMAIN) . '</a>.', 'admin.php?page=contributions')); } if ('' != wp_get_referer() && !$noredir && false === strpos(wp_get_referer(), 'page=contributions')) { $redir = wp_get_referer(); } elseif ('' != wp_get_original_referer() && !$noredir) { $redir = wp_get_original_referer(); } else { $redir = admin_url('admin.php?page=contributions'); } $redir = remove_query_arg(array('ids', 'flagged'), $redir); $contribution = wc_product_reviews_pro_get_contribution($comment_id); if ($contribution && $contribution->flag()) { $redir = add_query_arg(array('flagged' => '1'), $redir); } wp_redirect(esc_url_raw($redir)); exit; break; } }
function save_meta_box_postdata($comment_id) { if (!wp_verify_nonce($_POST['featured_comments_nonce'], plugin_basename(__FILE__))) { return; } if (!current_user_can('moderate_comments', $comment_id)) { comment_footer_die(__('You are not allowed to edit comments on this post.', 'featured-comments')); } update_comment_meta($comment_id, 'featured', isset($_POST['featured']) ? '1' : '0'); update_comment_meta($comment_id, 'buried', isset($_POST['buried']) ? '1' : '0'); }