/// <summary>
        /// 转换表情
        /// </summary>
        /// <param name="sDetail">内容</param>
        /// <returns>帖子内容</returns>
        private static string ParseSmilies(string sDetail)
        {
            RegexOptions options = RegexOptions.IgnoreCase;

            SmiliesInfo[] smiliesInfo = Smilies.GetSmiliesListWithInfo(); //表情数组
            int           smiliesMax  = GeneralConfigs.GetConfig().Smiliesmax;

            if (smiliesInfo == null)
            {
                return(sDetail);
            }

            string smilieFormatStr = "[smilie]{0}editor/images/smilies/{1}[/smilie]";

            for (int i = 0; i < Smilies.regexSmile.Length; i++)
            {
                if (smiliesMax > 0)
                {
                    sDetail = Smilies.regexSmile[i].Replace(sDetail, string.Format(smilieFormatStr, BaseConfigs.GetForumPath, smiliesInfo[i].Url), smiliesMax);
                }
                else
                {
                    sDetail = Smilies.regexSmile[i].Replace(sDetail, string.Format(smilieFormatStr, BaseConfigs.GetForumPath, smiliesInfo[i].Url));
                }
            }
            return(Regex.Replace(sDetail, @"\[smilie\](.+?)\[\/smilie\]", "<img src=\"$1\" />", options));
        }
Beispiel #2
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);
        }
Beispiel #3
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);
        }
Beispiel #4
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);
        }
        /// <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);
        }
Beispiel #6
0
        /// <summary>
        /// 创建用户信息
        /// </summary>
        /// <param name="tmpUsername"></param>
        /// <param name="email"></param>
        /// <param name="tmpBday"></param>
        /// <returns></returns>
        private UserInfo CreateUser(string tmpUsername, string email, string tmpBday)
        {
            // 如果找不到0积分的用户组则用户自动成为待验证用户
            UserInfo userinfo = new UserInfo();

            userinfo.Username      = tmpUsername;
            userinfo.Nickname      = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("nickname")));
            userinfo.Password      = DNTRequest.GetString("password");
            userinfo.Secques       = ForumUtils.GetUserSecques(DNTRequest.GetInt("question", 0), DNTRequest.GetString("answer"));
            userinfo.Gender        = DNTRequest.GetInt("gender", 0);
            userinfo.Adminid       = 0;
            userinfo.Groupexpiry   = 0;
            userinfo.Extgroupids   = "";
            userinfo.Regip         = DNTRequest.GetIP();
            userinfo.Joindate      = Utils.GetDateTime();
            userinfo.Lastip        = DNTRequest.GetIP();
            userinfo.Lastvisit     = Utils.GetDateTime();
            userinfo.Lastactivity  = Utils.GetDateTime();
            userinfo.Lastpost      = Utils.GetDateTime();
            userinfo.Lastpostid    = 0;
            userinfo.Lastposttitle = "";
            userinfo.Posts         = 0;
            userinfo.Digestposts   = 0;
            userinfo.Oltime        = 0;
            userinfo.Pageviews     = 0;
            userinfo.Credits       = 0;
            userinfo.Extcredits1   = Scoresets.GetScoreSet(1).Init;
            userinfo.Extcredits2   = Scoresets.GetScoreSet(2).Init;
            userinfo.Extcredits3   = Scoresets.GetScoreSet(3).Init;
            userinfo.Extcredits4   = Scoresets.GetScoreSet(4).Init;
            userinfo.Extcredits5   = Scoresets.GetScoreSet(5).Init;
            userinfo.Extcredits6   = Scoresets.GetScoreSet(6).Init;
            userinfo.Extcredits7   = Scoresets.GetScoreSet(7).Init;
            userinfo.Extcredits8   = Scoresets.GetScoreSet(8).Init;
            //userinfo.Avatarshowid = 0;
            userinfo.Email      = email;
            userinfo.Bday       = tmpBday;
            userinfo.Sigstatus  = DNTRequest.GetInt("sigstatus", 1) != 0 ? 1 : 0;
            userinfo.Tpp        = DNTRequest.GetInt("tpp", 0);
            userinfo.Ppp        = DNTRequest.GetInt("ppp", 0);
            userinfo.Templateid = DNTRequest.GetInt("templateid", 0);
            userinfo.Pmsound    = DNTRequest.GetInt("pmsound", 0);
            userinfo.Showemail  = DNTRequest.GetInt("showemail", 0);
            userinfo.Salt       = "";

            int receivepmsetting = config.Regadvance == 0 ? 3 : DNTRequest.GetInt("receivesetting", 3);//关于短信息枚举值的设置看ReceivePMSettingType类型注释,此处不禁止用户接受系统短信息

            //foreach (string rpms in DNTRequest.GetString("receivesetting").Split(','))
            //{
            //    if (!Utils.StrIsNullOrEmpty(rpms))
            //        receivepmsetting = receivepmsetting | int.Parse(rpms);
            //}

            //if (config.Regadvance == 0)
            //    receivepmsetting = 7;

            userinfo.Newsletter   = (ReceivePMSettingType)receivepmsetting;
            userinfo.Invisible    = DNTRequest.GetInt("invisible", 0);
            userinfo.Newpm        = config.Welcomemsg == 1 ? 1 : 0;
            userinfo.Medals       = "";
            userinfo.Accessmasks  = DNTRequest.GetInt("accessmasks", 0);
            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.Customstatus = (usergroupinfo.Allowcstatus == 1) ? Utils.HtmlEncode(DNTRequest.GetString("customstatus")) : "";
            //userinfo.Avatar = @"avatars\common\0.gif";
            //userinfo.Avatarwidth = 0;
            //userinfo.Avatarheight = 0;
            userinfo.Bio       = ForumUtils.BanWordFilter(DNTRequest.GetString("bio"));
            userinfo.Signature = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("signature")));

            PostpramsInfo postpramsinfo = new PostpramsInfo();

            postpramsinfo.Usergroupid        = usergroupid;
            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;
            userinfo.Sightml = UBB.UBBToHTML(postpramsinfo);

            userinfo.Authtime = Utils.GetDateTime();

            //邮箱激活链接验证
            if (config.Regverify == 1)
            {
                userinfo.Authstr  = ForumUtils.CreateAuthStr(20);
                userinfo.Authflag = 1;
                userinfo.Groupid  = 8;
                SendEmail(tmpUsername, DNTRequest.GetString("password").Trim(), DNTRequest.GetString(config.Antispamregisteremail).Trim(), userinfo.Authstr);
            }
            //系统管理员进行后台验证
            else if (config.Regverify == 2)
            {
                userinfo.Authstr  = DNTRequest.GetString("website");
                userinfo.Groupid  = 8;
                userinfo.Authflag = 1;
            }
            else
            {
                userinfo.Authstr  = "";
                userinfo.Authflag = 0;
                userinfo.Groupid  = UserCredits.GetCreditsUserGroupId(0).Groupid;
            }
            userinfo.Realname = DNTRequest.GetString("realname");
            userinfo.Idcard   = DNTRequest.GetString("idcard");
            userinfo.Mobile   = DNTRequest.GetString("mobile");
            userinfo.Phone    = DNTRequest.GetString("phone");

            //第三方加密验证模式
            if (config.Passwordmode > 1 && PasswordModeProvider.GetInstance() != null)
            {
                userinfo.Uid = PasswordModeProvider.GetInstance().CreateUserInfo(userinfo);
            }
            else
            {
                userinfo.Password = Utils.MD5(userinfo.Password);
                userinfo.Uid      = Users.CreateUser(userinfo);
            }
            return(userinfo);
        }
