public PartialViewResult Contact(ContactInfo model) {
model.ReconstructSettings();
this.ViewData[ContactInfo.Key] = model;
model.IsSaved = false;
LoadPage(model.Settings.Uri);
var settings = model.Settings;
if (settings.UseValidateHuman) {
bool IsValidated = model.ValidateHuman.ValidateValue(model.ValidationValue);
if (!IsValidated) {
ModelState.AddModelError("ValidationValue", model.ValidateHuman.AltValidationFailText);
model.ValidationValue = String.Empty;
}
}
//TODO: log the comment and B64 encode some of the settings (TBD)
if (ModelState.IsValid) {
string sIP = Request.ServerVariables["REMOTE_ADDR"].ToString();
PostComment pc = new PostComment();
pc.ContentCommentID = Guid.NewGuid();
pc.Root_ContentID = _page.ThePage.Root_ContentID;
pc.CreateDate = SiteData.CurrentSite.Now;
pc.IsApproved = false;
pc.IsSpam = false;
pc.CommenterIP = sIP;
pc.CommenterName = Server.HtmlEncode(model.CommenterName);
pc.CommenterEmail = Server.HtmlEncode(model.CommenterEmail ?? String.Empty);
pc.PostCommentText = Server.HtmlEncode(model.PostCommentText); //.Replace("<", "<").Replace(">", ">");
pc.CommenterURL = Server.HtmlEncode(model.CommenterURL ?? String.Empty);
pc.Save();
model.IsSaved = true;
model.CommenterName = String.Empty;
model.CommenterEmail = String.Empty;
model.PostCommentText = String.Empty;
model.CommenterURL = String.Empty;
model.ValidationValue = String.Empty;
this.ViewData[ContactInfo.Key] = model;
model.SendMail(pc, _page.ThePage);
ModelState.Clear();
}
return PartialView(settings.PostPartialName);
}