Esempio n. 1
0
        /// <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;
        }
Esempio n. 2
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);




            }
        }
    }
Esempio n. 3
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|帖子不存在");
        }
    }
Esempio n. 4
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);
			}

			#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;
		}
Esempio n. 5
0
        /// <summary>
        /// 获得单个帖子的信息, 包括发帖人的一般资料
        /// </summary>
        /// <param name="_postpramsinfo">参数列表</param>
        /// <returns>帖子的信息</returns>
        public static ShowtopicPagePostInfo GetSinglePost(PostpramsInfo postPramsInfo, out Discuz.Common.Generic.List<ShowtopicPageAttachmentInfo> attachmentList, bool ismoder)
        {
            //此代码已被移至showdebate.aspx.cs页面
            //UserInfo userInfo = Users.GetUserInfo(postPramsInfo.CurrentUserid);
            //postPramsInfo.Usercredits = userInfo == null ? 0 : userInfo.Credits;

            ShowtopicPagePostInfo postInfo = Discuz.Data.Posts.GetPostInfoWithAttachments(postPramsInfo, out attachmentList);
            if (postInfo != null)
            {
                int allowGetAttach = GetAllowGetAttachValue(postPramsInfo);
                Attachments.CheckPurchasedAttachments(attachmentList, postPramsInfo.CurrentUserid);
                int adcount = Advertisements.GetInPostAdCount("", postInfo.Fid);
                postInfo.Id = 1;
                LoadExtraPostInfo(postInfo, adcount);
                LoadPostMessage(postPramsInfo, attachmentList, ismoder, allowGetAttach, postPramsInfo.Hide, postInfo);
            }
            return postInfo;
        }
Esempio n. 6
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;
        }
Esempio n. 7
0
        /// <summary>
        /// 根据附件加载帖子内容
        /// </summary>
        /// <param name="postpramsInfo">参数对象</param>
        /// <param name="attachList">附件列表</param>
        /// <param name="isModer">是否是管理人员</param>
        /// <param name="allowGetAttach">是否允许获取附件</param>
        /// <param name="originalHideStatus">帖子原始Hide属性</param>
        /// <param name="postInfo">帖子信息 </param>
        private static void LoadPostMessage(PostpramsInfo postpramsInfo, List<ShowtopicPageAttachmentInfo> attachList, bool isModer, int allowGetAttach, int originalHideStatus, ShowtopicPagePostInfo postInfo)
        {
            UserGroupInfo tmpGroupInfo;

            bool showMessage = !Utils.InArray(postInfo.Groupid.ToString(), "4,5,6") && postInfo.Invisible == 0;

            //如果当前帖子不可见,但是查看用户是管理组时
            if (!showMessage && isModer)
            {
                postInfo.Message = "<div class='hintinfo'>该用户帖子内容已被屏蔽, 您拥有管理权限, 以下是帖子内容</div>" + postInfo.Message;
            }
            else if (!showMessage)
            {
                postInfo.Message = "<div class='hintinfo'>该用户帖子内容已被屏蔽</div>";
                List<ShowtopicPageAttachmentInfo> delattlist = new List<ShowtopicPageAttachmentInfo>();
                foreach (ShowtopicPageAttachmentInfo attach in attachList)
                {
                    if (attach.Pid == postInfo.Pid)
                        delattlist.Add(attach);
                }

                foreach (ShowtopicPageAttachmentInfo attach in delattlist)
                {
                    attachList.Remove(attach);
                }
            }

            //如果当前帖子可见 或者 当前查看用户是管理组时
            if (showMessage || isModer)
            {
                //处理帖子内容
                postpramsInfo.Smileyoff = postInfo.Smileyoff;
                postpramsInfo.Bbcodeoff = postInfo.Bbcodeoff;
                postpramsInfo.Parseurloff = postInfo.Parseurloff;
                postpramsInfo.Allowhtml = postInfo.Htmlon;
                postpramsInfo.Sdetail = postInfo.Message;
                postpramsInfo.Pid = postInfo.Pid;
                //校正hide处理
                tmpGroupInfo = UserGroups.GetUserGroupInfo(postInfo.Groupid);
                if (tmpGroupInfo.Allowhidecode == 0)
                    postpramsInfo.Hide = 0;

                //先简单判断是否是动网兼容模式
                if (!postpramsInfo.Ubbmode)
                    postInfo.Message = UBB.UBBToHTML(postpramsInfo);
                else
                    postInfo.Message = Utils.HtmlEncode(postInfo.Message);

                if (postpramsInfo.Jammer == 1)
                    postInfo.Message = ForumUtils.AddJammer(postInfo.Message);

                string message = postInfo.Message;
                if (postInfo.Attachment > 0 || regexAttach.IsMatch(message) || regexAttachImg.IsMatch(message))
                {
                    //获取在[hide]标签中的附件id
                    string[] attHidArray = GetHiddenAttachIdList(postpramsInfo.Sdetail, postpramsInfo.Hide);
                    List<ShowtopicPageAttachmentInfo> attachDeleteList = new List<ShowtopicPageAttachmentInfo>();
                    foreach (ShowtopicPageAttachmentInfo attach in attachList)
                    {
                        message = Attachments.GetMessageWithAttachInfo(postpramsInfo, allowGetAttach, attHidArray, postInfo, attach, message);
                        //if (attach.Inserted == 1 && (postpramsInfo.CurrentUserGroup.Radminid == 1 || attach.Uid == postpramsInfo.CurrentUserid || attach.Attachprice <= 0 || attach.Isbought == 1)//当为发帖人或不为收费附件或已购买该收费附件时
                        //    || Utils.InArray(attach.Aid.ToString(), attHidArray))

                        //如果附件已经插入到帖子内容中,则显示内容控制完全交给GetMessageWithAttachInfo
                        if ((attach.Inserted == 1 || Utils.InArray(attach.Aid.ToString(), attHidArray)))
                            attachDeleteList.Add(attach);
                    }

                    foreach (ShowtopicPageAttachmentInfo attach in attachDeleteList)
                    {
                        attachList.Remove(attach);
                    }
                    postInfo.Message = message;
                }

                //恢复hide初值
                postpramsInfo.Hide = originalHideStatus;
            }
        }
Esempio n. 8
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);
        }
Esempio n. 9
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

            //UserInfo userInfo = Users.GetUserInfo(postpramsInfo.CurrentUserid);
            //postpramsInfo.Usercredits = userInfo == null ? 0 : userInfo.Credits;

            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());
                }
            }
        }
Esempio n. 10
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;
        }
