예제 #1
0
        public void Move(int newForumId)
        {
            var moveEventArgs = new MoveEventArgs();

            FireBeforeMove(moveEventArgs);

            if (moveEventArgs.Cancel)
            {
                return;
            }

            var newF = new Forum(newForumId);
            var oldF = new Forum(ParentId);

            if (newF.Exists == false)
            {
                return;
            }

            ParentId = newForumId;
            Save(true);

            newF.Save();
            oldF.Save();


            FireAfterMove(moveEventArgs);
        }
예제 #2
0
        public void MarkAsSpam()
        {
            var e = new MarkAsSpamEventArgs();

            FireBeforeMarkAsSpam(e);

            if (e.Cancel)
            {
                return;
            }

            var topic = Topic.GetTopic(TopicId);
            var forum = new Forum(topic.ParentId);

            var member         = new Member(MemberId);
            var akismetApi     = Forum.GetAkismetApi();
            var akismetComment = Forum.ConstructAkismetComment(member, "comment", Body);

            akismetApi.SubmitSpam(akismetComment);

            Data.SqlHelper.ExecuteNonQuery("UPDATE forumComments SET isSpam = 1 WHERE id = " + Id);
            Id = 0;

            topic.Save(true);
            forum.Save();

            FireAfterMarkAsSpam(e);
        }
예제 #3
0
        public void MarkAsSpam()
        {
            var markAsSpamEventArgs = new MarkAsSpamEventArgs();

            FireBeforeMarkAsSpam(markAsSpamEventArgs);

            if (markAsSpamEventArgs.Cancel)
            {
                return;
            }

            var forum = new Forum(ParentId);

            var topic          = GetTopic(Id);
            var member         = new Member(topic.MemberId);
            var akismetApi     = Forum.GetAkismetApi();
            var akismetComment = Forum.ConstructAkismetComment(member, "topic", string.Format("{0} - {1}", Title, Body));

            akismetApi.SubmitSpam(akismetComment);

            Data.SqlHelper.ExecuteNonQuery("UPDATE forumTopics SET isSpam = 1 WHERE id = @id", Data.SqlHelper.CreateParameter("@id", Id.ToString(CultureInfo.InvariantCulture)));

            Id = 0;

            forum.Save();

            FireAfterMarkAsSpam(markAsSpamEventArgs);
        }
예제 #4
0
        public static Forum Create(int forumId, int parentId, int sortOrder)
        {
            Forum f = new Forum();

            f.Id        = forumId;
            f.ParentId  = parentId;
            f.SortOrder = sortOrder;
            f.Exists    = false;
            f.Save();
            return(f);
        }
예제 #5
0
        public void Delete()
        {
            var deleteEventArgs = new DeleteEventArgs();

            FireBeforeDelete(deleteEventArgs);

            if (deleteEventArgs.Cancel)
            {
                return;
            }

            var forum = new Forum(ParentId);

            Data.SqlHelper.ExecuteNonQuery("DELETE FROM forumTopics WHERE id = @id", Data.SqlHelper.CreateParameter("@id", Id.ToString(CultureInfo.InvariantCulture)));
            Id = 0;

            forum.Save();

            FireAfterDelete(deleteEventArgs);
        }
예제 #6
0
        public void Delete()
        {
            DeleteEventArgs e = new DeleteEventArgs();

            FireBeforeDelete(e);
            if (!e.Cancel)
            {
                Topic t = Topic.GetTopic(this.TopicId);
                Forum f = new Forum(t.ParentId);

                Data.SqlHelper.ExecuteNonQuery("DELETE FROM forumComments WHERE id = " + Id.ToString());
                Id = 0;

                t.Save(true);
                f.Save();


                FireAfterDelete(e);
            }
        }
예제 #7
0
파일: Topic.cs 프로젝트: ventil8/OurUmbraco
        public void Delete()
        {
            var deleteEventArgs = new DeleteEventArgs();
            FireBeforeDelete(deleteEventArgs);

            if (deleteEventArgs.Cancel)
                return;

            var forum = new Forum(ParentId);

            Data.SqlHelper.ExecuteNonQuery("DELETE FROM forumTopics WHERE id = @id", Data.SqlHelper.CreateParameter("@id", Id.ToString(CultureInfo.InvariantCulture)));
            Id = 0;

            forum.Save();

            FireAfterDelete(deleteEventArgs);
        }
