Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            switch (action)
            {
            case "setenabled":
                forumHotConfigInfo.Enable = DNTRequest.GetInt("enabled", 0) == 1;
                ForumHotConfigs.SaveConfig(forumHotConfigInfo);
                Response.Redirect("forum_forumhot.aspx");
                break;

            case "edit":
                forumHotItem = forumHotConfigInfo.ForumHotCollection[id - 1];
                break;

            case "editsave":
                //数据来源版块设定范围
                string forumlist = DNTRequest.GetString("forumlist");
                //显示版块名称长度限制
                int forumLength = DNTRequest.GetInt("forumnamelength", 0);
                //显示主题标题长度限制
                int titleLength = DNTRequest.GetInt("topictitlelength", 0);
                //数据来源时间设定范围
                string dataTimeType = DNTRequest.GetString("datatimetype");
                //热点信息类型
                string dataType = DNTRequest.GetString("datatype");
                //热点信息排序类型
                string sortType = DNTRequest.GetString("sorttype");
                //热点信息名称
                string forumHotName = DNTRequest.GetString("forumhotitemname");
                //是否启用
                int enabled = DNTRequest.GetInt("itemenabled", 0);
                //读取最大数据条数
                int dataCount = DNTRequest.GetInt("datacount", 0);
                //数据缓存时间
                int cacheTimeOut = DNTRequest.GetInt("cachetime", 0);

                //限制enabled值在0-1之间
                enabled = enabled < 0 ? 0 : (enabled > 1 ? 1 : enabled);

                cacheTimeOut = cacheTimeOut < 0 ? 1 : cacheTimeOut;


                switch (dataType)
                {
                case "topics":
                    forumLength = forumLength < 0 ? 0 : forumLength;
                    titleLength = titleLength < 0 ? 0 : titleLength;
                    break;

                case "forums":
                    forumlist    = string.Empty;
                    dataTimeType = string.Empty;
                    forumLength  = forumLength < 0 ? 0 : forumLength;
                    titleLength  = 0;
                    break;

                case "users":
                    forumlist   = string.Empty;
                    forumLength = 0;
                    titleLength = 0;
                    //如果此时sortType=posts,另外给它赋值为dataTimeType的值供前台方法调用
                    sortType = sortType == "posts" ? dataTimeType : sortType;
                    break;

                case "pictures":
                    titleLength = titleLength < 0 ? 0 : titleLength;
                    forumLength = 0;
                    break;
                }
                forumHotConfigInfo.ForumHotCollection[id - 1].Name             = forumHotName;
                forumHotConfigInfo.ForumHotCollection[id - 1].Enabled          = enabled;
                forumHotConfigInfo.ForumHotCollection[id - 1].Datatype         = dataType;
                forumHotConfigInfo.ForumHotCollection[id - 1].Sorttype         = sortType;
                forumHotConfigInfo.ForumHotCollection[id - 1].Forumlist        = forumlist;
                forumHotConfigInfo.ForumHotCollection[id - 1].Dataitemcount    = dataCount;
                forumHotConfigInfo.ForumHotCollection[id - 1].Datatimetype     = dataTimeType;
                forumHotConfigInfo.ForumHotCollection[id - 1].Cachetimeout     = cacheTimeOut;
                forumHotConfigInfo.ForumHotCollection[id - 1].Forumnamelength  = forumLength;
                forumHotConfigInfo.ForumHotCollection[id - 1].Topictitlelength = titleLength;

                ForumHotConfigs.SaveConfig(forumHotConfigInfo);
                DNTCache.GetCacheService().RemoveObject("/Forum/ForumHot");
                DNTCache.GetCacheService().RemoveObject("/Forum/ForumHostList-" + id);
                DNTCache.GetCacheService().RemoveObject("/Aggregation/HotForumList" + id);
                DNTCache.GetCacheService().RemoveObject("/Aggregation/Users_" + id + "List");
                DNTCache.GetCacheService().RemoveObject("/Aggregation/HotImages_" + id + "List");
                Response.Redirect("forum_forumhot.aspx");
                break;
            }
        }
        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 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;
                }
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// 构造方法
        /// </summary>
        public MainPage()
        {
            int    uid         = DNTRequest.GetInt("uid", -1);
            string transferurl = Config.SpreadConfigs.GetConfig().TransferUrl;

            if (uid < 1)
            {
                HttpContext.Current.Response.Redirect(transferurl == string.Empty ? BaseConfigs.GetForumPath : transferurl, true);
                return;
            }


            if (Utils.GetCookie("spread") != "")
            {
                HttpContext.Current.Response.Redirect(transferurl == string.Empty ? BaseConfigs.GetForumPath : transferurl, true);
            }
            //过滤用户,不得重复加分
            ShortUserInfo user = Users.GetShortUserInfo(uid);

            if (user == null || user.Uid < 1)
            {
                HttpContext.Current.Response.Redirect(transferurl == string.Empty ? BaseConfigs.GetForumPath : transferurl, true);
                return;
            }
            if (DNTRequest.GetIP() == user.Lastip)
            {
                HttpContext.Current.Response.Redirect(transferurl == string.Empty ? BaseConfigs.GetForumPath : transferurl, true);
            }


            Utils.WriteCookie("spread", uid.ToString(), 24 * 60);


            string credits = Config.SpreadConfigs.GetConfig().SpreadCredits;

            //设置用户的积分
            ///首先读取版块内自定义积分
            ///版设置了自定义积分则使用,否则使用论坛默认积分
            float[] values = null;
            if (!credits.Equals(""))
            {
                int   index   = 0;
                float tempval = 0;
                values = new float[8];
                foreach (string ext in Utils.SplitString(credits, ","))
                {
                    //if (index == 0)
                    //{
                    //    if (!ext.Equals("True"))
                    //    {
                    //        values = null;
                    //        break;
                    //    }
                    //    index++;
                    //    continue;
                    //}
                    tempval       = Utils.StrToFloat(ext, 0);
                    values[index] = tempval;
                    index++;
                    if (index > 8)
                    {
                        break;
                    }
                }
            }
            if (values != null)
            {
                Forum.UserCredits.UpdateUserExtCredits(uid.ToString(), values);
            }

            HttpContext.Current.Response.Redirect(transferurl == string.Empty ? BaseConfigs.GetForumPath : transferurl, true);
        }
