Пример #1
0
        public static int BindAttachment(Attachment[] atts, int topicId, int postId, int userId, UserGroup userGroupInfo)
        {
            int num = 0;

            for (int i = 0; i < atts.Length; i++)
            {
                if (atts[i] != null)
                {
                    if (atts[i].Pid == 0)
                    {
                        num++;
                    }

                    var str = atts[i].ID.ToString();
                    atts[i].Uid          = userId;
                    atts[i].Tid          = topicId;
                    atts[i].Pid          = postId;
                    atts[i].PostDateTime = DateTime.Now;
                    atts[i].ReadPerm     = 0;
                    int num2 = DNTRequest.GetString("attachprice_" + str).ToInt(0);
                    atts[i].AttachPrice = num2 == 0 ? 0 : userGroupInfo.CheckMaxPrice(num2);
                    int num3 = DNTRequest.GetString("readperm_" + str).ToInt(0);
                    if (num3 != 0)
                    {
                        int num4 = num3;
                        num4             = ((num4 > 255) ? 255 : num4);
                        atts[i].ReadPerm = num4;
                    }
                    atts[i].Description = DNTRequest.GetHtmlEncodeString("attachdesc_" + str);
                }
            }
            return(num);
        }
Пример #2
0
        private void SetPageIdAndNumber(String condition)
        {
            //topiccount = Topics.GetTopicCount(condition);
            topiccount = Topic.GetTopicCount(0, true, condition);
            topiccount = ((maxseachnumber > topiccount) ? topiccount : maxseachnumber);
            if (tpp <= 0)
            {
                tpp = config.Tpp;
            }
            if (userid != -1)
            {
                IUser user = BBX.Entity.User.FindByID(userid);
                if (user != null)
                {
                    if (user.Tpp > 0)
                    {
                        tpp = user.Tpp;
                    }
                    if (!user.Newpm)
                    {
                        newpmcount = 0;
                    }
                }
            }
            pagecount = ((topiccount % tpp == 0) ? (topiccount / tpp) : (topiccount / tpp + 1));
            if (pagecount == 0)
            {
                pagecount = 1;
            }
            pageid = ((pageid < 1) ? 1 : pageid);
            pageid = ((pageid > pagecount) ? pagecount : pageid);
            if (pageid * tpp > topiccount)
            {
                tpp -= pageid * tpp - topiccount;
            }
            var search = Request["search"];

            pagenumbers = search.IsNullOrWhiteSpace() ?
                          Utils.GetPageNumbers(pageid, pagecount, string.Format("showtopiclist.aspx?type={0}&newtopic={1}&forumid={2}&forums={3}", type, newtopic, forumid, forums), 8) :
                          Utils.GetPageNumbers(pageid, pagecount, string.Format("showtopiclist.aspx?search=1&type={0}&newtopic={1}&order={2}&direct={3}&forumid={4}&forums={5}", new object[]
            {
                type,
                newtopic,
                DNTRequest.GetHtmlEncodeString("order", true),
                DNTRequest.GetHtmlEncodeString("direct", true),
                forumid,
                forums
            }), 8);
        }
Пример #3
0
        protected override void ShowPage()
        {
            pagetitle = "用户";
            if (config.Memliststatus != 1)
            {
                AddErrLine("系统不允许查看用户列表");
                return;
            }

            orderby = DNTRequest.GetHtmlEncodeString("orderby", true).Trim();
            if (!("uid|username|credits|posts|admin|joindate|lastactivity").Contains(orderby))
            {
                orderby = "";
            }
            //进行参数过滤
            if (!Utils.StrIsNullOrEmpty(orderby) && !Utils.InArray(orderby, "uid,username,credits,posts,admin,joindate,lastactivity"))
            {
                orderby = "uid";
            }

            ordertype = DNTRequest.GetHtmlEncodeString("ordertyp", true).Trim();
            if (!("asc|desc").Contains(ordertype))
            {
                ordertype = "";
            }
            //进行参数过滤
            if (!ordertype.Equals("desc") && !ordertype.Equals("asc"))
            {
                ordertype = "desc";
            }

            totalusers = Users.GetUserCountByAdmin(DNTRequest.GetString("orderby"));

            //获取总页数
            pagecount = totalusers % 20 == 0 ? totalusers / 20 : totalusers / 20 + 1;
            pagecount = pagecount == 0 ? 1 : pagecount;

            //修正请求页数中可能的错误
            pageid = pageid < 1 ? 1 : pageid;
            pageid = pageid > pagecount ? pagecount : pageid;
            //获取当前页主题列表
            userlist = Users.GetUserList(20, pageid, orderby, ordertype);
            //得到页码链接
            pagenumbers = Utils.GetPageNumbers(pageid, pagecount, string.Format("showuser.aspx{0}", string.Format("?orderby={0}&ordertype={1}", orderby, ordertype)), 8);
        }
Пример #4
0
        protected override void ShowPage()
        {
            pagetitle = "用户帐号激活";

            SetUrl("index.aspx");
            SetMetaRefresh();
            SetShowBackLink(false);

            string authStr = DNTRequest.GetHtmlEncodeString("authstr").Trim().Replace("'", "''");

            if (!Utils.StrIsNullOrEmpty(authStr))
            {
                if (Users.UpdateAuthStr(authStr))
                {
                    AddMsgLine("您当前的帐号已经激活,稍后您将以相应身份返回首页");

                    OnlineUsers.UpdateAction(olid, UserAction.ActivationUser.ActionID, 0, config.Onlinetimeout);
                    return;
                }
            }
            AddMsgLine("您当前的激活链接无效,稍后您将以游客身份返回首页");
            OnlineUsers.DeleteRows(olid);
            ForumUtils.ClearUserCookie();
        }