Esempio n. 11
0
		/// <summary>
		/// 获得最后回复的帖子列表
		/// </summary>
		/// <param name="_postpramsinfo">参数列表</param>
		/// <returns>帖子列表</returns>
		public DataTable GetLastPostList(PostpramsInfo _postpramsinfo, string posttablename)
		{
			IDataParameter[] prams = {
									  DbHelper.MakeInParam("@tid",(DbType)SqlDbType.Int,4,_postpramsinfo.Tid),
									  DbHelper.MakeInParam("@postnum",(DbType)SqlDbType.Int,4,_postpramsinfo.Pagesize),
									  DbHelper.MakeInParam("@posttablename",(DbType)SqlDbType.VarChar,20,posttablename)
								  };
			DataTable dt = DbHelper.ExecuteDataset(CommandType.StoredProcedure, string.Format("{0}getlastpostlist", BaseConfigs.GetTablePrefix), prams).Tables[0];

			return dt;
		}
Esempio n. 12
0
        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) != -1)
                    {
                        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 = DatabaseProvider.GetInstance().GetRadminidByGroupid(int.Parse(groupid.SelectedValue));
                }

                __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 (Utils.IsNumeric(credits.Text.Replace("-", "")))
                {
                    __userinfo.Credits = Convert.ToInt32(credits.Text);
                }
                else
                {
                    base.RegisterStartupScript( "", "<script>alert('用户的金币不能为空或大于9位 !');</script>");
                    return;
                }

                GeneralConfigInfo __configinfo = GeneralConfigs.Deserialize(Server.MapPath("../../config/general.config"));
                if (__configinfo.Doublee == 0)
                {
                    int currentuid = AdminUsers.FindUserEmail(email.Text);
                    if ((currentuid != -1) && (currentuid != uid))
                    {
                        base.RegisterStartupScript( "", "<script>alert('当前用户的邮箱地址已被使用过, 请输入其他的邮箱!');</script>");
                        return;
                    }
                }

                __userinfo.Email = email.Text;
                __userinfo.Gender = Convert.ToInt32(gender.SelectedValue);
                __userinfo.Groupexpiry = Convert.ToInt32(groupexpiry.Text);
                __userinfo.Extgroupids = extgroupids.GetSelectString(",");

                if ((groupid.SelectedValue != "1") && (__userinfo.Uid == 1))
                {
                    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.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)
                {
                    AdminUsers.UserNameChange(__userinfo, ViewState["username"].ToString());
                }

                if (AdminUsers.UpdateUserAllInfo(__userinfo))
                {
                    if (userName.Text != ViewState["username"].ToString())
                    {
                        AdminUsers.UserNameChange(__userinfo, ViewState["username"].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
        }
Esempio n. 13
0
        /// <summary>
        /// 获得最后回复的帖子列表
        /// </summary>
        /// <param name="_postpramsinfo">参数列表</param>
        /// <returns>帖子列表</returns>
        public DataTable GetPagedLastPostList(PostpramsInfo postParmsInfo, string postTableName)
        {
            DbParameter[] parms = {
                                       DbHelper.MakeInParam("@tid",(DbType)SqlDbType.Int,4,postParmsInfo.Tid),
                                   };
            string where = "";
            if (postParmsInfo.Pageindex > 1)
                where = string.Format(" AND p.[pid] < (SELECT MIN([pid]) FROM (SELECT TOP {0} [{1}].[pid] FROM [{1}] WHERE [{1}].[tid]=@tid AND [{1}].[invisible]<=0 AND [{1}].layer<>0 ORDER BY [{1}].[pid] DESC) AS tblTmp)",
                                        (postParmsInfo.Pageindex - 1) * postParmsInfo.Pagesize,
                                        postTableName,
                                        BaseConfigs.GetTablePrefix);

            string commandText = string.Format("SELECT TOP {0} p.[pid], p.[fid], p.[layer], p.[posterid], p.[title], p.[message], p.[postdatetime], p.[attachment], p.[poster], p.[posterid], p.[invisible], p.[usesig], p.[htmlon], p.[smileyoff], p.[parseurloff], p.[bbcodeoff], p.[rate], p.[ratetimes], u.[username], u.[email], u.[showemail], uf.[avatar], uf.[avatarwidth], uf.[avatarheight], uf.[sightml] AS [signature], uf.[location], uf.[customstatus] FROM [{1}] p LEFT JOIN [{2}users] u ON u.[uid]=p.[posterid] LEFT JOIN [{2}userfields] uf ON uf.[uid]=u.[uid] WHERE p.[tid]=@tid AND p.[invisible]=0 AND p.layer<>0 {3} ORDER BY p.[pid] DESC",
                                                postParmsInfo.Pagesize,
                                                postTableName, BaseConfigs.GetTablePrefix,
                                                where);
            return DbHelper.ExecuteDataset(CommandType.Text, commandText, parms).Tables[0];
        }
Esempio n. 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)
        {
            Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
            List<ShowtopicPagePostInfo> postList = null;

            MemCachedConfigInfo mcci = MemCachedConfigs.GetConfig();

            //只有在应用memcached的情况下才可以使用主题缓存
            if (mcci != null && mcci.ApplyMemCached && postpramsInfo.Pageindex <= cachedPageNumber)
            {
                postList = cache.RetrieveObject("/Forum/ShowTopic_" + postpramsInfo.Tid + "/Page_" + postpramsInfo.Pageindex) as List<ShowtopicPagePostInfo>;
                postpramsInfo.Pagesize = GeneralConfigs.GetConfig().Ppp;//如果开启时,则不再使用用户自己的帖子分页设置
            }

            attachList = new List<ShowtopicPageAttachmentInfo>();
            if (postList == null || postList.Count == 0)
            {
                postList = Data.Posts.GetPostList(postpramsInfo);
                int adCount = Advertisements.GetInPostAdCount("", postpramsInfo.Fid);

                foreach (ShowtopicPagePostInfo postInfo in postList)
                {
                    LoadExtraPostInfo(postInfo, adCount);
                }

                if (postList.Count == 0)
                    return postList;

                //当存在帖子信息时则缓存相应数据
                if (mcci != null && mcci.ApplyMemCached && postpramsInfo.Pageindex <= cachedPageNumber)
                {
                    Discuz.Cache.ICacheStrategy ics = new ForumCacheStrategy();
                    ics.TimeOut = 60;
                    cache.LoadCacheStrategy(ics);
                    cache.AddObject("/Forum/ShowTopic_" + postpramsInfo.Tid + "/Page_" + postpramsInfo.Pageindex, postList);
                    cache.LoadDefaultCacheStrategy();
                }
            }
            //进行相应帖子信息设置
            string pidList = GetPidListWithAttach(postList);
            attachList = Attachments.GetAttachmentList(postpramsInfo, pidList);
            ParsePostListExtraInfo(postpramsInfo, attachList, isModer, postList);

            return postList;
        }
Esempio n. 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int pertask = DNTRequest.GetInt("pertask", 0);
                int lastnumber = DNTRequest.GetInt("lastnumber", 0);
                int startvalue = DNTRequest.GetInt("startvalue", 0);
                int endvalue = DNTRequest.GetInt("endvalue", 0);
                string resultmessage = "";
                switch (Request.Params["opname"])
                {
                    case "UpdatePostSP":
                        AdminForumStats.UpdatePostSP(pertask, ref lastnumber);
                        resultmessage = lastnumber.ToString();
                        break;
                    case "UpdateMyPost":
                        AdminForumStats.UpdateMyPost(pertask, ref lastnumber);
                        resultmessage = lastnumber.ToString();
                        break;
                    case "ReSetFourmTopicAPost":
                        //AdminForumStats.ReSetFourmTopicAPost(pertask, ref lastnumber);
                        AdminForumStats.ReSetFourmTopicAPost();
                        resultmessage = "-1";
                        break;
                    case "ReSetUserDigestPosts":
                        //AdminForumStats.ReSetUserDigestPosts(pertask, ref lastnumber);
                        //resultmessage = lastnumber.ToString();
                        AdminForumStats.ReSetUserDigestPosts();
                        resultmessage = "-1";
                        break;
                    case "ReSetUserPosts":
                        AdminForumStats.ReSetUserPosts(pertask, ref lastnumber);
                        resultmessage = lastnumber.ToString();
                        break;
                    case "ReSetTopicPosts":
                        AdminForumStats.ReSetTopicPosts(pertask, ref lastnumber);
                        resultmessage = lastnumber.ToString();
                        break;
                    case "ReSetFourmTopicAPost_StartEnd":
                        AdminForumStats.ReSetFourmTopicAPost(startvalue, endvalue);
                        resultmessage = "1";
                        break;
                    case "ReSetUserDigestPosts_StartEnd":
                        AdminForumStats.ReSetUserDigestPosts(startvalue, endvalue);
                        resultmessage = "1";
                        break;
                    case "ReSetUserPosts_StartEnd":
                        AdminForumStats.ReSetUserPosts(startvalue, endvalue);
                        resultmessage = "1";
                        break;
                    case "ReSetTopicPosts_StartEnd":
                        AdminForumStats.ResetLastRepliesInfoOfTopics(startvalue, endvalue);
                        resultmessage = "1";
                        break;
                    case "ftptest":
                        FTPs ftps = new FTPs();
                        string message = "";
                        bool ok = ftps.TestConnect(DNTRequest.GetString("serveraddress"), DNTRequest.GetInt("serverport", 0), DNTRequest.GetString("username"),
                            DNTRequest.GetString("password"), DNTRequest.GetInt("timeout", 0), DNTRequest.GetString("uploadpath"), ref message);
                        resultmessage = ok ? "ok" : "Զ�̸������ò��Գ��ִ���\n������" + message;
                        break;
                    case "setapp":
                        APIConfigInfo aci = APIConfigs.GetConfig();
                        aci.Enable = DNTRequest.GetString("allowpassport") == "1";
                        APIConfigs.SaveConfig(aci);
                        resultmessage = "ok";
                        break;
                    case "location":
                        string city = DNTRequest.GetString("city");
                        resultmessage = "ok";
                        DataTable dt = MallPluginProvider.GetInstance().GetLocationsTable();
                        foreach (DataRow dr in dt.Rows)
                        {
                            if (dr["country"].ToString() == DNTRequest.GetString("country") && dr["state"].ToString() == DNTRequest.GetString("state") && dr["city"].ToString() == city)
                            {
                               resultmessage = "<img src='../images/false.gif' title='" + city + "�Ѿ�����!'>";
                                break;
                            }
                        }
                        break;
                    case "goodsinfo":
                        int goodsid = DNTRequest.GetInt("goodsid", 0);
                        Goodsinfo goodsinfo = MallPluginProvider.GetInstance().GetGoodsInfo(goodsid);
                        if (goodsinfo == null)
                        {
                            resultmessage = "��Ʒ������!";
                            break;
                        }
                        //GoodsattachmentinfoCollection attachmentinfos = GoodsAttachments.GetGoodsAttachmentsByGoodsid(goodsinfo.Goodsid);
                        //string img = "";
                        //if (attachmentinfos != null)
                        //{
                        //    img = attachmentinfos[0].Filename;
                        //}
                        PostpramsInfo param = new PostpramsInfo();
                        param.Allowhtml = 1;
                        param.Showimages = 1;
                        param.Sdetail = goodsinfo.Message;
                        resultmessage = "<table width='100%'><tr><td>" + UBB.UBBToHTML(param) + "</td></tr></table>";
                        break;
                    case "downloadword":
                        dt = BanWords.GetBanWordList();
                        string words = "";
                        if (dt.Rows.Count > 0)
                        {
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                words += dt.Rows[i][2].ToString() + "=" + dt.Rows[i][3].ToString() + "\r\n";
                            }
                        }

                        string filename = "words.txt";
                        HttpContext.Current.Response.Clear();
                        HttpContext.Current.Response.Buffer = false;
                        HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
                        HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode(filename));
                        HttpContext.Current.Response.ContentType = "text/plain";
                        HttpContext.Current.Response.Write(words);
                        HttpContext.Current.Response.End();
                        break;

                    case "gettopicinfo":
                        StringBuilder sb = new StringBuilder();
                        TopicInfo info = Topics.GetTopicInfo(DNTRequest.GetInt("tid", 0));
                        sb.Append("[");
                        if (info != null)
                        {

                           sb.Append(string.Format("{{'tid':{0},'title':'{1}'}}", info.Tid, info.Title));
                        }

                        System.Web.HttpContext.Current.Response.Clear();
                        System.Web.HttpContext.Current.Response.ContentType = "application/json";
                        System.Web.HttpContext.Current.Response.Expires = 0;
                        System.Web.HttpContext.Current.Response.Cache.SetNoStore();
                        System.Web.HttpContext.Current.Response.Write(sb.Append("]").ToString());
                        System.Web.HttpContext.Current.Response.End();
                        break;
                }
                Response.Write(resultmessage);
                Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1);
                Response.Expires = -1;
                Response.End();
            }
        }
