コード例 #1
0
ファイル: delforums.cs プロジェクト: xiongeee/BBX
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                //var mpp = MallPluginProvider.GetInstance();
                //if (Request["istrade"] == "1" && mpp != null)
                //{
                //	mpp.EmptyGoodsCategoryFid(DNTRequest.GetInt("fid", 0));
                //	mpp.StaticWriteJsonFile();
                //	XCache.Remove("/Mall/MallSetting/GoodsCategories");
                //}
                //if (Forums.DeleteForum(Request["fid"]))
                var f = XForum.FindByID(Request["fid"].ToInt());
                if (f != null)
                {
                    f.Delete();

                    ForumOperator.RefreshForumCache();
                    AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "删除论坛版块", "删除论坛版块,fid为:" + Request["fid"]);
                    base.RegisterStartupScript("", "<script>window.location.href='forum_ForumsTree.aspx';</script>");
                    return;
                }
                base.RegisterStartupScript("", "<script>alert('对不起,当前节点下面还有子结点,因此不能删除!');window.location.href='forum_ForumsTree.aspx';</script>");
            }
        }
コード例 #2
0
        private void SubmitBatchSet_Click(object sender, EventArgs e)
        {
            string fidlist = Request["Forumtree1"];

            if (String.IsNullOrEmpty(fidlist) || fidlist == "," || fidlist == "0")
            {
                base.RegisterStartupScript("", "<script>alert('您未选中任何版块, 系统无法提交! ');</script>");
                return;
            }
            this.forumInfo = Forums.GetForumInfo(DNTRequest.GetInt("fid", -1));
            //this.forumInfo.AllowHtml = 0;
            //this.forumInfo.AllowBlog = 0;
            //this.forumInfo.IsTrade = 0;
            //this.forumInfo.AllowEditRules = 0;
            this.forumInfo.AllowSmilies     = this.setting.Items[0].Selected;
            this.forumInfo.AllowRss         = this.setting.Items[1].Selected;
            this.forumInfo.AllowBbCode      = this.setting.Items[2].Selected;
            this.forumInfo.AllowImgCode     = this.setting.Items[3].Selected;
            this.forumInfo.Recyclebin       = this.BoolToInt(this.setting.Items[4].Selected);
            this.forumInfo.Modnewposts      = this.BoolToInt(this.setting.Items[5].Selected);
            this.forumInfo.Jammer           = this.BoolToInt(this.setting.Items[6].Selected);
            this.forumInfo.DisableWatermark = this.setting.Items[7].Selected;
            this.forumInfo.Inheritedmod     = this.BoolToInt(this.setting.Items[8].Selected);
            this.forumInfo.AllowThumbnail   = this.setting.Items[9].Selected;
            this.forumInfo.AllowTag         = this.setting.Items[10].Selected;
            int num = 0;

            num = (this.setting.Items[11].Selected ? (num | 1) : (num & -2));
            num = (this.setting.Items[12].Selected ? (num | 16) : (num & -17));
            num = (this.setting.Items[13].Selected ? (num | 4) : (num & -5));
            this.forumInfo.AllowPostSpecial = num;
            this.forumInfo.AllowEditRules   = this.setting.Items[14].Selected;
            this.forumInfo.Password         = this.password.Text;
            this.forumInfo.Attachextensions = this.attachextensions.GetSelectString(",");
            this.forumInfo.ViewPerm         = this.viewperm.GetSelectString(",");
            this.forumInfo.PostPerm         = this.postperm.GetSelectString(",");
            this.forumInfo.ReplyPerm        = this.replyperm.GetSelectString(",");
            this.forumInfo.GetattachPerm    = this.getattachperm.GetSelectString(",");
            this.forumInfo.PostattachPerm   = this.postattachperm.GetSelectString(",");
            BatchSetParams bsp = default(BatchSetParams);

            bsp.SetPassWord         = this.setpassword.Checked;
            bsp.SetAttachExtensions = this.setattachextensions.Checked;
            bsp.SetPostCredits      = this.setpostcredits.Checked;
            bsp.SetReplyCredits     = this.setreplycredits.Checked;
            bsp.SetSetting          = this.setsetting.Checked;
            bsp.SetViewperm         = this.setviewperm.Checked;
            bsp.SetPostperm         = this.setpostperm.Checked;
            bsp.SetReplyperm        = this.setreplyperm.Checked;
            bsp.SetGetattachperm    = this.setgetattachperm.Checked;
            bsp.SetPostattachperm   = this.setpostattachperm.Checked;
            if (XForum.BatchSet(this.forumInfo, bsp, fidlist))
            {
                ForumOperator.RefreshForumCache();
                AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "复制版块设置", "编辑论坛版块列表为:" + fidlist.Trim());
                base.RegisterStartupScript("PAGE", "window.location.href='forum_ForumsTree.aspx';");
                return;
            }
            base.RegisterStartupScript("", "<script>alert('提交不成功!');window.location.href='forum_ForumsTree.aspx';</script>");
        }
