public void SubmitButton_Click(object sender, EventArgs e)
        {
            bool err = false;

            for (int i = 1; i <= fileList.Count; i++)
            {
                if (DNTRequest.GetFormString("id" + i) != "")
                {
                    try
                    {
                        if (!Utils.IsNumeric(DNTRequest.GetInt("typeid", 0)))
                        {
                            err = true;
                            continue;
                        }
                        AdminForums.CreateSmilies(DNTRequest.GetFormInt("order" + i, 0), DNTRequest.GetInt("typeid", 0), DNTRequest.GetFormString("code" + i), DNTRequest.GetFormString("url" + i),
                                                  userid, username, usergroupid, grouptitle, ip);
                    }
                    catch
                    {
                        base.RegisterStartupScript("", "<script>alert('出现错误,可能文件超出长度!');window.location.href='forum_smilegrid.aspx?typeid=" + DNTRequest.GetInt("typeid", 0) + "';</script>");
                    }
                }
            }
            base.RegisterStartupScript("", "<script>" + (err ? "alert('增加的记录中某个显示顺序是非数字,该记录未能增加!');" : "") + "window.location.href='forum_smilegrid.aspx?typeid=" + DNTRequest.GetInt("typeid", 0) + "';</script>");
        }
 private void GetFromData(NavInfo nav)
 {
     nav.Name         = GetMaxlengthString(DNTRequest.GetFormString("name"), 50);
     nav.Title        = GetMaxlengthString(DNTRequest.GetFormString("title"), 255);
     nav.Url          = GetMaxlengthString(DNTRequest.GetFormString("url"), 255);
     nav.Target       = DNTRequest.GetFormInt("target", 0);
     nav.Available    = DNTRequest.GetFormInt("available", 0);
     nav.Displayorder = DNTRequest.GetFormInt("displayorder", 0);
     nav.Level        = DNTRequest.GetFormInt("level", 0);
 }
Exemplo n.º 3
0
        private void ModifyAlbumInfo()
        {
            string errorinfo = "";
            string id        = DNTRequest.GetFormString("albumid");

            if (id == "0")
            {
                AlbumInfo albumInfo = new AlbumInfo();
                albumInfo.Userid      = userid;
                albumInfo.Username    = username;
                albumInfo.Albumcateid = DNTRequest.GetFormInt("albumcate", 0);
                albumInfo.Title       = Utils.HtmlEncode(DNTRequest.GetFormString("albumtitle"));
                albumInfo.Description = Utils.HtmlEncode(DNTRequest.GetFormString("albumdescription"));
                albumInfo.Password    = DNTRequest.GetFormString("password");
                albumInfo.Type        = DNTRequest.GetFormInt("type", 0);
                Data.DbProvider.GetInstance().AddSpaceAlbum(albumInfo);
            }
            else
            {
                AlbumInfo albumInfo = DTOProvider.GetAlbumInfo(Convert.ToInt32(id));
                if (albumInfo.Userid != userid)
                {
                    AddErrLine("您所编辑的相册不存在");
                    return;
                }
                albumInfo.Title       = Utils.HtmlEncode(DNTRequest.GetFormString("albumtitle"));
                albumInfo.Albumcateid = DNTRequest.GetFormInt("albumcate", 0);
                albumInfo.Description = Utils.HtmlEncode(DNTRequest.GetFormString("albumdescription"));
                albumInfo.Password    = DNTRequest.GetFormString("password");
                albumInfo.Type        = DNTRequest.GetFormInt("type", 0);
                Data.DbProvider.GetInstance().SaveSpaceAlbum(albumInfo);
            }
            if (errorinfo == "")
            {
                SetUrl(string.Format("usercpspacemanagealbum.aspx?page={0}", DNTRequest.GetInt("page", 1)));
                SetMetaRefresh();
                SetShowBackLink(true);
                if (id == "0")
                {
                    AddMsgLine("相册增加成功");
                }
                else
                {
                    AddMsgLine("相册修改成功");
                }
                return;
            }
            else
            {
                AddErrLine(errorinfo);
                return;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 是否是来自应用程序的登出
        /// </summary>
        /// <returns></returns>
        private bool IsApplicationLogout()
        {
            if (!APIConfigs.GetConfig().Enable)
            {
                return(false);
            }

            if (DNTRequest.GetFormInt("confirm", -1) != 1)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DataGrid1.DataKeyField = "id";
            string menuid = DNTRequest.GetString("menuid");
            string mode   = DNTRequest.GetString("mode");

            if (mode != "")
            {
                if (mode == "del")
                {
                    Nav.Delete(Nav._.ID == DNTRequest.GetQueryInt("id", 0));
                    Response.Redirect(Request.Path + (DNTRequest.GetString("parentid") != "" ? "?parentid=" + DNTRequest.GetString("parentid") : ""), true);
                }
                else
                {
                    if (String.IsNullOrEmpty(DNTRequest.GetFormString("name").Trim()) ||
                        String.IsNullOrEmpty(DNTRequest.GetFormString("displayorder").Trim()) ||
                        DNTRequest.GetFormInt("displayorder", 0) > Int16.MaxValue)
                    {
                        this.RegisterStartupScript("", "<script type='text/javascript'>alert('名称或序号输入不合法。');window.location=window.location;</script>");
                        return;
                    }
                    if (menuid == "0")
                    {
                        Nav nav = new Nav();
                        nav.ParentID = DNTRequest.GetQueryInt("parentid", 0);
                        GetFromData(nav);
                        //Nav.Insert(nav);
                        nav.Insert();
                    }
                    else
                    {
                        Nav nav = new Nav();
                        nav = Nav.Find(Nav._.ID == DNTRequest.GetFormInt("menuid", 0));
                        GetFromData(nav);
                        Nav.Update(nav);
                    }
                    Response.Redirect(Request.RawUrl, true);
                }
            }
            else
            {
                BindDataGrid(DNTRequest.GetQueryInt("parentid", 0));
                if (String.IsNullOrEmpty(DNTRequest.GetString("parentid")))
                {
                    returnbutton.Visible = false;
                }
            }
        }
Exemplo n.º 6
0
        private void DoBanUserOperation()
        {
            this.ispost = false;
            if (this.usergroupinfo.ReasonPm == 1 && Utils.StrIsNullOrEmpty(DNTRequest.GetString("reason")))
            {
                this.titlemessage = true;
                base.AddErrLine("请填写操作原因");
                return;
            }
            int    formInt = DNTRequest.GetFormInt("banexpirynew", -1);
            string text    = (formInt == 0) ? "29990101" : string.Format("{0:yyyyMMdd}", DateTime.Now.AddDays((double)formInt));
            string title;
            string actions;

            switch (DNTRequest.GetInt("bantype", -1))
            {
            case 0:
                Users.UpdateBanUser(CreditsFacade.GetCreditsUserGroupId((float)this.operateduser.Credits).ID, "0", this.operateduid);
                title   = string.Format("取消对 <a href=\"../../userinfo-{1}.aspx\" target=\"_blank\">{0}</a> 的禁止", this.operatedusername, this.operateduid);
                actions = "取消禁止";
                break;

            case 1:
                Users.UpdateBanUser(4, text, this.operateduid);
                title   = string.Format("禁止 <a href=\"../../userinfo-{1}.aspx\" target=\"_blank\">{0}</a> 发言", this.operatedusername, this.operateduid);
                actions = "禁止发言";
                break;

            case 2:
                Users.UpdateBanUser(5, text, this.operateduid);
                title   = string.Format("禁止 <a href=\"../../userinfo-{1}.aspx\" target=\"_blank\">{0}</a> 访问", this.operatedusername, this.operateduid);
                actions = "禁止访问";
                break;

            default:
                this.titlemessage = true;
                base.AddErrLine("错误的禁止类型");
                return;
            }
            ModeratorManageLog.Add(userid, username, usergroupid, usergroupinfo.GroupTitle, 0, "", 0, title, actions, DNTRequest.GetString("reason").Trim());
            this.ispost = true;
            base.SetShowBackLink(false);
            base.SetUrl(Utils.UrlDecode(ForumUtils.GetReUrl()));
            base.SetMetaRefresh();
            base.MsgForward("useradmin_succeed", true);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 是否是来自应用程序的登出
        /// </summary>
        /// <returns></returns>
        private bool IsApplicationLogout()
        {
            APIConfigInfo apiconfig = APIConfigs.GetConfig();

            if (!apiconfig.Enable)
            {
                return(false);
            }

            int confirm = DNTRequest.GetFormInt("confirm", -1);

            if (confirm != 1)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 设置BackLink
        /// </summary>
        private void SetBackLink()
        {
            StringBuilder builder = new StringBuilder();

            foreach (string key in System.Web.HttpContext.Current.Request.QueryString.AllKeys)
            {
                //if (key != "postusername")
                if (!string.IsNullOrEmpty(key) && !Utils.InArray(key, "postusername"))
                {
                    builder.AppendFormat("&{0}={1}", key, DNTRequest.GetQueryString(key));
                }
            }
            question = DNTRequest.GetFormInt("question", 0);
            if (question > 0)
            {
                builder.AppendFormat("&question={0}", question);
            }
            base.SetBackLink("login.aspx?postusername="******"username")) + builder);
        }
Exemplo n.º 9
0
        private void SetBackLink()
        {
            var stringBuilder = new StringBuilder();

            string[] allKeys = HttpContext.Current.Request.QueryString.AllKeys;
            for (int i = 0; i < allKeys.Length; i++)
            {
                string text = allKeys[i];
                if (!string.IsNullOrEmpty(text) && !Utils.InArray(text, "postusername"))
                {
                    stringBuilder.AppendFormat("&{0}={1}", text, DNTRequest.GetQueryString(text));
                }
            }
            this.question = DNTRequest.GetFormInt("question", 0);
            if (this.question > 0)
            {
                stringBuilder.AppendFormat("&question={0}", this.question);
            }
            base.SetBackLink("login.aspx?postusername="******"username")) + stringBuilder);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsFounderUid(userid))
            {
                Response.Write(base.GetShowMessage());
                Response.End();
                return;
            }
            if (!string.IsNullOrEmpty(DNTRequest.GetString("accout")))
            {
                TestAccout(DNTRequest.GetString("accout"));
            }
            if (IsPostBack)
            {
                configInfo.Alipayaccout     = DNTRequest.GetFormString("alipayaccount");
                configInfo.Cashtocreditrate = DNTRequest.GetFormInt("cashtocreditsrate", 0);

                int mincreditstobuy = DNTRequest.GetFormInt("mincreditstobuy", 0);
                //如果现金/积分兑换比率为0,则表示不开启积分充值功能
                if (configInfo.Cashtocreditrate > 0)
                {
                    //为了保证生成的订单价格最低价格为0.1元,则需要根据现金和积分兑换比率来动态调整积分最少购买数量的值
                    while ((decimal)mincreditstobuy / (decimal)configInfo.Cashtocreditrate < 0.10M)
                    {
                        mincreditstobuy++;
                    }
                }

                configInfo.Mincreditstobuy           = mincreditstobuy;
                configInfo.Maxcreditstobuy           = DNTRequest.GetFormInt("maxcreditstobuy", 0);
                configInfo.Userbuycreditscountperday = DNTRequest.GetFormInt("userbuycreditscountperday", 0);
                configInfo.Alipaypartnercheckkey     = DNTRequest.GetFormString("alipaypartnercheckkey");
                configInfo.Alipaypartnerid           = DNTRequest.GetFormString("alipaypartnerid");
                configInfo.Usealipaycustompartnerid  = DNTRequest.GetFormInt("usealipaycustompartnerid", 1);
                configInfo.Usealipayinstantpay       = DNTRequest.GetFormInt("usealipayinstantpay", 0);

                GeneralConfigs.SaveConfig(configInfo);
                GeneralConfigs.ResetConfig();
                base.RegisterStartupScript("PAGE", "window.location.href='global_screditset.aspx';");
            }
        }
Exemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsFounderUid(this.userid))
            {
                base.Response.Write(base.GetShowMessage());
                base.Response.End();
                return;
            }
            if (!string.IsNullOrEmpty(Request["accout"]))
            {
                this.TestAccout(Request["accout"]);
            }
            if (base.IsPostBack)
            {
                this.configInfo.Alipayaccout     = DNTRequest.GetFormString("alipayaccount");
                this.configInfo.Cashtocreditrate = DNTRequest.GetFormInt("cashtocreditsrate", 0);
                int num = DNTRequest.GetFormInt("mincreditstobuy", 0);
                if (this.configInfo.Cashtocreditrate > 0)
                {
                    while (num / this.configInfo.Cashtocreditrate < 0.10m)
                    {
                        num++;
                    }
                }
                this.configInfo.Mincreditstobuy           = num;
                this.configInfo.Maxcreditstobuy           = DNTRequest.GetFormInt("maxcreditstobuy", 0);
                this.configInfo.Userbuycreditscountperday = DNTRequest.GetFormInt("userbuycreditscountperday", 0);
                this.configInfo.Alipaypartnercheckkey     = DNTRequest.GetFormString("alipaypartnercheckkey");
                this.configInfo.Alipaypartnerid           = DNTRequest.GetFormString("alipaypartnerid");
                this.configInfo.Usealipaycustompartnerid  = DNTRequest.GetFormInt("usealipaycustompartnerid", 1);
                this.configInfo.Usealipayinstantpay       = DNTRequest.GetFormInt("usealipayinstantpay", 0);

                //GeneralConfigs.SaveConfig(this.configInfo);
                //GeneralConfigs.ResetConfig();
                configInfo.Save();
                GeneralConfigInfo.Current = null;
                base.RegisterStartupScript("PAGE", "window.location.href='global_screditset.aspx';");
            }
        }
Exemplo n.º 12
0
        protected override void ShowPage()
        {
            pagetitle = "用户控制面板";

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

            user = Users.GetUserInfo(userid);

            if (config.Enablealbum != 1)
            {
                AddErrLine("相册功能已被关闭");
                return;
            }

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

                if (DNTRequest.GetFormString("albumcate") == "")
                {
                    AddErrLine("请选择相册分类");
                    return;
                }
                if (DNTRequest.GetFormString("albumtitle") == "")
                {
                    AddErrLine("相册名称不能为空");
                    return;
                }
                if (DNTRequest.GetFormInt("type", 0) == 1 && DNTRequest.GetFormString("password") == string.Empty)
                {
                    AddErrLine("私人相册密码不能为空");
                    return;
                }

                ModifyAlbumInfo();
                return;
            }

            if (DNTRequest.GetString("mod") == "delete")
            {
                DeleteAlbumInfo();
                ispost = true;
                return;
            }
            if (DNTRequest.GetString("mod") == "edit")
            {
                LoadAlbumInfo();
            }

            if (DNTRequest.GetString("albumid") != "")
            {
                albumid = DNTRequest.GetInt("albumid", 0);
            }

            //获取主题总数
            albumcount = Data.DbProvider.GetInstance().GetSpaceAlbumsCount(userid);
            //获取总页数
            pagecount = albumcount % pagesize == 0 ? albumcount / pagesize : albumcount / pagesize + 1;
            if (pagecount == 0)
            {
                pagecount = 1;
            }

            //修正请求页数中可能的错误
            if (pageid < 1)
            {
                pageid = 1;
            }
            if (pageid > pagecount)
            {
                pageid = pagecount;
            }

            //获取相册分页记录数并显示
            albumInfoArray = Data.DbProvider.GetInstance().SpaceAlbumsList(pagesize, pageid, userid);
            foreach (DataRow singleAlbumInfo in albumInfoArray.Rows)
            {
                if (singleAlbumInfo["Logo"].ToString().IndexOf("http") < 0)
                {
                    if (singleAlbumInfo["Logo"].ToString().Trim() == "")
                    {
                        singleAlbumInfo["Logo"] = defaultLogo;
                    }
                    else
                    {
                        singleAlbumInfo["Logo"] = IsExistsLog(singleAlbumInfo["Logo"].ToString());
                    }
                }

                singleAlbumInfo["Title"] = singleAlbumInfo["Title"].ToString().Trim().Replace("\"", "&quot;").Replace("'", "&#39;");
            }
            pagenumbers   = Utils.GetPageNumbers(pageid, pagecount, "usercpspacemanagealbum.aspx", 8);
            allownewalbum = int.Parse(AlbumConfigs.GetConfig().MaxAlbumCount) - albumcount > 0;
            if (DNTRequest.GetString("mod") == "edit")
            {
                allownewalbum = true;
            }
        }
Exemplo n.º 13
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;
            }
            enabletag = config.Enabletag == 1;

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

                if (!Utils.IsNumeric(DNTRequest.GetString("poststatus")) ||
                    !Utils.IsNumeric(DNTRequest.GetString("commentstatus")))
                {
                    AddErrLine("请您确保: 发布类型, 评论类型 数据项有效!");
                    return;
                }
                if (DNTRequest.GetString("title") == "")
                {
                    AddErrLine("请您输入文章标题");
                    return;
                }
                if (DNTRequest.GetString("title").Length > 150)
                {
                    AddErrLine("请将文章标题保持在150字以内");
                    return;
                }
                if (blogcontent == "")
                {
                    AddErrLine("请您输入文章内容");
                    return;
                }
                int postid = DNTRequest.GetInt("postid", 0);
                if (postid == 0)
                {
                    AddErrLine("请正确选择文章");
                    return;
                }
                spacepostsinfo = BlogProvider.GetSpacepostsInfo(Space.Data.DbProvider.GetInstance().GetSpacePost(postid));
                if (spacepostsinfo == null || spacepostsinfo.Uid != userid)
                {
                    AddErrLine("您选择文章不存在");
                    return;
                }
                spacepostsinfo.Title          = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("title")));
                spacepostsinfo.Content        = Utils.HtmlEncode(ForumUtils.BanWordFilter(blogcontent));
                spacepostsinfo.Category       = DNTRequest.GetString("category");
                spacepostsinfo.PostStatus     = DNTRequest.GetFormInt("poststatus", 0);
                spacepostsinfo.CommentStatus  = DNTRequest.GetFormInt("commentstatus", 0);
                spacepostsinfo.PostUpDateTime = DateTime.Now;

                string errorinfo = "";
                Space.Data.DbProvider.GetInstance().SaveSpacePost(spacepostsinfo);
                if (enabletag)
                {
                    SpaceTags.DeleteSpacePostTags(spacepostsinfo.Postid);
                    string   tags      = DNTRequest.GetString("tags").Trim();
                    string[] tagsArray = null;
                    if (tags != string.Empty)
                    {
                        tagsArray = Utils.SplitString(tags, " ", true, 10);
                        if (tagsArray != null && tagsArray.Length > 0)
                        {
                            Space.Data.DbProvider.GetInstance().CreateSpacePostTags(string.Join(" ", tagsArray), postid, userid, Utils.GetDateTime());
                            SpaceTags.WriteSpacePostTagsCacheFile(postid);
                        }
                    }
                }

                DNTCache.GetCacheService().RemoveObject("/Space/RecentUpdateSpaceAggregationList");
                if (errorinfo == "")
                {
                    SetUrl("usercpspacemanageblog.aspx");
                    SetMetaRefresh();
                    SetShowBackLink(true);

                    AddMsgLine("文章修改成功");
                }
                else
                {
                    AddErrLine(errorinfo);
                    return;
                }
            }
            else
            {
                int postid = DNTRequest.GetInt("postid", 0);
                if (postid == 0)
                {
                    AddErrLine("请正确选择文章");
                    return;
                }
                categoryslist  = Space.Data.DbProvider.GetInstance().GetSpaceCategoryListByUserId(userid);
                spacepostsinfo = BlogProvider.GetSpacepostsInfo(Space.Data.DbProvider.GetInstance().GetSpacePost(postid));
                if (spacepostsinfo == null || spacepostsinfo.Uid != userid)
                {
                    AddErrLine("您选择文章不存在");
                    return;
                }
                categoryslist.Columns.Add(new DataColumn("checked", Type.GetType("System.Int32")));
                foreach (DataRow dr in categoryslist.Rows)
                {
                    dr["checked"] =
                        ("," + spacepostsinfo.Category + ",").IndexOf("," + dr["categoryid"].ToString() + ",");
                }
                blogcontent = spacepostsinfo.Content.Replace("'", "\"");

                if (enabletag)
                {
                    List <TagInfo> tags = SpaceTags.GetTagsListBySpacePost(spacepostsinfo.Postid);

                    foreach (TagInfo tag in tags)
                    {
                        if (tag.Orderid > -1)
                        {
                            spaceposttags += string.Format(" {0}", tag.Tagname);
                        }
                    }
                    spaceposttags = spaceposttags.Trim();
                }
            }
        }
Exemplo n.º 14
0
 private bool IsApplicationLogout()
 {
     return(APIConfigInfo.Current.Enable && DNTRequest.GetFormInt("confirm", -1) == 1);
 }