Beispiel #7
0
        /// <summary>
        /// 获取帖子参数信息(PostPramsInfo)
        /// </summary>
        /// <param name="price"></param>
        /// <returns></returns>
        private List <ShowtopicPageAttachmentInfo> GetAttachList(int price, string onlyauthor, int ismoder, int posterid, UserInfo userinfo, UserGroupInfo usergroupinfo, TopicInfo topic, ForumInfo forum)
        {
            GeneralConfigInfo config = GeneralConfigs.GetConfig();
            //获取当前页主题列表
            PostpramsInfo postpramsInfo = new PostpramsInfo();

            postpramsInfo.Fid                    = forum.Fid;
            postpramsInfo.Tid                    = topic.Tid;
            postpramsInfo.Jammer                 = forum.Jammer;
            postpramsInfo.Pagesize               = 10000; // 得到Ppp设置
            postpramsInfo.Pageindex              = 1;
            postpramsInfo.Getattachperm          = forum.Getattachperm;
            postpramsInfo.Usergroupid            = usergroupinfo.Groupid;
            postpramsInfo.Attachimgpost          = config.Attachimgpost;
            postpramsInfo.Showattachmentpath     = config.Showattachmentpath;
            postpramsInfo.Price                  = price;
            postpramsInfo.Usergroupreadaccess    = (ismoder == 1) ? int.MaxValue : usergroupinfo.Readaccess;
            postpramsInfo.CurrentUserid          = userinfo.Uid;
            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(topic.Tid, userinfo.Uid) || ismoder == 1)) ? -1 : 1;
            postpramsInfo.Hide        = topic.Posterid == userinfo.Uid ? -2 : postpramsInfo.Hide;
            postpramsInfo.Condition   = Posts.GetPostPramsInfoCondition(onlyauthor, topic.Tid, posterid);
            postpramsInfo.Usercredits = userinfo == null ? 0 : userinfo.Credits;
            List <ShowtopicPageAttachmentInfo> attachmentlist = new List <ShowtopicPageAttachmentInfo>();
            List <ShowtopicPagePostInfo>       postlist       = GetPostList(postpramsInfo, out attachmentlist, ismoder == 1);
            int allowGetAttach = GetAllowGetAttachValue(postpramsInfo);

            foreach (ShowtopicPageAttachmentInfo showtopicpageattachinfo in attachmentlist)
            {
                if (Forums.AllowGetAttachByUserID(forum.Permuserlist, userinfo.Uid))
                {
                    showtopicpageattachinfo.Getattachperm = 1;
                    showtopicpageattachinfo.Allowread     = 1;
                }
            }
            List <ShowtopicPageAttachmentInfo> attachDeleteList = new List <ShowtopicPageAttachmentInfo>();

            foreach (ShowtopicPageAttachmentInfo attachInfo in attachmentlist)
            {
                if (allowGetAttach == 1 && attachInfo.Allowread == 1)
                {
                    if (attachInfo.Filetype.IndexOf("jpeg") >= 0 || attachInfo.Filetype.IndexOf("png") >= 0)
                    {
                        if (!attachInfo.Filename.ToLower().StartsWith("http"))
                        {
                            attachInfo.Filename = Utils.GetRootUrl(BaseConfigs.GetForumPath) + "upload/" + attachInfo.Filename.Trim();
                        }
                    }
                    else
                    {
                        attachDeleteList.Add(attachInfo);//记录不是JPG或PNG的图片,以便进行remove操作
                    }
                }
                else
                {
                    attachDeleteList.Add(attachInfo);//记录不是JPG或PNG的图片,以便进行remove操作
                }
            }
            foreach (ShowtopicPageAttachmentInfo attach in attachDeleteList)
            {
                attachmentlist.Remove(attach);
            }
            return(attachmentlist);
        }
Beispiel #8
0
        /// <summary>
        /// 创建新用户
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="email"></param>
        /// <param name="birthday"></param>
        /// <returns></returns>
        private UserInfo CreateUser(string userName, string email, string birthday)
        {
            UserInfo userInfo = new UserInfo();

            userInfo.Username      = userName;
            userInfo.Email         = email;
            userInfo.Bday          = birthday;
            userInfo.Nickname      = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("nickname")));
            userInfo.Password      = Utils.MD5(ForumUtils.CreateAuthStr(16));
            userInfo.Secques       = "";
            userInfo.Gender        = DNTRequest.GetInt("gender", 0);
            userInfo.Adminid       = 0;
            userInfo.Groupexpiry   = 0;
            userInfo.Extgroupids   = "";
            userInfo.Regip         = userInfo.Lastip = DNTRequest.GetIP();
            userInfo.Joindate      = userInfo.Lastvisit = userInfo.Lastactivity = userInfo.Lastpost = Utils.GetDateTime();
            userInfo.Lastpostid    = 0;
            userInfo.Lastposttitle = "";
            userInfo.Posts         = 0;
            userInfo.Digestposts   = 0;
            userInfo.Oltime        = 0;
            userInfo.Pageviews     = 0;
            userInfo.Credits       = 0;
            userInfo.Extcredits1   = Scoresets.GetScoreSet(1).Init;
            userInfo.Extcredits2   = Scoresets.GetScoreSet(2).Init;
            userInfo.Extcredits3   = Scoresets.GetScoreSet(3).Init;
            userInfo.Extcredits4   = Scoresets.GetScoreSet(4).Init;
            userInfo.Extcredits5   = Scoresets.GetScoreSet(5).Init;
            userInfo.Extcredits6   = Scoresets.GetScoreSet(6).Init;
            userInfo.Extcredits7   = Scoresets.GetScoreSet(7).Init;
            userInfo.Extcredits8   = Scoresets.GetScoreSet(8).Init;

            userInfo.Sigstatus  = DNTRequest.GetInt("sigstatus", 1) != 0 ? 1 : 0;
            userInfo.Tpp        = DNTRequest.GetInt("tpp", 0);
            userInfo.Ppp        = DNTRequest.GetInt("ppp", 0);
            userInfo.Templateid = DNTRequest.GetInt("templateid", 0);
            userInfo.Pmsound    = DNTRequest.GetInt("pmsound", 0);
            userInfo.Showemail  = DNTRequest.GetInt("showemail", 0);
            userInfo.Salt       = "";

            int receivepmsetting = config.Regadvance == 0 ? 3 : DNTRequest.GetInt("receivesetting", 3);//关于短信息枚举值的设置看ReceivePMSettingType类型注释,此处不禁止用户接受系统短信息

            userInfo.Newsletter   = (ReceivePMSettingType)receivepmsetting;
            userInfo.Invisible    = DNTRequest.GetInt("invisible", 0);
            userInfo.Newpm        = config.Welcomemsg == 1 ? 1 : 0;
            userInfo.Medals       = "";
            userInfo.Accessmasks  = DNTRequest.GetInt("accessmasks", 0);
            userInfo.Website      = DNTRequest.GetHtmlEncodeString("website");
            userInfo.Icq          = DNTRequest.GetHtmlEncodeString("icq");
            userInfo.Qq           = DNTRequest.GetHtmlEncodeString("qq");
            userInfo.Yahoo        = DNTRequest.GetHtmlEncodeString("yahoo");
            userInfo.Msn          = DNTRequest.GetHtmlEncodeString("msn");
            userInfo.Skype        = DNTRequest.GetHtmlEncodeString("skype");
            userInfo.Location     = DNTRequest.GetHtmlEncodeString("location");
            userInfo.Customstatus = (usergroupinfo.Allowcstatus == 1) ? DNTRequest.GetHtmlEncodeString("customstatus") : "";
            userInfo.Bio          = ForumUtils.BanWordFilter(DNTRequest.GetString("bio"));
            userInfo.Signature    = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("signature")));

            PostpramsInfo postpramsinfo = new PostpramsInfo();

            postpramsinfo.Usergroupid        = usergroupid;
            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;
            userInfo.Sightml  = UBB.UBBToHTML(postpramsinfo);
            userInfo.Authtime = Utils.GetDateTime();
            userInfo.Realname = DNTRequest.GetString("realname");
            userInfo.Idcard   = DNTRequest.GetString("idcard");
            userInfo.Mobile   = DNTRequest.GetString("mobile");
            userInfo.Phone    = DNTRequest.GetString("phone");

            //系统管理员进行后台验证
            if (config.Regverify == 2)
            {
                userInfo.Authstr  = DNTRequest.GetString("website");
                userInfo.Groupid  = 8;
                userInfo.Authflag = 1;
            }
            else
            {
                userInfo.Authstr  = "";
                userInfo.Authflag = 0;
                userInfo.Groupid  = CreditsFacade.GetCreditsUserGroupId(0).Groupid;
            }
            userInfo.Uid = Users.CreateUser(userInfo);
            return(userInfo);
        }
        protected override void ShowPage()
        {
            pagetitle = "用户控制面板";

            if (userid == -1)
            {
                AddErrLine("你尚未登录");

                return;
            }
            user = Discuz.Forum.Users.GetUserInfo(userid);

            if (DNTRequest.IsPost())
            {
                SetBackLink("usercpforumsetting.aspx");
                if (ForumUtils.IsCrossSitePost())
                {
                    AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                    return;
                }
                UserInfo __userinfo = new UserInfo();
                __userinfo.Uid          = userid;
                __userinfo.Tpp          = DNTRequest.GetInt("tpp", 0);
                __userinfo.Ppp          = DNTRequest.GetInt("ppp", 0);
                __userinfo.Pmsound      = DNTRequest.GetInt("pmsound", 0);
                __userinfo.Invisible    = DNTRequest.GetInt("invisible", 0);
                __userinfo.Customstatus = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("customstatus")));
                //获取提交的内容并进行脏字和Html处理
                string signature = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("signature")));

                int sigstatus = DNTRequest.GetInt("sigstatus", 0);
                //错误参数值纠正
                if (sigstatus != 0)
                {
                    sigstatus = 1;
                }

                PostpramsInfo _postpramsinfo = new PostpramsInfo();
                _postpramsinfo.Usergroupid        = usergroupid;
                _postpramsinfo.Attachimgpost      = config.Attachimgpost;
                _postpramsinfo.Showattachmentpath = config.Showattachmentpath;
                _postpramsinfo.Hide                   = 0;
                _postpramsinfo.Price                  = 0;
                _postpramsinfo.Sdetail                = 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;//Editors.GetCustomEditButtonListWithInfo();
                _postpramsinfo.Smiliesmax             = config.Smiliesmax;
                _postpramsinfo.Signature              = 1;


                string sightml = UBB.UBBToHTML(_postpramsinfo);

                //if (usergroupinfo.Maxsigsize<Utils.ClearHtml(sightml).Length)
                if (DNTRequest.GetString("signature").Length > usergroupinfo.Maxsigsize)
                {
                    AddErrLine(string.Format("您的签名长度超过 {0} 字符的限制,请返回修改。", usergroupinfo.Maxsigsize));
                    return;
                }

                if (sightml.Length >= 1000)
                {
                    AddErrLine("您的签名转换后超出系统最大长度, 请返回修改");
                    return;
                }

                __userinfo.Sigstatus = sigstatus;
                __userinfo.Signature = signature;
                __userinfo.Sightml   = sightml;

                Discuz.Forum.Users.UpdateUserForumSetting(__userinfo);
                OnlineUsers.UpdateInvisible(olid, __userinfo.Invisible);

                ForumUtils.WriteCookie("sigstatus", sigstatus);
                ForumUtils.WriteCookie("tpp", __userinfo.Tpp.ToString());
                ForumUtils.WriteCookie("ppp", __userinfo.Ppp.ToString());
                ForumUtils.WriteCookie("pmsound", __userinfo.Pmsound.ToString());

                SetUrl("usercpforumsetting.aspx");
                SetMetaRefresh();
                SetShowBackLink(true);
                AddMsgLine("修改论坛设置完毕");
            }
        }
