Esempio n. 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.Allowpostspecial = 0; //需要作与运算如下
            //__foruminfo.Allowspecialonly = 0; //需要作与运算如下
            //$allow辩论 = allowpostspecial & 16;
            //$allow悬赏 = allowpostspecial & 4;
            //$allow投票 = allowpostspecial & 1;

            __foruminfo.Alloweditrules   = 0;
            __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          = 0;// 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.Postcredits      = "";
            __foruminfo.Replycredits     = "";
            __foruminfo.Redirect         = redirect.Text;
            __foruminfo.Attachextensions = attachextensions.GetSelectString(",");
            __foruminfo.Moderators       = moderators.Text;
            __foruminfo.Rules            = rules.Text;
            __foruminfo.Topictypes       = topictypes.Text;
            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.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.InsertForumsInf(__foruminfo).Replace("'", "’");

            AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "添加论坛版块", "添加论坛版块,名称为:" + name.Text.Trim());

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

            #endregion
        }