Exemple #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int tid = DNTRequest.GetInt("tid", 0);

        if (tid > 0)
        {
            //ShowtopicPagePostInfo info = Posts.GetSinglePost(tid);
            PostInfo postInfo = Posts.GetPostInfo(tid, Posts.GetFirstPostId(tid));
            if (postInfo != null)
            {
                //处理帖子内容
                PostpramsInfo postpramsinfo = new PostpramsInfo();
                postpramsinfo.Smileyoff   = postInfo.Smileyoff;
                postpramsinfo.Bbcodeoff   = postInfo.Bbcodeoff;
                postpramsinfo.Parseurloff = postInfo.Parseurloff;
                postpramsinfo.Allowhtml   = postInfo.Htmlon;
                postpramsinfo.Sdetail     = postInfo.Message;
                postpramsinfo.Pid         = postInfo.Pid;
                postpramsinfo.Showimages  = 1;

                //Discuz.Web.News.News

                //显示内容
                lblTitle.Text     = postInfo.Title;
                lblAuthor.Text    = postInfo.Poster;
                lblDatetime.Text  = postInfo.Postdatetime.ToString();
                content.InnerHtml = UBB.UBBToHTML(postpramsinfo);
            }
        }
    }
Exemple #2
0
        public static List<Post> GetPostList(PostpramsInfo pi, out List<Attachment> attachList, bool isModer)
        {
            //var postList = BBX.Data.Posts.GetPostList(postpramsInfo);
            var uid = 0;
            if (!pi.Condition.IsNullOrWhiteSpace()) uid = pi.Condition.Substring(pi.Condition.IndexOf("=") + 1).ToInt();
            var postList = Post.GetPostList(pi.Tid, uid, pi.Invisible, pi.Pageindex, pi.Pagesize)
                .ToList();
            attachList = new List<Attachment>();
            if (postList.Count == 0) return postList;
            // 设置楼层
            var start = (pi.Pageindex - 1) * pi.Pagesize;
            foreach (var item in postList)
            {
                item.Id = ++start;
            }

            int inPostAdCount = Advertisement.GetInPostAdCount("", pi.Fid);
            //ForumInfo forumInfo = Forums.GetForumInfo(postList[0].Fid);
            var forumInfo = XForum.FindByID(postList[0].Fid);
            foreach (var item in postList)
            {
                item.SmileyOff = !forumInfo.AllowSmilies ? 1 : item.SmileyOff;
                item.BBCodeOff = !forumInfo.AllowBbCode ? 1 : item.BBCodeOff;
                Posts.LoadExtraPostInfo(item, inPostAdCount);
            }
            string pidListWithAttach = Posts.GetPidListWithAttach(postList);
            attachList = Attachments.GetAttachmentList(pi, pidListWithAttach);
            Posts.ParsePostListExtraInfo(pi, attachList, isModer, postList);
            return postList;
        }
Exemple #3
0
        /// <summary>
        /// 装载帖子列表
        /// </summary>
        /// <param name="postpramsInfo">参数对象</param>
        /// <param name="reader"></param>
        /// <returns></returns>
        public static List <ShowtopicPagePostInfo> LoadPostList(PostpramsInfo postpramsInfo, IDataReader reader)
        {
            List <ShowtopicPagePostInfo> postList = new List <ShowtopicPagePostInfo>();

            //序号(楼层)的初值
            int id = (postpramsInfo.Pageindex - 1) * postpramsInfo.Pagesize;

            while (reader.Read())
            {
                //当帖子中的posterid字段为0时, 表示该数据出现异常
                if (TypeConverter.ObjectToInt(reader["posterid"]) == 0)
                {
                    continue;
                }

                ShowtopicPagePostInfo postInfo = LoadSingleShowtopicPagePostInfo(reader);
                //扩展属性
                id++;

                postInfo.Id = id;

                postList.Add(postInfo);
            }
            reader.Close();

            return(postList);
        }
Exemple #4
0
        /// <summary>
        /// 获取指定条件的帖子DataSet
        /// </summary>
        /// <param name="_postpramsinfo">参数列表</param>
        /// <returns>指定条件的帖子DataSet</returns>
        public static List <ShowtopicPagePostInfo> GetPostList(PostpramsInfo postpramsInfo)
        {
            IDataReader reader;
            string      postTableId = PostTables.GetPostTableId(postpramsInfo.Tid);

            if (!postpramsInfo.Condition.Equals(""))
            {
                reader = DatabaseProvider.GetInstance().GetPostListByCondition(postpramsInfo, postTableId);
            }
            else
            {
                //更新Cache缓存中的帖子信息(目前只对当前分表进行查询,这主要出于将所有分表数据转换对于某些中型论坛的服务器硬盘内存要求过高的暂时方案)
                if (postTableId == PostTables.GetPostTableId() && appDBCache && IPostService != null)
                {
                    List <ShowtopicPagePostInfo> list = IPostService.GetPostList(postpramsInfo, postTableId);
                    if (list != null && list.Count > 0)
                    {
                        return(list);
                    }
                }

                reader = DatabaseProvider.GetInstance().GetPostList(postpramsInfo, postTableId);
            }

            return(LoadPostList(postpramsInfo, reader));
        }
Exemple #5
0
        public static void ParsePostListExtraInfo(PostpramsInfo postpramsInfo, List<Attachment> attachList, bool isModer, List<Post> postList)
        {
            int hide = postpramsInfo.Hide;
            int allowGetAttachValue = Posts.GetAllowGetAttachValue(postpramsInfo);
            var guest = UserGroup.Guest;
            //var topicInfo = postpramsInfo.Topicinfo;
            //if (postpramsInfo.Topicinfo == null) topicInfo = Topic.FindByID(postpramsInfo.Tid);
            var topicInfo = Topic.FindByID(postpramsInfo.Tid);

            string stringarray = string.Empty;
            if (topicInfo.Special == 4 && !guest.AllowDiggs)
            {
                stringarray = Debatedigg.GetUesrDiggs(postpramsInfo.Tid, postpramsInfo.CurrentUserid);
            }
            foreach (var pi in postList)
            {
                Posts.LoadPostMessage(postpramsInfo, attachList, isModer, allowGetAttachValue, hide, pi);
                if (topicInfo.Special == 4)
                {
                    if (guest.AllowDiggs)
                    {
                        pi.Digged = Debates.IsDigged(pi.ID, postpramsInfo.CurrentUserid);
                    }
                    else
                    {
                        pi.Digged = Utils.InArray(pi.ID.ToString(), stringarray);
                    }
                }
            }
        }
Exemple #6
0
        /// <summary>
        /// 解析帖子列表附加信息及内容
        /// </summary>
        /// <param name="postpramsInfo">参数对象</param>
        /// <param name="attachList">附件列表</param>
        /// <param name="isModer">是否为版主</param>
        /// <param name="postList">帖子列表</param>
        public static void ParsePostListExtraInfo(PostpramsInfo postpramsInfo, List <ShowtopicPageAttachmentInfo> attachList, bool isModer, List <ShowtopicPagePostInfo> postList)
        {
            int originalHideStatus = postpramsInfo.Hide;
            // 计算是否允许查看附件
            int allowGetAttach = GetAllowGetAttachValue(postpramsInfo);

            #region 计算辩论帖是否被顶过
            string    diggedPidList = string.Empty;
            TopicInfo topicInfo     = postpramsInfo.Topicinfo == null?Topics.GetTopicInfo(postpramsInfo.Tid) : postpramsInfo.Topicinfo;

            if (topicInfo.Special == 4 && UserGroups.GetUserGroupInfo(7).Allowdiggs != 1)
            {
                diggedPidList = Discuz.Data.Debates.GetUesrDiggs(postpramsInfo.Tid, postpramsInfo.CurrentUserid);
            }
            #endregion

            foreach (ShowtopicPagePostInfo postInfo in postList)
            {
                LoadPostMessage(postpramsInfo, attachList, isModer, allowGetAttach, originalHideStatus, postInfo);

                if (topicInfo.Special == 4)
                {
                    if (UserGroups.GetUserGroupInfo(7).Allowdiggs == 1)
                    {
                        postInfo.Digged = Debates.IsDigged(postInfo.Pid, postpramsInfo.CurrentUserid);
                    }
                    else
                    {
                        postInfo.Digged = Utils.InArray(postInfo.Pid.ToString(), diggedPidList); //diggslist.Contains(reader["pid"].ToString());
                    }
                }
            }
        }
Exemple #7
0
        /// <summary>
        /// 获取辩论信息
        /// </summary>
        public void GetDebateInfo(PostpramsInfo postpramsInfo)
        {
            debateexpand = Debates.GetDebateTopic(topicid);
            debateList   = Debates.GetPostDebateList(topicid);//通过TID得到帖子观点
            if (debateexpand.Terminaltime < DateTime.Now)
            {
                isenddebate = true;
            }

            int positivepostlistcount = Debates.GetDebatesPostCount(postpramsInfo, 1);
            int negativepostlistcount = Debates.GetDebatesPostCount(postpramsInfo, 2);

            positivepagecount = (positivepostlistcount % pagesize == 0) ? (positivepostlistcount / pagesize) : (positivepostlistcount / pagesize + 1);
            negativepagecount = (negativepostlistcount % pagesize == 0) ? (negativepostlistcount / pagesize) : (negativepostlistcount / pagesize + 1);

            positivepagenumbers = Utils.GetAjaxPageNumbers(1, positivepagecount, "showdebatepage('" + forumpath + "tools/ajax.aspx?t=getdebatepostpage&opinion=1&tid=" + topic.Tid + "&{0}'," + parseurloff + ", " + smileyoff + ", " + bbcodeoff + ",'" + isenddebate + "',1," + userid + "," + topicid + ")", 8);
            negativepagenumbers = Utils.GetAjaxPageNumbers(1, negativepagecount, "showdebatepage('" + forumpath + "tools/ajax.aspx?t=getdebatepostpage&opinion=2&tid=" + topic.Tid + "&{0}'," + parseurloff + ", " + smileyoff + ", " + bbcodeoff + ",'" + isenddebate + "',2," + userid + "," + topicid + ")", 8);

            //防止无人参与时0做除数
            if (debateexpand.Negativediggs + debateexpand.Positivediggs != 0)
            {
                positivepercent = (float)debateexpand.Positivediggs / (float)(debateexpand.Negativediggs + debateexpand.Positivediggs) * 100;
                negativepercent = 100 - positivepercent;
            }

            foreach (ShowtopicPagePostInfo postlistinfo in positivepostlist)
            {
                //设置POST的观点属性
                if (debateList != null && debateList.ContainsKey(postlistinfo.Pid))
                {
                    postlistinfo.Debateopinion = Convert.ToInt32(debateList[postlistinfo.Pid]);
                }
            }
        }
