public static string MarkCommentAsSpam(int commentId) { var currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0; if (User.GetCurrent() != null || Xslt.IsMemberInGroup("admin", currentMember)) { var comment = new Businesslogic.Comment(commentId); comment.MarkAsSpam(); return("true"); } return("false"); }
public static string NewComment(int topicId, int itemsPerPage) { var currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0; if (currentMember > 0 && topicId > 0) { var body = HttpContext.Current.Request["body"]; var comment = Businesslogic.Comment.Create(topicId, body, currentMember); return(Xslt.NiceCommentUrl(comment.TopicId, comment.Id, itemsPerPage)); } return(""); }
public static string MoveTopic(int topicId, int newForumId) { var currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0; if (Xslt.IsMemberInGroup("admin", currentMember)) { var topic = Businesslogic.Topic.GetTopic(topicId); topic.Move(newForumId); return(Xslt.NiceTopicUrl(topic.Id)); } return("false"); }
public static string MarkTopicAsSpam(int topicId) { var currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0; if (Xslt.IsMemberInGroup("admin", currentMember)) { var topic = Businesslogic.Topic.GetTopic(topicId); topic.MarkAsSpam(); return("true"); } return("false"); }
public static string EditComment(int commentId, int itemsPerPage) { var currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0; var comment = new Businesslogic.Comment(commentId); if (comment.Editable(currentMember)) { var body = HttpContext.Current.Request["body"]; comment.Body = body; comment.Save(); return(Xslt.NiceCommentUrl(comment.TopicId, comment.Id, itemsPerPage)); } return(""); }
public static string NewTopic(int forumId) { var node = new Node(forumId); var currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0; if (currentMember > 0 && Access.HasAccces(node.Id, currentMember)) { var title = HttpContext.Current.Request["title"]; var body = HttpContext.Current.Request["body"]; var tags = HttpContext.Current.Request["tags"]; var topic = Businesslogic.Topic.Create(forumId, title, body, currentMember); return(Xslt.NiceTopicUrl(topic.Id)); } return("0"); }
public static string EditTopic(int topicId) { var currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0; var topic = Businesslogic.Topic.GetTopic(topicId); if (topic.Editable(currentMember)) { var title = HttpContext.Current.Request["title"]; var body = HttpContext.Current.Request["body"]; var tags = HttpContext.Current.Request["tags"]; topic.Body = body; topic.Title = title; //topic.Tags = tags; topic.Save(false); return(Xslt.NiceTopicUrl(topic.Id)); } return("0"); }
public static string CleanBBCode(string html) { string str = html; Regex exp; // format the code tags: [code]my site[code] // becomes: <code>my site</code> exp = new Regex(@"\[code\](.+?)\[/code\]", RegexOptions.Singleline | RegexOptions.IgnoreCase ); Xslt x = new Xslt(); MatchEvaluator exp_eval = new MatchEvaluator(x.ReplaceCode); // Replace matched characters using the delegate method. str = exp.Replace(str, exp_eval); // format the url tags: [url=www.website.com]my site[/url] // becomes: <a href="www.website.com">my site</a> exp = new Regex(@"\[quote\=([^\]]+)\]([^\]]+)\[/quote\]", RegexOptions.Singleline); str = exp.Replace(str, "<blockquote>$2</blockquote>"); return str; }
public static string CleanBBCode(string html) { string str = html; Regex exp; // format the code tags: [code]my site[code] // becomes: <code>my site</code> exp = new Regex(@"\[code\](.+?)\[/code\]", RegexOptions.Singleline | RegexOptions.IgnoreCase); Xslt x = new Xslt(); MatchEvaluator exp_eval = new MatchEvaluator(x.ReplaceCode); // Replace matched characters using the delegate method. str = exp.Replace(str, exp_eval); // format the url tags: [url=www.website.com]my site[/url] // becomes: <a href="www.website.com">my site</a> exp = new Regex(@"\[quote\=([^\]]+)\]([^\]]+)\[/quote\]", RegexOptions.Singleline); str = exp.Replace(str, "<blockquote>$2</blockquote>"); return(str); }
public static string TopicUrl(int topicId) { HttpContext.Current.Response.Redirect(Xslt.NiceTopicUrl(topicId)); HttpContext.Current.Response.End(); return(""); }