コード例 #3
0
ファイル: forumsmove.cs プロジェクト: xiongeee/BBX
        private void SaveMoveInfo_Click(object sender, EventArgs e)
        {
            if (this.sourceforumid.SelectedValue == this.targetforumid.SelectedValue)
            {
                base.RegisterStartupScript("", "<script>alert('您所要移动的版块与目标版块相同, 因此无法提交!');</script>");
                return;
            }
            bool isaschildnode = this.movetype.SelectedValue == "1";

            if (!AdminForums.MovingForumsPos(this.sourceforumid.SelectedValue.ToInt(), this.targetforumid.SelectedValue.ToInt(), isaschildnode))
            {
                base.RegisterStartupScript("", "<script>alert('当前源版块移动失败!');</script>");
                return;
            }
            ForumOperator.RefreshForumCache();
            AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "移动论坛版块", "移动论坛版块ID:" + this.sourceforumid.SelectedValue + "到ID:" + this.targetforumid.SelectedValue);
            base.RegisterStartupScript("PAGE", "window.location.href='forum_forumsTree.aspx';");
        }
コード例 #4
0
        public void InsertForum(Int32 parentid, Int32 systemdisplayorder)
        {
            //需要初始化 forumInfo
            forumInfo = new XForum();
            this.forumInfo.ParentID = parentid;
            //this.forumInfo.Layer = layer.ToInt();
            //this.forumInfo.Parentidlist = parentidlist;
            //this.forumInfo.SubforumCount = subforumcount.ToInt();
            this.forumInfo.Name         = this.name.Text.Trim();
            this.forumInfo.Status       = this.status.SelectedValue.ToInt();
            this.forumInfo.DisplayOrder = systemdisplayorder;
            this.forumInfo.TemplateID   = this.templateid.SelectedValue.ToInt();
            this.forumInfo.AllowSmilies = this.setting.Items[0].Selected;
            this.forumInfo.AllowRss     = this.setting.Items[1].Selected;
            //this.forumInfo.AllowHtml = 0;
            this.forumInfo.AllowBbCode  = this.setting.Items[2].Selected;
            this.forumInfo.AllowImgCode = this.setting.Items[3].Selected;
            //this.forumInfo.AllowBlog = 0;
            //this.forumInfo.IsTrade = 0;
            //this.forumInfo.AllowEditRules = 0;
            this.forumInfo.Recyclebin       = this.BoolToInt(this.setting.Items[4].Selected);
            this.forumInfo.Modnewposts      = this.BoolToInt(this.setting.Items[5].Selected);
            this.forumInfo.Modnewtopics     = this.BoolToInt(this.setting.Items[6].Selected);
            this.forumInfo.Jammer           = this.BoolToInt(this.setting.Items[7].Selected);
            this.forumInfo.DisableWatermark = this.setting.Items[8].Selected;
            this.forumInfo.Inheritedmod     = this.BoolToInt(this.setting.Items[9].Selected);
            this.forumInfo.AllowThumbnail   = this.setting.Items[10].Selected;
            this.forumInfo.AllowTag         = this.setting.Items[11].Selected;
            //this.forumInfo.IsTrade = 0;
            int num = 0;

            num = (this.setting.Items[12].Selected ? (num | 1) : (num & -2));
            num = (this.setting.Items[13].Selected ? (num | 16) : (num & -17));
            num = (this.setting.Items[14].Selected ? (num | 4) : (num & -5));
            this.forumInfo.AllowPostSpecial = num;
            this.forumInfo.AllowEditRules   = this.setting.Items[15].Selected;
            this.forumInfo.AllowSpecialOnly = (int)Convert.ToInt16(this.allowspecialonly.SelectedValue) != 0;
            this.forumInfo.AutoClose        = ((this.autocloseoption.SelectedValue == "0") ? 0 : this.autocloseday.Text.ToInt());
            this.forumInfo.Description      = this.description.Text;
            this.forumInfo.Password         = this.password.Text;
            this.forumInfo.Icon             = this.icon.Text;
            //this.forumInfo.PostcrEdits = "";
            //this.forumInfo.ReplycrEdits = "";
            this.forumInfo.Redirect         = this.redirect.Text;
            this.forumInfo.Attachextensions = this.attachextensions.GetSelectString(",");
            this.forumInfo.Moderators       = this.moderators.Text;
            this.forumInfo.Rules            = this.rules.Text;
            this.forumInfo.Seokeywords      = this.seokeywords.Text.Trim();
            this.forumInfo.Seodescription   = this.seodescription.Text.Trim();
            this.forumInfo.RewriteName      = this.rewritename.Text.Trim();
            this.forumInfo.TopicTypes       = this.topictypes.Text;
            this.forumInfo.ColCount         = colcount.SelectedValue == "1" ? 1 : colcountnumber.Text.ToInt();
            this.forumInfo.ViewPerm         = base.Request.Form["viewperm"];
            this.forumInfo.PostPerm         = base.Request.Form["postperm"];
            this.forumInfo.ReplyPerm        = base.Request.Form["replyperm"];
            this.forumInfo.GetattachPerm    = base.Request.Form["getattachperm"];
            this.forumInfo.PostattachPerm   = base.Request.Form["postattachperm"];
            string text;
            int    fid = AdminForums.CreateForums(this.forumInfo, out text, this.userid, this.username, this.usergroupid, this.grouptitle, this.ip);

            if (HttpContext.Current.Request.Files.Count > 0 && !string.IsNullOrEmpty(HttpContext.Current.Request.Files[0].FileName))
            {
                this.forumInfo      = Forums.GetForumInfo(fid);
                this.forumInfo.Icon = AdminForums.UploadForumIcon(this.forumInfo.ID);
                AdminForums.UpdateForumInfo(this.forumInfo).Replace("'", "’");
                ForumOperator.RefreshForumCache();
                GeneralConfigInfo config = GeneralConfigInfo.Current;
                config.Specifytemplate = ((Forums.GetSpecifyForumTemplateCount() > 0) ? 1 : 0);
                config.Save();

                //config.Save();;
            }
            if (string.IsNullOrEmpty(text))
            {
                base.RegisterStartupScript("PAGE", "self.location.href='forum_ForumsTree.aspx';");
                return;
            }
            base.RegisterStartupScript("PAGE", "alert('用户:" + text + "不存在,因为无法设为版主');self.location.href='forum_ForumsTree.aspx';");
        }
