예제 #1
0
        protected void ProcessSignInForum()
        {
            string         validateCodeAction = "SignInForum";
            MessageDisplay msgDisplay         = CreateMessageDisplay();

            if (CheckValidateCode(validateCodeAction, msgDisplay))
            {
                string password = _Request.Get("Password", Method.Post, string.Empty);
                if (password == string.Empty)
                {
                    msgDisplay.AddError("请输入版块密码");
                    return;
                }
                if (password == Forum.Password)
                {
                    My.AddValidatedForumID(Forum.ForumID, password);
                    //Response.Redirect(_Request.Get("UrlReferrer", Method.Post, BbsUrlHelper.GetForumUrl(Forum.CodeName)));
                    int threadID = _Request.Get <int>("threadid", Method.Get, 0);
                    if (threadID > 0)
                    {
                        Response.Redirect(BbsUrlHelper.GetThreadUrl(Forum.CodeName, threadID, 1));
                    }
                    else
                    {
                        Response.Redirect(BbsUrlHelper.GetForumUrl(Forum.CodeName));
                    }
                }
                else
                {
                    msgDisplay.AddError("密码不正确");
                }
            }
        }
예제 #2
0
        public PostNotify(string TopicSubject, int RelateUserID, int ThreadID, string forumCode)
        {
            this.ForumAliasName = forumCode;
            this.TopicSubject   = TopicSubject;
            this.RelateUserID   = RelateUserID;
            this.TargetID       = ThreadID;

            Url = BbsUrlHelper.GetThreadUrl(ForumAliasName, TargetID);
        }
예제 #3
0
        public CancelRateNotify(int relateUserID, string forumCode, int postID, string reson)
            : base(relateUserID, string.Empty)
        {
            this.ForumCode = forumCode;
            this.Reson     = reson;


            Url = BbsUrlHelper.GetThreadUrl(ForumCode, TargetID);
        }
예제 #4
0
        public RatePostNotify(int relateUserID, int ThreadID, string threadSubject, string ForumCode)
        {
            this.RelateUserID = relateUserID;
            this.ForumCode    = ForumCode;
            this.TopicSubject = threadSubject;
            this.TargetID     = ThreadID;

            this.Url = BbsUrlHelper.GetThreadUrl(ForumCode, TargetID);
        }
예제 #5
0
 protected string GetThreadUrl(BasicThread thread, bool isLastPage)
 {
     if (ThreadCatalogID == -1)
     {
         if (IsNormalThreads)
         {
             if (IsDefaultList)
             {
                 if (isLastPage)
                 {
                     return(BbsUrlHelper.GetThreadUrl(CodeName, thread.RedirectThreadID, thread.ThreadTypeString, thread.TotalPages, PageNumber));
                 }
                 else
                 {
                     return(BbsUrlHelper.GetThreadUrl(CodeName, thread.RedirectThreadID, thread.ThreadTypeString, 1, PageNumber));
                 }
             }
             else
             {
                 if (isLastPage)
                 {
                     return(BbsUrlHelper.GetThreadUrlForExtParms(CodeName, thread.RedirectThreadID, thread.ThreadTypeString, thread.TotalPages, "Action=" + Action + "&page=" + PageNumber));
                 }
                 else
                 {
                     return(BbsUrlHelper.GetThreadUrlForExtParms(CodeName, thread.RedirectThreadID, thread.ThreadTypeString, 1, "Action=" + Action + "&page=" + PageNumber));
                 }
             }
         }
         else
         {
             if (string.Compare(Action, "recycled", true) == 0)
             {
                 return(BbsUrlHelper.GetThreadUrl(CodeName, thread.RedirectThreadID, thread.TotalPages, thread.ThreadTypeString, "recyclebin"));
             }
             else if (string.Compare(Action, "unapproved", true) == 0)
             {
                 return(BbsUrlHelper.GetThreadUrl(CodeName, thread.RedirectThreadID, thread.TotalPages, thread.ThreadTypeString, "unapprovethreads"));
             }
             else
             {
                 return(BbsUrlHelper.GetThreadUrl(CodeName, thread.RedirectThreadID, thread.TotalPages, thread.ThreadTypeString, "unapproveposts"));
             }
         }
     }
     else
     {
         if (isLastPage)
         {
             return(BbsUrlHelper.GetThreadUrlForExtParms(CodeName, thread.RedirectThreadID, thread.ThreadTypeString, thread.TotalPages, "ThreadCatalogID=" + ThreadCatalogID + "&page=" + PageNumber));
         }
         else
         {
             return(BbsUrlHelper.GetThreadUrlForExtParms(CodeName, thread.RedirectThreadID, thread.ThreadTypeString, 1, "ThreadCatalogID=" + ThreadCatalogID + "&page=" + PageNumber));
         }
     }
 }
예제 #6
0
        protected string GetArchiverThreadLink(BasicThread thread, string linkStyle)
        {
            if (string.IsNullOrEmpty(linkStyle))
            {
                linkStyle = "<a href=\"{0}\">{1}</a>";
            }

            Forum forum = null;

            string subject = null;

            if (thread.ThreadType == ThreadType.Move || thread.ThreadType == ThreadType.Join)
            {
                int index = thread.SubjectText.IndexOf(',');
                if (index > 0)
                {
                    string threadIDStr = thread.SubjectText.Substring(0, index);
                    subject = thread.SubjectText.Substring(index + 1);
                }

                BasicThread redirectThread = PostBOV5.Instance.GetThread(thread.RedirectThreadID);
                if (redirectThread != null)
                {
                    forum = ForumBO.Instance.GetForum(redirectThread.ForumID);
                }

                if (forum == null)
                {
                    forum = ForumBO.Instance.GetForum(thread.ForumID);
                }
            }
            else
            {
                forum = ForumBO.Instance.GetForum(thread.ForumID);
            }

            string url = BbsUrlHelper.GetArchiverThreadUrl(forum.CodeName, thread.RedirectThreadID);

            if (subject == null)
            {
                subject = thread.SubjectText;
            }
            if (thread.ThreadType == ThreadType.Move)
            {
                return("已移动:" + string.Format(linkStyle, url, subject));
            }
            else if (thread.ThreadType == ThreadType.Join)
            {
                return("已合并:" + string.Format(linkStyle, url, subject));
            }
            else
            {
                return(string.Format(linkStyle, url, subject));
            }
        }