Exemple #5
0
        protected override void ShowPage()
        {
            if (postid == -1)
            {
                AddErrLine("无效的帖子ID");
                return;
            }

            // 获取该帖子的信息
            post = Posts.GetPostInfo(topicid, postid);
            if (post == null)
            {
                AddErrLine("不存在的帖子ID");
                return;
            }
            // 获取该主题的信息
            topic = Topics.GetTopicInfo(topicid);
            if (topic == null)
            {
                AddErrLine("不存在的主题ID");
                return;
            }
            if (topicid != post.Tid)
            {
                AddErrLine("主题ID无效");
                return;
            }

            topictitle = topic.Title;
            forumid    = topic.Fid;
            forum      = Forums.GetForumInfo(forumid);
            forumname  = forum.Name;
            pagetitle  = string.Format("删除{0}", post.Title);
            forumnav   = ShowForumAspxRewrite(forum.Pathlist.Trim(), forumid, forumpageid);

            if (!CheckPermission(post, DNTRequest.GetInt("opinion", -1)))
            {
                return;
            }

            if (!allowDelPost)
            {
                AddErrLine("当前不允许删帖");
                return;
            }

            // 通过验证的用户可以删除帖子,如果是主题帖则另处理
            if (post.Layer == 0)
            {
                TopicAdmins.DeleteTopics(topicid.ToString(), byte.Parse(forum.Recyclebin.ToString()), false);
                //重新统计论坛帖数
                Forums.SetRealCurrentTopics(forum.Fid);
                ForumTags.DeleteTopicTags(topicid);
            }
            else
            {
                int reval;
                if (topic.Special == 4)
                {
                    if (DNTRequest.GetInt("opinion", -1) != 1 && DNTRequest.GetInt("opinion", -1) != 2)
                    {
                        AddErrLine("参数错误");
                        return;
                    }
                    reval = Posts.DeletePost(Posts.GetPostTableId(topicid), postid, false, true);
                    Debates.DeleteDebatePost(topicid, DNTRequest.GetInt("opinion", -1), postid);
                }
                else
                {
                    reval = Posts.DeletePost(Posts.GetPostTableId(topicid), postid, false, true);
                }

                // 删除主题游客缓存
                ForumUtils.DeleteTopicCacheFile(topicid);
                //再次确保回复数精确
                Topics.UpdateTopicReplyCount(topic.Tid);
                //更新指定版块的最新发帖数信息
                Forums.UpdateLastPost(forum);

                if (reval > 0 && Utils.StrDateDiffHours(post.Postdatetime, config.Losslessdel * 24) < 0)
                {
                    UserCredits.UpdateUserCreditsByDeletePosts(post.Posterid);
                }
            }

            SetUrl(post.Layer == 0 ? base.ShowForumAspxRewrite(post.Fid, 0) : Urls.ShowTopicAspxRewrite(post.Tid, 1));
            SetMetaRefresh();
            SetShowBackLink(false);
            AddMsgLine("删除帖子成功, 返回主题");
        }
Exemple #6
0
        private void CreateTemplate_Click(object sender, EventArgs e)
        {
            #region 建立文件
            if (this.CheckCookie())
            {
                string templatepathlist = TreeView1.GetSelectString(",");

                if (templatepathlist == "")
                {
                    base.RegisterStartupScript("", "<script>alert('您未选中任何模板');</script>");
                    return;
                }
                if (DNTRequest.GetString("chkall") == "")   //非全部生成
                {
                    templatepathlist = RemadeTemplatePathList(templatepathlist);
                }
                int               templateid   = DNTRequest.GetInt("templateid", 1);
                string            skinname     = "";
                string            templateName = "";
                string[]          tempstr;
                int               updatecount       = 0;
                ForumPageTemplate forumpagetemplate = new ForumPageTemplate();

                foreach (string templatepath in templatepathlist.Split(','))
                {
                    tempstr      = templatepath.Split('\\');
                    skinname     = tempstr[0];
                    templateName = tempstr[tempstr.Length - 1];
                    tempstr      = templateName.Split('.');
                    if ((tempstr[tempstr.Length - 1].ToLower().Equals("htm") || (tempstr[tempstr.Length - 1].ToLower().Equals("config"))) && (templateName.IndexOf("_") != 0))
                    {
                        templateName = tempstr[0];
                        forumpagetemplate.GetTemplate("/", skinname, templateName, 1, templateid);
                        updatecount++;
                    }
                }
                //用cookies保存最近常生成的模板
                //templatepathlist = templatepathlist.Replace(DNTRequest.GetString("templatename") + "\\", "");
                //System.Web.HttpCookie commontemplate = new System.Web.HttpCookie("commontemplate");
                //if (templatepathlist.Split(',').Length > 5)
                //{
                //    string commontemplatevalue = "";
                //    string[] templatepathlistarray = templatepathlist.Split(',');
                //    for (int i = 0; i < 5; i++)
                //    {
                //        commontemplatevalue += templatepathlistarray[i] + ",";
                //    }
                //    commontemplate.Value = commontemplatevalue.TrimEnd(',');
                //}
                //else
                //{
                //    commontemplate.Value = templatepathlist;
                //}
                //commontemplate.Expires = DateTime.Now.AddYears(1);
                //Response.AppendCookie(commontemplate);


                base.RegisterStartupScript("PAGETemplate", "共" + updatecount + " 个模板已更新");
                //base.CallBaseRegisterStartupScript("form1", "<script>window.location.href='global_templatetree.aspx?templateid=" + Request.Params["templateid"] + "&path=" + Request.Params["path"].Replace(" ", "%20") + "&templatename=" + Request.Params["templatename"].Replace(" ", "%20") + "';</script>");
            }
            #endregion
        }
Exemple #7
0
        /// <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);
        }
Exemple #8
0
 public string AjaxHotTopicPagination(int recordcount, int pagesize, int currentpage, string condition)
 {
     if (DNTRequest.GetInt("postnumber", 0) > 0)
     {
         return(AjaxPagination(recordcount, pagesize, currentpage, "../usercontrols/ajaxtopicinfo.ascx", "pagename=forumhottopic&postnumber=" + DNTRequest.GetInt("postnumber", 0) + condition, "topiclistgrid"));
     }
     else
     {
         return(AjaxPagination(recordcount, pagesize, currentpage, "../usercontrols/ajaxtopicinfo.ascx", "pagename=forumhottopic" + condition, "topiclistgrid"));
     }
 }
Exemple #9
0
 //// <summary>
 /// 分页函数
 /// </summary>
 /// <param name="recordcount">总记录数</param>
 /// <param name="pagesize">每页记录数</param>
 /// <param name="currentpage">当前页数</param>
 public string AjaxPagination(int recordcount, int pagesize, int currentpage)
 {
     if (DNTRequest.GetInt("postnumber", 0) > 0)
     {
         return(AjaxPagination(recordcount, pagesize, currentpage, "../usercontrols/ajaxtopicinfo.ascx", "tablelist=" + tablelist + "&_ctl0=" + forumid + "&poster=" + posterlist + "&title=" + keylist + "&postdatetimeStart:postdatetimeStart=" + startdate + "&postdatetimeEnd:postdatetimeEnd=" + enddate + "&postnumber=" + DNTRequest.GetInt("postnumber", 0), "topiclistgrid"));
     }
     else
     {
         return(AjaxPagination(recordcount, pagesize, currentpage, "../usercontrols/ajaxtopicinfo.ascx", "tablelist=" + tablelist + "&_ctl0=" + forumid + "&poster=" + posterlist + "&title=" + keylist + "&postdatetimeStart:postdatetimeStart=" + startdate + "&postdatetimeEnd:postdatetimeEnd=" + enddate, "topiclistgrid"));
     }
 }
Exemple #10
0
        /// <summary>
        /// 获取功能列表为ZTree
        /// </summary>
        static public Object GetFunctionListForZTree()
        {
            #region 开始

            string result = string.Empty;
            try
            {
                int         channelId = DNTRequest.GetInt("channelId", 7);
                int         parentId  = DNTRequest.GetInt("parentId", 0);
                FunctionBLL op        = new FunctionBLL();
                Function    model     = new Function();
                DataSet     ds        = op.GetList("IsDeleted=0");
                DataTable   dt        = null;
                if (ds != null && ds.Tables.Count > 0)
                {
                    dt = ds.Tables[0];
                }

                List <Hashtable> list = new List <Hashtable>();
                if (dt != null && dt.Rows.Count > 0)
                {
                    DataRow[] allList = dt.Select(string.Format("ParentId={0}", parentId), "OrderId ASC");
                    if (allList.Length > 0)
                    {
                        foreach (DataRow dr in allList)
                        {
                            bool      isParent = false;
                            DataRow[] allChild = dt.Select(string.Format("ParentId={0}", dr["FunctionId"]), "OrderId ASC");
                            if (allChild != null && allChild.Length > 0)
                            {
                                isParent = true;
                            }
                            #region inner001
                            string    className = ComPage.SafeToString(dr["FunctionName"]);
                            Hashtable ht        = new Hashtable();

                            ht.Add("id", dr["FunctionId"]);
                            ht.Add("name", className);
                            ht.Add("pId", dr["ParentId"]);
                            ht.Add("externalLink", dr["ExternalLinkAddress"]);
                            ht.Add("orderId", dr["OrderId"]);
                            ht.Add("open", true);

                            if (isParent)
                            {
                                GetChild(list, allChild, dt);
                            }
                            list.Add(ht);
                            #endregion
                        }
                    }
                }
                result = DNTRequest.GetResultJson(true, "success", list);
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, ex.Message, null);
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            return(result);

            #endregion end 开始
        }