Пример #5
0
 protected override void ShowPage()
 {
     this.pagetitle = "用户";
     if (this.config.Memliststatus != 1)
     {
         base.AddErrLine("系统不允许查看用户列表");
         return;
     }
     this.orderby = DNTRequest.GetHtmlEncodeString("orderby", true).Trim();
     if (!"id|name|credits|posts|adminid|joindate|lastactivity".Contains(this.orderby))
     {
         this.orderby = "";
     }
     if (!this.orderby.IsNullOrEmpty() && !Utils.InArray(this.orderby, "id,name,credits,posts,adminid,joindate,lastactivity"))
     {
         this.orderby = "id";
     }
     this.ordertype = DNTRequest.GetHtmlEncodeString("ordertype", true).Trim();
     if (!"asc|desc".Contains(this.ordertype))
     {
         this.ordertype = "";
     }
     if (!this.ordertype.Equals("desc") && !this.ordertype.Equals("asc"))
     {
         this.ordertype = "desc";
     }
     //this.totalusers = Users.GetUserCountByAdmin(DNTRequest.GetString("orderby"));
     this.totalusers = XUser.Meta.Count;
     this.pagecount  = ((this.totalusers % 20 == 0) ? (this.totalusers / 20) : (this.totalusers / 20 + 1));
     this.pagecount  = ((this.pagecount == 0) ? 1 : this.pagecount);
     this.pageid     = ((this.pageid < 1) ? 1 : this.pageid);
     this.pageid     = ((this.pageid > this.pagecount) ? this.pagecount : this.pageid);
     //this.userlist = Users.GetUserList(20, this.pageid, this.orderby, this.ordertype);
     this.userlist    = XUser.GetUserList(20, this.pageid, this.orderby, this.ordertype);
     this.pagenumbers = Utils.GetPageNumbers(this.pageid, this.pagecount, string.Format("showuser.aspx{0}", string.Format("?orderby={0}&ordertype={1}", this.orderby, this.ordertype)), 8);
 }
Пример #6
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);
        }
Пример #7
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);
            }
        }
Пример #8
0
        protected override void ShowPage()
        {
            pagetitle = string.Format("激活{0}", config.Spacename);

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

            UserInfo user = Users.GetUserInfo(userid);

            if (config.Enablespace != 1)
            {
                AddErrLine(string.Format("{0}功能已被关闭", config.Spacename));
                return;
            }

            bool isactivespace = false;
            bool isallowapply  = true;

            if (user.Spaceid > 0)
            {
                isactivespace = true;
            }
            else
            {
                if (user.Spaceid < 0)
                {
                    isallowapply = false;
                }
                else
                {
                    if (spaceactiveconfig.AllowPostcount == "1" || spaceactiveconfig.AllowDigestcount == "1" ||
                        spaceactiveconfig.AllowScore == "1" || spaceactiveconfig.AllowUsergroups == "1")
                    {
                        if (spaceactiveconfig.AllowPostcount == "1")
                        {
                            isallowapply = isallowapply && (Convert.ToInt32(spaceactiveconfig.Postcount) <= user.Posts);
                        }
                        if (spaceactiveconfig.AllowDigestcount == "1")
                        {
                            isallowapply = isallowapply &&
                                           (Convert.ToInt32(spaceactiveconfig.Digestcount) <= user.Digestposts);
                        }
                        if (spaceactiveconfig.AllowScore == "1")
                        {
                            isallowapply = isallowapply && (Convert.ToInt32(spaceactiveconfig.Score) <= user.Credits);
                        }
                        if (spaceactiveconfig.AllowUsergroups == "1")
                        {
                            isallowapply = isallowapply &&
                                           (("," + spaceactiveconfig.Usergroups + ",").IndexOf("," + user.Groupid + ",") !=
                                            -1);
                        }
                    }
                    else
                    {
                        isallowapply = false;
                    }
                }
            }

            if (isactivespace)
            {
                AddErrLine("您已经申请过个人空间!");
                return;
            }
            if (!isallowapply)
            {
                AddErrLine("您未被允许申请个人空间!");
                return;
            }

            if (DNTRequest.IsPost())
            {
                if (ForumUtils.IsCrossSitePost())
                {
                    AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                    return;
                }
                if (DNTRequest.GetString("spacetitle").Length > 100)
                {
                    AddErrLine("个人空间标题不得超过100个字符");
                    return;
                }
                if (DNTRequest.GetString("description").Length > 200)
                {
                    AddErrLine("个人空间描述不得超过200个字符");
                    return;
                }
                if (DNTRequest.GetInt("bpp", 0) == 0)
                {
                    AddErrLine("显示日志篇数必需是一个大于0的数字");
                    return;
                }

                if (page_err == 0)
                {
                    DataRow dr = DbProvider.GetInstance().GetThemes();
                    spaceconfiginfo                = new SpaceConfigInfo();
                    spaceconfiginfo.UserID         = userid;
                    spaceconfiginfo.Spacetitle     = DNTRequest.GetHtmlEncodeString("spacetitle");
                    spaceconfiginfo.Description    = DNTRequest.GetHtmlEncodeString("description");
                    spaceconfiginfo.BlogDispMode   = DNTRequest.GetInt("blogdispmode", 0);
                    spaceconfiginfo.Bpp            = DNTRequest.GetInt("bpp", 0);
                    spaceconfiginfo.Commentpref    = DNTRequest.GetInt("commentpref", 0);
                    spaceconfiginfo.MessagePref    = DNTRequest.GetInt("messagepref", 0);
                    spaceconfiginfo.UpdateDateTime = spaceconfiginfo.CreateDateTime = DateTime.Now;
                    string rewritename = DNTRequest.GetFormString("rewritename").Trim();
                    if (rewritename != string.Empty)
                    {
                        if (Globals.CheckSpaceRewriteNameAvailable(rewritename) == 0)
                        {
                            spaceconfiginfo.Rewritename = rewritename;
                        }
                        else
                        {
                            AddErrLine("您输入的 个性域名 不可用或含有非法字符");
                            return;
                        }
                    }
                    else
                    {
                        spaceconfiginfo.Rewritename = "";
                    }

                    spaceconfiginfo.ThemeID      = int.Parse(dr["themeid"].ToString());
                    spaceconfiginfo.ThemePath    = dr["directory"].ToString();
                    spaceconfiginfo.PostCount    = 0;
                    spaceconfiginfo.CommentCount = 0;
                    spaceconfiginfo.VisitedTimes = 0;
                    spaceconfiginfo.DefaultTab   = 0;

                    string errorinfo = "";
                    int    blogid    = DbProvider.GetInstance().AddSpaceConfigData(spaceconfiginfo);
                    Users.UpdateUserSpaceId(-blogid, userid);

                    SpaceActiveConfigInfo _spaceconfiginfo = SpaceActiveConfigs.GetConfig();
                    if (_spaceconfiginfo.ActiveType == "0")
                    {
                        if (errorinfo == "")
                        {
                            SetUrl("index.aspx");
                            SetMetaRefresh();
                            SetShowBackLink(true);
                            AddMsgLine("您的申请已经提交,请等待管理员开通您的个人空间");
                        }
                        else
                        {
                            AddErrLine(errorinfo);
                            return;
                        }
                    }
                    else
                    {
                        Discuz.Data.DatabaseProvider.GetInstance().UpdateUserSpaceId(userid);
                        int     tabid = Spaces.GetNewTabId(userid);
                        TabInfo tab   = new TabInfo();
                        tab.TabID        = tabid;
                        tab.UserID       = userid;
                        tab.DisplayOrder = 0;
                        tab.TabName      = "首页";
                        tab.IconFile     = "";
                        tab.Template     = "template_25_75.htm";
                        Spaces.AddTab(tab);
                        Spaces.AddLocalModule("builtin_calendarmodule.xml", userid, tabid, 1);
                        Spaces.AddLocalModule("builtin_statisticmodule.xml", userid, tabid, 1);
                        Spaces.AddLocalModule("builtin_postlistmodule.xml", userid, tabid, 2);
                        if (SpaceActiveConfigs.GetConfig().Spacegreeting != string.Empty)
                        {
                            SpacePostInfo spacepostsinfo = new SpacePostInfo();
                            spacepostsinfo.Title          = string.Format("欢迎使用 {0} 个人空间", config.Forumtitle);
                            spacepostsinfo.Content        = SpaceActiveConfigs.GetConfig().Spacegreeting;
                            spacepostsinfo.Category       = string.Empty;
                            spacepostsinfo.PostStatus     = 1;
                            spacepostsinfo.CommentStatus  = 0;
                            spacepostsinfo.Postdatetime   = DateTime.Now;
                            spacepostsinfo.Author         = username;
                            spacepostsinfo.Uid            = userid;
                            spacepostsinfo.PostUpDateTime = DateTime.Now;
                            spacepostsinfo.Commentcount   = 0;
                            DbProvider.GetInstance().AddSpacePost(spacepostsinfo);
                        }

                        ///添加最新主题到日志
                        List <TopicInfo> list = Topics.GetTopicsByUserId(userid, 1, config.Topictoblog, 0, 0);
                        foreach (TopicInfo mytopic in list)
                        {
                            int      pid  = Posts.GetFirstPostId(mytopic.Tid);
                            PostInfo post = Posts.GetPostInfo(mytopic.Tid, pid);
                            if (post != null && post.Message.Trim() != string.Empty)
                            {
                                SpacePostInfo spacepost = new SpacePostInfo();
                                spacepost.Author = username;
                                string content = Posts.GetPostMessageHTML(post, new AttachmentInfo[0]);
                                spacepost.Category       = "";
                                spacepost.Content        = content;
                                spacepost.Postdatetime   = DateTime.Now;
                                spacepost.PostStatus     = 1;
                                spacepost.PostUpDateTime = DateTime.Now;
                                spacepost.Title          = post.Title;
                                spacepost.Uid            = userid;
                                DbProvider.GetInstance().AddSpacePost(spacepost);
                            }
                        }
                        SetUrl("space/");
                        SetMetaRefresh();
                        SetShowBackLink(true);
                        AddMsgLine("恭喜您,您的个人空间已经被开通");
                    }
                }
            }
            else
            {
                spaceconfiginfo = BlogProvider.GetSpaceConfigInfo(userid);
            }
        }