예제 #7
0
 protected string GetThreadUrl(BasicThread thread, bool isLastPage)
 {
     if (isLastPage)
     {
         return(BbsUrlHelper.GetThreadUrl(thread.Forum.CodeName, thread.RedirectThreadID, thread.ThreadTypeString, thread.TotalPages, PageNumber));
     }
     else
     {
         return(BbsUrlHelper.GetThreadUrl(thread.Forum.CodeName, thread.RedirectThreadID, thread.ThreadTypeString, 1, PageNumber));
     }
 }
예제 #8
0
 private void appendThreadTypeLink(StringBuilder sb, string threadLocationStr, string name, string linkStyle, string currentLinkStyle)
 {
     if (string.Compare(Action, threadLocationStr, true) == 0)
     {
         sb.Append(string.Format(currentLinkStyle, BbsUrlHelper.GetForumUrl(Forum.CodeName, threadLocationStr, 1), name));
     }
     else
     {
         sb.Append(string.Format(linkStyle, BbsUrlHelper.GetForumUrl(Forum.CodeName, threadLocationStr, 1), name));
     }
 }
예제 #9
0
 protected string GetThreadUrl(int postID)
 {
     foreach (PostV5 post in Posts)
     {
         if (postID == post.PostID)
         {
             Forum forum = ForumBO.Instance.GetForum(post.ForumID);
             return(BbsUrlHelper.GetThreadUrl(forum.CodeName, post.ThreadID));
         }
     }
     return(string.Empty);
 }
예제 #10
0
        protected string GetThreadUrl(int threadID)
        {
            BasicThread thread = ThreadList.GetValue(threadID);

            if (thread == null)
            {
                return(string.Empty);
            }

            Forum forum = thread.Forum;

            return(BbsUrlHelper.GetThreadUrl(forum.CodeName, thread.RedirectThreadID, 1, thread.ThreadTypeString, "unapproveposts"));
        }
예제 #11
0
        protected virtual void GetThread()
        {
            ThreadType realThreadType = ThreadType.Normal;

            if (IsOnlyLookOneUser)
            {
                int totalCount;
                PostBOV5.Instance.GetUserPosts(ThreadID, LookUserID, ThreadType.Normal, PageNumber, PageSize, true, false, out m_Thread, out m_PostList, out realThreadType, out totalCount);

                m_TotalPosts = totalCount;
            }
            else
            {
                if (string.IsNullOrEmpty(Type))
                {
                    PostBOV5.Instance.GetThreadWithReplies(ThreadID, PageNumber, PageSize, true, UpdateView, true, out m_Thread, out m_PostList, out realThreadType);
                }
                else if (GetPosts(ThreadType.Normal, out m_TotalPosts, out m_Thread, out m_PostList))
                {
                }
                else if (IsUnapprovePosts || IsMyUnapprovePosts)
                {
                    m_MustRemovePostListFirstOne = false;
                    int total;
                    PostBOV5.Instance.GetUnapprovedPostThread(ThreadID, null, PageNumber, PageSize, out m_Thread, out m_PostList, out total);
                    m_TotalPosts = total;
                }
                else
                {
                    ShowError(new InvalidParamError("type"));
                }
            }
            //如果不是 投票 问题  辩论  则跳到相应的页面
            if (realThreadType != ThreadType.Normal)
            {
                Response.Redirect(BbsUrlHelper.GetThreadUrl(CodeName, ThreadID, PostBOV5.Instance.GetThreadTypeString(realThreadType)));
            }

            PostBOV5.Instance.ProcessKeyword(m_PostList, ProcessKeywordMode.TryUpdateKeyword);

            //if (_Request.IsSpider == false)
            //{
            //List<int> userIDs = new List<int>();
            //foreach(PostV5 post in m_PostList)
            //{
            //    userIDs.Add(post.UserID);
            //}
            //UserBO.Instance.GetUsers(userIDs, GetUserOption.WithAll);
            UserBO.Instance.GetUsers(m_PostList.GetUserIds(), GetUserOption.WithAll);
            //}
        }
예제 #12
0
 protected string GetUserLink(SimpleUser simpleUser, string linkStyle)
 {
     if (simpleUser == null || simpleUser.UserID < 1)
     {
         return("游客");
     }
     else
     {
         if (string.IsNullOrEmpty(linkStyle))
         {
             linkStyle = "<a href=\"{0}\"  target=\"_blank\">{1}</a>";
         }
         return(string.Format(linkStyle, BbsUrlHelper.GetUserSpaceUrl(simpleUser.UserID), simpleUser.Username));
     }
 }
예제 #13
0
        protected override void GetThread()
        {
            if (IsOnlyLookOneUser)
            {
                Response.Redirect(BbsUrlHelper.GetThreadUrl(CodeName, ThreadID, 1, LookUserID, PostBOV5.Instance.GetThreadTypeString(ThreadType.Normal), ForumListPage));
            }

            if (IsUnapprovePosts)
            {
                BbsRouter.JumpToUrl(BbsUrlHelper.GetThreadUrl(CodeName, ThreadID, PostBOV5.Instance.GetThreadTypeString(ThreadType.Normal)), "type=" + Type);
            }

            int?total;

            if (string.IsNullOrEmpty(Type))
            {
                ThreadType realThreadType;

                PostBOV5.Instance.GetPollWithReplies(ThreadID, PageNumber, PageSize, true, UpdateView, out m_PollThread, out m_PostList, out realThreadType);

                //如果不是 投票 则跳到相应的页面
                if (realThreadType != ThreadType.Poll)
                {
                    Response.Redirect(BbsUrlHelper.GetThreadUrl(CodeName, ThreadID, PostBOV5.Instance.GetThreadTypeString(realThreadType)));
                }
            }
            else
            {
                BasicThread thread;
                GetPosts(ThreadType.Poll, out m_TotalPosts, out thread, out m_PostList);

                m_PollThread = (PollThreadV5)thread;
            }

            PostBOV5.Instance.ProcessKeyword(m_PostList, ProcessKeywordMode.TryUpdateKeyword);
            //if (_Request.IsSpider == false)
            //{
            //List<int> userIDs = new List<int>();
            //foreach (PostV5 post in m_PostList)
            //{
            //    userIDs.Add(post.UserID);
            //}
            //UserBO.Instance.GetUsers(userIDs, GetUserOption.WithAll);
            UserBO.Instance.GetUsers(m_PostList.GetUserIds(), GetUserOption.WithAll);
            //}
        }
