예제 #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
 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));
     }
 }
예제 #3
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);
                        }
                    }
                }
            }
        }
예제 #4
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();
        }
예제 #5
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());
        }
예제 #6
0
 protected virtual string GetNavigationForumUrl(Forum forum)
 {
     return(BbsUrlHelper.GetForumUrl(forum.CodeName));
 }