예제 #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 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));
     }
 }
예제 #7
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);
 }
예제 #8
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"));
        }
예제 #9
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);
            //}
        }
예제 #10
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);
            //}
        }
예제 #11
0
        private void WriteXML()
        {
            List <int> canVisitForumIDs = ForumBO.Instance.GetForumIdsForVisit(User.Guest);


            DateTime dateTime = (DateTimeUtil.Now - new TimeSpan(AllSettings.Current.BaiduPageOpJopSettings.UpdateFrequency, 0, 0));

            ThreadCollectionV5 threads = PostBOV5.Instance.GetThreadsByLastPostCreateDate(dateTime);

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

            while (true)
            {
                //if (Bbs3Globals.ApplicationPath != null && Globals.FullWebRoot != null)
                if (Globals.FullAppRoot != null && Globals.SiteRoot != null)
                {
                    break;
                }
                else
                {
                    System.Threading.Thread.Sleep(1000);
                }
            }

            string fielName = UrlUtil.JoinUrl(AllSettings.Current.BaiduPageOpJopSettings.FilePath, "\\sitemap_baidu.xml");//= Common.Globals.
            //写XML
            XmlTextWriter xmlWriter = null;

            try
            {
                xmlWriter = new XmlTextWriter(fielName, Encoding.UTF8);
            }
            catch
            {
                if (xmlWriter != null)
                {
                    xmlWriter.Close();
                }
                return;
            }
            //xmlWriter.Namespaces = false;
            xmlWriter.WriteStartDocument();
            xmlWriter.WriteStartElement("document");
            xmlWriter.WriteAttributeString("xmlns", "bbs", null, "http://www.baidu.com/search/bbs_sitemap.xsd");
            //xmlWriter.
            xmlWriter.WriteElementString("webSite", Globals.FullAppRoot);
            xmlWriter.WriteElementString("webMaster", AllSettings.Current.BaiduPageOpJopSettings.Email);
            xmlWriter.WriteElementString("updatePeri", AllSettings.Current.BaiduPageOpJopSettings.UpdateFrequency.ToString());
            xmlWriter.WriteElementString("updatetime", DateTime.Now.ToString());
            xmlWriter.WriteElementString("version", Globals.Version);

            foreach (BasicThread thread in threads)
            {
                if (canVisitForumIDs.Contains(thread.ForumID))
                {
                    xmlWriter.WriteStartElement("item");

                    xmlWriter.WriteStartElement("link");
                    xmlWriter.WriteString(UrlUtil.JoinUrl(Globals.SiteRoot, BbsUrlHelper.GetThreadUrl(thread.Forum.CodeName, thread.ThreadID, thread.ThreadTypeString, 1, 1)));
                    xmlWriter.WriteEndElement();
                    //标题节点
                    xmlWriter.WriteStartElement("title");
                    xmlWriter.WriteString(Format(thread.SubjectText));
                    xmlWriter.WriteEndElement();

                    xmlWriter.WriteStartElement("pubDate");
                    xmlWriter.WriteString(thread.CreateDate.ToString());
                    xmlWriter.WriteEndElement();

                    xmlWriter.WriteStartElement("bbs:lastDate");
                    xmlWriter.WriteString(thread.UpdateDate.ToString());
                    xmlWriter.WriteEndElement();

                    xmlWriter.WriteStartElement("bbs:reply");
                    xmlWriter.WriteString(thread.TotalReplies.ToString());
                    xmlWriter.WriteEndElement();

                    xmlWriter.WriteStartElement("bbs:hit");
                    xmlWriter.WriteString(thread.TotalViews.ToString());
                    xmlWriter.WriteEndElement();

                    xmlWriter.WriteStartElement("bbs:mainLen");
                    if (thread.ThreadContent != null)
                    {
                        xmlWriter.WriteString(StringUtil.GetByteCount(thread.ThreadContent.Content).ToString());
                    }
                    else
                    {
                        xmlWriter.WriteString("1");
                    }
                    xmlWriter.WriteEndElement();

                    xmlWriter.WriteStartElement("bbs:boardid");
                    xmlWriter.WriteString(thread.ForumID.ToString());
                    xmlWriter.WriteEndElement();

                    xmlWriter.WriteStartElement("bbs:pick");
                    xmlWriter.WriteString(thread.IsValued ? "1" : "0");
                    xmlWriter.WriteEndElement();

                    xmlWriter.WriteEndElement();
                }
            }
            xmlWriter.WriteEndElement();
            xmlWriter.WriteEndDocument();
            xmlWriter.Flush();
            xmlWriter.Close();
        }
예제 #12
0
 protected string GetThreadLastPageUrl(BasicThread thread)
 {
     return(BbsUrlHelper.GetThreadUrl(thread.Forum.CodeName, thread.RedirectThreadID, thread.ThreadTypeString, thread.TotalPages, 1));
 }