예제 #14
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (BaseHasError)
            {
                return;
            }

            int pageIndex = _Request.Get <int>("page", Method.Get, 1) - 1;
            int pageSize  = AllSettings.Current.BbsSettings.ThreadsPageSize;
            int totalThreads;// = Forum.TotalThreads;

            threadList = PostBOV5.Instance.GetThreads(Forum.ForumID, ForumSetting.DefaultThreadSortField, null, null, true, pageIndex + 1, pageSize, _Request.IsSpider, out totalThreads);

            PostBOV5.Instance.ProcessKeyword(threadList, ProcessKeywordMode.TryUpdateKeyword);

            SetPager("ThreadListPager", BbsUrlHelper.GetArchiverForumUrlForPager(Forum.CodeName), pageIndex + 1, pageSize, totalThreads);

            AddNavigationItem(Forum.ForumName);
        }
예제 #15
0
        protected string GetThreadCatalogLinks(string linkStyle, string currentLinkStyle)
        {
            if (Forum.ThreadCatalogStatus == ThreadCatalogStatus.DisEnable)
            {
                return(string.Empty);
            }

            if (string.IsNullOrEmpty(linkStyle))
            {
                linkStyle = "<a href=\"{0}\">{1}</a>";
            }
            if (string.IsNullOrEmpty(currentLinkStyle))
            {
                currentLinkStyle = "<a class=\"threadCatalogSelected\">{1}</a>";
            }

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            appendThreadTypeLink(sb, "list", "全部", linkStyle, currentLinkStyle);
            foreach (ThreadCatalog threadCatalog in ThreadCatalogs)
            {
                if (ThreadCatalogID == threadCatalog.ThreadCatalogID)
                {
                    sb.Append(string.Format(currentLinkStyle, BbsUrlHelper.GetThreadCatalogUrl(Forum.CodeName, threadCatalog.ThreadCatalogID, 1), threadCatalog.ThreadCatalogName));
                }
                //sb.Append("<a class=\"threadCatalogSelected\">" + threadCatalog.ThreadCatalogName + "</a> ");
                else
                {
                    sb.Append(string.Format(linkStyle, BbsUrlHelper.GetThreadCatalogUrl(Forum.CodeName, threadCatalog.ThreadCatalogID, 1), threadCatalog.ThreadCatalogName));
                }
            }
            if (Forum.ThreadCatalogStatus != ThreadCatalogStatus.EnableAndMust)
            {
                if (ThreadCatalogID == 0)
                {
                    sb.Append(string.Format(currentLinkStyle, BbsUrlHelper.GetThreadCatalogUrl(Forum.CodeName, 0, 1), "其他"));
                }
                else
                {
                    sb.Append(string.Format(linkStyle, BbsUrlHelper.GetThreadCatalogUrl(Forum.CodeName, 0, 1), "其他"));
                }
            }
            return(sb.ToString());
        }
