public static XPathNodeIterator Comment(int commentID) { XmlDocument xd = new XmlDocument(); Businesslogic.Comment c = new uForum.Businesslogic.Comment(commentID); return c.ToXml(xd).CreateNavigator().Select("."); }
public static int CommentPageNumber(int commentId, int itemsPerPage) { Businesslogic.Comment c = new uForum.Businesslogic.Comment(commentId); int position = c.Position - 1; return (int)(position / itemsPerPage); }
public static string DeleteComment(int commentId) { int _currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0; if (User.GetCurrent() != null || Xslt.IsMemberInGroup("admin", _currentMember)) { Businesslogic.Comment c = new uForum.Businesslogic.Comment(commentId); c.Delete(); return "true"; } return "false"; }
public static string EditComment(int commentId, int itemsPerPage) { int _currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0; Businesslogic.Comment c = new uForum.Businesslogic.Comment(commentId); if (c.Editable(_currentMember)) { string body = HttpContext.Current.Request["body"]; c.Body = body; c.Save(); return Xslt.NiceCommentUrl(c.TopicId, c.Id, itemsPerPage); } return ""; }
void Comment_AfterCreate(object sender, uForum.Businesslogic.CreateEventArgs e) { uForum.Businesslogic.Comment c = (uForum.Businesslogic.Comment)sender; //WB added to show these events are firing... umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, c.Id, "Comment_AfterCreate in ForumPostsCounter() class is starting"); Member mem = new Member(c.MemberId); int posts = 0; int.TryParse(mem.getProperty("forumPosts").Value.ToString(), out posts); mem.getProperty("forumPosts").Value = (posts + 1); mem.Save(); mem.XmlGenerate(new System.Xml.XmlDocument()); //Performs the action NewTopic in case we want to reward people for creating new posts. uPowers.BusinessLogic.Action a = new uPowers.BusinessLogic.Action("NewComment"); a.Perform(mem.Id, c.Id, "New comment created"); //WB added to show these events are firing... umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, c.Id, "Comment_AfterCreate in ForumPostsCounter() class is finishing"); }
public static string NiceCommentUrl(int topicId, int commentId, int itemsPerPage) { string url = NiceTopicUrl(topicId); if (!string.IsNullOrEmpty(url)) { Businesslogic.Comment c = new uForum.Businesslogic.Comment(commentId); int position = c.Position - 1; int page = (int)(position / itemsPerPage); url += "?p=" + page.ToString() + "#comment" + c.Id.ToString(); } return url; }
private void SanitizeComment(uForum.Businesslogic.Comment c) { c.Body = our.Utills.Sanitize(c.Body); }