Exemple #8
0
        private PostpramsInfo GetPostPramsInfo(int hide)
        {
            PostpramsInfo postpramsInfo = new PostpramsInfo();

            postpramsInfo.Fid                    = this.forum.Fid;
            postpramsInfo.Tid                    = this.topicid;
            postpramsInfo.Jammer                 = this.forum.Jammer;
            postpramsInfo.Pagesize               = 5;
            postpramsInfo.Pageindex              = 1;
            postpramsInfo.Getattachperm          = this.forum.Getattachperm;
            postpramsInfo.Usergroupid            = this.usergroupid;
            postpramsInfo.Attachimgpost          = this.config.Attachimgpost;
            postpramsInfo.Showattachmentpath     = this.config.Showattachmentpath;
            postpramsInfo.Hide                   = hide;
            postpramsInfo.Price                  = this.price;
            postpramsInfo.Ubbmode                = false;
            postpramsInfo.Showimages             = this.forum.Allowimgcode;
            postpramsInfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            postpramsInfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            postpramsInfo.Smiliesmax             = this.config.Smiliesmax;
            postpramsInfo.Bbcodemode             = this.config.Bbcodemode;
            postpramsInfo.CurrentUserid          = this.userid;
            User userInfo = Users.GetUserInfo(postpramsInfo.CurrentUserid);

            postpramsInfo.Usercredits = ((userInfo == null) ? 0 : userInfo.Credits);
            return(postpramsInfo);
        }
Exemple #9
0
        /// <summary>
        /// 获取帖子参数信息(PostPramsInfo)
        /// </summary>
        /// <param name="price"></param>
        /// <returns></returns>
        public PostpramsInfo GetPostPramsInfo(int price)
        {
            //获取当前页主题列表
            PostpramsInfo postpramsInfo = new PostpramsInfo();

            postpramsInfo.Fid                    = forum.Fid;
            postpramsInfo.Tid                    = topicid;
            postpramsInfo.Jammer                 = forum.Jammer;
            postpramsInfo.Pagesize               = ppp; // 得到Ppp设置
            postpramsInfo.Pageindex              = pageid;
            postpramsInfo.Getattachperm          = forum.Getattachperm;
            postpramsInfo.Usergroupid            = usergroupid;
            postpramsInfo.Attachimgpost          = config.Attachimgpost;
            postpramsInfo.Showattachmentpath     = config.Showattachmentpath;
            postpramsInfo.Price                  = price;
            postpramsInfo.Usergroupreadaccess    = (ismoder == 1) ? int.MaxValue : usergroupinfo.Readaccess;
            postpramsInfo.CurrentUserid          = userid;
            postpramsInfo.Showimages             = forum.Allowimgcode;
            postpramsInfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            postpramsInfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            postpramsInfo.Smiliesmax             = config.Smiliesmax;
            postpramsInfo.Bbcodemode             = config.Bbcodemode;
            postpramsInfo.CurrentUserGroup       = usergroupinfo;
            postpramsInfo.Topicinfo              = topic;
            //判断是否为回复可见帖, hide=0为不解析[hide]标签, hide>0解析为回复可见字样, hide=-1解析为以下内容回复可见字样显示真实内容
            //将逻辑判断放入取列表的循环中处理,此处只做是否为回复人的判断,主题作者也该可见
            postpramsInfo.Hide = topic.Hide >= 1 ? (ismoder == 1 || Posts.IsReplier(topicid, userid) ? -1 : topic.Hide) : topic.Hide;
            postpramsInfo.Hide = topic.Posterid == userid ? -2 : postpramsInfo.Hide;
            hide = postpramsInfo.Hide;
            postpramsInfo.Condition     = Posts.GetPostPramsInfoCondition(onlyauthor, topicid, posterid);
            postpramsInfo.TemplateWidth = Templates.GetTemplateWidth(templatepath);//获取当前模版的宽度
            postpramsInfo.Usercredits   = userInfo == null ? 0 : userInfo.Credits;
            postlist = Posts.GetPostList(postpramsInfo, out attachmentlist, ismoder == 1);
            if (postlist.Count == 0)
            {
                TopicAdmins.RepairTopicList(topicid.ToString());
                topic = GetTopicInfo();
                BindPageCountAndId();
                postpramsInfo.Pageindex = pagecount;
                postlist = Posts.GetPostList(postpramsInfo, out attachmentlist, ismoder == 1);
            }

            if (postlist.Count > 0)
            {
                this.Context.MaskUserName(postlist, oluserinfo);
            }

            foreach (ShowtopicPageAttachmentInfo showtopicpageattachinfo in attachmentlist)
            {
                if (Forums.AllowGetAttachByUserID(forum.Permuserlist, userid))
                {
                    showtopicpageattachinfo.Getattachperm = 1;
                    showtopicpageattachinfo.Allowread     = 1;
                }
            }
            BindDownloadAttachmentTip();

            return(postpramsInfo);
        }
Exemple #10
0
        public static string GetMessageWithAttachInfo(PostpramsInfo postPramsInfo, int allowGetAttach, string[] hideAttachIdArray, Int32 pid, Int32 posterid, Attachment attachInfo, string message)
        {
            if (Utils.InArray(attachInfo.ID.ToString(), hideAttachIdArray))
            {
                return(message);
            }

            if ((attachInfo.ReadPerm <= postPramsInfo.Usergroupreadaccess || posterid == postPramsInfo.CurrentUserid) && allowGetAttach == 1)
            {
                attachInfo.AllowRead = true;
            }
            else
            {
                attachInfo.AllowRead = false;
            }

            attachInfo.Getattachperm = allowGetAttach;
            attachInfo.FileName      = attachInfo.FileName.ToString().Replace("\\", "/");
            if (message.IndexOf("[attach]" + attachInfo.ID + "[/attach]") != -1 ||
                message.IndexOf("[attachimg]" + attachInfo.ID + "[/attachimg]") != -1)
            {
                string attachReplacement = Attachments.GetAttachReplacement(postPramsInfo, allowGetAttach, attachInfo);
                Regex  regex             = new Regex(string.Format("\\[attach\\]{0}\\[/attach\\]|\\[attachimg\\]{0}\\[/attachimg\\]", attachInfo.ID));
                message = regex.Replace(message, attachReplacement, 1);
                message = message.Replace("[attach]" + attachInfo.ID + "[/attach]", string.Empty);
                message = message.Replace("[attachimg]" + attachInfo.ID + "[/attachimg]", string.Empty);
                if (attachInfo.Pid == pid)
                {
                    attachInfo.Inserted = true;
                }
            }
            else
            {
                if (attachInfo.Pid == pid)
                {
                    //attachInfo.Attachimgpost = (Attachment.IsImgFilename(attachInfo.Name) ? 1 : 0);
                    var instance = PreviewProvider.GetInstance(Path.GetExtension(attachInfo.FileName).Remove(0, 1).Trim());
                    if (instance != null)
                    {
                        if (attachInfo.FileName.StartsWith("http://") || attachInfo.FileName.StartsWith("ftp://"))
                        {
                            instance.UseFTP    = true;
                            attachInfo.Preview = instance.GetPreview(attachInfo.FileName, attachInfo);
                        }
                        else
                        {
                            instance.UseFTP = false;
                            string fileName = "";
                            if (!attachInfo.FileName.Contains("://"))
                            {
                                fileName = Utils.GetMapPath(BaseConfigs.GetForumPath + "upload/" + attachInfo.FileName);
                            }
                            attachInfo.Preview = instance.GetPreview(fileName, attachInfo);
                        }
                    }
                }
            }
            return(message);
        }
Exemple #11
0
        private static List <Post> GetDebatePostList(PostpramsInfo pi, out List <Attachment> attachList, bool isModer, int debateOpinion, PostOrderType postOrderType)
        {
            var sb = new StringBuilder();
            //var list = BBX.Data.Debates.GetDebatePostList(pi, debateOpinion, postOrderType);
            var list = Post.SearchDebate(pi.Tid, debateOpinion, (pi.Pageindex - 1) * pi.Pagesize, pi.Pagesize);

            if (list.Count == 0 && pi.Pageindex > 1)
            {
                //var count = BBX.Data.Debates.GetRealDebatePostCount(pi.Tid, debateOpinion);
                var count = Post.SearchDebateCount(pi.Tid, debateOpinion);
                pi.Pageindex = ((count % pi.Pagesize == 0) ? (count / pi.Pagesize) : (count / pi.Pagesize + 1));
                //list = BBX.Data.Debates.GetDebatePostList(pi, debateOpinion, postOrderType);
                list = Post.SearchDebate(pi.Tid, debateOpinion, (pi.Pageindex - 1) * pi.Pagesize, pi.Pagesize);
            }
            var list2 = list.ToList();
            // 设置楼层
            var start = (pi.Pageindex - 1) * pi.Pagesize;
            var db    = Debate.FindByTid(pi.Tid);

            foreach (var item in list2)
            {
                item.Id = ++start;

                if (db != null)
                {
                    db.CastTo(item);
                }
            }

            var sb2           = new StringBuilder();
            int inPostAdCount = Advertisement.GetInPostAdCount("", pi.Fid);

            foreach (var item in list2)
            {
                Posts.LoadExtraPostInfo(item, inPostAdCount);
                sb.AppendFormat("{0},", item.ID);
                if (item.Attachment > 0)
                {
                    sb2.AppendFormat("{0},", item.ID);
                }
            }
            attachList = Attachments.GetAttachmentList(pi, sb2.ToString().TrimEnd(','));
            var postDiggs = Debates.GetPostDiggs(sb.ToString().Trim(','));

            foreach (var item in list2)
            {
                if (postDiggs.ContainsKey(item.ID))
                {
                    item.Diggs = postDiggs[item.ID];
                }
            }
            Posts.ParsePostListExtraInfo(pi, attachList, isModer, list2);
            return(list2);
        }