예제 #16
0
        private void GetThread()
        {
            //if (Forum == null)
            //return;

            int threadID = _Request.Get <int>("threadid", Method.Get, 0);
            int pageSize = AllSettings.Current.BbsSettings.PostsPageSize;

            try
            {
                using (new ErrorScope())
                {
                    ThreadType tempType;
                    PostBOV5.Instance.GetThreadWithReplies(threadID, ThreadType.Normal, PageNumber, pageSize, false, true, true, false, out m_Thread, out m_ReplyList, out tempType);
                    if (m_Thread == null)
                    {
                        ErrorMessage = "主题不存在";
                    }
                    else
                    {
                        if (m_Thread != null)
                        {
                            //List<int> userIDs = new List<int>();
                            //foreach (PostV5 post in m_ReplyList)
                            //{
                            //    userIDs.Add(post.UserID);
                            //}
                            //UserBO.Instance.GetUsers(userIDs, GetUserOption.WithAll);
                            UserBO.Instance.GetUsers(m_ReplyList.GetUserIds(), GetUserOption.WithAll);

                            SetPager("PostListPager", BbsUrlHelper.GetArchiverThreadUrlForPager(Thread.Forum.CodeName, threadID), PageNumber, pageSize, m_Thread.TotalReplies + 1);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.LogException(ex);
                ErrorMessage = ex.Message;
            }
        }
예제 #17
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (BaseHasError)
            {
                return;
            }

            AddNavigationItem(Forum.ForumName, BbsUrlHelper.GetArchiverForumUrl(CodeName));
            if (Thread != null)
            {
                AddNavigationItem(Thread.SubjectText);

                //SetPageTitle(AllSettings.Current.BaseSeoSettings.FormatPageNumber(PageNumber));
                //SetPageTitle(Thread.SubjectText);
            }

            if (ViewReply == false)
            {
                IsShowReplies = false;
            }
        }
예제 #18
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            AddNavigationItem("最新主题");

            int totalThreads = 0;
            int displayCount = BbsSettings.NewThreadPageCount * BbsSettings.ThreadsPageSize;

            if (PageNumber - 1 < BbsSettings.NewThreadPageCount)
            {
                threadList = PostBOV5.Instance.GetNewThreads(My, null, PageNumber, BbsSettings.ThreadsPageSize, out totalThreads);
            }
            else
            {
                totalThreads = displayCount;
                threadList   = new ThreadCollectionV5();
            }

            if (displayCount > totalThreads || displayCount == 0)
            {
                displayCount = totalThreads;
            }
            SetPager("list", BbsUrlHelper.GetNewThreadListUrlForPager(), PageNumber, BbsSettings.ThreadsPageSize, displayCount);
        }
예제 #19
0
        protected string GetPosition <T>(OnlineUser <T> onlineUser) where T : IComparable <T>
        {
            StringBuilder sb = new StringBuilder();

            if (onlineUser.ForumID > 0)
            {
                Forum forum = ForumBO.Instance.GetForum(onlineUser.ForumID);
                if (forum != null)
                {
                    if (forum.CanDisplayInList(My))
                    {
                        sb.AppendFormat(@"<a href=""{0}"" target=""_blank"">{1}</a>", BbsUrlHelper.GetForumUrl(forum.CodeName), forum.ForumNameText);

                        if (onlineUser.ThreadID > 0 && forum.CanVisit(My))
                        {
                            sb.AppendFormat(@" - <a href=""{0}"" target=""_blank"">{1}</a>", BbsUrlHelper.GetThreadUrl(forum.CodeName, onlineUser.ThreadID), onlineUser.ThreadSubject);
                        }
                    }
                }
            }

            return(sb.ToString());
        }
예제 #20
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            //点击了快速发帖按钮
            if (_Request.IsClick("postButton"))
            {
                ProcessThread();
            }

            ForumBO.Instance.SetForumsLastThread(Forum.SubForumsForList);

            int totalThreads = 0;

            int pageSize = AllSettings.Current.BbsSettings.ThreadsPageSize;

            if (_Request.IsSpider)
            {
                if (ThreadCatalogID != -1)
                {
                    m_ThreadCatalogID = -1;
                }

                if (Action != "list")
                {
                    m_Action = "list";
                }
            }

            //如果要显示某个主题分类的主题
            if (ThreadCatalogID != -1)
            {
                AddNavigationItem(Forum.ForumName, BbsUrlHelper.GetForumUrl(CodeName));

                Action = "";
                if (ThreadCatalogID != 0)
                {
                    ThreadCatalog threadCatalog = ForumBO.Instance.GetThreadCatalog(ThreadCatalogID);
                    if (threadCatalog == null)
                    {
                        Response.End();
                    }

                    AddNavigationItem(string.Concat("[", threadCatalog.ThreadCatalogName, "]"));
                    //navigation += "  [" + threadCatalog.ThreadCatalogName + "]";
                }
                else
                {
                    AddNavigationItem("[其他]");
                }
                //navigation += "    [其他]";


                threads = PostBOV5.Instance.GetThreads(ForumID, ThreadCatalogID, PageNumber, pageSize, SortType, BeginDate, EndDate, IsDesc, out totalThreads);

                //设置分页控件的显示
                SetPager("ThreadListPager", BbsUrlHelper.GetThreadCatalogUrlForPager(CodeName, ThreadCatalogID) + (parms == null ? "" : "?" + parms), PageNumber, pageSize, totalThreads);
                //url = BbsUrlHelper.GetForumEmoticonUrlForPager(CodeName, ThreadCatalogID, PageNumber, IsGetAllDefaultEmoticon, EmoticonGroupID);
            }
            else
            {
                string navigation = null;

                switch (Action)
                {
                //精华帖
                case "valued":

                    navigation = "[精华帖]";
                    threads    = PostBOV5.Instance.GetValuedThreads(ForumID, PageNumber, pageSize, SortType, BeginDate, EndDate, IsDesc, true, out totalThreads);

                    break;

                //投票帖
                case "poll":

                    navigation = "[投票帖]";
                    threads    = PostBOV5.Instance.GetThreads(ForumID, ThreadType.Poll, PageNumber, pageSize, SortType, BeginDate, EndDate, IsDesc, true, out totalThreads);
                    break;

                //问题帖
                case "question":

                    navigation = "[提问帖]";
                    threads    = PostBOV5.Instance.GetThreads(ForumID, ThreadType.Question, PageNumber, pageSize, SortType, BeginDate, EndDate, IsDesc, true, out totalThreads);
                    break;

                //辩论帖
                case "polemize":

                    navigation = "[辩论帖]";
                    threads    = PostBOV5.Instance.GetThreads(ForumID, ThreadType.Polemize, PageNumber, pageSize, SortType, BeginDate, EndDate, IsDesc, true, out totalThreads);
                    break;

                //回收
                case "recycled":

                    IsNormalThreads = false;
                    IsRecycleBin    = true;
                    navigation      = "[回收站]";
                    if (ForumManagePermission.HasPermissionForSomeone(My, ManageForumPermissionSetNode.ActionWithTarget.SetThreadsRecycled) == false)
                    {
                        ShowError("您没有权限进入回收站");
                    }
                    threads = PostBOV5.Instance.GetThreadsByStatus(ThreadStatus.Recycled, ForumID, SortType, BeginDate, EndDate, IsDesc, PageNumber, pageSize, out totalThreads);
                    break;

                //未审核主题
                case "unapproved":

                    IsNormalThreads     = false;
                    IsUnapprovedThreads = true;
                    navigation          = "[未审核主题]";
                    if (ForumManagePermission.HasPermissionForSomeone(My, ManageForumPermissionSetNode.ActionWithTarget.ApproveThreads) == false)
                    {
                        ShowError("您没有权限查看未审核的主题");
                    }

                    threads = PostBOV5.Instance.GetThreadsByStatus(ThreadStatus.UnApproved, ForumID, SortType, BeginDate, EndDate, IsDesc, PageNumber, pageSize, out totalThreads);
                    break;

                //未审核回复
                case "unapprovedpost":

                    IsNormalThreads          = false;
                    IsUnapprovedPostsThreads = true;
                    navigation = "[未审核回复]";
                    if (ForumManagePermission.Can(My, ManageForumPermissionSetNode.Action.ApprovePosts) == false)
                    {
                        ShowError("您没有权限查看未审核的回复");
                    }
                    threads      = PostBOV5.Instance.GetUnapprovedPostThreads(ForumID, PageNumber, pageSize);
                    totalThreads = threads.TotalRecords;
                    break;

                //正常帖子
                default:

                    IsDefaultList = true;
                    Action        = "list";
                    threads       = PostBOV5.Instance.GetThreads(ForumID, SortType, BeginDate, EndDate, IsDesc, PageNumber, pageSize, _Request.IsSpider, out totalThreads);
                    break;
                }

                if (navigation == null)
                {
                    AddNavigationItem(Forum.ForumName);
                }
                else
                {
                    AddNavigationItem(Forum.ForumName, BbsUrlHelper.GetForumUrl(CodeName));
                    AddNavigationItem(navigation);
                }

                //设置分页控件的显示
                SetPager("ThreadListPager", BbsUrlHelper.GetForumUrlForPager(CodeName, Action) + (parms == null ? "" : "?" + parms), PageNumber, pageSize, totalThreads);
                //url = BbsUrlHelper.GetForumEmoticonUrlForPager(CodeName, Action, PageNumber, IsGetAllDefaultEmoticon, EmoticonGroupID);
            }

            if (PageNumber > 1 && threads.Count == 0)
            {
                Response.Redirect(AttachQueryString("page=1"));
            }


            //更新用户在在线列表中的状态
            UpdateOnlineStatus(OnlineAction.ViewThreadList, 0, "");
            //OnlineManager.UpdateOnlineUser(MyUserID, ForumID, 0, My.OnlineStatus, OnlineAction.ViewThreadList, Request, Response);

            if (IsNormalThreads)
            {
                PostBOV5.Instance.ProcessKeyword(threads, ProcessKeywordMode.TryUpdateKeyword);
            }
            else
            {
                PostBOV5.Instance.ProcessKeyword(threads, ProcessKeywordMode.FillOriginalText);
            }

            if (CanManageThread)
            {
                List <int> userIDs = new List <int>();
                foreach (BasicThread thread in threads)
                {
                    if (userIDs.Contains(thread.PostUserID) == false)
                    {
                        userIDs.Add(thread.PostUserID);
                    }
                }

                UserBO.Instance.GetUsers(userIDs, GetUserOption.WithAll);
            }

            WaitForFillSimpleUsers <Moderator>(Forum.Moderators);
            foreach (Forum subForum in Forum.SubForumsForList)
            {
                WaitForFillSimpleUsers <Moderator>(subForum.Moderators);
            }

            SubmitFillUsers();
        }
