Example #1
0
<?php

/**
 * Edit Comments Administration Panel.
 *
 * @package WordPress
 * @subpackage Administration
 */
/** WordPress Administration Bootstrap */
require_once './admin.php';
require_once './includes/default-list-tables.php';
$wp_list_table = new WP_Comments_Table();
$wp_list_table->check_permissions();
if (isset($_REQUEST['doaction']) || isset($_REQUEST['doaction2']) || isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2'])) {
    check_admin_referer('bulk-comments');
    if ((isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2'])) && !empty($_REQUEST['pagegen_timestamp'])) {
        $comment_status = $wpdb->escape($_REQUEST['comment_status']);
        $delete_time = $wpdb->escape($_REQUEST['pagegen_timestamp']);
        $comment_ids = $wpdb->get_col("SELECT comment_ID FROM {$wpdb->comments} WHERE comment_approved = '{$comment_status}' AND '{$delete_time}' > comment_date_gmt");
        $doaction = 'delete';
    } elseif (($_REQUEST['action'] != -1 || $_REQUEST['action2'] != -1) && isset($_REQUEST['delete_comments'])) {
        $comment_ids = $_REQUEST['delete_comments'];
        $doaction = $_REQUEST['action'] != -1 ? $_REQUEST['action'] : $_REQUEST['action2'];
    } elseif ($_REQUEST['doaction'] == 'undo' && isset($_REQUEST['ids'])) {
        $comment_ids = array_map('absint', explode(',', $_REQUEST['ids']));
        $doaction = $_REQUEST['action'];
    } else {
        wp_redirect(wp_get_referer());
    }
    $approved = $unapproved = $spammed = $unspammed = $trashed = $untrashed = $deleted = 0;
    $redirect_to = remove_query_arg(array('trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids'), wp_get_referer());
Example #2
0
     check_ajax_referer('replyto-comment', '_ajax_nonce-replyto-comment');
     $comment_post_ID = (int) $_POST['comment_post_ID'];
     if (!current_user_can('edit_post', $comment_post_ID)) {
         die('-1');
     }
     if ('' == $_POST['content']) {
         die(__('Error: please type a comment.'));
     }
     $comment_id = (int) $_POST['comment_ID'];
     $_POST['comment_status'] = $_POST['status'];
     edit_comment();
     $position = isset($_POST['position']) && (int) $_POST['position'] ? (int) $_POST['position'] : '-1';
     $checkbox = isset($_POST['checkbox']) && true == $_POST['checkbox'] ? 1 : 0;
     $comments_listing = isset($_POST['comments_listing']) ? $_POST['comments_listing'] : '';
     require_once './includes/default-list-tables.php';
     $wp_list_table = new WP_Comments_Table();
     ob_start();
     $wp_list_table->single_row($comment_id, $mode, $comments_listing, $checkbox);
     $comment_list_item = ob_get_contents();
     ob_end_clean();
     $x = new WP_Ajax_Response();
     $x->add(array('what' => 'edit_comment', 'id' => $comment->comment_ID, 'data' => $comment_list_item, 'position' => $position));
     $x->send();
     break;
 case 'add-menu-item':
     if (!current_user_can('edit_theme_options')) {
         die('-1');
     }
     check_ajax_referer('add-menu_item', 'menu-settings-column-nonce');
     require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
     $item_ids = wp_save_nav_menu_items(0, $_POST['menu-item']);
Example #3
0
/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $position
 * @param unknown_type $checkbox
 * @param unknown_type $mode
 */
function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', $table_row = true)
{
    // allow plugin to replace the popup content
    $content = apply_filters('wp_comment_reply', '', array('position' => $position, 'checkbox' => $checkbox, 'mode' => $mode));
    if (!empty($content)) {
        echo $content;
        return;
    }
    require_once './includes/default-list-tables.php';
    $wp_list_table = new WP_Comments_Table('reply');
    $columns = $wp_list_table->get_column_headers();
    $hidden = array_intersect(array_keys($columns), array_filter($wp_list_table->get_hidden_columns()));
    $col_count = count($columns) - count($hidden);
    ?>
<form method="get" action="">
<?php 
    if ($table_row) {
        ?>
<table style="display:none;"><tbody id="com-reply"><tr id="replyrow" style="display:none;"><td colspan="<?php 
        echo $col_count;
        ?>
">
<?php 
    } else {
        ?>
<div id="com-reply" style="display:none;"><div id="replyrow" style="display:none;">
<?php 
    }
    ?>
	<div id="replyhead" style="display:none;"><?php 
    _e('Reply to Comment');
    ?>
</div>

	<div id="edithead" style="display:none;">
		<div class="inside">
		<label for="author"><?php 
    _e('Name');
    ?>
</label>
		<input type="text" name="newcomment_author" size="50" value="" tabindex="101" id="author" />
		</div>

		<div class="inside">
		<label for="author-email"><?php 
    _e('E-mail');
    ?>
</label>
		<input type="text" name="newcomment_author_email" size="50" value="" tabindex="102" id="author-email" />
		</div>

		<div class="inside">
		<label for="author-url"><?php 
    _e('URL');
    ?>
</label>
		<input type="text" id="author-url" name="newcomment_author_url" size="103" value="" tabindex="103" />
		</div>
		<div style="clear:both;"></div>
	</div>

	<div id="replycontainer"><textarea rows="8" cols="40" name="replycontent" tabindex="104" id="replycontent"></textarea></div>

	<p id="replysubmit" class="submit">
	<a href="#comments-form" class="cancel button-secondary alignleft" tabindex="106"><?php 
    _e('Cancel');
    ?>
</a>
	<a href="#comments-form" class="save button-primary alignright" tabindex="104">
	<span id="savebtn" style="display:none;"><?php 
    _e('Update Comment');
    ?>
</span>
	<span id="replybtn" style="display:none;"><?php 
    _e('Submit Reply');
    ?>
</span></a>
	<img class="waiting" style="display:none;" src="<?php 
    echo esc_url(admin_url('images/wpspin_light.gif'));
    ?>
" alt="" />
	<span class="error" style="display:none;"></span>
	<br class="clear" />
	</p>

	<input type="hidden" name="user_ID" id="user_ID" value="<?php 
    echo get_current_user_id();
    ?>
" />
	<input type="hidden" name="action" id="action" value="" />
	<input type="hidden" name="comment_ID" id="comment_ID" value="" />
	<input type="hidden" name="comment_post_ID" id="comment_post_ID" value="" />
	<input type="hidden" name="status" id="status" value="" />
	<input type="hidden" name="position" id="position" value="<?php 
    echo $position;
    ?>
" />
	<input type="hidden" name="checkbox" id="checkbox" value="<?php 
    echo $checkbox ? 1 : 0;
    ?>
" />
	<input type="hidden" name="mode" id="mode" value="<?php 
    echo esc_attr($mode);
    ?>
" />
	<?php 
    wp_nonce_field('replyto-comment', '_ajax_nonce-replyto-comment', false);
    ?>
	<?php 
    wp_comment_form_unfiltered_html_nonce();
    if ($table_row) {
        ?>
</td></tr></tbody></table>
<?php 
    } else {
        ?>
</div></div>
<?php 
    }
    ?>
</form>
<?php 
}
Example #4
0
/**
 * Display comments for post.
 *
 * @since 2.8.0
 *
 * @param object $post
 */
function post_comment_meta_box($post)
{
    global $wpdb, $post_ID;
    $total = $wpdb->get_var($wpdb->prepare("SELECT count(1) FROM {$wpdb->comments} WHERE comment_post_ID = '%d' AND ( comment_approved = '0' OR comment_approved = '1')", $post_ID));
    if (1 > $total) {
        echo '<p>' . __('No comments yet.') . '</p>';
        return;
    }
    wp_nonce_field('get-comments', 'add_comment_nonce', false);
    add_filter('manage_edit-comments_columns', 'post_comment_meta_box_thead', 8, 1);
    add_filter('manage_edit-comments_sortable_columns', create_function('', 'return array();'), 8);
    require_once './includes/default-list-tables.php';
    $wp_list_table = new WP_Comments_Table();
    ?>

<table class="widefat comments-box fixed" cellspacing="0" style="display:none;">
<thead><tr>
	<?php 
    $wp_list_table->print_column_headers();
    ?>
</tr></thead>
<tbody id="the-comment-list" class="list:comment"></tbody>
</table>
<p class="hide-if-no-js"><a href="#commentstatusdiv" id="show-comments" onclick="commentsBox.get(<?php 
    echo $total;
    ?>
);return false;"><?php 
    _e('Show comments');
    ?>
</a> <img class="waiting" style="display:none;" src="<?php 
    echo esc_url(admin_url('images/wpspin_light.gif'));
    ?>
" alt="" /></p>
<?php 
    $hidden = get_hidden_meta_boxes('post');
    if (!in_array('commentsdiv', $hidden)) {
        ?>
		<script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php 
        echo $total;
        ?>
, 10);});</script>
<?php 
    }
    remove_filter('manage_edit-comments_columns', 'post_comment_meta_box_thead');
    wp_comment_trashnotice();
}