Пример #1
0
        private void ProcessBeforeRequestIn3M()
        {
            //已经到期的、需要处理的主题状态(例如:到期的置顶、到期的主题高亮)
            TopicStatusCollection experiesTopicStatus;

            //需要处理的提问对应的主题ID
            List <int> autoFinalQuestionThreadIds;

            //结贴时,每个板块中的用户得分情况(不同板块的积分策略可能不同,因此此处需要先将不同板块区分开来)
            Dictionary <int, Dictionary <int, int> > autoFinalQuestionForumIDAndRewards;


            //以上是本计划任务所需的所有数据的变量的声明
            //--------------------------------------------------------------

            //查询本计划任务所需的所有数据
            JobDao.Instance.QueryForBeforeRequestIn3M(out experiesTopicStatus, out autoFinalQuestionThreadIds, out autoFinalQuestionForumIDAndRewards);

            //以下开始处理这些数据
            //--------------------------------------------------------------


            //处理过期的主题状态(例如:到期的置顶、到期的主题高亮)
            PostBOV5.Instance.ProcessExperiesTopicStatus(experiesTopicStatus);

            //自动结束提问贴并自动散分
            PostBOV5.Instance.AutoFinalQuestion(autoFinalQuestionThreadIds, autoFinalQuestionForumIDAndRewards);

            ThreadCachePool.UpdateCache(autoFinalQuestionThreadIds);
        }
Пример #2
0
        public override void Action()
        {
#if !Passport
            try
            {
                ForumBO.Instance.ResetTodayPosts();
                ThreadCachePool.ClearCahceAt0AM();
                UserBO.Instance.ClearMostActiveUsersCache(new ActiveUserType[] { ActiveUserType.DayOnlineTime, ActiveUserType.DayPosts, ActiveUserType.WeekOnlineTime, ActiveUserType.WeekPosts, ActiveUserType.MonthPosts, ActiveUserType.MonthOnlineTime });

                UserBO.Instance.ClearExperiesExtendField();
            }
            catch { }
#endif
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int markCount = BbsSettings.ShowMarksCount;
            int postPageSize = BbsSettings.PostsPageSize;

            StickSortType oldStickSortType = BbsSettings.StickSortType;
            StickSortType oldGlobalStickSortType = BbsSettings.GloableStickSortType;

            if (SaveSetting<BbsSettings>("savesetting"))
            {
                if (BbsSettings.ShowMarksCount != markCount
                    || BbsSettings.PostsPageSize != postPageSize
                    || oldStickSortType != BbsSettings.StickSortType
                    || oldGlobalStickSortType != BbsSettings.GloableStickSortType)
                    ThreadCachePool.ClearAllCache();
            }
		}
Пример #4
0
        private BasicThread ProcessLastThread(BasicThread thread, string key)
        {
            if (thread.ThreadStatus == ThreadStatus.Recycled || thread.ThreadStatus == ThreadStatus.UnApproved)
            {
                //PostBOV5.Instance.ClearTopThreadsCache(ForumID);
                ThreadCachePool.ClearAllCache();
                ThreadCollectionV5 threads = PostBOV5.Instance.GetTopThreads(ForumID);
                if (threads != null && threads.Count > 0)
                {
                    thread       = threads[0];
                    LastThreadID = thread.ThreadID;
                }
                else
                {
                    LastThreadID = 0;
                    return(null);
                }
            }
            if (thread.ThreadType == ThreadType.Join || thread.ThreadType == ThreadType.Move)
            {
                int threadID;
                if (int.TryParse(thread.Subject.Substring(0, thread.Subject.IndexOf(',')), out threadID))
                {
                    thread = PostBOV5.Instance.GetThread(threadID);
                    if (thread == null)
                    {
                        return(null);
                    }
                }
                else
                {
                    return(null);
                }
            }
            if (thread != null)
            {
                PageCacheUtil.Set(key, thread);
            }

            return(thread);
        }