예제 #21
0
 protected override string GetNavigationForumUrl(MaxLabs.bbsMax.Entities.Forum forum)
 {
     return(BbsUrlHelper.GetArchiverForumUrl(forum.CodeName));
 }
예제 #22
0
        protected string GetThreadLink(string linkStyle, BasicThread thread, int subjectLength, int page, string type, string codeName, bool typeIsExtParms, int listPage, bool addStyle)
        {
            if (thread == null || thread.ThreadID < 1)
            {
                return("-");
            }
            else
            {
                if (string.IsNullOrEmpty(linkStyle))
                {
                    linkStyle = "<a href=\"{0}\">{1}</a>";
                }

                string threadSubjectStyle;
                if (addStyle == false || string.IsNullOrEmpty(thread.SubjectStyle))
                {
                    threadSubjectStyle = "<span>";
                }
                else
                {
                    threadSubjectStyle = "<span style=\"" + thread.SubjectStyle + "\">";
                }


                string subject;
                if (thread.ThreadType == ThreadType.Move || thread.ThreadType == ThreadType.Join)
                {
                    int index = thread.Subject.IndexOf(',');
                    if (index > 0)
                    {
                        string threadIDStr = thread.Subject.Substring(0, index);

                        int threadID;
                        if (int.TryParse(threadIDStr, out threadID))
                        {
                            BasicThread tempThread = PostBOV5.Instance.GetThread(threadID);
                            Forum       forum      = null;
                            if (tempThread != null)
                            {
                                forum = ForumBO.Instance.GetForum(tempThread.ForumID, false);
                            }

                            subject = thread.Subject.Substring(index + 1);

                            string threadTypeString;
                            if (thread.ThreadType == ThreadType.Move)
                            {
                                threadTypeString = "已移动: ";
                            }
                            else
                            {
                                threadTypeString = "已合并: ";
                            }

                            if (forum == null)
                            {
                                forum = ForumBO.Instance.GetForum(thread.ForumID);
                            }

                            string url;
                            if (typeIsExtParms)
                            {
                                url = BbsUrlHelper.GetThreadUrlForExtParms(forum.CodeName, threadID, page, type);
                            }
                            else
                            {
                                if (string.IsNullOrEmpty(type))
                                {
                                    url = BbsUrlHelper.GetThreadUrl(forum.CodeName, threadID, thread.ThreadTypeString, page, listPage);
                                }
                                else
                                {
                                    url = BbsUrlHelper.GetThreadUrl(forum.CodeName, threadID, thread.ThreadTypeString, page, type);
                                }
                            }
                            string cutSubject = CutString(threadTypeString + subject, subjectLength);

                            return(string.Format(linkStyle, url, threadSubjectStyle + cutSubject + "</span>", subject));
                        }
                    }
                }

                subject = CutString(thread.Subject, subjectLength);
                Forum  forum2 = ForumBO.Instance.GetForum(thread.ForumID);
                string endStatus;
                if (thread.ThreadType == ThreadType.Question)
                {
                    endStatus = thread.IsClosed ? " [已解决]" : " [未解决]";
                }
                else if (thread.ThreadType == ThreadType.Poll)
                {
                    endStatus = thread.IsClosed ? " [已结束]" : " [投票中]";
                }
                else
                {
                    endStatus = string.Empty;
                }

                string url2;
                string tempCodeName;
                if (string.IsNullOrEmpty(codeName))
                {
                    tempCodeName = forum2.CodeName;
                }
                else
                {
                    tempCodeName = codeName;
                }

                if (typeIsExtParms)
                {
                    url2 = BbsUrlHelper.GetThreadUrlForExtParms(tempCodeName, thread.ThreadID, thread.ThreadTypeString, page, type);
                }
                else
                {
                    if (string.IsNullOrEmpty(type))
                    {
                        url2 = BbsUrlHelper.GetThreadUrl(tempCodeName, thread.ThreadID, thread.ThreadTypeString, page, listPage);
                    }
                    else
                    {
                        url2 = BbsUrlHelper.GetThreadUrl(tempCodeName, thread.ThreadID, thread.ThreadTypeString, page, type);
                    }
                }

                return(string.Format(linkStyle, url2, threadSubjectStyle + subject + "</span>", thread.Subject) + endStatus);
            }
        }