Exemplo n.º 15
0
        /// <summary>
        /// 设置相关主题信息
        /// </summary>
        /// <param name="pollitem"></param>
        /// <param name="topicprice"></param>
        /// <param name="postmessage"></param>
        private void SetTopicInfo(string[] pollitem, int topicprice, string postmessage)
        {
            if (postinfo.Layer == 0)
            {
                ///修改投票信息
                StringBuilder itemvaluelist = new StringBuilder("");
                if (topic.Special == 1)
                {
                    string pollItemname = Utils.HtmlEncode(DNTRequest.GetFormString("PollItemname").Trim());

                    if (!Utils.StrIsNullOrEmpty(pollItemname))
                    {
                        int multiple   = DNTRequest.GetString("multiple") == "on" ? 1 : 0;
                        int maxchoices = DNTRequest.GetInt("maxchoices", 0);

                        if (multiple == 1 && maxchoices > pollitem.Length)
                        {
                            maxchoices = pollitem.Length;
                        }

                        if (!Polls.UpdatePoll(topic.Tid, multiple, pollitem.Length, DNTRequest.GetFormString("PollOptionID").Trim(), pollItemname, DNTRequest.GetFormString("PollOptionDisplayOrder").Trim(), DNTRequest.GetString("enddatetime"), maxchoices, DNTRequest.GetString("visiblepoll") == "on" ? 1 : 0, DNTRequest.GetString("allowview") == "on" ? 1 : 0))
                        {
                            AddErrLine("投票错误,请检查显示顺序");
                            return;
                        }
                    }
                    else
                    {
                        AddErrLine("投票项为空");
                        return;
                    }
                }

                //修改辩论信息
                if (topic.Special == 4)
                {
                    debateinfo.Positiveopinion = DNTRequest.GetString("positiveopinion");
                    debateinfo.Negativeopinion = DNTRequest.GetString("negativeopinion");
                    debateinfo.Terminaltime    = TypeConverter.StrToDateTime(DNTRequest.GetString("terminaltime"));
                    if (!Debates.UpdateDebateTopic(debateinfo))
                    {
                        AddErrLine("辩论修改选择了无效的主题");
                        return;
                    }
                }

                int iconid = DNTRequest.GetInt("iconid", 0);
                topic.Iconid = (iconid > 15 || iconid < 0) ? 0 : iconid;
                topic.Title  = postinfo.Title;

                //悬赏差价处理
                if (topic.Special == 2)
                {
                    int pricediff = topicprice - topic.Price;
                    if (pricediff > 0)
                    {
                        if (bonusCreditsTrans < 1 || bonusCreditsTrans > 8)
                        {
                            AddErrLine("系统未设置\"交易积分设置\", 无法判断当前要使用的(扩展)积分字段, 暂时无法发布悬赏"); return;
                        }
                        //扣分
                        if (usergroupinfo.Radminid != 1 && Users.GetUserExtCredits(topic.Posterid, bonusCreditsTrans) < pricediff)
                        {
                            AddErrLine("主题作者 " + Scoresets.GetValidScoreName()[bonusCreditsTrans] + " 不足, 无法追加悬赏");
                            return;
                        }
                        else
                        {
                            topic.Price = topicprice;
                            Users.UpdateUserExtCredits(topic.Posterid, bonusCreditsTrans,
                                                       -pricediff * (Scoresets.GetCreditsTax() + 1)); //计算税后的实际支付
                        }
                    }
                    else if (pricediff < 0 && usergroupinfo.Radminid != 1)
                    {
                        AddErrLine("不能降低悬赏价格");
                        return;
                    }
                }
                else if (topic.Special == 0)//普通主题,出售
                {
                    topic.Price = topicprice;
                }
                if (usergroupinfo.Allowsetreadperm == 1)
                {
                    topic.Readperm = DNTRequest.GetInt("topicreadperm", 0) > 255 ? 255 : DNTRequest.GetInt("topicreadperm", 0);
                }

                if (ForumUtils.IsHidePost(postmessage) && usergroupinfo.Allowhidecode == 1)
                {
                    topic.Hide = 1;
                }

                topic.Typeid = DNTRequest.GetFormInt("typeid", 0);

                htmltitle = DNTRequest.GetString("htmltitle").Trim();
                if (!Utils.StrIsNullOrEmpty(htmltitle) && Utils.HtmlDecode(htmltitle).Trim() != topic.Title)
                {
                    //按照  附加位/htmltitle(1位)/magic(3位)/以后扩展(未知位数) 的方式来存储,  11001
                    topic.Magic = 11000;
                }
                else
                {
                    topic.Magic = 0;
                }

                topic.Displayorder = Topics.GetTitleDisplayOrder(usergroupinfo, useradminid, forum, topic, message, disablepostctrl);

                ForumTags.DeleteTopicTags(topic.Tid);
                Topics.DeleteRelatedTopics(topic.Tid);
                string tags = DNTRequest.GetString("tags").Trim();
                if (enabletag && !Utils.StrIsNullOrEmpty(tags))
                {
                    if (ForumUtils.InBanWordArray(tags))
                    {
                        AddErrLine("标签中含有系统禁止词语,请修改");
                        return;
                    }

                    string[] tagArray = Utils.SplitString(tags, " ", true, 2, 10);
                    if (tagArray.Length > 0 && tagArray.Length <= 5)
                    {
                        topic.Magic = Topics.SetMagicValue(topic.Magic, MagicType.TopicTag, 1);
                        ForumTags.CreateTopicTags(tagArray, topic.Tid, userid, Utils.GetDateTime());
                    }
                    else
                    {
                        AddErrLine("超过标签数的最大限制或单个标签长度没有介于2-10之间,最多可填写 5 个标签");
                        return;
                    }
                }

                Topics.UpdateTopic(topic);

                //保存htmltitle
                if (canhtmltitle && !Utils.StrIsNullOrEmpty(htmltitle) && htmltitle != topic.Title)
                {
                    Topics.WriteHtmlTitleFile(Utils.RemoveUnsafeHtml(htmltitle), topic.Tid);
                }
            }
            else
            {
                if (ForumUtils.IsHidePost(postmessage) && usergroupinfo.Allowhidecode == 1)
                {
                    topic.Hide = 1;
                    Topics.UpdateTopic(topic);
                }
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// 获得帖子评分列表
        /// </summary>
        public void GetRateLogList()
        {
            System.Text.StringBuilder xmlnode = new System.Text.StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");

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

            try
            {
                List <RateLogInfo> rateList = Posts.GetPostRateLogList(DNTRequest.GetFormInt("pid", 0));
                if (rateList == null || rateList.Count == 0)
                {
                    xmlnode.Append("<error>该帖没有评分记录</error>");
                    ResponseXML(xmlnode);
                    return;
                }
                xmlnode.Append("<data>\r\n");

                List <RateLogInfo> finalRateList = new List <RateLogInfo>();

                //该循环用于将评分列表中多次评分用户的分值聚合成一条数据
                foreach (RateLogInfo info in rateList)
                {
                    Predicate <RateLogInfo> match         = new Predicate <RateLogInfo>(delegate(RateLogInfo rateLog) { return(rateLog.Uid == info.Uid && rateLog.ExtCredits == info.ExtCredits); });
                    RateLogInfo             finalRateInfo = finalRateList.Find(match);
                    if (finalRateInfo == null)
                    {
                        finalRateList.Add(info);
                    }
                    else
                    {
                        finalRateInfo.Score += info.Score;
                        finalRateInfo.Reason = string.IsNullOrEmpty(finalRateInfo.Reason) ? info.Reason : finalRateInfo.Reason;
                    }
                }

                string[] scorename = Scoresets.GetValidScoreName();
                string[] scoreunit = Scoresets.GetValidScoreUnit();

                int uidCount     = 0;
                int previoursUid = 0;
                foreach (RateLogInfo rate in finalRateList)
                {
                    if (previoursUid != rate.Uid)
                    {
                        uidCount++;
                    }
                    xmlnode.Append("<ratelog>");
                    xmlnode.AppendFormat("\r\n\t<rateid>{0}</rateid>", rate.Id);
                    xmlnode.AppendFormat("\r\n\t<uid>{0}</uid>", rate.Uid);
                    xmlnode.AppendFormat("\r\n\t<username>{0}</username>", rate.UserName.Trim());
                    xmlnode.AppendFormat("\r\n\t<extcredits>{0}</extcredits>", rate.ExtCredits);
                    xmlnode.AppendFormat("\r\n\t<extcreditsname>{0}</extcreditsname>", scorename[rate.ExtCredits]);
                    xmlnode.AppendFormat("\r\n\t<extcreditsunit>{0}</extcreditsunit>", scoreunit[rate.ExtCredits]);
                    xmlnode.AppendFormat("\r\n\t<postdatetime>{0}</postdatetime>", ForumUtils.ConvertDateTime(rate.PostDateTime));
                    xmlnode.AppendFormat("\r\n\t<score>{0}</score>", rate.Score > 0 ? ("+" + rate.Score.ToString()) : rate.Score.ToString());
                    xmlnode.AppendFormat("\r\n\t<reason>{0}</reason>", rate.Reason.Trim());
                    xmlnode.Append("\r\n</ratelog>\r\n");
                    previoursUid = rate.Uid;
                }
                xmlnode.Append("</data>");

                ResponseXML(xmlnode);
                if (DNTRequest.GetFormInt("ratetimes", 0) != uidCount)
                {
                    Posts.UpdatePostRateTimes(DNTRequest.GetFormInt("tid", 0), DNTRequest.GetFormInt("pid", 0).ToString());
                }
            }
            catch //添加try语法, 以防止在并发情况下, 服务器端远程链接被关闭后出现应用程序 '警告'(事件查看器)
            {
                System.Web.HttpContext.Current.Response.Clear();
                System.Web.HttpContext.Current.Response.Expires = 0;
                System.Web.HttpContext.Current.Response.Cache.SetNoStore();
                System.Web.HttpContext.Current.Response.End();
            }
        }
Exemplo n.º 17
0
        private void DoBanUserOperation()
        {
            ispost = false;
            string actions = "";
            string title   = "";

            //判断后台是否设置必须输入理由, 0-不需要 1-必须
            if (usergroupinfo.Reasonpm == 1 && Utils.StrIsNullOrEmpty(DNTRequest.GetString("reason")))
            {
                titlemessage = true;
                AddErrLine("请填写操作原因");
                return;
            }
            int    banexpirynew = DNTRequest.GetFormInt("banexpirynew", -1);
            string expday       = (banexpirynew == 0) ? "29990101" : string.Format("{0:yyyyMMdd}", DateTime.Now.AddDays(banexpirynew));

            switch (DNTRequest.GetInt("bantype", -1))
            {
            case 0:    //正常状态
                //Users.UpdateUserGroup(operateduid, UserCredits.GetCreditsUserGroupId(operateduser.Credits).Groupid);
                Users.UpdateBanUser(CreditsFacade.GetCreditsUserGroupId(operateduser.Credits).Groupid, "0", operateduid);
                title   = string.Format("取消对 <a href=\"../../userinfo-{1}.aspx\" target=\"_blank\">{0}</a> 的禁止", operatedusername, operateduid);
                actions = "取消禁止";
                break;

            case 1:    //禁止发言
                //Users.UpdateUserGroup(operateduid, 4);
                Users.UpdateBanUser(4, expday, operateduid);
                title   = string.Format("禁止 <a href=\"../../userinfo-{1}.aspx\" target=\"_blank\">{0}</a> 发言", operatedusername, operateduid);
                actions = "禁止发言";
                break;

            case 2:    //禁止访问
                //Users.UpdateUserGroup(operateduid, 5);
                Users.UpdateBanUser(5, expday, operateduid);
                title   = string.Format("禁止 <a href=\"../../userinfo-{1}.aspx\" target=\"_blank\">{0}</a> 访问", operatedusername, operateduid);
                actions = "禁止访问";
                break;

            default:
                titlemessage = true;
                actions      = "错误的禁止类型";
                AddErrLine("错误的禁止类型");
                return;
            }

            AdminModeratorLogs.InsertLog(userid.ToString(), username, usergroupid.ToString(), usergroupinfo.Grouptitle, DNTRequest.GetIP(),
                                         DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "0", "", "0", title, actions, DNTRequest.GetString("reason").Trim());
            // 收件箱
            //if (DNTRequest.GetFormInt("sendmessage", 0) == 1)
            //{
            //    PrivateMessageInfo privatemessageinfo = new PrivateMessageInfo();
            //    privatemessageinfo.Message = Utils.HtmlEncode(string.Format("这是由论坛系统自动发送的通知短消息。操作理由: {0}\r\n\r\n如果您对本管理操作有异议,请与我取得联系。", DNTRequest.GetString("reason").Trim()));
            //    privatemessageinfo.Subject = Utils.HtmlEncode("您被执行 " + actions + " 操作");
            //    privatemessageinfo.Msgto = operateduser.Username;
            //    privatemessageinfo.Msgtoid = operateduid;
            //    privatemessageinfo.Msgfrom = username;
            //    privatemessageinfo.Msgfromid = userid;
            //    privatemessageinfo.New = 1;
            //    privatemessageinfo.Postdatetime = Utils.GetDateTime();
            //    privatemessageinfo.Folder = 0;
            //    PrivateMessages.CreatePrivateMessage(privatemessageinfo, 0);
            //}

            ispost = true;
            SetShowBackLink(false);
            SetUrl(Utils.UrlDecode(ForumUtils.GetReUrl()));
            SetMetaRefresh();
            MsgForward("useradmin_succeed", true);
        }
Exemplo n.º 18
0
        private void Save_Click(object sender, EventArgs e)
        {
            #region 保存积分设置信息

            if (this.CheckCookie())
            {
                if ((Convert.ToDouble(creditstax.Text.Trim()) > 1) || (Convert.ToDouble(creditstax.Text.Trim()) < 0))
                {
                    base.RegisterStartupScript("", "<script>alert('积分交易税必须是0--1之间的小数');window.location.href='global_scoreset.aspx';</script>");
                    return;
                }

                if (Convert.ToDouble(transfermincredits.Text.Trim()) < 0)
                {
                    base.RegisterStartupScript("", "<script>alert('转账最低余额必须是大于或等于0');window.location.href='global_scoreset.aspx';</script>");
                    return;
                }

                if (Convert.ToDouble(exchangemincredits.Text.Trim()) < 0)
                {
                    base.RegisterStartupScript("", "<script>alert('兑换最低余额必须是大于或等于0');window.location.href='global_scoreset.aspx';</script>");
                    return;
                }

                if (Convert.ToDouble(maxincperthread.Text.Trim()) < 0)
                {
                    base.RegisterStartupScript("", "<script>alert('单主题最高收入必须是大于或等于0');window.location.href='global_scoreset.aspx';</script>");
                    return;
                }

                if (Convert.ToDouble(maxchargespan.Text.Trim()) < 0)
                {
                    base.RegisterStartupScript("", "<script>alert('单主题最高出售时限必须是大于或等于0');window.location.href='global_scoreset.aspx';</script>");
                    return;
                }

                if (formula.Text.Trim() == "" || !AdminForums.CreateUpdateUserCreditsProcedure(formula.Text.Trim()))
                {
                    base.RegisterStartupScript("", "<script>alert('总积分计算公式为空或不正确');window.location.href='global_scoreset.aspx';</script>");
                    return;
                }
                if (Convert.ToInt32(losslessdel.Text) > 9999 || Convert.ToInt32(losslessdel.Text) < 0)
                {
                    base.RegisterStartupScript("", "<script>alert('删帖不减积分时间期限只能在0-9999之间');window.location.href='forum_option.aspx';</script>");
                    return;
                }

                dsSrc.ReadXml(Server.MapPath("../../config/scoreset.config"));
                dsSrc.Tables["formula"].Rows[0]["formulacontext"] = formula.Text.Trim();
                dsSrc.Tables["formula"].Rows[0]["creditstrans"]   = creditstrans.SelectedValue;
                if (creditstrans.SelectedValue == "0")
                {
                    dsSrc.Tables["formula"].Rows[0]["topicattachcreditstrans"] = creditstrans.SelectedValue;
                    dsSrc.Tables["formula"].Rows[0]["bonuscreditstrans"]       = creditstrans.SelectedValue;
                }
                else
                {
                    dsSrc.Tables["formula"].Rows[0]["topicattachcreditstrans"] = topicattachcreditstrans.SelectedValue;
                    dsSrc.Tables["formula"].Rows[0]["bonuscreditstrans"]       = bonuscreditstrans.SelectedValue;
                }
                dsSrc.Tables["formula"].Rows[0]["creditstax"]         = Convert.ToDouble(creditstax.Text);
                dsSrc.Tables["formula"].Rows[0]["transfermincredits"] = Convert.ToDouble(transfermincredits.Text);
                dsSrc.Tables["formula"].Rows[0]["exchangemincredits"] = Convert.ToDouble(exchangemincredits.Text);
                dsSrc.Tables["formula"].Rows[0]["maxincperthread"]    = Convert.ToDouble(maxincperthread.Text);
                dsSrc.Tables["formula"].Rows[0]["maxchargespan"]      = Convert.ToDouble(maxchargespan.Text);
                dsSrc.WriteXml(Server.MapPath("../../config/scoreset.config"));


                Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
                cache.RemoveObject("/Forum/Scoreset");
                cache.RemoveObject("/Forum/Scoreset/CreditsTrans");
                cache.RemoveObject("/Forum/Scoreset//Forum/Scoreset/TopicAttachCreditsTrans");
                cache.RemoveObject("/Forum/Scoreset/BonusCreditsTrans");
                cache.RemoveObject("/Forum/Scoreset/CreditsTax");
                cache.RemoveObject("/Forum/Scoreset/TransferMinCredits");
                cache.RemoveObject("/Forum/Scoreset/ExchangeMinCredits");
                cache.RemoveObject("/Forum/Scoreset/MaxIncPerThread");
                cache.RemoveObject("/Forum/Scoreset/MaxChargeSpan");
                cache.RemoveObject("/Forum/IsSetDownLoadAttachScore");
                cache.RemoveObject("/Forum/ValidScoreUnit");
                cache.RemoveObject("/Forum/RateScoreSet");

                AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "修改积分设置", "修改积分设置");

                configInfo.Alipayaccout     = DNTRequest.GetFormString("alipayaccount");
                configInfo.Cashtocreditrate = DNTRequest.GetFormInt("cashtocreditsrate", 0);

                int mincreditstobuy = DNTRequest.GetFormInt("mincreditstobuy", 0);
                //如果现金/积分兑换比率为0,则表示不开启积分充值功能
                if (configInfo.Cashtocreditrate > 0)
                {
                    //为了保证生成的订单价格最低价格为0.1元,则需要根据现金和积分兑换比率来动态调整积分最少购买数量的值
                    while ((decimal)mincreditstobuy / (decimal)configInfo.Cashtocreditrate < 0.10M)
                    {
                        mincreditstobuy++;
                    }
                }

                configInfo.Mincreditstobuy           = mincreditstobuy;
                configInfo.Maxcreditstobuy           = DNTRequest.GetFormInt("maxcreditstobuy", 0);
                configInfo.Userbuycreditscountperday = DNTRequest.GetFormInt("userbuycreditscountperday", 0);
                configInfo.Alipaypartnercheckkey     = DNTRequest.GetFormString("alipaypartnercheckkey");
                configInfo.Alipaypartnerid           = DNTRequest.GetFormString("alipaypartnerid");
                configInfo.Usealipaycustompartnerid  = DNTRequest.GetFormInt("usealipaycustompartnerid", 1);
                configInfo.Usealipayinstantpay       = DNTRequest.GetFormInt("usealipayinstantpay", 0);
                configInfo.Losslessdel = Convert.ToInt16(losslessdel.Text);
                GeneralConfigs.SaveConfig(configInfo);
                GeneralConfigs.ResetConfig();

                if (RefreshUserScore.SelectedValue.IndexOf("1") == 0)
                {
                    //运行ajax批量更新用户积分功能
                    ClientScript.RegisterStartupScript(this.GetType(), "Page", "<script>submit_Click();</script>");
                    return;
                    //Users.UpdateUserCredits(formula.Text, 0);
                }

                base.RegisterStartupScript("PAGE", "window.location.href='global_scoreset.aspx';");
            }

            #endregion
        }
Exemplo n.º 19
0
        protected override void ShowPage()
        {
            if (userid == -1)
            {
                AddErrLine("你尚未登录");
                return;
            }
            if (config.Enablemall < 2)
            {
                AddErrLine("当前操作只有在开启商城(高级)模式时才可以使用!");
                return;
            }

            user     = Users.GetUserInfo(userid);
            shopinfo = Shops.GetShopByUserId(user.Uid);

            if (!DNTRequest.IsPost())
            {
                shopcategorydt       = ShopCategories.GetShopCategoryTable(shopinfo.Shopid);
                shopcategorydt_count = shopcategorydt.Rows.Count;
                shopcategorydata     = ShopCategories.GetShopCategoryJson(shopcategorydt);
                categoryoptions      = ShopCategories.GetShopCategoryOption(shopcategorydt, false);
            }
            else
            {
                if (ForumUtils.IsCrossSitePost())
                {
                    AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                    return;
                }
                string operation = DNTRequest.GetFormString("operation");
                if (operation != "add")
                {
                    int shopcategoryid = DNTRequest.GetFormInt("categoryid", 0);
                    if (shopcategoryid <= 0)
                    {
                        AddErrLine("店铺商品分类参数无效<br />");
                        return;
                    }

                    shopcategoryinfo = ShopCategories.GetShopCategoryByCategoryId(shopcategoryid);
                }

                shopid = 0;
                item   = DNTRequest.GetString("item");

                switch (operation)
                {
                case "delete":     //删除分类
                {
                    if (shopcategoryinfo == null || shopcategoryinfo.Categoryid <= 0)
                    {
                        AddErrLine("要删除的店铺商品分类参数无效<br />");
                        return;
                    }
                    if (!ShopCategories.DeleteCategoryByCategoryId(shopcategoryinfo))
                    {
                        AddErrLine("对不起,当前节点下面还有子结点,因此不能删除<br />");
                        return;
                    }
                    break;
                }

                case "edit":     //编辑分类名称
                {
                    if (shopcategoryinfo == null || shopcategoryinfo.Categoryid <= 0)
                    {
                        AddErrLine("要修改的店铺商品分类参数无效<br />");
                        return;
                    }
                    string editname = DNTRequest.GetString("editcategoryname");
                    if (editname == "")
                    {
                        AddErrLine("店铺商品分类名称未变更或不能为空<br />");
                        return;
                    }
                    shopcategoryinfo.Name = editname;
                    ShopCategories.UpdateShopCategory(shopcategoryinfo);
                    break;
                }

                case "add":     //添加分类
                {
                    shopcategoryinfo        = new Shopcategoryinfo();
                    shopcategoryinfo.Name   = DNTRequest.GetFormString("addcategoryname");
                    shopcategoryinfo.Shopid = shopinfo.Shopid;

                    int addtype = DNTRequest.GetInt("addtype", 0);
                    if (addtype > 0 && addtype <= 2)
                    {
                        int targetcategoryid = DNTRequest.GetFormInt("selectcategoryid", 0);

                        if (targetcategoryid <= 0)
                        {
                            AddErrLine("要添加到的目标分类参数无效<br />");
                            return;
                        }

                        targetshopcategoryinfo = ShopCategories.GetShopCategoryByCategoryId(targetcategoryid);
                        if (targetshopcategoryinfo == null || targetshopcategoryinfo.Categoryid <= 0)
                        {
                            AddErrLine("要添加到的目标分类参数无效<br />");
                            return;
                        }
                    }

                    ShopCategories.CreateShopCategory(shopcategoryinfo, targetshopcategoryinfo, addtype);
                    break;
                }

                case "move":     //移动分类
                {
                    int targetcategoryid = DNTRequest.GetFormInt("targetcategoryid", 0);

                    if (targetcategoryid <= 0)
                    {
                        AddErrLine("要移动到的目标分类参数无效<br />");
                        return;
                    }

                    targetshopcategoryinfo = ShopCategories.GetShopCategoryByCategoryId(targetcategoryid);
                    if (targetshopcategoryinfo == null || targetshopcategoryinfo.Categoryid <= 0)
                    {
                        AddErrLine("要移动到的目标分类参数无效<br />");
                        return;
                    }
                    string target_parentidlist = "," + targetshopcategoryinfo.Parentidlist.Trim() + ",";
                    if (target_parentidlist.IndexOf("," + shopcategoryinfo.Categoryid.ToString() + ",") > 0)
                    {
                        AddErrLine("不能将当前分类移动到其子分类<br />");
                        return;
                    }
                    ShopCategories.MoveShopCategory(shopcategoryinfo, targetshopcategoryinfo, DNTRequest.GetInt("isaschildnode", 0) == 1 ? true : false);
                    break;
                }
                }

                SetUrl("usercpshopcategory.aspx?item=" + item);
                SetMetaRefresh();
                AddMsgLine("操作成功. <br />(<a href=\"usercpmygoods.aspx?item=" + item + "\">点击这里返回</a>)<br />");
            }
        }
Exemplo n.º 20
0
        private void Save_Click(object sender, EventArgs e)
        {
            if (base.CheckCookie())
            {
                if (Convert.ToDouble(this.creditstax.Text.Trim()) > 1.0 || Convert.ToDouble(this.creditstax.Text.Trim()) < 0.0)
                {
                    base.RegisterStartupScript("", "<script>alert('积分交易税必须是0--1之间的小数');window.location.href='global_scoreset.aspx';</script>");
                    return;
                }
                if (Convert.ToDouble(this.transfermincredits.Text.Trim()) < 0.0)
                {
                    base.RegisterStartupScript("", "<script>alert('转账最低余额必须是大于或等于0');window.location.href='global_scoreset.aspx';</script>");
                    return;
                }
                if (Convert.ToDouble(this.exchangemincredits.Text.Trim()) < 0.0)
                {
                    base.RegisterStartupScript("", "<script>alert('兑换最低余额必须是大于或等于0');window.location.href='global_scoreset.aspx';</script>");
                    return;
                }
                if (Convert.ToDouble(this.maxincperthread.Text.Trim()) < 0.0)
                {
                    base.RegisterStartupScript("", "<script>alert('单主题最高收入必须是大于或等于0');window.location.href='global_scoreset.aspx';</script>");
                    return;
                }
                if (Convert.ToDouble(this.maxchargespan.Text.Trim()) < 0.0)
                {
                    base.RegisterStartupScript("", "<script>alert('单主题最高出售时限必须是大于或等于0');window.location.href='global_scoreset.aspx';</script>");
                    return;
                }
                //if (String.IsNullOrEmpty(this.formula.Text.Trim()) || !AdminForums.CreateUpdateUserCreditsProcedure(this.formula.Text.Trim()))
                // 原来计算积分的公式作为存储过程写入,现在暂时固定编码到User.UpdateUserCredits
                if (String.IsNullOrEmpty(this.formula.Text.Trim()))
                {
                    base.RegisterStartupScript("", "<script>alert('总积分计算公式为空或不正确');window.location.href='global_scoreset.aspx';</script>");
                    return;
                }
                if (this.losslessdel.Text.ToInt() > 9999 || this.losslessdel.Text.ToInt() < 0)
                {
                    base.RegisterStartupScript("", "<script>alert('删帖不减积分时间期限只能在0-9999之间');window.location.href='forum_option.aspx';</script>");
                    return;
                }
                this.dsSrc.ReadXml(base.Server.MapPath("../../config/scoreset.config"));
                this.dsSrc.Tables["formula"].Rows[0]["formulacontext"] = this.formula.Text.Trim();
                this.dsSrc.Tables["formula"].Rows[0]["creditstrans"]   = this.creditstrans.SelectedValue;
                if (this.creditstrans.SelectedValue == "0")
                {
                    this.dsSrc.Tables["formula"].Rows[0]["topicattachcreditstrans"] = this.creditstrans.SelectedValue;
                    this.dsSrc.Tables["formula"].Rows[0]["bonuscreditstrans"]       = this.creditstrans.SelectedValue;
                }
                else
                {
                    this.dsSrc.Tables["formula"].Rows[0]["topicattachcreditstrans"] = this.topicattachcreditstrans.SelectedValue;
                    this.dsSrc.Tables["formula"].Rows[0]["bonuscreditstrans"]       = this.bonuscreditstrans.SelectedValue;
                }
                this.dsSrc.Tables["formula"].Rows[0]["creditstax"]         = Convert.ToDouble(this.creditstax.Text);
                this.dsSrc.Tables["formula"].Rows[0]["transfermincredits"] = Convert.ToDouble(this.transfermincredits.Text);
                this.dsSrc.Tables["formula"].Rows[0]["exchangemincredits"] = Convert.ToDouble(this.exchangemincredits.Text);
                this.dsSrc.Tables["formula"].Rows[0]["maxincperthread"]    = Convert.ToDouble(this.maxincperthread.Text);
                this.dsSrc.Tables["formula"].Rows[0]["maxchargespan"]      = Convert.ToDouble(this.maxchargespan.Text);
                this.dsSrc.WriteXml(base.Server.MapPath("../../config/scoreset.config"));

                XCache.Remove(CacheKeys.FORUM_SCORESET);
                XCache.Remove(CacheKeys.FORUM_SCORESET_CREDITS_TRANS);
                XCache.Remove("/Forum/Scoreset//Forum/Scoreset/TopicAttachCreditsTrans");
                XCache.Remove("/Forum/Scoreset/BonusCreditsTrans");
                XCache.Remove(CacheKeys.FORUM_SCORESET_CREDITS_TAX);
                XCache.Remove(CacheKeys.FORUM_SCORESET_TRANSFER_MIN_CREDITS);
                XCache.Remove(CacheKeys.FORUM_SCORESET_EXCHANGE_MIN_CREDITS);
                XCache.Remove(CacheKeys.FORUM_SCORESET_MAX_INC_PER_THREAD);
                XCache.Remove(CacheKeys.FORUM_SCORESET_MAX_CHARGE_SPAN);
                XCache.Remove("/Forum/IsSetDownLoadAttachScore");
                XCache.Remove(CacheKeys.FORUM_VALID_SCORE_UNIT);
                XCache.Remove(CacheKeys.FORUM_RATESCORESET);

                AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "修改积分设置", "修改积分设置");
                this.configInfo.Alipayaccout     = DNTRequest.GetFormString("alipayaccount");
                this.configInfo.Cashtocreditrate = DNTRequest.GetFormInt("cashtocreditsrate", 0);
                int num = DNTRequest.GetFormInt("mincreditstobuy", 0);
                if (this.configInfo.Cashtocreditrate > 0)
                {
                    while (num / this.configInfo.Cashtocreditrate < 0.10m)
                    {
                        num++;
                    }
                }
                this.configInfo.Mincreditstobuy           = num;
                this.configInfo.Maxcreditstobuy           = DNTRequest.GetFormInt("maxcreditstobuy", 0);
                this.configInfo.Userbuycreditscountperday = DNTRequest.GetFormInt("userbuycreditscountperday", 0);
                this.configInfo.Alipaypartnercheckkey     = DNTRequest.GetFormString("alipaypartnercheckkey");
                this.configInfo.Alipaypartnerid           = DNTRequest.GetFormString("alipaypartnerid");
                this.configInfo.Usealipaycustompartnerid  = DNTRequest.GetFormInt("usealipaycustompartnerid", 1);
                this.configInfo.Usealipayinstantpay       = DNTRequest.GetFormInt("usealipayinstantpay", 0);
                this.configInfo.Losslessdel = (int)Convert.ToInt16(this.losslessdel.Text);

                //GeneralConfigs.SaveConfig(this.configInfo);
                //GeneralConfigs.ResetConfig();
                configInfo.Save();
                GeneralConfigInfo.Current = null;
                if (this.RefreshUserScore.SelectedValue.IndexOf("1") == 0)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), "Page", "<script>submit_Click();</script>");
                    return;
                }
                base.RegisterStartupScript("PAGE", "window.location.href='global_scoreset.aspx';");
            }
        }
