approve_comment($commentID, $postID);
break;
case "0":
$WPrapAjaxEditComments->moderate_comment($commentID, $postID);
break;
case "delete":
$message = $WPrapAjaxEditComments->delete_comment($commentID, $postID);
die('');
break;
case "spam":
$WPrapAjaxEditComments->spam_comment($commentID, $postID);
break;
}
}
if ($action == "gettimeleft") {
$WPrapAjaxEditComments->get_time_left($commentID);
die('');
} elseif ($action == "editcomment") {
$WPrapAjaxEditComments->get_comment($commentID, $postID);
die('');
} elseif ($action == "movecomment") {
check_admin_referer('wp-ajax-edit-comments_move-comment');
$response = new WP_Ajax_Response();
if (isset($_POST['post_offset'])) {
$response = $WPrapAjaxEditComments->get_posts((int)$_POST['post_offset']);
}
if (isset($_POST['post_title'])) {
$response = $WPrapAjaxEditComments->get_posts_by_title($_POST['post_title']);
}
if (isset($_POST['post_id'])) {
$response = $WPrapAjaxEditComments->get_posts_by_id((int)$_POST['post_id']);
}
if (isset($_POST['newid'])) {
die($WPrapAjaxEditComments->move_comment($commentID, $_POST['pid'],$_POST['newid']));
die('');
}
$response->send();
die('');
} elseif ($action == "savecomment") {
if ($WPrapAjaxEditComments->is_comment_owner($postID)) {
check_admin_referer('wp-ajax-edit-comments_save-comment');
}
$comment = get_comment($commentID, ARRAY_A);
$comment['comment_content'] = trim(urldecode($_POST['comment_content']));
if ($WPrapAjaxEditComments->can_edit_name($commentID, $postID)) {
$comment['comment_author'] = trim(strip_tags(urldecode($_POST['comment_author'])));
}
if ($WPrapAjaxEditComments->can_edit_email($commentID, $postID)) {
$comment['comment_author_email'] = trim(strip_tags(urldecode($_POST['comment_author_email'])));
}
if ($WPrapAjaxEditComments->can_edit_url($commentID, $postID)) {
$comment['comment_author_url'] = trim(strip_tags(urldecode($_POST['comment_author_url'])));
//Quick JS Test
if ($comment['comment_author_email'] == "undefined") {$comment['comment_author_email']='';}
if ($comment['comment_author_url'] == "undefined") {$comment['comment_author_url']='http://';}
if ($comment['comment_author'] == "undefined") {$comment['comment_author']='';}
}
//For the date function
if (isset($_POST['aa'])) {
$aa = (int)urldecode($_POST['aa']);
$mm = (int)urldecode($_POST['mm']);
$jj = (int)urldecode($_POST['jj']);
$hh = (int)urldecode($_POST['hh']);
$mn = (int)urldecode($_POST['mn']);
$ss = (int)urldecode($_POST['ss']);
$jj = ($jj > 31 ) ? 31 : $jj;
$hh = ($hh > 23 ) ? $hh -24 : $hh;
$mn = ($mn > 59 ) ? $mn -60 : $mn;
$ss = ($ss > 59 ) ? $ss -60 : $ss;
$comment['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
}
$response = new WP_Ajax_Response();
$response = @$WPrapAjaxEditComments->save_comment($commentID, $postID, $comment);
$response = apply_filters('wp_ajax_comments_save_comment', $response, $comment, $_POST);
$response->send();
die('');
} else {
check_ajax_referer($action . "_" . $commentID);
}
switch ($action) {
case "deletecomment":
$message = $WPrapAjaxEditComments->delete_comment($commentID, $postID);
$message = ($message == 1 ? 1: $WPrapAjaxEditComments->get_error($message));
die('' . $message);
break;
case "spamcomment":
$message = $WPrapAjaxEditComments->spam_comment($commentID, $postID);
$message = ($message == 1 ? 1: $WPrapAjaxEditComments->get_error($message));
die('' . $message);
break;
case "approvecomment":
$message = $WPrapAjaxEditComments->approve_comment($commentID, $postID);
$message = ($message == 1 ? 1: $WPrapAjaxEditComments->get_error($message));
die('' . $message);
break;
case "unapprovecomment":
$message = $WPrapAjaxEditComments->moderate_comment($commentID, $postID);
$message = ($message == 1 ? 1: $WPrapAjaxEditComments->get_error($message));
die('' . $message);
break;
case "delinkcomment":
$comment = get_comment($commentID, ARRAY_A);
$comment['comment_author_url'] = '';
$message = $WPrapAjaxEditComments->delink_comment($commentID, $postID, $comment);
$message = ($message == 1 ? 1: $WPrapAjaxEditComments->get_error($message));
die('' . $message);
break;
case "requestdeletion":
$message = $WPrapAjaxEditComments->request_deletion($commentID, $postID, trim(strip_tags(urldecode($_POST['message']))));
$message = ($message == 1 ? 1: $WPrapAjaxEditComments->get_error($message));
die('' . $message);
break;
}
}
die('');
?>