예제 #23
0
        protected bool GetPosts(ThreadType threadType, out int?totalCount, out BasicThread thread, out PostCollectionV5 posts)
        {
            totalCount = null;
            thread     = null;
            posts      = null;
            ThreadType realThreadType = threadType;

            if (string.Compare(Type, SystemForum.RecycleBin.ToString(), true) == 0)
            {
                PostBOV5.Instance.GetPosts(ThreadID, false, PageNumber, PageSize, null, true, true, true, true, ref thread, out posts, ref realThreadType);
                if (realThreadType != threadType)
                {
                    BbsRouter.JumpToUrl(BbsUrlHelper.GetThreadUrl(CodeName, ThreadID, PostBOV5.Instance.GetThreadTypeString(realThreadType)), "type=" + Type);
                }

                if (thread == null)
                {
                    ShowError("您要查看的主题不存在或者已被删除");
                }

                //totalCount = base.TotalPosts;
                return(true);
            }
            else if (string.Compare(Type, SystemForum.UnapproveThreads.ToString(), true) == 0)
            {
                PostBOV5.Instance.GetPosts(ThreadID, false, PageNumber, PageSize, null, true, true, true, true, ref thread, out posts, ref realThreadType);
                //m_Thread.ThreadContent = m_PostList[0];
                totalCount = posts.TotalRecords;
                if (realThreadType != threadType)
                {
                    BbsRouter.JumpToUrl(BbsUrlHelper.GetThreadUrl(CodeName, ThreadID, PostBOV5.Instance.GetThreadTypeString(realThreadType)), "type=" + Type);
                }

                if (thread == null)
                {
                    ShowError("您要查看的主题不存在或者已被删除");
                }

                return(true);
            }
            else if (string.Compare(Type, MyThreadType.MyUnapprovedThread.ToString(), true) == 0)
            //|| string.Compare(Type, MyThreadType.MyUnapprovedPostThread.ToString(), true) == 0)
            {
                int count;
                PostBOV5.Instance.GetUnapprovedPostThread(ThreadID, MyUserID, PageNumber, PageSize, out thread, out posts, out count);


                if (thread == null)
                {
                    ShowError("您要查看的主题不存在或者已被删除");
                }
                if (posts.Count > 0)
                {
                    thread.ThreadContent = posts[0];
                }
                else
                {
                    ShowError("您要查看的主题不存在或者已被删除");
                }


                totalCount = count;
                return(true);
            }
            else if (IsGetPost)
            {
                if (threadType != ThreadType.Normal)
                {
                    BbsRouter.JumpToUrl(BbsUrlHelper.GetThreadUrl(CodeName, ThreadID, PostBOV5.Instance.GetThreadTypeString(ThreadType.Normal)), "type=getpost&postid=" + PostID);
                }

                thread = PostBOV5.Instance.GetThread(ThreadID);
                PostV5 post = PostBOV5.Instance.GetPost(PostID, true);
                if (post == null)
                {
                    ShowError("您要查看的帖子不存在或者已被删除");
                }

                posts = new PostCollectionV5();
                posts.Add(post);

                totalCount = 1;

                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #24
0
        protected string GetThreadPager(BasicThread thread, string style, string urlStyle, string type, bool typeIsExtParms, string codeName, int listPage)
        {
            if (thread == null || thread.RedirectThreadID < 1)
            {
                return(string.Empty);
            }

            if (thread.ThreadType == ThreadType.Polemize)
            {
                return(string.Empty);
            }

            int totalPosts;

            if (type != null && SystemForum.UnapprovePosts.ToString().ToLower() == type.ToLower())
            {
                totalPosts = thread.UnApprovedPostsCount;
            }
            else
            {
                if (thread.ThreadType == ThreadType.Question && thread.IsClosed)////减掉最佳答案那个回复,最佳答案单独显示[这里有个问题,如果最佳答案被删除了,统计又与其他主题一样(未解决)]
                {
                    totalPosts = thread.TotalReplies;
                }
                else
                {
                    totalPosts = thread.TotalReplies + 1;
                }
            }

            int postsPageSize = AllSettings.Current.BbsSettings.PostsPageSize;
            int totalPage     = totalPosts % postsPageSize == 0 ? totalPosts / postsPageSize : (totalPosts / postsPageSize + 1);

            if (totalPage < 1)
            {
                return(string.Empty);
            }

            Forum         forum = ForumBO.Instance.GetForum(thread.ForumID);
            StringBuilder sb    = new StringBuilder();

            string url;

            if (string.IsNullOrEmpty(codeName))
            {
                if (typeIsExtParms)
                {
                    url = BbsUrlHelper.GetThreadUrlForPagerExtParms(forum.CodeName, thread.RedirectThreadID, thread.ThreadTypeString, type);
                }
                else
                {
                    if (string.IsNullOrEmpty(type))
                    {
                        url = BbsUrlHelper.GetThreadUrlForPager(forum.CodeName, thread.RedirectThreadID, listPage, thread.ThreadTypeString);
                    }
                    else
                    {
                        url = BbsUrlHelper.GetThreadUrlForPager(forum.CodeName, thread.RedirectThreadID, thread.ThreadTypeString, type);
                    }
                }
            }
            else
            {
                if (typeIsExtParms)
                {
                    url = BbsUrlHelper.GetThreadUrlForPagerExtParms(forum.CodeName, thread.RedirectThreadID, thread.ThreadTypeString, type);
                }
                else
                {
                    if (string.IsNullOrEmpty(type))
                    {
                        url = BbsUrlHelper.GetThreadUrlForPager(codeName, thread.RedirectThreadID, listPage, thread.ThreadTypeString);
                    }
                    else
                    {
                        url = BbsUrlHelper.GetThreadUrlForPager(codeName, thread.RedirectThreadID, thread.ThreadTypeString, type);
                    }
                }
            }

            if (totalPage > 1 && totalPage <= 5)
            {
                for (int i = 1; i < totalPage + 1; i++)
                {
                    //string url=UrlHelper.GetThreadUrl(forum.CodeName, thread.RedirectThreadID, i);
                    //if (!string.IsNullOrEmpty(urlParams))
                    //    url = url + (url.IndexOf('?') > 0 ? "&" : "?") + urlParams;

                    sb.Append(string.Format(urlStyle, string.Format(url, i), i));
                    if (i < totalPage)
                    {
                        sb.Append(" ");
                    }
                }
            }
            else if (totalPage > 5)
            {
                for (int i = 1; i < totalPage + 1; i++)
                {
                    if (i < 3 || i > totalPage - 3)
                    {
                        sb.Append(string.Format(urlStyle, string.Format(url, i), i) + " ");
                    }
                    else if (i == 3)
                    {
                        sb.Append("... ");
                    }
                }
            }
            if (string.IsNullOrEmpty(style))
            {
                return(sb.ToString());
            }
            else
            {
                if (sb.Length > 0)
                {
                    return(string.Format(style, sb.ToString()));
                }
                else
                {
                    return("");
                }
            }
        }
예제 #25
0
 protected string GetSearchThreadUrl(PostV5 post)
 {
     return(BbsUrlHelper.GetSearchThreadUrl(post.Forum.CodeName, post.ThreadID, post.PostID, mode, searchText));
 }
예제 #26
0
 protected string GetThreadLastPageUrl(BasicThread thread)
 {
     return(BbsUrlHelper.GetThreadUrl(thread.Forum.CodeName, thread.RedirectThreadID, thread.ThreadTypeString, thread.TotalPages, 1));
 }
예제 #27
0
        protected void ProcessPost()
        {
            string         validateCodeAction = "ReplyTopic";
            MessageDisplay msgDisplay         = CreateMessageDisplay();

            if (CheckValidateCode(validateCodeAction, msgDisplay))
            {
                PostType postType        = (PostType)_Request.Get <int>("viewPointType", Method.Post, 0);
                bool     isReplyPolemize = _Request.Get <bool>("isReplyPolemize", Method.Post, false);

                if (isReplyPolemize && postType == PostType.Normal)
                {
                    msgDisplay.AddError("请选择您的观点!");
                    return;
                }

                string postNickName;
                if (IsLogin == false)
                {
                    if (EnableGuestNickName)
                    {
                        postNickName = _Request.Get("guestNickName", Method.Post, "");
                    }
                    else
                    {
                        postNickName = "";
                    }
                }
                else
                {
                    postNickName = My.Name;
                }
                string subject   = _Request.Get("Subject", Method.Post, string.Empty);
                string content   = _Request.Get("Editor", Method.Post, string.Empty, false);
                string iPAddress = _Request.IpAddress;

                //string enableItems = _Request.Get("enableItem", Method.Post, string.Empty);

                bool enableHTML     = false;
                bool enableMaxCode3 = false;
                if (AllowHtml && AllowMaxcode)
                {
                    enableHTML = _Request.Get <int>("eritoSellect", Method.Post, 0) == 1;

                    if (enableHTML == false)
                    {
                        enableMaxCode3 = true;
                    }
                }
                else if (AllowHtml)
                {
                    enableHTML = true;
                }

                else if (AllowMaxcode)
                {
                    enableMaxCode3 = true;
                }

                bool enableEmoticons   = true; // (enableItems.IndexOf("enableemoticons", StringComparison.OrdinalIgnoreCase) > -1);
                bool enableSignature   = true; //(enableItems.IndexOf("enablesignature", StringComparison.OrdinalIgnoreCase) > -1);
                bool enableReplyNotice = true; //(enableItems.IndexOf("enablereplynotice", StringComparison.OrdinalIgnoreCase) > -1);

                int  postID        = 0;
                bool success       = false;
                bool hasCatchError = false;
                try
                {
                    success = PostBOV5.Instance.ReplyThread(
                        My, ThreadID, postType, 0, subject, content, enableEmoticons, enableHTML, enableMaxCode3, enableSignature
                        , enableReplyNotice, ForumID, postNickName, iPAddress, 0, new AttachmentCollection(), false, out postID);
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                    hasCatchError = true;
                }

                if (hasCatchError == false)
                {
                    if (success == false)
                    {
                        CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            if (error is UnapprovedError)
                            {
                                _Request.Clear();
                                AlertWarning(error.Message);
                            }
                            else
                            {
                                msgDisplay.AddError(error);
                            }
                        });
                    }
                    else
                    {
                        ValidateCodeManager.CreateValidateCodeActionRecode(validateCodeAction);
                        bool returnLastUrl = _Request.Get <int>("tolastpage", Method.Post, 0) == 1;

                        UserBO.Instance.UpdateUserReplyReturnThreadLastPage(My, returnLastUrl);

                        if (IsAjaxRequest)
                        {
                            AlertSuccess("操作成功");//告诉客户端操作成功
                            if (returnLastUrl)
                            {
                                PageNumber = PostBOV5.Instance.GetThread(ThreadID).TotalPages;
                            }
                            else
                            {
                                PageNumber         = PageNumber;
                                m_ThreadLastPostID = postID;
                            }
                            //_Request.Clear();
                        }
                        else
                        {
                            string returnUrl;
                            if (returnLastUrl)
                            {
                                returnUrl = BbsUrlHelper.GetLastThreadUrl(Forum.CodeName, ThreadID, postID, PostBOV5.Instance.GetThread(ThreadID).TotalPages, true);
                            }
                            else
                            {
                                returnUrl = BbsUrlHelper.GetThreadUrl(Forum.CodeName, ThreadID, PostBOV5.Instance.GetThread(ThreadID).ThreadTypeString, PageNumber) + "?lastPostID=" + postID;
                            }
                            Response.Redirect(returnUrl);
                        }
                    }
                }
            }
        }