Exemplo n.º 21
0
        public void GetRateLogList()
        {
            var sb = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");

            if (!DNTRequest.IsPost() || ForumUtils.IsCrossSitePost())
            {
                sb.Append("<error>您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。</error>");
                this.ResponseXML(sb);
                return;
            }
            try
            {
                //List<RateLogInfo> postRateLogList = Posts.GetPostRateLogList(DNTRequest.GetFormInt("pid", 0));
                var postRateLogList = RateLog.Search(0, WebHelper.RequestInt("pid"));
                if (postRateLogList == null || postRateLogList.Count == 0)
                {
                    sb.Append("<error>该帖没有评分记录</error>");
                    this.ResponseXML(sb);
                }
                else
                {
                    sb.Append("<data>\r\n");
                    var list = new List <RateLog>();
                    foreach (var info in postRateLogList)
                    {
                        //Predicate<RateLogInfo> match = (RateLogInfo rateLog) => rateLog.Uid == info.Uid && rateLog.ExtCredits == info.ExtCredits;
                        //RateLogInfo rateLogInfo = list.Find(match);
                        var rateLogInfo = list.Find(e => e.Uid == info.Uid && e.ExtCredits == info.ExtCredits);
                        if (rateLogInfo == null)
                        {
                            list.Add(info);
                        }
                        else
                        {
                            rateLogInfo.Score += info.Score;
                            rateLogInfo.Reason = (string.IsNullOrEmpty(rateLogInfo.Reason) ? info.Reason : rateLogInfo.Reason);
                            if (rateLogInfo.Reason.IsNullOrWhiteSpace())
                            {
                                rateLogInfo.Reason = info.Reason;
                            }
                        }
                    }
                    string[] validScoreName = Scoresets.GetValidScoreName();
                    string[] validScoreUnit = Scoresets.GetValidScoreUnit();
                    int      num            = 0;
                    int      num2           = 0;
                    foreach (var item in list)
                    {
                        if (num2 != item.Uid)
                        {
                            num++;
                        }

                        sb.Append("<ratelog>");
                        sb.AppendFormat("\r\n\t<rateid>{0}</rateid>", item.ID);
                        sb.AppendFormat("\r\n\t<uid>{0}</uid>", item.Uid);
                        sb.AppendFormat("\r\n\t<username>{0}</username>", item.UserName.Trim());
                        sb.AppendFormat("\r\n\t<extcredits>{0}</extcredits>", item.ExtCredits);
                        sb.AppendFormat("\r\n\t<extcreditsname>{0}</extcreditsname>", validScoreName[item.ExtCredits]);
                        sb.AppendFormat("\r\n\t<extcreditsunit>{0}</extcreditsunit>", validScoreUnit[item.ExtCredits]);
                        sb.AppendFormat("\r\n\t<postdatetime>{0}</postdatetime>", ForumUtils.ConvertDateTime(item.PostDateTime));
                        sb.AppendFormat("\r\n\t<score>{0}</score>", (item.Score > 0) ? ("+" + item.Score.ToString()) : item.Score.ToString());
                        sb.AppendFormat("\r\n\t<reason>{0}</reason>", item.Reason.Trim());
                        sb.Append("\r\n</ratelog>\r\n");
                        num2 = item.Uid;
                    }
                    sb.Append("</data>");
                    this.ResponseXML(sb);
                    if (DNTRequest.GetFormInt("ratetimes", 0) != num)
                    {
                        Posts.UpdatePostRateTimes(DNTRequest.GetFormInt("tid", 0), DNTRequest.GetFormInt("pid", 0).ToString());
                    }
                }
            }
            catch
            {
                HttpContext.Current.Response.Clear();
                HttpContext.Current.Response.Expires = 0;
                HttpContext.Current.Response.Cache.SetNoStore();
                HttpContext.Current.Response.End();
            }
        }