Пример #5
0
        private void SaveSettings2()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("PostContentLengths", "PostSubjectLengths", "PolemizeValidDays", "PollValidDays", "QuestionValidDays",
                                                             "RecycleOwnThreadsIntervals", "UpdateThreadSortOrderIntervals", "CreatePostIntervals", "DeleteOwnThreadsIntervals", "AllowFileExtensions",
                                                             "new_PostContentLengths", "new_PostSubjectLengths", "new_PolemizeValidDays", "new_PollValidDays", "new_QuestionValidDays",
                                                             "new_RecycleOwnThreadsIntervals", "new_UpdateThreadSortOrderIntervals", "new_CreatePostIntervals", "new_DeleteOwnThreadsIntervals", "new_AllowFileExtensions"
                                                             , "AllowAttachment", "AllowImageAttachment", "CreatePostAllowAudioTag", "CreatePostAllowEmoticon", "CreatePostAllowFlashTag", "CreatePostAllowHTML"
                                                             , "CreatePostAllowImageTag", "CreatePostAllowMaxcode", "CreatePostAllowTableTag", "CreatePostAllowUrlTag", "CreatePostAllowVideoTag", "MaxPostAttachmentCount"
                                                             , "MaxTopicAttachmentCount", "MaxSignleAttachmentSize", "ShowSignatureInThread", "ShowSignatureInPost", "CreateThreadNeedApprove", "ReplyNeedApprove"
                                                             , "new_AllowAttachment", "new_AllowImageAttachment", "new_CreatePostAllowAudioTag", "new_CreatePostAllowEmoticon", "new_CreatePostAllowFlashTag", "new_CreatePostAllowHTML"
                                                             , "new_CreatePostAllowImageTag", "new_CreatePostAllowMaxcode", "new_CreatePostAllowTableTag", "new_CreatePostAllowUrlTag", "new_CreatePostAllowVideoTag", "new_MaxPostAttachmentCount"
                                                             , "new_MaxTopicAttachmentCount", "new_MaxSignleAttachmentSize", "new_ShowSignatureInThread", "new_ShowSignatureInPost", "new_CreateThreadNeedApprove", "new_ReplyNeedApprove"
                                                             , "UpdateOwnPostIntervals", "new_UpdateOwnPostIntervals"
                                                             , "EnableSellThread", "new_EnableSellThread"
                                                             , "EnableSellAttachment", "new_EnableSellAttachment"
                                                             , "DisplayInList", "new_DisplayInList"
                                                             , "VisitForum", "new_VisitForum"
                                                             , "SellAttachmentDays"
                                                             , "SellThreadDays"
                                                             , "ReplyReturnThreadLastPage"
                                                             , "ThreadSortField"
                                                             );


            if (_Request.Get("inheritType", Method.Post, "False").ToLower() == "true")//继承上级
            {
                ForumSettings tempSetting = AllSettings.Current.ForumSettings.Clone();

                ForumSettingItemCollection tempItems = new ForumSettingItemCollection();

                for (int i = 0; i < tempSetting.Items.Count; i++)
                {
                    if (tempSetting.Items[i].ForumID == ForumID)
                    {
                    }
                    else
                    {
                        tempItems.Add(tempSetting.Items[i]);
                    }
                }

                tempSetting.Items = tempItems;
                try
                {
                    if (!SettingManager.SaveSettings(tempSetting))
                    {
                        CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            msgDisplay.AddError(error);
                        });
                        m_Success = false;
                    }
                    else
                    {
                        BbsRouter.JumpToUrl(Request.RawUrl, "success=true");
                    }
                }
                catch (Exception ex)
                {
                    m_Success = false;
                    msgDisplay.AddError(ex.Message);
                }
                return;
            }



            ForumSettingItem forumSetItem = new ForumSettingItem();

            ExceptableItem_Int32scope    int32scope    = new ExceptableItem_Int32scope();
            ExceptableItem_Second <long> second_long   = new ExceptableItem_Second <long>();
            ExceptableItem_Second <int>  second_int    = new ExceptableItem_Second <int>();
            ExceptableItem_ExtensionList extensionList = new ExceptableItem_ExtensionList();

            forumSetItem.ForumID                        = ForumID;
            forumSetItem.PostContentLengths             = int32scope.GetExceptable("PostContentLengths", msgDisplay); //GetInt32Exceptable("PostContentLengths",msgDisplay);
            forumSetItem.PostSubjectLengths             = int32scope.GetExceptable("PostSubjectLengths", msgDisplay); //GetInt32Exceptable("PostSubjectLengths",msgDisplay);
            forumSetItem.PolemizeValidDays              = second_long.GetExceptable("PolemizeValidDays", msgDisplay);
            forumSetItem.PollValidDays                  = second_long.GetExceptable("PollValidDays", msgDisplay);
            forumSetItem.QuestionValidDays              = second_long.GetExceptable("QuestionValidDays", msgDisplay);
            forumSetItem.RecycleOwnThreadsIntervals     = second_int.GetExceptable("RecycleOwnThreadsIntervals", msgDisplay);
            forumSetItem.UpdateThreadSortOrderIntervals = second_int.GetExceptable("UpdateThreadSortOrderIntervals", msgDisplay);
            forumSetItem.UpdateOwnPostIntervals         = second_int.GetExceptable("UpdateOwnPostIntervals", msgDisplay);
            forumSetItem.CreatePostIntervals            = second_int.GetExceptable("CreatePostIntervals", msgDisplay);
            forumSetItem.DeleteOwnThreadsIntervals      = second_int.GetExceptable("DeleteOwnThreadsIntervals", msgDisplay);
            forumSetItem.AllowFileExtensions            = extensionList.GetExceptable("AllowFileExtensions", msgDisplay);

            forumSetItem.AllowAttachment         = new ExceptableItem_bool().GetExceptable("AllowAttachment", msgDisplay);
            forumSetItem.AllowImageAttachment    = new ExceptableItem_bool().GetExceptable("AllowImageAttachment", msgDisplay);
            forumSetItem.CreatePostAllowAudioTag = new ExceptableItem_bool().GetExceptable("CreatePostAllowAudioTag", msgDisplay);
            forumSetItem.CreatePostAllowEmoticon = new ExceptableItem_bool().GetExceptable("CreatePostAllowEmoticon", msgDisplay);
            forumSetItem.CreatePostAllowFlashTag = new ExceptableItem_bool().GetExceptable("CreatePostAllowFlashTag", msgDisplay);
            forumSetItem.CreatePostAllowHTML     = new ExceptableItem_bool().GetExceptable("CreatePostAllowHTML", msgDisplay);
            forumSetItem.CreatePostAllowImageTag = new ExceptableItem_bool().GetExceptable("CreatePostAllowImageTag", msgDisplay);
            forumSetItem.CreatePostAllowMaxcode  = new ExceptableItem_bool().GetExceptable("CreatePostAllowMaxcode", msgDisplay);
            forumSetItem.CreatePostAllowTableTag = new ExceptableItem_bool().GetExceptable("CreatePostAllowTableTag", msgDisplay);
            forumSetItem.CreatePostAllowUrlTag   = new ExceptableItem_bool().GetExceptable("CreatePostAllowUrlTag", msgDisplay);
            forumSetItem.CreatePostAllowVideoTag = new ExceptableItem_bool().GetExceptable("CreatePostAllowVideoTag", msgDisplay);
            forumSetItem.MaxPostAttachmentCount  = new ExceptableItem_Int_MoreThenZero().GetExceptable("MaxPostAttachmentCount", msgDisplay);
            forumSetItem.MaxTopicAttachmentCount = new ExceptableItem_Int_MoreThenZero().GetExceptable("MaxTopicAttachmentCount", msgDisplay);
            forumSetItem.MaxSignleAttachmentSize = new ExceptableItem_FileSize().GetExceptable("MaxSignleAttachmentSize", msgDisplay);
            forumSetItem.ShowSignatureInPost     = new ExceptableItem_bool().GetExceptable("ShowSignatureInPost", msgDisplay);
            forumSetItem.ShowSignatureInThread   = new ExceptableItem_bool().GetExceptable("ShowSignatureInThread", msgDisplay);
            forumSetItem.CreateThreadNeedApprove = new ExceptableItem_bool().GetExceptable("CreateThreadNeedApprove", msgDisplay);
            forumSetItem.ReplyNeedApprove        = new ExceptableItem_bool().GetExceptable("ReplyNeedApprove", msgDisplay);
            forumSetItem.EnableSellThread        = new ExceptableItem_bool().GetExceptable("EnableSellThread", msgDisplay);
            forumSetItem.EnableSellAttachment    = new ExceptableItem_bool().GetExceptable("EnableSellAttachment", msgDisplay);
            forumSetItem.EnableHiddenTag         = _Request.Get <bool>("enableHiddenTag", Method.Post, true);
            forumSetItem.EnableThreadRank        = _Request.Get <bool>("EnableThreadRank", Method.Post, true);
            forumSetItem.DefaultThreadSortField  = _Request.Get <ThreadSortField>("ThreadSortField", Method.Post, ThreadSortField.LastReplyDate);


            ThreadSortField oldThreadSortField = ForumSetting.DefaultThreadSortField;
            ThreadSortField newThreadSortField = forumSetItem.DefaultThreadSortField;


            forumSetItem.AllowGuestVisitForum  = _Request.Get <bool>("AllowGuestVisitForum", Method.Post, true);
            forumSetItem.DisplayInListForGuest = _Request.Get <bool>("DisplayInListForGuest", Method.Post, true);
            forumSetItem.VisitForum            = new ExceptableItem_bool().GetExceptable("VisitForum", msgDisplay);
            forumSetItem.DisplayInList         = new ExceptableItem_bool().GetExceptable("DisplayInList", msgDisplay);



            forumSetItem.SellThreadDays     = GetSeconds("SellThreadDays", msgDisplay);
            forumSetItem.SellAttachmentDays = GetSeconds("SellAttachmentDays", msgDisplay);

            forumSetItem.ReplyReturnThreadLastPage = _Request.Get <bool>("ReplyReturnThreadLastPage", Method.Post, false);

            if (msgDisplay.HasAnyError())
            {
                m_Success = false;
                return;
            }

            ForumSettings settings           = AllSettings.Current.ForumSettings.Clone();
            ForumSettingItemCollection items = new ForumSettingItemCollection();


            bool hasAdd     = false;
            bool hasTopItem = false;//是否有ForumID为0的设置

            foreach (ForumSettingItem item in settings.Items)
            {
                if (item.ForumID == forumSetItem.ForumID)
                {
                    items.Add(forumSetItem);
                    hasAdd = true;
                }
                else
                {
                    ProcessApplyAllForumSetting(item, forumSetItem);

                    items.Add(item);
                }
                if (item.ForumID == 0)
                {
                    hasTopItem = true;
                }
            }
            if (hasAdd == false)
            {
                items.Add(forumSetItem);
            }


            if (hasTopItem == false)//如果没有 加入
            {
                ForumSettingItem tempItem = new ForumSettingItem();
                ProcessApplyAllForumSetting(tempItem, forumSetItem);
                items.Add(tempItem);
            }

            settings.Items = items;

            try
            {
                using (new ErrorScope())
                {
                    bool success = SettingManager.SaveSettings(settings);

                    if (!success)
                    {
                        CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            msgDisplay.AddError(error);
                        });
                        m_Success = false;
                    }
                    else
                    {
                        if (_Request.Get <bool>("ThreadSortField_aplyallnode", Method.Post, false))
                        {
                            ThreadCachePool.ClearAllCache();
                        }
                        else if (oldThreadSortField != newThreadSortField)
                        {
                            ThreadCachePool.ClearAllCache();
                        }

                        string rawUrl = Request.RawUrl;

                        BbsRouter.JumpToUrl(rawUrl, "success=true");
                    }
                }
            }
            catch (Exception ex)
            {
                m_Success = false;
                msgDisplay.AddError(ex.Message);
            }
        }