Exemple #11
0
 protected override void ShowPage()
 {
     if (this.postid == -1)
     {
         base.AddErrLine("无效的帖子ID");
         return;
     }
     this.post = Post.FindByID(this.postid);
     if (this.post == null)
     {
         base.AddErrLine("不存在的帖子ID");
         return;
     }
     this.topic = Topic.FindByID(this.topicid);
     if (this.topic == null)
     {
         base.AddErrLine("不存在的主题ID");
         return;
     }
     if (this.topicid != this.post.Tid)
     {
         base.AddErrLine("主题ID无效");
         return;
     }
     this.topictitle = this.topic.Title;
     this.forumid    = this.topic.Fid;
     this.forum      = Forums.GetForumInfo(this.forumid);
     this.forumname  = this.forum.Name;
     this.pagetitle  = string.Format("删除{0}", this.post.Title);
     this.forumnav   = base.ShowForumAspxRewrite(this.forum.Pathlist.Trim(), this.forumid, this.forumpageid);
     if (!this.CheckPermission(this.post, DNTRequest.GetInt("opinion", -1)))
     {
         return;
     }
     if (!this.allowDelPost)
     {
         base.AddErrLine("当前不允许删帖");
         return;
     }
     if (this.post.Layer == 0)
     {
         TopicAdmins.DeleteTopics(this.topicid.ToString(), forum.Recyclebin, false);
         XForum.SetRealCurrentTopics(this.forum.Fid);
         Tag.DeleteTopicTags(this.topicid);
     }
     else
     {
         if (this.topic.Special == 4)
         {
             if (DNTRequest.GetInt("opinion", -1) != 1 && DNTRequest.GetInt("opinion", -1) != 2)
             {
                 base.AddErrLine("参数错误");
                 return;
             }
             Posts.DeletePost(post, false, true);
             Debate.DeleteDebatePost(this.topicid, DNTRequest.GetInt("opinion", -1), this.postid);
         }
         else
         {
             Posts.DeletePost(post, false, true);
         }
         ForumUtils.DeleteTopicCacheFile(this.topicid);
         Topics.UpdateTopicReplyCount(this.topic.ID);
         //Forums.UpdateLastPost(this.forum);
         (forum as XForum).ResetLastPost();
     }
     base.SetUrl((this.post.Layer == 0) ? base.ShowForumAspxRewrite(this.post.Fid, 0) : Urls.ShowTopicAspxRewrite(this.post.Tid, 1));
     base.SetMetaRefresh();
     base.SetShowBackLink(false);
     base.AddMsgLine("删除帖子成功, 返回主题");
 }