Beispiel #10
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 = ismoder == 1 || Posts.IsReplier(topicid, userid) ? -1 : 1;
            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;
            postpramsInfo.Invisible     = invisible;
            switch (stand)
            {
            case 0:
                postlist = Posts.GetPostList(postpramsInfo, out attachmentlist, ismoder == 1);
                break;

            case 1:
                postlist = Debates.GetPositivePostList(postpramsInfo, out attachmentlist, ismoder == 1);
                break;

            case 2:
                postlist = Debates.GetNegativePostList(postpramsInfo, out attachmentlist, ismoder == 1);
                break;
            }
            if (topic.Special == 4)
            {
                string pidList = "";
                foreach (ShowtopicPagePostInfo post in postlist)
                {
                    pidList += post.Pid + ",";
                }
                Dictionary <int, int> postdiggs = Debates.GetPostDiggs(pidList.Trim(','));
                foreach (ShowtopicPagePostInfo post in postlist)
                {
                    if (postdiggs.ContainsKey(post.Pid))
                    {
                        post.Diggs = postdiggs[post.Pid];
                    }
                }
            }
            if (postlist.Count == 0)
            {
                TopicAdmins.RepairTopicList(topicid.ToString());
                topic = GetTopicInfo();
                BindPageCountAndId();
                postpramsInfo.Pageindex = pagecount;
                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;
                }
            }
            BindDownloadAttachmentTip();

            return(postpramsInfo);
        }
Beispiel #11
0
        public void GetPostInfo(Post pi)
        {
            if (pi != null)
            {
                this.isexist = true;
                var ppi = new PostpramsInfo();
                ppi.Fid                    = pi.Fid;
                ppi.Tid                    = pi.Tid;
                ppi.Pid                    = pi.ID;
                ppi.Jammer                 = 0;
                ppi.Attachimgpost          = this.config.Attachimgpost;
                ppi.Showattachmentpath     = 1;
                ppi.Showimages             = 1;
                ppi.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
                ppi.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
                ppi.Smiliesmax             = this.config.Smiliesmax;
                ppi.Bbcodemode             = this.config.Bbcodemode;
                ppi.Smileyoff              = pi.SmileyOff;
                ppi.BBCode                 = pi.BBCodeOff == 0;
                ppi.Parseurloff            = pi.ParseUrlOff;
                ppi.Allowhtml              = pi.HtmlOn;
                ppi.Sdetail                = pi.Message;
                this.message               = pi.Message;
                if (ppi.Jammer == 1)
                {
                    this.message = ForumUtils.AddJammer(this.message);
                }

                ppi.Sdetail = this.message;
                if (!ppi.Ubbmode)
                {
                    this.message = UBB.UBBToHTML(ppi);
                }
                else
                {
                    this.message = Utils.HtmlEncode(this.message);
                }

                if (pi.Attachment == 1 || new Regex("\\[attach\\](\\d+?)\\[\\/attach\\]", RegexOptions.IgnoreCase).IsMatch(this.message))
                {
                    var list = Attachment.FindAllByPid(pi.ID);
                    //list.Columns.Add("attachimgpost", typeof(Int16));
                    foreach (var att in list)
                    {
                        if (this.message.IndexOf("[attach]" + att.ID + "[/attach]") != -1)
                        {
                            string text;
                            if (att.FileSize > 1024)
                            {
                                text = Math.Round((Double)att.FileSize / 1024, 2) + " K";
                            }
                            else
                            {
                                text = att.FileSize + " B";
                            }

                            string newValue;
                            if (att.ImgPost)
                            {
                                att["attachimgpost"] = 1;
                                if (ppi.Showattachmentpath == 1)
                                {
                                    newValue = "<img src=\"../../upload/" + att.FileName + "\" onload=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='点击在新窗口浏览图片 CTRL+鼠标滚轮可放大/缩小';}\" onmouseover=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='点击在新窗口浏览图片 CTRL+Mouse 滚轮可放大/缩小';}\" onclick=\"if(!this.resized) { return true; } else { window.open(this.src); }\" onmousewheel=\"return imgzoom(this);\" />";
                                }
                                else
                                {
                                    newValue = "<img src=\"../../attachment.aspx?attachmentid=" + att.ID + "\" onload=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='点击在新窗口浏览图片 CTRL+鼠标滚轮可放大/缩小';}\" onmouseover=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='点击在新窗口浏览图片 CTRL+Mouse 滚轮可放大/缩小';}\" onclick=\"if(!this.resized) { return true; } else { window.open(this.src); }\" onmousewheel=\"return imgzoom(this);\" />";
                                }
                            }
                            else
                            {
                                att["attachimgpost"] = 0;
                                newValue             = "<p><img alt=\"\" src=\"../../images/attachicons/attachment.gif\" border=\"0\" /><span class=\"bold\">附件</span>: <a href=\"../../attachment.aspx?attachmentid=" + att["aid"].ToString() + "\" target=\"_blank\">" + att["attachment"].ToString().Trim() + "</a> (" + att["postdatetime"].ToString() + ", " + text + ")<br />该附件被下载次数 " + att["downloads"].ToString() + "</p>";
                            }
                            this.message = this.message.Replace("[attach]" + att.ID + "[/attach]", newValue);
                        }
                    }
                    //list.Dispose();
                }
                this.title = Utils.RemoveHtml(pi.Title);
            }
        }