Exemplo n.º 22
0
        /// <summary>
        /// 获取用户id
        /// </summary>
        /// <returns></returns>
        private ShortUserInfo GetShortUserInfo()
        {
            postpassword = !Utils.StrIsNullOrEmpty(loginauth) ?
                           DES.Decode(loginauth.Replace("[", "+"), config.Passwordkey) :
                           DNTRequest.GetString("password");

            postusername = Utils.StrIsNullOrEmpty(postusername) ? DNTRequest.GetString("username") : postusername;

            int uid = -1;

            switch (config.Passwordmode)
            {
            case 1:    //动网兼容模式
            {
                if (config.Secques == 1 && (!Utils.StrIsNullOrEmpty(loginauth) || !loginsubmit))
                {
                    uid = Users.CheckDvBbsPasswordAndSecques(postusername, postpassword, DNTRequest.GetFormInt("question", 0), DNTRequest.GetString("answer"));
                }
                else
                {
                    uid = Users.CheckDvBbsPassword(postusername, postpassword);
                }
                break;
            }

            case 0:    //默认模式
            {
                if (config.Secques == 1 && (!Utils.StrIsNullOrEmpty(loginauth) || !loginsubmit))
                {
                    uid = Users.CheckPasswordAndSecques(postusername, postpassword, true, DNTRequest.GetFormInt("question", 0), DNTRequest.GetString("answer"));
                }
                else
                {
                    uid = Users.CheckPassword(postusername, postpassword, true);
                }
                break;
            }

            default:     //第三方加密验证模式
            {
                return((ShortUserInfo)Users.CheckThirdPartPassword(postusername, postpassword, DNTRequest.GetFormInt("question", 0), DNTRequest.GetString("answer")));
            }
            }
            if (uid != -1)
            {
                Users.UpdateTrendStat(TrendType.Login);
            }
            return(uid > 0 ? Users.GetShortUserInfo(uid) : null);
        }
