/// <summary> /// 创建主题信息 /// </summary> /// <param name="admininfo"></param> /// <param name="postmessage"></param> /// <param name="isbonus"></param> /// <param name="topicprice"></param> /// <returns></returns> public TopicInfo CreateTopic(AdminGroupInfo admininfo, string postmessage, bool isbonus, int topicprice) { TopicInfo topicinfo = new TopicInfo(); topicinfo.Fid = forumid; topicinfo.Iconid = (DNTRequest.GetInt("iconid", 0) < 0 || DNTRequest.GetInt("iconid", 0) > 15) ? 0 : DNTRequest.GetInt("iconid", 0); message = Posts.GetPostMessage(usergroupinfo, admininfo, postmessage, (TypeConverter.StrToInt(DNTRequest.GetString("htmlon")) == 1)); topicinfo.Title = (useradminid == 1) ? Utils.HtmlEncode(posttitle) : Utils.HtmlEncode(ForumUtils.BanWordFilter(posttitle)); 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(topicinfo); } if (Utils.GetCookie("lasttopictitle") == Utils.MD5(topicinfo.Title) || Utils.GetCookie("lasttopicmessage") == Utils.MD5(message)) { AddErrLine("请勿重复发帖"); return(topicinfo); } topicinfo.Typeid = DNTRequest.GetInt("typeid", 0); if (usergroupinfo.Allowsetreadperm == 1) { topicinfo.Readperm = DNTRequest.GetInt("topicreadperm", 0) > 255 ? 255 : DNTRequest.GetInt("topicreadperm", 0); } topicinfo.Price = topicprice; topicinfo.Poster = username; topicinfo.Posterid = userid; topicinfo.Postdatetime = curdatetime; topicinfo.Lastpost = curdatetime; topicinfo.Lastposter = username; topicinfo.Displayorder = Topics.GetTitleDisplayOrder(usergroupinfo, useradminid, forum, topicinfo, message, disablepost); string htmltitle = DNTRequest.GetString("htmltitle").Trim(); if (!Utils.StrIsNullOrEmpty(htmltitle) && Utils.HtmlDecode(htmltitle).Trim() != topicinfo.Title) { //按照 附加位/htmltitle(1位)/magic(3位)/以后扩展(未知位数) 的方式来存储 例: 11001 topicinfo.Magic = 11000; } //标签(Tag)操作 string tags = DNTRequest.GetString("tags").Trim(); string[] tagArray = null; if (enabletag && !Utils.StrIsNullOrEmpty(tags)) { if (ForumUtils.InBanWordArray(tags)) { AddErrLine("标签中含有系统禁止词语,请修改"); return(topicinfo); } tagArray = Utils.SplitString(tags, " ", true, 2, 10); if (tagArray.Length > 0 && tagArray.Length <= 5) { if (topicinfo.Magic == 0) { topicinfo.Magic = 10000; } topicinfo.Magic = Utils.StrToInt(topicinfo.Magic.ToString() + "1", 0); } else { AddErrLine("超过标签数的最大限制或单个标签长度没有介于2-10之间,最多可填写 5 个标签"); return(topicinfo); } } if (isbonus) { topicinfo.Special = 2; //检查积分是否足够 if (mybonustranscredits < topicprice && usergroupinfo.Radminid != 1) { AddErrLine(string.Format("无法进行悬赏<br /><br />您当前的{0}为 {1} {3}<br/>悬赏需要{0} {2} {3}", bonusextcreditsinfo.Name, mybonustranscredits, topicprice, bonusextcreditsinfo.Unit)); return(topicinfo); } else { Users.UpdateUserExtCredits(topicinfo.Posterid, Scoresets.GetBonusCreditsTrans(), -topicprice * (Scoresets.GetCreditsTax() + 1)); //计算税后的实际支付 } } if (type == "poll") { topicinfo.Special = 1; } if (type == "debate") //辩论帖 { topicinfo.Special = 4; } if (!Moderators.IsModer(useradminid, userid, forumid)) { topicinfo.Attention = 1; } if (ForumUtils.IsHidePost(postmessage) && usergroupinfo.Allowhidecode == 1) { topicinfo.Hide = 1; } topicinfo.Tid = Topics.CreateTopic(topicinfo); //canhtmltitle = config.Htmltitle == 1 && Utils.InArray(usergroupid.ToString(), config.Htmltitleusergroup); //canhtmltitle = config.Htmltitle == 1 && usergroupinfo.Allowhtml == 1; //保存htmltitle if (canhtmltitle && !Utils.StrIsNullOrEmpty(htmltitle) && htmltitle != topicinfo.Title) { Topics.WriteHtmlTitleFile(Utils.RemoveUnsafeHtml(htmltitle), topicinfo.Tid); } if (enabletag && tagArray != null && tagArray.Length > 0) { if (useradminid != 1 && ForumUtils.HasBannedWord(tags)) { string bannedWord = ForumUtils.GetBannedWord(tags); AddErrLine(string.Format("标签中含有系统禁止词语 <font color=\"red\">{0}</font>,请修改", bannedWord)); return(topicinfo); } ForumTags.CreateTopicTags(tagArray, topicinfo.Tid, userid, curdatetime); } if (type == "debate") { DebateInfo debatetopic = new DebateInfo(); debatetopic.Tid = topicinfo.Tid; debatetopic.Positiveopinion = DNTRequest.GetString("positiveopinion"); debatetopic.Negativeopinion = DNTRequest.GetString("negativeopinion"); debatetopic.Terminaltime = Convert.ToDateTime(DNTRequest.GetString("terminaltime")); Topics.CreateDebateTopic(debatetopic); } Topics.AddParentForumTopics(forum.Parentidlist.Trim(), 1); return(topicinfo); }
/// <summary> /// 绑定列表 /// </summary> /// <param name="pageIndex"></param> private void BindGridView(int pageIndex) { StringBuilder strWhere = new StringBuilder(); strWhere.Append(" 1=1 "); string CompanyID = ""; if (ddlProjectType.SelectValue != "" && ddlProjectType.SelectValue != "0") { strWhere.Append(" AND a.ProjectType=(select SystemInfoCode from T_SystemInfo where SystemInfoID=" + ddlProjectType.SelectValue + ") "); } if (kgsj1.Text.Trim().Length > 0) { strWhere.Append(" AND a.kgsj>='" + kgsj1.Text.Trim() + " 00:00:00.00 ' "); } if (kgsj2.Text.Trim().Length > 0) { strWhere.Append(" AND a.kgsj<='" + kgsj2.Text.Trim() + " 23:59:59.99' "); } if (jgsj1.Text.Trim().Length > 0) { strWhere.Append(" AND a.jgsj>='" + jgsj1.Text.Trim() + " 00:00:00.00 ' "); } if (jgsj2.Text.Trim().Length > 0) { strWhere.Append(" AND a.jgsj<='" + jgsj2.Text.Trim() + " 23:59:59.99' "); } if (txtGcbm.Text.Trim().Length > 0) { strWhere.Append(" AND a.gcbm like '%" + txtGcbm.Text.Trim() + "%' "); } if (txtGcmc.Text.Trim().Length > 0) { strWhere.Append(" AND a.gcmc like '%" + txtGcmc.Text.Trim() + "%' "); } if (txtGcdd.Text.Trim().Length > 0) { strWhere.Append(" AND a.gcdd like '%" + txtGcdd.Text.Trim() + "%' "); } if (txtghxkzh.Text.Trim().Length > 0) { strWhere.Append(" AND a.ghxkzh like '%" + txtghxkzh.Text.Trim() + "%' "); } if (txtsgxkzh.Text.Trim().Length > 0) { strWhere.Append(" AND a.sgxkzh like '%" + txtsgxkzh.Text.Trim() + "%' "); } if (ddlChargeUserID.SelectValue != "" && ddlChargeUserID.SelectValue != "0") { strWhere.Append(" AND a.ChargeUserID= " + ddlChargeUserID.SelectValue); } if (PublicModel.isSuperAdmin()) //超级管理员 { CompanyID = "0"; strWhere.Append(" and a.Area_Code like '" + ConvertEx.ToString(Session["AREA_CODE"]) + "%'"); } else if (PublicModel.isArchiveUser()) //档案馆用户看自己的 { CompanyID = "0"; strWhere.Append(" and a.Area_Code like '" + ConvertEx.ToString(Session["OLD_AREA_CODE"]) + "%'"); } else { if (Common.Session.GetSessionInt("CompanyType") == SystemSet._JSCOMPANYINFO) //其他人只能看自己的 { CompanyID = Common.Session.GetSession("CompanyId"); } else { CompanyID = "0"; strWhere.Append(" AND EXISTS(select SingleProjectID from T_SingleProjectCompany where "); strWhere.Append("CompanyID=" + Common.Session.GetSession("CompanyId") + " AND SingleProjectID=a.SingleProjectID )"); } } if (ViewState["CurrentPageIndex"] == null && Common.ConvertEx.ToInt(DNTRequest.GetQueryString("PageIndex")) > 0) { pageIndex = Common.ConvertEx.ToInt(DNTRequest.GetQueryString("PageIndex")); ViewState["CurrentPageIndex"] = pageIndex; } else { pageIndex = ConvertEx.ToInt(ViewState["CurrentPageIndex"]); } DataTable dt = singleProjectBLL.GetListPaging(ConvertEx.ToInt(CompanyID), strWhere.ToString(), pageSize, pageIndex, out itemCount);; AspNetPager.AlwaysShow = true; AspNetPager.PageSize = pageSize; AspNetPager.RecordCount = itemCount; AspNetPager.CurrentPageIndex = pageIndex; rpData.DataSource = dt; rpData.DataBind(); }
private void DeleteUserGroupInf_Click(object sender, EventArgs e) { #region 除用户组 if (this.CheckCookie()) { if (AdminUserGroups.DeleteUserGroupInfo(DNTRequest.GetInt("groupid", -1))) { Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList"); Discuz.Forum.UserGroups.GetUserGroupList(); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台删除特殊用户组", "组ID:" + DNTRequest.GetInt("groupid", -1)); base.RegisterStartupScript("PAGE", "window.location.href='global_usergroupspecialgrid.aspx';"); } else { if (AdminUserGroups.opresult != "") { base.RegisterStartupScript("", "<script>alert('操作失败,原因:" + AdminUserGroups.opresult + "');window.location.href='global_usergroupspecialgrid.aspx';</script>"); } else { base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergroupspecialgrid.aspx';</script>"); } } } #endregion }
private string GetTopicType() { #region 获取主题分类 string tmpType = __foruminfo.Topictypes; int i = 0; DataTable topicTypes = DbHelper.ExecuteDataset(DatabaseProvider.GetInstance().GetTopicTypes()).Tables[0]; while (true) { #region if (DNTRequest.GetFormString("type" + i) == "") //循环处理选择的主题分类 { break; } else { if (DNTRequest.GetFormString("type" + i) != "-1") //-1不使用,0平板显示,1下拉显示 { string oldtopictype = DNTRequest.GetFormString("oldtopictype" + i); //旧主题分类 string newtopictype = DNTRequest.GetFormString("type" + i); //新主题分类 if (oldtopictype == null || oldtopictype == "") { //tmpType += newtopictype; int insertOrder = GetDisplayOrder(newtopictype.Split(',')[1], topicTypes); ArrayList topictypesal = new ArrayList(); foreach (string topictype in tmpType.Split('|')) { if (topictype != "") { topictypesal.Add(topictype); } } bool isInsert = false; for (int j = 0; j < topictypesal.Count; j++) { int curDisplayOrder = GetDisplayOrder(topictypesal[j].ToString().Split(',')[1], topicTypes); if (curDisplayOrder > insertOrder) { topictypesal.Insert(j, newtopictype); isInsert = true; break; } } if (!isInsert) { topictypesal.Add(newtopictype); } tmpType = ""; foreach (object t in topictypesal) { tmpType += t.ToString() + "|"; } } else { tmpType = tmpType.Replace(oldtopictype, newtopictype); } } else { if (DNTRequest.GetFormString("oldtopictype" + i) != "") { tmpType = tmpType.Replace(DNTRequest.GetFormString("oldtopictype" + i), ""); } } } #endregion i++; } return(tmpType); #endregion }
protected override void ShowPage() { if (userid == -1) { AddErrLine("你尚未登录"); return; } if (config.Enablemall < 2) { AddErrLine("当前操作只有在开启商城(高级)模式时才可以使用!"); return; } user = Users.GetUserInfo(userid); if (item == "") { item = "shopcategory"; } if (item == "recommend") { recommendgoodslist = Goods.GetGoodsRecommendManageList(userid, 6, 1, ""); } reccount = (shopgoodscategoryid <= 0) ? Goods.GetGoodsCountBySellerUid(userid, true) : Goods.GetGoodsCountByShopCategory(shopgoodscategoryid, ""); // 得到分页大小设置 int pagesize = 10; //修正请求页数中可能的错误 if (pageid < 1) { pageid = 1; } //获取总页数 pagecount = reccount % pagesize == 0 ? reccount / pagesize : reccount / pagesize + 1; if (pagecount == 0) { pagecount = 1; } if (pageid > pagecount) { pageid = pagecount; } shopinfo = Shops.GetShopByUserId(user.Uid); //如果不是提交... if (!ispost) { if (shopgoodscategoryid <= 0) { goodslist = Goods.GetGoodsListBySellerUID(userid, true, pagesize, pageid, "lastupdate", 1); } else { goodslist = Goods.GetGoodsInfoListByShopCategory(shopgoodscategoryid, pagesize, pageid, "", "lastupdate", 1); } pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "usercpshopgoodsmanage.aspx?item=" + item + "&shopgoodscategoryid=" + shopgoodscategoryid, 8); shopcategorydt = ShopCategories.GetShopCategoryTable(shopinfo.Shopid); shopcategorydt_count = shopcategorydt.Rows.Count; shopcategorydata = ShopCategories.GetShopCategoryJson(shopcategorydt); categoryoptions = ShopCategories.GetShopCategoryOption(shopcategorydt, true); } else { string operation = DNTRequest.GetString("operation"); if (operation == "") { operation = "movecategory"; } switch (operation) { case "movecategory": //移动到商品分类 { if (goodsidlist == "") { AddErrLine("你未选中任何商品"); return; } int selectcategoryid = DNTRequest.GetInt("selectcategoryid", 0); if (selectcategoryid <= 0) { AddErrLine("你未选择要移动到的商品分类"); return; } if (Goods.IsSeller(goodsidlist, userid)) { if (Goods.MoveGoodsShopCategory(goodsidlist, selectcategoryid) > 0) { SetUrl("usercpshopgoodsmanage.aspx?item=" + item + "&shopgoodscategoryid=" + shopgoodscategoryid); SetMetaRefresh(); AddMsgLine("操作成功. <br />(<a href=\"usercpshopgoodsmanage.aspx?item=" + item + "&shopgoodscategoryid=" + shopgoodscategoryid + "\">点击这里返回</a>)<br />"); } else { AddErrLine("商品参数信息无效或所选商品已在该分类下"); return; } } else { AddErrLine("你不是当前商品的卖家,因此无法移动该商品到指定的分类"); return; } break; } case "removecategory": //移除商品分类 { int removeshopgoodscategoryid = DNTRequest.GetInt("removeshopgoodscategoryid", 0); int removegoodsid = DNTRequest.GetInt("removegoodsid", 0); if (removeshopgoodscategoryid <= 0 || removegoodsid <= 0) { AddErrLine("移除分类信息错误"); return; } if (Goods.IsSeller(removegoodsid.ToString(), userid)) { if (Goods.RemoveGoodsShopCategory(removegoodsid, removeshopgoodscategoryid) > 0) { SetUrl("usercpshopgoodsmanage.aspx?item=" + item + "&shopgoodscategoryid=" + shopgoodscategoryid); SetMetaRefresh(); AddMsgLine("操作成功. <br />(<a href=\"usercpshopgoodsmanage.aspx?item=" + item + "&shopgoodscategoryid=" + shopgoodscategoryid + "\">点击这里返回</a>)<br />"); } else { AddErrLine("商品参数信息无效或所选商品已在该分类下"); return; } } else { AddErrLine("您不是当前商品的卖家,因此无法移除该商品的分类"); return; } break; } case "recommend": //推荐商品 { if (goodsidlist == "") { AddErrLine("您未选中任何商品"); return; } if ((recommendgoodslist.Count + goodsidlist.Split(',').Length) > 5) { AddErrLine("您推荐的商品总数已大于5, 因为无法进行推荐"); return; } if (Goods.IsSeller(goodsidlist, userid)) { Goods.RecommendGoods(goodsidlist); SetUrl("usercpshopgoodsmanage.aspx?item=" + item + "&shopgoodscategoryid=" + shopgoodscategoryid); SetMetaRefresh(); AddMsgLine("操作成功. <br />(<a href=\"usercpshopgoodsmanage.aspx?item=" + item + "&shopgoodscategoryid=" + shopgoodscategoryid + "\">点击这里返回</a>)<br />"); } else { AddErrLine("您不是当前商品的卖家,因此无法推荐该商品"); return; } break; } case "cancelrecommend": //取消推荐商品 { goodsidlist = DNTRequest.GetString("cancelrecommendgoodsid"); if (goodsidlist == "") { AddErrLine("您未选中任何商品"); return; } if (Goods.IsSeller(goodsidlist, userid)) { Goods.CancelRecommendGoods(goodsidlist); SetUrl("usercpshopgoodsmanage.aspx?item=" + item + "&shopgoodscategoryid=" + shopgoodscategoryid); SetMetaRefresh(); AddMsgLine("操作成功. <br />(<a href=\"usercpshopgoodsmanage.aspx?item=" + item + "&shopgoodscategoryid=" + shopgoodscategoryid + "\">点击这里返回</a>)<br />"); } else { AddErrLine("你不是当前商品的卖家,因此无法取消推荐该商品"); return; } break; } case "updatedisplayorder": //更新商品显示顺序 { foreach (Goodsinfo goodsinfo in recommendgoodslist) { //当显示顺序值发生变化时,则更新相应的商品信息 if (goodsinfo.Displayorder != DNTRequest.GetInt("displayorder_" + goodsinfo.Goodsid, 0)) { goodsinfo.Displayorder = DNTRequest.GetInt("displayorder_" + goodsinfo.Goodsid, 0); Goods.UpdateGoods(goodsinfo); } } SetUrl("usercpshopgoodsmanage.aspx?item=" + item + "&shopgoodscategoryid=" + shopgoodscategoryid); SetMetaRefresh(); AddMsgLine("操作成功. <br />(<a href=\"usercpshopgoodsmanage.aspx?item=" + item + "&shopgoodscategoryid=" + shopgoodscategoryid + "\">点击这里返回</a>)<br />"); break; } } } }
//public DataTable GroupParticipateScore(string raterange) //{ // #region 用数据库中的记录更新已装入的默认数据 // NewParticipateScore(); // int i = 0; // foreach (string raterangestr in raterange.Split('|')) // { // if (raterangestr.Trim() != "") // { // string[] scoredata = raterangestr.Split(','); // if (scoredata[1].Trim() == "True") // templateDT.Rows[i]["available"] = true; // templateDT.Rows[i]["Min"] = scoredata[4].Trim(); // templateDT.Rows[i]["Max"] = scoredata[5].Trim(); // templateDT.Rows[i]["MaxInDay"] = scoredata[6].Trim(); // } // i++; // } // return templateDT; // #endregion //} protected void DataGrid_Update(Object sender, DataGridCommandEventArgs e) { #region 编辑相关的积分设置信息 string id = DataGrid1.DataKeys[(int)e.Item.ItemIndex].ToString(); bool available = ((CheckBox)e.Item.FindControl("available")).Checked; string Min = ((TextBox)e.Item.Cells[5].Controls[0]).Text.Trim(); string Max = ((TextBox)e.Item.Cells[6].Controls[0]).Text.Trim(); string MaxInDay = ((TextBox)e.Item.Cells[7].Controls[0]).Text.Trim(); LoadDataInfo(); int count = Convert.ToInt16(id) - 1; templateDT.Rows[count]["available"] = available; if (Min == "" || Max == "" || MaxInDay == "") { base.RegisterStartupScript("", GetMessageScript("评分的最小值,最大值以及24小时最大评分数不能为空.")); return; } if ((Min != "" && !Utils.IsNumeric(Min.Replace("-", ""))) || (Max != "" && !Utils.IsNumeric(Max.Replace("-", ""))) || (MaxInDay != "" && !Utils.IsNumeric(MaxInDay.Replace("-", "")))) { base.RegisterStartupScript("", GetMessageScript("输入的数据必须是数字.")); return; } if (Convert.ToInt16(Utils.SBCCaseToNumberic(Min)) >= Convert.ToInt16(Utils.SBCCaseToNumberic(Max))) { base.RegisterStartupScript("", GetMessageScript("评分的最小值必须小于评分最大值.")); return; } templateDT.Rows[count]["Min"] = Convert.ToInt16(Utils.SBCCaseToNumberic(Min)); templateDT.Rows[count]["Max"] = Convert.ToInt16(Utils.SBCCaseToNumberic(Max)); templateDT.Rows[count]["MaxInDay"] = Convert.ToInt16(Utils.SBCCaseToNumberic(MaxInDay)); try { WriteScoreInf(templateDT); DataGrid1.EditItemIndex = -1; DataGrid1.DataSource = LoadDataInfo(); DataGrid1.DataBind(); base.RegisterStartupScript("PAGE", "window.location.href='global_allowparticipatescore.aspx?pagename=" + DNTRequest.GetString("pagename") + "&groupid=" + DNTRequest.GetString("groupid") + "';"); } catch { base.RegisterStartupScript("", GetMessageScript("无法更新数据库.")); return; } #endregion }
public void WriteScoreInf(DataTable dt) { #region 向数据库中写入允许的评分范围内容 string scorecontent = ""; foreach (DataRow dr in dt.Rows) { scorecontent += string.Format("{0},{1},{2},{3},{4},{5},{6}|", dr["id"].ToString(), dr["available"].ToString(), dr["ScoreCode"].ToString(), dr["ScoreName"].ToString(), dr["Min"].ToString(), dr["Max"].ToString(), dr["MaxInDay"].ToString()); } Forum.UserGroups.UpdateUserGroupRaterange(scorecontent.Substring(0, scorecontent.Length - 1), DNTRequest.GetInt("groupid", 0)); templateDT.Clear(); Caches.ReSetUserGroupList(); #endregion }
public void VerifyLoginInf() { if (!Discuz.Forum.OnlineUsers.CheckUserVerifyCode(olid, DNTRequest.GetString("vcode"))) { Response.Redirect("syslogin.aspx?result=3"); return; } UserInfo userInfo = null; if (config.Passwordmode == 1) { userInfo = Users.GetUserInfo(Users.CheckDvBbsPassword(DNTRequest.GetString("username"), DNTRequest.GetString("password"))); } else if (config.Passwordmode == 0) { userInfo = Users.GetUserInfo(Users.CheckPassword(DNTRequest.GetString("username"), Utils.MD5(DNTRequest.GetString("password")), false)); } else//第三方加密验证模式 { userInfo = Users.CheckThirdPartPassword(DNTRequest.GetString("username"), DNTRequest.GetString("password"), -1, null); } if (userInfo != null) { UserGroupInfo usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(userInfo.Groupid); if (usergroupinfo.Radminid == 1) { ForumUtils.WriteUserCookie(userInfo.Uid, 1440, GeneralConfigs.GetConfig().Passwordkey); UserGroupInfo userGroupInfo = AdminUserGroups.AdminGetUserGroupInfo(userInfo.Groupid); HttpCookie cookie = new HttpCookie("dntadmin"); cookie.Values["key"] = ForumUtils.SetCookiePassword(userInfo.Password + userInfo.Secques + userInfo.Uid, config.Passwordkey); cookie.Expires = DateTime.Now.AddMinutes(30); HttpContext.Current.Response.AppendCookie(cookie); AdminVistLogs.InsertLog(userInfo.Uid, userInfo.Username, userInfo.Groupid, userGroupInfo.Grouptitle, DNTRequest.GetIP(), "后台管理员登陆", ""); try { SoftInfo.LoadSoftInfo(); } catch { Response.Write("<script type=\"text/javascript\">top.location.href='index.aspx';</script>"); Response.End(); } //升级general.config文件 try { GeneralConfigs.Serialiaze(GeneralConfigs.GetConfig(), Server.MapPath("../config/general.config")); } catch { } Response.Write("<script type=\"text/javascript\">top.location.href='index.aspx';</script>"); Response.End(); } else { Response.Redirect("syslogin.aspx?result=2"); } } else { Response.Redirect("syslogin.aspx?result=1"); } }
protected void Page_Load(object sender, EventArgs e) { UserName.Attributes.Remove("class"); PassWord.Attributes.Remove("class"); UserName.AddAttributes("style", "width:200px"); PassWord.AddAttributes("style", "width:200px"); config = GeneralConfigs.GetConfig(); OnlineUserInfo oluserinfo = Discuz.Forum.OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout); olid = oluserinfo.Olid; if (!Page.IsPostBack) { #region 如果IP访问列表有设置则进行判断 if (config.Adminipaccess.Trim() != "") { string[] regctrl = Utils.SplitString(config.Adminipaccess, "\n"); if (!Utils.InIPArray(DNTRequest.GetIP(), regctrl)) { StringBuilder sb = new StringBuilder(); sb.Append("<br /><br /><div style=\"width:100%\" align=\"center\"><div align=\"center\" style=\"width:600px; border:1px dotted #FF6600; background-color:#FFFCEC; margin:auto; padding:20px;\">"); sb.Append("<img src=\"images/hint.gif\" border=\"0\" alt=\"提示:\" align=\"absmiddle\" /> 您的IP地址不在系统允许的范围之内</div></div>"); Response.Write(sb.ToString()); Response.End(); return; } } #endregion #region 用户身份判断 UserGroupInfo usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(oluserinfo.Groupid); if (oluserinfo.Userid <= 0 || usergroupinfo.Radminid != 1) { string message = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; message += "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>无法确认您的身份</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">"; message += "<link href=\"styles/default.css\" type=\"text/css\" rel=\"stylesheet\"></head><script type=\"text/javascript\">if(top.location!=self.location){top.location.href = \"syslogin.aspx\";}</script><body><br /><br /><div style=\"width:100%\" align=\"center\">"; message += "<div align=\"center\" style=\"width:600px; border:1px dotted #FF6600; background-color:#FFFCEC; margin:auto; padding:20px;\"><img src=\"images/hint.gif\" border=\"0\" alt=\"提示:\" align=\"absmiddle\" width=\"11\" height=\"13\" /> "; message += "无法确认您的身份, 请<a href=\"../login.aspx\">登录</a></div></div></body></html>"; Response.Write(message); Response.End(); return; } #endregion #region 判断安装目录文件信息 if (IsExistsSetupFile()) { string message = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; message += "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>请将您的安装目录即install/目录下的文件全部删除, 以免其它用户运行安装该程序!</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">"; message += "<link href=\"styles/default.css\" type=\"text/css\" rel=\"stylesheet\"></head><script type=\"text/javascript\">if(top.location!=self.location){top.location.href = \"syslogin.aspx\";}</script><body><br /><br /><div style=\"width:100%\" align=\"center\">"; message += "<div align=\"center\" style=\"width:660px; border:1px dotted #FF6600; background-color:#FFFCEC; margin:auto; padding:20px;\"><img src=\"images/hint.gif\" border=\"0\" alt=\"提示:\" align=\"absmiddle\" width=\"11\" height=\"13\" /> "; message += "请将您的安装目录(install/)下和升级目录(upgrade/)下的.aspx文件及bin/Discuz.Install.dll全部删除, 以免其它用户运行安装或升级程序!</div></div></body></html>"; Response.Write(message); Response.End(); return; } #endregion #region 显示相关页面登陆提交信息 if (Context.Request.Cookies["dntadmin"] == null || Context.Request.Cookies["dntadmin"]["key"] == null || ForumUtils.GetCookiePassword(Context.Request.Cookies["dntadmin"]["key"].ToString(), config.Passwordkey) != (oluserinfo.Password + Discuz.Forum.Users.GetUserInfo(oluserinfo.Userid).Secques + oluserinfo.Userid.ToString())) { Msg.Text = "<IMG alt=\"提示:\" src=\"images/warning.gif\" align=\"absMiddle\" border=\"0\" width=\"16\" height=\"16\">请重新进行管理员登录"; } if (oluserinfo.Userid > 0 && usergroupinfo.Radminid == 1 && oluserinfo.Username.Trim() != "") { UserName.Text = oluserinfo.Username; UserName.AddAttributes("readonly", "true"); UserName.CssClass = "nofocus"; UserName.Attributes.Add("onfocus", "this.className='nofocus';"); UserName.Attributes.Add("onblur", "this.className='nofocus';"); } if (DNTRequest.GetString("result") == "1") { Msg.Text = "<IMG alt=\"提示:\" src=\"images/warning.gif\" align=\"absMiddle\" border=\"0\" width=\"16\" height=\"16\"><font color=\"red\">用户不存在或密码错误</font>"; return; } if (DNTRequest.GetString("result") == "2") { Msg.Text = "<IMG alt=\"提示:\" src=\"images/warning.gif\" align=\"absMiddle\" border=\"0\" width=\"16\" height=\"16\"><font color=\"red\">用户不是管理员身分,因此无法登陆后台</font>"; return; } if (DNTRequest.GetString("result") == "3") { Msg.Text = "<IMG alt=\"提示:\" src=\"images/warning.gif\" align=\"absMiddle\" border=\"0\" width=\"16\" height=\"16\"><font color=\"red\">验证码错误,请重新输入</font>"; return; } if (DNTRequest.GetString("result") == "4") { Msg.Text = ""; return; } #endregion } if (Page.IsPostBack) { VerifyLoginInf();//对提供的信息进行验证 } else { Response.Redirect("syslogin.aspx?result=4"); } }
/// <summary> /// 投票和辩论校验 /// </summary> /// <param name="createpoll"></param> /// <param name="pollitem"></param> private void ValidatePollAndDebate() { #region 投票验证 if (DNTRequest.GetString("createpoll") == "1") { // 验证用户是否有发布投票的权限 if (usergroupinfo.Allowpostpoll != 1) { AddErrLine(string.Format("您当前的身份 \"{0}\" 没有发布投票的权限", usergroupinfo.Grouptitle)); } pollitem = Utils.SplitString(DNTRequest.GetString("PollItemname"), "\r\n"); if (pollitem.Length < 2) { AddErrLine("投票项不得少于2个"); } else if (pollitem.Length > config.Maxpolloptions) { AddErrLine(string.Format("系统设置为投票项不得多于{0}个", config.Maxpolloptions)); } else { for (int i = 0; i < pollitem.Length; i++) { if (pollitem[i].Trim().Equals("")) { AddErrLine("投票项不能为空"); } } } enddatetime = DNTRequest.GetString("enddatetime"); if (!Utils.IsDateString(enddatetime)) { AddErrLine("投票结束日期格式错误"); } } #endregion #region 辩论验证 if (type == "debate") { if (usergroupinfo.Allowdebate != 1) { AddErrLine(string.Format("您当前的身份 \"{0}\" 没有发起辩论的权限", usergroupinfo.Grouptitle)); } ; if (DNTRequest.GetString("positiveopinion") == "") { AddErrLine("正方观点不能为空"); } if (DNTRequest.GetString("negativeopinion") == "") { AddErrLine("反方观点不能为空"); } if (!Utils.IsDateString(DNTRequest.GetString("terminaltime"))) { AddErrLine("结束日期格式不正确"); } } #endregion }
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';"); } }
/// <summary> /// 悬赏校验 /// </summary> /// <param name="topicprice"></param> /// <param name="isbonus"></param> private void ValidateBonus(ref int topicprice, ref bool isbonus) { #region 悬赏/售价验证 isbonus = type == "bonus"; topicprice = 0; string tmpprice = DNTRequest.GetString("topicprice"); if (Regex.IsMatch(tmpprice, "^[0-9]*[0-9][0-9]*$") || tmpprice == "") { topicprice = Utils.StrToInt(tmpprice, 0) > 32767 ? 32767 : Utils.StrToInt(tmpprice, 0); if (!isbonus) { 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.Allowbonus == 0) { AddErrLine(string.Format("您当前的身份 \"{0}\" 未被允许进行悬赏", usergroupinfo.Grouptitle)); } if (topicprice > mybonustranscredits) { AddErrLine(string.Format("您悬赏的{0},已超过您所能支付的范围", bonusextcreditsinfo.Name)); } if (topicprice < usergroupinfo.Minbonusprice || topicprice > usergroupinfo.Maxbonusprice) { AddErrLine(string.Format("悬赏价格超出范围, 您应在 {0} - {1} {2}{3} 范围内进行悬赏", usergroupinfo.Minbonusprice, usergroupinfo.Maxbonusprice, bonusextcreditsinfo.Unit, bonusextcreditsinfo.Name)); } } } else { if (!isbonus) { AddErrLine("主题售价只能为整数"); } else { AddErrLine("悬赏价格只能为整数"); } } #endregion }
/// <summary> /// 常规项验证 /// </summary> /// <param name="admininfo"></param> /// <param name="postmessage"></param> private void NormalValidate(AdminGroupInfo admininfo, string postmessage, ShortUserInfo user) { if (ForumUtils.IsCrossSitePost()) { AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。"); return; } if (forum.Applytopictype == 1 && forum.Postbytopictype == 1 && !Utils.StrIsNullOrEmpty(topictypeselectoptions)) { if (DNTRequest.GetString("typeid").Trim().Equals("")) { AddErrLine("主题类型不能为空"); } //检测所选主题分类是否有效 if (!Forums.IsCurrentForumTopicType(DNTRequest.GetString("typeid").Trim(), forum.Topictypes)) { AddErrLine("错误的主题类型"); } } if (Utils.StrIsNullOrEmpty(DNTRequest.GetString(config.Antispamposttitle).Trim().Replace(" ", ""))) { AddErrLine("标题不能为空"); } else if (DNTRequest.GetString(config.Antispamposttitle).Length > 60) { AddErrLine("标题最大长度为60个字符,当前为 " + DNTRequest.GetString(config.Antispamposttitle).Length + " 个字符"); } if (Utils.StrIsNullOrEmpty(postmessage.Replace(" ", ""))) { AddErrLine("内容不能为空"); } if (admininfo != null && admininfo.Disablepostctrl != 1) { if (postmessage.Length < config.Minpostsize) { AddErrLine("您发表的内容过少, 系统设置要求帖子内容不得少于 " + config.Minpostsize + " 字多于 " + config.Maxpostsize + " 字"); } else if (postmessage.Length > config.Maxpostsize) { AddErrLine("您发表的内容过多, 系统设置要求帖子内容不得少于 " + config.Minpostsize + " 字多于 " + config.Maxpostsize + " 字"); } } //新用户广告强力屏蔽检查 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, DNTRequest.GetString(config.Antispamposttitle), postmessage)) { AddErrLine("发帖失败,内容中有不符合新用户强力广告屏蔽规则的字符,请检查标题和内容,如有疑问请与管理员联系"); } } } } }
/// <summary> /// 创建主题帖信息 /// </summary> /// <param name="topicinfo"></param> /// <returns></returns> public PostInfo CreatePost(TopicInfo topicinfo) { PostInfo postinfo = new PostInfo(); postinfo.Fid = forumid; postinfo.Tid = topicinfo.Tid; postinfo.Poster = username; postinfo.Posterid = userid; postinfo.Title = useradminid == 1 ? Utils.HtmlEncode(posttitle) : postinfo.Title = Utils.HtmlEncode(ForumUtils.BanWordFilter(posttitle)); postinfo.Postdatetime = curdatetime; postinfo.Message = message; postinfo.Ip = DNTRequest.GetIP(); postinfo.Invisible = UserAuthority.GetTopicPostInvisible(forum, useradminid, userid, usergroupinfo, postinfo); postinfo.Usesig = TypeConverter.StrToInt(DNTRequest.GetString("usesig")); postinfo.Htmlon = (usergroupinfo.Allowhtml == 1 && (TypeConverter.StrToInt(DNTRequest.GetString("htmlon")) == 1)) ? 1 : 0; postinfo.Smileyoff = (smileyoff == 0 && forum.Allowsmilies == 1) ? TypeConverter.StrToInt(DNTRequest.GetString("smileyoff")) : smileyoff; postinfo.Bbcodeoff = (usergroupinfo.Allowcusbbcode == 1 && forum.Allowbbcode == 1) ? postinfo.Bbcodeoff = TypeConverter.StrToInt(DNTRequest.GetString("bbcodeoff")) : 1; postinfo.Parseurloff = TypeConverter.StrToInt(DNTRequest.GetString("parseurloff")); postinfo.Topictitle = topicinfo.Title; //if (Utils.GetCookie("lasttopictitle") == Utils.MD5(postinfo.Title) || Utils.GetCookie("lasttopicmessage") == Utils.MD5(postinfo.Message)) //{ // AddErrLine("请勿重复发帖"); // return postinfo; //} try { postinfo.Pid = Posts.CreatePost(postinfo); Utils.WriteCookie("lasttopictitle", Utils.MD5(postinfo.Title)); Utils.WriteCookie("lasttopicmessage", Utils.MD5(postinfo.Message)); } catch { TopicAdmins.DeleteTopics(topicinfo.Tid.ToString(), false); AddErrLine("帖子保存出现异常"); } //创建投票 if (createpoll) { msg = Polls.CreatePoll(DNTRequest.GetFormString("PollItemname"), DNTRequest.GetString("multiple") == "on" ? 1 : 0, DNTRequest.GetInt("maxchoices", 1), DNTRequest.GetString("visiblepoll") == "on" ? 1 : 0, DNTRequest.GetString("allowview") == "on" ? 1 : 0, enddatetime, topicinfo.Tid, pollitem, userid); } return(postinfo); }
private void DeleteSet_Click(object sender, EventArgs e) { #region 除设置 if (this.CheckCookie()) { Forums.UpdateForumField(DNTRequest.GetInt("fid", 0), DNTRequest.GetString("fieldname"), "''"); base.RegisterStartupScript("PAGE", "window.location.href='forum_editforums.aspx?fid=" + DNTRequest.GetString("fid") + "&tabindex=1';"); } #endregion }
protected override void ShowPage() { #region 临时帐号发帖 //int realuserid = -1; //bool tempaccountspost = false; //string tempusername = DNTRequest.GetString("tempusername"); //if (!Utils.StrIsNullOrEmpty(tempusername) && tempusername != username) //{ // realuserid = Users.CheckTempUserInfo(tempusername, DNTRequest.GetString("temppassword"), DNTRequest.GetInt("question", 0), DNTRequest.GetString("answer")); // if (realuserid == -1) // { // AddErrLine("临时帐号登录失败,无法继续发帖。"); // return; // } // else // { // userid = realuserid; // username = tempusername; // tempaccountspost = true; // } //} #endregion if (userid > 0) { userinfo = Users.GetShortUserInfo(userid); } #region 判断是否是灌水 AdminGroupInfo admininfo = AdminGroups.GetAdminGroupInfo(usergroupid); if (admininfo != null) { disablepost = admininfo.Disablepostctrl; } if (!UserAuthority.CheckPostTimeSpan(usergroupinfo, admininfo, oluserinfo, userinfo, ref msg)) { if (continuereply != "") { AddErrLine("<b>回帖成功</b><br />由于" + msg + "后刷新继续"); } else { AddErrLine(msg); } return; } #endregion //获取主题帖信息 PostInfo postinfo = GetPostAndTopic(admininfo); if (IsErr()) { return; } forum = Forums.GetForumInfo(forumid); smileyoff = 1 - forum.Allowsmilies; bbcodeoff = (forum.Allowbbcode == 1 && usergroupinfo.Allowcusbbcode == 1) ? 0 : 1; allowimg = forum.Allowimgcode; needaudit = UserAuthority.NeedAudit(forum, useradminid, topic, userid, disablepost, usergroupinfo); #region 附件信息绑定 //得到用户可以上传的文件类型 string attachmentTypeSelect = Attachments.GetAllowAttachmentType(usergroupinfo, forum); attachextensions = Attachments.GetAttachmentTypeArray(attachmentTypeSelect); attachextensionsnosize = Attachments.GetAttachmentTypeString(attachmentTypeSelect); //得到今天允许用户上传的附件总大小(字节) int MaxTodaySize = (userid > 0 ? MaxTodaySize = Attachments.GetUploadFileSizeByuserid(userid) : 0); attachsize = usergroupinfo.Maxsizeperday - MaxTodaySize;//今天可上传得大小 //是否有上传附件的权限 canpostattach = UserAuthority.PostAttachAuthority(forum, usergroupinfo, userid, ref msg); if (canpostattach && (userinfo != null && userinfo.Uid > 0) && apb != null && config.Enablealbum == 1 && (UserGroups.GetUserGroupInfo(userinfo.Groupid).Maxspacephotosize - apb.GetPhotoSizeByUserid(userid) > 0)) { caninsertalbum = true; albumlist = apb.GetSpaceAlbumByUserId(userid); } #endregion if (!Utils.StrIsNullOrEmpty(forum.Password) && Utils.MD5(forum.Password) != ForumUtils.GetCookie("forum" + forumid + "password")) { AddErrLine("本版块被管理员设置了密码"); SetBackLink(base.ShowForumAspxRewrite(forumid, 0)); return; } #region 访问和发帖权限校验 if (!UserAuthority.VisitAuthority(forum, usergroupinfo, userid, ref msg)) { AddErrLine(msg); needlogin = true; return; } if (!UserAuthority.PostReply(forum, userid, usergroupinfo, topic)) { AddErrLine(topic.Closed == 1 ? "主题已关闭无法回复" : "您没有发表回复的权限"); needlogin = (topic.Closed == 1 ? false : true); return; } if (!UserAuthority.CheckPostTimeSpan(usergroupinfo, admininfo, oluserinfo, userinfo, ref msg)) { AddErrLine(msg); return; } #endregion // 如果是受灌水限制用户, 则判断是否是灌水 if (admininfo != null) { disablepost = admininfo.Disablepostctrl; } if (forum.Templateid > 0) { templatepath = Templates.GetTemplateItem(forum.Templateid).Directory; } AddLinkCss(BaseConfigs.GetForumPath + "templates/" + templatepath + "/editor.css", "css"); customeditbuttons = Caches.GetCustomEditButtonList(); //如果是提交... if (ispost) { string backlink = (DNTRequest.GetInt("topicid", -1) > 0 ? string.Format("postreply.aspx?topicid={0}&restore=1&forumpage=" + forumpageid, topicid) : string.Format("postreply.aspx?postid={0}&restore=1&forumpage=" + forumpageid, postid)); if (!DNTRequest.GetString("quote").Equals("")) { backlink = string.Format("{0}"e={1}", backlink, DNTRequest.GetString("quote")); } SetBackLink(backlink); #region 验证提交信息 //常规项验证 NormalValidate(admininfo, postmessage, userinfo); if (IsErr()) { return; } #endregion //是否有上传附件的权限 canpostattach = UserAuthority.PostAttachAuthority(forum, usergroupinfo, userid, ref msg); // 产生新帖子 if (!string.IsNullOrEmpty(DNTRequest.GetFormString("toreplay_user").Trim())) { postmessage = DNTRequest.GetFormString("toreplay_user").Trim() + "\n\n" + postmessage; } postinfo = CreatePostInfo(postmessage); //获取被回复帖子的作者uid int replyUserid = postid > 0 ? Posts.GetPostInfo(topicid, postid).Posterid : postinfo.Posterid; postid = postinfo.Pid; if (IsErr()) { return; } #region 当回复成功后,发送通知 if (postinfo.Pid > 0 && DNTRequest.GetString("postreplynotice") == "on") { Notices.SendPostReplyNotice(postinfo, topic, replyUserid); } #endregion //向第三方应用同步数据 Sync.Reply(postid.ToString(), topic.Tid.ToString(), topic.Title, postinfo.Poster, postinfo.Posterid.ToString(), topic.Fid.ToString(), ""); //更新主题相关信息 //UpdateTopicInfo(postmessage); #region 处理附件 //处理附件 StringBuilder sb = new StringBuilder(); AttachmentInfo[] attachmentinfo = null; string attachId = DNTRequest.GetFormString("attachid"); if (!string.IsNullOrEmpty(attachId)) { attachmentinfo = Attachments.GetNoUsedAttachmentArray(userid, attachId); Attachments.UpdateAttachment(attachmentinfo, topic.Tid, postinfo.Pid, postinfo, ref sb, userid, config, usergroupinfo); } //加入相册 if (config.Enablealbum == 1 && apb != null) { sb.Append(apb.CreateAttachment(attachmentinfo, usergroupid, userid, username)); } #endregion OnlineUsers.UpdateAction(olid, UserAction.PostReply.ActionID, forumid, forum.Name, topicid, topictitle); #region 设置提示信息和跳转链接 //辩论地址 if (topic.Special == 4) { SetUrl(Urls.ShowDebateAspxRewrite(topicid)); } else if (infloat == 0)//此处加是否弹窗提交判断是因为在IE6下弹窗提交会造成gettopicinfo, getpostlist(位于showtopic页面)被提交了两次 { SetUrl(string.Format("showtopic.aspx?forumpage={0}&topicid={1}&page=end&jump=pid#{2}", forumpageid, topicid, postid)); } if (DNTRequest.GetFormString("continuereply") == "on") { SetUrl("postreply.aspx?topicid=" + topicid + "&forumpage=" + forumpageid + "&continuereply=yes"); } if (sb.Length > 0) { UpdateUserCredits(Forums.GetValues(forum.Replycredits)); SetMetaRefresh(5); SetShowBackLink(true); if (infloat == 1) { AddErrLine(sb.ToString()); return; } else { AddMsgLine("<table cellspacing=\"0\" cellpadding=\"4\" border=\"0\"><tr><td colspan=2 align=\"left\"><span class=\"bold\"><nobr>发表回复成功,但图片/附件上传出现问题:</nobr></span><br /></td></tr></table>"); } } else { SetMetaRefresh(); SetShowBackLink(false); //上面已经进行用户组判断 if (postinfo.Invisible == 1) { AddMsgLine(string.Format("发表回复成功, 但需要经过审核才可以显示. {0}<br /><br />(<a href=\"" + base.ShowForumAspxRewrite(forumid, 0) + "\">点击这里返回 {1}</a>)", (DNTRequest.GetFormString("continuereply") == "on" ? "继续回复" : "返回该主题"), forum.Name)); } else { UpdateUserCredits(Forums.GetValues(forum.Replycredits)); MsgForward("postreply_succeed"); AddMsgLine(string.Format("发表回复成功, {0}<br />(<a href=\"" + base.ShowForumAspxRewrite(forumid, 0) + "\">点击这里返回 {1}</a>)<br />", (DNTRequest.GetFormString("continuereply") == "on" ? "继续回复" : "返回该主题"), forum.Name)); } } #endregion // 删除主题游客缓存 if (topic.Replies < (config.Ppp + 10)) { ForumUtils.DeleteTopicCacheFile(topicid); } //发送邮件通知 if (DNTRequest.GetString("emailnotify") == "on" && topic.Posterid != -1 && topic.Posterid != userid) { SendNotifyEmail(Users.GetShortUserInfo(topic.Posterid).Email.Trim(), postinfo, Utils.GetRootUrl(BaseConfigs.GetForumPath) + string.Format("showtopic.aspx?topicid={0}&page=end&jump=pid#{1}", topicid, postid)); } } }
private void SaveInfo_Click(object sender, EventArgs e) { #region 保存设置信息 if (this.CheckCookie()) { string creditinf = available.SelectedValue + "," + extcredits1.Text + "," + extcredits2.Text + "," + extcredits3.Text + "," + extcredits4.Text + "," + extcredits5.Text + "," + extcredits6.Text + "," + extcredits7.Text + "," + extcredits8.Text; Forums.UpdateForumField(DNTRequest.GetInt("fid", 0), DNTRequest.GetString("fieldname"), creditinf); DNTCache.GetCacheService().RemoveObject("/Forum/ForumList"); base.RegisterStartupScript("PAGE", "window.location.href='forum_editforums.aspx?fid=" + DNTRequest.GetString("fid") + "&tabindex=1';"); } #endregion }
/// <summary> /// 创建帖子信息 /// </summary> /// <param name="postmessage"></param> /// <returns></returns> public PostInfo CreatePostInfo(string postmessage) { PostInfo postinfo = new PostInfo(); postinfo.Fid = forumid; postinfo.Tid = topicid; postinfo.Parentid = postinfo.Parentid; postinfo.Layer = postinfo.Layer + 1; postinfo.Poster = username; postinfo.Posterid = userid; bool ishtmlon = (Utils.StrToInt(DNTRequest.GetString("htmlon"), 0) == 1); 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(DNTRequest.GetString(config.Antispamposttitle))); if (usergroupinfo.Allowhtml == 0) { postinfo.Message = Utils.HtmlEncode(ForumUtils.BanWordFilter(postmessage)); } else { postinfo.Message = ishtmlon ? ForumUtils.BanWordFilter(postmessage) : Utils.HtmlEncode(ForumUtils.BanWordFilter(postmessage)); } } postinfo.Postdatetime = Utils.GetDateTime(); if (Utils.StrIsNullOrEmpty(postinfo.Message.Replace(" ", ""))) { AddErrLine("内容不能为空, 请返回修改!"); return(postinfo); } 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(postinfo); } postinfo.Ip = DNTRequest.GetIP(); postinfo.Lastedit = ""; postinfo.Debateopinion = DNTRequest.GetInt("debateopinion", 0); postinfo.Invisible = needaudit ? 1 : 0; // 如果当前用户非管理员并且论坛设定了发帖审核时间段,当前时间如果在其中的一个时间段内,则用户所发帖均为待审核状态 if (useradminid != 1 && !Moderators.IsModer(useradminid, userid, forumid)) { if (Scoresets.BetweenTime(config.Postmodperiods) || ForumUtils.HasAuditWord(postinfo.Title) || ForumUtils.HasAuditWord(postinfo.Message)) { postinfo.Invisible = 1; } } postinfo.Usesig = TypeConverter.StrToInt(DNTRequest.GetString("usesig")); postinfo.Htmlon = (usergroupinfo.Allowhtml == 1 && ishtmlon) ? 1 : postinfo.Htmlon; postinfo.Smileyoff = (smileyoff != 0) ? smileyoff : TypeConverter.StrToInt(DNTRequest.GetString("smileyoff")); postinfo.Bbcodeoff = (usergroupinfo.Allowcusbbcode == 1 && forum.Allowbbcode == 1) ? TypeConverter.StrToInt(DNTRequest.GetString("bbcodeoff")) : 1; postinfo.Parseurloff = TypeConverter.StrToInt(DNTRequest.GetString("parseurloff")); postinfo.Attachment = 0; postinfo.Rate = 0; postinfo.Ratetimes = 0; postinfo.Topictitle = topic.Title; if ((postinfo.Title != "" && Utils.GetCookie("lastposttitle") == Utils.MD5(postinfo.Title)) || Utils.GetCookie("lastpostmessage") == Utils.MD5(postinfo.Message)) { AddErrLine("请勿重复发帖"); return(postinfo); } postinfo.Pid = Posts.CreatePost(postinfo); Utils.WriteCookie("lastposttitle", Utils.MD5(postinfo.Title)); Utils.WriteCookie("lastpostmessage", Utils.MD5(postinfo.Message)); ForumUtils.WriteCookie("clearUserdata", "forum"); return(postinfo); }
private string GetMessageScript(string message) { return(string.Format("<script>alert('{0}');window.location.href='global_allowparticipatescore.aspx?pagename={1}&groupid={2}';</script>", message, DNTRequest.GetString("pagename"), DNTRequest.GetString("groupid"))); }
/// <summary> /// 获取主题帖信息 /// </summary> /// <param name="admininfo"></param> /// <returns></returns> public PostInfo GetPostAndTopic(AdminGroupInfo admininfo) { PostInfo postinfo = new PostInfo(); //如果帖子id和主题id都没有指定 if (postid == -1 && topicid == -1) { AddErrLine("无效的主题ID"); return(postinfo); } //如果帖子id被指定 if (postid != -1) { postinfo = Posts.GetPostInfo(topicid, postid); if (postinfo == null) { AddErrLine("无效的帖子ID"); return(postinfo); } if (topicid != postinfo.Tid) { AddErrLine("主题ID无效"); return(postinfo); } //如果帖子作者是禁止发言,禁止访问,禁止IP用户组或者帖子invisible属性小于0,则不允许引用及回复 if (!string.IsNullOrEmpty(DNTRequest.GetString("quote"))) { if (postinfo.Invisible != 0) { postinfo.Message = "**** 作者被禁止或删除 内容自动屏蔽 ****"; } else { string info = postinfo.Posterid > 0 ? Users.GetShortUserInfo(postinfo.Posterid).Groupid.ToString() : null; if (Utils.InArray(info, "4.5.6")) { postinfo.Message = "**** 作者被禁止或删除 内容自动屏蔽 ****"; } } //if (Utils.InArray(Users.GetShortUserInfo(postinfo.Posterid).Groupid.ToString(), "4,5,6") || postinfo.Invisible != 0) // postinfo.Message = "**** 作者被禁止或删除 内容自动屏蔽 ****"; if ((postinfo.Message.IndexOf("[hide]") > -1) && (postinfo.Message.IndexOf("[/hide]") > -1)) { message = string.Format("[quote] 原帖由 [b]{0}[/b] 于 {1} 发表\r\n ***隐藏帖*** [/quote]", postinfo.Poster, postinfo.Postdatetime); } //message = "[quote] 原帖由 [b]" + postinfo.Poster + "[/b] 于 " + postinfo.Postdatetime + " 发表\r\n ***隐藏帖*** [/quote]"; else { message = string.Format("[quote]{0}\r\n [color=#999999]{1} 发表于 {2} [/color][url={5}showtopic.aspx?topicid={3}&postid={4}#{4}][img]{5}images/common/back.gif[/img][/url][/size][/quote]" , UBB.ClearAttachUBB(Utils.GetSubString(postinfo.Message, 200, "......")), postinfo.Poster, postinfo.Postdatetime, topicid, postid, Utils.GetRootUrl(forumpath)); } } } // 获取该主题的信息 topic = Topics.GetTopicInfo(topicid); // 如果该主题不存在 if (topic == null) { AddErrLine("不存在的主题ID"); return(postinfo); } topictitle = topic.Title.Trim(); pagetitle = topictitle; forumid = topic.Fid; // 如果当前用户非管理员并且该主题已关闭,不允许用户发帖 if ((admininfo == null || !Moderators.IsModer(admininfo.Admingid, userid, forumid)) && topic.Closed == 1) { AddErrLine("主题已关闭无法回复"); return(postinfo); } if (topic.Readperm > usergroupinfo.Readaccess && topic.Posterid != userid && useradminid != 1) { if (forum.Moderators != null && !Utils.InArray(username, forum.Moderators.Split(','))) { AddErrLine("本主题阅读权限为: " + topic.Readperm + ", 您当前的身份 \"" + usergroupinfo.Grouptitle + "\" 阅读权限不够"); } } return(postinfo); }
private void SubmitInfo_Click(object sender, EventArgs e) { #region 提交同级版块 if (this.CheckCookie()) { if (DNTRequest.GetString("fid") != "") { __foruminfo = AdminForums.GetForumInfomation(DNTRequest.GetInt("fid", 0)); __foruminfo.Name = name.Text.Trim(); __foruminfo.Displayorder = Convert.ToInt32(displayorder.Text); __foruminfo.Status = Convert.ToInt16(status.SelectedValue); if (colcount.SelectedValue == "1") //传统模式[默认] { __foruminfo.Colcount = 1; } else { if (Convert.ToInt16(colcountnumber.Text) < 1 || Convert.ToInt16(colcountnumber.Text) > 9) { base.RegisterStartupScript("", "<script>alert('列值必须在2~9范围内');</script>"); return; } __foruminfo.Colcount = Convert.ToInt16(colcountnumber.Text); } __foruminfo.Templateid = (Convert.ToInt32(templateid.SelectedValue) == config.Templateid ? 0 : Convert.ToInt32(templateid.SelectedValue)); __foruminfo.Allowhtml = 0; __foruminfo.Allowblog = 0; __foruminfo.Istrade = 0; //__foruminfo.Allowpostspecial = 0; //需要作与运算如下 //__foruminfo.Allowspecialonly = 0; //需要作与运算如下 ////$allow辩论 = allowpostspecial & 16; ////$allow悬赏 = allowpostspecial & 4; ////$allow投票 = allowpostspecial & 1; __foruminfo.Alloweditrules = 0; __foruminfo.Allowsmilies = BoolToInt(setting.Items[0].Selected); __foruminfo.Allowrss = BoolToInt(setting.Items[1].Selected); __foruminfo.Allowbbcode = BoolToInt(setting.Items[2].Selected); __foruminfo.Allowimgcode = BoolToInt(setting.Items[3].Selected); __foruminfo.Recyclebin = BoolToInt(setting.Items[4].Selected); __foruminfo.Modnewposts = BoolToInt(setting.Items[5].Selected); __foruminfo.Jammer = BoolToInt(setting.Items[6].Selected); __foruminfo.Disablewatermark = BoolToInt(setting.Items[7].Selected); __foruminfo.Inheritedmod = BoolToInt(setting.Items[8].Selected); __foruminfo.Allowthumbnail = BoolToInt(setting.Items[9].Selected); __foruminfo.Allowtag = BoolToInt(setting.Items[10].Selected); //__foruminfo.Istrade = BoolToInt(setting.Items[11].Selected); int temppostspecial = 0; temppostspecial = setting.Items[11].Selected ? temppostspecial | 1 : temppostspecial & ~1; temppostspecial = setting.Items[12].Selected ? temppostspecial | 16 : temppostspecial & ~16; temppostspecial = setting.Items[13].Selected ? temppostspecial | 4 : temppostspecial & ~4; __foruminfo.Allowpostspecial = temppostspecial; __foruminfo.Allowspecialonly = Convert.ToInt16(allowspecialonly.SelectedValue); if (autocloseoption.SelectedValue == "0") { __foruminfo.Autoclose = 0; } else { __foruminfo.Autoclose = Convert.ToInt32(autocloseday.Text); } __foruminfo.Description = description.Text; __foruminfo.Password = password.Text; __foruminfo.Icon = icon.Text; __foruminfo.Redirect = redirect.Text; __foruminfo.Attachextensions = attachextensions.GetSelectString(","); AdminForums.CompareOldAndNewModerator(__foruminfo.Moderators, moderators.Text.Replace("\r\n", ","), DNTRequest.GetInt("fid", 0)); __foruminfo.Moderators = moderators.Text.Replace("\r\n", ","); __foruminfo.Rules = rules.Text; __foruminfo.Topictypes = topictypes.Text; __foruminfo.Viewperm = Request.Form["viewperm"]; __foruminfo.Postperm = Request.Form["postperm"]; __foruminfo.Replyperm = Request.Form["replyperm"]; __foruminfo.Getattachperm = Request.Form["getattachperm"]; __foruminfo.Postattachperm = Request.Form["postattachperm"]; __foruminfo.Applytopictype = Convert.ToInt32(applytopictype.SelectedValue); __foruminfo.Postbytopictype = Convert.ToInt32(postbytopictype.SelectedValue); __foruminfo.Viewbytopictype = Convert.ToInt32(viewbytopictype.SelectedValue); __foruminfo.Topictypeprefix = Convert.ToInt32(topictypeprefix.SelectedValue); __foruminfo.Topictypes = GetTopicType(); __foruminfo.Permuserlist = GetPermuserlist(); Discuz.Aggregation.AggregationFacade.ForumAggregation.ClearDataBind(); string result = AdminForums.SaveForumsInf(__foruminfo).Replace("'", "’"); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "编辑论坛版块", "编辑论坛版块,名称为:" + name.Text.Trim()); GeneralConfigInfo __configinfo = GeneralConfigs.Deserialize(Server.MapPath("../../config/general.config")); __configinfo.Specifytemplate = DatabaseProvider.GetInstance().GetSpecifyForumTemplateCount() > 0 ? 1: 0; GeneralConfigs.Serialiaze(__configinfo, Server.MapPath("../../config/general.config")); if (result == "") { Response.Redirect("forum_ForumsTree.aspx"); } else { Response.Write("<script>alert('用户:" + result + "不存在或因为它们所属组为\"游客\",\"等待验证会员\",因为无法设为版主');window.location.href='forum_ForumsTree.aspx';</script>"); Response.End(); } } } #endregion }
protected void updatehelp_Click(object sender, EventArgs e) { Helps.UpdateHelp(id, title.Text, DNTRequest.GetString("helpmessage_hidden").Trim(), int.Parse(type.SelectedValue), int.Parse(orderby.Text)); Response.Redirect("global_helplist.aspx"); }
private void RunForumStatic_Click(object sender, EventArgs e) { #region 运行论坛统计 if (this.CheckCookie()) { forumsstatic.Text = ViewState["forumsstatic"].ToString(); int fid = DNTRequest.GetInt("fid", -1); if (fid > 0) { __foruminfo = AdminForums.GetForumInfomation(fid); } else { return; } int topiccount = 0; int postcount = 0; int lasttid = 0; string lasttitle = ""; string lastpost = ""; int lastposterid = 0; string lastposter = ""; int replypost = 0; AdminForumStats.ReSetFourmTopicAPost(fid, out topiccount, out postcount, out lasttid, out lasttitle, out lastpost, out lastposterid, out lastposter, out replypost); runforumsstatic = string.Format("<br /><br />运行结果<hr style=\"height:1px; width:600; color:#CCCCCC; background:#CCCCCC; border: 0; \" align=\"left\" />主题总数:{0}<br />帖子总数:{1}<br />今日回帖数总数:{2}<br />最后提交日期:{3}", topiccount, postcount, replypost, lastpost); if ((__foruminfo.Topics == topiccount) && (__foruminfo.Posts == postcount) && (__foruminfo.Todayposts == replypost) && (__foruminfo.Lastpost.Trim() == lastpost)) { runforumsstatic += "<br /><br /><br />结果一致"; } else { runforumsstatic += "<br /><br /><br />比较<hr style=\"height:1px; width:600; color:#CCCCCC; background:#CCCCCC; border: 0; \" align=\"left\" />"; if (__foruminfo.Topics != topiccount) { runforumsstatic += "主题总数有差异<br />"; } if (__foruminfo.Posts != postcount) { runforumsstatic += "帖子总数有差异<br />"; } if (__foruminfo.Todayposts != replypost) { runforumsstatic += "今日回帖数总数有差异<br />"; } if (__foruminfo.Lastpost != lastpost) { runforumsstatic += "最后提交日期有差异<br />"; } } } this.TabControl1.SelectedIndex = 5; DataGridBind(""); BindTopicType(); #endregion }
public void OrderApplyAdd(HttpRequest Request, HttpResponse Response, HttpContext context) { string ValidCodeRequest = UtilityHelper.BWJSCommonHelper.SafeString(Request["ValidCode"], ""); string ValidCodeSesstion = context.Session["ValidCode"].ToString(); if (!ValidCodeRequest.Equals(ValidCodeSesstion)) { Response.Write("{\"ValidCodeError\":\"Error\"}"); } else { #region 获取参数 begin string TransNo = UtilityHelper.CommonHelper.OrderNoOne(); // Guid.NewGuid().ToString("N");//这里直接赋值 string CaseCode = UtilityHelper.BWJSCommonHelper.SafeString(Request["CaseCode"], ""); int productId = DNTRequest.GetInt("productId", 0); int Type = UtilityHelper.BWJSCommonHelper.SafeInt(Request["Type"], 0);//当Type为0时默认给自己投保 1为他人投保 #region 承包申请表 OrderApply int userId = UtilityHelper.BWJSCommonHelper.SafeInt(Request["userId"], 0); int machineID = UtilityHelper.BWJSCommonHelper.SafeInt(Request["MachineID"], 0); #endregion #region 投保人信息参数 ApplicantInfo string cName = UtilityHelper.BWJSCommonHelper.SafeString(Request["CName"], ""); string eName = UtilityHelper.BWJSCommonHelper.SafeString(Request["EName"], ""); int cardType = UtilityHelper.BWJSCommonHelper.SafeInt(Request["CardType"], 0); string cardCode = UtilityHelper.BWJSCommonHelper.SafeString(Request["CardCode"], ""); int sex = UtilityHelper.BWJSCommonHelper.SafeInt(Request["Sex"], 0); string birthDay = UtilityHelper.BWJSCommonHelper.SafeString(Request["BirthDay"], ""); string mobile = UtilityHelper.BWJSCommonHelper.SafeString(Request["Mobile"], ""); string email = UtilityHelper.BWJSCommonHelper.SafeString(Request["Email"], ""); string cardPeriod = UtilityHelper.BWJSCommonHelper.SafeString(Request["CardPeriod"], ""); string job = UtilityHelper.BWJSCommonHelper.SafeString(Request["Job"], ""); #endregion #region 订单信息参数 ApplicationData string applicationDate = UtilityHelper.BWJSCommonHelper.SafeString(Request["ApplicationDate"], ""); string startDate = UtilityHelper.BWJSCommonHelper.SafeString(Request["StartDate"], ""); string endDate = UtilityHelper.BWJSCommonHelper.SafeString(Request["EndDate"], ""); #endregion #region 被投保人信息参数 InsurantInfo string bcName = UtilityHelper.BWJSCommonHelper.SafeString(Request["BCName"], ""); string beName = UtilityHelper.BWJSCommonHelper.SafeString(Request["BEName"], ""); int bsex = UtilityHelper.BWJSCommonHelper.SafeInt(Request["BSex"], 0); int bcardType = UtilityHelper.BWJSCommonHelper.SafeInt(Request["BCardType"], 0); string bcardCode = UtilityHelper.BWJSCommonHelper.SafeString(Request["BCardCode"], ""); string bbirthDay = UtilityHelper.BWJSCommonHelper.SafeString(Request["BBirthDay"], ""); int relationID = UtilityHelper.BWJSCommonHelper.SafeInt(Request["RelationID"], 0); //购买关系必填 int count = UtilityHelper.BWJSCommonHelper.SafeInt(Request["Count"], 0); //购买份数必填 decimal singlePrice = UtilityHelper.BWJSCommonHelper.SafeDecimal(Request["SinglePrice"], 0m); //购买单价必填 decimal TotalPrice = UtilityHelper.BWJSCommonHelper.SafeDecimal(Request["TotalPrice"], 0m); //购买总价 string bcardPeriod = UtilityHelper.BWJSCommonHelper.SafeString(Request["BCardPeriod"], ""); string bmobile = UtilityHelper.BWJSCommonHelper.SafeString(Request["BMobile"], ""); string bemail = UtilityHelper.BWJSCommonHelper.SafeString(Request["BEmail"], ""); string bjob = UtilityHelper.BWJSCommonHelper.SafeString(Request["BJob"], ""); #endregion #region 其它信息 OtherInfo string provCityId = UtilityHelper.BWJSCommonHelper.SafeString(Request["ProvCityId"], ""); DateTime qTCardPeriod = UtilityHelper.BWJSCommonHelper.SafeDateTime(Request["QTCardPeriod"], DateTime.Parse("1900-1-1"));//其它 证件有效期,格式:yyyy-MM-dd(疾病险) int notifyAnswerId = UtilityHelper.BWJSCommonHelper.SafeInt(Request["NotifyAnswerId"], 0); string priceArgsId = UtilityHelper.BWJSCommonHelper.SafeString(Request["PriceArgsId"], ""); int relatedPersonHouse = UtilityHelper.BWJSCommonHelper.SafeInt(Request["RelatedPersonHouse"], 0); string visaCity = UtilityHelper.BWJSCommonHelper.SafeString(Request["VisaCity"], ""); string destination = UtilityHelper.BWJSCommonHelper.SafeString(Request["Destination"], ""); int tripPurposeId = UtilityHelper.BWJSCommonHelper.SafeInt(Request["TripPurposeId"], 0); string propertyAddress = UtilityHelper.BWJSCommonHelper.SafeString(Request["PropertyAddress"], ""); #endregion #endregion 获取参数 end #region OrderApplyViewModel 赋值 OrderApplyViewModel viewModel = new OrderApplyViewModel(); viewModel.caseCode = CaseCode; viewModel.transNo = TransNo; viewModel.productId = productId; viewModel.TotalPrice = TotalPrice; viewModel.applicantInfo = new ApplicantInfo(); viewModel.applicantInfo.CName = cName; viewModel.applicantInfo.EName = eName; viewModel.applicantInfo.CardType = cardType; viewModel.applicantInfo.Sex = sex; viewModel.applicantInfo.BirthDay = birthDay; viewModel.applicantInfo.Mobile = mobile; viewModel.applicantInfo.Email = email; viewModel.applicantInfo.CardCode = cardCode; viewModel.applicantInfo.CardPeriod = cardPeriod; viewModel.applicantInfo.RecordCreateTime = DateTime.Now; viewModel.applicantInfo.RecordUpdateTime = DateTime.Now; viewModel.applicantInfo.Job = job; viewModel.applicationData = new ApplicationData(); viewModel.applicationData.ApplicationDate = applicationDate; viewModel.applicationData.StartDate = startDate; viewModel.applicationData.EndDate = endDate; viewModel.applicationData.RecordCreateTime = DateTime.Now; viewModel.applicationData.RecordUpdateTime = DateTime.Now; viewModel.insurantInfo = new InsurantInfo(); if (Type == 0)//给自己投保 { viewModel.insurantInfo.CName = viewModel.applicantInfo.CName; viewModel.insurantInfo.EName = viewModel.applicantInfo.EName; viewModel.insurantInfo.Sex = viewModel.applicantInfo.Sex; viewModel.insurantInfo.CardType = viewModel.applicantInfo.CardType; viewModel.insurantInfo.Birthday = viewModel.applicantInfo.BirthDay; viewModel.insurantInfo.CardPeriod = viewModel.applicantInfo.CardPeriod; viewModel.insurantInfo.Mobile = viewModel.applicantInfo.Mobile; viewModel.insurantInfo.CardCode = viewModel.applicantInfo.CardCode; viewModel.insurantInfo.RelationID = 1; viewModel.insurantInfo.Email = viewModel.applicantInfo.Email; //新加字段 viewModel.insurantInfo.Job = viewModel.applicantInfo.Job; //新加字段 } else { viewModel.insurantInfo.Email = bemail; viewModel.insurantInfo.CName = bcName; viewModel.insurantInfo.EName = beName; viewModel.insurantInfo.Sex = bsex; viewModel.insurantInfo.CardType = bcardType; viewModel.insurantInfo.Birthday = bbirthDay; viewModel.insurantInfo.CardPeriod = bcardPeriod; viewModel.insurantInfo.Mobile = bmobile; viewModel.insurantInfo.RelationID = relationID; viewModel.insurantInfo.CardCode = bcardCode; viewModel.insurantInfo.Job = bjob; } viewModel.insurantInfo.Count = count; viewModel.insurantInfo.SinglePrice = singlePrice; viewModel.insurantInfo.RecordCreateTime = DateTime.Now; viewModel.insurantInfo.RecordUpdateTime = DateTime.Now; viewModel.orderApply = new OrderApply(); viewModel.orderApply.RecordCreateTime = DateTime.Now; viewModel.orderApply.RecordUpdateTime = DateTime.Now; viewModel.orderApply.UserID = userId; viewModel.orderApply.MachineID = machineID; // viewModel.transactions = new Transactions(); viewModel.otherInfo = new OtherInfo(); viewModel.otherInfo.ProvCityID = provCityId; viewModel.otherInfo.CardPeriod = DateTime.Parse(cardPeriod);//这里传投保人 证件有效期 viewModel.otherInfo.NotifyAnswerID = notifyAnswerId; viewModel.otherInfo.PriceArgsID = priceArgsId; viewModel.otherInfo.RecordCreateTime = DateTime.Now; viewModel.otherInfo.RecordUpdateTime = DateTime.Now; viewModel.otherInfo.VisaCity = visaCity; viewModel.otherInfo.Destination = destination; viewModel.otherInfo.TripPurposeId = tripPurposeId; viewModel.otherInfo.PropertyAddress = propertyAddress; viewModel.otherInfo.RelatedPersonHouse = relatedPersonHouse; #endregion OrderApplyHelperBLL orderApplyHelper = new OrderApplyHelperBLL(); string msg = ""; bool b = orderApplyHelper.OrderApplyAdd(viewModel, out msg); Response.Write(msg); } }
private void Bind() { if (IsType == 1) { ddlBaseType.Attributes.Add("datatype", "no0"); } if (IsBrowseCount == 1) { txtBrowseCount.Attributes.Add("datatype", "n"); } if (IsAddDate == 1) { txtAddDate.Attributes.Add("datatype", "datetime"); } txtAddDate.Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); CommendDate.Value = DateTime.Now.ToString("yyyy-MM-dd"); Mod_Information dto = new Mod_Information(); if (id != 0) { dto = BInformation.GetModel(string.Format("ID={0} AND WebSiteID={1}", id, AdminManage.WebSiteID)); if (dto != null) { txtTitle.Text = dto.Title; txtSubTitle.Text = dto.SubTitle; ddlBaseType.SelectedValue = dto.TypeID.ToString(); txtImage.Text = dto.Image; txtVideo.Text = dto.FileURL; txtIntroduction.Text = dto.Introduction; txtContent1.Text = dto.Content1; txtOrderBy.Text = dto.OrderBy.ToString(); foreach (ListItem item in cblShow.Items) { switch (item.Value) { case "1": item.Selected = (dto.State == 1); break; case "2": item.Selected = (dto.IsTop == 1); break; case "3": item.Selected = (dto.IsCommend == 1); break; } } txtOrderBy.Text = dto.OrderBy.ToString(); txtBrowseCount.Text = dto.BrowseCount.ToString(); txtAddDate.Value = DateTime.Parse(dto.AddDate.ToString()).ToString("yyyy-MM-dd HH:mm:ss"); CommendDate.Value = DateTime.Parse(dto.CommendDate.ToString()).ToString("yyyy-MM-dd"); txtSource.Text = dto.Source; txtAuthor.Text = dto.Author; txtLink.Text = dto.Link; //绑定图片集 rptPicList.DataSource = BPicList.GetList(0, string.Format("ProductID={0} AND WebSiteID={1} AND Model='XWXC' and State=1 ", id, AdminManage.WebSiteID), " OrderBy asc,ID asc "); rptPicList.DataBind(); //绑定文件集 rptFileList.DataSource = BPicList.GetList(0, string.Format("ProductID={0} AND WebSiteID={1} AND Model='XTWJ' and State=1 ", id, AdminManage.WebSiteID), " OrderBy asc,ID asc "); rptFileList.DataBind(); } else { MessageBox.ShowRedirect(this, "信息已删除或不存在!", "Column/Information/List.aspx?" + StringHelper.DelUrlParameter("ID")); } } else { int TypeID = DNTRequest.GetQueryInt("TypeID", 0); ddlBaseType.SelectedValue = TypeID.ToString(); if (AdminManage.WebSiteID == 10001) { txtSource.Text = "本站"; } else if (AdminManage.WebSiteID == 10002) { txtSource.Text = ""; } } }
protected override void ShowPage() { GetPostAds(forumid); if (userid > 0 && useradminid > 0) { AdminGroupInfo admingroupinfo = AdminGroups.GetAdminGroupInfo(usergroupid); if (admingroupinfo != null) { disablepostctrl = admingroupinfo.Disablepostctrl; } } #region 获取版块信息 if (forumid == -1) { AddLinkRss(forumpath + "tools/rss.aspx", "最新主题"); AddErrLine("无效的版块ID"); return; } forum = Forums.GetForumInfo(forumid); if (forum == null || forum.Fid < 1) { if (config.Rssstatus == 1) { AddLinkRss(forumpath + "tools/rss.aspx", Utils.EncodeHtml(config.Forumtitle) + " 最新主题"); } AddErrLine("不存在的版块ID"); return; } #endregion if (config.Rssstatus == 1) { AddLinkRss(forumpath + "tools/" + base.RssAspxRewrite(forum.Fid), Utils.EncodeHtml(forum.Name) + " 最新主题"); } if (JumpUrl(forum)) { return; } needaudit = UserAuthority.NeedAudit(forum, useradminid, userid, usergroupinfo); // 检查是否具有版主的身份 if (useradminid > 0) { ismoder = Moderators.IsModer(useradminid, userid, forumid); } //设置搜索和排序条件 SetSearchCondition(); showforumlogin = IsShowForumLogin(forum); pagetitle = Utils.RemoveHtml(forum.Name); navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname); forumnav = ShowForumAspxRewrite(ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname).Replace("\"showforum", "\"" + forumurl + "showforum"), forumid, pageid); topicextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetTopicAttachCreditsTrans()); bonusextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetBonusCreditsTrans()); #region 主题分类设置 if (forum.Applytopictype == 1) //启用主题分类 { topictypeselectoptions = Forums.GetCurrentTopicTypesOption(forum.Fid, forum.Topictypes); } if (forum.Viewbytopictype == 1) //允许按类别浏览 { topictypeselectlink = Forums.GetCurrentTopicTypesLink(forum.Fid, forum.Topictypes, forumurl + "showforum.aspx"); } #endregion //更新页面Meta中的keyword,description项, 提高SEO友好性 UpdateMetaInfo(Utils.StrIsNullOrEmpty(forum.Seokeywords) ? config.Seokeywords : forum.Seokeywords, Utils.StrIsNullOrEmpty(forum.Seodescription) ? forum.Description : forum.Seodescription, config.Seohead); //设置编辑器状态 SetEditorState(); #region 访问和发帖权限校验 if (!UserAuthority.VisitAuthority(forum, usergroupinfo, userid, ref msg)) { AddErrLine(msg); needlogin = userid == -1; return; } canposttopic = UserAuthority.PostAuthority(forum, usergroupinfo, userid, ref msg); // 如果当前用户非管理员并且论坛设定了禁止发帖时间段,当前时间如果在其中的一个时间段内,不允许用户发帖 if (useradminid != 1 && usergroupinfo.Disableperiodctrl != 1) { string visittime = ""; if (canposttopic && Scoresets.BetweenTime(config.Postbanperiods, out visittime)) { canposttopic = false; } isnewbie = UserAuthority.CheckNewbieSpan(userid); } //是否显示快速发主题编辑器(全局权限判定,版块权限判定,是否是游客,游客需要显示,登录用户是否允许发主题且已过新手见习期) if ((config.Fastpost == 1 || config.Fastpost == 3) && forum.Allowspecialonly <= 0 && (userid < 0 || (canposttopic && !isnewbie))) { canquickpost = true; } #endregion // 得到子版块列表 if (forum.Subforumcount > 0) { subforumlist = Forums.GetSubForumCollection(forumid, forum.Colcount, config.Hideprivate, usergroupid, config.Moddisplay); } if (!forum.Rules.Equals("")) { forum.Rules = UBB.ParseSimpleUBB(forum.Rules);//替换版规中的UBB } //获取主题总数 topiccount = Topics.GetTopicCount(forumid, true, condition); #region 设置分页及主题列表信息 // 得到Tpp设置 if (tpp <= 0) { tpp = config.Tpp; } // 得到Ppp设置 if (ppp <= 0) { ppp = config.Ppp; } //修正请求页数中可能的错误 if (pageid < 1) { pageid = 1; } int toptopicpagecount = 0; if (forum.Layer > 0) { //获取当前页置顶主题列表 DataRow dr = Topics.GetTopTopicListID(forumid); if (dr != null && !Utils.StrIsNullOrEmpty(dr["tid"].ToString())) { topiccount = topiccount + TypeConverter.ObjectToInt(dr["tid0Count"]); } //获取总页数 pagecount = topiccount % tpp == 0 ? topiccount / tpp : topiccount / tpp + 1; if (pagecount == 0) { pagecount = 1; } if (pageid > pagecount) { pageid = pagecount; } if (dr != null && !Utils.StrIsNullOrEmpty(dr["tid"].ToString())) { toptopiccount = TypeConverter.ObjectToInt(dr["tidCount"]); if (toptopiccount > tpp * (pageid - 1)) { toptopiclist = Topics.GetTopTopicList(forumid, tpp, pageid, dr["tid"].ToString(), forum.Autoclose, forum.Topictypeprefix); toptopicpagecount = toptopiccount / tpp; } if (toptopicpagecount >= pageid || (pageid == 1 && toptopicpagecount != toptopiccount)) { topiclist = GetTopicInfoList(tpp - toptopiccount % tpp, pageid - toptopicpagecount, 0); } else { topiclist = GetTopicInfoList(tpp, pageid - toptopicpagecount, toptopiccount % tpp); } } else { toptopicpagecount = 0; topiclist = GetTopicInfoList(tpp, pageid, 0); } //如果topiclist为空则更新当前论坛帖数 if (topiclist == null || topiclist.Count == 0 || topiclist.Count > topiccount) { Forums.SetRealCurrentTopics(forum.Fid); } SetPageNumber(); //当版块数大于一个并且当版块数量为一个时不是版块自身时显示下拉菜单 showvisitedforumsmenu = visitedforums != null && ((visitedforums.Length == 1 && visitedforums[0].Fid != forumid) || visitedforums.Length > 1); SetVisitedForumsCookie(); //保存查看版块的页数 Utils.WriteCookie("forumpageid", pageid.ToString(), 30); //判断是否需要生成游客缓存页面 IsGuestCachePage(); } #endregion #region 替换版规中的UBB forum.Description = UBB.ParseSimpleUBB(forum.Description); #endregion #region 更新在线信息 OnlineUsers.UpdateAction(olid, UserAction.ShowForum.ActionID, forumid, forum.Name, -1, ""); if ((forumtotalonline < config.Maxonlinelist && (config.Whosonlinestatus == 2 || config.Whosonlinestatus == 3)) || DNTRequest.GetString("showonline") == "yes") { showforumonline = true; onlineuserlist = OnlineUsers.GetForumOnlineUserCollection(forumid, out forumtotalonline, out forumtotalonlineguest, out forumtotalonlineuser, out forumtotalonlineinvisibleuser); } //if (DNTRequest.GetString("showonline") != "no") //{ // showforumonline = false; //} if (DNTRequest.GetString("showonline") == "no") { showforumonline = false; } #endregion //修正版主列表 if (forum.Moderators.Trim() != "") { string moderHtml = string.Empty; foreach (string m in forum.Moderators.Split(',')) { moderHtml += string.Format("<a href=\"{0}userinfo.aspx?username={1}\">{2}</a>,", forumpath, Utils.UrlEncode(m), m); } forum.Moderators = moderHtml.TrimEnd(','); } ForumUtils.UpdateVisitedForumsOptions(forumid); }
private void UpdateUserGroupInf_Click(object sender, EventArgs e) { #region 更新特殊用户组信息 if (this.CheckCookie()) { Hashtable ht = new Hashtable(); ht.Add("附件最大尺寸", maxattachsize.Text); ht.Add("每天最大附件总尺寸", maxsizeperday.Text); ht.Add("个人空间附件总尺寸", maxspaceattachsize.Text); ht.Add("相册空间总尺寸", maxspacephotosize.Text); foreach (DictionaryEntry de in ht) { if (!Utils.IsInt(de.Value.ToString())) { base.RegisterStartupScript("", "<script>alert('输入错误," + de.Key.ToString() + "只能是0或者正整数');window.location.href='global_usergroupspecialgrid.aspx';</script>"); return; } } userGroupInfo = AdminUserGroups.AdminGetUserGroupInfo(DNTRequest.GetInt("groupid", -1)); userGroupInfo.System = 0; userGroupInfo.Type = 0; userGroupInfo.Readaccess = Convert.ToInt32(readaccess.Text); int selectradminid = radminid.SelectedValue == "0" ? -1 : Convert.ToInt32(radminid.SelectedValue); userGroupInfo.Radminid = selectradminid; if (selectradminid.ToString() != ViewState["radminid"].ToString()) { Users.UpdateUserAdminIdByGroupId(userGroupInfo.Radminid, userGroupInfo.Groupid); } userGroupInfo.Grouptitle = groupTitle.Text; userGroupInfo.Stars = Convert.ToInt32(stars.Text); userGroupInfo.Color = color.Text; userGroupInfo.Groupavatar = groupavatar.Text; userGroupInfo.Maxprice = Convert.ToInt32(maxprice.Text); userGroupInfo.Maxpmnum = Convert.ToInt32(maxpmnum.Text); userGroupInfo.Maxsigsize = Convert.ToInt32(maxsigsize.Text); userGroupInfo.Maxattachsize = Convert.ToInt32(maxattachsize.Text); userGroupInfo.Maxsizeperday = Convert.ToInt32(maxsizeperday.Text); userGroupInfo.Maxspaceattachsize = Convert.ToInt32(maxspaceattachsize.Text); userGroupInfo.Maxspacephotosize = Convert.ToInt32(maxspacephotosize.Text); //userGroupInfo.MaxFriendsCount = Convert.ToInt32(maxfriendscount.Text); userGroupInfo.Attachextensions = attachextensions.GetSelectString(","); usergrouppowersetting.GetSetting(ref userGroupInfo); if (AdminUserGroups.UpdateUserGroupInfo(userGroupInfo)) { Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList"); Discuz.Forum.UserGroups.GetUserGroupList(); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台删除特殊用户组", "组ID:" + DNTRequest.GetInt("groupid", -1)); base.RegisterStartupScript("PAGE", "window.location.href='global_usergroupspecialgrid.aspx';"); } else { if (AdminUserGroups.opresult != "") { base.RegisterStartupScript("", "<script>alert('操作失败,原因:" + AdminUserGroups.opresult + "');window.location.href='global_usergroupspecialgrid.aspx';</script>"); } else { base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergroupspecialgrid.aspx';</script>"); } } } #endregion }
/// <summary> /// 设置页码链接 /// </summary> private void SetPageNumber() { if (DNTRequest.GetString("search") == "") { if (topictypeid == -1) { if (config.Aspxrewrite == 1) { if (Utils.StrIsNullOrEmpty(filter)) { if (config.Iisurlrewrite == 0) { pagenumbers = Utils.GetStaticPageNumbers(pageid, pagecount, (Utils.StrIsNullOrEmpty(forum.Rewritename) ? "showforum-" + forumid : forumpath + forum.Rewritename), config.Extname, 8, (!Utils.StrIsNullOrEmpty(forum.Rewritename) ? 1 : 0)); } else { pagenumbers = Utils.GetStaticPageNumbers(pageid, pagecount, (Utils.StrIsNullOrEmpty(forum.Rewritename) ? "showforum-" + forumid : forumpath + forum.Rewritename), config.Extname, 8, (!Utils.StrIsNullOrEmpty(forum.Rewritename) ? 2 : 0)); } if (pageid < pagecount) { nextpage = string.Format("<a href=\"{0}{1}\" class=\"next\">下一页</a>", forumpath, Urls.ShowForumAspxRewrite(forumid, pageid + 1, forum.Rewritename)); } } else { pagenumbers = Utils.GetPageNumbers(pageid, pagecount, string.Format("{0}showforum.aspx?forumid={1}&filter={2}", forumpath, forumid, filter), 8); if (pageid < pagecount) { nextpage = string.Format("<a href=\"{0}showforum.aspx?forumid={1}&filter={2}&page={3}\" class=\"next\">下一页</a>", forumpath, forumid, filter, pageid + 1); } } } else { pagenumbers = Utils.GetPageNumbers(pageid, pagecount, string.Format("{0}showforum.aspx?forumid={1}{2}", forumpath, forumid, (Utils.StrIsNullOrEmpty(filter) ? "" : "&filter=" + filter)), 8); if (pageid < pagecount) { nextpage = string.Format("<a href=\"{0}showforum.aspx?forumid={1}{2}&page={3}\" class=\"next\">下一页</a>", forumpath, forumid, (Utils.StrIsNullOrEmpty(filter) ? "" : "&filter=" + filter), pageid + 1); } } } else //当有主题类型条件时 { pagenumbers = Utils.GetPageNumbers(pageid, pagecount, string.Format("{0}showforum.aspx?forumid={1}&typeid={2}{3}", forumpath, forumid, topictypeid, (Utils.StrIsNullOrEmpty(filter) ? "" : "&filter=" + filter)), 8); if (pageid < pagecount) { nextpage = string.Format("<a href=\"{0}showforum.aspx?forumid={1}&typeid={2}{3}&page={4}\" class=\"next\">下一页</a>", forumpath, forumid, topictypeid, (Utils.StrIsNullOrEmpty(filter) ? "" : "&filter=" + filter), pageid + 1); } } } else { pagenumbers = Utils.GetPageNumbers(pageid, pagecount, string.Format("{0}showforum.aspx?search=1&cond={1}&order={2}&direct={3}&forumid={4}&interval={5}&typeid={6}{7}", forumpath, Utils.HtmlEncode(DNTRequest.GetString("cond").Trim()), order, direct, forumid, interval, topictypeid, (Utils.StrIsNullOrEmpty(filter) ? "" : "&filter=" + filter)), 8); if (pageid < pagecount) { nextpage = string.Format("<a href=\"{0}showforum.aspx?search=1&cond={1}&order={2}&direct={3}&forumid={4}&interval={5}&typeid={6}{7}&page={8}\" class=\"next\">下一页</a>", forumpath, Utils.HtmlEncode(DNTRequest.GetString("cond").Trim()), order, direct, forumid, interval, topictypeid, (Utils.StrIsNullOrEmpty(filter) ? "" : "&filter=" + filter), pageid + 1); } } }
protected void del(string idlist) { #region 除帮助 Helps.DelHelp(idlist); AdminVistLogs.InsertLog(userid, username, usergroupid, grouptitle, ip, "删除帮助", "删除帮助,帮助ID为: " + DNTRequest.GetString("id")); Response.Redirect("global_helplist.aspx"); #endregion }
protected override void ShowPage() { if (oluserinfo.Groupid == 4) { AddErrLine("你所在的用户组,为禁止发言"); return; } #region 临时帐号发帖 //int realuserid = -1; //bool tempaccountspost = false; //string tempusername = DNTRequest.GetString("tempusername"); //if (!Utils.StrIsNullOrEmpty(tempusername) && tempusername != username) //{ // realuserid = Users.CheckTempUserInfo(tempusername, DNTRequest.GetString("temppassword"), DNTRequest.GetInt("question", 0), DNTRequest.GetString("answer")); // if (realuserid == -1) // { // AddErrLine("临时帐号登录失败,无法继续发帖。"); return; // } // else // { // userid = realuserid; // username = tempusername; // tempaccountspost = true; // } //} #endregion if (userid > 0) { userinfo = Users.GetShortUserInfo(userid); // if (userinfo != null) // { // usergroupinfo = UserGroups.GetUserGroupInfo(userinfo.Groupid); // usergroupid = usergroupinfo.Groupid; // useradminid = userinfo.Adminid; // } } #region 获取并检查版块信息 forum = Forums.GetForumInfo(forumid); if (forum == null || forum.Layer == 0) { forum = new ForumInfo();//如果不初始化对象,则会报错 allowposttopic = false; AddErrLine("错误的论坛ID"); return; } pagetitle = Utils.RemoveHtml(forum.Name); enabletag = (config.Enabletag & forum.Allowtag) == 1; if (forum.Applytopictype == 1) //启用主题分类 { topictypeselectoptions = Forums.GetCurrentTopicTypesOption(forum.Fid, forum.Topictypes); } if (forum.Password != "" && Utils.MD5(forum.Password) != ForumUtils.GetCookie("forum" + forumid + "password")) { AddErrLine("本版块被管理员设置了密码"); SetBackLink(base.ShowForumAspxRewrite(forumid, 0)); return; } needaudit = UserAuthority.NeedAudit(forum, useradminid, userid, usergroupinfo); smileyoff = 1 - forum.Allowsmilies; bbcodeoff = (forum.Allowbbcode == 1 && usergroupinfo.Allowcusbbcode == 1) ? 0 : 1; allowimg = forum.Allowimgcode; customeditbuttons = Caches.GetCustomEditButtonList(); #endregion #region 访问和发帖权限校验 if (!UserAuthority.VisitAuthority(forum, usergroupinfo, userid, ref msg)) { AddErrLine(msg); needlogin = true; return; } if (!UserAuthority.PostAuthority(forum, usergroupinfo, userid, ref msg)) { AddErrLine(msg); needlogin = true; return; } #endregion #region 附件信息绑定 //得到用户可以上传的文件类型 string attachmentTypeSelect = Attachments.GetAllowAttachmentType(usergroupinfo, forum); attachextensions = Attachments.GetAttachmentTypeArray(attachmentTypeSelect); attachextensionsnosize = Attachments.GetAttachmentTypeString(attachmentTypeSelect); //得到今天允许用户上传的附件总大小(字节) int MaxTodaySize = (userid > 0 ? MaxTodaySize = Attachments.GetUploadFileSizeByuserid(userid) : 0); attachsize = usergroupinfo.Maxsizeperday - MaxTodaySize;//今天可上传得大小 //是否有上传附件的权限 canpostattach = UserAuthority.PostAttachAuthority(forum, usergroupinfo, userid, ref msg); if (canpostattach && (userinfo != null && userinfo.Uid > 0) && apb != null && config.Enablealbum == 1 && (UserGroups.GetUserGroupInfo(userinfo.Groupid).Maxspacephotosize - apb.GetPhotoSizeByUserid(userid) > 0)) { caninsertalbum = true; albumlist = apb.GetSpaceAlbumByUserId(userid); } #endregion canhtmltitle = usergroupinfo.Allowhtmltitle == 1; #region 积分信息 creditstrans = Scoresets.GetTopicAttachCreditsTrans(); userextcreditsinfo = Scoresets.GetScoreSet(creditstrans); bonusextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetBonusCreditsTrans()); #endregion #region 特殊主题权限判断 if (forum.Allowspecialonly > 0 && !Utils.InArray(type, "poll,bonus,debate")) { AddErrLine(string.Format("当前版块 \"{0}\" 不允许发表普通主题", forum.Name)); return; } if (!UserAuthority.PostSpecialAuthority(forum, type, ref msg)) { AddErrLine(msg); return; } if (!UserAuthority.PostSpecialAuthority(usergroupinfo, type, ref msg)) { AddErrLine(msg); needlogin = true; return; } if (type == "bonus") { int creditTrans = Scoresets.GetBonusCreditsTrans(); //当“交易积分设置”有效时(1-8的整数): if (creditTrans <= 0) { //AddErrLine(string.Format("系统未设置\"交易积分设置\", 无法判断当前要使用的(扩展)积分字段, 暂时无法发布悬赏", usergroupinfo.Grouptitle)); return; AddErrLine("系统未设置\"交易积分设置\", 无法判断当前要使用的(扩展)积分字段, 暂时无法发布悬赏"); return; } mybonustranscredits = Users.GetUserExtCredits(userid, creditTrans); } userGroupInfoList.Sort(delegate(UserGroupInfo x, UserGroupInfo y) { return((x.Readaccess - y.Readaccess) + (y.Groupid - x.Groupid)); }); #endregion //发帖不受审核、过滤、灌水等限制权限 AdminGroupInfo admininfo = AdminGroups.GetAdminGroupInfo(usergroupid); disablepost = admininfo != null ? admininfo.Disablepostctrl : usergroupinfo.Disableperiodctrl; //如果是提交... if (ispost) { #region 判断是否是灌水 if (!UserAuthority.CheckPostTimeSpan(usergroupinfo, admininfo, oluserinfo, userinfo, ref msg)) { AddErrLine(msg); return; } #endregion SetBackLink(string.Format("posttopic.aspx?forumid={0}&restore=1&type={1}", forumid, type)); ForumUtils.WriteCookie("postmessage", postmessage); #region 验证提交信息 //常规项验证 NormalValidate(admininfo, postmessage, userinfo); 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 int hide = (ForumUtils.IsHidePost(postmessage) && usergroupinfo.Allowhidecode == 1) ? 1 : 0; TopicInfo topicinfo = CreateTopic(admininfo, postmessage, isbonus, topicprice); if (IsErr()) { return; } PostInfo postinfo = CreatePost(topicinfo); if (IsErr()) { return; } #region 处理附件 //处理附件 StringBuilder sb = new StringBuilder(); AttachmentInfo[] attachmentinfo = null; string attachId = DNTRequest.GetFormString("attachid"); if (!string.IsNullOrEmpty(attachId)) { attachmentinfo = Attachments.GetNoUsedAttachmentArray(userid, attachId); Attachments.UpdateAttachment(attachmentinfo, topicinfo.Tid, postinfo.Pid, postinfo, ref sb, userid, config, usergroupinfo); } //加入相册 if (config.Enablealbum == 1 && apb != null) { sb.Append(apb.CreateAttachment(attachmentinfo, usergroupid, userid, username)); } #endregion #region 添加日志的操作 SpacePluginBase spb = SpacePluginProvider.GetInstance(); if (DNTRequest.GetFormString("addtoblog") == "on" && spb != null) { if (userid != -1 && userinfo.Spaceid > 0) { spb.CreateTopic(topicinfo, postinfo, attachmentinfo); } else { AddMsgLine("您的个人空间尚未开通, 无法同时添加为日志"); } } #endregion OnlineUsers.UpdateAction(olid, UserAction.PostTopic.ActionID, forumid, forum.Name, -1, ""); #region 设置提示信息和跳转链接 if (sb.Length > 0) { SetUrl(base.ShowTopicAspxRewrite(topicinfo.Tid, 0)); SetMetaRefresh(5); SetShowBackLink(true); if (infloat == 1) { AddErrLine(sb.ToString()); return; } else { sb.Insert(0, "<table cellspacing=\"0\" cellpadding=\"4\" border=\"0\"><tr><td colspan=2 align=\"left\"><span class=\"bold\"><nobr>发表主题成功,但图片/附件上传出现问题:</nobr></span><br /></td></tr>"); AddMsgLine(sb.Append("</table>").ToString()); } } else { SetShowBackLink(false); if (useradminid != 1) { //是否需要审核 if (UserAuthority.NeedAudit(forum, useradminid, userid, usergroupinfo) || topicinfo.Displayorder == -2) { ForumUtils.WriteCookie("postmessage", ""); SetLastPostedForumCookie(); SetUrl(base.ShowForumAspxRewrite(forumid, forumpageid)); SetMetaRefresh(); AddMsgLine("发表主题成功, 但需要经过审核才可以显示. 返回该版块"); } else { PostTopicSucceed(Forums.GetValues(forum.Postcredits), topicinfo, topicinfo.Tid); } } else { PostTopicSucceed(Forums.GetValues(forum.Postcredits), topicinfo, topicinfo.Tid); } } #endregion //ForumUtils.WriteCookie("postmessage", ""); //SetLastPostedForumCookie(); //如果已登录就不需要再登录 if (needlogin && userid > 0) { needlogin = false; } } else //非提交操作 { AddLinkCss(BaseConfigs.GetForumPath + "templates/" + templatepath + "/editor.css", "css"); } }