Exemple #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                int    pertask    = DNTRequest.GetInt("pertask", 0);
                int    lastnumber = DNTRequest.GetInt("lastnumber", 0);
                int    startvalue = DNTRequest.GetInt("startvalue", 0);
                int    endvalue   = DNTRequest.GetInt("endvalue", 0);
                string text       = "";
                string key        = base.Request.Params["opname"];
                if (key != null)
                {
                    switch (key)
                    {
                    case "UpdatePostSP":
                        //AdminForumStats.UpdatePostSP(pertask, ref lastnumber);
                        text = lastnumber.ToString();
                        break;

                    case "UpdateMyPost":
                        AdminForumStats.UpdateMyPost(pertask, ref lastnumber);
                        text = lastnumber.ToString();
                        break;

                    case "ReSetFourmTopicAPost":
                        //AdminForumStats.ReSetFourmTopicAPost();
                        // 清空forums表中的帖子数,以便重新统计
                        // 取得每个版块在当前分表中的帖子数,累加并更新forums表中版块帖子数

                        //!!! 但是实际上SQL处理有误,每重置一次,数量会不断增加,故不迁移
                        text = "-1";
                        break;

                    case "ReSetUserDigestPosts":
                        AdminForumStats.ReSetUserDigestPosts();
                        text = "-1";
                        break;

                    case "ReSetUserPosts":
                        AdminForumStats.ReSetUserPosts(pertask, ref lastnumber);
                        text = lastnumber.ToString();
                        break;

                    case "ReSetTopicPosts":
                        AdminForumStats.ReSetTopicPosts(pertask, ref lastnumber);
                        text = lastnumber.ToString();
                        break;

                    case "ReSetFourmTopicAPost_StartEnd":
                        AdminForumStats.ReSetFourmTopicAPost(startvalue, endvalue);
                        text = "1";
                        break;

                    case "ReSetUserDigestPosts_StartEnd":
                        AdminForumStats.ReSetUserDigestPosts(startvalue, endvalue);
                        text = "1";
                        break;

                    case "ReSetUserPosts_StartEnd":
                        AdminForumStats.ReSetUserPosts(startvalue, endvalue);
                        text = "1";
                        break;

                    case "ReSetTopicPosts_StartEnd":
                        AdminForumStats.ResetLastRepliesInfoOfTopics(startvalue, endvalue);
                        text = "1";
                        break;

                    //case "ftptest":
                    //    {
                    //        var fTPs = new FTPs();
                    //        string str = "";
                    //        text = (fTPs.TestConnect(Request["serveraddress"], DNTRequest.GetInt("serverport", 0), Request["username"], Request["password"], DNTRequest.GetInt("timeout", 0), Request["uploadpath"], ref str) ? "ok" : ("远程附件设置测试出现错误!\n描述:" + str));
                    //        break;
                    //    }
                    case "setapp":
                    {
                        var config = APIConfigInfo.Current;
                        config.Enable = (Request["allowpassport"] == "1");

                        //APIConfigs.SaveConfig(config);
                        config.Save();
                        text = "ok";
                        break;
                    }

                    case "location":
                    {
                        string @string = Request["city"];
                        text = "ok";
                        //var dataTable = MallPluginProvider.GetInstance().GetLocationsTable();
                        //foreach (DataRow dataRow in dataTable.Rows)
                        //{
                        //	if (dataRow["country"].ToString() == Request["country"] && dataRow["state"].ToString() == Request["state"] && dataRow["city"].ToString() == @string)
                        //	{
                        //		text = "<img src='../images/false.gif' title='" + @string + "已经存在!'>";
                        //		break;
                        //	}
                        //}
                        break;
                    }

                    //case "goodsinfo":
                    //	int goodsid = DNTRequest.GetInt("goodsid", 0);
                    //	var goodsInfo = MallPluginProvider.GetInstance().GetGoodsInfo(goodsid);
                    //	if (goodsInfo == null)
                    //	{
                    //		text = "商品不存在!";
                    //	}
                    //	else
                    //	{
                    //		text = "<table width='100%'><tr><td>" + UBB.UBBToHTML(new PostpramsInfo
                    //		{
                    //			Allowhtml = 1,
                    //			Showimages = 1,
                    //			Sdetail = goodsInfo.Message
                    //		}) + "</td></tr></table>";
                    //	}
                    //	break;
                    case "downloadword":
                    {
                        //var dataTable = BanWords.GetBanWordList();
                        //string text2 = "";
                        //if (dataTable.Rows.Count > 0)
                        //{
                        //    for (int i = 0; i < dataTable.Rows.Count; i++)
                        //    {
                        //        text2 = text2 + dataTable.Rows[i][2].ToString() + "=" + dataTable.Rows[i][3].ToString() + "\r\n";
                        //    }
                        //}
                        var    text2 = Word.GetBanWordsStr();
                        string s     = "words.txt";
                        HttpContext.Current.Response.Clear();
                        HttpContext.Current.Response.Buffer          = false;
                        HttpContext.Current.Response.ContentEncoding = Encoding.UTF8;
                        HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + base.Server.UrlEncode(s));
                        HttpContext.Current.Response.ContentType = "text/plain";
                        HttpContext.Current.Response.Write(text2);
                        HttpContext.Current.Response.End();
                        break;
                    }

                    case "gettopicinfo":
                    {
                        var sb        = new StringBuilder();
                        var topicInfo = Topic.FindByID(DNTRequest.GetInt("tid", 0));
                        sb.Append("[");
                        if (topicInfo != null)
                        {
                            sb.Append(string.Format("{{'tid':{0},'title':'{1}'}}", topicInfo.ID, topicInfo.Title));
                        }
                        HttpContext.Current.Response.Clear();
                        HttpContext.Current.Response.ContentType = "application/json";
                        HttpContext.Current.Response.Expires     = 0;
                        HttpContext.Current.Response.Cache.SetNoStore();
                        HttpContext.Current.Response.Write(sb.Append("]").ToString());
                        HttpContext.Current.Response.End();
                        break;
                    }

                    case "DeletePrivateMessages":
                        var rs = ShortMessage.DeletePrivateMessages(Request["isnew"] == "true", Request["postdatetime"].ToInt(), Request["msgfromlist"], Request["lowerupper"] == "true", this.DecodeChar(Request["subject"]), this.DecodeChar(Request["message"]), Request["isupdateusernewpm"] == "true");
                        text = string.Format("[{{'count':'{0}'}}]", rs);
                        Thread.Sleep(4000);
                        break;

                    case "sendsmtogroup":
                    {
                        int int5 = DNTRequest.GetInt("start_uid", 0);
                        text = Users.SendPMByGroupidList(Request["groupidlist"], DNTRequest.GetInt("topnumber", 0), ref int5, Request["msgfrom"], DNTRequest.GetInt("msguid", 1), DNTRequest.GetInt("folder", 0), this.DecodeChar(Request["subject"]), Request["postdatetime"], this.DecodeChar(Request["message"])).ToString();
                        text = string.Format("[{{'startuid':{0},'count':'{1}'}}]", int5, text);
                        Thread.Sleep(4000);
                        break;
                    }

                    case "usergroupsendemail":
                    {
                        int int6 = DNTRequest.GetInt("start_uid", 0);
                        text = Users.SendEmailByGroupidList(Request["groupidlist"], DNTRequest.GetInt("topnumber", 0), ref int6, this.DecodeChar(Request["subject"]), this.DecodeChar(Request["body"])).ToString();
                        text = string.Format("[{{'startuid':{0},'count':'{1}'}}]", int6, text);
                        Thread.Sleep(4000);
                        break;
                    }

                    case "updateusercreditbyformula":
                    {
                        int int7 = DNTRequest.GetInt("start_uid", 0);
                        text = Users.UpdateUserCredits(this.DecodeChar(Request["formula"]), int7).ToString();
                        text = string.Format("[{{'startuid':{0},'count':'{1}'}}]", int7 + 100, text);
                        Thread.Sleep(4000);
                        break;
                    }

                    default:
                        break;
                    }
                }

                HttpContext.Current.Response.Clear();
                HttpContext.Current.Response.Expires = 0;
                HttpContext.Current.Response.Cache.SetNoStore();
                base.Response.Write(text);
                base.Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1.0);
                base.Response.Expires         = -1;
                base.Response.End();
            }
        }
        private void AddSmileInfo_Click(object sender, EventArgs e)
        {
            #region 添加表情记录

            if (this.CheckCookie())
            {
                DatabaseProvider.GetInstance().AddSmiles(DatabaseProvider.GetInstance().GetMaxSmiliesId(), int.Parse(displayorder.Text),
                                                         DNTRequest.GetInt("typeid", 0), code.Text,
                                                         Smilies.GetSmilieTypeById(DNTRequest.GetInt("typeid", 0).ToString())["url"].ToString() + "/" + url.UpdateFile());

                Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UI/SmiliesList");
                Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UI/SmiliesListWithInfo");
                AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "表情文件添加", code.Text);
                base.RegisterStartupScript("PAGE", "window.location.href='forum_smilegrid.aspx?typeid=" + DNTRequest.GetInt("typeid", 0) + "';");

                //if (this.CheckCookie())
                //{
                //    string sqlstring = string.Format("INSERT INTO [" + BaseConfigFactory.GetTablePrefix + "smilies] (displayorder,type,code,url) Values ('{0}','{1}','{2}','{3}')",
                //                                     displayorder.Text,

                //                                     code.Text,
                //                                     SmiliesFactory.GetSmilieTypeById(DNTRequest.GetInt("typeid", 0).ToString())["url"].ToString() + "/" + url.UpdateFile());
                //    AdminDatabase.ExecuteNonQuery(sqlstring);

                //    DatabaseProvider.GetInstance().AddSmiles(DatabaseProvider.GetInstance().GetMaxSmiliesId(),int.Parse(displayorder.Text),DNTRequest.GetInt("typeid", 0),code.Text,
                //        Smilies.GetSmilieTypeById(DNTRequest.GetInt("typeid", 0).ToString())["url"].ToString() + "/" + url.UpdateFile());

                //    DNTCache.GetCacheService().RemoveObject("/Forum/UI/SmiliesList");
                //    DNTCache.GetCacheService().RemoveObject("/Forum/UI/SmiliesListWithInfo");
                //    AdminVistLogFactory.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "表情文件添加", code.Text);
                //    Page.RegisterStartupScript("PAGE", "window.location.href='forum_smilegrid.aspx?typeid=" + DNTRequest.GetInt("typeid", 0) + "';");
                //}
            }

            #endregion
        }