Пример #9
0
        /// <summary>
        /// 设置分页信息
        /// </summary>
        private void SetPageIdAndNumber()
        {
            //设置查询条件
            //SetCondition();
            //获取主题总数
            topiccount = Topics.GetTopicCount(condition);

            //防止查询数超过系统规定的最大值
            topiccount = maxseachnumber > topiccount ? topiccount : maxseachnumber;

            if (tpp <= 0)
            {
                tpp = config.Tpp;
            }

            //得到用户设置的每页显示主题数
            if (userid != -1)
            {
                ShortUserInfo userinfo = Users.GetShortUserInfo(userid);
                if (userinfo != null)
                {
                    if (userinfo.Tpp > 0)
                    {
                        tpp = userinfo.Tpp;
                    }

                    if (userinfo.Newpm == 0)
                    {
                        newpmcount = 0;
                    }
                }
            }

            //获取总页数
            pagecount = topiccount % tpp == 0 ? topiccount / tpp : topiccount / tpp + 1;
            if (pagecount == 0)
            {
                pagecount = 1;
            }

            //修正请求页数中可能的错误
            pageid = pageid < 1 ? 1 : pageid;
            pageid = pageid > pagecount ? pagecount : pageid;

            //如果当前页面的返回结果超过系统规定的的范围时,则进行相应删剪
            if ((pageid * tpp) > topiccount)
            {
                tpp = tpp - (pageid * tpp - topiccount);
            }

            //得到页码链接
            pagenumbers = Utils.StrIsNullOrEmpty(DNTRequest.GetString("search")) ?
                          Utils.GetPageNumbers(pageid, pagecount, string.Format("showtopiclist.aspx?type={0}&newtopic={1}&forumid={2}&forums={3}", type, newtopic, forumid, forums), 8) :
                          Utils.GetPageNumbers(pageid, pagecount, string.Format("showtopiclist.aspx?search=1&type={0}&newtopic={1}&order={2}&direct={3}&forumid={4}&forums={5}",
                                                                                type, newtopic, DNTRequest.GetHtmlEncodeString("order", true), DNTRequest.GetHtmlEncodeString("direct", true), forumid, forums), 8);
        }