Exemple #12
0
        /// <summary>
        /// 更新用户全部信息
        /// </summary>
        /// <param name="__userinfo"></param>
        /// <returns></returns>
        public static bool UpdateUserAllInfo(UserInfo userInfo)
        {
            Users.UpdateUser(userInfo);

            //当用户不是版主(超级版主)或管理员
            if ((userInfo.Adminid == 0) || (userInfo.Adminid > 3))
            {
                //删除用户在版主列表中相关数据
                Data.Moderators.DeleteModerator(userInfo.Uid);
                //同时更新版块相关的版主信息
                UpdateForumsFieldModerators(userInfo.Username);
            }
            else
            {
                DNTCache cache = DNTCache.GetCacheService();
                cache.RemoveObject("/Forum/AdminUsers");
            }

            #region 以下为更新该用户的扩展信息

            string signature = Utils.HtmlEncode(ForumUtils.BanWordFilter(userInfo.Signature));

            UserGroupInfo     usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(userInfo.Groupid);
            GeneralConfigInfo config        = GeneralConfigs.GetConfig();

            PostpramsInfo postPramsInfo = new PostpramsInfo();
            postPramsInfo.Usergroupid        = usergroupinfo.Groupid;
            postPramsInfo.Attachimgpost      = config.Attachimgpost;
            postPramsInfo.Showattachmentpath = config.Showattachmentpath;
            postPramsInfo.Hide                   = 0;
            postPramsInfo.Price                  = 0;
            postPramsInfo.Sdetail                = userInfo.Signature;
            postPramsInfo.Smileyoff              = 1;
            postPramsInfo.Bbcodeoff              = 1 - usergroupinfo.Allowsigbbcode;
            postPramsInfo.Parseurloff            = 1;
            postPramsInfo.Showimages             = usergroupinfo.Allowsigimgcode;
            postPramsInfo.Allowhtml              = 0;
            postPramsInfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            postPramsInfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            postPramsInfo.Smiliesmax             = config.Smiliesmax;
            postPramsInfo.Signature              = 1;
            postPramsInfo.Onlinetimeout          = config.Onlinetimeout;

            userInfo.Signature = signature;
            userInfo.Authstr   = ForumUtils.CreateAuthStr(20);
            userInfo.Sightml   = UBB.UBBToHTML(postPramsInfo);
            Users.UpdateUser(userInfo);

            #endregion

            Users.UpdateUserForumSetting(userInfo);
            return(true);
        }
Exemple #13
0
 public void GetPostAds(PostpramsInfo postpramsInfo, int count)
 {
     this.inpostad      = Advertisement.GetInPostAd("", this.forumid, this.templatepath, (count > postpramsInfo.Pagesize) ? postpramsInfo.Pagesize : count);
     this.quickeditorad = Advertisement.GetQuickEditorAD("", this.forumid);
     this.quickbgad     = Advertisement.GetQuickEditorBgAd("", this.forumid);
     if (this.quickbgad.Length <= 1)
     {
         this.quickbgad = new string[]
         {
             "",
             ""
         };
     }
 }
Exemple #14
0
        /// <summary>
        /// 获取指定条件的帖子DataSet
        /// </summary>
        /// <param name="_postpramsinfo">参数列表</param>
        /// <returns>指定条件的帖子DataSet</returns>
        public static List <ShowtopicPagePostInfo> GetPostList(PostpramsInfo postpramsInfo, out List <ShowtopicPageAttachmentInfo> attachList, bool isModer)
        {
            List <ShowtopicPagePostInfo> postList = Data.Posts.GetPostList(postpramsInfo);

            attachList = new List <ShowtopicPageAttachmentInfo>();

            //进行相应帖子信息设置
            string pidList = Posts.GetPidListWithAttach(postList);

            attachList = Attachments.GetAttachmentList(postpramsInfo, pidList);
            ParsePostListExtraInfo(postpramsInfo, attachList, isModer, postList);

            return(postList);
        }
Exemple #15
0
        private static List <ShowtopicPagePostInfo> GetDebatePostList(PostpramsInfo postpramsInfo, out List <ShowtopicPageAttachmentInfo> attachList,
                                                                      bool isModer, int debateOpinion, PostOrderType postOrderType)
        {
            List <ShowtopicPagePostInfo> postList = new List <ShowtopicPagePostInfo>();

            attachList = new List <ShowtopicPageAttachmentInfo>();
            StringBuilder attachmentpidlist = new StringBuilder();
            StringBuilder pidList           = new StringBuilder();

            postList = Data.Debates.GetDebatePostList(postpramsInfo, debateOpinion, postOrderType);

            //当因冗余字段不准导致未取得分页信息时,修正冗余字段,并取最后一页
            if (postList.Count == 0 && postpramsInfo.Pageindex > 1)
            {
                int postcount = Data.Debates.GetRealDebatePostCount(postpramsInfo.Tid, debateOpinion);

                postpramsInfo.Pageindex = postcount % postpramsInfo.Pagesize == 0 ? postcount / postpramsInfo.Pagesize : postcount / postpramsInfo.Pagesize + 1;

                postList = Data.Debates.GetDebatePostList(postpramsInfo, debateOpinion, postOrderType);
            }

            StringBuilder attachPidList = new StringBuilder();
            int           adCount       = Advertisements.GetInPostAdCount("", postpramsInfo.Fid);

            foreach (ShowtopicPagePostInfo post in postList)
            {
                Discuz.Forum.Posts.LoadExtraPostInfo(post, adCount);
                pidList.AppendFormat("{0},", post.Pid);
                if (post.Attachment > 0)
                {
                    attachPidList.AppendFormat("{0},", post.Pid);
                }
            }
            attachList = Attachments.GetAttachmentList(postpramsInfo, attachPidList.ToString().TrimEnd(','));

            Dictionary <int, int> postdiggs = GetPostDiggs(pidList.ToString().Trim(','));

            foreach (ShowtopicPagePostInfo post in postList)
            {
                if (postdiggs.ContainsKey(post.Pid))
                {
                    post.Diggs = postdiggs[post.Pid];
                }
            }

            Posts.ParsePostListExtraInfo(postpramsInfo, attachList, isModer, postList);

            return(postList);
        }
Exemple #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int tid = DNTRequest.GetInt("tid", 0);

        if (tid > 0)
        {
            try
            {
                //ShowtopicPagePostInfo info = Posts.GetSinglePost(tid);
                PostInfo postInfo = Posts.GetPostInfo(tid, Posts.GetFirstPostId(tid));
                if (postInfo != null)
                {
                    //处理帖子内容
                    PostpramsInfo postpramsinfo = new PostpramsInfo();
                    postpramsinfo.Smileyoff   = postInfo.Smileyoff;
                    postpramsinfo.Bbcodeoff   = postInfo.Bbcodeoff;
                    postpramsinfo.Parseurloff = postInfo.Parseurloff;
                    postpramsinfo.Allowhtml   = postInfo.Htmlon;
                    postpramsinfo.Sdetail     = postInfo.Message;
                    postpramsinfo.Pid         = postInfo.Pid;
                    postpramsinfo.Showimages  = 1;

                    //Discuz.Web.News.News

                    //显示内容
                    //lblTitle.Text = postInfo.Title;
                    //lblAuthor.Text = postInfo.Poster;
                    //lblDatetime.Text = postInfo.Postdatetime.ToString();
                    //content.InnerHtml = UBB.UBBToHTML(postpramsinfo);
                    string postInfos = "0|" + postInfo.Title + "|" + postInfo.Postdatetime + "|" + postInfo.Poster + "$$$$";
                    string test      = UBB.UBBToHTML(postpramsinfo);
                    Response.Write(postInfos + UBB.UBBToHTML(postpramsinfo));
                }
                else
                {
                    Response.Write("1|不存在相关内容");
                }
            }
            catch (Exception ex)
            {
                Response.Write("2|获取信息出错:" + ex);
            }
        }
        else
        {
            Response.Write("3|帖子不存在");
        }
    }