Esempio n. 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int pertask = DNTRequest.GetInt("pertask", 0);
                int lastnumber = DNTRequest.GetInt("lastnumber", 0);
                int startvalue = DNTRequest.GetInt("startvalue", 0);
                int endvalue = DNTRequest.GetInt("endvalue", 0);
                string resultmessage = "";
                switch (Request.Params["opname"])
                {
                    case "UpdatePostSP":
                        AdminForumStats.UpdatePostSP(pertask, ref lastnumber);
                        resultmessage = lastnumber.ToString();
                        break;
                    case "UpdateMyPost":
                        AdminForumStats.UpdateMyPost(pertask, ref lastnumber);
                        resultmessage = lastnumber.ToString();
                        break;
                    case "ReSetFourmTopicAPost":
                        //AdminForumStats.ReSetFourmTopicAPost(pertask, ref lastnumber);
                        AdminForumStats.ReSetFourmTopicAPost();
                        resultmessage = "-1";
                        break;
                    case "ReSetUserDigestPosts":
                        //AdminForumStats.ReSetUserDigestPosts(pertask, ref lastnumber);
                        //resultmessage = lastnumber.ToString();
                        AdminForumStats.ReSetUserDigestPosts();
                        resultmessage = "-1";
                        break;
                    case "ReSetUserPosts":
                        AdminForumStats.ReSetUserPosts(pertask, ref lastnumber);
                        resultmessage = lastnumber.ToString();
                        break;
                    case "ReSetTopicPosts":
                        AdminForumStats.ReSetTopicPosts(pertask, ref lastnumber);
                        resultmessage = lastnumber.ToString();
                        break;
                    case "ReSetFourmTopicAPost_StartEnd":
                        AdminForumStats.ReSetFourmTopicAPost(startvalue, endvalue);
                        resultmessage = "1";
                        break;
                    case "ReSetUserDigestPosts_StartEnd":
                        AdminForumStats.ReSetUserDigestPosts(startvalue, endvalue);
                        resultmessage = "1";
                        break;
                    case "ReSetUserPosts_StartEnd":
                        AdminForumStats.ReSetUserPosts(startvalue, endvalue);
                        resultmessage = "1";
                        break;
                    case "ReSetTopicPosts_StartEnd":
                        AdminForumStats.ResetLastRepliesInfoOfTopics(startvalue, endvalue);
                        resultmessage = "1";
                        break;
                    case "ftptest":
                        FTPs ftps = new FTPs();
                        string message = "";
                        bool ok = ftps.TestConnect(DNTRequest.GetString("serveraddress"), DNTRequest.GetInt("serverport", 0), DNTRequest.GetString("username"), 
                            DNTRequest.GetString("password"), DNTRequest.GetInt("timeout", 0), DNTRequest.GetString("uploadpath"), ref message);
                        resultmessage = ok ? "ok" : "远程附件设置测试出现错误!\n描述:" + message;
                        break;
                    case "setapp":
                        APIConfigInfo aci = APIConfigs.GetConfig();
                        aci.Enable = DNTRequest.GetString("allowpassport") == "1";
                        APIConfigs.SaveConfig(aci);
                        resultmessage = "ok";
                        break;
                    case "location":
                        string city = DNTRequest.GetString("city");
                        resultmessage = "ok";
                        DataTable dt = MallPluginProvider.GetInstance().GetLocationsTable();
                        foreach (DataRow dr in dt.Rows)
                        {
                            if (dr["country"].ToString() == DNTRequest.GetString("country") && dr["state"].ToString() == DNTRequest.GetString("state") && dr["city"].ToString() == city)
                            {
                               resultmessage = "<img src='../images/false.gif' title='" + city + "已经存在!'>";
                                break;
                            }
                        }
                        break;
                    case "goodsinfo":
                        int goodsid = DNTRequest.GetInt("goodsid", 0);
                        Goodsinfo goodsinfo = MallPluginProvider.GetInstance().GetGoodsInfo(goodsid);
                        if (goodsinfo == null)
                        {
                            resultmessage = "商品不存在!";
                            break;
                        }
                        //GoodsattachmentinfoCollection attachmentinfos = GoodsAttachments.GetGoodsAttachmentsByGoodsid(goodsinfo.Goodsid);
                        //string img = "";
                        //if (attachmentinfos != null)
                        //{
                        //    img = attachmentinfos[0].Filename;
                        //}
                        PostpramsInfo param = new PostpramsInfo();
                        param.Allowhtml = 1;
                        param.Showimages = 1;
                        param.Sdetail = goodsinfo.Message;
                        resultmessage = "<table width='100%'><tr><td>" + UBB.UBBToHTML(param) + "</td></tr></table>";
                        break;
                    case "downloadword":
                        dt = BanWords.GetBanWordList();
                        string words = "";
                        if (dt.Rows.Count > 0)
                        {
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                words += dt.Rows[i][2].ToString() + "=" + dt.Rows[i][3].ToString() + "\r\n";
                            }
                        }

                        string filename = "words.txt";
                        HttpContext.Current.Response.Clear();
                        HttpContext.Current.Response.Buffer = false;
                        HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
                        HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode(filename));
                        HttpContext.Current.Response.ContentType = "text/plain";
                        HttpContext.Current.Response.Write(words);
                        HttpContext.Current.Response.End();
                        break;

                    case "gettopicinfo":
                        StringBuilder sb = new StringBuilder();
                        TopicInfo info = Topics.GetTopicInfo(DNTRequest.GetInt("tid", 0));
                        sb.Append("[");
                        if (info != null)
                        {
                           sb.Append(string.Format("{{'tid':{0},'title':'{1}'}}", info.Tid, info.Title));
                        }

                        System.Web.HttpContext.Current.Response.Clear();
                        System.Web.HttpContext.Current.Response.ContentType = "application/json";
                        System.Web.HttpContext.Current.Response.Expires = 0;
                        System.Web.HttpContext.Current.Response.Cache.SetNoStore();
                        System.Web.HttpContext.Current.Response.Write(sb.Append("]").ToString());
                        System.Web.HttpContext.Current.Response.End();
                        break;

                    case "DeletePrivateMessages"://批量删除短消息
                        {
                            resultmessage = PrivateMessages.DeletePrivateMessages(DNTRequest.GetString("isnew") == "true", DNTRequest.GetString("postdatetime"), DNTRequest.GetString("msgfromlist"), DNTRequest.GetString("lowerupper") == "true", DecodeChar(DNTRequest.GetString("subject")), DecodeChar(DNTRequest.GetString("message")), DNTRequest.GetString("isupdateusernewpm") == "true");
                            resultmessage = string.Format("[{{'count':'{0}'}}]", resultmessage);
                            System.Threading.Thread.Sleep(4000);/*暂停4秒,以减轻数据库压力*/
                            break;
                        }
                    case "sendsmtogroup"://批量发送短消息
                        {
                            int start_uid = DNTRequest.GetInt("start_uid", 0);
                            resultmessage = Users.SendPMByGroupidList(DNTRequest.GetString("groupidlist"), DNTRequest.GetInt("topnumber", 0),
                                ref start_uid,
                                DNTRequest.GetString("msgfrom"), DNTRequest.GetInt("msguid", 1), DNTRequest.GetInt("folder", 0),
                                DecodeChar(DNTRequest.GetString("subject")), DNTRequest.GetString("postdatetime"), DecodeChar(DNTRequest.GetString("message"))).ToString();
                            resultmessage = string.Format("[{{'startuid':{0},'count':'{1}'}}]", start_uid, resultmessage);
                            System.Threading.Thread.Sleep(4000);/*暂停4秒,以减轻数据库压力*/
                            break;
                        }
                    case "usergroupsendemail"://批量发送邮件
                        {
                            int start_uid = DNTRequest.GetInt("start_uid", 0);
                            resultmessage = Users.SendEmailByGroupidList(DNTRequest.GetString("groupidlist"), DNTRequest.GetInt("topnumber", 0),
                                ref start_uid, DecodeChar(DNTRequest.GetString("subject")), DecodeChar(DNTRequest.GetString("body"))).ToString();
                            resultmessage = string.Format("[{{'startuid':{0},'count':'{1}'}}]", start_uid, resultmessage);
                            System.Threading.Thread.Sleep(4000);/*暂停4秒,以减轻数据库压力*/
                            break;
                        }
                    case "updateusercreditbyformula"://根据积分公式批量更新用户积分
                        {
                            int start_uid = DNTRequest.GetInt("start_uid", 0);
                            resultmessage = Users.UpdateUserCredits(DecodeChar(DNTRequest.GetString("formula")), start_uid).ToString();
                            resultmessage = string.Format("[{{'startuid':{0},'count':'{1}'}}]", start_uid + 100 /*每次递增100条记录*/, resultmessage);
                            System.Threading.Thread.Sleep(4000);/*暂停4秒,以减轻数据库压力*/
                            break;
                        }
                }
                System.Web.HttpContext.Current.Response.Clear();
                System.Web.HttpContext.Current.Response.Expires = 0;
                System.Web.HttpContext.Current.Response.Cache.SetNoStore();
                Response.Write(resultmessage);
                Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1);
                Response.Expires = -1;
                Response.End();
            }
        }