コード例 #5
0
        private void SubmitInfo_Click(object sender, EventArgs e)
        {
            var fid = Request["fid"].ToInt();

            if (base.CheckCookie() && fid > 0)
            {
                //this.forumInfo = Forums.GetForumInfo(DNTRequest.GetInt("fid", 0));
                var f = XForum.FindByID(fid);
                this.forumInfo              = f as IXForum;
                this.forumInfo.Name         = this.name.Text.Trim();
                this.forumInfo.DisplayOrder = displayorder.Text.ToInt();
                this.forumInfo.Status       = status.SelectedValue.ToInt();
                if (this.colcount.SelectedValue == "1")
                {
                    this.forumInfo.ColCount = 1;
                }
                else
                {
                    var count = colcountnumber.Text.ToInt();
                    if (count < 1 || count > 9)
                    {
                        this.colcountnumber.Text = "";
                        base.RegisterStartupScript("", "<script>alert('列值必须在2~9范围内');</script>");
                        return;
                    }
                    this.forumInfo.ColCount = count;
                }
                if (this.rewritename.Text.Trim() != this.oldrewritename.Value && !this.rewritename.Text.IsNullOrEmpty() && XForum.CheckRewriteNameInvalid(this.rewritename.Text.Trim()))
                {
                    this.rewritename.Text = "";
                    base.RegisterStartupScript("", "<script>alert('URL重写非法!');</script>");
                    return;
                }
                this.forumInfo.TemplateID = ((this.templateid.SelectedValue.ToInt() == this.config.Templateid) ? 0 : this.templateid.SelectedValue.ToInt());
                //this.forumInfo.AllowHtml = 0;
                //this.forumInfo.AllowBlog = 0;
                //this.forumInfo.IsTrade = 0;
                //this.forumInfo.AllowEditRules = 0;
                this.forumInfo.AllowSmilies     = this.setting.Items[0].Selected;
                this.forumInfo.AllowRss         = this.setting.Items[1].Selected;
                this.forumInfo.AllowBbCode      = this.setting.Items[2].Selected;
                this.forumInfo.AllowImgCode     = this.setting.Items[3].Selected;
                this.forumInfo.Recyclebin       = this.BoolToInt(this.setting.Items[4].Selected);
                this.forumInfo.Modnewposts      = this.BoolToInt(this.setting.Items[5].Selected);
                this.forumInfo.Modnewtopics     = this.BoolToInt(this.setting.Items[6].Selected);
                this.forumInfo.Jammer           = this.BoolToInt(this.setting.Items[7].Selected);
                this.forumInfo.DisableWatermark = this.setting.Items[8].Selected;
                this.forumInfo.Inheritedmod     = this.BoolToInt(this.setting.Items[9].Selected);
                this.forumInfo.AllowThumbnail   = this.setting.Items[10].Selected;
                this.forumInfo.AllowTag         = this.setting.Items[11].Selected;
                int num = 0;
                num = (this.setting.Items[12].Selected ? (num | 1) : (num & -2));
                num = (this.setting.Items[13].Selected ? (num | 16) : (num & -17));
                num = (this.setting.Items[14].Selected ? (num | 4) : (num & -5));
                this.forumInfo.AllowPostSpecial = num;
                this.forumInfo.AllowEditRules   = this.setting.Items[15].Selected;
                this.forumInfo.AllowSpecialOnly = (int)Convert.ToInt16(this.allowspecialonly.SelectedValue) != 0;
                if (this.autocloseoption.SelectedValue == "0")
                {
                    this.forumInfo.AutoClose = 0;
                }
                else
                {
                    this.forumInfo.AutoClose = this.autocloseday.Text.ToInt();
                }
                this.forumInfo.Description      = this.description.Text;
                this.forumInfo.Password         = this.password.Text;
                this.forumInfo.Icon             = ((HttpContext.Current.Request.Files.Count > 0 && !string.IsNullOrEmpty(HttpContext.Current.Request.Files[0].FileName)) ? AdminForums.UploadForumIcon(this.forumInfo.ID) : this.icon.Text);
                this.forumInfo.Redirect         = this.redirect.Text;
                this.forumInfo.Attachextensions = this.attachextensions.GetSelectString(",");
                AdminForums.CompareOldAndNewModerator(this.forumInfo.Moderators, this.moderators.Text.Replace("\r\n", ","), DNTRequest.GetInt("fid", 0));
                this.forumInfo.Moderators      = this.moderators.Text.Replace("\r\n", ",");
                this.forumInfo.Rules           = this.rules.Text.Trim();
                this.forumInfo.Seokeywords     = this.seokeywords.Text.Trim();
                this.forumInfo.Seodescription  = this.seodescription.Text.Trim();
                this.forumInfo.RewriteName     = this.rewritename.Text.Trim();
                this.forumInfo.ViewPerm        = base.Request.Form["viewperm"];
                this.forumInfo.PostPerm        = base.Request.Form["postperm"];
                this.forumInfo.ReplyPerm       = base.Request.Form["replyperm"];
                this.forumInfo.GetattachPerm   = base.Request.Form["getattachperm"];
                this.forumInfo.PostattachPerm  = base.Request.Form["postattachperm"];
                this.forumInfo.ApplytopicType  = Convert.ToSByte(this.applytopictype.SelectedValue);
                this.forumInfo.PostbytopicType = Convert.ToSByte(this.postbytopictype.SelectedValue);
                this.forumInfo.ViewbytopicType = Convert.ToSByte(this.viewbytopictype.SelectedValue);
                this.forumInfo.Topictypeprefix = Convert.ToSByte(this.topictypeprefix.SelectedValue);
                this.forumInfo.TopicTypes      = this.GetTopicType();
                this.forumInfo.Permuserlist    = this.GetPermuserlist();
                //AggregationFacade.ForumAggregation.ClearDataBind();
                string text = AdminForums.UpdateForumInfo(this.forumInfo).Replace("'", "’");
                if (this.childForumApplyTemplate.Checked)
                {
                    // 子孙采用相同的模板
                    //AdminForums.UpdateForumTemplateID(this.forumInfo);
                    foreach (var item in f.AllChilds)
                    {
                        item.TemplateID = f.TemplateID;
                        item.Update();
                    }
                }
                ForumOperator.RefreshForumCache();
                AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "编辑论坛版块", "编辑论坛版块,名称为:" + this.name.Text.Trim());
                var config = GeneralConfigInfo.Current;
                config.Specifytemplate = ((Forums.GetSpecifyForumTemplateCount() > 0) ? 1 : 0);
                config.Save();

                //config.Save();;
                if (String.IsNullOrEmpty(text))
                {
                    //base.Response.Redirect("forum_ForumsTree.aspx");
                    base.RegisterStartupScript("PAGE", "self.location.href='forum_ForumsTree.aspx';");
                    return;
                }
                base.Response.Write("<script>alert('用户:" + text + "不存在或因为它们所属组为\"游客\",\"等待验证会员\",因为无法设为版主');window.location.href='forum_ForumsTree.aspx';</script>");
                base.Response.End();
            }
        }