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)); } }
protected override bool CheckPermission() { if (Forum == null) { if (Thread == null) { return(false); } Response.Redirect(BbsUrlHelper.GetArchiverThreadUrl(Thread.Forum.CodeName, Thread.ThreadID)); //ErrorMessage = "版块不存在"; //return false; } if (false == Forum.CanVisit(My)) { if (!Forum.CanDisplayInList(My)) { ErrorMessage = "版块不存在!"; } else { ErrorMessage = "您没有权限进入该版块!"; } return(false); } //版块类型正常,但需要密码 if (Forum.ForumType == ForumType.Normal && !string.IsNullOrEmpty(Forum.Password)) { //如果当前用户不拥有“进入版块不需要密码”的权限,继续检查 if (!Forum.SigninWithoutPassword(My)) { //检查这个用户之前是否已经通过这个版块的验证,避免重复输入密码 if (!My.IsValidatedForum(Forum)) { ErrorMessage = "进入该版块需要密码"; return(false); } } } if (Thread == null || ReplyList == null) { ErrorMessage = "主题不存在"; return(false); } if (Thread.ForumID != Forum.ForumID) { Response.Redirect(UrlHelper.GetArchiverThreadUrl(Thread.Forum.CodeName, Thread.ThreadID)); } if (Can(ForumPermissionSetNode.Action.VisitThread) == false) { ErrorMessage = "您所在的用户组没有进入主题页的权限"; return(false); } if (Thread.ThreadType == ThreadType.Move) { BasicThread tempThread = PostBOV5.Instance.GetThread(Thread.RedirectThreadID); string tempCodeName = ""; if (tempThread != null) { Forum tempForum = ForumBO.Instance.GetForum(tempCodeName); if (tempForum != null) { tempCodeName = tempForum.CodeName; } else { ErrorMessage = "主题不存在!"; return(false); } } else { ErrorMessage = "主题不存在!"; return(false); } string url = BbsUrlHelper.GetArchiverThreadUrl(tempCodeName, tempThread.ThreadID); Response.Redirect(url); return(false); } else if (Thread.ThreadType == ThreadType.Question) { //PostV5 bestPost; //QuestionV5 question = PostBOV5.Instance.GetQuestion(Thread.ThreadID, out bestPost); //Question question = PostManager.GetQuestion(thread.ThreadID, false, out bestPost); QuestionThread question = null; if (Thread is QuestionThread) { question = (QuestionThread)Thread; if (PageNumber == 1 && question.BestPost != null) { //把最佳答案插入第2楼 m_ReplyList.Insert(1, question.BestPost); } } if (question == null) { ErrorMessage = "主题不存在!"; } if (Thread.IsClosed) { IsShowReplies = true; } else if (question.AlwaysEyeable || ForumPermission.Can(My, ForumPermissionSetNode.Action.AlwaysViewContents) || Thread.IsReplied(My)) { IsShowReplies = true; } else { IsShowReplies = false; } } return(true); }