Exemple #17
0
        //public static void DeleteAttachmentByPid(int pid)
        //{
        //	DataTable attachmentListByPid = Attachments.GetAttachmentListByPid(pid);
        //	if (attachmentListByPid != null || attachmentListByPid.Rows.Count != 0)
        //	{
        //		foreach (DataRow dataRow in attachmentListByPid.Rows)
        //		{
        //			string mapPath = Utils.GetMapPath(BaseConfigs.GetForumPath + "upload/" + dataRow["filename"]);
        //			if (dataRow["filename"].ToString().Trim().ToLower().IndexOf("http") < 0 && File.Exists(mapPath))
        //			{
        //				File.Delete(mapPath);
        //			}
        //		}
        //	}
        //	BBX.Data.Attachments.DeleteAttachmentByPid(pid);
        //}

        //public static int GetUserAttachmentCount(int uid)
        //{
        //    if (uid >= 0)
        //    {
        //        return BBX.Data.Attachments.GetUserAttachmentCount(uid);
        //    }
        //    return 0;
        //}

        //public static int GetUserAttachmentCount(int uid, int typeid)
        //{
        //    return BBX.Data.Attachments.GetUserAttachmentCount(uid, Attachments.SetExtNamelist(typeid));
        //}

        //public static string SetExtNamelist(int typeid)
        //{
        //    string text = "";
        //    string[] array = Attachments.GetExtName(typeid).Split(',');
        //    for (int i = 0; i < array.Length; i++)
        //    {
        //        string str = array[i];
        //        text = text + "'" + str + "',";
        //    }
        //    return text.Remove(text.Length - 1, 1);
        //}

        //public static List<MyAttachmentInfo> GetAttachmentByUid(int uid, int typeid, int pageIndex, int pageSize)
        //{
        //    List<MyAttachmentInfo> result = new List<MyAttachmentInfo>();
        //    if (pageIndex <= 0)
        //    {
        //        return result;
        //    }
        //    return BBX.Data.Attachments.GetAttachmentByUid(uid, typeid, pageIndex, pageSize, Attachments.SetExtNamelist(typeid));
        //}

        //public static List<AttachmentType> AttachTypeList()
        //{
        //    return BBX.Data.Attachments.AttachTypeList();
        //}

        //public static string GetExtName(int typeid)
        //{
        //    var ts = MyAttachmentsTypeConfigInfo.Current.AttachmentType;
        //    for (int i = 0; i < ts.Length; i++)
        //    {
        //        var ti = ts[i];
        //        if (ti.TypeId == typeid)
        //        {
        //            return "." + ti.ExtName.Replace(",", ",.");
        //        }
        //    }
        //    return "";
        //}

        //public static void UpdateSLUploadAttachInfo(int topicid, int postid, UserGroup usergroupinfo)
        //{
        //	if (GeneralConfigInfo.Current.Silverlight != 1 || Utils.StrIsNullOrEmpty(DNTRequest.GetFormString("attachid")))
        //	{
        //		return;
        //	}
        //	string[] array = DNTRequest.GetFormString("attachid").Split(',');
        //	if (String.IsNullOrEmpty(array[0]))
        //	{
        //		array[0] = "0";
        //	}
        //	if (Utils.IsNumericArray(array))
        //	{
        //		string[] descs = DNTRequest.GetFormString("sl_attachdesc").Split(',');
        //		string[] readpeams = DNTRequest.GetFormString("sl_readperm").Split(',');
        //		string[] prices = (DNTRequest.GetString("sl_attachprice") == null) ? null : DNTRequest.GetString("sl_attachprice").Split(',');
        //		int num = 0;
        //		int num2 = 0;
        //		while (num2 < array.Length && num2 <= GeneralConfigInfo.Current.Maxattachments)
        //		{
        //			int aid = array[num2].ToInt(0);
        //			if (aid > 0 && Utils.IsSafeSqlString(descs[num2]))
        //			{
        //				//var att = Attachments.GetAttachmentInfo(aid);
        //				var att = Attachment.FindByID(aid);
        //				att.Description = descs[num2];
        //				att.ReadPerm = ((readpeams.Length == array.Length) ? readpeams[num2].ToInt(0) : 0);
        //				att.Tid = topicid;
        //				att.Pid = postid;
        //				att.AttachPrice = ((prices.Length == array.Length) ? UserGroups.CheckUserGroupMaxPrice(usergroupinfo, prices[num2].ToInt(0)) : 0);
        //				//Attachments.UpdateAttachment(att);
        //				att.Save();
        //				num = (att.FileType.ToLower().StartsWith("image") ? 2 : 1);
        //			}
        //			num2++;
        //		}
        //		if (num > 0)
        //		{
        //			Attachments.UpdateTopicAndPostAttachmentType(topicid, postid, num);
        //		}
        //	}
        //}

        //public static void DeleteNoUsedForumAttachment()
        //{
        //    BBX.Data.Attachments.DeleteNoUsedForumAttachment();
        //}

        public static List <Attachment> GetAttachmentList(PostpramsInfo postpramsInfo, string pidList)
        {
            var list = new List <Attachment>();

            if (!pidList.IsNullOrEmpty())
            {
                //list = BBX.Data.Attachments.GetAttachmentListByPidList(pidList.ToString());
                var atts = Attachment.FindAllByPids(pidList);
                foreach (var item in atts)
                {
                    list.Add(item);
                }
                Attachments.CheckPurchasedAttachments(list, postpramsInfo.CurrentUserid);
            }
            return(list);
        }
Exemple #18
0
 /// <summary>
 /// 获取帖子广告信息
 /// </summary>
 public void GetPostAds(PostpramsInfo postpramsInfo, int count)
 {
     //加载帖内广告
     inpostad = Advertisements.GetInPostAd("", forumid, templatepath, count > postpramsInfo.Pagesize ? postpramsInfo.Pagesize : count);
     //快速发帖广告
     quickeditorad = Advertisements.GetQuickEditorAD("", forumid);
     //快速编辑器背景广告
     quickbgad = Advertisements.GetQuickEditorBgAd("", forumid);
     if (quickbgad.Length <= 1)
     {
         quickbgad = new string[2] {
             "", ""
         }
     }
     ;
 }
Exemple #19
0
        /// <summary>
        /// 更新用户全部信息
        /// </summary>
        /// <param name="__userinfo"></param>
        /// <returns></returns>
        public static bool UpdateUserAllInfo(UserInfo __userinfo)
        {
            DatabaseProvider.GetInstance().UpdateUserAllInfo(__userinfo);

            //当用户不是版主(超级版主)或管理员
            if ((__userinfo.Adminid == 0) || (__userinfo.Adminid > 3))
            {
                //删除用户在版主列表中相关数据
                DatabaseProvider.GetInstance().DeleteModerator(__userinfo.Uid);

                //同时更新版块相关的版主信息
                UpdateForumsFieldModerators(__userinfo.Username);
            }

            #region 以下为更新该用户的扩展信息

            string signature = Utils.HtmlEncode(ForumUtils.BanWordFilter(__userinfo.Signature));

            UserGroupInfo     usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(__userinfo.Groupid);
            GeneralConfigInfo config        = GeneralConfigs.GetConfig();

            PostpramsInfo _postpramsinfo = new PostpramsInfo();
            _postpramsinfo.Usergroupid        = usergroupinfo.Groupid;
            _postpramsinfo.Attachimgpost      = config.Attachimgpost;
            _postpramsinfo.Showattachmentpath = config.Showattachmentpath;
            _postpramsinfo.Hide                   = 0;
            _postpramsinfo.Price                  = 0;
            _postpramsinfo.Sdetail                = __userinfo.Signature;
            _postpramsinfo.Smileyoff              = 1;
            _postpramsinfo.Bbcodeoff              = 1 - usergroupinfo.Allowsigbbcode;
            _postpramsinfo.Parseurloff            = 1;
            _postpramsinfo.Showimages             = usergroupinfo.Allowsigimgcode;
            _postpramsinfo.Allowhtml              = 0;
            _postpramsinfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            _postpramsinfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            _postpramsinfo.Smiliesmax             = config.Smiliesmax;
            _postpramsinfo.Signature              = 1;
            _postpramsinfo.Onlinetimeout          = config.Onlinetimeout;

            DatabaseProvider.GetInstance().UpdateUserField(__userinfo, signature, ForumUtils.CreateAuthStr(20), UBB.UBBToHTML(_postpramsinfo));

            #endregion

            Users.UpdateUserForumSetting(__userinfo);

            return(true);
        }
Exemple #20
0
        /// <summary>
        /// 获取ShowtopicPagePostInfo对象与ShowtopicPageAttachmentInfo对象列表
        /// </summary>
        /// <param name="postPramsInfo">参数对象</param>
        /// <param name="attachmentList">输出附件列表</param>
        /// <returns></returns>
        public static ShowtopicPagePostInfo GetPostInfoWithAttachments(PostpramsInfo postPramsInfo, out List <ShowtopicPageAttachmentInfo> attachmentList)
        {
            attachmentList = new List <ShowtopicPageAttachmentInfo>();
            //得到帖子对应主题的所有附件,因为ACCESS不支持存储过程,故此方法在ACCESS版中做了特殊处理
            IDataReader attachmentReader;
            IDataReader reader = DatabaseProvider.GetInstance().GetSinglePost(out attachmentReader, postPramsInfo, PostTables.GetPostTableId(postPramsInfo.Tid));
            //Access版运行此处逻辑
            bool isAccess = false;

            if (attachmentReader == null)
            {
                attachmentReader = reader;
            }
            else
            {
                isAccess = true;
            }

            while (attachmentReader.Read())
            {
                attachmentList.Add(Attachments.LoadSingleAttachmentInfo(attachmentReader));
            }
            //bool next = false;
            //Access版运行此处逻辑
            if (!isAccess)
            {
                reader.NextResult();
            }
            ShowtopicPagePostInfo postInfo = null;

            if (reader.Read())
            {
                postInfo = LoadSingleShowtopicPagePostInfo(reader);
            }

            reader.Close();

            if (!attachmentReader.IsClosed)
            {
                attachmentReader.Close();
            }

            return(postInfo);
        }
Exemple #21
0
 private static int GetAllowGetAttachValue(PostpramsInfo postpramsInfo)
 {
     if (Forums.AllowGetAttachByUserID(Forums.GetForumInfo(postpramsInfo.Fid).Permuserlist, postpramsInfo.CurrentUserid))
     {
         return 1;
     }
     int result = 0;
     if (postpramsInfo.Getattachperm.IsNullOrWhiteSpace() || postpramsInfo.Getattachperm == null)
     {
         result = postpramsInfo.CurrentUserGroup.AllowGetattach ? 1 : 0;
     }
     else
     {
         if (Forums.AllowGetAttach(postpramsInfo.Getattachperm, postpramsInfo.Usergroupid))
         {
             result = 1;
         }
     }
     return result;
 }