예제 #13
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);
            }
        }
예제 #14
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());
        }
예제 #15
0
        private void BuildRssFile()
        {
            string decodeTicket = "0|guest|";

            if (userTicket != string.Empty)
            {
                try
                {
                    decodeTicket = SecurityUtil.DesDecode(userTicket);//解密
                }
                catch
                {
                    ShowError("非法的密钥");
                }
                if (decodeTicket == null || decodeTicket.LastIndexOf('|') <= 0)
                {
                    decodeTicket = "0|guest|";
                }
            }

            string[] split = decodeTicket.Split('|');
            if (split.Length != 3)
            {
                split = new string[] { "0", "guest", "" };
            }
            int    userID        = Convert.ToInt32(split[0]);
            string password      = split[1];
            string forumPassword = split[2];

            ThreadCollectionV5 threads = new ThreadCollectionV5();

            string userPassword = string.Empty;

            AuthUser user;

            if (userID == 0)
            {
                userPassword = "******";
                user         = MaxLabs.bbsMax.Entities.User.Guest;
            }
            else
            {
                user         = UserBO.Instance.GetAuthUser(userID);
                userPassword = user.Password;
            }

            if (string.Compare(userPassword, password, true) == 0)
            {
                int count = AllSettings.Current.BbsSettings.RssShowThreadCount;

                if (count > 0)
                {
                    int total;
                    if (forumID != 0)
                    {
                        threads = PostBOV5.Instance.GetNewThreads(user, forumID, 1, count, out total); //PostManager.GetThreadsByCreateDate(forumID, 0, 20);
                    }
                    else //等于0
                    {
                        threads = PostBOV5.Instance.GetNewThreads(user, null, 1, count, out total);//PostManager.GetThreadsByCreateDate(0, 20);
                    }
                }
            }
            //开始输出XML
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.ContentType = "text/xml";
            XmlTextWriter xmlWriter = new XmlTextWriter(HttpContext.Current.Response.OutputStream, Encoding.UTF8);

            xmlWriter.WriteStartDocument();
            xmlWriter.WriteStartElement("rss");
            xmlWriter.WriteAttributeString("version", "2.0");
            xmlWriter.WriteStartElement("channel");
            xmlWriter.WriteElementString("title", BbsName);
            xmlWriter.WriteElementString("link", Globals.FullAppRoot);
            xmlWriter.WriteElementString("description", "bbsMax");
            xmlWriter.WriteElementString("copyright", "(c) 2007, bbsMax. All rights reserved.");
            xmlWriter.WriteElementString("generator", "bbsMax");
            xmlWriter.WriteElementString("ttl", "30");
            foreach (BasicThread thread in threads)
            {
                //Item节点
                xmlWriter.WriteStartElement("item");
                //标题节点
                xmlWriter.WriteStartElement("title");
                xmlWriter.WriteCData(Format(thread.SubjectText));
                xmlWriter.WriteEndElement();
                //描述节点
                xmlWriter.WriteStartElement("description");
                xmlWriter.WriteCData(Format(thread.SubjectText));
                xmlWriter.WriteEndElement();
                //类别节点
                xmlWriter.WriteStartElement("category");
                xmlWriter.WriteCData(Format(thread.Forum.ForumName));
                xmlWriter.WriteEndElement();
                //链接节点
                xmlWriter.WriteStartElement("link");
                xmlWriter.WriteString(UrlUtil.JoinUrl(Globals.SiteRoot, BbsUrlHelper.GetThreadUrl(thread.Forum.CodeName, thread.ThreadID, thread.ThreadTypeString, 1)));
                xmlWriter.WriteEndElement();
                //作者节点
                xmlWriter.WriteStartElement("author");
                xmlWriter.WriteCData(Format(thread.LastReplyUsername));
                xmlWriter.WriteEndElement();
                //日期节点
                xmlWriter.WriteStartElement("pubDate");
                xmlWriter.WriteString(thread.CreateDate.AddHours(-AllSettings.Current.DateTimeSettings.ServerTimeZone).ToString("R"));
                xmlWriter.WriteEndElement();

                xmlWriter.WriteEndElement();
            }
            xmlWriter.WriteEndElement();
            xmlWriter.WriteEndElement();
            xmlWriter.WriteEndDocument();
            xmlWriter.Flush();
            xmlWriter.Close();
            HttpContext.Current.Response.End();
        }
예제 #16
0
        protected string GetThreadUrl(BasicThread thread)
        {
            Forum forum = thread.Forum;

            return(BbsUrlHelper.GetThreadUrl(forum.CodeName, thread.RedirectThreadID, thread.ThreadTypeString));
        }
예제 #17
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);
                        }
                    }
                }
            }
        }
예제 #18
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);
            }
        }