예제 #8
0
 public static Forum Create(int forumId, int parentId, int sortOrder)
 {
     Forum f = new Forum();
     f.Id = forumId;
     f.ParentId = parentId;
     f.SortOrder = sortOrder;
     f.Exists = false;
     f.Save();
     return f;
 }
예제 #9
0
        public void Save()
        {
            if (Id == 0) {

                if (Library.Utills.IsMember(MemberId) && !string.IsNullOrEmpty(Body)) {
                    CreateEventArgs e = new CreateEventArgs();
                    FireBeforeCreate(e);
                    if (!e.Cancel) {
                        Data.SqlHelper.ExecuteNonQuery("INSERT INTO forumComments (topicId, memberId, body, position) VALUES(@topicId, @memberId, @body, @position)",
                            Data.SqlHelper.CreateParameter("@topicId", TopicId),
                            Data.SqlHelper.CreateParameter("@memberId", MemberId),
                            Data.SqlHelper.CreateParameter("@body", Body),
                            Data.SqlHelper.CreateParameter("@position", Position)
                            );

                        Created = DateTime.Now;
                        Id = Data.SqlHelper.ExecuteScalar<int>("SELECT MAX(id) FROM forumComments WHERE memberId = @memberId",
                            Data.SqlHelper.CreateParameter("@memberId", MemberId));

                        Topic t = Topic.GetTopic(TopicId);
                        if (t.Exists) {
                            t.Save();
                        }

                        Forum f = new Forum(t.ParentId);
                        if (f.Exists) {
                            f.SetLatestComment(Id);
                            f.SetLatestTopic(t.Id);
                            f.SetLatestAuthor(MemberId);
                            f.LatestPostDate = DateTime.Now;
                            f.Save();
                        }

                        FireAfterCreate(e);
                    }
                }

            } else {

                UpdateEventArgs e = new UpdateEventArgs();
                FireBeforeUpdate(e);

                if (!e.Cancel) {
                    Data.SqlHelper.ExecuteNonQuery("UPDATE forumComments SET topicId = @topicId, memberId = @memberId, body = @body WHERE id = @id",
                        Data.SqlHelper.CreateParameter("@topicId", TopicId),
                        Data.SqlHelper.CreateParameter("@memberId", MemberId),
                        Data.SqlHelper.CreateParameter("@body", Body),
                        Data.SqlHelper.CreateParameter("@id", Id)
                        );
                    FireAfterUpdate(e);
                }
            }
        }
예제 #10
0
        public void Delete()
        {
            DeleteEventArgs e = new DeleteEventArgs();
            FireBeforeDelete(e);
            if (!e.Cancel) {
                Topic t = Topic.GetTopic(this.TopicId);
                Forum f = new Forum(t.ParentId);

                Data.SqlHelper.ExecuteNonQuery("DELETE FROM forumComments WHERE id = " + Id.ToString());
                Id = 0;

                t.Save(true);
                f.Save();

                FireAfterDelete(e);
            }
        }
예제 #11
0
        public void MarkAsSpam()
        {
            var e = new MarkAsSpamEventArgs();

            FireBeforeMarkAsSpam(e);

            if (e.Cancel)
                return;

            var topic = Topic.GetTopic(TopicId);
            var forum = new Forum(topic.ParentId);

            var member = new Member(MemberId);
            var akismetApi = Forum.GetAkismetApi();
            var akismetComment = Forum.ConstructAkismetComment(member, "comment", Body);
            akismetApi.SubmitSpam(akismetComment);

            Data.SqlHelper.ExecuteNonQuery("UPDATE forumComments SET isSpam = 1 WHERE id = " + Id);
            Id = 0;

            topic.Save(true);
            forum.Save();

            FireAfterMarkAsSpam(e);
        }
예제 #12
0
        public void MarkAsSpam()
        {
            var markAsSpamEventArgs = new MarkAsSpamEventArgs();
            FireBeforeMarkAsSpam(markAsSpamEventArgs);

            if (markAsSpamEventArgs.Cancel)
                return;

            var forum = new Forum(ParentId);

            var topic = GetTopic(Id);
            var member = new Member(topic.MemberId);
            var akismetApi = Forum.GetAkismetApi();
            var akismetComment = Forum.ConstructAkismetComment(member, "topic", string.Format("{0} - {1}", Title, Body));
            akismetApi.SubmitSpam(akismetComment);

            Data.SqlHelper.ExecuteNonQuery("UPDATE forumTopics SET isSpam = 1 WHERE id = @id", Data.SqlHelper.CreateParameter("@id", Id.ToString(CultureInfo.InvariantCulture)));

            Id = 0;

            forum.Save();

            FireAfterMarkAsSpam(markAsSpamEventArgs);
        }
