示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                #region  FID删除相应的版块

                if (DNTRequest.GetString("istrade") == "1")
                {
                    //如果是交易版块,则选清除绑定的商品
                    if (MallPluginProvider.GetInstance() != null)
                    {
                        MallPluginProvider.GetInstance().EmptyGoodsCategoryFid(DNTRequest.GetInt("fid", 0));
                        MallPluginProvider.GetInstance().StaticWriteJsonFile();
                        DNTCache.GetCacheService().RemoveObject("/Mall/MallSetting/GoodsCategories");
                    }
                }

                if (Forums.DeleteForum(DNTRequest.GetString("fid")))
                {
                    ForumOperator.RefreshForumCache();
                    AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "删除论坛版块", "删除论坛版块,fid为:" + DNTRequest.GetString("fid"));
                    base.RegisterStartupScript("", "<script>window.location.href='forum_ForumsTree.aspx';</script>");
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('对不起,当前节点下面还有子结点,因此不能删除!');window.location.href='forum_ForumsTree.aspx';</script>");
                }

                #endregion
            }
        }
示例#2
0
        private void SaveMoveInfo_Click(object sender, EventArgs e)
        {
            #region 保存版块移动设置

            if (sourceforumid.SelectedValue == targetforumid.SelectedValue)
            {
                base.RegisterStartupScript("", "<script>alert('您所要移动的版块与目标版块相同, 因此无法提交!');</script>");
                return;
            }

            bool aschild = movetype.SelectedValue == "1" ? true : false;
            if (!AdminForums.MovingForumsPos(sourceforumid.SelectedValue, targetforumid.SelectedValue, aschild))
            {
                base.RegisterStartupScript("", "<script>alert('当前源版块移动失败!');</script>");
                return;
            }
            ForumOperator.RefreshForumCache();
            AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "移动论坛版块", "移动论坛版块ID:" + sourceforumid.SelectedValue + "到ID:" + targetforumid.SelectedValue);
            base.RegisterStartupScript("PAGE", "window.location.href='forum_forumsTree.aspx';");

            #endregion
        }
        public void InsertForum(string parentid, string layer, string parentidlist, string subforumcount, string systemdisplayorder)
        {
            #region 添加新论坛
            forumInfo.Parentid         = Convert.ToInt32(parentid);
            forumInfo.Layer            = Convert.ToInt32(layer);
            forumInfo.Parentidlist     = parentidlist;
            forumInfo.Subforumcount    = Convert.ToInt32(subforumcount);
            forumInfo.Name             = name.Text.Trim();
            forumInfo.Status           = Convert.ToInt16(status.SelectedValue);
            forumInfo.Displayorder     = Convert.ToInt32(systemdisplayorder);
            forumInfo.Templateid       = Convert.ToInt32(templateid.SelectedValue);
            forumInfo.Allowsmilies     = BoolToInt(setting.Items[0].Selected);
            forumInfo.Allowrss         = BoolToInt(setting.Items[1].Selected);
            forumInfo.Allowhtml        = 0;
            forumInfo.Allowbbcode      = BoolToInt(setting.Items[2].Selected);
            forumInfo.Allowimgcode     = BoolToInt(setting.Items[3].Selected);
            forumInfo.Allowblog        = 0;
            forumInfo.Istrade          = 0;
            forumInfo.Alloweditrules   = 0;
            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);
            forumInfo.Istrade          = 0;
            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);
            forumInfo.Autoclose        = autocloseoption.SelectedValue == "0" ? 0 : Convert.ToInt32(autocloseday.Text);
            forumInfo.Description      = description.Text;
            forumInfo.Password         = password.Text;
            forumInfo.Icon             = icon.Text;
            forumInfo.Postcredits      = "";
            forumInfo.Replycredits     = "";
            forumInfo.Redirect         = redirect.Text;
            forumInfo.Attachextensions = attachextensions.GetSelectString(",");
            forumInfo.Moderators       = moderators.Text;
            forumInfo.Rules            = rules.Text;
            forumInfo.Seokeywords      = seokeywords.Text.Trim();
            forumInfo.Seodescription   = seodescription.Text.Trim();
            forumInfo.Rewritename      = rewritename.Text.Trim();
            forumInfo.Topictypes       = topictypes.Text;
            forumInfo.Colcount         = colcount.SelectedValue == "1" ? 1 : Convert.ToInt16(colcountnumber.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"];
            string result;
            int    fid = AdminForums.CreateForums(forumInfo, out result, userid, username, usergroupid, grouptitle, ip);

            //如果有上传版块图片的操作
            if (HttpContext.Current.Request.Files.Count > 0 && !string.IsNullOrEmpty(HttpContext.Current.Request.Files[0].FileName))
            {
                forumInfo      = Forums.GetForumInfo(fid);
                forumInfo.Icon = AdminForums.UploadForumIcon(forumInfo.Fid);
                AdminForums.UpdateForumInfo(forumInfo).Replace("'", "’");
                ForumOperator.RefreshForumCache();
                GeneralConfigInfo configInfo = GeneralConfigs.GetConfig();
                configInfo.Specifytemplate = Forums.GetSpecifyForumTemplateCount() > 0 ? 1 : 0;
                GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config"));
            }

            if (string.IsNullOrEmpty(result))
            {
                base.RegisterStartupScript("PAGE", "self.location.href='forum_ForumsTree.aspx';");
            }
            else
            {
                base.RegisterStartupScript("PAGE", "alert('用户:" + result + "不存在,因为无法设为版主');self.location.href='forum_ForumsTree.aspx';");
            }

            #endregion
        }
        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为0表示绑定到默认模板
                    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.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("'", "’");

                    if (childForumApplyTemplate.Checked)//批量设置子版块的模板信息
                    {
                        AdminForums.UpdateForumTemplateID(forumInfo);
                    }

                    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
        }
        private void SubmitBatchSet_Click(object sender, EventArgs e)
        {
            #region 写入批量论坛设置信息

            string targetlist = DNTRequest.GetString("Forumtree1");

            if ((targetlist == "") || (targetlist == ",") || (targetlist == "0"))
            {
                base.RegisterStartupScript("", "<script>alert('您未选中任何版块, 系统无法提交! ');</script>");
                return;
            }

            forumInfo                  = Forums.GetForumInfo(DNTRequest.GetInt("fid", -1));
            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.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);
            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.Alloweditrules   = BoolToInt(setting.Items[14].Selected);
            forumInfo.Password         = password.Text;
            forumInfo.Attachextensions = attachextensions.GetSelectString(",");
            forumInfo.Viewperm         = viewperm.GetSelectString(",");
            forumInfo.Postperm         = postperm.GetSelectString(",");
            forumInfo.Replyperm        = replyperm.GetSelectString(",");
            forumInfo.Getattachperm    = getattachperm.GetSelectString(",");
            forumInfo.Postattachperm   = postattachperm.GetSelectString(",");

            BatchSetParams bsp = new BatchSetParams();
            bsp.SetPassWord         = setpassword.Checked;
            bsp.SetAttachExtensions = setattachextensions.Checked;
            bsp.SetPostCredits      = setpostcredits.Checked;
            bsp.SetReplyCredits     = setreplycredits.Checked;
            bsp.SetSetting          = setsetting.Checked;
            bsp.SetViewperm         = setviewperm.Checked;
            bsp.SetPostperm         = setpostperm.Checked;
            bsp.SetReplyperm        = setreplyperm.Checked;
            bsp.SetGetattachperm    = setgetattachperm.Checked;
            bsp.SetPostattachperm   = setpostattachperm.Checked;

            if (AdminForums.BatchSetForumInf(forumInfo, bsp, targetlist))
            {
                ForumOperator.RefreshForumCache();
                AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "复制版块设置", "编辑论坛版块列表为:" + targetlist.Trim());
                base.RegisterStartupScript("PAGE", "window.location.href='forum_ForumsTree.aspx';");
            }
            else
            {
                base.RegisterStartupScript("", "<script>alert('提交不成功!');window.location.href='forum_ForumsTree.aspx';</script>");
            }

            #endregion
        }