Пример #10
0
        protected override void ShowPage()
        {
            pagetitle = "用户控制面板";

            if (userid == -1)
            {
                AddErrLine("你尚未登录");
                return;
            }
            user = Users.GetUserInfo(userid);

            if (config.Enablealbum != 1)
            {
                AddErrLine("相册功能已被关闭");
                return;
            }
            if (albumid < 1)
            {
                AddErrLine("指定的相册不存在");
                return;
            }
            AlbumInfo albuminfo = DTOProvider.GetAlbumInfo(albumid);

            if (this.userid != albuminfo.Userid)
            {
                AddErrLine("您无权限在该相册内添加照片");
                return;
            }

            enabletag     = config.Enabletag == 1;
            freephotosize = UserGroups.GetUserGroupInfo(usergroupid).Maxspacephotosize - Data.DbProvider.GetInstance().GetPhotoSizeByUserid(userid);
            albumname     = albuminfo.Title;

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

                HttpFileCollection files = HttpContext.Current.Request.Files;
                int imgcount             = 0;

                for (int iFile = 0; iFile < files.Count; iFile++)
                {
                    HttpPostedFile postedFile = files[iFile];
                    if (postedFile == null || postedFile.FileName == "")
                    {
                        continue;
                    }
                    string fileName, fileExtension;
                    fileName      = Path.GetFileName(postedFile.FileName);
                    fileExtension = Path.GetExtension(fileName).ToLower();
                    if (fileExtension != ".jpg" && fileExtension != ".gif" && fileExtension != ".png" && fileExtension != ".jpeg")
                    {
                        continue;
                    }

                    //判断用户是否达到了照片最大上传数
                    int filesize = postedFile.ContentLength;
                    if (freephotosize < filesize)
                    {
                        AddErrLine("照片上传空间数已满,某些照片不能再上传!<br />如果想继续上传,请删除以前旧照片!");
                        return;
                    }
                    string    phototitle     = Utils.HtmlEncode(DNTRequest.GetFormString("phototitle" + (iFile + 1)));
                    PhotoInfo spacephotoinfo = new PhotoInfo();
                    spacephotoinfo.Title   = Utils.StrIsNullOrEmpty(phototitle) ? fileName.Remove(fileName.IndexOf("."), 1) : phototitle;
                    spacephotoinfo.Albumid = albumid;
                    spacephotoinfo.Userid  = userid;
                    string[] currentdate = DateTime.Now.ToString("yyyy-MM-dd").Split('-');
                    string   uploaddir   = "";

                    //当支持FTP上传远程照片
                    if (FTPs.GetAlbumAttachInfo.Allowupload == 1)
                    {
                        //当不保留本地附件模式时
                        if (FTPs.GetAlbumAttachInfo.Reservelocalattach == 0)
                        {
                            uploaddir = Utils.GetMapPath(BaseConfigs.GetForumPath + "space/upload/temp/");
                        }
                        else
                        {
                            uploaddir = Utils.GetMapPath(BaseConfigs.GetForumPath + "space/upload/" + currentdate[0] + "/" + currentdate[1] + "/" + currentdate[2] + "/");
                        }

                        if (!Directory.Exists(uploaddir))
                        {
                            Utils.CreateDir(uploaddir);
                        }

                        string ftpfilename = Globals.UploadSpaceFile(postedFile, uploaddir, true);
                        spacephotoinfo.Filename = FTPs.GetAlbumAttachInfo.Remoteurl + "/" + currentdate[0] + "/" + currentdate[1] + "/" + currentdate[2] + "/" + ftpfilename;

                        FTPs ftps = new FTPs();
                        ftps.UpLoadFile("/" + currentdate[0] + "/" + currentdate[1] + "/" + currentdate[2] + "/",
                                        uploaddir + ftpfilename,
                                        FTPs.FTPUploadEnum.AlbumAttach);
                        ftps = new FTPs();
                        ftps.UpLoadFile("/" + currentdate[0] + "/" + currentdate[1] + "/" + currentdate[2] + "/",
                                        uploaddir + Globals.GetThumbnailImage(ftpfilename),
                                        FTPs.FTPUploadEnum.AlbumAttach);
                        ftps = new FTPs();
                        ftps.UpLoadFile("/" + currentdate[0] + "/" + currentdate[1] + "/" + currentdate[2] + "/",
                                        uploaddir + Globals.GetSquareImage(ftpfilename),
                                        FTPs.FTPUploadEnum.AlbumAttach);
                    }
                    else
                    {
                        uploaddir = Utils.GetMapPath(BaseConfigs.GetForumPath + "space/upload/" + currentdate[0] + "/" + currentdate[1] + "/" + currentdate[2] + "/");
                        if (!Directory.Exists(uploaddir))
                        {
                            Utils.CreateDir(uploaddir);
                        }

                        spacephotoinfo.Filename = "space/upload/" + currentdate[0] + "/" + currentdate[1] + "/" + currentdate[2] + "/" + Globals.UploadSpaceFile(postedFile, uploaddir, true);
                    }

                    spacephotoinfo.Attachment   = fileName;
                    spacephotoinfo.Description  = Utils.HtmlEncode(DNTRequest.GetFormString("description" + (iFile + 1)));
                    spacephotoinfo.Filesize     = filesize;
                    spacephotoinfo.Username     = username;
                    spacephotoinfo.IsAttachment = 0;
                    freephotosize -= filesize;
                    int      photoid   = Data.DbProvider.GetInstance().AddSpacePhoto(spacephotoinfo);
                    string   tags      = DNTRequest.GetHtmlEncodeString("phototag" + (iFile + 1)).Trim();
                    string[] tagsArray = null;
                    if (enabletag && tags != string.Empty)
                    {
                        tagsArray = Utils.SplitString(tags, " ", true, 10);
                        if (tagsArray.Length > 0)
                        {
                            Data.DbProvider.GetInstance().CreatePhotoTags(string.Join(" ", tagsArray), photoid, userid, Utils.GetDateTime());
                            AlbumTags.WritePhotoTagsCacheFile(photoid);
                        }
                    }
                    imgcount++;
                }
                if (imgcount != 0)
                {
                    AlbumInfo albumInfo = DTOProvider.GetAlbumInfo(albumid);
                    albumInfo.Imgcount = Data.DbProvider.GetInstance().GetSpacePhotoCountByAlbumId(albumid);
                    Data.DbProvider.GetInstance().SaveSpaceAlbum(albumInfo);
                }
                else
                {
                    AddErrLine("没有符合要求的图片,请上传jpg,jpeg,gif,png格式的图片");
                    return;
                }

                //生成json数据
                Albums.CreateAlbumJsonData(albumid);
                Albums.CreatePhotoImageByAlbum(albumid);

                SetUrl(string.Format("usercpspacemanagephoto.aspx?albumid={0}", albumid));
                SetMetaRefresh();
                SetShowBackLink(true);
                AddMsgLine("照片增加完毕");
            }
        }