Esempio n. 17
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 && (Posts.IsReplier(topicid, userid) || ismoder == 1)) ? -1 : 1;
            postpramsInfo.Hide = topic.Posterid == userid ? -2 : 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);

            foreach (ShowtopicPageAttachmentInfo showtopicpageattachinfo in attachmentlist)
            {
                if (Forums.AllowGetAttachByUserID(forum.Permuserlist, userid))
                {
                    showtopicpageattachinfo.Getattachperm = 1;
                    showtopicpageattachinfo.Allowread = 1;
                }
            }            
            return postpramsInfo;
        }
Esempio n. 18
0
        public void UpdateUser()
        {
            editusersubmit = true;

            UserInfo userinfo = Users.GetUserInfo(DNTRequest.GetFormInt("uid", 0));

            if (userinfo.Adminid >= 1 && userinfo.Adminid <= 3 && userinfo.Adminid <= this.useradminid)
            {
                AddErrLine("您无权编辑此用户信息");
                return;
            }
            if (DNTRequest.GetString("bio").Length > 500)
            {
                //如果自我介绍超过500...
                AddErrLine("自我介绍不得超过500个字符");
                return;
            }
            if (DNTRequest.GetString("signature").Length > 500)
            {
                //如果签名超过500...
                AddErrLine("签名不得超过500个字符");
                return;
            }

            userinfo.Location = Utils.HtmlEncode(DNTRequest.GetFormString("locationnew"));
            userinfo.Bio = Utils.HtmlEncode(DNTRequest.GetFormString("bionew"));
            if (userinfo.Signature != Utils.HtmlEncode(DNTRequest.GetFormString("signaturenew")))
            {
                userinfo.Signature = Utils.HtmlEncode(DNTRequest.GetFormString("signaturenew"));
                PostpramsInfo postPramsInfo = new PostpramsInfo();
                postPramsInfo.Usergroupid = usergroupid;
                postPramsInfo.Attachimgpost = config.Attachimgpost;
                postPramsInfo.Showattachmentpath = config.Showattachmentpath;
                postPramsInfo.Hide = 0;
                postPramsInfo.Price = 0;
                //获取提交的内容并进行脏字和Html处理
                postPramsInfo.Sdetail = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("signaturenew"))); ;
                postPramsInfo.Smileyoff = 1;
                postPramsInfo.Bbcodeoff = 1 - usergroupinfo.Allowsigbbcode;
                postPramsInfo.Parseurloff = 1;
                postPramsInfo.Showimages = usergroupinfo.Allowsigimgcode;
                postPramsInfo.Allowhtml = 0;
                postPramsInfo.Signature = 1;
                postPramsInfo.Smiliesinfo = Smilies.GetSmiliesListWithInfo();
                postPramsInfo.Customeditorbuttoninfo = null;
                postPramsInfo.Smiliesmax = config.Smiliesmax;
                postPramsInfo.Signature = 1;

                userinfo.Sightml = UBB.UBBToHTML(postPramsInfo);
            }

            //删除头像
            if (DNTRequest.GetString("delavatar") == "1")
            {
                Avatars.DeleteAvatar(userinfo.Uid.ToString());
            }

            if (!Users.UpdateUser(userinfo))
            {
                AddErrLine("用户未更新成功");
                return;
            }

            AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, GetGroupTile(), DNTRequest.GetIP(), "更新编辑用户", "");
            if (DNTRequest.GetFormString("operation") == "edituser")
            {
                op = "updateuser";
                SetUrl("modcp.aspx?operation=edituser&forumid=" + fid);
                MsgForward("modcp_succeed");
                AddMsgLine("用户资料成功更新");
                SetMetaRefresh();
            }
        }