Beispiel #12
0
        /// <summary>创建用户信息</summary>
        private static UserInfo CreateUser(GeneralConfigInfo config, IPKSPrincipal principal, bool isAdmin)
        {
            var tmpUsername = principal.Identity.Name;
            // 如果找不到0积分的用户组则用户自动成为待验证用户
            UserInfo userinfo = new UserInfo();

            userinfo.Username      = tmpUsername;
            userinfo.Nickname      = tmpUsername;
            userinfo.Password      = Guid.NewGuid().ToString();
            userinfo.Secques       = "";
            userinfo.Gender        = 0;
            userinfo.Adminid       = isAdmin ? 1 : 0;
            userinfo.Groupexpiry   = 0;
            userinfo.Extgroupids   = "";
            userinfo.Regip         = DNTRequest.GetIP();
            userinfo.Joindate      = Discuz.Common.Utils.GetDateTime();
            userinfo.Lastip        = userinfo.Regip;
            userinfo.Lastvisit     = userinfo.Joindate;
            userinfo.Lastactivity  = userinfo.Joindate;
            userinfo.Lastpost      = userinfo.Joindate;
            userinfo.Lastpostid    = 0;
            userinfo.Lastposttitle = "";
            userinfo.Posts         = 0;
            userinfo.Digestposts   = 0;
            userinfo.Oltime        = 0;
            userinfo.Pageviews     = 0;
            userinfo.Credits       = 0;
            userinfo.Extcredits1   = Scoresets.GetScoreSet(1).Init;
            userinfo.Extcredits2   = Scoresets.GetScoreSet(2).Init;
            userinfo.Extcredits3   = Scoresets.GetScoreSet(3).Init;
            userinfo.Extcredits4   = Scoresets.GetScoreSet(4).Init;
            userinfo.Extcredits5   = Scoresets.GetScoreSet(5).Init;
            userinfo.Extcredits6   = Scoresets.GetScoreSet(6).Init;
            userinfo.Extcredits7   = Scoresets.GetScoreSet(7).Init;
            userinfo.Extcredits8   = Scoresets.GetScoreSet(8).Init;
            //userinfo.Avatarshowid = 0;
            userinfo.Email      = principal.Identity.Email ?? "";
            userinfo.Bday       = "";
            userinfo.Sigstatus  = 1;
            userinfo.Tpp        = 0;
            userinfo.Ppp        = 0;
            userinfo.Templateid = 0;
            userinfo.Pmsound    = 0;
            userinfo.Showemail  = 0;
            userinfo.Salt       = "";

            int receivepmsetting = 3;//关于短信息枚举值的设置看ReceivePMSettingType类型注释,此处不禁止用户接受系统短信息

            //foreach (string rpms in DNTRequest.GetString("receivesetting").Split(','))
            //{
            //    if (!Utils.StrIsNullOrEmpty(rpms))
            //        receivepmsetting = receivepmsetting | int.Parse(rpms);
            //}

            //if (config.Regadvance == 0)
            //    receivepmsetting = 7;

            userinfo.Newsletter   = (ReceivePMSettingType)receivepmsetting;
            userinfo.Invisible    = 0;
            userinfo.Newpm        = config.Welcomemsg == 1 ? 1 : 0;
            userinfo.Medals       = "";
            userinfo.Accessmasks  = 0;
            userinfo.Website      = "";
            userinfo.Icq          = "";
            userinfo.Qq           = "";
            userinfo.Yahoo        = "";
            userinfo.Msn          = "";
            userinfo.Skype        = "";
            userinfo.Location     = "";
            userinfo.Customstatus = "";
            //userinfo.Avatar = @"avatars\common\0.gif";
            //userinfo.Avatarwidth = 0;
            //userinfo.Avatarheight = 0;
            userinfo.Bio       = "";
            userinfo.Signature = "";

            var usergroupid   = isAdmin ? 1 : 7;
            var usergroupinfo = UserGroups.GetUserGroupInfo(usergroupid);

            PostpramsInfo postpramsinfo = new PostpramsInfo();

            postpramsinfo.Usergroupid        = usergroupid;
            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;
            userinfo.Sightml = UBB.UBBToHTML(postpramsinfo);

            userinfo.Authtime = userinfo.Joindate;

            if (isAdmin)
            {
                userinfo.Authstr  = "";
                userinfo.Authflag = 0;
                userinfo.Groupid  = usergroupid;
            }
            //邮箱激活链接验证
            else if (config.Regverify == 1)
            {
                userinfo.Authstr  = ForumUtils.CreateAuthStr(20);
                userinfo.Authflag = 1;
                userinfo.Groupid  = 8;
                //SendEmail(tmpUsername, DNTRequest.GetString("password").Trim(), DNTRequest.GetString(config.Antispamregisteremail).Trim(), userinfo.Authstr);
                //Emails.DiscuzSmtpMail(tmpUsername, emailaddress, password, authstr);
            }
            //系统管理员进行后台验证
            else if (config.Regverify == 2)
            {
                userinfo.Authstr  = "";
                userinfo.Groupid  = 8;
                userinfo.Authflag = 1;
            }
            else
            {
                userinfo.Authstr  = "";
                userinfo.Authflag = 0;
                userinfo.Groupid  = UserCredits.GetCreditsUserGroupId(0).Groupid;
            }
            userinfo.Realname = "";
            userinfo.Idcard   = "";
            userinfo.Mobile   = "";
            userinfo.Phone    = principal.Identity.PhoneNumber;

            //第三方加密验证模式
            if (config.Passwordmode > 1 && PasswordModeProvider.GetInstance() != null)
            {
                userinfo.Uid = PasswordModeProvider.GetInstance().CreateUserInfo(userinfo);
            }
            else
            {
                userinfo.Password = Discuz.Common.Utils.MD5(userinfo.Password);
                userinfo.Uid      = Users.CreateUser(userinfo);
            }
            return(userinfo);
        }
Beispiel #13
0
        /// <summary>
        /// 获取帖子信息
        /// </summary>
        /// <param name="dt"></param>
        public void GetPostInfo(DataTable dt)
        {
            if (dt != null)
            {
                if (dt.Rows.Count > 0)
                {
                    isexist = true;
                    PostpramsInfo _postpramsinfo = new PostpramsInfo();
                    _postpramsinfo.Fid                    = Convert.ToInt32(dt.Rows[0]["fid"].ToString());
                    _postpramsinfo.Tid                    = Convert.ToInt32(dt.Rows[0]["tid"].ToString());
                    _postpramsinfo.Pid                    = Convert.ToInt32(dt.Rows[0]["pid"].ToString());
                    _postpramsinfo.Jammer                 = 1;
                    _postpramsinfo.Attachimgpost          = config.Attachimgpost;
                    _postpramsinfo.Showattachmentpath     = 1;
                    _postpramsinfo.Showimages             = 1;
                    _postpramsinfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
                    _postpramsinfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
                    _postpramsinfo.Smiliesmax             = config.Smiliesmax;
                    _postpramsinfo.Bbcodemode             = config.Bbcodemode;

                    _postpramsinfo.Smileyoff   = Utils.StrToInt(dt.Rows[0]["smileyoff"], 0);
                    _postpramsinfo.Bbcodeoff   = Utils.StrToInt(dt.Rows[0]["bbcodeoff"], 0);
                    _postpramsinfo.Parseurloff = Utils.StrToInt(dt.Rows[0]["parseurloff"], 0);
                    _postpramsinfo.Allowhtml   = Utils.StrToInt(dt.Rows[0]["htmlon"], 0);
                    _postpramsinfo.Sdetail     = dt.Rows[0]["message"].ToString();

                    message = dt.Rows[0]["message"].ToString();

                    //是不是加干扰码
                    if (_postpramsinfo.Jammer == 1)
                    {
                        message = ForumUtils.AddJammer(message);
                    }

                    _postpramsinfo.Sdetail = message;

                    if (!_postpramsinfo.Ubbmode)
                    {
                        message = UBB.UBBToHTML(_postpramsinfo);
                    }
                    else
                    {
                        message = Utils.HtmlEncode(message);
                    }

                    #region 附件

                    // 处理上传图片图文混排问题
                    if (dt.Rows[0]["attachment"].ToString().Equals("1") || new Regex(@"\[attach\](\d+?)\[\/attach\]", RegexOptions.IgnoreCase).IsMatch(message))
                    {
                        DataTable dtAttachment = DatabaseProvider.GetInstance().GetAttachmentsByPid(Utils.StrToInt(dt.Rows[0]["pid"], 0));
                        dtAttachment.Columns.Add("attachimgpost", Type.GetType("System.Int16"));

                        string replacement = "";
                        string filesize    = "";

                        foreach (DataRow drAt in dtAttachment.Rows)
                        {
                            if (message.IndexOf("[attach]" + drAt["aid"].ToString() + "[/attach]") != -1)
                            {
                                if (Convert.ToInt64(drAt["filesize"]) > 1024)
                                {
                                    filesize = Convert.ToString(Math.Round(Convert.ToDecimal(drAt["filesize"]) / 1024, 2)) + " K";
                                }
                                else
                                {
                                    filesize = drAt["filesize"].ToString() + " B";
                                }

                                if (Utils.IsImgFilename(drAt["attachment"].ToString().Trim()))
                                {
                                    drAt["attachimgpost"] = 1;

                                    if (_postpramsinfo.Showattachmentpath == 1)
                                    {
                                        replacement = "<img src=\"../../upload/" + drAt["filename"].ToString() + "\" onload=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='点击在新窗口浏览图片 CTRL+鼠标滚轮可放大/缩小';}\" onmouseover=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='点击在新窗口浏览图片 CTRL+Mouse 滚轮可放大/缩小';}\" onclick=\"if(!this.resized) { return true; } else { window.open(this.src); }\" onmousewheel=\"return imgzoom(this);\" />";
                                    }
                                    else
                                    {
                                        replacement = "<img src=\"../../attachment.aspx?attachmentid=" + drAt["aid"].ToString() + "\" onload=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='点击在新窗口浏览图片 CTRL+鼠标滚轮可放大/缩小';}\" onmouseover=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='点击在新窗口浏览图片 CTRL+Mouse 滚轮可放大/缩小';}\" onclick=\"if(!this.resized) { return true; } else { window.open(this.src); }\" onmousewheel=\"return imgzoom(this);\" />";
                                    }
                                }
                                else
                                {
                                    drAt["attachimgpost"] = 0;
                                    replacement           = "<p><img alt=\"\" src=\"../../images/attachicons/attachment.gif\" border=\"0\" /><span class=\"bold\">附件</span>: <a href=\"../../attachment.aspx?attachmentid=" + drAt["aid"].ToString() + "\" target=\"_blank\">" + drAt["attachment"].ToString().Trim() + "</a> (" + drAt["postdatetime"].ToString() + ", " + filesize + ")<br />该附件被下载次数 " + drAt["downloads"].ToString() + "</p>";
                                }

                                message = message.Replace("[attach]" + drAt["aid"].ToString() + "[/attach]", replacement);
                            }
                        }
                        dtAttachment.Dispose();
                    }

                    #endregion

                    title = Utils.RemoveHtml(dt.Rows[0]["title"].ToString().Trim());
                }
            }
        }
