コード例 #1
0
        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
        }
コード例 #2
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';");
        }
コード例 #3
0
ファイル: addfirstforum.cs プロジェクト: xiongeee/BBX
        public void InsertForum(string parentid, string systemdisplayorder)
        {
            if (!this.rewritename.Text.IsNullOrEmpty() && XForum.CheckRewriteNameInvalid(this.rewritename.Text.Trim()))
            {
                this.rewritename.Text = "";
                base.RegisterStartupScript("", "<script>alert('URL重写非法!');</script>");
                return;
            }
            this.forumInfo.ParentID = parentid.ToInt();
            //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.ColCount     = 1;
            this.forumInfo.DisplayOrder = systemdisplayorder.ToInt();
            this.forumInfo.TemplateID   = 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;
            //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.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;

            AdminForums.CreateForums(this.forumInfo, out text, this.userid, this.username, this.usergroupid, this.grouptitle, this.ip);
            if (String.IsNullOrEmpty(text))
            {
                base.RegisterStartupScript("PAGE", "window.location.href='forum_ForumsTree.aspx';");
                return;
            }
            base.RegisterStartupScript("PAGE", "alert('用户:" + text + "不存在,因为无法设为版主');window.location.href='forum_ForumsTree.aspx';");
        }
コード例 #4
0
        /// <summary>
        /// 插入论坛版块
        /// </summary>
        /// <param name="parentid"></param>
        /// <param name="layer"></param>
        /// <param name="parentidlist"></param>
        /// <param name="subforumcount"></param>
        /// <param name="systemdisplayorder"></param>
        public void InsertForum(string parentid, string layer, string parentidlist, string subforumcount, string systemdisplayorder)
        {
            #region 插入论坛版块记录

            if (rewritename.Text.Trim() != "" && Discuz.Forum.Forums.CheckRewriteNameInvalid(rewritename.Text.Trim()))
            {
                rewritename.Text = "";
                base.RegisterStartupScript("", "<script>alert('URL重写非法!');</script>");
                return;
            }
            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.ToInt32(status.SelectedValue);
            forumInfo.Colcount      = 1;
            forumInfo.Displayorder  = Convert.ToInt32(systemdisplayorder);
            forumInfo.Templateid    = 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);
            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.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;
            AdminForums.CreateForums(forumInfo, out result, userid, username, usergroupid, grouptitle, ip);

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

            #endregion
        }