Esempio n. 19
0
        /// <summary>
        /// 获取悬赏帖子列表
        /// </summary>
        /// <param name="postpramsInfo">参数对象</param>
        /// <param name="attachmentList">输出附件列表</param>
        /// <param name="isModer">当前是否为管理人员</param>
        /// <returns></returns>
        public static List<ShowbonusPagePostInfo> GetPostListWithBonus(PostpramsInfo postpramsInfo, out List<ShowtopicPageAttachmentInfo> attachmentList, bool isModer)
        {
            List<ShowtopicPagePostInfo> postList = GetPostList(postpramsInfo, out attachmentList, isModer);

            List<ShowbonusPagePostInfo> bonusPostList = new List<ShowbonusPagePostInfo>();

            Dictionary<int, BonusLogInfo> bonusDetails = Discuz.Data.Bonus.GetLogsForEachPost(postpramsInfo.Tid);
            foreach (ShowtopicPagePostInfo sppi in postList)
            {
                ShowbonusPagePostInfo item = new ShowbonusPagePostInfo();

                #region 属性赋值
                item.Adindex = sppi.Adindex;
                item.Attachment = sppi.Attachment;
                item.Avatar = sppi.Avatar;
                item.Avatarheight = sppi.Avatarheight;
                item.Avatarwidth = sppi.Avatarwidth;
                item.Bbcodeoff = sppi.Bbcodeoff;
                item.Bday = sppi.Bday;
                item.Credits = sppi.Credits;
                item.Customstatus = sppi.Customstatus;
                item.Digestposts = sppi.Digestposts;
                item.Email = sppi.Email;
                item.Extcredits1 = sppi.Extcredits1;
                item.Extcredits2 = sppi.Extcredits2;
                item.Extcredits3 = sppi.Extcredits3;
                item.Extcredits4 = sppi.Extcredits4;
                item.Extcredits5 = sppi.Extcredits5;
                item.Extcredits6 = sppi.Extcredits6;
                item.Extcredits7 = sppi.Extcredits7;
                item.Extcredits8 = sppi.Extcredits8;
                item.Fid = sppi.Fid;
                item.Gender = sppi.Gender;
                item.Groupid = sppi.Groupid;
                item.Htmlon = sppi.Htmlon;
                item.Icq = sppi.Icq;
                item.Id = sppi.Id;
                item.Invisible = sppi.Invisible;
                item.Ip = sppi.Ip;
                item.Joindate = sppi.Joindate;
                item.Lastactivity = sppi.Lastactivity;
                item.Lastedit = sppi.Lastedit;
                item.Layer = sppi.Layer;
                item.Location = sppi.Location;
                item.Medals = sppi.Medals;
                item.Message = sppi.Message;
                item.Msn = sppi.Msn;
                item.Nickname = sppi.Nickname;
                item.Onlinestate = sppi.Onlinestate;
                item.Parseurloff = sppi.Parseurloff;
                item.Pid = sppi.Pid;
                item.Postdatetime = sppi.Postdatetime;
                item.Poster = sppi.Poster;
                item.Posterid = sppi.Posterid;
                item.Posts = sppi.Posts;
                item.Qq = sppi.Qq;
                item.Rate = sppi.Rate;
                item.Ratetimes = sppi.Ratetimes;
                item.Showemail = sppi.Showemail;
                item.Signature = sppi.Signature;
                item.Skype = sppi.Skype;
                item.Smileyoff = sppi.Smileyoff;
                item.Spaceid = sppi.Spaceid;
                item.Stars = sppi.Stars;
                item.Status = sppi.Status;
                item.Title = sppi.Title;
                item.Userinvisible = sppi.Userinvisible;
                item.Username = sppi.Username;
                item.Usesig = sppi.Usesig;
                item.Website = sppi.Website;
                item.Yahoo = sppi.Yahoo;

                if (bonusDetails.ContainsKey(item.Pid))
                {
                    item.Bonus = bonusDetails[item.Pid].Bonus;
                    item.Bonusextid = bonusDetails[item.Pid].Extid;
                    item.Isbest = bonusDetails[item.Pid].Isbest;
                }
                #endregion

                if (bonusDetails.ContainsKey(item.Pid) || item.Layer == 0)
                    bonusPostList.Add(item);
            }
            return bonusPostList;
        }