Exemplo n.º 23
0
        private IUser GetShortUserInfo()
        {
            //int num;

            IUser user = null;

            //switch (this.config.Passwordmode)
            //{
            //    case 0:
            if (this.config.Secques == 1)
            {
                //num = Users.CheckPasswordAndSecques(this.postusername, this.postpassword, true, DNTRequest.GetFormInt("question", 0), DNTRequest.GetString("answer"));
                user = BBX.Entity.User.Login(this.postusername, this.postpassword, true, DNTRequest.GetFormInt("question", 0), DNTRequest.GetString("answer"));
            }
            else
            {
                //num = Users.CheckPassword(this.postusername, this.postpassword, true);
                user = BBX.Entity.User.Login(this.postusername, this.postpassword);
            }
            //        break;

            //    case 1:
            //        if (this.config.Secques == 1)
            //        {
            //            num = Users.CheckDvBbsPasswordAndSecques(this.postusername, this.postpassword, DNTRequest.GetFormInt("question", 0), DNTRequest.GetString("answer"));
            //        }
            //        else
            //        {
            //            num = Users.CheckDvBbsPassword(this.postusername, this.postpassword);
            //        }
            //        break;

            //    default:
            //        return Users.CheckThirdPartPassword(this.postusername, this.postpassword, DNTRequest.GetFormInt("question", 0), DNTRequest.GetString("answer"));
            //}
            if (user == null)
            {
                return(null);
            }

            //Users.UpdateTrendStat(TrendType.Login);
            TrendStat.Today.Login++;

            return(user);
        }
Exemplo n.º 24
0
 private void SetTopicInfo(string[] pollitem, int topicprice, string postmessage)
 {
     if (this.postinfo.Layer == 0)
     {
         new StringBuilder("");
         if (this.topic.Special == 1)
         {
             string text = Utils.HtmlEncode(DNTRequest.GetFormString("PollItemname").Trim());
             if (text.IsNullOrEmpty())
             {
                 base.AddErrLine("投票项为空");
                 return;
             }
             int num  = (DNTRequest.GetString("multiple") == "on") ? 1 : 0;
             int num2 = DNTRequest.GetInt("maxchoices", 0);
             if (num == 1 && num2 > pollitem.Length)
             {
                 num2 = pollitem.Length;
             }
             if (!Poll.UpdatePoll(
                     this.topic.ID, num, pollitem.Length,
                     DNTRequest.GetFormString("PollOptionID").Trim(),
                     text,
                     DNTRequest.GetFormString("PollOptionDisplayOrder").Trim(),
                     Utility.ToDateTime(DNTRequest.GetString("enddatetime")),
                     num2,
                     (DNTRequest.GetString("visiblepoll") == "on") ? 1 : 0,
                     (DNTRequest.GetString("allowview") == "on") ? true : false))
             {
                 base.AddErrLine("投票错误,请检查显示顺序");
                 return;
             }
         }
         if (this.topic.Special == 4)
         {
             this.debateinfo.PositiveOpinion = DNTRequest.GetString("positiveopinion");
             this.debateinfo.NegativeOpinion = DNTRequest.GetString("negativeopinion");
             this.debateinfo.TerminalTime    = Request["terminaltime"].ToDateTime();
             if (this.debateinfo.Update() < 1)
             {
                 base.AddErrLine("辩论修改选择了无效的主题");
                 return;
             }
         }
         int @int = DNTRequest.GetInt("iconid", 0);
         this.topic.IconID = ((@int > 15 || @int < 0) ? 0 : @int);
         this.topic.Title  = this.postinfo.Title;
         if (this.topic.Special == 2)
         {
             int num3 = topicprice - this.topic.Price;
             if (num3 > 0)
             {
                 if (this.bonusCreditsTrans < 1 || this.bonusCreditsTrans > 8)
                 {
                     base.AddErrLine("系统未设置\"交易积分设置\", 无法判断当前要使用的(扩展)积分字段, 暂时无法发布悬赏");
                     return;
                 }
                 if (!usergroupinfo.Is管理员 && Users.GetUserExtCredits(this.topic.PosterID, this.bonusCreditsTrans) < (float)num3)
                 {
                     base.AddErrLine("主题作者 " + Scoresets.GetValidScoreName()[this.bonusCreditsTrans] + " 不足, 无法追加悬赏");
                     return;
                 }
                 this.topic.Price = topicprice;
                 BBX.Entity.User.UpdateUserExtCredits(this.topic.PosterID, this.bonusCreditsTrans, (float)(-(float)num3) * (Scoresets.GetCreditsTax() + 1f));
             }
             else
             {
                 if (num3 < 0 && !usergroupinfo.Is管理员)
                 {
                     base.AddErrLine("不能降低悬赏价格");
                     return;
                 }
             }
         }
         else
         {
             if (this.topic.Special == 0)
             {
                 this.topic.Price = topicprice;
             }
         }
         if (this.usergroupinfo.AllowSetreadPerm)
         {
             this.topic.ReadPerm = ((DNTRequest.GetInt("topicreadperm", 0) > 255) ? 255 : DNTRequest.GetInt("topicreadperm", 0));
         }
         if (ForumUtils.IsHidePost(postmessage) && this.usergroupinfo.AllowHideCode)
         {
             this.topic.Hide = 1;
         }
         this.topic.TypeID = DNTRequest.GetFormInt("typeid", 0);
         this.htmltitle    = DNTRequest.GetString("htmltitle").Trim();
         if (!this.htmltitle.IsNullOrEmpty() && Utils.HtmlDecode(this.htmltitle).Trim() != this.topic.Title)
         {
             this.topic.Magic = 11000;
         }
         else
         {
             this.topic.Magic = 0;
         }
         this.topic.DisplayOrder = Topics.GetTitleDisplayOrder(this.usergroupinfo, this.useradminid, this.forum, this.topic, this.message, this.disablepostctrl);
         Tag.DeleteTopicTags(this.topic.ID);
         //Topics.DeleteRelatedTopics(this.topic.ID);
         TopicTagCache.DeleteRelatedTopics(this.topic.ID);
         string text2 = DNTRequest.GetString("tags").Trim();
         if (this.enabletag && !text2.IsNullOrEmpty())
         {
             if (ForumUtils.InBanWordArray(text2))
             {
                 base.AddErrLine("标签中含有系统禁止词语,请修改");
                 return;
             }
             string[] array = Utils.SplitString(text2, " ", true, 2, 10);
             if (array.Length <= 0 || array.Length > 5)
             {
                 base.AddErrLine("超过标签数的最大限制或单个标签长度没有介于2-10之间,最多可填写 5 个标签");
                 return;
             }
             this.topic.Magic = Topics.SetMagicValue(this.topic.Magic, MagicType.TopicTag, 1);
             Tag.CreateTopicTags(array, this.topic.ID, this.userid, Utils.GetDateTime());
         }
         //Topics.UpdateTopic(this.topic);
         topic.Update();
         if (this.canhtmltitle && !this.htmltitle.IsNullOrEmpty() && this.htmltitle != this.topic.Title)
         {
             Topics.WriteHtmlTitleFile(Utils.RemoveUnsafeHtml(this.htmltitle), this.topic.ID);
             return;
         }
     }
     else
     {
         if (ForumUtils.IsHidePost(postmessage) && this.usergroupinfo.AllowHideCode)
         {
             this.topic.Hide = 1;
             //Topics.UpdateTopic(this.topic);
             topic.Update();
         }
     }
 }
