示例#1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            ForumThread thread          = new ForumThread(threadId, postId);
            bool        userCanEditPost = false;

            if (isModerator ||
                ((this.theUser != null) && (this.theUser.UserId == thread.PostUserId) && (thread.ForumId == forumId))
                )
            {
                userCanEditPost = true;
            }

            if (!userCanEditPost)
            {
                WebUtils.SetupRedirect(this, SiteUtils.GetCurrentPageUrl());
                return;
            }

            thread.ContentChanged += new ContentChangedEventHandler(thread_ContentChanged);



            if (thread.DeletePost(postId))
            {
                CurrentPage.UpdateLastModifiedTime();

                if (thread.PostUserId > -1)
                {
                    Forum.UpdateUserStats(thread.PostUserId);
                }

                SiteUtils.QueueIndexing();
            }

            if (hdnReturnUrl.Value.Length > 0)
            {
                WebUtils.SetupRedirect(this, hdnReturnUrl.Value);
                return;
            }

            WebUtils.SetupRedirect(this, SiteUtils.GetCurrentPageUrl());
        }