예제 #13
0
        public void MarkAsHam()
        {
            var markAsHamEventArgs = new MarkAsHamEventArgs();
            FireBeforeMarkAsHam(markAsHamEventArgs);

            if (markAsHamEventArgs.Cancel)
                return;

            var forum = new Forum(ParentId);

            var topic = GetTopic(Id);
            var member = new Member(topic.MemberId);
            var akismetApi = Forum.GetAkismetApi();
            var akismetComment = Forum.ConstructAkismetComment(member, "topic", string.Format("{0} - {1}", Title, Body));
            akismetApi.SubmitHam(akismetComment);

            Data.SqlHelper.ExecuteNonQuery("UPDATE forumTopics SET isSpam = 0 WHERE id = @id", Data.SqlHelper.CreateParameter("@id", Id.ToString(CultureInfo.InvariantCulture)));

            Id = 0;

            forum.Save();

            // Set reputation to at least 50 so their next posts won't be automatically marked as spam
            int reputation;
            int.TryParse(member.getProperty("reputationTotal").Value.ToString(), out reputation);
            if (reputation < 50)
                member.getProperty("reputationTotal").Value = 50;

            int.TryParse(member.getProperty("reputationCurrent").Value.ToString(), out reputation);
            if (reputation < 50)
                member.getProperty("reputationCurrent").Value = 50;

            member.Save();

            FireAfterMarkAsHam(markAsHamEventArgs);
        }
예제 #14
0
        public void Save(bool silent, bool dontMarkAsSpam)
        {
            if (Id == 0)
            {
                if (Library.Utills.IsMember(MemberId) && !string.IsNullOrEmpty(Title) && !string.IsNullOrEmpty(Body))
                {
                    var createEventArgs = new CreateEventArgs();
                    FireBeforeCreate(createEventArgs);

                    if (createEventArgs.Cancel)
                    {
                        return;
                    }


                    UrlName = umbraco.cms.helpers.url.FormatUrl(Title);

                    Data.SqlHelper.ExecuteNonQuery("INSERT INTO forumTopics (parentId, memberId, title, urlName, body, latestReplyAuthor, isSpam) VALUES(@parentId, @memberId, @title, @urlname, @body, @latestReplyAuthor, @isSpam)",
                                                   Data.SqlHelper.CreateParameter("@parentId", ParentId),
                                                   Data.SqlHelper.CreateParameter("@memberId", MemberId),
                                                   Data.SqlHelper.CreateParameter("@title", Title),
                                                   Data.SqlHelper.CreateParameter("@urlname", UrlName),
                                                   Data.SqlHelper.CreateParameter("@latestReplyAuthor", LatestReplyAuthor),
                                                   Data.SqlHelper.CreateParameter("@body", Body),
                                                   Data.SqlHelper.CreateParameter("@isSpam", dontMarkAsSpam ? false : Forum.IsSpam(MemberId, string.Format("{0} - {1}", Title, Body), "topic"))
                                                   );

                    Created = DateTime.Now;
                    Updated = DateTime.Now;
                    Id      = Data.SqlHelper.ExecuteScalar <int>("SELECT MAX(id) FROM forumTopics WHERE memberId = @memberId", Data.SqlHelper.CreateParameter("@memberId", MemberId));

                    var forum = new Forum(ParentId);

                    if (forum.Exists)
                    {
                        forum.SetLatestTopic(Id);
                        forum.SetLatestAuthor(MemberId);
                        forum.LatestPostDate = DateTime.Now;
                        forum.Save();
                    }

                    // save tags
                    Tag.AddTagsToTopic(Id, Tags);

                    FireAfterCreate(createEventArgs);
                }
            }
            else
            {
                var updateEventArgs = new UpdateEventArgs();
                FireBeforeUpdate(updateEventArgs);

                if (updateEventArgs.Cancel == false)
                {
                    var totalComments = Data.SqlHelper.ExecuteScalar <int>("SELECT count(id) from forumComments where (forumComments.isSpam IS NULL OR forumComments.isSpam != 1) AND topicId = @id", Data.SqlHelper.CreateParameter("@id", Id));
                    LatestReplyAuthor = Data.SqlHelper.ExecuteScalar <int>("SELECT TOP 1 memberId FROM forumComments WHERE (forumComments.isSpam IS NULL OR forumComments.isSpam != 1) AND (topicId= @id) ORDER BY Created DESC ", Data.SqlHelper.CreateParameter("@id", Id));
                    LatestComment     = Data.SqlHelper.ExecuteScalar <int>("SELECT TOP 1 id FROM forumComments WHERE (forumComments.isSpam IS NULL OR forumComments.isSpam != 1) AND (topicId= @id) ORDER BY Created DESC ", Data.SqlHelper.CreateParameter("@id", Id));

                    UrlName = umbraco.cms.helpers.url.FormatUrl(Title);

                    if (silent == false)
                    {
                        Updated = DateTime.Now;
                    }

                    Data.SqlHelper.ExecuteNonQuery("UPDATE forumTopics SET replies = @replies, parentId = @parentId, memberId = @memberId, title = @title, urlname = @urlname, body = @body, updated = @updated, locked = @locked, latestReplyAuthor = @latestReplyAuthor, latestComment = @latestComment, isSpam = @isSpam WHERE id = @id",
                                                   Data.SqlHelper.CreateParameter("@parentId", ParentId),
                                                   Data.SqlHelper.CreateParameter("@memberId", MemberId),
                                                   Data.SqlHelper.CreateParameter("@title", Title),
                                                   Data.SqlHelper.CreateParameter("@urlname", UrlName),
                                                   Data.SqlHelper.CreateParameter("@body", Body),
                                                   Data.SqlHelper.CreateParameter("@id", Id),
                                                   Data.SqlHelper.CreateParameter("@updated", Updated),
                                                   Data.SqlHelper.CreateParameter("@latestReplyAuthor", LatestReplyAuthor),
                                                   Data.SqlHelper.CreateParameter("@latestComment", LatestComment),
                                                   Data.SqlHelper.CreateParameter("@locked", Locked),
                                                   Data.SqlHelper.CreateParameter("@replies", totalComments),
                                                   Data.SqlHelper.CreateParameter("@isSpam", dontMarkAsSpam ? false : Forum.IsSpam(MemberId, string.Format("{0} - {1}", Title, Body), "topic"))
                                                   );

                    // save tags
                    Tag.AddTagsToTopic(Id, Tags);

                    UpdateCommentsPosition();

                    FireAfterUpdate(updateEventArgs);
                }
            }
        }