Exemplo n.º 25
0
        /// <summary>
        /// 验证帖子信息
        /// </summary>
        /// <param name="admininfo"></param>
        /// <param name="user"></param>
        /// <param name="ishtmlon"></param>
        private void SetPostInfo(AdminGroupInfo admininfo, ShortUserInfo user, bool ishtmlon)
        {
            if (postinfo.Layer == 0 && forum.Applytopictype == 1 && forum.Postbytopictype == 1 && topictypeselectoptions != string.Empty)
            {
                if (Utils.StrIsNullOrEmpty(DNTRequest.GetString("typeid")) || DNTRequest.GetString("typeid").Trim() == "0")
                {
                    AddErrLine("主题类型不能为空");
                    return;
                }

                if (!Forums.IsCurrentForumTopicType(DNTRequest.GetString("typeid").Trim(), forum.Topictypes))
                {
                    AddErrLine("错误的主题类型");
                    return;
                }
            }

            //这段代码有什么作用,和下面的SetAttachmentInfo方法做的事情是否有重复?能否拿掉?
            ///删除附件
            if (DNTRequest.GetInt("isdeleteatt", 0) == 1)
            {
                if (DNTRequest.GetFormInt("aid", 0) > 0 && Attachments.DeleteAttachment(DNTRequest.GetFormInt("aid", 0)) > 0)
                {
                    attachmentlist  = Attachments.GetAttachmentListByPid(postinfo.Pid);
                    attachmentcount = Attachments.GetAttachmentCountByPid(postinfo.Pid);
                }
                AddLinkCss(BaseConfigs.GetForumPath + "templates/" + templatepath + "/editor.css", "css");
                // 帖子内容
                message = postinfo.Message;
                ispost  = false;

                return;
            }
            //
            #region 检查标题和内容信息
            if (string.IsNullOrEmpty(postTitle.Trim().Replace(" ", "")) && postinfo.Layer == 0)
            {
                AddErrLine("标题不能为空");
            }
            else if (postTitle.Length > 60)
            {
                AddErrLine("标题最大长度为60个字符,当前为 " + postTitle.Length.ToString() + " 个字符");
            }

            //string postmessage = DNTRequest.GetString("message");
            if (postMessage.Equals("") || postMessage.Replace(" ", "").Equals(""))
            {
                AddErrLine("内容不能为空");
            }

            if (admininfo != null && disablepostctrl != 1)
            {
                if (postMessage.Length < config.Minpostsize)
                {
                    AddErrLine("您发表的内容过少, 系统设置要求帖子内容不得少于 " + config.Minpostsize.ToString() + " 字多于 " + config.Maxpostsize.ToString() + " 字");
                }
                else if (postMessage.Length > config.Maxpostsize)
                {
                    AddErrLine("您发表的内容过多, 系统设置要求帖子内容不得少于 " + config.Minpostsize.ToString() + " 字多于 " + config.Maxpostsize.ToString() + " 字");
                }
            }

            //新用户广告强力屏蔽检查
            if ((config.Disablepostad == 1) && useradminid < 1)  //如果开启新用户广告强力屏蔽检查或是游客
            {
                if ((config.Disablepostadpostcount != 0 && user.Posts <= config.Disablepostadpostcount) ||
                    (config.Disablepostadregminute != 0 && DateTime.Now.AddMinutes(-config.Disablepostadregminute) <= Convert.ToDateTime(user.Joindate)))
                {
                    foreach (string regular in config.Disablepostadregular.Replace("\r", "").Split('\n'))
                    {
                        if (Posts.IsAD(regular, postTitle, postMessage))
                        {
                            AddErrLine("发帖失败,内容中有不符合新用户强力广告屏蔽规则的字符,请检查标题和内容,如有疑问请与管理员联系");
                            return;
                        }
                    }
                }
            }

            #endregion
            string[] pollitem   = Utils.SplitString(DNTRequest.GetString("PollItemname"), "\r\n");
            int      topicprice = 0;
            string   tmpprice   = DNTRequest.GetString("topicprice");

            if (postinfo.Layer == 0)
            {
                #region 投票信息
                //string[] pollitem = Utils.SplitString(DNTRequest.GetString("PollItemname"), "\r\n");

                if (!Utils.StrIsNullOrEmpty(DNTRequest.GetString("updatepoll")) && topic.Special == 1)
                {
                    pollinfo.Multiple = DNTRequest.GetInt("multiple", 0);

                    // 验证用户是否有发布投票的权限
                    if (usergroupinfo.Allowpostpoll != 1)
                    {
                        AddErrLine("您当前的身份 \"" + usergroupinfo.Grouptitle + "\" 没有发布投票的权限");
                        return;
                    }

                    if (pollitem.Length < 2)
                    {
                        AddErrLine("投票项不得少于2个");
                    }
                    else if (pollitem.Length > config.Maxpolloptions)
                    {
                        AddErrLine("系统设置为投票项不得多于" + config.Maxpolloptions + "个");
                    }
                    else
                    {
                        for (int i = 0; i < pollitem.Length; i++)
                        {
                            if (Utils.StrIsNullOrEmpty(pollitem[i]))
                            {
                                AddErrLine("投票项不能为空");
                            }
                        }
                    }
                }
                #endregion

                #region 悬赏信息
                //int topicprice = 0;
                //string tmpprice = DNTRequest.GetString("topicprice");

                if (Regex.IsMatch(tmpprice, "^[0-9]*[0-9][0-9]*$") || tmpprice == string.Empty)
                {
                    topicprice = Utils.StrToInt(tmpprice, 0) > 32767 ? 32767 : Utils.StrToInt(tmpprice, 0);
                    //当不是正在进行的悬赏...
                    if (topic.Special != 2)
                    {
                        if (topicprice > usergroupinfo.Maxprice && usergroupinfo.Maxprice > 0)
                        {
                            if (userextcreditsinfo.Unit.Equals(""))
                            {
                                AddErrLine(string.Format("主题售价不能高于 {0} {1}", usergroupinfo.Maxprice, userextcreditsinfo.Name));
                            }
                            else
                            {
                                AddErrLine(string.Format("主题售价不能高于 {0} {1}({2})", usergroupinfo.Maxprice, userextcreditsinfo.Name, userextcreditsinfo.Unit));
                            }
                        }
                        else if (topicprice > 0 && usergroupinfo.Maxprice <= 0)
                        {
                            AddErrLine(string.Format("您当前的身份 \"{0}\" 未被允许出售主题", usergroupinfo.Grouptitle));
                        }
                        else if (topicprice < 0)
                        {
                            AddErrLine("主题售价不能为负数");
                        }
                    }
                    else
                    {
                        if (usergroupinfo.Radminid != 1)
                        {
                            if (usergroupinfo.Allowbonus == 0)
                            {
                                AddErrLine(string.Format("您当前的身份 \"{0}\" 未被允许进行悬赏", usergroupinfo.Grouptitle));
                            }

                            if (topicprice < usergroupinfo.Minbonusprice || topicprice > usergroupinfo.Maxbonusprice)
                            {
                                AddErrLine(string.Format("悬赏价格超出范围, 您应在 {0} - {1} {2}{3} 范围内进行悬赏", usergroupinfo.Minbonusprice, usergroupinfo.Maxbonusprice,
                                                         userextcreditsinfo.Unit, userextcreditsinfo.Name));
                            }
                        }
                    }
                }
                else
                {
                    if (topic.Special != 2)
                    {
                        AddErrLine("主题售价只能为整数");
                    }
                    else
                    {
                        AddErrLine("悬赏价格只能为整数");
                    }
                }
                #endregion

                #region 辩论信息
                if (!Utils.StrIsNullOrEmpty(DNTRequest.GetString("updatedebate")) && topic.Special == 4)
                {
                    if (usergroupinfo.Allowdebate != 1)
                    {
                        AddErrLine("您当前的身份 \"" + usergroupinfo.Grouptitle + "\" 没有发布辩论的权限");
                        return;
                    }
                    if (Utils.StrIsNullOrEmpty(DNTRequest.GetString("positiveopinion")))
                    {
                        AddErrLine("正方观点不能为空");
                        return;
                    }
                    if (Utils.StrIsNullOrEmpty(DNTRequest.GetString("negativeopinion")))
                    {
                        AddErrLine("反方观点不能为空");
                        return;
                    }
                    if (Utils.StrIsNullOrEmpty(DNTRequest.GetString("terminaltime")))
                    {
                        AddErrLine("辩论的结束日期不能为空");
                        return;
                    }
                    if (!Utils.IsDateString(DNTRequest.GetString("terminaltime")))
                    {
                        AddErrLine("结束日期格式不正确");
                        return;
                    }
                }
                #endregion
            }

            #region 绑定并检查主题和帖子信息
            if (useradminid == 1)
            {
                postinfo.Title = Utils.HtmlEncode(postTitle);

                if (usergroupinfo.Allowhtml == 0)
                {
                    postinfo.Message = Utils.HtmlEncode(postMessage);
                }
                else
                {
                    postinfo.Message = ishtmlon ? postMessage :
                                       Utils.HtmlEncode(postMessage);
                }
            }
            else
            {
                postinfo.Title = Utils.HtmlEncode(ForumUtils.BanWordFilter(postTitle));

                if (usergroupinfo.Allowhtml == 0)
                {
                    postinfo.Message = Utils.HtmlEncode(ForumUtils.BanWordFilter(postMessage));
                }
                else
                {
                    postinfo.Message = ishtmlon ? ForumUtils.BanWordFilter(postMessage) :
                                       Utils.HtmlEncode(ForumUtils.BanWordFilter(postMessage));
                }
            }
            postinfo.Title = postinfo.Title.Length > 60 ? postinfo.Title.Substring(0, 60) : postinfo.Title;

            if (useradminid != 1 && (ForumUtils.HasBannedWord(postTitle) || ForumUtils.HasBannedWord(postMessage)))
            {
                string bannedWord = ForumUtils.GetBannedWord(postTitle) == string.Empty ? ForumUtils.GetBannedWord(postMessage) : ForumUtils.GetBannedWord(postTitle);
                AddErrLine(string.Format("对不起, 您提交的内容包含不良信息  <font color=\"red\">{0}</font>, 请返回修改!", bannedWord));
                return;
            }

            //if (useradminid != 1 && (ForumUtils.HasAuditWord(postinfo.Title) || ForumUtils.HasAuditWord(postinfo.Message)))
            //{
            //    AddErrLine("对不起, 管理员设置了需要对发帖进行审核, 您没有权力编辑已通过审核的帖子, 请返回修改!");
            //    return;
            //}

            topic.Displayorder = Topics.GetTitleDisplayOrder(usergroupinfo, useradminid, forum, topic, message, disablepostctrl);

            #endregion
            // 检察上面验证是否有错误
            if (IsErr())
            {
                return;
            }
            //如果是不是管理员组,或者编辑间隔超过60秒,则附加编辑信息
            if (Utils.StrDateDiffSeconds(postinfo.Postdatetime, 60) > 0 && config.Editedby == 1 && useradminid != 1)
            {
                postinfo.Lastedit = username + " 最后编辑于 " + Utils.GetDateTime();
            }

            postinfo.Usesig      = Utils.StrToInt(DNTRequest.GetString("usesig"), 0);
            postinfo.Htmlon      = (usergroupinfo.Allowhtml == 1 && ishtmlon ? 1 : 0);
            postinfo.Smileyoff   = smileyoff == 0 ? TypeConverter.StrToInt(DNTRequest.GetString("smileyoff")) : smileyoff;
            postinfo.Bbcodeoff   = (usergroupinfo.Allowcusbbcode == 1 ? TypeConverter.StrToInt(DNTRequest.GetString("bbcodeoff")) : 1);
            postinfo.Parseurloff = TypeConverter.StrToInt(DNTRequest.GetString("parseurloff"));
            postinfo.Invisible   = needaudit ? 1 : 0;

            //如果当前用户就是作者或所在管理组有编辑的权限
            if (userid == postinfo.Posterid || (admininfo != null && admininfo.Alloweditpost == 1 && Moderators.IsModer(useradminid, userid, forumid)))
            {
                alloweditpost = true;
            }
            else
            {
                AddErrLine("您当前的身份不是作者");
                return;
            }

            if (!alloweditpost)
            {
                AddErrLine("您当前的身份没有编辑帖子的权限");
                return;
            }

            if (alloweditpost)
            {
                SetTopicInfo(pollitem, topicprice, postMessage);
            }
        }