Beispiel #14
0
        protected override void ShowPage()
        {
            if (config.Enablemall == 0) //未启用交易服务
            {
                AddErrLine("系统未开启交易服务, 当前页面暂时无法访问!");
                return;
            }
            else
            {
                goodscategoryfid = Discuz.Mall.GoodsCategories.GetGoodsCategoryWithFid();
            }

            headerad = "";
            footerad = "";
            floatad  = "";

            disablepostctrl = 0;

            // 如果商品ID无效
            if (goodsid == -1)
            {
                AddErrLine("无效的商品ID");
                return;
            }

            goodsinfo = Goods.GetGoodsInfo(goodsid);
            if (goodsinfo == null || goodsinfo.Closed > 1)
            {
                AddErrLine("不存在的商品ID");
                headerad = Advertisements.GetOneHeaderAd("", 0);
                footerad = Advertisements.GetOneFooterAd("", 0);
                floatad  = Advertisements.GetFloatAd("", 0);
                return;
            }

            UserInfo userinfo = Users.GetUserInfo(goodsinfo.Selleruid);

            if (userinfo != null)
            {
                joindate = Convert.ToDateTime(userinfo.Joindate).ToString("yyyy-MM-dd");
            }

            sb_usercredit       = GoodsUserCredits.GetUserCreditJsonData(goodsinfo.Selleruid);
            creditrulesjsondata = GoodsUserCredits.GetCreditRulesJsonData().ToString();

            if (config.Enablemall == 1) //开启普通模式
            {
                forumid = GoodsCategories.GetCategoriesFid(goodsinfo.Categoryid);
                forum   = Forums.GetForumInfo(forumid);
                if (forum == null)
                {
                    AddErrLine("当前商品所属分类未绑定相应版块");
                    return;
                }

                forumname = forum.Name;
                forumnav  = ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname);

                ///得到广告列表
                ///头部
                headerad = Advertisements.GetOneHeaderAd("", forumid);
                footerad = Advertisements.GetOneFooterAd("", forumid);
                doublead = Advertisements.GetDoubleAd("", forumid);
                floatad  = Advertisements.GetFloatAd("", forumid);

                // 检查是否具有版主的身份
                if (useradminid != 0)
                {
                    ismoder = Moderators.IsModer(useradminid, userid, forumid) ? 1 : 0;
                    //得到管理组信息
                    admininfo = AdminGroups.GetAdminGroupInfo(usergroupid);
                    if (admininfo != null)
                    {
                        disablepostctrl = admininfo.Disablepostctrl;
                    }
                }
            }
            goodscategoryinfo = GoodsCategories.GetGoodsCategoryInfoById(goodsinfo.Categoryid);
            pagetitle         = goodsinfo.Title;
            navhomemenu       = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname);

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

            //编辑器状态
            StringBuilder sb = new StringBuilder("var Allowhtml=1;\r\n");

            parseurloff = 0;
            bbcodeoff   = 1;
            if (config.Enablemall == 1) //开启普通模式
            {
                smileyoff = 1 - forum.Allowsmilies;

                if (forum.Allowbbcode == 1 && usergroupinfo.Allowcusbbcode == 1)
                {
                    bbcodeoff = 0;
                }

                allowimg = forum.Allowimgcode;
            }
            else if (config.Enablemall == 2) //当为高级模式时
            {
                if (usergroupinfo.Allowcusbbcode == 1)
                {
                    bbcodeoff = 0;
                }

                allowimg = 1;
            }

            sb.Append("var Allowsmilies=" + (1 - smileyoff) + ";\r\n");
            sb.Append("var Allowbbcode=" + (1 - bbcodeoff) + ";\r\n");
            usesig = ForumUtils.GetCookie("sigstatus") == "0" ? 0 : 1;
            sb.Append("var Allowimgcode=" + allowimg + ";\r\n");

            AddScript(sb.ToString());

            if (config.Enablemall == 2)
            {
                recommendgoodslist = Goods.GetGoodsRecommendList(goodsinfo.Selleruid, 6, 1,
                                                                 DbProvider.GetInstance().GetGoodsIdCondition((int)MallUtils.OperaCode.NoEuqal, goodsinfo.Goodsid));
            }

            smilietypes = Caches.GetSmilieTypesCache();

            if (newpmcount > 0)
            {
                pmlist     = PrivateMessages.GetPrivateMessageListForIndex(userid, 5, 1, 1);
                showpmhint = Convert.ToInt32(Users.GetShortUserInfo(userid).Newsletter) > 4;
            }


            // 得到pptradelog设置
            pptradelog = Utils.StrToInt(ForumUtils.GetCookie("ppp"), config.Ppp);
            if (pptradelog <= 0)
            {
                pptradelog = config.Ppp;
            }

            //快速发帖广告
            if (config.Enablemall == 1) //开启普通模式
            {
                quickeditorad = Advertisements.GetQuickEditorAD("", forumid);
            }

            //更新页面Meta中的Description项, 提高SEO友好性
            string metadescritpion = Utils.RemoveHtml(goodsinfo.Message);

            metadescritpion = metadescritpion.Length > 100 ? metadescritpion.Substring(0, 100) : metadescritpion;
            UpdateMetaInfo(config.Seokeywords, metadescritpion, config.Seohead);

            GoodspramsInfo goodspramsInfo = new GoodspramsInfo();

            goodspramsInfo.Goodsid = goodsinfo.Goodsid;

            if (config.Enablemall == 1) //开启普通模式
            {
                goodspramsInfo.Fid           = forum.Fid;
                goodspramsInfo.Jammer        = forum.Jammer;
                goodspramsInfo.Getattachperm = forum.Getattachperm;
                goodspramsInfo.Showimages    = forum.Allowimgcode;
            }
            else if (config.Enablemall == 2) //当为高级模式时
            {
                goodspramsInfo.Jammer        = 0;
                goodspramsInfo.Getattachperm = "";
                goodspramsInfo.Showimages    = 1;
            }
            goodspramsInfo.Pageindex          = pageid;
            goodspramsInfo.Usergroupid        = usergroupid;
            goodspramsInfo.Attachimgpost      = config.Attachimgpost;
            goodspramsInfo.Showattachmentpath = config.Showattachmentpath;
            goodspramsInfo.Hide  = 0;
            goodspramsInfo.Price = 0;
            goodspramsInfo.Usergroupreadaccess = usergroupinfo.Readaccess;

            if (ismoder == 1)
            {
                goodspramsInfo.Usergroupreadaccess = int.MaxValue;
            }

            goodspramsInfo.CurrentUserid          = userid;
            goodspramsInfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            goodspramsInfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            goodspramsInfo.Smiliesmax             = config.Smiliesmax;
            goodspramsInfo.Bbcodemode             = config.Bbcodemode;
            goodspramsInfo.CurrentUserGroup       = usergroupinfo;
            goodspramsInfo.Sdetail     = goodsinfo.Message;
            goodspramsInfo.Smileyoff   = goodsinfo.Smileyoff;
            goodspramsInfo.Bbcodeoff   = goodsinfo.Bbcodeoff;
            goodspramsInfo.Parseurloff = goodsinfo.Parseurloff;
            goodspramsInfo.Allowhtml   = 1;
            goodspramsInfo.Sdetail     = goodsinfo.Message;

            message = Goods.MessgeTranfer(goodspramsInfo, GoodsAttachments.GetGoodsAttachmentsByGoodsid(goodsinfo.Goodsid));

            forumlistboxoptions = Caches.GetForumListBoxOptionsCache();
            tradecount          = TradeLogs.GetGoodsTradeLogCount(goodsid);
            leavewordcount      = GoodsLeaveWords.GetGoodsLeaveWordCount(goodsid);
            pptradelog          = 16;

            ForumUtils.WriteCookie("referer", string.Format(base.ShowGoodsAspxRewrite(goodsinfo.Goodsid)));

            if (config.Enablemall == 1) //开启普通模式
            {
                ForumUtils.UpdateVisitedForumsOptions(forumid);
            }

            visitedforumsoptions = ForumUtils.GetVisitedForumsOptions(config.Visitedforums);

            //删除留言
            if (DNTRequest.GetInt("deleteleaveword", 0) == 1)
            {
                isdeleteop = true;
                int leavewordid = DNTRequest.GetInt("leavewordid", 0);

                if (leavewordid <= 0)
                {
                    AddErrLine("您要删除的留言已被删除, 现在转入商品页面");
                    return;
                }
                if (GoodsLeaveWords.DeleteLeaveWordById(leavewordid, userid, goodsinfo.Selleruid, useradminid))
                {
                    SetUrl(base.ShowGoodsAspxRewrite(goodsinfo.Goodsid));
                    SetMetaRefresh();
                    AddMsgLine("该留言已被删除, 现在转入商品页面<br />(<a href=\"" + base.ShowGoodsAspxRewrite(goodsinfo.Goodsid) + "\">如果您的浏览器没有自动跳转, 请点击这里</a>)<br />");
                    return;
                }
                else
                {
                    AddErrLine("您的用户身份无效删除该留言, 现在转入商品页面");
                    return;
                }
            }

            //删除商品
            if (DNTRequest.GetInt("deletegoods", 0) == 1)
            {
                isdeleteop = true;
                //是否为卖家或版主
                if (Goods.IsSeller(goodsinfo.Goodsid.ToString(), userid) || ismoder == 1)
                {
                    Goods.DeleteGoods(goodsinfo.Goodsid.ToString(), false);

                    SetUrl(this.ShowGoodsListAspxRewrite(goodsinfo.Categoryid, 1));
                    SetMetaRefresh();
                    AddMsgLine("操作成功. <br />(<a href=\"" + this.ShowGoodsListAspxRewrite(goodsinfo.Categoryid, 1) + "\">点击这里返回</a>)<br />");
                    return;
                }
                else
                {
                    AddErrLine("你不是当前商品的卖家或版主,因此无法删除该商品");
                    return;
                }
            }


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

                if (DNTRequest.GetString("postleaveword") == "add")
                {
                    //当验证密码正确后,则发送相应留言
                    Goodsleavewordinfo goodsleavewordinfo = new Goodsleavewordinfo();
                    goodsleavewordinfo.Ip         = DNTRequest.GetIP();
                    goodsleavewordinfo.Goodsid    = goodsinfo.Goodsid;
                    goodsleavewordinfo.Tradelogid = 0;
                    goodsleavewordinfo.Uid        = userid;
                    goodsleavewordinfo.Username   = username;
                    goodsleavewordinfo.Message    = DNTRequest.GetString("message");
                    goodsleavewordinfo.Isbuyer    = goodsinfo.Selleruid != userid ? 1 : 0;
                    if (GoodsLeaveWords.CreateLeaveWord(goodsleavewordinfo, goodsinfo.Selleruid, DNTRequest.GetString("sendnotice") == "on" ? true : false) > 0)
                    {
                        SetUrl(base.ShowGoodsAspxRewrite(goodsinfo.Goodsid));
                        SetMetaRefresh();
                        AddMsgLine("您的留言已发布, 现在转入商品页面<br />(<a href=\"" + base.ShowGoodsAspxRewrite(goodsinfo.Goodsid) + "\">如果您的浏览器没有自动跳转, 请点击这里</a>)<br />");
                    }
                }
                else
                {
                    //当验证密码正确后,则发送相应留言
                    Goodsleavewordinfo goodsleavewordinfo = GoodsLeaveWords.GetGoodsLeaveWordById(DNTRequest.GetInt("leavewordid", 0));
                    if (goodsleavewordinfo != null && goodsleavewordinfo.Id > 0)
                    {
                        goodsleavewordinfo.Ip           = DNTRequest.GetIP();
                        goodsleavewordinfo.Uid          = userid;
                        goodsleavewordinfo.Username     = username;
                        goodsleavewordinfo.Message      = DNTRequest.GetString("message");
                        goodsleavewordinfo.Postdatetime = DateTime.Now;
                        if (GoodsLeaveWords.UpdateLeaveWord(goodsleavewordinfo))
                        {
                            SetUrl(base.ShowGoodsAspxRewrite(goodsinfo.Goodsid));
                            SetMetaRefresh();
                            AddMsgLine("留言更新成功, 现在转入商品页面<br />(<a href=\"" + base.ShowGoodsAspxRewrite(goodsinfo.Goodsid) + "\">如果您的浏览器没有自动跳转, 请点击这里</a>)<br />");
                        }
                    }
                    else
                    {
                        AddErrLine("当前留言不存在或已被删除");
                        return;
                    }
                }
            }
            else
            {
                goodsinfo.Viewcount += 1; //浏览量加1
                Goods.UpdateGoods(goodsinfo);
            }
        }