Exemple #14
0
        public showforum()
        {
            //

            int forumid = DNTRequest.GetInt("forumid", -1);

            if (forumid == -1)
            {
                ShowMsg("无效的版块ID");
                return;
            }


            ForumInfo forum = Forums.GetForumInfo(forumid);

            if (forum == null)
            {
                ShowMsg("不存在的版块ID");
                return;
            }
            if (!Forums.AllowView(forum.Viewperm, usergroupinfo.Groupid))
            {
                ShowMsg("您没有浏览该版块的权限");
                return;
            }

            if (forum.Password != "")
            {
                ShowMsg("简洁版本无法浏览设置了密码的版块");
                return;
            }

            ShowTitle(forum.Name + " - 首页");
            ShowBody();
            HttpContext.Current.Response.Write("<h1>" + config.Forumtitle + "</h1>");

            HttpContext.Current.Response.Write("<div class=\"forumnav\">");
            HttpContext.Current.Response.Write("<a href=\"index.aspx\">首页</a> &raquo; ");
            HttpContext.Current.Response.Write(ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname).Replace("</a><", "</a> &raquo; <"));
            HttpContext.Current.Response.Write("</div>\r\n");

            HttpContext.Current.Response.Write("<div id=\"wrap\">");

            //得到当前用户请求的页数
            int pageid = DNTRequest.GetInt("page", 1);
            //获取主题总数
            int topiccount = Topics.GetTopicCount(forumid);

            // 得到Tpp设置
            int tpp = 50;

            //获取总页数
            int pagecount = topiccount % tpp == 0 ? topiccount / tpp : topiccount / tpp + 1;

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


            HttpContext.Current.Response.Write("<ol>");
            //获取当前页主题列表
            DataTable dt;

            dt = Topics.GetTopicList(forumid, pageid, tpp);

            foreach (DataRow dr in dt.Rows)
            {
                if (config.Aspxrewrite == 1)
                {
                    HttpContext.Current.Response.Write(string.Format("<li><a href=\"showtopic-{0}{1}\">{2}</a>  &nbsp; ({3} 篇回复)</li>", dr["tid"].ToString(), config.Extname, dr["title"].ToString().Trim(), dr["replies"].ToString()));
                }
                else
                {
                    HttpContext.Current.Response.Write(string.Format("<li><a href=\"showtopic.aspx?topicid={0}\">{1}</a>  &nbsp; ({2} 篇回复)</li>", dr["tid"].ToString(), dr["title"].ToString().Trim(), dr["replies"].ToString()));
                }
            }
            HttpContext.Current.Response.Write("</ol>");

            HttpContext.Current.Response.Write("</div>");

            //页码链接
            HttpContext.Current.Response.Write("<div class=\"pagenumbers\">");
            if (config.Aspxrewrite == 1)
            {
                HttpContext.Current.Response.Write(Utils.GetStaticPageNumbers(pageid, pagecount, "showforum-" + forumid.ToString(), config.Extname, 8));
                HttpContext.Current.Response.Write("</div>");
                HttpContext.Current.Response.Write(string.Format("<div class=\"fullversion\">查看完整版本: <a href=\"../showforum-{0}{1}\">{2}</a></div>\r\n", forumid.ToString(), config.Extname, forum.Name));
            }
            else
            {
                HttpContext.Current.Response.Write(Utils.GetPageNumbers(pageid, pagecount, "showforum.aspx", 8));
                HttpContext.Current.Response.Write("</div>");
                HttpContext.Current.Response.Write(string.Format("<div class=\"fullversion\">查看完整版本: <a href=\"../showforum.aspx?forumid={0}\">{1}</a></div>\r\n", forumid.ToString(), forum.Name));
            }
            ShowFooter();
            HttpContext.Current.Response.End();
        }
Exemple #15
0
        protected override void ShowPage()
        {
            if (config.Enablemall == 0) //未启用交易服务
            {
                AddErrLine("系统未开启交易服务, 当前页面暂时无法访问!");
                return;
            }

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

            headerad = "";
            footerad = "";

            // 如果商品交易日志不正确
            if (goodstradelogid <= 0)
            {
                AddErrLine("无效的交易日志信息.");
                return;
            }

            goodstradelog = TradeLogs.GetGoodsTradeLogInfo(goodstradelogid);
            int oldstatus = goodstradelog.Status;

            if (config.Enablemall == 1) //开启普通模式
            {
                forumid = GoodsCategories.GetCategoriesFid(goodstradelog.Categoryid);
            }
            else
            {
                forumid = 0;
            }

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

            if (goodstradelog.Sellerid != userid && goodstradelog.Buyerid != userid)
            {
                AddErrLine("您的身份不是买卖双方, 因为不能评价");
                return;
            }
            if (goodstradelog.Status != 7 && goodstradelog.Status != 17)
            {
                AddErrLine("交易尚未结束, 因为不能评价");
                return;
            }
            if (!GoodsRates.CanRate(goodstradelog.Id, userid)) //如果当前用户已评价过则不允许再评价
            {
                AddErrLine("不能重复评价");
                return;
            }


            //如果是提交...
            if (ispost)
            {
                Goodsrateinfo goodsrateinfo = new Goodsrateinfo();
                goodsrateinfo.Ip              = DNTRequest.GetIP();
                goodsrateinfo.Postdatetime    = DateTime.Now;
                goodsrateinfo.Price           = goodstradelog.Number * goodstradelog.Price + goodstradelog.Transportfee;
                goodsrateinfo.Ratetype        = DNTRequest.GetInt("ratetype", 0);
                goodsrateinfo.Uid             = userid;
                goodsrateinfo.Username        = username;
                goodsrateinfo.Message         = DNTRequest.GetString("message");
                goodsrateinfo.Goodstradelogid = goodstradelog.Id;
                goodsrateinfo.Goodstitle      = goodstradelog.Subject;
                goodsrateinfo.Goodsid         = goodstradelog.Goodsid;
                goodsrateinfo.Explain         = "";

                if (goodstradelog.Buyerid == userid)  //买家
                {
                    goodsrateinfo.Uidtype        = 2;
                    goodsrateinfo.Ratetouid      = goodstradelog.Sellerid;
                    goodsrateinfo.Ratetousername = goodstradelog.Seller;
                    goodstradelog.Ratestatus     = 2;
                }
                else //卖家
                {
                    goodsrateinfo.Uidtype        = 1;
                    goodsrateinfo.Ratetouid      = goodstradelog.Buyerid;
                    goodsrateinfo.Ratetousername = goodstradelog.Buyer;
                    goodstradelog.Ratestatus     = 1;
                }
                if (GoodsRates.CreateGoodsRate(goodsrateinfo) > 0) //如果评价成功
                {
                    if (GoodsRates.RateClosed(goodsrateinfo.Goodstradelogid, goodstradelog.Sellerid, goodstradelog.Buyerid))
                    {
                        goodstradelog.Ratestatus = 3;
                        TradeLogs.UpdateTradeLog(goodstradelog, oldstatus); //更新交易的评价状态
                    }

                    GoodsUserCredits.SetUserCredit(goodsrateinfo, goodsrateinfo.Uidtype == 1 ? goodstradelog.Buyerid : goodstradelog.Sellerid);

                    SetUrl(base.ShowGoodsAspxRewrite(goodsrateinfo.Goodsid));
                    SetMetaRefresh();
                    AddMsgLine("您的评价已经成功<br />(<a href=\"" + base.ShowGoodsAspxRewrite(goodsrateinfo.Goodsid) + "\">点击这里返回商品页面</a>)<br />");
                }
            }
        }