Exemplo n.º 26
0
        private IUser GetShortUserInfo()
        {
            this.postpassword = ((!this.loginauth.IsNullOrEmpty()) ? DES.Decode(this.loginauth.Replace("[", "+"), this.config.Passwordkey) : DNTRequest.GetString("password"));
            this.postusername = (this.postusername.IsNullOrEmpty() ? DNTRequest.GetString("username") : this.postusername);
            //int num;

            IUser user = null;

            //switch (this.config.Passwordmode)
            //{
            //    case 0:
            if (this.config.Secques == 1 && (!this.loginauth.IsNullOrEmpty() || !this.loginsubmit))
            {
                //num = Users.CheckPasswordAndSecques(this.postusername, this.postpassword, true, DNTRequest.GetFormInt("question", 0), DNTRequest.GetString("answer"));
                user = BBX.Entity.User.Login(this.postusername, this.postpassword, true, DNTRequest.GetFormInt("question", 0), DNTRequest.GetString("answer"));
            }
            else
            {
                //num = Users.CheckPassword(this.postusername, this.postpassword, true);
                user = BBX.Entity.User.Login(this.postusername, this.postpassword);
            }
            //break;
            //    case 1:
            //        if (this.config.Secques == 1 && (!this.loginauth.IsNullOrEmpty() || !this.loginsubmit))
            //        {
            //            num = Users.CheckDvBbsPasswordAndSecques(this.postusername, this.postpassword, DNTRequest.GetFormInt("question", 0), DNTRequest.GetString("answer"));
            //        }
            //        else
            //        {
            //            num = Users.CheckDvBbsPassword(this.postusername, this.postpassword);
            //        }
            //        break;
            //    default:
            //        return Users.CheckThirdPartPassword(this.postusername, this.postpassword, DNTRequest.GetFormInt("question", 0), DNTRequest.GetString("answer"));
            //}
            if (user == null)
            {
                return(null);
            }

            //Users.UpdateTrendStat(TrendType.Login);
            TrendStat.Today.Login++;

            return(user);
        }
Exemplo n.º 27
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;
            }

            enabletag     = config.Enabletag == 1;
            categoryslist = Space.Data.DbProvider.GetInstance().GetSpaceCategoryListByUserId(userid);
            spaceconfig   = Spaces.GetSpaceConfigByUserId(userid);
            if (DNTRequest.IsPost())
            {
                if (ForumUtils.IsCrossSitePost())
                {
                    AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                    return;
                }
                if (!Utils.IsNumeric(DNTRequest.GetString("poststatus")) || !Utils.IsNumeric(DNTRequest.GetString("commentstatus")))
                {
                    AddErrLine("请您确保 发布类型,评论类型,数据项有效!");
                    return;
                }
                if (DNTRequest.GetString("title") == "")
                {
                    AddErrLine("请您输入文章标题");
                    return;
                }
                if (DNTRequest.GetString("title").Length > 150)
                {
                    AddErrLine("请将文章标题保持在150字以内");
                    return;
                }
                if (blogcontent == "")
                {
                    AddErrLine("请您输入文章内容");
                    return;
                }

                SpacePostInfo spacepostsinfo = new SpacePostInfo();
                spacepostsinfo.Title          = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("title")));
                spacepostsinfo.Content        = Utils.HtmlEncode(ForumUtils.BanWordFilter(blogcontent));
                spacepostsinfo.Category       = DNTRequest.GetString("category");
                spacepostsinfo.PostStatus     = DNTRequest.GetFormInt("poststatus", 0);
                spacepostsinfo.CommentStatus  = DNTRequest.GetFormInt("commentstatus", 0);
                spacepostsinfo.Postdatetime   = DateTime.Now;
                spacepostsinfo.Author         = username;
                spacepostsinfo.Uid            = userid;
                spacepostsinfo.PostUpDateTime = DateTime.Now;
                spacepostsinfo.Commentcount   = 0;

                int postid = Space.Data.DbProvider.GetInstance().AddSpacePost(spacepostsinfo);

                //启用了标签功能
                if (enabletag)
                {
                    string   tags      = DNTRequest.GetString("tags").Trim();
                    string[] tagsArray = null;
                    if (!Utils.StrIsNullOrEmpty(tags))
                    {
                        tagsArray = Utils.SplitString(tags, " ", true, 10);
                        if (tagsArray != null && tagsArray.Length > 0)
                        {
                            Space.Data.DbProvider.GetInstance().CreateSpacePostTags(string.Join(" ", tagsArray), postid, userid, Utils.GetDateTime());
                            SpaceTags.WriteSpacePostTagsCacheFile(postid);
                        }
                    }
                }
                DNTCache.GetCacheService().RemoveObject("/Space/RecentUpdateSpaceAggregationList");
                SetUrl("usercpspacemanageblog.aspx");
                SetMetaRefresh();
                SetShowBackLink(true);
                AddMsgLine("文章增加成功");
            }
        }
Exemplo n.º 28
0
        /// <summary>
        /// 获取用户id
        /// </summary>
        /// <returns></returns>
        private ShortUserInfo GetShortUserInfo()
        {
            int uid = -1;

            switch (config.Passwordmode)
            {
            case 1:    //动网兼容模式
            {
                if (config.Secques == 1)
                {
                    uid = Users.CheckDvBbsPasswordAndSecques(postusername, postpassword, DNTRequest.GetFormInt("question", 0), DNTRequest.GetString("answer"));
                }
                else
                {
                    uid = Users.CheckDvBbsPassword(postusername, postpassword);
                }
                break;
            }

            case 0:    //默认模式
            {
                if (config.Secques == 1)
                {
                    uid = Users.CheckPasswordAndSecques(postusername, postpassword, true, DNTRequest.GetFormInt("question", 0), DNTRequest.GetString("answer"));
                }
                else
                {
                    uid = Users.CheckPassword(postusername, postpassword, true);
                }
                break;
            }

            default:     //第三方加密验证模式
            {
                return((ShortUserInfo)Users.CheckThirdPartPassword(postusername, postpassword, DNTRequest.GetFormInt("question", 0), DNTRequest.GetString("answer")));
            }
            }
            if (uid != -1)
            {
                Users.UpdateTrendStat(TrendType.Login);
            }
            return(uid > 0 ? Users.GetShortUserInfo(uid) : null);
        }
Exemplo n.º 29
0
        protected override void ShowPage()
        {
            if (usergroupinfo.Radminid == 0)
            {
                AddErrLine("您没有推荐主题的权限!");
                return;
            }
            if (tid == -1)
            {
                return;
            }
            DataTable postInfo = BlockEntries.GetPostInfoByTid(tid);

            title        = postInfo.Rows[0]["title"].ToString();
            summary      = Utils.RemoveHtml(Utils.ClearUBB(postInfo.Rows[0]["message"].ToString().Trim()));
            poster       = postInfo.Rows[0]["poster"].ToString();
            postdatetime = postInfo.Rows[0]["postdatetime"].ToString().Trim();
            //如果是提交...
            if (ispost)
            {
                blockid   = DNTRequest.GetFormInt("blockid", -1);
                blockName = DNTRequest.GetFormString("blockname");
                title     = DNTRequest.GetFormString("topicTitle");
                summary   = DNTRequest.GetFormString("summary");
                NormalValidate(blockName, blockid, title, summary);

                BlockEntryInfo blockEntries = new BlockEntryInfo();
                blockEntries.title             = title;
                blockEntries.blockid           = blockid;
                blockEntries.image             = DNTRequest.GetFormString("selectImage");
                blockEntries.summary           = summary;
                blockEntries.author            = DNTRequest.GetFormString("poster");
                blockEntries.postdatetime      = TypeConverter.StrToDateTime(DNTRequest.GetFormString("postdatetime"));
                blockEntries.link              = "showtopic.aspx?tid=" + tid;
                blockEntries.foretag           = "";
                blockEntries.reartag           = "";
                blockEntries.color             = "";
                blockEntries.html              = "";
                blockEntries.pushedbyuid       = userid;
                blockEntries.pubshedbyusername = username;
                blockEntries.pusheddatetime    = DateTime.Now;
                blockEntries.displayorder      = 1;
                BlockEntries.AddBlockEntry(blockEntries);
                AddMsgLine("推荐成功");
                SetUrl(Urls.ShowDebateAspxRewrite(topicid));
                #region 验证提交信息
                if (IsErr())
                {
                    return;
                }

                //// 如果用户上传了附件,则检测用户是否有上传附件的权限
                //if (ForumUtils.IsPostFile())
                //{
                //    if (Utils.StrIsNullOrEmpty(Attachments.GetAttachmentTypeArray(attachmentTypeSelect)))
                //        AddErrLine("系统不允许上传附件");

                //    if (!UserAuthority.PostAttachAuthority(forum, usergroupinfo, userid, ref msg))
                //        AddErrLine(msg);
                //}

                ////发悬赏校验
                //int topicprice = 0;
                //bool isbonus = type == "bonus";
                //ValidateBonus(ref topicprice, ref isbonus);

                ////发特殊主题校验
                //ValidatePollAndDebate();

                //if (IsErr())
                //    return;
                #endregion
                if (IsErr())
                {
                    return;
                }

                if (IsErr())
                {
                    return;
                }

                //如果已登录就不需要再登录
                if (needlogin && userid > 0)
                {
                    needlogin = false;
                }
            }
            else //非提交操作
            {
                AddLinkCss(BaseConfigs.GetForumPath + "templates/" + templatepath + "/editor.css", "css");
            }
        }
Exemplo n.º 30
0
        public void SubmitButton_Click(object sender, EventArgs e)
        {
            bool err = false;

            for (int i = 1; i <= fileList.Count; i++)
            {
                if (DNTRequest.GetFormString("id" + i) != "")
                {
                    try
                    {
                        if (!Utils.IsNumeric(DNTRequest.GetInt("typeid", 0)))
                        {
                            err = true;
                            continue;
                        }
                        DatabaseProvider.GetInstance().AddSmiles(DatabaseProvider.GetInstance().GetMaxSmiliesId(), DNTRequest.GetFormInt("order" + i, 0), DNTRequest.GetInt("typeid", 0), DNTRequest.GetFormString("code" + i), DNTRequest.GetFormString("url" + i));
                    }
                    catch
                    {
                        base.RegisterStartupScript("", "<script>alert('出现错误,可能文件超出长度!');window.location.href='forum_smilegrid.aspx?typeid=" + DNTRequest.GetInt("typeid", 0) + "';</script>");
                    }
                }
            }
            UpdateSmiliesCache();
            base.RegisterStartupScript("", "<script>" + (err ? "alert('增加的记录中某个显示顺序是非数字,该记录未能增加!');" : "") + "window.location.href='forum_smilegrid.aspx?typeid=" + DNTRequest.GetInt("typeid", 0) + "';</script>");
        }