예제 #28
0
        protected string GetThreadUrl(BasicThread thread)
        {
            Forum forum = thread.Forum;

            return(BbsUrlHelper.GetThreadUrl(forum.CodeName, thread.RedirectThreadID, thread.ThreadTypeString));
        }
예제 #29
0
        //快速发帖
        private void ProcessThread()
        {
            string         validateCodeAction = "CreateTopic";
            MessageDisplay msgDisplay         = CreateMessageDisplay();

            if (CheckValidateCode(validateCodeAction, msgDisplay))
            {
                string posterName;
                if (IsLogin == false)
                {
                    if (EnableGuestNickName)
                    {
                        posterName = _Request.Get("guestNickName", Method.Post, string.Empty);
                    }
                    else
                    {
                        posterName = "";
                    }
                }
                else
                {
                    posterName = My.Name;
                }

                string subject   = _Request.Get("Subject", Method.Post, string.Empty);
                string content   = _Request.Get("Editor", Method.Post, string.Empty, false);
                string ipAddress = _Request.IpAddress;

                //string enableItems = _Request.Get("enableItem", Method.Post, string.Empty);

                bool enableHtml     = false;
                bool enableMaxCode3 = false;
                if (AllowHtml && AllowMaxcode)
                {
                    enableHtml = _Request.Get <int>("eritoSellect", Method.Post, 0) == 1;
                    //enableHtml = StringUtil.EqualsIgnoreCase(_Request.Get("contentFormat", Method.Post, ""), "enablehtml");
                    if (enableHtml == false)
                    {
                        enableMaxCode3 = true;
                    }
                }
                else if (AllowHtml)
                {
                    enableHtml = true;
                }
                else if (AllowMaxcode)
                {
                    enableMaxCode3 = true;
                }

                bool enableEmoticons   = true; //(enableItems.IndexOf("enableemoticons", StringComparison.OrdinalIgnoreCase) > -1);
                bool enableSignature   = true; //(enableItems.IndexOf("enablesignature", StringComparison.OrdinalIgnoreCase) > -1);
                bool enableReplyNotice = true; //(enableItems.IndexOf("enablereplynotice", StringComparison.OrdinalIgnoreCase) > -1);

                int threadCatalogID = _Request.Get <int>("threadCatalogs", Method.Post, 0);


                int  threadID = 0, postID = 0;
                bool success       = false;
                bool hasCatchError = false;
                try
                {
                    success = PostBOV5.Instance.CreateThread(
                        My, false, enableEmoticons, ForumID, threadCatalogID, 0, subject
                        , string.Empty, 0, posterName, false, false, content, enableHtml, enableMaxCode3, enableSignature
                        , enableReplyNotice, ipAddress, new AttachmentCollection(), out threadID, out postID
                        );
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                    hasCatchError = true;
                }

                if (hasCatchError == false)
                {
                    if (success == false)
                    {
                        CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            if (error is UnapprovedError)
                            {
                                m_PageNumber = PageNumber;
                                _Request.Clear();
                                AlertWarning(error.Message);
                            }
                            else
                            {
                                msgDisplay.AddError(error);
                            }
                        });
                    }
                    else
                    {
                        ValidateCodeManager.CreateValidateCodeActionRecode(validateCodeAction);
                        if (IsAjaxRequest)
                        {
                            m_PageNumber = PageNumber;

                            AlertSuccess("操作成功");
                            _Request.Clear();
                        }
                        else
                        {
                            string returnUrl = BbsUrlHelper.GetForumUrl(Forum.CodeName, Action, PageNumber);
                            Response.Redirect(returnUrl);
                        }
                    }
                }
            }
        }