Esempio n. 20
0
 /// <summary>
 /// 获得单个帖子的信息, 包括发帖人的一般资料
 /// </summary>
 /// <param name="_postpramsinfo">参数列表</param>
 /// <returns>帖子的信息</returns>
 public IDataReader GetSinglePost(out IDataReader attachments, PostpramsInfo postParmsInfo, string postTableId)
 {
     DbParameter[] parms = {
                                 DbHelper.MakeInParam("@pid",(DbType)SqlDbType.Int,4,postParmsInfo.Pid),
                                 DbHelper.MakeInParam("@tid",(DbType)SqlDbType.Int,4,postParmsInfo.Tid)
                             };
     attachments = null;
     return DbHelper.ExecuteReader(CommandType.StoredProcedure,
                                   string.Format("{0}getsinglepost{1}", BaseConfigs.GetTablePrefix, postTableId),
                                   parms);
 }
Esempio n. 21
0
        protected override void ShowPage()
        {
            pagetitle = "用户控制面板";

            if (!IsLogin())
                return;

            if (DNTRequest.IsPost())
            {
                if (ForumUtils.IsCrossSitePost())
                {
                    AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                    return;
                }

                ValidateInfo();

                if (IsErr())
                    return;

                if (page_err == 0)
                {
                    UserInfo oldUserInfo = Users.GetUserInfo(userid);
                    UserInfo userInfo = oldUserInfo.Clone();
                    //需要判断签名是否修改过
                    sig = oldUserInfo.Sightml;
                    userInfo.Uid = userid;
                    userInfo.Username = username;
                    userInfo.Nickname = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("nickname")));
                    userInfo.Gender = DNTRequest.GetInt("gender", 0);
                    userInfo.Realname = DNTRequest.GetString("realname");
                    userInfo.Idcard = DNTRequest.GetString("idcard");
                    userInfo.Mobile = DNTRequest.GetString("mobile");
                    userInfo.Phone = DNTRequest.GetString("phone");
                    userInfo.Email = DNTRequest.GetString("email").Trim().ToLower();
                    if (userInfo.Email != oldUserInfo.Email && !Users.ValidateEmail(userInfo.Email, userid))
                    {
                        AddErrLine("Email: \"" + userInfo.Email + "\" 已经被其它用户注册使用");
                        return;
                    }

                    userInfo.Bday = Utils.HtmlEncode(DNTRequest.GetString("bday"));
                    userInfo.Showemail = DNTRequest.GetInt("showemail", 1);

                    if (DNTRequest.GetString("website").IndexOf(".") > -1 && !DNTRequest.GetString("website").ToLower().StartsWith("http"))
                        userInfo.Website = Utils.HtmlEncode("http://" + DNTRequest.GetString("website"));
                    else
                        userInfo.Website = Utils.HtmlEncode(DNTRequest.GetString("website"));

                    userInfo.Icq = Utils.HtmlEncode(DNTRequest.GetString("icq"));
                    userInfo.Qq = Utils.HtmlEncode(DNTRequest.GetString("qq"));
                    userInfo.Yahoo = Utils.HtmlEncode(DNTRequest.GetString("yahoo"));
                    userInfo.Msn = Utils.HtmlEncode(DNTRequest.GetString("msn"));
                    userInfo.Skype = Utils.HtmlEncode(DNTRequest.GetString("skype"));
                    userInfo.Location = Utils.HtmlEncode(DNTRequest.GetString("location"));
                    userInfo.Bio = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("bio")));

                    PostpramsInfo postPramsInfo = new PostpramsInfo();
                    postPramsInfo.Usergroupid = usergroupid;
                    postPramsInfo.Attachimgpost = config.Attachimgpost;
                    postPramsInfo.Showattachmentpath = config.Showattachmentpath;
                    postPramsInfo.Hide = 0;
                    postPramsInfo.Price = 0;
                    //获取提交的内容并进行脏字和Html处理
                    postPramsInfo.Sdetail = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("signature"))); ;
                    postPramsInfo.Smileyoff = 1;
                    postPramsInfo.Bbcodeoff = 1 - usergroupinfo.Allowsigbbcode;
                    postPramsInfo.Parseurloff = 1;
                    postPramsInfo.Showimages = usergroupinfo.Allowsigimgcode;
                    postPramsInfo.Allowhtml = 0;
                    postPramsInfo.Signature = 1;
                    postPramsInfo.Smiliesinfo = Smilies.GetSmiliesListWithInfo();
                    postPramsInfo.Customeditorbuttoninfo = null;
                    postPramsInfo.Smiliesmax = config.Smiliesmax;
                    postPramsInfo.Signature = 1;

                    userInfo.Sightml = UBB.UBBToHTML(postPramsInfo);
                    if (sig != userInfo.Sightml)
                    {
                        Sync.UpdateSignature(userid, userInfo.Username, userInfo.Sightml, "");
                    }
                    if (userInfo.Sightml.Length >= 1000)
                    {
                        AddErrLine("您的签名转换后超出系统最大长度, 请返回修改");
                        return;
                    }

                    userInfo.Signature = postPramsInfo.Sdetail;
                    userInfo.Sigstatus = DNTRequest.GetInt("sigstatus", 0) != 0 ? 1 : 0;


                    if (CheckModified(oldUserInfo, userInfo))
                    {
                        Users.UpdateUserProfile(userInfo);
                        Sync.UpdateProfile(userInfo.Uid, userInfo.Username, "");
                    }
                    OnlineUsers.DeleteUserByUid(userid);    //删除在线表中的信息,使之重建该用户在线表信息
                    //ManyouApplications.AddUserLog(userid, UserLogActionEnum.Update);
                    
                    ForumUtils.WriteCookie("sigstatus", userInfo.Sigstatus.ToString());

                    SetUrl("usercpprofile.aspx");
                    SetMetaRefresh();
                    SetShowBackLink(true);
                    AddMsgLine("修改个人档案完毕");
                }
            }
            else
            {
                pagename += action == "" ? "" : "?action=" + action;

                UserInfo userInfo = Users.GetUserInfo(userid);//olid
                avatarFlashParam = Utils.GetRootUrl(BaseConfigs.GetForumPath) + "images/common/camera.swf?nt=1&inajax=1&appid=" +
                    Utils.MD5(userInfo.Username + userInfo.Password + userInfo.Uid + olid) + "&input=" +
                    DES.Encode(userid + "," + olid, config.Passwordkey) + "&ucapi=" + Utils.UrlEncode(Utils.GetRootUrl(BaseConfigs.GetForumPath) +
                    "tools/ajax.aspx");
                avatarImage = Avatars.GetAvatarUrl(userid);
            }
        }