Exemple #22
0
        /// <summary>
        /// 计算是否允许查看附件
        /// </summary>
        /// <param name="postpramsInfo"></param>
        /// <returns></returns>
        private static int GetAllowGetAttachValue(PostpramsInfo postpramsInfo)
        {
            if (Forums.AllowGetAttachByUserID(Forums.GetForumInfo(postpramsInfo.Fid).Permuserlist, postpramsInfo.CurrentUserid))
            {
                return(1);
            }

            int allowGetAttach = 0;

            if (postpramsInfo.Getattachperm.Equals("") || postpramsInfo.Getattachperm == null)
            {
                allowGetAttach = postpramsInfo.CurrentUserGroup.Allowgetattach;
            }
            else if (Forums.AllowGetAttach(postpramsInfo.Getattachperm, postpramsInfo.Usergroupid))
            {
                allowGetAttach = 1;
            }

            return(allowGetAttach);
        }
Exemple #23
0
        private static List <ShowtopicPagePostInfo> GetDebatePostList(PostpramsInfo postpramsInfo, out List <ShowtopicPageAttachmentInfo> attachmentlist, bool ismoder, int debateOpinion, PostOrderType postOrderType)
        {
            List <ShowtopicPagePostInfo> postcoll = new List <ShowtopicPagePostInfo>();

            attachmentlist = new List <ShowtopicPageAttachmentInfo>();
            StringBuilder attachmentpidlist = new StringBuilder();
            StringBuilder pidlist           = new StringBuilder();
            IDataReader   reader            = DatabaseProvider.GetInstance().GetDebatePostList(postpramsInfo.Tid, debateOpinion, postpramsInfo.Pagesize, postpramsInfo.Pageindex, Posts.GetPostTableName(postpramsInfo.Tid), postOrderType);

            postcoll = Posts.ParsePostList(postpramsInfo, attachmentlist, ismoder, postcoll, reader, attachmentpidlist);

            //当因冗余字段不准导致未取得分页信息时,修正冗余字段,并取最后一页
            if (postcoll.Count == 0 && postpramsInfo.Pageindex > 1)
            {
                int postcount = DatabaseProvider.GetInstance().ReviseDebateTopicDiggs(postpramsInfo.Tid, debateOpinion);

                postpramsInfo.Pageindex = postcount % postpramsInfo.Pagesize == 0 ? postcount / postpramsInfo.Pagesize : postcount / postpramsInfo.Pagesize + 1;

                reader = DatabaseProvider.GetInstance().GetDebatePostList(postpramsInfo.Tid, debateOpinion, postpramsInfo.Pagesize, postpramsInfo.Pageindex, Posts.GetPostTableName(postpramsInfo.Tid), postOrderType);

                postcoll = Posts.ParsePostList(postpramsInfo, attachmentlist, ismoder, postcoll, reader, attachmentpidlist);
            }



            foreach (ShowtopicPagePostInfo post in postcoll)
            {
                pidlist.AppendFormat("{0},", post.Pid);
            }

            Dictionary <int, int> postdiggs = GetPostDiggs(pidlist.ToString().Trim(','));

            foreach (ShowtopicPagePostInfo post in postcoll)
            {
                if (postdiggs.ContainsKey(post.Pid))
                {
                    post.Diggs = postdiggs[post.Pid];
                }
            }
            return(postcoll);
        }
Exemple #24
0
        /// <summary>
        /// 获取帖子参数信息(PostPramsInfo)
        /// </summary>
        /// <param name="price"></param>
        /// <returns></returns>
        public PostpramsInfo GetPostPramsInfo(int price)
        {
            //获取当前页主题列表
            PostpramsInfo postpramsInfo = new PostpramsInfo();

            postpramsInfo.Fid                    = forum.Fid;
            postpramsInfo.Tid                    = topicid;
            postpramsInfo.Jammer                 = forum.Jammer;
            postpramsInfo.Pagesize               = pagesize; // 得到Ppp设置
            postpramsInfo.Pageindex              = pageid;
            postpramsInfo.Getattachperm          = forum.Getattachperm;
            postpramsInfo.Usergroupid            = usergroupid;
            postpramsInfo.Attachimgpost          = config.Attachimgpost;
            postpramsInfo.Showattachmentpath     = config.Showattachmentpath;
            postpramsInfo.Price                  = price;
            postpramsInfo.Usergroupreadaccess    = (ismoder == 1) ? int.MaxValue : usergroupinfo.Readaccess;
            postpramsInfo.CurrentUserid          = userid;
            postpramsInfo.Showimages             = forum.Allowimgcode;
            postpramsInfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            postpramsInfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            postpramsInfo.Smiliesmax             = config.Smiliesmax;
            postpramsInfo.Bbcodemode             = config.Bbcodemode;
            postpramsInfo.CurrentUserGroup       = usergroupinfo;
            postpramsInfo.Topicinfo              = topic;
            postpramsInfo.Condition              = Posts.GetPostPramsInfoCondition(onlyauthor, topicid, topic.Posterid);

            //判断是否为回复可见帖, hide=0为不解析[hide]标签, hide>0解析为回复可见字样, hide=-1解析为以下内容回复可见字样显示真实内容
            //将逻辑判断放入取列表的循环中处理,此处只做是否为回复人的判断,主题作者也该可见
            postpramsInfo.Hide = (topic.Hide == 1 && (Posts.IsReplier(topicid, userid) || ismoder == 1)) ? -1 : 1;
            postpramsInfo.Pid  = Posts.GetFirstPostId(topic.Tid);
            UserInfo userInfo = Users.GetUserInfo(userid);

            postpramsInfo.Usercredits = userInfo == null ? 0 : userInfo.Credits;
            debatepost        = Posts.GetSinglePost(postpramsInfo, out attachmentlist, ismoder == 1);
            postpramsInfo.Pid = 0;

            return(postpramsInfo);
        }
Exemple #25
0
        public static EntityList<Post> GetPagedLastPost(PostpramsInfo ppi)
        {
            var list = Post.GetPagedLastPost(ppi);
            var random = new Random((int)DateTime.Now.Ticks);
            int inPostAdCount = Advertisement.GetInPostAdCount("", ppi.Fid);
            foreach (var pi in list)
            {
                ppi.Smileyoff = pi.SmileyOff;
                ppi.BBCode = pi.BBCodeOff < 1;
                ppi.Parseurloff = pi.ParseUrlOff;
                ppi.Allowhtml = pi.HtmlOn;
                ppi.Pid = pi.ID;

                var msg = pi.Message;
                ppi.Sdetail = msg;
                if (ppi.Price > 0 && pi.Layer == 0)
                {
                    var ue = Scoresets.GetScoreSet(Scoresets.GetTopicAttachCreditsTrans());
                    msg = string.Format("<div class=\"paystyle\">此帖为交易帖,要付 {0} <span class=\"bold\">{1}</span>{2} 才可查看</div>", ue.Name, ppi.Price, ue.Unit);
                }
                else
                {
                    if (!ppi.Ubbmode)
                        msg = UBB.UBBToHTML(ppi);
                    else
                        msg = Utils.HtmlEncode(msg);
                }
                pi.Adindex = random.Next(0, inPostAdCount);
                if (ppi.Jammer == 1) msg = ForumUtils.AddJammer(msg);
                pi.Html = msg;

                if (!pi["showemail"].ToBoolean())
                {
                    pi["email"] = "";
                }
            }
            return list;
        }
        /// <summary>
        /// 获取帖子参数信息(PostPramsInfo)
        /// </summary>
        /// <param name="price"></param>
        /// <returns></returns>
        public PostpramsInfo GetPostPramsInfo()
        {
            //获取当前页主题列表
            PostpramsInfo postpramsInfo = new PostpramsInfo();

            postpramsInfo.Fid    = forum.Fid;
            postpramsInfo.Tid    = topicid;
            postpramsInfo.Jammer = forum.Jammer;
            //postpramsInfo.Pagesize = int.MaxValue;
            postpramsInfo.Pagesize           = (ppp <= 0 ? config.Ppp : ppp);
            postpramsInfo.Pageindex          = 1;
            postpramsInfo.Getattachperm      = forum.Getattachperm;
            postpramsInfo.Usergroupid        = usergroupid;
            postpramsInfo.Attachimgpost      = config.Attachimgpost;
            postpramsInfo.Showattachmentpath = config.Showattachmentpath;
            postpramsInfo.Price = 0;
            postpramsInfo.Usergroupreadaccess    = usergroupinfo.Readaccess;
            postpramsInfo.Usergroupreadaccess    = (ismoder == 1) ? int.MaxValue : usergroupinfo.Readaccess;
            postpramsInfo.CurrentUserid          = userid;
            postpramsInfo.Showimages             = forum.Allowimgcode;
            postpramsInfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            postpramsInfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            postpramsInfo.Smiliesmax             = config.Smiliesmax;
            postpramsInfo.Bbcodemode             = config.Bbcodemode;
            postpramsInfo.CurrentUserGroup       = usergroupinfo;
            //判断是否为回复可见帖, hide=0为不解析[hide]标签, hide>0解析为回复可见字样, hide=-1解析为以下内容回复可见字样显示真实内容
            //将逻辑判断放入取列表的循环中处理,此处只做是否为回复人的判断,主题作者也该可见
            postpramsInfo.Hide      = (topic.Hide == 1 && (Posts.IsReplier(topicid, userid) || ismoder == 1)) ? -1 : 1;
            postpramsInfo.Condition = Posts.GetPostPramsInfoCondition(onlyauthor, topicid, topic.Posterid);
            //if (!(Utils.StrIsNullOrEmpty(onlyauthor) || onlyauthor.Equals("0")))
            //    postpramsInfo.Condition = string.Format(" {0}.posterid={1}", Posts.GetPostTableName(topicid), topic.Posterid);

            postlist = Posts.GetPostListWithBonus(postpramsInfo, out attachmentlist, ismoder == 1);

            return(postpramsInfo);
        }