예제 #15
0
파일: Topic.cs 프로젝트: ventil8/OurUmbraco
        public void Move(int newForumId)
        {
            var moveEventArgs = new MoveEventArgs();
            FireBeforeMove(moveEventArgs);

            if (moveEventArgs.Cancel)
                return;

            var newF = new Forum(newForumId);
            var oldF = new Forum(ParentId);

            if (newF.Exists == false)
                return;

            ParentId = newForumId;
            Save(true);

            newF.Save();
            oldF.Save();

            FireAfterMove(moveEventArgs);
        }
예제 #16
0
        public void Save(bool dontMarkAsSpam)
        {
            if (Id == 0)
            {
                if (Library.Utills.IsMember(MemberId) && !string.IsNullOrEmpty(Body))
                {
                    CreateEventArgs e = new CreateEventArgs();
                    FireBeforeCreate(e);
                    if (e.Cancel)
                    {
                        return;
                    }

                    Data.SqlHelper.ExecuteNonQuery("INSERT INTO forumComments (topicId, memberId, body, position, isSpam) VALUES(@topicId, @memberId, @body, @position, @isSpam)",
                                                   Data.SqlHelper.CreateParameter("@topicId", TopicId),
                                                   Data.SqlHelper.CreateParameter("@memberId", MemberId),
                                                   Data.SqlHelper.CreateParameter("@body", Body),
                                                   Data.SqlHelper.CreateParameter("@position", Position),
                                                   Data.SqlHelper.CreateParameter("@isSpam", dontMarkAsSpam ? false : Forum.IsSpam(MemberId, Body, "comment"))
                                                   );

                    Created = DateTime.Now;
                    Id      = Data.SqlHelper.ExecuteScalar <int>("SELECT MAX(id) FROM forumComments WHERE memberId = @memberId",
                                                                 Data.SqlHelper.CreateParameter("@memberId", MemberId));

                    Topic t = Topic.GetTopic(TopicId);
                    if (t.Exists)
                    {
                        t.Save();
                    }

                    Forum f = new Forum(t.ParentId);
                    if (f.Exists)
                    {
                        f.SetLatestComment(Id);
                        f.SetLatestTopic(t.Id);
                        f.SetLatestAuthor(MemberId);
                        f.LatestPostDate = DateTime.Now;
                        f.Save();
                    }


                    FireAfterCreate(e);
                }
            }
            else
            {
                UpdateEventArgs e = new UpdateEventArgs();
                FireBeforeUpdate(e);

                if (!e.Cancel)
                {
                    Data.SqlHelper.ExecuteNonQuery("UPDATE forumComments SET topicId = @topicId, memberId = @memberId, body = @body, isSpam = @isSpam WHERE id = @id",
                                                   Data.SqlHelper.CreateParameter("@topicId", TopicId),
                                                   Data.SqlHelper.CreateParameter("@memberId", MemberId),
                                                   Data.SqlHelper.CreateParameter("@body", Body),
                                                   Data.SqlHelper.CreateParameter("@id", Id),
                                                   Data.SqlHelper.CreateParameter("@isSpam", dontMarkAsSpam ? false : Forum.IsSpam(MemberId, Body, "comment"))
                                                   );
                    FireAfterUpdate(e);
                }
            }
        }