Пример #11
0
        protected override void ShowPage()
        {
            pagetitle = "用户控制面板";

            if (userid == -1)
            {
                AddErrLine("你尚未登录");
                return;
            }
            user = Users.GetUserInfo(userid);
            if (config.Enablespace != 1)
            {
                AddErrLine("个人空间功能已被关闭");
                return;
            }

            if (user.Spaceid <= 0)
            {
                AddErrLine("您尚未开通个人空间");
                return;
            }

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

                string linktitle = DNTRequest.GetHtmlEncodeString("linktitle");
                if ((linktitle.Length > 50) || (linktitle == ""))
                {
                    AddErrLine("链接标题不得超过50个字符且不能为空");
                    return;
                }

                string linkurl = DNTRequest.GetHtmlEncodeString("linkurl");
                if ((linkurl.Length > 255) || (linkurl == ""))
                {
                    AddErrLine("链接地址不得超过255个字符且不能为空");
                    return;
                }

                if (DNTRequest.GetString("description").Length > 200)
                {
                    AddErrLine("链接描述不得超过200个字符");
                    return;
                }

                string        errorinfo       = "";
                SpaceLinkInfo __spacelinkinfo = new SpaceLinkInfo();
                __spacelinkinfo.UserId      = userid;
                __spacelinkinfo.LinkTitle   = linktitle;
                __spacelinkinfo.LinkUrl     = linkurl;
                __spacelinkinfo.Description = DNTRequest.GetHtmlEncodeString("description");

                Space.Data.DbProvider.GetInstance().AddSpaceLink(__spacelinkinfo);

                if (errorinfo == "")
                {
                    SetUrl("usercpspacelinklist.aspx");
                    SetMetaRefresh();
                    SetShowBackLink(true);
                    AddMsgLine("添加友情链接完毕");
                }
                else
                {
                    AddErrLine(errorinfo);
                    return;
                }
            }
        }
Пример #12
0
        public void SendPM()
        {
            if (pm == null)
            {
                pm = new ShortMessage();
            }

            if (this.useradminid == 1)
            {
                this.pm.Message = DNTRequest.GetHtmlEncodeString("message");
                this.pm.Subject = DNTRequest.GetHtmlEncodeString("subject");
            }
            else
            {
                this.pm.Message = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("message")));
                this.pm.Subject = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("subject")));
            }
            if (this.useradminid != 1 && (ForumUtils.HasBannedWord(this.pm.Message) || ForumUtils.HasBannedWord(this.pm.Subject) || ForumUtils.HasAuditWord(this.pm.Message) || ForumUtils.HasAuditWord(this.pm.Subject)))
            {
                string arg = (ForumUtils.GetBannedWord(this.pm.Message) == string.Empty) ? ForumUtils.GetBannedWord(this.pm.Subject) : ForumUtils.GetBannedWord(this.pm.Message);
                base.AddErrLine(string.Format("对不起, 您提交的内容包含不良信息 <font color=\"red\">{0}</font>, 因此无法提交, 请返回修改!", arg));
                return;
            }
            string text = "," + Users.GetUserInfo(this.msgtoid).Ignorepm + ",";

            if (text.IndexOf("{ALL}") >= 0 || text.IndexOf("," + this.username + ",") >= 0)
            {
                base.AddErrLine("短消息发送失败!");
                return;
            }
            this.pm.Message   = ForumUtils.BanWordFilter(this.pm.Message);
            this.pm.Subject   = ForumUtils.BanWordFilter(this.pm.Subject);
            this.pm.Msgto     = DNTRequest.GetString("msgto");
            this.pm.MsgtoID   = this.msgtoid;
            this.pm.Msgfrom   = this.username;
            this.pm.MsgfromID = this.userid;
            if (!Utils.StrIsNullOrEmpty(DNTRequest.GetString("savetousercpdraftbox")))
            {
                this.CreatePM(2, 0, "usercpdraftbox.aspx", "已将消息保存到草稿箱");
                return;
            }
            if (!Utils.StrIsNullOrEmpty(DNTRequest.GetString("savetosentbox")))
            {
                this.CreatePM(0, 1, "usercpsentbox.aspx", "发送完毕, 且已将消息保存到发件箱");
            }
            else
            {
                this.CreatePM(0, 0, "usercpinbox.aspx", "发送完毕");
            }
            if (!base.IsErr())
            {
                Online.UpdatePostPMTime(this.olid);
                //int olidByUid = OnlineUsers.GetOlidByUid(this.pm.MsgtoID);
                //if (olidByUid > 0)
                var entity = Online.FindByUserID(pm.MsgtoID);
                if (entity != null)
                {
                    Users.UpdateUserNewPMCount(this.pm.MsgtoID, entity.ID);
                }
            }
        }