Exemple #16
0
        protected override void ShowPage()
        {
            // 获取帖子ID
            topicid = DNTRequest.GetInt("topicid", -1);
            postid  = DNTRequest.GetInt("postid", -1);
            // 如果主题ID非数字
            if (postid == -1)
            {
                AddErrLine("无效的帖子ID");
                return;
            }

            // 获取该帖子的信息
            post = Posts.GetPostInfo(topicid, postid);
            // 如果该帖子不存在
            if (post == null)
            {
                AddErrLine("不存在的主题ID");
                return;
            }

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

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

            if (topicid != post.Tid)
            {
                AddErrLine("主题ID无效");
                return;
            }

            topictitle = topic.Title;
            forumid    = topic.Fid;
            forum      = Forums.GetForumInfo(forumid);
            forumname  = forum.Name;
            pagetitle  = "删除" + post.Title;
            forumnav   = ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname);
            int opinion = DNTRequest.GetInt("opinion", -1);

            if (!CheckPermission(post, opinion))
            {
                return;
            }

            if (!allowdelpost)
            {
                AddErrLine("当前不允许删帖");
                return;
            }

            int Losslessdel = Utils.StrDateDiffHours(post.Postdatetime, config.Losslessdel * 24);

            // 通过验证的用户可以删除帖子,如果是主题贴则另处理
            if (post.Layer == 0)
            {
                TopicAdmins.DeleteTopics(topicid.ToString(), byte.Parse(forum.Recyclebin.ToString()), false);
                //重新统计论坛帖数
                Forums.SetRealCurrentTopics(forum.Fid);

                ForumTags.DeleteTopicTags(topicid);
            }
            else
            {
                int reval;
                if (topic.Special == 4)
                {
                    string opiniontext = "";

                    if (opinion != 1 && opinion != 2)
                    {
                        AddErrLine("参数错误");
                        return;
                    }
                    reval = Posts.DeletePost(Posts.GetPostTableID(topicid), postid, false, true);
                    switch (opinion)
                    {
                    case 1:
                        opiniontext = "positivediggs";
                        break;

                    case 2:
                        opiniontext = "negativediggs";
                        break;
                    }
                    Discuz.Data.DatabaseProvider.GetInstance().DeleteDebatePost(topicid, opiniontext, postid);
                }
                else
                {
                    reval = Posts.DeletePost(Posts.GetPostTableID(topicid), postid, false, true);
                }

                // 删除主题游客缓存
                ForumUtils.DeleteTopicCacheFile(topicid);

                //再次确保回复数精确
                Topics.UpdateTopicReplies(topic.Tid);

                //更新指定版块的最新发帖数信息
                Forums.UpdateLastPost(forum);

                if (reval > 0 && Losslessdel < 0)
                {
                    UserCredits.UpdateUserCreditsByPosts(post.Posterid, -1);
                }
            }


            SetUrl(Urls.ShowTopicAspxRewrite(post.Tid, 1));
            if (post.Layer == 0)
            {
                SetUrl(base.ShowForumAspxRewrite(post.Fid, 0));
            }
            SetMetaRefresh();
            SetShowBackLink(false);
            AddMsgLine("删除帖子成功, 返回主题");
        }
Exemple #17
0
        /// <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);
        }
        protected override void ShowPage()
        {
            pagetitle = "首页";
            if (userid > 0 && useradminid > 0)
            {
                AdminGroupInfo admingroupinfo = AdminGroups.GetAdminGroupInfo(usergroupid);
                if (admingroupinfo != null)
                {
                    disablepostctrl = admingroupinfo.Disablepostctrl;
                }
            }

            int toframe = DNTRequest.GetInt("f", 1);

            if (toframe == 0)
            {
                ForumUtils.WriteCookie("isframe", "1");
            }
            else
            {
                toframe = Utils.StrToInt(ForumUtils.GetCookie("isframe"), -1) == -1 ? config.Isframeshow : Utils.StrToInt(ForumUtils.GetCookie("isframe"), -1);
            }

            if (toframe == 2)
            {
                HttpContext.Current.Response.Redirect(BaseConfigs.GetForumPath + "frame.aspx");
                HttpContext.Current.Response.End();
                return;
            }

            if (config.Rssstatus == 1)
            {
                AddLinkRss("tools/rss.aspx", "最新主题");
            }

            OnlineUsers.UpdateAction(olid, UserAction.IndexShow.ActionID, 0, config.Onlinetimeout);

            //if (newpmcount > 0)
            //    pmlist = PrivateMessages.GetPrivateMessageListForIndex(userid,5,1,1);

            if (userid != -1)
            {
                userinfo = Users.GetShortUserInfo(userid);
                if (userinfo == null)
                {
                    userid = -1;
                    ForumUtils.ClearUserCookie("dnt");
                }
                else
                {
                    newpmcount = userinfo.Newpm == 0 ? 0 : newpmcount;
                    lastvisit  = userinfo.Lastvisit.ToString();
                    showpmhint = Convert.ToInt32(userinfo.Newsletter) > 4;
                }
            }

            navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname);

            forumlist      = Forums.GetForumIndexCollection(config.Hideprivate, usergroupid, config.Moddisplay, out totaltopic, out totalpost, out todayposts);
            forumlinkcount = forumlinklist.Rows.Count;

            //个人空间控制
            if (config.Enablespace == 1)
            {
                GetSpacePerm();
            }

            // 获得统计信息
            totalusers       = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("totalusers"));
            lastusername     = Statistics.GetStatisticsRowItem("lastusername").Trim();
            lastuserid       = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("lastuserid"));
            yesterdayposts   = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("yesterdayposts"));
            highestposts     = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("highestposts"));
            highestpostsdate = Statistics.GetStatisticsRowItem("highestpostsdate").ToString().Trim();
            if (todayposts > highestposts)
            {
                highestposts     = todayposts;
                highestpostsdate = DateTime.Now.ToString("yyyy-M-d");
            }
            totalonline     = onlineusercount;
            showforumonline = false;
            onlineiconlist  = Caches.GetOnlineGroupIconList();
            if (totalonline < config.Maxonlinelist || DNTRequest.GetString("showonline") == "yes")
            {
                showforumonline = true;
                //获得在线用户列表和图标
                onlineuserlist = OnlineUsers.GetOnlineUserCollection(out totalonline, out totalonlineguest, out totalonlineuser, out totalonlineinvisibleuser);
            }

            if (DNTRequest.GetString("showonline") == "no")
            {
                showforumonline = false;
            }

            highestonlineusercount = Statistics.GetStatisticsRowItem("highestonlineusercount");
            highestonlineusertime  = DateTime.Parse(Statistics.GetStatisticsRowItem("highestonlineusertime")).ToString("yyyy-MM-dd HH:mm");
            // 得到公告
            announcementlist  = Announcements.GetSimplifiedAnnouncementList(nowdatetime, "2999-01-01 00:00:00");
            announcementcount = announcementlist != null ? announcementlist.Rows.Count : 0;

            List <IndexPageForumInfo> topforum = new List <IndexPageForumInfo>();

            foreach (IndexPageForumInfo f in forumlist)
            {
                f.Description = UBB.ParseSimpleUBB(f.Description);
                if (f.Layer == 0)
                {
                    topforum.Add(f);
                }
            }

            taglist = config.Enabletag == 1 ? ForumTags.GetCachedHotForumTags(config.Hottagcount) : new TagInfo[0];

            ///得到广告列表
            headerad   = Advertisements.GetOneHeaderAd("indexad", 0);
            footerad   = Advertisements.GetOneFooterAd("indexad", 0);
            inforumad  = Advertisements.GetInForumAd("indexad", 0, topforum, templatepath);
            pagewordad = Advertisements.GetPageWordAd("indexad", 0);
            doublead   = Advertisements.GetDoubleAd("indexad", 0);
            floatad    = Advertisements.GetFloatAd("indexad", 0);
            mediaad    = Advertisements.GetMediaAd(templatepath, "indexad", 0);
            pagead     = Advertisements.GetPageAd("indexad", 0);

            if (userid > 0)
            {
                if (oluserinfo.Newpms < 0)
                {
                    Users.UpdateUserNewPMCount(userid, olid);
                }
            }
        }
Exemple #19
0
        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}&quote={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));
                }
            }
        }
        public ajaxpostinfo()
        {
            if (DNTRequest.GetInt("tid", 0) == 0)
            {
                return;
            }
            DataTable dt = Posts.GetPostInfo(DNTRequest.GetString("istopic") == "true", DNTRequest.GetInt("tid", 0), DNTRequest.GetInt("pid", 0));

            GetPostInfo(dt);
            dt.Dispose();

            //    dt.Dispose();
            //int tid = DNTRequest.GetInt("tid", 0);
            //string posttablename = string.Format("{0}posts{1}", BaseConfigs.GetTablePrefix, Posts.GetPostTableId(tid));
            ////是否帖子
            //if (DNTRequest.GetString("istopic") == "false")
            //{
            //    int pid = DNTRequest.GetInt("pid", 0);
            //    DataTable dt = Posts.GetPostInfoByPid(posttablename, pid);
            //    GetPostInfo(dt);
            //    dt.Dispose();
            //}
            ////是否是主题
            //if (DNTRequest.GetString("istopic") == "true")
            //{
            //    DataTable dt = Posts.GetMainPostInfo(posttablename, tid);
            //    GetPostInfo(dt);
            //    dt.Dispose();
            //}
        }