Beispiel #15
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.GetHtmlEncodeString("realname");
                    userInfo.Idcard   = DNTRequest.GetHtmlEncodeString("idcard");
                    userInfo.Mobile   = DNTRequest.GetHtmlEncodeString("mobile");
                    userInfo.Phone    = DNTRequest.GetHtmlEncodeString("phone");
                    userInfo.Email    = DNTRequest.GetHtmlEncodeString("email").Trim().ToLower();
                    if (userInfo.Email != oldUserInfo.Email && !Users.ValidateEmail(userInfo.Email, userid))
                    {
                        AddErrLine("Email: \"" + userInfo.Email + "\" 已经被其它用户注册使用");
                        return;
                    }

                    userInfo.Bday      = DNTRequest.GetHtmlEncodeString("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 = DNTRequest.GetHtmlEncodeString("website");
                    }

                    userInfo.Icq      = DNTRequest.GetHtmlEncodeString("icq");
                    userInfo.Qq       = DNTRequest.GetHtmlEncodeString("qq");
                    userInfo.Yahoo    = DNTRequest.GetHtmlEncodeString("yahoo");
                    userInfo.Msn      = DNTRequest.GetHtmlEncodeString("msn");
                    userInfo.Skype    = DNTRequest.GetHtmlEncodeString("skype");
                    userInfo.Location = DNTRequest.GetHtmlEncodeString("location");
                    userInfo.Bio      = ForumUtils.BanWordFilter(DNTRequest.GetHtmlEncodeString("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                = ForumUtils.BanWordFilter(DNTRequest.GetHtmlEncodeString("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);
            }
        }
Beispiel #16
0
        private User CreateUser(string userName, string nickname, string email, string birthday)
        {
            var userInfo = new User();

            userInfo.Name          = userName;
            userInfo.Email         = email;
            userInfo.Bday          = birthday;
            userInfo.NickName      = nickname;
            userInfo.Password      = Utils.MD5(ForumUtils.CreateAuthStr(16));
            userInfo.Secques       = "";
            userInfo.Gender        = DNTRequest.GetInt("gender", 0);
            userInfo.AdminID       = 0;
            userInfo.GroupExpiry   = 0;
            userInfo.ExtGroupIds   = "";
            userInfo.RegIP         = userInfo.LastIP = WebHelper.UserHost;
            userInfo.JoinDate      = userInfo.LastVisit = userInfo.LastActivity = userInfo.LastPost = DateTime.Now;
            userInfo.LastPostID    = 0;
            userInfo.LastPostTitle = "";
            userInfo.Posts         = 0;
            userInfo.DigestPosts   = 0;
            userInfo.OLTime        = 0;
            userInfo.PageViews     = 0;
            userInfo.Credits       = 0;
            userInfo.ExtCredits1   = Scoresets.GetScoreSet(1).Init;
            userInfo.ExtCredits2   = Scoresets.GetScoreSet(2).Init;
            userInfo.ExtCredits3   = Scoresets.GetScoreSet(3).Init;
            userInfo.ExtCredits4   = Scoresets.GetScoreSet(4).Init;
            userInfo.ExtCredits5   = Scoresets.GetScoreSet(5).Init;
            userInfo.ExtCredits6   = Scoresets.GetScoreSet(6).Init;
            userInfo.ExtCredits7   = Scoresets.GetScoreSet(7).Init;
            userInfo.ExtCredits8   = Scoresets.GetScoreSet(8).Init;
            userInfo.Sigstatus     = ((DNTRequest.GetInt("sigstatus", 1) != 0) ? 1 : 0);
            userInfo.Tpp           = DNTRequest.GetInt("tpp", 0);
            userInfo.Ppp           = DNTRequest.GetInt("ppp", 0);
            userInfo.TemplateID    = DNTRequest.GetInt("templateid", 0);
            userInfo.Pmsound       = DNTRequest.GetInt("pmsound", 0);
            userInfo.ShowEmail     = DNTRequest.GetInt("showemail", 0) != 0;
            userInfo.Salt          = "";
            int newsletter = (this.config.Regadvance == 0) ? 3 : DNTRequest.GetInt("receivesetting", 3);

            //userInfo.Newsletter = (ReceivePMSettingType)newsletter;
            userInfo.NewsLetter  = newsletter;
            userInfo.Invisible   = DNTRequest.GetInt("invisible", 0) != 0;
            userInfo.Newpm       = ((this.config.Welcomemsg == 1) ? 1 : 0) != 0;
            userInfo.AccessMasks = DNTRequest.GetInt("accessmasks", 0);

            var uf = userInfo.Field;

            uf.Medals       = "";
            uf.Website      = DNTRequest.GetHtmlEncodeString("website");
            uf.Icq          = DNTRequest.GetHtmlEncodeString("icq");
            uf.qq           = DNTRequest.GetHtmlEncodeString("qq");
            uf.Yahoo        = DNTRequest.GetHtmlEncodeString("yahoo");
            uf.Msn          = DNTRequest.GetHtmlEncodeString("msn");
            uf.Skype        = DNTRequest.GetHtmlEncodeString("skype");
            uf.Location     = DNTRequest.GetHtmlEncodeString("location");
            uf.Customstatus = usergroupinfo.AllowCstatus ? DNTRequest.GetHtmlEncodeString("customstatus") : "";
            uf.Bio          = ForumUtils.BanWordFilter(DNTRequest.GetString("bio"));
            uf.Signature    = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("signature")));
            uf.Sightml      = UBB.UBBToHTML(new PostpramsInfo
            {
                Usergroupid        = this.usergroupid,
                Attachimgpost      = this.config.Attachimgpost,
                Showattachmentpath = this.config.Showattachmentpath,
                Hide                   = 0,
                Price                  = 0,
                Sdetail                = uf.Signature,
                Smileyoff              = 1,
                BBCode                 = this.usergroupinfo.AllowSigbbCode,
                Parseurloff            = 1,
                Showimages             = this.usergroupinfo.AllowSigimgCode ? 1 : 0,
                Allowhtml              = 0,
                Smiliesinfo            = Smilies.GetSmiliesListWithInfo(),
                Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo(),
                Smiliesmax             = this.config.Smiliesmax
            });
            uf.AuthTime = DateTime.Now;
            uf.RealName = DNTRequest.GetString("realname");
            uf.Idcard   = DNTRequest.GetString("idcard");
            uf.Mobile   = DNTRequest.GetString("mobile");
            uf.Phone    = DNTRequest.GetString("phone");
            if (this.config.Regverify == 2)
            {
                uf.Authstr       = DNTRequest.GetString("website");
                userInfo.GroupID = 8;
                uf.Authflag      = 1;
            }
            else
            {
                uf.Authstr       = "";
                uf.Authflag      = 0;
                userInfo.GroupID = CreditsFacade.GetCreditsUserGroupId(0f).ID;
            }
            //userInfo.ID = Users.CreateUser(userInfo);
            userInfo.Save();
            return(userInfo);
        }
