home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cricao de Sites - 650 Layouts Prontos
/
WebMasters.iso
/
Plugins
/
wp-ajax-edit-comments.1.1.4.3
/
php-includes
/
AjaxEditComments.php
Wrap
PHP Script
|
2008-02-19
|
3KB
|
87 lines
<?php
if (!function_exists('add_action'))
{ //
require_once("../../../../wp-config.php");
}
header('Content-Type: text/html; charset='.get_option('blog_charset').'');
//Gets the comment
if (isset($_POST['GetCommentId']) && isset($_POST['_wpnonce'])) {
//Strip out everything but the ID
$commentID = $rap_ajaxComment->getCommentID($_POST['GetCommentId']);
if(!$rap_ajaxComment->verifyNonce($_POST['_wpnonce'], 'wp-ajax-edit-comments-edit_comment')) { die("0") ;}
if ($commentID == 0) {
echo "0";
} else {
echo $rap_ajaxComment->getComment($commentID);
}
}
//Gets the time left to edit a comment
if (isset($_POST['LoadTimeId']) && isset($_POST['_wpnonce'])) {
$commentID = $rap_ajaxComment->getCommentID($_POST['LoadTimeId']);
if(!$rap_ajaxComment->verifyNonce($_POST['_wpnonce'], 'wp-ajax-edit-comments-load_time')) { die('0'); }
if ($commentID == 0) {
echo "0,0";
} else {
echo $rap_ajaxComment->getTimeLeft($commentID);
}
}
//Deletes or marks as spam
if (isset($_POST['CommentOption']) && isset($_POST['CommentId']) && isset($_POST['_wpnonce'])) {
if(!$rap_ajaxComment->verifyNonce($_POST['_wpnonce'], 'wp-ajax-edit-comments-delete_spam_comment')) { die("Operation failed") ;}
$commentID = $rap_ajaxComment->getCommentID($_POST['CommentId']);
if ($commentID == 0) {
_e('Operation Failed', "WPAjaxEditComments");
} else {
switch($_POST['CommentOption']) {
case "delete":
if($rap_ajaxComment->deleteComment($commentID)) {
echo "1";
} else {
_e('Could Not Delete Comment', "WPAjaxEditComments");
}
break;
case "spam":
if ($rap_ajaxComment->spamComment($commentID, "1")) {
echo "1";
}else {
_e('Could Not Mark as Spam', "WPAjaxEditComments"); }
break;
case "unspam":
if ($rap_ajaxComment->spamComment($commentID, "0")){
echo "1";
}else{
_e('Could Not De-Spam Comment', "WPAjaxEditComments");}
break;
}
}
}
//Saves the comment data
if (isset($_POST['SaveCommentId']) && isset($_POST['SaveContent']) && isset($_POST['_wpnonce'])) {
if(!$rap_ajaxComment->verifyNonce($_POST['_wpnonce'], 'wp-ajax-edit-comments-save_comment')) { die("0") ;}
$commentID = $rap_ajaxComment->getCommentID($_POST['SaveCommentId']);
if ($commentID == 0) {
echo "0";
} else {
$returnText = $rap_ajaxComment->saveComment($commentID, $_POST['SaveContent']);
if ($returnText === "spam") {
$returnText .= $rap_ajaxComment->getSpamText();
}
echo $returnText;
}
}
//Saves the author data
if (isset($_POST['SaveAuthorCommentId']) && isset($_POST['AuthorURL']) && isset($_POST['AuthorName']) && isset($_POST['_wpnonce'])) {
if(!$rap_ajaxComment->verifyNonce($_POST['_wpnonce'], 'wp-ajax-edit-comments-save_author')) { die("0") ;}
$commentID = $rap_ajaxComment->getCommentID($_POST['SaveAuthorCommentId']);
if ($commentID == 0) {
echo "0";
} else {
$returnText = $rap_ajaxComment->saveAuthor($commentID, $_POST['AuthorURL'], $_POST['AuthorName']);
if ($returnText === "spam") {
$returnText .= $rap_ajaxComment->getSpamText();
}
echo $returnText;
}
}
?>