示例#1
0
        protected void PostMessageHandler(object sender, System.EventArgs e)
        {
            int userID    = SessionAdapter.GetUserID();
            int messageID = 0;
            // store the new message as a new thread in the current forum.
            bool isSticky = meMessageEditor.IsSticky;

            if (!_userCanCreateNormalThreads && _userCanCreateStickyThreads)
            {
                // always sticky
                isSticky = true;
            }
            int threadID = ForumManager.CreateNewThreadInForum(_forum.ForumID, userID, meMessageEditor.NewThreadSubject,
                                                               meMessageEditor.MessageText, meMessageEditor.MessageTextHTML, isSticky,
                                                               Request.UserHostAddress.ToString(), _forum.DefaultSupportQueueID, meMessageEditor.SubscribeToThread, out messageID);

            // invalidate forum RSS in cache
            ApplicationAdapter.InvalidateCachedForumRSS(_forum.ForumID);

            if (SessionAdapter.CheckIfNeedsAuditing(AuditActions.AuditNewThread))
            {
                SecurityManager.AuditNewThread(userID, threadID);
            }

            // invalidate Forum in ASP.NET cache
            CacheManager.InvalidateCachedItem(CacheManager.ProduceCacheKey(CacheKeys.SingleForum, _forum.ForumID));

            if (meMessageEditor.AddAttachment)
            {
                // go to attachment management.
                Response.Redirect(string.Format("Attachments.aspx?SourceType=2&MessageID={0}", messageID), true);
            }
            else
            {
                // all ok, redirect to thread list
                Response.Redirect("Threads.aspx?ForumID=" + _forum.ForumID, true);
            }
        }