Пример #13
0
        protected override void ShowPage()
        {
            pagetitle = "编辑图片信息";

            #region 验证
            if (userid == -1)
            {
                AddErrLine("请先登录");
                return;
            }
            user = Users.GetUserInfo(userid);
            if (config.Enablealbum != 1)
            {
                AddErrLine("相册功能已被关闭");
                return;
            }
            if (photoid < 1)
            {
                AddErrLine("不存在的图片Id");
                return;
            }
            photo = DTOProvider.GetPhotoInfo(photoid, 0, 0);
            if (photo == null)
            {
                AddErrLine("图片不存在");
                return;
            }
            if (photo.Userid != userid)
            {
                AddErrLine("您没有编辑此图片的权限");
                return;
            }
            #endregion

            if (!DNTRequest.IsPost())
            {
                photo.Filename = Globals.GetThumbnailImage(photo.Filename);
                commentstatus  = (int)photo.Commentstatus;
                tagstatus      = (int)photo.Tagstatus;
                tags           = AlbumTags.GetTagsByPhotoId(photoid);
            }
            else
            {
                photo.Title       = DNTRequest.GetHtmlEncodeString("title");
                photo.Description = DNTRequest.GetHtmlEncodeString("description");

                if (commentstatus < 0 || commentstatus > 2)
                {
                    commentstatus = 2;
                }

                photo.Commentstatus = (PhotoStatus)commentstatus;

                string   newtags   = DNTRequest.GetHtmlEncodeString("phototag").Trim();
                string[] tagsArray = null;
                if (config.Enabletag == 1 && newtags != string.Empty && newtags != tags)
                {
                    tagsArray = Utils.SplitString(newtags, " ", true, 10);
                    if (tagsArray.Length > 0 && string.Join(" ", tagsArray) != tags)
                    {
                        DbProvider.GetInstance().DeletePhotoTags(photoid);
                        DbProvider.GetInstance().CreatePhotoTags(string.Join(" ", tagsArray), photoid, userid, Utils.GetDateTime());
                        AlbumTags.WritePhotoTagsCacheFile(photoid);
                    }
                }

                DTOProvider.UpdatePhotoInfo(photo);

                //生成json数据
                Albums.CreateAlbumJsonData(photo.Albumid);
                //生成图片标题
                Albums.CreatePhotoTitleImage(photo.Photoid, photo.Title);
                //生成用户名图片
                Albums.CreateUserImage(photo.Userid, photo.Username);

                AddMsgLine("图片信息修改成功, 将返回图片列表");
                SetUrl("usercpspacemanagephoto.aspx?albumid=" + photo.Albumid);
                SetMetaRefresh();
            }
        }
Пример #14
0
        /// <summary>
        /// 创建并发送短消息
        /// </summary>
        public void SendPM()
        {
            #region 创建并发送短消息

            // 收件箱
            if (useradminid == 1)
            {
                pm.Message = DNTRequest.GetHtmlEncodeString("message");
                pm.Subject = DNTRequest.GetHtmlEncodeString("subject");
            }
            else
            {
                pm.Message = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("message")));
                pm.Subject = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("subject")));
            }

            if (useradminid != 1 && (ForumUtils.HasBannedWord(pm.Message) || ForumUtils.HasBannedWord(pm.Subject) || ForumUtils.HasAuditWord(pm.Message) || ForumUtils.HasAuditWord(pm.Subject)))
            {
                string bannedWord = ForumUtils.GetBannedWord(pm.Message) == string.Empty ? ForumUtils.GetBannedWord(pm.Subject) : ForumUtils.GetBannedWord(pm.Message);
                AddErrLine(string.Format("对不起, 您提交的内容包含不良信息 <font color=\"red\">{0}</font>, 因此无法提交, 请返回修改!", bannedWord));
                return;
            }
            string Ignorepm = "," + Users.GetUserInfo(msgtoid).Ignorepm + ",";
            //禁止所有用户或当前用户在忽略列表内时
            if (Ignorepm.IndexOf("{ALL}") >= 0 || Ignorepm.IndexOf("," + username + ",") >= 0)
            {
                AddErrLine("短消息发送失败!");
                return;
            }

            pm.Message      = ForumUtils.BanWordFilter(pm.Message);
            pm.Subject      = ForumUtils.BanWordFilter(pm.Subject);
            pm.Msgto        = DNTRequest.GetString("msgto");
            pm.Msgtoid      = msgtoid;
            pm.Msgfrom      = username;
            pm.Msgfromid    = userid;
            pm.New          = 1;
            pm.Postdatetime = Utils.GetDateTime();

            // 只将消息保存到草稿箱
            if (!Utils.StrIsNullOrEmpty(DNTRequest.GetString("savetousercpdraftbox")))
            {
                CreatePM(2, 0, "usercpdraftbox.aspx", "已将消息保存到草稿箱");
                return;
            }
            else if (!Utils.StrIsNullOrEmpty(DNTRequest.GetString("savetosentbox")))// 发送消息且保存到发件箱
            {
                CreatePM(0, 1, "usercpsentbox.aspx", "发送完毕, 且已将消息保存到发件箱");
            }
            else// 发送消息但不保存到发件箱
            {
                CreatePM(0, 0, "usercpinbox.aspx", "发送完毕");
            }

            if (!IsErr())
            {
                // 更新在线表中的用户最后发帖时间
                OnlineUsers.UpdatePostPMTime(olid);

                //为在线用户更新短消息数
                int targetolid = OnlineUsers.GetOlidByUid(pm.Msgtoid);
                if (targetolid > 0)
                {
                    Users.UpdateUserNewPMCount(pm.Msgtoid, targetolid);
                }
            }
            #endregion
        }
Пример #15
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 = Users.GetUserInfo(userid);
            if (config.Enablespace != 1)
            {
                AddErrLine("个人空间功能已被关闭");
                return;
            }

            if (user.Spaceid <= 0)
            {
                AddErrLine("您尚未开通个人空间");
                return;
            }

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

                string title = DNTRequest.GetHtmlEncodeString("title");
                if ((title.Length > 50) || (title == ""))
                {
                    AddErrLine("分类名称不得超过50个字符且不能为空");
                    return;
                }
                if (DNTRequest.GetString("description").Length > 1000)
                {
                    AddErrLine("分类描述不得超过1000个字符");
                    return;
                }
                if (!Utils.IsNumeric(DNTRequest.GetString("displayorder")))
                {
                    AddErrLine("分类描述序号必须为数字");
                    return;
                }

                SpaceCategoryInfo __spacecategoryinfo = new SpaceCategoryInfo();
                __spacecategoryinfo.Title        = title;
                __spacecategoryinfo.Description  = DNTRequest.GetHtmlEncodeString("description");
                __spacecategoryinfo.Displayorder = Convert.ToInt32(DNTRequest.GetString("displayorder"));
                __spacecategoryinfo.Uid          = userid;
                Space.Data.DbProvider.GetInstance().AddSpaceCategory(__spacecategoryinfo);

                SetUrl("usercpspacemanagecategory.aspx");
                SetMetaRefresh();
                SetShowBackLink(true);
                AddMsgLine("添加日志分类完毕");
            }
        }