Esempio n. 22
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;
        }
Esempio n. 23
0
 /// <summary>
 /// 获得最后回复的帖子列表
 /// </summary>
 /// <param name="_postpramsinfo">参数列表</param>
 /// <returns>帖子列表</returns>
 public DataTable GetLastPostList(PostpramsInfo postParmsInfo, string postTableId)
 {
     DbParameter[] parms = {
                                DbHelper.MakeInParam("@tid",(DbType)SqlDbType.Int,4,postParmsInfo.Tid),
                                DbHelper.MakeInParam("@pageindex",(DbType)SqlDbType.Int,4,postParmsInfo.Pageindex),
                                DbHelper.MakeInParam("@postnum",(DbType)SqlDbType.Int,4,postParmsInfo.Pagesize)
                            };
     return DbHelper.ExecuteDataset(CommandType.StoredProcedure,
                                    string.Format("{0}getlastpostlist{1}", BaseConfigs.GetTablePrefix, postTableId),
                                    parms).Tables[0];
 }
Esempio n. 24
0
 /// <summary>
 /// 获得最后回复的帖子列表
 /// </summary>
 /// <param name="postpramsInfo">参数对象</param>
 /// <returns>帖子列表</returns>
 public static DataTable GetLastPostDataTable(PostpramsInfo postpramsInfo)
 {
     return GetPagedLastDataTable(postpramsInfo);
 }
Esempio n. 25
0
        /// <summary>
        /// 获取指定条件的帖子DataReader
        /// </summary>
        /// <param name="_postpramsinfo">参数列表</param>
        /// <returns>指定条件的帖子DataReader</returns>
        public IDataReader GetPostListByCondition(PostpramsInfo postPramsInfo, string postTableId)
        {
            int posterid = Convert.ToInt32(postPramsInfo.Condition.Substring(postPramsInfo.Condition.IndexOf("=") + 1).Trim());
            DbParameter[] parms = {
                                           DbHelper.MakeInParam("@tid",(DbType)SqlDbType.Int,4,postPramsInfo.Tid),
                                           DbHelper.MakeInParam("@pagesize", (DbType)SqlDbType.Int,4,postPramsInfo.Pagesize),
                                           DbHelper.MakeInParam("@pageindex",(DbType)SqlDbType.Int,4,postPramsInfo.Pageindex),
                                           DbHelper.MakeInParam("@posterid",(DbType)SqlDbType.Int,4,posterid)
                                       };

            MemCachedConfigInfo mcci = MemCachedConfigs.GetConfig();
            RedisConfigInfo rci = RedisConfigs.GetConfig();

            //只有在应用memcached或redis的情况下才可以使用主题缓存,则此时为了确保数据同步,必须从主数据库中提取数据进行缓存
            if (((mcci != null && mcci.ApplyMemCached) || (rci != null && rci.ApplyRedis)) && postPramsInfo.Pageindex <= 5)
                return DbHelper.ExecuteReaderInMasterDB(CommandType.StoredProcedure,
                                          string.Format("{0}getpostlistbycondition{1}", BaseConfigs.GetTablePrefix, postTableId),
                                          parms);
            else
                return DbHelper.ExecuteReader(CommandType.StoredProcedure,
                                         string.Format("{0}getpostlistbycondition{1}", BaseConfigs.GetTablePrefix, postTableId),
                                         parms);
        }
Esempio n. 26
0
        /// <summary>
        /// 获得最后回复的帖子列表
        /// </summary>
        /// <param name="_postpramsinfo">参数列表</param>
        /// <returns>帖子列表</returns>
        public static DataTable GetPagedLastDataTable(PostpramsInfo postpramsInfo)
        {
            DataTable dt = Data.Posts.GetPagedLastPostDataTable(postpramsInfo);
            if (dt == null)
            {
                dt = new DataTable();
                dt.Columns.Add("adindex", Type.GetType("System.Int32"));
                return dt;
            }

            dt.Columns.Add("adindex", Type.GetType("System.Int32"));
            Random random = new Random(unchecked((int)DateTime.Now.Ticks));
            int adcount = Advertisements.GetInPostAdCount("", postpramsInfo.Fid);

            foreach (DataRow dr in dt.Rows)
            {
                // ubb转为html代码在页面显示
                postpramsInfo.Smileyoff = Utils.StrToInt(dr["smileyoff"], 0);
                postpramsInfo.Bbcodeoff = Utils.StrToInt(dr["bbcodeoff"], 0);
                postpramsInfo.Parseurloff = Utils.StrToInt(dr["parseurloff"], 0);
                postpramsInfo.Allowhtml = Utils.StrToInt(dr["htmlon"], 0);
                postpramsInfo.Pid = Utils.StrToInt(dr["pid"], 0);
                postpramsInfo.Sdetail = dr["message"].ToString();

                if (postpramsInfo.Price > 0 && Utils.StrToInt(dr["layer"], 0) == 0)
                    dr["message"] = string.Format("<div class=\"paystyle\">此帖为交易帖,要付 {0} <span class=\"bold\">{1}</span>{2} 才可查看</div>", Scoresets.GetScoreSet(Scoresets.GetTopicAttachCreditsTrans()).Name, postpramsInfo.Price, Scoresets.GetScoreSet(Scoresets.GetTopicAttachCreditsTrans()).Unit);
                else
                {
                    if (!postpramsInfo.Ubbmode)
                        dr["message"] = UBB.UBBToHTML(postpramsInfo);
                    else
                        dr["message"] = Utils.HtmlEncode(dr["message"].ToString());
                }
                dr["adindex"] = random.Next(0, adcount);

                //是不是加干扰码
                if (postpramsInfo.Jammer == 1)
                    dr["message"] = ForumUtils.AddJammer(dr["message"].ToString());

                //是不是隐藏会员email
                if (Utils.StrToInt(dr["showemail"], 0) == 1)
                    dr["email"] = "";
            }
            return dt;
        }