Beispiel #17
0
        protected override void ShowPage()
        {
            topictitle = "";
            forumnav   = "";

            ////加载帖内广告
            //inpostad = Advertisements.GetInPostAd("", fid, templatepath, postlist.Count > ppp ? ppp : postlist.Count);

            //AdminGroupInfo admininfo = AdminGroups.GetAdminGroupInfo(useradminid);

            showpayments = DNTRequest.GetInt("showpayments", 0);
            buyit        = DNTRequest.GetInt("buyit", 0);
            topicid      = DNTRequest.GetInt("topicid", -1);
            // 如果主题ID非数字
            if (topicid == -1)
            {
                AddErrLine(WRONG_TOPIC);
                return;
            }

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

            // 如果该主题不存在
            if (topic == null)
            {
                AddErrLine(NOT_EXIST_TOPIC);
                return;
            }

            if (topic.Posterid == userid)
            {
                HttpContext.Current.Response.Redirect(base.ShowTopicAspxRewrite(topic.Tid, 0));
                return;
            }

            if (topic.Price <= 0)
            {
                HttpContext.Current.Response.Redirect(base.ShowTopicAspxRewrite(topic.Tid, 0));
                return;
            }

            topictitle = topic.Title.Trim();
            topicprice = topic.Price;
            poster     = topic.Poster;
            posterid   = topic.Posterid;
            pagetitle  = topictitle.Trim();
            forumid    = topic.Fid;
            ForumInfo forum = Forums.GetForumInfo(forumid);

            forumname = forum.Name.Trim();
            forumnav  = ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname);

            //判断是否为回复可见帖, price=0为非购买可见(正常), price>0 为购买可见, price=-1为购买可见但当前用户已购买
            price = 0;
            if (topic.Price > 0)
            {
                price = topic.Price;
                if (PaymentLogs.IsBuyer(topicid, userid) || (Utils.StrDateDiffHours(topic.Postdatetime, Scoresets.GetMaxChargeSpan()) > 0 && Scoresets.GetMaxChargeSpan() != 0))//判断当前用户是否已经购买
                {
                    price = -1;
                }
            }

            if (useradminid != 0)
            {
                ismoder = Moderators.IsModer(useradminid, userid, forumid) ? 1 : 0;
            }

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

            if (topic.Displayorder == -1)
            {
                AddErrLine("此主题已被删除!");
                return;
            }

            if (topic.Displayorder == -2)
            {
                AddErrLine("此主题未经审核!");
                return;
            }

            if (forum.Password != "" &&
                Utils.MD5(forum.Password) != ForumUtils.GetCookie("forum" + forumid.ToString() + "password"))
            {
                AddErrLine("本版块被管理员设置了密码");
                //SetBackLink("showforum-" + forumid.ToString() + config.Extname);
                HttpContext.Current.Response.Redirect("showforum-" + forumid.ToString() + config.Extname, true);
                return;
            }

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

            userextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetCreditsTrans());
            maxincpertopic     = Scoresets.GetMaxIncPerTopic();
            maxchargespan      = Scoresets.GetMaxChargeSpan();
            creditstax         = Scoresets.GetCreditsTax() * 100;

            netamount = topicprice - topicprice * creditstax / 100;
            if (topicprice > maxincpertopic)
            {
                netamount = maxincpertopic - maxincpertopic * creditstax / 100;
            }

            if (price != -1)
            {
                IDataReader reader = Users.GetUserInfoToReader(userid);
                if (reader == null)
                {
                    AddErrLine(NO_PERMISSION);
                    return;
                }

                if (!reader.Read())
                {
                    AddErrLine(NO_PERMISSION);
                    reader.Close();
                    return;
                }

                if (Utils.StrToFloat(reader["extcredits" + Scoresets.GetCreditsTrans().ToString()], 0) < topic.Price)
                {
                    AddErrLine(string.Format(NOT_ENOUGH_MONEY_TO, Utils.StrToFloat(reader["extcredits" + Scoresets.GetCreditsTrans().ToString()], 0), topic.Price));
                    reader.Close();

                    return;
                }

                userlastprice = Utils.StrToFloat(reader["extcredits" + Scoresets.GetCreditsTrans().ToString()], 0) - topic.Price;
                reader.Close();
            }



            //如果不是提交...
            if (!ispost)
            {
                buyers = PaymentLogs.GetPaymentLogByTidCount(topic.Tid);

                //显示购买信息列表
                if (showpayments == 1)
                {
                    //得到当前用户请求的页数
                    pageid = DNTRequest.GetInt("page", 1);
                    //获取主题总数
                    //获取总页数
                    pagecount = buyers % pagesize == 0 ? buyers / pagesize : buyers / pagesize + 1;
                    if (pagecount == 0)
                    {
                        pagecount = 1;
                    }
                    //修正请求页数中可能的错误
                    if (pageid < 1)
                    {
                        pageid = 1;
                    }
                    if (pageid > pagecount)
                    {
                        pageid = pagecount;
                    }

                    //获取收入记录并分页显示
                    paymentloglist = PaymentLogs.GetPaymentLogByTid(pagesize, pageid, topic.Tid);
                }

                //判断是否为回复可见帖, hide=0为非回复可见(正常), hide>0为回复可见, hide=-1为回复可见但当前用户已回复
                int hide = 0;
                if (topic.Hide == 1)
                {
                    hide = topic.Hide;
                    if (Posts.IsReplier(topicid, userid))
                    {
                        hide = -1;
                    }
                }

                PostpramsInfo _postpramsinfo = new PostpramsInfo();
                _postpramsinfo.Fid                = forum.Fid;
                _postpramsinfo.Tid                = topicid;
                _postpramsinfo.Jammer             = forum.Jammer;
                _postpramsinfo.Pagesize           = 5;
                _postpramsinfo.Pageindex          = 1;
                _postpramsinfo.Getattachperm      = forum.Getattachperm;
                _postpramsinfo.Usergroupid        = usergroupid;
                _postpramsinfo.Attachimgpost      = config.Attachimgpost;
                _postpramsinfo.Showattachmentpath = config.Showattachmentpath;
                _postpramsinfo.Hide               = hide;
                _postpramsinfo.Price              = price;
                _postpramsinfo.Ubbmode            = false;

                _postpramsinfo.Showimages             = forum.Allowimgcode;
                _postpramsinfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
                _postpramsinfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
                _postpramsinfo.Smiliesmax             = config.Smiliesmax;
                _postpramsinfo.Bbcodemode             = config.Bbcodemode;

                lastpostlist = Posts.GetLastPostList(_postpramsinfo);
            }
            else
            {
                int reval = PaymentLogs.BuyTopic(userid, topic.Tid, topic.Posterid, topic.Price, netamount);
                if (reval > 0)
                {
                    SetUrl(base.ShowTopicAspxRewrite(topic.Tid, 0));

                    SetMetaRefresh();
                    SetShowBackLink(false);
                    AddMsgLine(PURCHASE_SUCCESS);
                    return;
                }
                else
                {
                    SetBackLink(base.ShowForumAspxRewrite(topic.Fid, 0));

                    if (reval == -1)
                    {
                        AddErrLine(NOT_ENOUGH_MONEY);
                        return;
                    }
                    else if (reval == -2)
                    {
                        AddErrLine(NO_PERMISSION);
                        return;
                    }
                    else
                    {
                        AddErrLine(UNKNOWN_REASON);
                        return;
                    }
                }
            }
        }