Пример #17
0
        protected override void ShowPage()
        {
            pagetitle = "用户控制面板";
            if (userid == -1)
            {
                AddErrLine("你尚未登录");
                return;
            }

            user = Users.GetUserInfo(userid);
            if (config.Enablespace != 1)
            {
                AddErrLine("个人空间功能已被关闭");
                return;
            }
            if (user.Spaceid <= 0)
            {
                AddErrLine("您尚未开通个人空间");
                return;
            }

            if (DNTRequest.IsPost())
            {
                if (ForumUtils.IsCrossSitePost())
                {
                    AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                    return;
                }
                if (DNTRequest.GetString("spacetitle").Length > 100)
                {
                    AddErrLine("BLOG标题不得超过100个字符");
                    return;
                }
                if (DNTRequest.GetString("_description").Length > 200)
                {
                    AddErrLine("空间描述不得超过200个字符");
                    return;
                }

                if (page_err == 0)
                {
                    spaceconfiginfo              = BlogProvider.GetSpaceConfigInfo(userid);
                    spaceconfiginfo.UserID       = userid;
                    spaceconfiginfo.Spacetitle   = DNTRequest.GetHtmlEncodeString("spacetitle");
                    spaceconfiginfo.Description  = DNTRequest.GetHtmlEncodeString("_description");
                    spaceconfiginfo.BlogDispMode = DNTRequest.GetInt("blogdispmode", 0);
                    spaceconfiginfo.Bpp          = DNTRequest.GetInt("bpp", 0);
                    spaceconfiginfo.Commentpref  = DNTRequest.GetInt("commentpref", 0);
                    spaceconfiginfo.MessagePref  = DNTRequest.GetInt("messagepref", 0);

                    if (spaceactiveconfig.Enablespacerewrite == 1)
                    {
                        string rewritename = DNTRequest.GetFormString("rewritename").Trim();

                        if (!Utils.StrIsNullOrEmpty(rewritename))
                        {
                            if (Globals.CheckSpaceRewriteNameAvailable(rewritename) == 0)
                            {
                                Space.Data.DbProvider.GetInstance().UpdateUserSpaceRewriteName(userid, rewritename);
                            }
                            else
                            {
                                AddErrLine("您输入的 个性域名 不可用或含有非法字符");
                                return;
                            }
                        }
                    }

                    string errorinfo = "";
                    Space.Data.DbProvider.GetInstance().SaveSpaceConfigData(spaceconfiginfo);
                    if (errorinfo == "")
                    {
                        SetShowBackLink(true);
                        AddMsgLine("个人空间基本设置完毕");
                    }
                    else
                    {
                        AddErrLine(errorinfo);
                        return;
                    }
                }
            }
            else
            {
                spaceconfiginfo = BlogProvider.GetSpaceConfigInfo(userid);
            }
        }
Пример #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);
            }
        }
Пример #19
0
        /// <summary>
        /// 设置页码链接
        /// </summary>
        private void SetPageNumber()
        {
            if (DNTRequest.GetString("search") == "")
            {
                if (topictypeid == -1)
                {
                    if (config.Aspxrewrite == 1)
                    {
                        if (Utils.StrIsNullOrEmpty(filter))
                        {
                            if (config.Iisurlrewrite == 0)
                            {
                                pagenumbers = Utils.GetStaticPageNumbers(pageid, pagecount, (Utils.StrIsNullOrEmpty(forum.Rewritename) ? "showforum-" + forumid : forumpath + forum.Rewritename), config.Extname, 8, (!Utils.StrIsNullOrEmpty(forum.Rewritename) ? 1 : 0));
                            }
                            else
                            {
                                pagenumbers = Utils.GetStaticPageNumbers(pageid, pagecount, (Utils.StrIsNullOrEmpty(forum.Rewritename) ? "showforum-" + forumid : forumpath + forum.Rewritename), config.Extname, 8, (!Utils.StrIsNullOrEmpty(forum.Rewritename) ? 2 : 0));
                            }

                            if (pageid < pagecount)
                            {
                                nextpage = string.Format("<a href=\"{0}{1}\" class=\"next\">下一页</a>", forumpath, Urls.ShowForumAspxRewrite(forumid, pageid + 1, forum.Rewritename));
                            }
                        }
                        else
                        {
                            pagenumbers = Utils.GetPageNumbers(pageid, pagecount, string.Format("{0}showforum.aspx?forumid={1}&filter={2}", forumpath, forumid, filter), 8);

                            if (pageid < pagecount)
                            {
                                nextpage = string.Format("<a href=\"{0}showforum.aspx?forumid={1}&filter={2}&page={3}\" class=\"next\">下一页</a>", forumpath, forumid, filter, pageid + 1);
                            }
                        }
                    }
                    else
                    {
                        pagenumbers = Utils.GetPageNumbers(pageid, pagecount, string.Format("{0}showforum.aspx?forumid={1}{2}", forumpath, forumid, (Utils.StrIsNullOrEmpty(filter) ? "" : "&filter=" + filter)), 8);

                        if (pageid < pagecount)
                        {
                            nextpage = string.Format("<a href=\"{0}showforum.aspx?forumid={1}{2}&page={3}\" class=\"next\">下一页</a>", forumpath, forumid, (Utils.StrIsNullOrEmpty(filter) ? "" : "&filter=" + filter), pageid + 1);
                        }
                    }
                }
                else //当有主题类型条件时
                {
                    pagenumbers = Utils.GetPageNumbers(pageid, pagecount, string.Format("{0}showforum.aspx?forumid={1}&typeid={2}{3}",
                                                                                        forumpath, forumid, topictypeid, (Utils.StrIsNullOrEmpty(filter) ? "" : "&filter=" + filter)), 8);

                    if (pageid < pagecount)
                    {
                        nextpage = string.Format("<a href=\"{0}showforum.aspx?forumid={1}&typeid={2}{3}&page={4}\" class=\"next\">下一页</a>", forumpath, forumid, topictypeid, (Utils.StrIsNullOrEmpty(filter) ? "" : "&filter=" + filter), pageid + 1);
                    }
                }
            }
            else
            {
                pagenumbers = Utils.GetPageNumbers(pageid, pagecount, string.Format("{0}showforum.aspx?search=1&cond={1}&order={2}&direct={3}&forumid={4}&interval={5}&typeid={6}{7}",
                                                                                    forumpath, DNTRequest.GetHtmlEncodeString("cond").Trim(), order, direct, forumid, interval,
                                                                                    topictypeid, (Utils.StrIsNullOrEmpty(filter) ? "" : "&filter=" + filter)), 8);

                if (pageid < pagecount)
                {
                    nextpage = string.Format("<a href=\"{0}showforum.aspx?search=1&cond={1}&order={2}&direct={3}&forumid={4}&interval={5}&typeid={6}{7}&page={8}\" class=\"next\">下一页</a>",
                                             forumpath, DNTRequest.GetHtmlEncodeString("cond").Trim(), order, direct,
                                             forumid, interval, topictypeid, (Utils.StrIsNullOrEmpty(filter) ? "" : "&filter=" + filter), pageid + 1);
                }
            }
        }