Esempio n. 27
0
		/// <summary>
		/// 获取指定条件的帖子DataReader
		/// </summary>
		/// <param name="_postpramsinfo">参数列表</param>
		/// <returns>指定条件的帖子DataReader</returns>
		public IDataReader GetPostList(PostpramsInfo _postpramsinfo, string posttablename)
		{
			IDataParameter[] prams = {
									  DbHelper.MakeInParam("@tid",(DbType)SqlDbType.Int,4,_postpramsinfo.Tid),
									  DbHelper.MakeInParam("@pagesize", (DbType)SqlDbType.Int,4,_postpramsinfo.Pagesize),
									  DbHelper.MakeInParam("@pageindex",(DbType)SqlDbType.Int,4,_postpramsinfo.Pageindex),
									  DbHelper.MakeInParam("@posttablename",(DbType)SqlDbType.VarChar,20,posttablename)
								  };
			return DbHelper.ExecuteReader(CommandType.StoredProcedure, string.Format("{0}getpostlist", BaseConfigs.GetTablePrefix), prams);
		}
Esempio n. 28
0
        /// <summary>
        /// 得到空间格式的帖子内容
        /// </summary>
        /// <param name="postinfo">帖子描述</param>
        /// <param name="attArray">附件集合</param>
        /// <returns>空间格式</returns>
        public static string GetPostMessageHTML(PostInfo postInfo, AttachmentInfo[] attachmentArray)
        {
            string message = "";
            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.Showimages = 1 - postInfo.Smileyoff;
            postpramsInfo.Smiliesinfo = Smilies.GetSmiliesListWithInfo();
            postpramsInfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            postpramsInfo.Pid = postInfo.Pid;
            //强制隐藏hide内容
            postpramsInfo.Hide = 1;
            //设定这是为个人空间进行的解析
            postpramsInfo.Isforspace = 1;

            //先简单判断是否是动网兼容模式
            if (!postpramsInfo.Ubbmode)
                message = UBB.UBBToHTML(postpramsInfo);
            else
                message = Utils.HtmlEncode(postInfo.Message);

            if (postpramsInfo.Jammer == 1)
                message = ForumUtils.AddJammer(postInfo.Message);

            if (postInfo.Attachment > 0 || regexAttach.IsMatch(message) || regexAttachImg.IsMatch(message))
            {
                //获取在[hide]标签中的附件id
                string[] attHidArray = GetHiddenAttachIdList(postpramsInfo.Sdetail, postpramsInfo.Hide);

                ShowtopicPagePostInfo info = new ShowtopicPagePostInfo();
                info.Posterid = postInfo.Posterid;
                info.Pid = postInfo.Pid;

                for (int i = 0; i < attachmentArray.Length; i++)
                {
                    ShowtopicPageAttachmentInfo sAtt = new ShowtopicPageAttachmentInfo();
                    sAtt.Aid = attachmentArray[i].Aid;
                    sAtt.Attachment = attachmentArray[i].Attachment;
                    sAtt.Description = attachmentArray[i].Description;
                    sAtt.Downloads = attachmentArray[i].Downloads;
                    sAtt.Filename = attachmentArray[i].Filename;
                    sAtt.Filesize = attachmentArray[i].Filesize;
                    sAtt.Filetype = attachmentArray[i].Filetype;
                    sAtt.Pid = attachmentArray[i].Pid;
                    sAtt.Postdatetime = attachmentArray[i].Postdatetime;
                    sAtt.Readperm = attachmentArray[i].Readperm;
                    sAtt.Sys_index = attachmentArray[i].Sys_index;
                    sAtt.Sys_noupload = attachmentArray[i].Sys_noupload;
                    sAtt.Tid = attachmentArray[i].Tid;
                    sAtt.Uid = attachmentArray[i].Uid;
                    message = Attachments.GetMessageWithAttachInfo(postpramsInfo, 1, attHidArray, info, sAtt, message);
                }
            }
            return message;
        }
Esempio n. 29
0
		/// <summary>
		/// 获得单个帖子的信息, 包括发帖人的一般资料
		/// </summary>
		/// <param name="_postpramsinfo">参数列表</param>
		/// <returns>帖子的信息</returns>
		public IDataReader GetSinglePost(out IDataReader _Attachments,PostpramsInfo _postpramsinfo, string posttableid)
		{
			IDataParameter[] prams = {
									  DbHelper.MakeInParam("@pid",(DbType)SqlDbType.Int,4,_postpramsinfo.Pid),
									  DbHelper.MakeInParam("@tid",(DbType)SqlDbType.Int,4,_postpramsinfo.Tid)
								  };
			_Attachments = null;
			IDataReader reader = DbHelper.ExecuteReader(CommandType.StoredProcedure, string.Format("{0}getsinglepost{1}", BaseConfigs.GetTablePrefix, posttableid), prams);

			return reader;
		}
Esempio n. 30
0
        /// <summary>
        /// 获取指定条件的帖子DataSet
        /// </summary>
        /// <param name="_postpramsinfo">参数列表</param>
        /// <returns>指定条件的帖子DataSet</returns>
        public static List<ShowtopicPagePostInfo> GetPostList(PostpramsInfo postpramsInfo, out List<ShowtopicPageAttachmentInfo> attachList, bool isModer)
        {
            Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
            List<ShowtopicPagePostInfo> postList = Data.Posts.GetPostList(postpramsInfo);
            attachList = new List<ShowtopicPageAttachmentInfo>();

            if (postList.Count == 0)
                return postList;

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

            foreach (ShowtopicPagePostInfo postInfo in postList)
            {
                LoadExtraPostInfo(postInfo, adCount);
            }

            //进行相应帖子信息设置
            string pidList = GetPidListWithAttach(postList);
            attachList = Attachments.GetAttachmentList(postpramsInfo, pidList);
            ParsePostListExtraInfo(postpramsInfo, attachList, isModer, postList);

            return postList;
        }