예제 #17
0
        public void MarkAsSpam()
        {
            var e = new MarkAsSpamEventArgs();

            FireBeforeMarkAsSpam(e);

            if (e.Cancel)
                return;

            var topic = Topic.GetTopic(TopicId);
            var forum = new Forum(topic.ParentId);

            Member member = null;
            try { member = new Member(topic.MemberId); }
            catch (Exception) { }

            if (member != null)
            {
                member.getProperty("blocked").Value = true;
                member.Save();
            }

            Data.SqlHelper.ExecuteNonQuery("UPDATE forumComments SET isSpam = 1 WHERE id = " + Id);
            Id = 0;

            topic.Save(true, true);
            forum.Save();

            member.getProperty("blocked").Value = true;
            member.Save();

            Forum.SendSpamMail(Body, TopicId, "comment", member == null ? 0 : member.Id, true);

            FireAfterMarkAsSpam(e);
        }
예제 #18
0
        public void MarkAsHam()
        {
            var e = new MarkAsHamEventArgs();

            FireBeforeMarkAsHam(e);

            if (e.Cancel)
                return;

            var topic = Topic.GetTopic(TopicId);
            var forum = new Forum(topic.ParentId);

            var member = new Member(MemberId);

            Data.SqlHelper.ExecuteNonQuery("UPDATE forumComments SET isSpam = 0 WHERE id = " + Id);
            Id = 0;

            topic.Save(true);
            forum.Save();

            // Set reputation to at least 50 so their next posts won't be automatically marked as spam
            int reputation;
            int.TryParse(member.getProperty("reputationTotal").Value.ToString(), out reputation);
            if (reputation < 50)
                member.getProperty("reputationTotal").Value = 50;

            int.TryParse(member.getProperty("reputationCurrent").Value.ToString(), out reputation);
            if (reputation < 50)
                member.getProperty("reputationCurrent").Value = 50;

            member.getProperty("blocked").Value = false;
            member.Save();

            FireAfterMarkAsHam(e);
        }
예제 #19
0
        public void Move(int newForumId)
        {
            MoveEventArgs e = new MoveEventArgs();
            FireBeforeMove(e);

            if (!e.Cancel) {
                Forum newF = new Forum(newForumId);
                Forum oldF = new Forum(ParentId);

                if (newF.Exists) {
                    ParentId = newForumId;
                    Save(true);

                    newF.Save();
                    oldF.Save();

                    FireAfterMove(e);
                }
            }
        }