Пример #20
0
 private void SetPageNumber()
 {
     if (String.IsNullOrEmpty(DNTRequest.GetString("search")))
     {
         if (this.topictypeid == -1)
         {
             if (this.config.Aspxrewrite == 1)
             {
                 if (this.filter.IsNullOrEmpty())
                 {
                     if (this.config.Iisurlrewrite == 0)
                     {
                         this.pagenumbers = Utils.GetStaticPageNumbers(this.pageid, this.pagecount, this.forum.Rewritename.IsNullOrEmpty() ? ("showforum-" + this.forumid) : (this.forumpath + this.forum.Rewritename), this.config.Extname, 8, (!this.forum.Rewritename.IsNullOrEmpty()) ? 1 : 0);
                     }
                     else
                     {
                         this.pagenumbers = Utils.GetStaticPageNumbers(this.pageid, this.pagecount, this.forum.Rewritename.IsNullOrEmpty() ? ("showforum-" + this.forumid) : (this.forumpath + this.forum.Rewritename), this.config.Extname, 8, (!this.forum.Rewritename.IsNullOrEmpty()) ? 2 : 0);
                     }
                     if (this.pageid < this.pagecount)
                     {
                         this.nextpage = string.Format("<a href=\"{0}{1}\" class=\"next\">下一页</a>", this.forumpath, Urls.ShowForumAspxRewrite(this.forumid, this.pageid + 1, this.forum.Rewritename));
                         return;
                     }
                 }
                 else
                 {
                     this.pagenumbers = Utils.GetPageNumbers(this.pageid, this.pagecount, string.Format("{0}showforum.aspx?forumid={1}&filter={2}", this.forumpath, this.forumid, this.filter), 8);
                     if (this.pageid < this.pagecount)
                     {
                         this.nextpage = string.Format("<a href=\"{0}showforum.aspx?forumid={1}&filter={2}&page={3}\" class=\"next\">下一页</a>", new object[]
                         {
                             this.forumpath,
                             this.forumid,
                             this.filter,
                             this.pageid + 1
                         });
                         return;
                     }
                 }
             }
             else
             {
                 this.pagenumbers = Utils.GetPageNumbers(this.pageid, this.pagecount, string.Format("{0}showforum.aspx?forumid={1}{2}", this.forumpath, this.forumid, this.filter.IsNullOrEmpty() ? "" : ("&filter=" + this.filter)), 8);
                 if (this.pageid < this.pagecount)
                 {
                     this.nextpage = string.Format("<a href=\"{0}showforum.aspx?forumid={1}{2}&page={3}\" class=\"next\">下一页</a>", new object[]
                     {
                         this.forumpath,
                         this.forumid,
                         this.filter.IsNullOrEmpty() ? "" : ("&filter=" + this.filter),
                         this.pageid + 1
                     });
                     return;
                 }
             }
         }
         else
         {
             this.pagenumbers = Utils.GetPageNumbers(this.pageid, this.pagecount, string.Format("{0}showforum.aspx?forumid={1}&typeid={2}{3}", new object[]
             {
                 this.forumpath,
                 this.forumid,
                 this.topictypeid,
                 this.filter.IsNullOrEmpty() ? "" : ("&filter=" + this.filter)
             }), 8);
             if (this.pageid < this.pagecount)
             {
                 this.nextpage = string.Format("<a href=\"{0}showforum.aspx?forumid={1}&typeid={2}{3}&page={4}\" class=\"next\">下一页</a>", new object[]
                 {
                     this.forumpath,
                     this.forumid,
                     this.topictypeid,
                     this.filter.IsNullOrEmpty() ? "" : ("&filter=" + this.filter),
                     this.pageid + 1
                 });
                 return;
             }
         }
     }
     else
     {
         this.pagenumbers = Utils.GetPageNumbers(this.pageid, this.pagecount, string.Format("{0}showforum.aspx?search=1&cond={1}&order={2}&direct={3}&forumid={4}&interval={5}&typeid={6}{7}", new object[]
         {
             this.forumpath,
             DNTRequest.GetHtmlEncodeString("cond").Trim(),
             this.order,
             this.direct,
             this.forumid,
             this.interval,
             this.topictypeid,
             this.filter.IsNullOrEmpty() ? "" : ("&filter=" + this.filter)
         }), 8);
         if (this.pageid < this.pagecount)
         {
             this.nextpage = string.Format("<a href=\"{0}showforum.aspx?search=1&cond={1}&order={2}&direct={3}&forumid={4}&interval={5}&typeid={6}{7}&page={8}\" class=\"next\">下一页</a>", new object[]
             {
                 this.forumpath,
                 DNTRequest.GetHtmlEncodeString("cond").Trim(),
                 this.order,
                 this.direct,
                 this.forumid,
                 this.interval,
                 this.topictypeid,
                 this.filter.IsNullOrEmpty() ? "" : ("&filter=" + this.filter),
                 this.pageid + 1
             });
         }
     }
 }