Beispiel #18
0
        protected override void ShowPage()
        {
            this.pagetitle = "用户控制面板";
            if (!base.IsLogin())
            {
                return;
            }

            var uid = userid;

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

                if (this.page_err == 0)
                {
                    var userInfo = Users.GetUserInfo(uid);
                    //var userInfo2 = (User)userInfo.Clone();
                    var uf = userInfo.Field;
                    this.sig = userInfo.Field.Sightml;
                    //userInfo.ID = uid;
                    userInfo.Name     = this.username;
                    userInfo.NickName = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("nickname")));
                    userInfo.Gender   = DNTRequest.GetInt("gender", 0);

                    uf.RealName = DNTRequest.GetHtmlEncodeString("realname");
                    uf.Idcard   = DNTRequest.GetHtmlEncodeString("idcard");
                    uf.Mobile   = DNTRequest.GetHtmlEncodeString("mobile");
                    uf.Phone    = DNTRequest.GetHtmlEncodeString("phone");

                    var email = DNTRequest.GetHtmlEncodeString("email").Trim().ToLower();
                    if (email != userInfo.Email && !Users.ValidateEmail(email, userInfo.ID))
                    {
                        base.AddErrLine("Email: \"" + userInfo.Email + "\" 已经被其它用户注册使用");
                        return;
                    }
                    userInfo.Email = email;

                    userInfo.Bday      = DNTRequest.GetHtmlEncodeString("bday");
                    userInfo.ShowEmail = DNTRequest.GetInt("showemail", 1) != 0;

                    if (DNTRequest.GetString("website").IndexOf(".") > -1 && !DNTRequest.GetString("website").ToLower().StartsWith("http"))
                    {
                        uf.Website = Utils.HtmlEncode("http://" + DNTRequest.GetString("website"));
                    }
                    else
                    {
                        uf.Website = DNTRequest.GetHtmlEncodeString("website");
                    }
                    uf.Icq      = DNTRequest.GetHtmlEncodeString("icq");
                    uf.qq       = DNTRequest.GetHtmlEncodeString("qq");
                    uf.Yahoo    = DNTRequest.GetHtmlEncodeString("yahoo");
                    uf.Msn      = DNTRequest.GetHtmlEncodeString("msn");
                    uf.Skype    = DNTRequest.GetHtmlEncodeString("skype");
                    uf.Location = DNTRequest.GetHtmlEncodeString("location");
                    uf.Bio      = ForumUtils.BanWordFilter(DNTRequest.GetHtmlEncodeString("bio"));

                    var postpramsInfo = new PostpramsInfo();
                    postpramsInfo.Usergroupid        = this.usergroupid;
                    postpramsInfo.Attachimgpost      = this.config.Attachimgpost;
                    postpramsInfo.Showattachmentpath = this.config.Showattachmentpath;
                    postpramsInfo.Hide                   = 0;
                    postpramsInfo.Price                  = 0;
                    postpramsInfo.Sdetail                = ForumUtils.BanWordFilter(DNTRequest.GetHtmlEncodeString("signature"));
                    postpramsInfo.Smileyoff              = 1;
                    postpramsInfo.BBCode                 = this.usergroupinfo.AllowSigbbCode;
                    postpramsInfo.Parseurloff            = 1;
                    postpramsInfo.Showimages             = this.usergroupinfo.AllowSigimgCode ? 1 : 0;
                    postpramsInfo.Allowhtml              = 0;
                    postpramsInfo.Signature              = 1;
                    postpramsInfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
                    postpramsInfo.Customeditorbuttoninfo = null;
                    postpramsInfo.Smiliesmax             = this.config.Smiliesmax;
                    postpramsInfo.Signature              = 1;

                    uf.Sightml = UBB.UBBToHTML(postpramsInfo);
                    if (this.sig != uf.Sightml)
                    {
                        Sync.UpdateSignature(userInfo.ID, userInfo.Name, uf.Sightml, "");
                    }
                    if (uf.Sightml.Length >= 1000)
                    {
                        base.AddErrLine("您的签名转换后超出系统最大长度, 请返回修改");
                        return;
                    }
                    uf.Signature       = postpramsInfo.Sdetail;
                    userInfo.Sigstatus = ((DNTRequest.GetInt("sigstatus", 0) != 0) ? 1 : 0);
                    //throw new NotImplementedException("CheckModified");
                    ////if (this.CheckModified(userInfo, userInfo2))
                    //{
                    //    //Users.UpdateUserProfile(userInfo2);
                    //    Sync.UpdateProfile(userInfo.ID, userInfo.Name, "");
                    //}
                    userInfo.Save();
                    Sync.UpdateProfile(userInfo.ID, userInfo.Name, "");

                    Online.DeleteUserByUid(userInfo.ID);
                    ForumUtils.WriteCookie("sigstatus", userInfo.Sigstatus.ToString());

                    base.SetUrl("usercpprofile.aspx");
                    base.SetMetaRefresh();
                    base.SetShowBackLink(true);
                    base.AddMsgLine("修改个人档案完毕");
                    return;
                }
            }
            else
            {
                this.pagename += ((String.IsNullOrEmpty(this.action)) ? "" : ("?action=" + this.action));
                var userInfo3 = Users.GetUserInfo(uid);
                this.avatarFlashParam = Utils.GetRootUrl(BaseConfigs.GetForumPath) + "images/common/camera.swf?nt=1&inajax=1&appid=" + (Utils.MD5(userInfo3.Name + userInfo3.Password + userInfo3.ID + this.olid)) + "&input=" + (DES.Encode(uid + "," + this.olid, this.config.Passwordkey)) + "&ucapi=" + (Utils.UrlEncode(Utils.GetRootUrl(BaseConfigs.GetForumPath) + "tools/ajax.ashx"));
                this.avatarImage      = Avatars.GetAvatarUrl(uid);
            }
        }
Beispiel #19
0
        public PostpramsInfo GetPostPramsInfo(int price)
        {
            var pi = new PostpramsInfo();

            pi.Fid                    = this.forum.Fid;
            pi.Tid                    = this.topicid;
            pi.Jammer                 = this.forum.Jammer;
            pi.Pagesize               = this.ppp;
            pi.Pageindex              = this.pageid;
            pi.Getattachperm          = this.forum.Getattachperm;
            pi.Usergroupid            = this.usergroupid;
            pi.Attachimgpost          = this.config.Attachimgpost;
            pi.Showattachmentpath     = this.config.Showattachmentpath;
            pi.Price                  = price;
            pi.Usergroupreadaccess    = ((this.ismoder == 1) ? 0x7FFFFFFF : this.usergroupinfo.Readaccess);
            pi.CurrentUserid          = this.userid;
            pi.Showimages             = this.forum.Allowimgcode;
            pi.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            pi.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            pi.Smiliesmax             = this.config.Smiliesmax;
            pi.Bbcodemode             = this.config.Bbcodemode;
            pi.CurrentUserGroup       = this.usergroupinfo;
            //pi.Topicinfo = this.topic.Cast<TopicInfo>();
            pi.Hide          = ((this.topic.Hide >= 1) ? ((this.ismoder == 1 || Post.IsReplier(this.topicid, this.userid)) ? -1 : this.topic.Hide) : this.topic.Hide);
            pi.Hide          = ((this.topic.PosterID == this.userid) ? -2 : pi.Hide);
            this.hide        = pi.Hide;
            pi.Condition     = Posts.GetPostPramsInfoCondition(this.onlyauthor, this.topicid, this.posterid);
            pi.TemplateWidth = Template.GetWidth(this.templatepath);
            pi.Usercredits   = ((this.userInfo == null) ? 0 : this.userInfo.Credits);
            pi.Invisible     = this.invisible;
            switch (this.stand)
            {
            case 0:
                this.postlist = Posts.GetPostList(pi, out this.attachmentlist, this.ismoder == 1);
                break;

            case 1:
                this.postlist = Debates.GetPositivePostList(pi, out this.attachmentlist, this.ismoder == 1);
                break;

            case 2:
                this.postlist = Debates.GetNegativePostList(pi, out this.attachmentlist, this.ismoder == 1);
                break;
            }
            if (this.topic.Special == 4)
            {
                string text = "";
                foreach (var item in this.postlist)
                {
                    text = text + item.ID + ",";
                }
                var postDiggs = Debates.GetPostDiggs(text.Trim(','));
                foreach (var item in this.postlist)
                {
                    if (postDiggs.ContainsKey(item.ID))
                    {
                        item.Diggs = postDiggs[item.ID];
                    }
                }
            }
            if (this.postlist.Count == 0)
            {
                TopicAdmins.RepairTopicList(this.topicid.ToString());
                this.topic = base.GetTopicInfo();
                this.BindPageCountAndId();
                pi.Pageindex  = this.pagecount;
                this.postlist = Posts.GetPostList(pi, out this.attachmentlist, this.ismoder == 1);
            }
            foreach (var current3 in this.attachmentlist)
            {
                if (Forums.AllowGetAttachByUserID(this.forum.Permuserlist, this.userid))
                {
                    current3.Getattachperm = 1;
                    current3.AllowRead     = true;
                }
            }
            base.BindDownloadAttachmentTip();
            return(pi);
        }