Exemple #21
0
        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);
            }
        }
Exemple #22
0
        public void SubmitButton_Click(object sender, EventArgs e)
        {
            bool flag = false;

            for (int i = 1; i <= this.fileList.Count; i++)
            {
                if (DNTRequest.GetFormString("id" + i) != "")
                {
                    try
                    {
                        if (!Utils.IsNumeric(DNTRequest.GetInt("typeid", 0)))
                        {
                            flag = true;
                        }
                        else
                        {
                            AdminForums.CreateSmilies(DNTRequest.GetFormInt("order" + i, 0), DNTRequest.GetInt("typeid", 0), DNTRequest.GetFormString("code" + i), DNTRequest.GetFormString("url" + i), this.userid, this.username, this.usergroupid, this.grouptitle, this.ip);
                        }
                    }
                    catch
                    {
                        base.RegisterStartupScript("", "<script>alert('出现错误,可能文件超出长度!');window.location.href='forum_smilegrid.aspx?typeid=" + DNTRequest.GetInt("typeid", 0) + "';</script>");
                    }
                }
            }
            base.RegisterStartupScript("", "<script>" + (flag ? "alert('增加的记录中某个显示顺序是非数字,该记录未能增加!');" : "") + "window.location.href='forum_smilegrid.aspx?typeid=" + DNTRequest.GetInt("typeid", 0) + "';</script>");
        }
Exemple #23
0
        private void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                int @int = DNTRequest.GetInt("opnumber", 0);
                int num  = -1;
                switch (@int)
                {
                case 1:

                    //Caches.ReSetAdminGroupList();
                    num = 2;
                    break;

                case 2:
                    //Caches.ReSetUserGroupList();
                    num = 3;
                    break;

                case 3:
                    Caches.ReSetModeratorList();
                    num = 4;
                    break;

                case 4:
                    Caches.ReSetAnnouncementList();
                    Caches.ReSetSimplifiedAnnouncementList();
                    num = 5;
                    break;

                case 5:
                    Caches.ReSetSimplifiedAnnouncementList();
                    num = 6;
                    break;

                case 6:
                    Caches.ReSetForumListBoxOptions();
                    num = 7;
                    break;

                case 7:
                    Caches.ReSetSmiliesList();
                    num = 8;
                    break;

                case 8:
                    Caches.ReSetIconsList();
                    num = 9;
                    break;

                case 9:
                    Caches.ReSetCustomEditButtonList();
                    num = 10;
                    break;

                case 10:
                    num = 11;
                    break;

                case 11:
                    Caches.ReSetScoreset();
                    num = 12;
                    break;

                case 12:
                    Caches.ReSetSiteUrls();
                    num = 13;
                    break;

                case 13:
                    Caches.ReSetStatistics();
                    num = 14;
                    break;

                case 14:
                    Caches.ReSetAttachmentTypeArray();
                    num = 15;
                    break;

                case 15:
                    Caches.ReSetTemplateListBoxOptionsCache();
                    num = 16;
                    break;

                case 16:
                    //Caches.ReSetOnlineGroupIconList();
                    num = 17;
                    break;

                case 17:
                    Caches.ReSetForumLinkList();
                    num = 18;
                    break;

                case 18:
                    Caches.ReSetBanWordList();
                    num = 19;
                    break;

                case 19:
                    Caches.ReSetForumList();
                    num = 20;
                    break;

                case 20:
                    Caches.ReSetOnlineUserTable();
                    num = 21;
                    break;

                case 21:
                    Caches.ReSetRss();
                    num = 22;
                    break;

                case 22:
                    Caches.ReSetRssXml();
                    num = 23;
                    break;

                case 23:
                    Caches.ReSetValidTemplateIDList();
                    num = 24;
                    break;

                case 24:
                    Caches.ReSetValidScoreName();
                    num = 25;
                    break;

                case 25:
                    //Caches.ReSetMedalsList();
                    num = 26;
                    break;

                case 26:
                    Caches.ReSetDBlinkAndTablePrefix();
                    num = 27;
                    break;

                case 27:
                    //Caches.ReSetAllPostTableName();
                    num = 28;
                    break;

                case 28:
                    //Caches.ReSetLastPostTableName();
                    num = 29;
                    break;

                case 29:
                    Caches.ReSetAdsList();
                    num = 30;
                    break;

                case 30:
                    Caches.ReSetStatisticsSearchtime();
                    num = 31;
                    break;

                case 31:
                    Caches.ReSetStatisticsSearchcount();
                    num = 32;
                    break;

                case 32:
                    Caches.ReSetCommonAvatarList();
                    num = 33;
                    break;

                case 33:
                    Caches.ReSetJammer();
                    num = 34;
                    break;

                case 34:
                    Caches.ReSetMagicList();
                    num = 35;
                    break;

                case 35:
                    Caches.ReSetScorePaySet();
                    num = 36;
                    break;

                case 36:
                    //Caches.ReSetPostTableInfo();
                    num = 37;
                    break;

                case 37:
                    Caches.ReSetDigestTopicList(16);
                    num = 38;
                    break;

                case 38:
                    Caches.ReSetHotTopicList(16, 30);
                    num = 39;
                    break;

                case 39:
                    Caches.ReSetRecentTopicList(16);
                    num = 40;
                    break;

                case 40:
                    Caches.EditDntConfig();
                    num = 41;
                    break;

                case 41:
                    Online.ResetOnlineList();
                    num = 42;
                    break;

                case 42:
                    Caches.ReSetNavPopupMenu();
                    num = -1;
                    break;
                }
                base.Response.Write(num);
                base.Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1.0);
                base.Response.Expires         = -1;
                base.Response.End();
            }
        }
Exemple #24
0
 private void DelRec_Click(object sender, EventArgs e)
 {
     if (base.CheckCookie())
     {
         if (Request["id"] != "")
         {
             string @string = Request["id"];
             AdminForums.DeleteSmilies(@string, this.userid, this.username, this.usergroupid, this.grouptitle, this.ip);
             base.Response.Redirect("forum_smilegrid.aspx?typeid=" + DNTRequest.GetInt("typeid", 0));
             return;
         }
         base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location.href='forum_smilegrid.aspx?typeid=" + DNTRequest.GetInt("typeid", 0) + "';</script>");
     }
 }
Exemple #25
0
        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
        }
Exemple #26
0
        private void EditSmile_Click(object sender, EventArgs e)
        {
            int  num  = 0;
            bool flag = false;

            foreach (object current in this.smilesgrid.GetKeyIDArray())
            {
                if (!Utils.IsNumeric(this.smilesgrid.GetControlValue(num, "displayorder")))
                {
                    flag = true;
                }
                else
                {
                    AdminForums.UpdateSmilies(int.Parse(current.ToString()), int.Parse(this.smilesgrid.GetControlValue(num, "displayorder")), DNTRequest.GetInt("typeid", 0), this.smilesgrid.GetControlValue(num, "code"), this.smilesgrid.GetControlValue(num, "url"), this.userid, this.username, this.usergroupid, this.grouptitle, this.ip);
                    num++;
                }
            }
            if (flag)
            {
                base.RegisterStartupScript("", "<script>alert('批量更新出现输入错误,某些记录未能更新');window.location.href='forum_smilegrid.aspx?typeid=" + DNTRequest.GetInt("typeid", 0) + "';</script>");
                return;
            }
            base.RegisterStartupScript("", "<script>window.location.href='forum_smilegrid.aspx?typeid=" + DNTRequest.GetInt("typeid", 0) + "';</script>");
        }
        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
        }
