public void MarkAsSpam(OxiteContext context, FormCollection form) { SpamCandidate spamCandidate = new SpamCandidate { blog = null, comment_author = form["commentCreatorName"], comment_author_email = form["commentCreatorEmail"], comment_author_url = form["commentCreatorUrl"], comment_content = form["commentBody"], comment_type = "comment", permalink = null, referrer = null, user_agent = form["commentCreatorUserAgent"], user_ip = form["commentCreatorIP"] }; context.GeneratePostRequest(GetApiMethodUri("submit-spam"), Version, spamCandidate.ToQueryString()).GetResponse(); }
public void MarkAsSpam(OxiteContext context, FormCollection form) { SpamCandidate spamCandidate = new SpamCandidate { blog = new Uri(context.Site.Host, context.HttpContext.Request.ApplicationPath), comment_author = form["commentCreatorName"], comment_author_email = form["commentCreatorEmail"], comment_author_url = form["commentCreatorUrl"], comment_content = form["commentBody"], comment_type = "comment", permalink = !string.IsNullOrEmpty(form["permalinkUri"]) ? new Uri(form["permalinkUri"]) : null, referrer = !string.IsNullOrEmpty(form["commentReferrerUri"]) ? new Uri(form["commentReferrerUri"]) : null, user_agent = form["commentCreatorUserAgent"], user_ip = form["commentCreatorIP"] }; context.GeneratePostRequest(GetApiMethodUri("submit-spam"), Version, spamCandidate.ToQueryString()).GetResponse(); }
public bool IsCommentSpam(OxiteContext context, CommentIn comment) { if (context.User.IsAuthenticated) { return(false); } SpamCandidate spamCandidate = new SpamCandidate { blog = null, comment_author = comment.CreatorName, comment_author_email = comment.CreatorEmail, comment_author_url = comment.CreatorUrl, comment_content = comment.Body, comment_type = "comment", permalink = null, referrer = context.HttpContext.Request.UrlReferrer, user_agent = context.HttpContext.Request.UserAgent, user_ip = context.HttpContext.Request.UserHostAddress }; HttpWebRequest validationRequest = context.GeneratePostRequest( GetApiMethodUri("comment-check"), Version, spamCandidate.ToQueryString() ); try { HttpWebResponse validationResponse = validationRequest.GetResponse() as HttpWebResponse; string responseCode = new StreamReader(validationResponse.GetResponseStream()).ReadToEnd(); return(bool.Parse(responseCode)); } catch { return(false); } }
public void MarkAsHam(OxiteContext context, SpamCandidate spamCandidate) { context.GeneratePostRequest(GetApiMethodUri("submit-ham"), Version, spamCandidate.ToQueryString()).GetResponse(); }