Exemple #27
0
        protected override void ShowPage()
        {
            //获取主题信息
            topic = GetTopicInfo();
            if (topic == null || IsErr())
            {
                return;
            }

            topicid = topic.Tid;
            forumid = topic.Fid;
            forum   = Forums.GetForumInfo(forumid);
            if (forum == null)
            {
                AddErrLine("不存在的版块ID"); return;
            }

            pagetitle = string.Format("{0} - {1}", topic.Title, Utils.RemoveHtml(forum.Name));
            ///得到广告列表
            GetForumAds(forum.Fid);

            // 检查是否具有版主的身份
            if (useradminid != 0)
            {
                ismoder   = Moderators.IsModer(useradminid, userid, forum.Fid) ? 1 : 0;
                admininfo = AdminGroups.GetAdminGroupInfo(usergroupid); //得到管理组信息
                if (admininfo != null)
                {
                    disablepostctrl = admininfo.Disablepostctrl;
                }
            }

            //验证不通过则返回
            if (!ValidateInfo())
            {
                return;
            }

            Caches.GetTopicTypeArray().TryGetValue(topic.Typeid, out topictypes);
            topictypes = topictypes != "" ? "[" + topictypes + "]" : "";

            showratelog = GeneralConfigs.GetConfig().DisplayRateCount > 0 ? 1 : 0;
            score       = Scoresets.GetValidScoreName();
            scoreunit   = Scoresets.GetValidScoreUnit();

            //编辑器状态
            EditorState();
            navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname);
            usesig      = ForumUtils.GetCookie("sigstatus") == "0" ? 0 : 1;

            int price = 0;

            if (topic.Special != 4)//不是辩论帖,就跳转到showtopic页面显示
            {
                HttpContext.Current.Response.Redirect(forumpath + this.ShowTopicAspxRewrite(topic.Tid, 1)); return;
            }

            if (topic.Moderated > 0)
            {
                moderactions = TopicAdmins.GetTopicListModeratorLog(topicid);
            }

            // 获取帖子总数
            onlyauthor = Utils.StrIsNullOrEmpty(onlyauthor) ? "0" : onlyauthor;

            // 获取分页相关信息
            BindPageCountAndId();

            PostpramsInfo postpramsInfo = GetPostPramsInfo(price);

            //获取当前正反方列表
            positivepostlist = Debates.GetPositivePostList(postpramsInfo, out attachmentlist, ismoder == 1);
            negativepostlist = Debates.GetNegativePostList(postpramsInfo, out attachmentlist, ismoder == 1);

            GetPostAds(postpramsInfo, positivepostlist.Count);

            //辩论帖
            if (topic.Special == 4)
            {
                GetDebateInfo(postpramsInfo);
            }

            enabletag = (config.Enabletag & forum.Allowtag) == 1;
            if (enabletag)
            {
                relatedtopics = Topics.GetRelatedTopicList(topicid, 5);
            }

            //更新页面Meta信息
            UpdateMetaInfo(Utils.RemoveHtml(debatepost.Message));

            ///更新主题查看次数和在线用户信息
            TopicStats.Track(topicid, 1);
            Topics.MarkOldTopic(topic);
            topicviews = topic.Views + 1 + (config.TopicQueueStats == 1 ? TopicStats.GetStoredTopicViewCount(topic.Tid) : 0);
            OnlineUsers.UpdateAction(olid, UserAction.ShowTopic.ActionID, forumid, forum.Name, topicid, topic.Title);
            BindDownloadAttachmentTip();
        }
Exemple #28
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            int topicid = DNTRequest.GetInt("topicid", -1);

            if (topicid == -1)
            {
                base.ShowMsg("无效的主题ID");
                return;
            }
            var topic = Topic.FindByID(topicid);

            if (topic == null || topic.Closed > 1)
            {
                base.ShowMsg("不存在的主题ID");
                return;
            }
            if (topic.DisplayOrder == -1)
            {
                base.ShowMsg("此主题已被删除!");
                return;
            }
            if (topic.ReadPerm > this.usergroupinfo.Readaccess && topic.PosterID != this.userid)
            {
                base.ShowMsg(string.Format("本主题阅读权限为: {0}, 您当前的身份 \"{1}\" 阅读权限不够", topic.ReadPerm, this.usergroupinfo.GroupTitle));
                return;
            }
            var forum = Forums.GetForumInfo(topic.Fid);

            if (forum.ViewPerm.IsNullOrEmpty())
            {
                if (!this.usergroupinfo.AllowVisit)
                {
                    base.ShowMsg("您当前的身份 \"" + this.usergroupinfo.GroupTitle + "\" 没有浏览该版块的权限");
                    return;
                }
            }
            else
            {
                if (!forum.AllowView(this.usergroupinfo.ID))
                {
                    base.ShowMsg("您没有浏览该版块的权限");
                    return;
                }
            }
            if (!String.IsNullOrEmpty(forum.Password))
            {
                base.ShowMsg("简洁版本无法浏览设置了密码的版块");
                return;
            }
            int num  = Moderators.IsModer(this.useradminid, this.userid, forum.ID) ? 1 : 0;
            int num2 = 0;

            if (topic.Price > 0 && this.userid != topic.PosterID && num != 1)
            {
                num2 = topic.Price;
                var charge = Scoresets.GetMaxChargeSpan();
                if (PaymentLog.IsBuyer(topicid, this.userid) || charge != 0 && topic.PostDateTime.AddHours(charge) < DateTime.Now)
                {
                    num2 = -1;
                }
            }
            if (num2 > 0)
            {
                base.ShowMsg(string.Format("此帖需转到完整版处购买后才可查看.<a href=\"{0}buytopic.aspx?topicid={1}\">点击购买</a>", BaseConfigs.GetForumPath, topic.ID));
                return;
            }
            int num3 = topic.Replies + 1;
            int num4 = 1;
            int num5 = 30;
            int num6 = (num3 % num5 == 0) ? (num3 / num5) : (num3 / num5 + 1);

            if (num6 == 0)
            {
                num6 = 1;
            }
            if (DNTRequest.GetString("page").ToLower().Equals("end"))
            {
                num4 = num6;
            }
            else
            {
                num4 = DNTRequest.GetInt("page", 1);
            }
            if (num4 < 1)
            {
                num4 = 1;
            }
            if (num4 > num6)
            {
                num4 = num6;
            }
            int hide = 1;

            if (topic.Hide == 1 && (Post.IsReplier(topicid, this.userid) || num == 1))
            {
                hide = -1;
            }
            var pi = new PostpramsInfo();

            pi.Fid                    = forum.ID;
            pi.Tid                    = topicid;
            pi.Jammer                 = forum.Jammer;
            pi.Pagesize               = num5;
            pi.Pageindex              = num4;
            pi.Getattachperm          = forum.GetattachPerm;
            pi.Usergroupid            = this.usergroupinfo.ID;
            pi.Attachimgpost          = this.config.Attachimgpost;
            pi.Showattachmentpath     = this.config.Showattachmentpath;
            pi.Hide                   = hide;
            pi.Price                  = topic.Price;
            pi.Usergroupreadaccess    = this.usergroupinfo.Readaccess;
            pi.CurrentUserid          = this.userid;
            pi.Showimages             = forum.AllowImgCode ? 1 : 0;
            pi.Smileyoff              = 1;
            pi.Smiliesmax             = 0;
            pi.Smiliesinfo            = null;
            pi.Customeditorbuttoninfo = null;
            pi.Bbcodemode             = 0;
            pi.BBCode                 = false;
            pi.CurrentUserGroup       = this.usergroupinfo;
            pi.Onlinetimeout          = this.config.Onlinetimeout;
            User userInfo = Users.GetUserInfo(this.userid);

            pi.Usercredits = ((userInfo == null) ? 0 : userInfo.Credits);
            this.postlist  = Posts.GetPostList(pi, out this.attachmentlist, num == 1);
            if (this.postlist.Count <= 0)
            {
                base.ShowMsg("读取信息失败");
                return;
            }
            base.ShowTitle(topic.Title + " - ");
            base.ShowBody();
            Response.Write("<h1>" + this.config.Forumtitle + "</h1>");
            Response.Write("<div class=\"forumnav\">");
            Response.Write("<a href=\"index.aspx\">首页</a> &raquo; ");
            if (this.config.Aspxrewrite == 1)
            {
                Response.Write(string.Format("{0} &raquo; <a href=\"showtopic-{1}{2}\">{3}</a>", new object[]
                {
                    ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), this.config.Extname).Replace("</a><", "</a> &raquo; <"),
                    topicid.ToString(),
                    this.config.Extname,
                    topic.Title
                }));
            }
            else
            {
                Response.Write(string.Format("{0} &raquo; <a href=\"showtopic.aspx?topicid={1}\">{2}</a>", ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), "aspx").Replace("</a><", "</a> &raquo; <"), topicid.ToString(), topic.Title));
            }
            Response.Write("</div>\r\n");
            Regex regex  = new Regex("<img alt=.*? imageid=\"(.*?)\".*?newsrc=\"(.*?)\".*?/>", RegexOptions.IgnoreCase);
            Regex regex2 = new Regex("<img imageid=\"(.*?)\" src=\"(.*?)\".*?/>", RegexOptions.IgnoreCase);

            foreach (var item in this.postlist)
            {
                Response.Write("<div class=\"postitem\">\r\n");
                Response.Write("\t<div class=\"postitemtitle\">\r\n");
                Response.Write(Utils.HtmlEncode(item.Poster) + " - " + item.PostDateTime.ToFullString());
                Response.Write("</div><div class=\"postitemcontent\">");
                var msg = item.Message;
                if (this.config.Showimgattachmode == 1)
                {
                    Match match = regex.Match(msg);
                    while (match.Success)
                    {
                        msg   = msg.Replace(match.Value, string.Format("<a href=\"{0}\" target=\"_blank\">点击显示图片:{1}</a>", match.Groups[2].Value, match.Groups[1].Value));
                        match = match.NextMatch();
                    }
                }
                else
                {
                    Match match = regex2.Match(msg);
                    while (match.Success)
                    {
                        msg   = msg.Replace(match.Value, string.Format("<img alt=\"{0}\" src=\"{1}\" />", match.Groups[1].Value, match.Groups[2].Value));
                        match = match.NextMatch();
                    }
                }
                Response.Write(msg);
                foreach (var att in this.attachmentlist)
                {
                    if (att.Pid == item.ID)
                    {
                        Response.Write(string.Format("<br /><br />附件: <a href=\"../attachment.aspx?attachmentid={0}\">{1}</a>", att.ID, Utils.HtmlEncode(att.Name)));
                    }
                }
                Response.Write("\t</div>\r\n</div>\r\n");
            }
            Response.Write("<div class=\"pagenumbers\">");
            if (this.config.Aspxrewrite == 1)
            {
                Response.Write(Utils.GetStaticPageNumbers(num4, num6, "showtopic-" + topicid, this.config.Extname, 8));
            }
            else
            {
                Response.Write(Utils.GetPageNumbers(num4, num6, "showtopic.aspx?topicid=" + topicid, 8, "page"));
            }
            Response.Write("</div>\r\n");
            //Topic.UpdateViewCount(topicid, 1);
            topic.Views++;
            topic.SaveAsync(10000);
            if (this.config.Aspxrewrite == 1)
            {
                Response.Write(string.Format("<div class=\"fullversion\">查看完整版本: <a href=\"../showtopic-{0}{1}\">{2}</a></div>\r\n", topicid, this.config.Extname, topic.Title));
            }
            else
            {
                Response.Write(string.Format("<div class=\"fullversion\">查看完整版本: <a href=\"../showtopic.aspx?topicid={0}\">{1}</a></div>\r\n", topicid, topic.Title));
            }
            base.ShowFooter();
            HttpContext.Current.ApplicationInstance.CompleteRequest();
        }