Exemple #28
0
        public AjaxPage()
        {
            //this.config = GeneralConfigInfo.Current;
            string t = DNTRequest.GetString("t");

            switch (t)
            {
            case "checkusername":
                this.CheckUserName();
                break;

            case "checkrewritename":
                //this.CheckRewriteName();
                break;

            case "ratelist":
                this.GetRateLogList();
                break;

            case "smilies":
                this.GetSmilies();
                break;

            case "relatekw":
                this.GetRelateKeyword();
                break;

            case "gettopictags":
                this.GetTopicTags();
                break;

            case "topicswithsametag":
                this.GetTopicsWithSameTag();
                break;

            case "getforumhottags":
                this.GetForumHotTags();
                break;

            case "gethotdebatetopic":
                this.Getdebatesjsonlist("gethotdebatetopic", DNTRequest.GetString("tidlist", true));
                break;

            case "recommenddebates":
                this.Getdebatesjsonlist("recommenddebates", DNTRequest.GetString("tidlist", true));
                break;

            case "addcommentdebates":
                this.ResponseXML(Debates.CommentDabetas(DNTRequest.GetInt("tid", 0), DNTRequest.GetString("commentdebates", true), DNTRequest.IsPost()));
                break;

            case "getpostinfo":
                this.GetPostInfo();
                break;

            case "getattachpaymentlog":
                this.GetAttachPaymentLogByAid(DNTRequest.GetInt("aid", 0));
                break;

            case "getiplist":
                this.GetIpList();
                break;

            case "getforumtopictypelist":
                this.GetForumTopicTypeList();
                break;

            case "image":
                this.GetImage();
                break;

            case "resetemail":
                this.ResetEmail();
                break;

            case "colorfulltags":
                ColorFullTags();
                break;

            case "closedtags":
                ClosedTags();
                break;
            }
            if (DNTRequest.GetString("Filename") != "" && DNTRequest.GetString("Upload") != "")
            {
                var uid = DecodeUid(DNTRequest.GetString("input")).Split(',')[0].ToInt(-1);
                this.ResponseText(this.UploadTempAvatar(uid));
                return;
            }
            if (DNTRequest.GetString("avatar1") != "" && DNTRequest.GetString("avatar2") != "" && DNTRequest.GetString("avatar3") != "")
            {
                var uid = DecodeUid(DNTRequest.GetString("input")).Split(',')[0];
                //this.CreateDir(uid);
                if (!this.SaveAvatar("avatar1", uid) || !this.SaveAvatar("avatar2", uid) || !this.SaveAvatar("avatar3", uid))
                {
                    //File.Delete(Utils.GetMapPath(BaseConfigs.GetForumPath + "upload\\temp\\avatar_" + uid + ".jpg"));
                    this.ResponseText("<?xml version=\"1.0\" ?><root><face success=\"0\"/></root>");
                    return;
                }
                //File.Delete(Utils.GetMapPath(BaseConfigs.GetForumPath + "upload\\temp\\avatar_" + uid + ".jpg"));
                this.ResponseText("<?xml version=\"1.0\" ?><root><face success=\"1\"/></root>");
            }
        }
Exemple #29
0
        protected override void ShowPage()
        {
            pagetitle = "用户控制面板";
            if (userid == -1)
            {
                AddErrLine("你尚未登录");
                return;
            }

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

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

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

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

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

                    string errorinfo = "";
                    Space.Data.DbProvider.GetInstance().SaveSpaceConfigData(spaceconfiginfo);
                    if (errorinfo == "")
                    {
                        SetShowBackLink(true);
                        AddMsgLine("个人空间基本设置完毕");
                    }
                    else
                    {
                        AddErrLine(errorinfo);
                        return;
                    }
                }
            }
            else
            {
                spaceconfiginfo = BlogProvider.GetSpaceConfigInfo(userid);
            }
        }
Exemple #30
0
        private void SubmitInfo_Click(object sender, EventArgs e)
        {
            #region 提交同级版块

            if (this.CheckCookie())
            {
                if (DNTRequest.GetString("fid") != "")
                {
                    forumInfo              = Forums.GetForumInfo(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)
                        {
                            colcountnumber.Text = "";
                            base.RegisterStartupScript("", "<script>alert('列值必须在2~9范围内');</script>");
                            return;
                        }
                        forumInfo.Colcount = Convert.ToInt16(colcountnumber.Text);
                    }

                    if (rewritename.Text.Trim() != oldrewritename.Value && rewritename.Text.Trim() != "" && Discuz.Forum.Forums.CheckRewriteNameInvalid(rewritename.Text.Trim()))
                    {
                        rewritename.Text = "";
                        base.RegisterStartupScript("", "<script>alert('URL重写非法!');</script>");
                        return;
                    }

                    forumInfo.Templateid = (Convert.ToInt32(templateid.SelectedValue) == config.Templateid ? 0 : Convert.ToInt32(templateid.SelectedValue));
                    forumInfo.Allowhtml  = 0;
                    forumInfo.Allowblog  = 0;
                    forumInfo.Istrade    = 0;

                    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.Modnewtopics     = BoolToInt(setting.Items[6].Selected);
                    forumInfo.Jammer           = BoolToInt(setting.Items[7].Selected);
                    forumInfo.Disablewatermark = BoolToInt(setting.Items[8].Selected);
                    forumInfo.Inheritedmod     = BoolToInt(setting.Items[9].Selected);
                    forumInfo.Allowthumbnail   = BoolToInt(setting.Items[10].Selected);
                    forumInfo.Allowtag         = BoolToInt(setting.Items[11].Selected);
                    int temppostspecial = 0;
                    temppostspecial            = setting.Items[12].Selected ? temppostspecial | 1 : temppostspecial & ~1;
                    temppostspecial            = setting.Items[13].Selected ? temppostspecial | 16 : temppostspecial & ~16;
                    temppostspecial            = setting.Items[14].Selected ? temppostspecial | 4 : temppostspecial & ~4;
                    forumInfo.Allowpostspecial = temppostspecial;
                    forumInfo.Alloweditrules   = BoolToInt(setting.Items[15].Selected);
                    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;

                    //如果有上传的图片被提交上来,则执行文件保存操作,并返回保存后的文件路径,否则将icon.text控件中的值保存
                    forumInfo.Icon = HttpContext.Current.Request.Files.Count > 0 && !string.IsNullOrEmpty(HttpContext.Current.Request.Files[0].FileName)
                        ? AdminForums.UploadForumIcon(forumInfo.Fid) : 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.Trim();
                    forumInfo.Seokeywords    = seokeywords.Text.Trim();
                    forumInfo.Seodescription = seodescription.Text.Trim();
                    forumInfo.Rewritename    = rewritename.Text.Trim();
                    forumInfo.Topictypes     = topictypes.Text.Trim();
                    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.UpdateForumInfo(forumInfo).Replace("'", "’");
                    ForumOperator.RefreshForumCache();
                    AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "编辑论坛版块", "编辑论坛版块,名称为:" + name.Text.Trim());

                    GeneralConfigInfo configInfo = GeneralConfigs.GetConfig();
                    configInfo.Specifytemplate = Forums.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
        }