private void LoadList() { IList <Category> listComplete = ForumsManager.GetAllCategories(); listRepeater.DataSource = listComplete; listRepeater.DataBind(); }
private static string CreateForumProvider(string forumTitle, string forumDescription) { ForumsManager forumsManager = ForumsManager.GetManager(); Forum forum = forumsManager.CreateForum(); forum.Title = forumTitle + " forum"; forum.Description = forumDescription + " description"; forum.UrlName = Regex.Replace(forumTitle.ToLower(), @"[^\w\-\!\$\'\(\)\=\@\d_]+", "-"); forumsManager.RecompileItemUrls <Forum>(forum); forumsManager.SaveChanges(); return(forum.Title); }
private void ValidateUpdatingForumPost(ForumPost post, string origin, Guid userId) { var catchSpamInForums = Config.Get <AkismetModuleConfig>().ProtectForums; if (catchSpamInForums) { var forumsMan = ForumsManager.GetManager(string.Empty, "DummyTransaction"); var existingPost = forumsMan.GetPost(post.Id); if (existingPost != null && existingPost.IsMarkedSpam != post.IsMarkedSpam) { Akismet akismetApiClient = new Akismet(Config.Get <AkismetModuleConfig>().ApiKey, "http://www.sitefinity.com", "SitefinityAkismetModule"); if (!akismetApiClient.VerifyKey()) { return; } var akismetDbContext = new AkismetEntityContext(); var existingAkismetData = akismetDbContext.AkismetDataList.SingleOrDefault(a => a.ContentItemId == post.Id); if (existingAkismetData != null) { var updatedForumPost = new AkismetComment() { Blog = "http://www.sitefinity.com", CommentContent = post.Content, CommentType = "comment", Referrer = existingAkismetData.Referrer, UserAgent = existingAkismetData.UserAgent, UserIp = existingAkismetData.UserIP, }; if (post.IsMarkedSpam) { // the item has been marked as spam akismetApiClient.SubmitSpam(updatedForumPost); } else { // the item has been marked as ham akismetApiClient.SubmitHam(updatedForumPost); } } } } }
private void LoadTopic() { Topic topic = ForumsManager.GetTopic(IdTopic); //BusiBlocks.CommsBlock.Forums.Category forum = topic.Category; if (!BusiBlocks.SecurityHelper.CanUserView(Page.User.Identity.Name, topic.Category.Id)) { throw new BusiBlocks.InvalidGroupMembershipException(); } //if (!BusiBlocks.SecurityHelper.HasGroupAccess(Page.User.Identity.Name, topic)) // throw new BusiBlocks.InvalidGroupMembershipException(); //if (BusiBlocks.SecurityHelper.CanRead(Page.User, forum, null) == false) // throw new BusiBlocks.InvalidPermissionException("read forum"); IList <Message> messages = ForumsManager.GetMessagesByTopic(topic); ExploreMessages(messages, null, 0); }
private void CreateForums() { var groupId = new Guid(SampleForumGroupId); var mgr = ForumsManager.GetManager(); if (mgr.GetGroups().Where(g => g.Id == groupId).FirstOrDefault() == null) { // create forum group SampleUtilities.CreateForumGroup(groupId, "Sample Forum Group", "Sample Forum Group for the Sitefinity Event Logger Module website."); // create sample forum var forumId = new Guid(SampleForumId); SampleUtilities.CreateForum(forumId, groupId, "Sample Forum", "Sample Discussion Forum"); var forumContent = FILLER_TEXT; SampleUtilities.CreateForumThreadFromPost(forumId, new Guid(SampleThreadId), new Guid(SamplePostId), "Sample Post A", forumContent); } }
public void LoadTopic(string idTopic) { if (idTopic != null) { Topic topic = ForumsManager.GetTopic(idTopic); Category forum = topic.Category; if (!BusiBlocks.SecurityHelper.CanUserView(Page.User.Identity.Name, forum.Id)) { throw new BusiBlocks.InvalidGroupMembershipException(); } lblTopic.InnerText = topic.Title; lnkForum.HRef = Navigation.Communication_ForumView(forum.Name).GetServerUrl(true); IList <Message> messages = ForumsManager.GetMessagesByTopic(topic); ExploreMessages(messages, null, 0); viewTopic.IdTopic = idTopic; } }
private IQueryable <ForumPost> GetPosts(ForumThread thread) { // TODO: provider return(ForumsManager.GetManager().GetPosts(thread.Id)); }
private IQueryable <ForumThread> GetThreads() { // TODO: provider return(ForumsManager.GetManager().GetThreads().Where(x => x.Forum.Title == this.ForumName)); }