Exemple #29
0
        public showtopic()
        {
            // 获取主题ID
            int topicid = DNTRequest.GetInt("topicid", -1);

            // 如果主题ID非数字
            if (topicid == -1)
            {
                ShowMsg("无效的主题ID");
                return;
            }

            // 获取该主题的信息
            TopicInfo topic = Topics.GetTopicInfo(topicid);

            // 如果该主题不存在
            if (topic == null)
            {
                ShowMsg("不存在的主题ID");
                return;
            }

            if (topic.Readperm > usergroupinfo.Readaccess && topic.Posterid != userid)
            {
                ShowMsg(string.Format("本主题阅读权限为: {0}, 您当前的身份 \"{1}\" 阅读权限不够", topic.Readperm.ToString(), usergroupinfo.Grouptitle));
                return;
            }

            ForumInfo forum = Forums.GetForumInfo(topic.Fid);

            if (forum.Viewperm == null || forum.Viewperm == string.Empty)            //当板块权限为空时,按照用户组权限
            {
                if (usergroupinfo.Allowvisit != 1)
                {
                    ShowMsg("您当前的身份 \"" + usergroupinfo.Grouptitle + "\" 没有浏览该版块的权限");
                    return;
                }
            }
            else            //当板块权限不为空,按照板块权限
            {
                if (!Forums.AllowView(forum.Viewperm, usergroupinfo.Groupid))
                {
                    ShowMsg("您没有浏览该版块的权限");
                    return;
                }
            }

            if (forum.Password != "")
            {
                ShowMsg("简洁版本无法浏览设置了密码的版块");
                return;
            }

            //验证用户是否为本版版主
            int ismoder = Moderators.IsModer(useradminid, userid, forum.Fid) ? 1 : 0;

            //购买帖子操作
            //判断是否为回复可见帖, price=0为非购买可见(正常), price>0 为购买可见, price=-1为购买可见但当前用户已购买
            int price = 0;

            if (topic.Price > 0 && userid != topic.Posterid && ismoder != 1)
            {
                price = topic.Price;
                //时间乘以-1是因为当Configs.GetMaxChargeSpan()==0时,帖子始终为购买帖
                if (PaymentLogs.IsBuyer(topicid, userid) || (Utils.StrDateDiffHours(topic.Postdatetime, Scoresets.GetMaxChargeSpan()) > 0 && Scoresets.GetMaxChargeSpan() != 0))//判断当前用户是否已经购买
                {
                    price = -1;
                }
            }
            if (price > 0)
            {
                ShowMsg(string.Format("此帖需转到完整版处购买后才可查看.<a href=\"{0}buytopic.aspx?topicid={1}\">点击购买</a>", "/Forum/", topic.Tid));
                return;
            }


            // 获取帖子总数
            //postcount = Posts.GetPostCount(topicid);
            int postcount = topic.Replies + 1;
            int pageid    = 1;

            // 得到Tpp设置
            int ppp = 30;

            //获取总页数
            int pagecount = postcount % ppp == 0 ? postcount / ppp : postcount / ppp + 1;

            if (pagecount == 0)
            {
                pagecount = 1;
            }
            // 得到当前用户请求的页数
            if (DNTRequest.GetString("page").ToLower().Equals("end"))
            {
                pageid = pagecount;
            }
            else
            {
                pageid = DNTRequest.GetInt("page", 1);
            }
            //修正请求页数中可能的错误
            if (pageid < 1)
            {
                pageid = 1;
            }
            if (pageid > pagecount)
            {
                pageid = pagecount;
            }

            int hide = 1;

            if (topic.Hide == 1 && (Posts.IsReplier(topicid, userid) || ismoder == 1))
            {
                hide = -1;
            }


            //获取当前页主题列表


            PostpramsInfo postpramsInfo = new PostpramsInfo();

            postpramsInfo.Fid                 = forum.Fid;
            postpramsInfo.Tid                 = topicid;
            postpramsInfo.Jammer              = forum.Jammer;
            postpramsInfo.Pagesize            = ppp;
            postpramsInfo.Pageindex           = pageid;
            postpramsInfo.Getattachperm       = forum.Getattachperm;
            postpramsInfo.Usergroupid         = usergroupinfo.Groupid;
            postpramsInfo.Attachimgpost       = config.Attachimgpost;
            postpramsInfo.Showattachmentpath  = config.Showattachmentpath;
            postpramsInfo.Hide                = hide;
            postpramsInfo.Price               = topic.Price;
            postpramsInfo.Usergroupreadaccess = usergroupinfo.Readaccess;


            postpramsInfo.CurrentUserid = userid;

            postpramsInfo.Showimages = forum.Allowimgcode;
            // 简洁版本中关闭表情符的解析
            postpramsInfo.Smileyoff              = 1;
            postpramsInfo.Smiliesmax             = 0;
            postpramsInfo.Smiliesinfo            = null;
            postpramsInfo.Customeditorbuttoninfo = null;
            postpramsInfo.Bbcodemode             = 0;
            // 简洁版本中关闭ubb转换
            postpramsInfo.Bbcodeoff        = 1;
            postpramsInfo.CurrentUserGroup = usergroupinfo;

            postpramsInfo.Onlinetimeout = config.Onlinetimeout;

            postlist = Posts.GetPostList(postpramsInfo, out attachmentlist, ismoder == 1);
            if (postlist.Count <= 0)
            {
                ShowMsg("读取信息失败");
                return;
            }

            ShowTitle(topic.Title);
            ShowBody();
            HttpContext.Current.Response.Write("<h1>" + config.Forumtitle + "</h1>");

            HttpContext.Current.Response.Write("<div class=\"forumnav\">");
            HttpContext.Current.Response.Write("<a href=\"index.aspx\">首页</a> &raquo; ");

            if (config.Aspxrewrite == 1)
            {
                HttpContext.Current.Response.Write(string.Format("{0} &raquo; <a href=\"showtopic-{1}{2}\">{3}</a>", ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname).Replace("</a><", "</a> &raquo; <"), topicid.ToString(), config.Extname, topic.Title));
            }
            else
            {
                HttpContext.Current.Response.Write(string.Format("{0} &raquo; <a href=\"showtopic.aspx?topicid={1}\">{2}</a>", ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), "aspx").Replace("</a><", "</a> &raquo; <"), topicid.ToString(), topic.Title));
            }
            HttpContext.Current.Response.Write("</div>\r\n");

            foreach (ShowtopicPagePostInfo postinfo in postlist)
            {
                HttpContext.Current.Response.Write("<div class=\"postitem\">\r\n");
                HttpContext.Current.Response.Write("\t<div class=\"postitemtitle\">\r\n");
                HttpContext.Current.Response.Write(Utils.HtmlEncode(postinfo.Poster) + " - " + postinfo.Postdatetime);
                HttpContext.Current.Response.Write("</div><div class=\"postitemcontent\">");
                HttpContext.Current.Response.Write(postinfo.Message);
                foreach (ShowtopicPageAttachmentInfo attinfo in attachmentlist)
                {
                    if (attinfo.Pid == postinfo.Pid)
                    {
                        HttpContext.Current.Response.Write(string.Format("<br /><br />附件: <a href=\"../attachment.aspx?attachmentid={0}\">{1}</a>", attinfo.Aid.ToString(), Utils.HtmlEncode(attinfo.Attachment)));
                    }
                }
                HttpContext.Current.Response.Write("\t</div>\r\n</div>\r\n");
            }
            //得到页码链接
            HttpContext.Current.Response.Write("<div class=\"pagenumbers\">");

            if (config.Aspxrewrite == 1)
            {
                HttpContext.Current.Response.Write(Utils.GetStaticPageNumbers(pageid, pagecount, "showtopic-" + topicid.ToString(), config.Extname, 8));
            }
            else
            {
                HttpContext.Current.Response.Write(Utils.GetPageNumbers(pageid, pagecount, "showtopic.aspx?topicid=" + topicid.ToString(), 8, "page"));
            }
            HttpContext.Current.Response.Write("</div>\r\n");
            //更新查看次数
            //Topics.UpdateTopicViews(topicid);
            TopicStats.Track(topicid, 1);

            if (config.Aspxrewrite == 1)
            {
                HttpContext.Current.Response.Write(string.Format("<div class=\"fullversion\">查看完整版本: <a href=\"../showtopic-{0}{1}\">{2}</a></div>\r\n", topicid.ToString(), config.Extname, topic.Title));
            }
            else
            {
                HttpContext.Current.Response.Write(string.Format("<div class=\"fullversion\">查看完整版本: <a href=\"../showtopic.aspx?topicid={0}\">{1}</a></div>\r\n", topicid.ToString(), topic.Title));
            }
            ShowFooter();
            HttpContext.Current.Response.End();
        }
        private void SaveUserInfo_Click(object sender, EventArgs e)
        {
            #region 保存用户信息

            if (this.CheckCookie())
            {
                int    uid       = DNTRequest.GetInt("uid", -1);
                string errorInfo = "";

                if (!AllowEditUserInfo(uid, true))
                {
                    return;
                }

                if (userName.Text != ViewState["username"].ToString())
                {
                    if (AdminUsers.GetUserId(userName.Text) > 0)
                    {
                        base.RegisterStartupScript("", "<script>alert('您所输入的用户名已被使用过, 请输入其他的用户名!');</script>");
                        return;
                    }
                }

                if (userName.Text == "")
                {
                    base.RegisterStartupScript("", "<script>alert('用户名不能为空!');</script>");
                    return;
                }

                if (groupid.SelectedValue == "0")
                {
                    base.RegisterStartupScript("", "<script>alert('您未选中任何用户组!');</script>");
                    return;
                }

                userInfo             = AdminUsers.GetUserInfo(uid);
                userInfo.Username    = userName.Text;
                userInfo.Nickname    = nickname.Text;
                userInfo.Accessmasks = Convert.ToInt32(accessmasks.SelectedValue);

                //当用户组发生变化时则相应更新用户的管理组字段
                if (userInfo.Groupid.ToString() != groupid.SelectedValue)
                {
                    userInfo.Adminid = UserGroups.GetUserGroupInfo(int.Parse(groupid.SelectedValue)).Radminid;
                }

                //userInfo.Avatarshowid = 0;

                if ((bday.Text == "0000-00-00") || (bday.Text == "0000-0-0") | (bday.Text.Trim() == ""))
                {
                    userInfo.Bday = "";
                }
                else
                {
                    if (!Utils.IsDateString(bday.Text.Trim()))
                    {
                        base.RegisterStartupScript("", "<script>alert('用户生日不是有效的日期型数据!');</script>");
                        return;
                    }
                    else
                    {
                        userInfo.Bday = bday.Text;
                    }
                }


                if (!Users.ValidateEmail(email.Text, uid))
                {
                    base.RegisterStartupScript("", "<script>alert('当前用户的邮箱地址已被使用过, 请输入其他的邮箱!');</script>");
                    return;
                }

                userInfo.Email  = email.Text;
                userInfo.Gender = Convert.ToInt32(gender.SelectedValue);
                //userInfo.Groupexpiry = Convert.ToInt32(groupexpiry.Text);后台操作为永久禁言和永久禁访

                userInfo.Groupexpiry = 0;
                userInfo.Extgroupids = extgroupids.GetSelectString(",");

                if ((groupid.SelectedValue != "1") && (userInfo.Uid == BaseConfigs.GetFounderUid))
                {
                    base.RegisterStartupScript("", "<script>alert('创始人的所属用户组不能被修改为其它组!');window.location.href='global_edituser.aspx?uid=" + DNTRequest.GetString("uid") + "';</script>");
                    return;
                }

                userInfo.Groupid      = Convert.ToInt32(groupid.SelectedValue);
                userInfo.Invisible    = Convert.ToInt32(invisible.SelectedValue);
                userInfo.Joindate     = joindate.Text;
                userInfo.Lastactivity = lastactivity.Text;
                userInfo.Lastip       = lastip.Text;
                userInfo.Lastpost     = lastpost.Text;
                userInfo.Lastvisit    = lastvisit.Text;
                userInfo.Newpm        = Convert.ToInt32(newpm.SelectedValue);
                userInfo.Newsletter   = (ReceivePMSettingType)GetNewsLetter();
                userInfo.Oltime       = Convert.ToInt32(oltime.Text);
                userInfo.Pageviews    = Convert.ToInt32(pageviews.Text);
                userInfo.Pmsound      = Convert.ToInt32(pmsound.Text);
                userInfo.Posts        = Convert.ToInt32(posts.Text);
                userInfo.Ppp          = Convert.ToInt32(ppp.Text);
                userInfo.Regip        = regip.Text;
                userInfo.Digestposts  = Convert.ToInt32(digestposts.Text);

                if (secques.SelectedValue == "1")
                {
                    userInfo.Secques = "";                               //清空安全码
                }
                userInfo.Showemail  = Convert.ToInt32(showemail.SelectedValue);
                userInfo.Sigstatus  = Convert.ToInt32(sigstatus.SelectedValue);
                userInfo.Templateid = Convert.ToInt32(templateid.SelectedValue);
                userInfo.Tpp        = Convert.ToInt32(tpp.Text);


                if (Utils.IsNumeric(extcredits1.Text.Replace("-", "")))
                {
                    userInfo.Extcredits1 = float.Parse(extcredits1.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits2.Text.Replace("-", "")))
                {
                    userInfo.Extcredits2 = float.Parse(extcredits2.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits3.Text.Replace("-", "")))
                {
                    userInfo.Extcredits3 = float.Parse(extcredits3.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits4.Text.Replace("-", "")))
                {
                    userInfo.Extcredits4 = float.Parse(extcredits4.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits5.Text.Replace("-", "")))
                {
                    userInfo.Extcredits5 = float.Parse(extcredits5.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits6.Text.Replace("-", "")))
                {
                    userInfo.Extcredits6 = float.Parse(extcredits6.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits7.Text.Replace("-", "")))
                {
                    userInfo.Extcredits7 = float.Parse(extcredits7.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits8.Text.Replace("-", "")))
                {
                    userInfo.Extcredits8 = float.Parse(extcredits8.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }


                //根据公式计算用户的总积分,并更新
                userInfo.Credits = CreditsFacade.GetUserCreditsByUserInfo(userInfo);
                //判断用户组是否为积分用户组。如果是的话,就用当前积分更新。
                if (UserGroups.IsCreditUserGroup(userInfo.Groupid))
                {
                    userInfo.Groupid = CreditsFacade.GetCreditsUserGroupId(userInfo.Credits).Groupid;
                }
                //用户扩展信息
                userInfo.Website      = website.Text;
                userInfo.Icq          = icq.Text;
                userInfo.Qq           = qq.Text;
                userInfo.Yahoo        = yahoo.Text;
                userInfo.Msn          = msn.Text;
                userInfo.Skype        = skype.Text;
                userInfo.Location     = location.Text;
                userInfo.Customstatus = customstatus.Text;
                //userInfo.Avatar = avatar.Text;
                //userInfo.Avatarheight = Convert.ToInt32(avatarheight.Text);
                //userInfo.Avatarwidth = Convert.ToInt32(avatarwidth.Text);
                userInfo.Bio = bio.Text;
                if (signature.Text.Length > UserGroups.GetUserGroupInfo(userInfo.Groupid).Maxsigsize)
                {
                    errorInfo = "更新的签名长度超过 " + UserGroups.GetUserGroupInfo(userInfo.Groupid).Maxsigsize + " 字符的限制,未能更新。";
                }
                else
                {
                    userInfo.Signature = signature.Text;
                    //签名UBB转换HTML
                    PostpramsInfo _postpramsinfo = new PostpramsInfo();
                    _postpramsinfo.Showimages = UserGroups.GetUserGroupInfo(userInfo.Groupid).Allowsigimgcode;
                    _postpramsinfo.Sdetail    = signature.Text;
                    userInfo.Sightml          = UBB.UBBToHTML(_postpramsinfo);
                }

                userInfo.Realname = realname.Text;
                userInfo.Idcard   = idcard.Text;
                userInfo.Mobile   = mobile.Text;
                userInfo.Phone    = phone.Text;
                userInfo.Medals   = DNTRequest.GetString("medalid");

                if (IsEditUserName.Checked && userName.Text != ViewState["username"].ToString())
                {
                    AdminUsers.UserNameChange(userInfo, ViewState["username"].ToString());
                    //用户重命名同步
                    Discuz.Forum.Sync.RenameUser(userInfo.Uid, ViewState["username"].ToString(), userInfo.Username, "");
                }

                if (AdminUsers.UpdateUserAllInfo(userInfo))
                {
                    OnlineUsers.DeleteUserByUid(userInfo.Uid);    //移除该用户的在线信息,使之重建在线表信息
                    if (ViewState["Groupid"].ToString() != userInfo.Groupid.ToString())
                    {
                        if (userInfo.Groupid == 4)
                        {
                            if (AlbumPluginProvider.GetInstance() != null)
                            {
                                AlbumPluginProvider.GetInstance().Ban(userInfo.Uid);
                            }
                            if (SpacePluginProvider.GetInstance() != null)
                            {
                                SpacePluginProvider.GetInstance().Ban(userInfo.Uid);
                            }
                        }
                        else
                        {
                            if (AlbumPluginProvider.GetInstance() != null)
                            {
                                AlbumPluginProvider.GetInstance().UnBan(userInfo.Uid);
                            }
                            if (SpacePluginProvider.GetInstance() != null)
                            {
                                SpacePluginProvider.GetInstance().UnBan(userInfo.Uid);
                            }
                        }
                    }
                    //if (userName.Text != ViewState["username"].ToString())
                    //{
                    //    AdminUsers.UserNameChange(userInfo, ViewState["username"].ToString());
                    //}
                    //删除头像
                    if (delavart.Checked)
                    {
                        Avatars.DeleteAvatar(userInfo.Uid.ToString());
                    }
                    AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台编辑用户", "用户名:" + userName.Text);
                    if (errorInfo == "")
                    {
                        base.RegisterStartupScript("PAGE", "window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';");
                    }
                    else
                    {
                        base.RegisterStartupScript("PAGE", "alert('" + errorInfo + "');window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';");
                    }
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';</script>");
                }
            }

            #endregion
        }