예제 #30
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            AddNavigationItem("搜索");

            SearchSettings setting = AllSettings.Current.SearchSettings;

            if (IsLogin == false && setting.EnableGuestSearch == false)
            {
                ShowError("您是游客不允许使用搜索帖子的功能");
            }
            else if (IsLogin && setting.EnableSearch[My] == false)
            {
                ShowError("您所在的用户组不允许使用搜索帖子的功能");
            }

            canVisitForumIDs = ForumBO.Instance.GetForumIdsForVisit(My);

            if (canVisitForumIDs != null && canVisitForumIDs.Count == 0)
            {
                ShowError("您所在的用户组没有搜索帖子的权限");
            }

            //int maxResultCount = 0;

            if (IsLogin == false)
            {
                m_MaxResultCount = setting.GuestMaxResultCount;
            }
            else
            {
                m_MaxResultCount = setting.MaxResultCount[My];
            }

            if (_Request.Get("searchID", Method.Get) != null)
            {
                m_SearchID = _Request.Get <Guid>("searchID", Method.Get, Guid.Empty);
                if (m_SearchID == Guid.Empty)
                {
                    ShowError("非法的searchID");
                }
            }

            if (_Request.IsClick("SearchSubmit"))
            {
                ProcessSearch();
            }
            else
            {
                if (m_SearchID == Guid.Empty)
                {
                    mode = (SearchMode)_Request.Get <int>("Mode", Method.Get, 1);
                    string searchText = _Request.Get("SearchText", Method.Get, string.Empty, false);

                    if (mode == SearchMode.ThreadUserID || mode == SearchMode.PostUserID)
                    {
                        int userID;
                        if (int.TryParse(searchText, out userID) == false)
                        {
                            ShowError("用户ID必须为整数!");
                            return;
                        }

                        User user = UserBO.Instance.GetUser(userID);
                        if (user == null)
                        {
                            ShowError("不存在该用户!");
                            return;
                        }
                        else
                        {
                            if (mode == SearchMode.ThreadUserID)
                            {
                                mode = SearchMode.UserThread;
                            }
                            else
                            {
                                mode = SearchMode.UserPost;
                            }

                            m_SearchID = PostBOV5.Instance.SearchTopics(My, null, user.Username, mode, setting.SearchType, null, false, true, m_MaxResultCount);
                        }
                    }
                    else if (mode == SearchMode.Subject || mode == SearchMode.Content)
                    {
                        m_SearchID = PostBOV5.Instance.SearchTopics(My, null, HttpUtility.HtmlEncode(searchText), mode, setting.SearchType, null, false, true, m_MaxResultCount);
                    }
                    else if (mode == SearchMode.UserThread && searchText != string.Empty)
                    {
                        User user = UserBO.Instance.GetUser(searchText);
                        if (user == null)
                        {
                            ShowError("不存在该用户!");
                            return;
                        }
                        m_SearchID = PostBOV5.Instance.SearchTopics(My, null, searchText, mode, setting.SearchType, null, false, true, m_MaxResultCount);
                    }
                    if (m_SearchID != Guid.Empty)
                    {
                        string url = BbsUrlHelper.GetSearchIndexUrl() + "?searchID=" + m_SearchID.ToString();
                        ShowSuccess("搜索完毕, 稍后将转到搜索结果页面", url);
                    }
                }
                else
                {
                    ProcessGetThreads();
                }
            }
        }