예제 #20
0
파일: Topic.cs 프로젝트: ventil8/OurUmbraco
        public void Save(bool silent)
        {
            if (Id == 0)
            {

                if (Library.Utills.IsMember(MemberId) && !string.IsNullOrEmpty(Title) && !string.IsNullOrEmpty(Body))
                {

                    var createEventArgs = new CreateEventArgs();
                    FireBeforeCreate(createEventArgs);

                    if (createEventArgs.Cancel == false)
                    {
                        UrlName = umbraco.cms.helpers.url.FormatUrl(Title);

                        Data.SqlHelper.ExecuteNonQuery("INSERT INTO forumTopics (parentId, memberId, title, urlName, body, latestReplyAuthor) VALUES(@parentId, @memberId, @title, @urlname, @body, @latestReplyAuthor)",
                            Data.SqlHelper.CreateParameter("@parentId", ParentId),
                            Data.SqlHelper.CreateParameter("@memberId", MemberId),
                            Data.SqlHelper.CreateParameter("@title", Title),
                            Data.SqlHelper.CreateParameter("@urlname", UrlName),
                            Data.SqlHelper.CreateParameter("@latestReplyAuthor", LatestReplyAuthor),
                            Data.SqlHelper.CreateParameter("@body", Body)
                        );

                        Created = DateTime.Now;
                        Updated = DateTime.Now;
                        Id = Data.SqlHelper.ExecuteScalar<int>("SELECT MAX(id) FROM forumTopics WHERE memberId = @memberId", Data.SqlHelper.CreateParameter("@memberId", MemberId));

                        var forum = new Forum(ParentId);

                        if (forum.Exists)
                        {
                            forum.SetLatestTopic(Id);
                            forum.SetLatestAuthor(MemberId);
                            forum.LatestPostDate = DateTime.Now;
                            forum.Save();
                        }

                        FireAfterCreate(createEventArgs);
                    }
                }

            }
            else
            {

                var updateEventArgs = new UpdateEventArgs();
                FireBeforeUpdate(updateEventArgs);

                if (updateEventArgs.Cancel == false)
                {
                    var totalComments = Data.SqlHelper.ExecuteScalar<int>("SELECT count(id) from forumComments where topicId = @id", Data.SqlHelper.CreateParameter("@id", Id));
                    LatestReplyAuthor = Data.SqlHelper.ExecuteScalar<int>("SELECT TOP 1 memberId FROM forumComments WHERE (topicId= @id) ORDER BY Created DESC ", Data.SqlHelper.CreateParameter("@id", Id));
                    LatestComment = Data.SqlHelper.ExecuteScalar<int>("SELECT TOP 1 id FROM forumComments WHERE (topicId= @id) ORDER BY Created DESC ", Data.SqlHelper.CreateParameter("@id", Id));

                    UrlName = umbraco.cms.helpers.url.FormatUrl(Title);

                    if (silent == false)
                        Updated = DateTime.Now;

                    Data.SqlHelper.ExecuteNonQuery("UPDATE forumTopics SET replies = @replies, parentId = @parentId, memberId = @memberId, title = @title, urlname = @urlname, body = @body, updated = @updated, locked = @locked, latestReplyAuthor = @latestReplyAuthor, latestComment = @latestComment WHERE id = @id",
                        Data.SqlHelper.CreateParameter("@parentId", ParentId),
                        Data.SqlHelper.CreateParameter("@memberId", MemberId),
                        Data.SqlHelper.CreateParameter("@title", Title),
                        Data.SqlHelper.CreateParameter("@urlname", UrlName),
                        Data.SqlHelper.CreateParameter("@body", Body),
                        Data.SqlHelper.CreateParameter("@id", Id),
                        Data.SqlHelper.CreateParameter("@updated", Updated),
                        Data.SqlHelper.CreateParameter("@latestReplyAuthor", LatestReplyAuthor),
                        Data.SqlHelper.CreateParameter("@latestComment", LatestComment),
                        Data.SqlHelper.CreateParameter("@locked", Locked),
                        Data.SqlHelper.CreateParameter("@replies", totalComments)
                    );

                    UpdateCommentsPosition();

                    FireAfterUpdate(updateEventArgs);
                }
            }
        }
예제 #21
0
파일: Topic.cs 프로젝트: Jeavon/OurUmbraco
        public void MarkAsSpam()
        {
            var markAsSpamEventArgs = new MarkAsSpamEventArgs();
            FireBeforeMarkAsSpam(markAsSpamEventArgs);

            if (markAsSpamEventArgs.Cancel)
                return;

            var forum = new Forum(ParentId);

            var topic = GetTopic(Id);
            var member = new Member(topic.MemberId);
            member.getProperty("blocked").Value = true;
            member.Save();

            Data.SqlHelper.ExecuteNonQuery("UPDATE forumTopics SET isSpam = 1 WHERE id = @id", Data.SqlHelper.CreateParameter("@id", Id.ToString(CultureInfo.InvariantCulture)));

            Id = 0;

            forum.Save();

            Forum.SendSpamMail(Body, Id, "topic", member.Id, true);

            FireAfterMarkAsSpam(markAsSpamEventArgs);
        }