Example #1
0
     /// <summary>
     /// 发帖权限控制
     /// </summary>
     /// <param name="forum">版块信息</param>
     /// <param name="usergroupinfo">当前用户的用户组信息</param>
     /// <param name="userId">当前用户Id</param>
     /// <returns></returns>
     public static bool PostAuthority(ForumInfo forum, UserGroupInfo userGroupInfo, int userId, ref string msg)
     {
         if (!Forums.AllowPostByUserID(forum.Permuserlist, userId)) //判断当前用户在当前版块发主题权限
         {
             if (string.IsNullOrEmpty(forum.Postperm))//权限设置为空时,根据用户组权限判断
             {
                 // 验证用户是否有发表主题的权限
                 if (userGroupInfo.Allowpost != 1)
                 {
                     msg = "您当前的身份 \"" + userGroupInfo.Grouptitle + "\" 没有发表主题的权限";
                     return false;
                 }
 
             }
             else//权限设置不为空时,根据板块权限判断
             {
                 if (!Forums.AllowPost(forum.Postperm, userGroupInfo.Groupid))
                 {
                     msg = "您没有在该版块发表主题的权限";
                     return false;
                 }
             }
         }
         return true;
     }
Example #2
0
        protected override void ShowPage()
		{
            if (userid == -1)
            {
                AddErrLine("你尚未登录");
                return;
            }
			
			string referer = ForumUtils.GetCookie("referer");

			// 获取主题ID
			topicid = DNTRequest.GetInt("topicid", -1);
            albumid = DNTRequest.GetInt("albumid", -1);
            blogid = DNTRequest.GetInt("postid", -1);
            goodsid = DNTRequest.GetInt("goodsid", -1);
            
            if (topicid != -1)//收藏的是主题
            {
                // 获取该主题的信息
                TopicInfo topic = Topics.GetTopicInfo(topicid);
                // 如果该主题不存在
                if (topic == null)
                {
                    AddErrLine("不存在的主题ID");
                    return;
                }

                topictitle = topic.Title;
                forumid = topic.Fid;
                forum = Forums.GetForumInfo(forumid);
                forumname = forum.Name;
                pagetitle = Utils.RemoveHtml(forum.Name);
                forumnav = forum.Pathlist;

                // 检查用户是否拥有足够权限                
                if (config.Maxfavorites <= Favorites.GetFavoritesCount(userid))
                {
                    AddErrLine("您收藏的主题数目已经达到系统设置的数目上限");
                    return;
                }

                if (Favorites.CheckFavoritesIsIN(userid, topicid) != 0)
                {
                    AddErrLine("您过去已经收藏过这个主题,请返回");
                    return;
                }

                if (Favorites.CreateFavorites(userid, topicid) > 0)
                {
                    AddMsgLine("指定主题已成功添加到收藏夹中,现在将回到上一页");
                    SetUrl(referer);
                    SetMetaRefresh();
                    SetShowBackLink(false);
                }
            }
		}
Example #3
0
        public static ForumInfo[] GetForumSpecialUser(string username)
        {
            DataTable dt = new DataTable();
            if (username == "")
                dt = Data.Forums.GetForumTableBySpecialUser("");
            else
                dt = Data.Forums.GetForumTableBySpecialUser(username);

            ForumInfo[] foruminfo = null;

            if (dt.Rows.Count > 0)
            {
                foruminfo = new ForumInfo[dt.Rows.Count];

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    foruminfo[i] = new ForumInfo();

                    if (dt.Rows[i]["permuserlist"].ToString() != "")
                    {
                        if (username != "")
                        {
                            foreach (string s in dt.Rows[i]["permuserlist"].ToString().Split('|'))
                            {
                                if (username == s.Split(',')[0])
                                {
                                    foruminfo[i].Permuserlist = s;
                                }
                            }
                        }
                        else
                        {
                            if (dt.Rows[i]["permuserlist"].ToString().Split('|').Length == 1)
                            {
                                foruminfo[i].Permuserlist = dt.Rows[i]["permuserlist"].ToString();
                            }
                            else
                            {
                                for (int j = 0; j < dt.Rows[i]["permuserlist"].ToString().Split('|').Length; j++)
                                {
                                    foruminfo[i].Permuserlist += dt.Rows[i]["permuserlist"].ToString().Split('|')[j] + "|";
                                }
                                foruminfo[i].Permuserlist = foruminfo[i].Permuserlist.ToString().Substring(0, foruminfo[i].Permuserlist.ToString().Length - 1);
                            }
                        }

                        foruminfo[i].Fid = Utils.StrToInt(dt.Rows[i]["fid"].ToString(), 0);
                        foruminfo[i].Name = dt.Rows[i]["name"].ToString();
                        foruminfo[i].Moderators = dt.Rows[i]["moderators"].ToString();
                    }
                }
            }
            return foruminfo;
        }
Example #4
0
        /// <summary>
        /// 发帖权限控制
        /// </summary>
        /// <param name="forum">版块信息</param>
        /// <param name="usergroupinfo">当前用户的用户组信息</param>
        /// <param name="userId">当前用户Id</param>
        /// <returns></returns>
        public static bool PostAuthority(ForumInfo forum, UserGroupInfo userGroupInfo, int userId, ref string msg)
        {
            if (!Forums.AllowPostByUserID(forum.Permuserlist, userId)) //判断当前用户在当前版块发主题权限
            {
                if (string.IsNullOrEmpty(forum.Postperm))//权限设置为空时,根据用户组权限判断
                {
                    // 验证用户是否有发表主题的权限
                    if (userGroupInfo.Allowpost != 1)
                    {
                        msg = "您当前的身份 \"" + userGroupInfo.Grouptitle + "\" 没有发表主题的权限";
                        return false;
                    }

                }
                else//权限设置不为空时,根据板块权限判断
                {
                    if (!Forums.AllowPost(forum.Postperm, userGroupInfo.Groupid))
                    {
                        msg = "您没有在该版块发表主题的权限";
                        return false;
                    }
                }
            }
            //当用户拥有发帖权限但版块只允许发布特殊主题时,需要判断用户是否能发布特殊主题
            if (forum.Allowspecialonly > 0)
            {
                //当版块设置了只允许特殊主题,但又没有开启任何特殊主题类型,则相当于关闭了版块的发主题功能
                if (forum.Allowpostspecial <= 0)
                {
                    msg = "您没有在该版块发表特殊主题的权限";
                    return false;
                }

                if ((forum.Allowpostspecial & 1) == 1 && userGroupInfo.Allowpostpoll != 1)
                    msg = "您当前的身份 \"" + userGroupInfo.Grouptitle + "\" 没有发布投票的权限";
                else
                    return true;

                if ((forum.Allowpostspecial & 4) == 4 && userGroupInfo.Allowbonus != 1)
                    msg = "您当前的身份 \"" + userGroupInfo.Grouptitle + "\" 没有发布悬赏的权限";
                else
                    return true;

                if ((forum.Allowpostspecial & 16) == 16 && userGroupInfo.Allowdebate != 1)
                    msg = "您当前的身份 \"" + userGroupInfo.Grouptitle + "\" 没有发起辩论的权限";
                else
                    return true;

                return false;
            }
            return true;
        }
        public void LoadCurrentForumInfo(int fid)
        {
            #region 提取基本信息

            if (fid > 0)
            {
                forumInfo = Forums.GetForumInfo(fid);
            }
            else
            {
                return;
            }

            if (forumInfo.Allowsmilies == 1) setting.Items[0].Selected = true;
            if (forumInfo.Allowrss == 1) setting.Items[1].Selected = true;
            if (forumInfo.Allowbbcode == 1) setting.Items[2].Selected = true;
            if (forumInfo.Allowimgcode == 1) setting.Items[3].Selected = true;
            if (forumInfo.Recyclebin == 1) setting.Items[4].Selected = true;
            if (forumInfo.Modnewposts == 1) setting.Items[5].Selected = true;
            if (forumInfo.Modnewtopics == 1) setting.Items[6].Selected = true;
            if (forumInfo.Jammer == 1) setting.Items[7].Selected = true;
            if (forumInfo.Disablewatermark == 1) setting.Items[8].Selected = true;
            if (forumInfo.Inheritedmod == 1) setting.Items[9].Selected = true;
            if (forumInfo.Allowthumbnail == 1) setting.Items[10].Selected = true;
            if (forumInfo.Allowtag == 1) setting.Items[11].Selected = true;
            if ((forumInfo.Allowpostspecial & 1) != 0) setting.Items[12].Selected = true;
            if ((forumInfo.Allowpostspecial & 16) != 0) setting.Items[13].Selected = true;
            if ((forumInfo.Allowpostspecial & 4) != 0) setting.Items[14].Selected = true;
            if ((forumInfo.Alloweditrules == 1)) setting.Items[15].Selected = true;

            //DataTable dt = DatabaseProvider.GetInstance().GetUserGroupsTitle();
            viewperm.SetSelectByID(forumInfo.Viewperm.Trim());
            postperm.SetSelectByID(forumInfo.Postperm.Trim());
            replyperm.SetSelectByID(forumInfo.Replyperm.Trim());
            getattachperm.SetSelectByID(forumInfo.Getattachperm.Trim());
            postattachperm.SetSelectByID(forumInfo.Postattachperm.Trim());

            //dt = DatabaseProvider.GetInstance().GetAttachTypes();
                
            attachextensions.SetSelectByID(forumInfo.Attachextensions.Trim());

            #endregion
        }
Example #6
0
        public static ForumInfo[] GetForumSpecialUser(int fid)
        {
            //TODO:这个方法有问题,稍后研究
            DataTable dt = Data.Forums.GetForumTableWithSpecialUser(fid);

            ForumInfo[] foruminfo = null;

            if (dt.Rows.Count > 0)
            {
                foruminfo = new ForumInfo[dt.Rows.Count];

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    foruminfo[i] = new ForumInfo();

                    if (dt.Rows[i]["permuserlist"].ToString() != "")
                    {

                        if (dt.Rows[i]["permuserlist"].ToString().Split('|').Length == 1)
                        {
                            foruminfo[i].Permuserlist = dt.Rows[i]["permuserlist"].ToString();
                        }
                        else
                        {
                            for (int j = 0; j < dt.Rows[i]["permuserlist"].ToString().Split('|').Length; j++)
                            {

                                foruminfo[i].Permuserlist += dt.Rows[i]["permuserlist"].ToString().Split('|')[j] + "|";
                            }
                            foruminfo[i].Permuserlist = foruminfo[i].Permuserlist.ToString().Substring(0, foruminfo[i].Permuserlist.ToString().Length - 1);
                        }

                        foruminfo[i].Fid = Utils.StrToInt(dt.Rows[i]["fid"].ToString(), 0);
                        foruminfo[i].Name = dt.Rows[i]["name"].ToString();
                        foruminfo[i].Moderators = dt.Rows[i]["moderators"].ToString();
                    }
                }
            }
            return foruminfo;
        }
Example #7
0
 /// <summary>
 /// 访问权限控制
 /// </summary>
 /// <param name="forum">访问的版块信息</param>
 /// <param name="usergroupinfo">当前用户的用户组信息</param>
 /// <param name="userId">当前用户Id</param>
 /// <returns></returns>
 public static bool VisitAuthority(ForumInfo forum, UserGroupInfo userGroupInfo, int userId, ref string msg)
 {
     if (!Forums.AllowViewByUserId(forum.Permuserlist, userId)) //判断当前用户在当前版块浏览权限
     {
         if (string.IsNullOrEmpty(forum.Viewperm))//当板块权限为空时,按照用户组权限
         {
             if (userGroupInfo.Allowvisit != 1)
             {
                 msg = "您当前的身份 \"" + userGroupInfo.Grouptitle + "\" 没有浏览该版块的权限";
                 return false;
             }
         }
         else//当板块权限不为空,按照板块权限
         {
             if (!Forums.AllowView(forum.Viewperm, userGroupInfo.Groupid))
             {
                 msg = "您没有浏览该版块的权限";
                 return false;
             }
         }
     }
     return true;
 }
        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 = Forums.GetForumInfo(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
        }
        public void LoadCurrentForumInfo(int fid)
        {
            #region 加载相关信息

            if (fid <= 0)
                return;

            forumInfo = Forums.GetForumInfo(fid);

            if (forumInfo == null)
                return;

            if (forumInfo.Layer > 0)
            {
                tabPage2.Visible = true;
                tabPage6.Visible = true;
            }
            else//如果是分类
            {
                //删除掉"高级设置"属性页
                TabControl1.Items.Remove(tabPage2);
                tabPage2.Visible = false;

                //删除掉"权限设置"属性页
                //TabControl1.Items.Remove(tabPage3);
                //tabPage3.Visible = false;

                //删除掉"特殊用户"属性页
                //TabControl1.Items.Remove(tabPage4);
                //tabPage4.Visible = false;

                //删除掉"主题分类"属性页
                TabControl1.Items.Remove(tabPage5);
                tabPage5.Visible = false;

                //删除掉"统计信息"属性页
                TabControl1.Items.Remove(tabPage6);
                tabPage6.Visible = false;
                //templatestyle.Visible = false;
            }
            forumname.Text = forumInfo.Name.Trim();
            name.Text = forumInfo.Name.Trim();
            displayorder.Text = forumInfo.Displayorder.ToString();

            status.SelectedValue = forumInfo.Status.ToString();

            if (forumInfo.Colcount == 1)
            {
                showcolnum.Attributes.Add("style", "display:none");
                colcount.SelectedIndex = 0;
            }
            else
            {
                showcolnum.Attributes.Add("style", "display:block");
                colcount.SelectedIndex = 1;
            }
            colcount.Attributes.Add("onclick", "javascript:document.getElementById('" + showcolnum.ClientID + "').style.display= (document.getElementById('TabControl1_tabPage1_colcount_0').checked ? 'none' : 'block');");
            colcountnumber.Text = forumInfo.Colcount.ToString();
            //forumInfo.Templateid为0表示绑定到默认模板
            templateid.SelectedValue = (forumInfo.Templateid == 0 && config.Templateid ==1) ? "1" : forumInfo.Templateid.ToString();

            forumsstatic.Text = string.Format("主题总数:{0}<br />帖子总数:{1}<br />今日回帖数总数:{2}<br />最后提交日期:{3}",
                                              forumInfo.Topics.ToString(),
                                              forumInfo.Posts.ToString(),
                                              forumInfo.Todayposts.ToString(),
                                              forumInfo.Lastpost.ToString());

            ViewState["forumsstatic"] = forumsstatic.Text;

            if (forumInfo.Allowsmilies == 1) setting.Items[0].Selected = true;
            if (forumInfo.Allowrss == 1) setting.Items[1].Selected = true;
            if (forumInfo.Allowbbcode == 1) setting.Items[2].Selected = true;
            if (forumInfo.Allowimgcode == 1) setting.Items[3].Selected = true;
            if (forumInfo.Recyclebin == 1) setting.Items[4].Selected = true;
            if (forumInfo.Modnewposts == 1) setting.Items[5].Selected = true;
            if (forumInfo.Modnewtopics == 1) setting.Items[6].Selected = true;
            if (forumInfo.Jammer == 1) setting.Items[7].Selected = true;
            if (forumInfo.Disablewatermark == 1) setting.Items[8].Selected = true;
            if (forumInfo.Inheritedmod == 1) setting.Items[9].Selected = true;
            if (forumInfo.Allowthumbnail == 1) setting.Items[10].Selected = true;
            if (forumInfo.Allowtag == 1) setting.Items[11].Selected = true;
            //if (__foruminfo.Istrade == 1) setting.Items[11].Selected = true;
            if ((forumInfo.Allowpostspecial & 1) != 0) setting.Items[12].Selected = true;
            if ((forumInfo.Allowpostspecial & 16) != 0) setting.Items[13].Selected = true;
            if ((forumInfo.Allowpostspecial & 4) != 0) setting.Items[14].Selected = true;
            if ((forumInfo.Alloweditrules == 1)) setting.Items[15].Selected = true;
            allowspecialonly.SelectedValue = forumInfo.Allowspecialonly.ToString();

            if (forumInfo.Autoclose == 0)
            {
                showclose.Attributes.Add("style", "display:none");
                autocloseoption.SelectedIndex = 0;
            }
            else
            {
                autocloseoption.SelectedIndex = 1;
            }
            autocloseoption.Attributes.Add("onclick", "javascript:document.getElementById('" + showclose.ClientID + "').style.display= (document.getElementById('TabControl1_tabPage2_autocloseoption_0').checked ? 'none' : 'block');");
            autocloseday.Text = forumInfo.Autoclose.ToString();

            //提取高级信息
            description.Text = forumInfo.Description.Trim();
            password.Text = forumInfo.Password.Trim();
            icon.Text = forumInfo.Icon.Trim();
            redirect.Text = forumInfo.Redirect.Trim();
            moderators.Text = forumInfo.Moderators.Trim();

            inheritmoderators.Text = Users.GetModerators(fid);
            rules.Text = forumInfo.Rules.Trim();
            seokeywords.Text = forumInfo.Seokeywords == null ? "" : forumInfo.Seokeywords.Trim();
            seodescription.Text = forumInfo.Seodescription == null ? "" : forumInfo.Seodescription.Trim();
            rewritename.Text = forumInfo.Rewritename == null ? "" : forumInfo.Rewritename.Trim();
            oldrewritename.Value = rewritename.Text;
            topictypes.Text = forumInfo.Topictypes.Trim();
            DataTable dt = UserGroups.GetUserGroupForDataTable();
            int i = 1;
            foreach (DataRow dr in dt.Rows)
            {
                HtmlTableRow tr = new HtmlTableRow();
                HtmlTableCell td = new HtmlTableCell("td");
                //if (i % 2 == 1)
                //    td.Attributes.Add("class", "td_alternating_item1");
                //else
                //    td.Attributes.Add("class", "td_alternating_item2");
                td.Controls.Add(new LiteralControl("<input type='checkbox' id='r" + i + "' onclick='selectRow(" + i + ",this.checked)'>"));
                tr.Cells.Add(td);
                td = new HtmlTableCell("td");
                //if (i % 2 == 1)
                //    td.Attributes.Add("class", "td_alternating_item1");
                //else
                //    td.Attributes.Add("class", "td_alternating_item2");
                td.Controls.Add(new LiteralControl("<label for='r" + i + "'>" + dr["grouptitle"].ToString() + "</lable>"));
                tr.Cells.Add(td);
                tr.Cells.Add(GetTD("viewperm", forumInfo.Viewperm.Trim(), dr["groupid"].ToString(), i));

                if (forumInfo.Layer > 0)
                {
                    tr.Cells.Add(GetTD("postperm", forumInfo.Postperm.Trim(), dr["groupid"].ToString(), i));
                    tr.Cells.Add(GetTD("replyperm", forumInfo.Replyperm.Trim(), dr["groupid"].ToString(), i));
                    tr.Cells.Add(GetTD("getattachperm", forumInfo.Getattachperm.Trim(), dr["groupid"].ToString(), i));
                    tr.Cells.Add(GetTD("postattachperm", forumInfo.Postattachperm.Trim(), dr["groupid"].ToString(), i));
                }
                powerset.Rows.Add(tr);
                i++;
            }
            if (forumInfo.Layer == 0)
            {
                HtmlTableRow dr = powerset.Rows[0];
                dr.Cells[3].Visible = false;
                dr.Cells[4].Visible = false;
                dr.Cells[5].Visible = false;
                dr.Cells[6].Visible = false;
            }

            dt = Attachments.GetAttachmentType();
            attachextensions.SetSelectByID(forumInfo.Attachextensions.Trim());

            if (fid > 0)
            {
                forumInfo = Forums.GetForumInfo(fid);
            }
            else
            {
                return;
            }
            applytopictype.SelectedValue = forumInfo.Applytopictype.ToString();
            postbytopictype.SelectedValue = forumInfo.Postbytopictype.ToString();
            viewbytopictype.SelectedValue = forumInfo.Viewbytopictype.ToString();
            topictypeprefix.SelectedValue = forumInfo.Topictypeprefix.ToString();


            #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
        }
Example #11
0
        private string condition = ""; //查询条件
       

        protected override void ShowPage()
        {
            if (config.Enablemall == 0) //未启用交易模式
            {
                AddErrLine("系统未开启交易模式, 当前页面暂时无法访问!");
                return;
            }
            else
                goodscategoryfid = Discuz.Mall.GoodsCategories.GetGoodsCategoryWithFid();

            forumnav = "";
            forumallowrss = 0;
            if (categoryid <= 0)
            {
                AddErrLine("无效的商品分类ID");
                return;
            }

            if (config.Enablemall == 2) //开启高级模式
            {
                AddLinkRss("mallgoodslist.aspx?categoryid=" + categoryid, "商品列表");
                AddErrLine("当前页面在开启商城(高级)模式下无法访问, 系统将会重定向到商品列表页面!");
                return;
            }

            goodscategoryinfo = GoodsCategories.GetGoodsCategoryInfoById(categoryid);
            if (goodscategoryinfo != null && goodscategoryinfo.Categoryid > 0)
            {
                forumid = GoodsCategories.GetCategoriesFid(goodscategoryinfo.Categoryid);
            }
            else 
            {
                AddErrLine("无效的商品分类ID");
                return;
            }

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

            disablepostctrl = 0;
            if (userid > 0 && useradminid > 0)
                admingroupinfo = AdminGroups.GetAdminGroupInfo(usergroupid);

            if (admingroupinfo != null)
                this.disablepostctrl = admingroupinfo.Disablepostctrl;

            if (forumid == -1)
            {
                AddLinkRss("tools/rss.aspx", "最新商品");
                AddErrLine("无效的商品分类ID");
                return;
            }
            else
            {
                forum = Forums.GetForumInfo(forumid);
                // 检查是否具有版主的身份
                if (useradminid > 0)
                    ismoder = Moderators.IsModer(useradminid, userid, forumid);

                #region 对搜索条件进行检索

                string orderStr = "goodsid";

                if (DNTRequest.GetString("search").Trim() != "") //进行指定查询
                {
                    //所在城市信息
                    cond = DNTRequest.GetInt("locus_2", -1);                    
                    if (cond < 1)
                        condition = "";
                    else
                    {
                        locus = Locations.GetLocusByLID(cond);
                        condition = "AND [lid] = " + cond;
                    }

                    //排序的字段
                    order = DNTRequest.GetInt("order", -1);
                    switch (order)
                    {
                        case 2:
                            orderStr = "expiration"; //到期日
                            break;
                        case 1:
                            orderStr = "price"; //商品价格
                            break;
                        default:
                            orderStr = "goodsid";
                            break;
                    }

                    if (DNTRequest.GetInt("direct", -1) == 0)
                        direct = 0;
                }

                #endregion

                if (forum == null)
                {
                    if (config.Rssstatus == 1)
                        AddLinkRss("tools/rss.aspx", Utils.EncodeHtml(config.Forumtitle) + " 最新商品");

                    AddErrLine("不存在的商品分类ID");
                    return;
                }


                //当版块有外部链接时,则直接跳转
                if (forum.Redirect != null && forum.Redirect != string.Empty)
                {
                    System.Web.HttpContext.Current.Response.Redirect(forum.Redirect);
                    return;
                }

                if (forum.Istrade <= 0)
                {
                    AddErrLine("当前版块不允许商品交易");
                    forumnav = "";
                    return;
                }

                if (forum.Fid < 1)
                {
                    if (config.Rssstatus == 1 && forum.Allowrss == 1)
                        AddLinkRss("tools/" + base.RssAspxRewrite(forum.Fid), Utils.EncodeHtml(forum.Name) + " 最新商品");

                    AddErrLine("不存在的商品分类ID");
                    return;
                }
                if (config.Rssstatus == 1)
                    AddLinkRss("tools/" + base.RssAspxRewrite(forum.Fid), Utils.EncodeHtml(forum.Name) + " 最新商品");

                forumname = forum.Name;
                pagetitle = Utils.RemoveHtml(forum.Name);
                subforumcount = forum.Subforumcount;
                forumnav = ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname);
                navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname);

                //更新页面Meta中的Description项, 提高SEO友好性
                UpdateMetaInfo(config.Seokeywords, forum.Description, config.Seohead);

                // 是否显示版块密码提示 1为显示, 0不显示
                showforumlogin = 1;
                // 如果版块未设密码
                if (forum.Password == "")
                    showforumlogin = 0;
                else
                {
                    // 如果检测到相应的cookie正确
                    if (Utils.MD5(forum.Password) == ForumUtils.GetCookie("forum" + forumid.ToString() + "password"))
                        showforumlogin = 0;
                    else
                    {
                        // 如果用户提交的密码正确则保存cookie
                        if (forum.Password == DNTRequest.GetString("forumpassword"))
                        {
                            ForumUtils.WriteCookie("forum" + forumid.ToString() + "password", Utils.MD5(forum.Password));
                            showforumlogin = 0;
                        }
                    }
                }

                if (!Forums.AllowViewByUserId(forum.Permuserlist, userid)) //判断当前用户在当前版块浏览权限
                {
                    if (forum.Viewperm == null || forum.Viewperm == string.Empty) //当板块权限为空时,按照用户组权限
                    {
                        if (useradminid != 1 && (usergroupinfo.Allowvisit != 1 || usergroupinfo.Allowtrade != 1))
                        {
                            AddErrLine("您当前的身份 \"" + usergroupinfo.Grouptitle + "\" 没有浏览该商品分类的权限");
                            if (userid == -1)
                            {
                                needlogin = true;
                            }
                            return;
                        }
                    }
                    else //当板块权限不为空,按照板块权限
                    {
                        if (!Forums.AllowView(forum.Viewperm, usergroupid))
                        {
                            AddErrLine("您没有浏览该商品分类的权限");
                            if (userid == -1)
                            {
                                needlogin = true;
                            }
                            return;
                        }
                    }
                }


                ////判断是否有发主题的权限
                if (userid > -1 && Forums.AllowPostByUserID(forum.Permuserlist, userid))
                    canposttopic = true;

                if (forum.Postperm == null || forum.Postperm == string.Empty) //权限设置为空时,根据用户组权限判断
                {
                    // 验证用户是否有发表交易的权限
                    if (usergroupinfo.Allowtrade == 1)
                    {
                        canposttopic = true;
                    }
                }
                else if (Forums.AllowPost(forum.Postperm, usergroupid))
                {
                    canposttopic = true;
                }

                // 如果当前用户非管理员并且论坛设定了禁止发帖时间段,当前时间如果在其中的一个时间段内,不允许用户发帖
                if (useradminid != 1 && usergroupinfo.Disableperiodctrl != 1)
                {
                    string visittime = "";
                    if (Scoresets.BetweenTime(config.Postbanperiods, out visittime))
                        canposttopic = false;
                }

                if (newpmcount > 0)
                {
                    pmlist = PrivateMessages.GetPrivateMessageListForIndex(userid, 5, 1, 1);
                    showpmhint = Convert.ToInt32(Users.GetShortUserInfo(userid).Newsletter) > 4;
                }

                //得到子分类JSON格式
                subcategoriesjson = GoodsCategories.GetSubCategoriesJson(categoryid);
                //得到当前用户请求的页数
                pageid = DNTRequest.GetInt("page", 1);
                //获取主题总数
                goodscount = Goods.GetGoodsCount(categoryid, condition);

                // 得到gpp设置
                if (gpp <= 0)
                    gpp = config.Gpp;

                if (gpp <= 0)
                    gpp = 16;
           
                //修正请求页数中可能的错误
                if (pageid < 1)
                    pageid = 1;

                if (forum.Layer > 0)
                {
                    //获取总页数
                    pagecount = goodscount % gpp == 0 ? goodscount / gpp : goodscount / gpp + 1;
                    if (pagecount == 0)
                        pagecount = 1;

                    if (pageid > pagecount)
                        pageid = pagecount;

                    goodslist = Goods.GetGoodsInfoList(categoryid, gpp, pageid, condition, orderStr, direct);

                    ForumUtils.WriteCookie("referer", string.Format("showgoodslist.aspx?categoryid={0}&page={1}&order={2}&direct={3}&locus2={4}&search={5}", categoryid.ToString(), pageid.ToString(), orderStr, direct, cond, DNTRequest.GetString("search")));

                    //得到页码链接
                    if (DNTRequest.GetString("search") == "")
                    {
                        if (categoryid == 0)
                        {
                            if (config.Aspxrewrite == 1)
                            {
                                pagenumbers = Utils.GetStaticPageNumbers(pageid, pagecount, "showgoodslist-" + categoryid.ToString(), config.Extname, 8);
                            }
                            else
                            {
                                pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "showgoodslist.aspx?categoryid=" + categoryid.ToString(), 8);
                            }

                        }
                        else //当有类型条件时
                        {
                            pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "showgoodslist.aspx?categoryid=" + categoryid, 8);
                        }
                    }
                    else
                    {
                        pagenumbers = Utils.GetPageNumbers(pageid, pagecount,
                                         "showgoodslist.aspx?search=" + DNTRequest.GetString("search") + "&order=" + 2 + "&direct=" + direct + "&categoryid=" + categoryid + "&locus_2=" + cond , 8);
                    }
                }
            }


            forumlistboxoptions = Caches.GetForumListBoxOptionsCache();

            OnlineUsers.UpdateAction(olid, UserAction.ShowForum.ActionID, forumid, forumname, -1, "");


            showforumonline = false;
            onlineiconlist = Caches.GetOnlineGroupIconList();
            if (forumtotalonline < config.Maxonlinelist || DNTRequest.GetString("showonline") == "yes")
            {
                showforumonline = true;
                onlineuserlist = OnlineUsers.GetForumOnlineUserCollection(forumid, out forumtotalonline, out forumtotalonlineguest,
                                                             out forumtotalonlineuser, out forumtotalonlineinvisibleuser);
            }

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

            ForumUtils.UpdateVisitedForumsOptions(forumid);
            visitedforumsoptions = ForumUtils.GetVisitedForumsOptions(config.Visitedforums);
            //因为目前还未提供RSS功能,所以下面两项为0
            forumallowrss = 0; 
        }
Example #12
0
        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 = AdminForums.GetForumInfomation(DNTRequest.GetInt("fid", -1));
            __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.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.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))
            {
                base.RegisterStartupScript( "PAGE", "window.location.href='forum_ForumsTree.aspx';");
            }
            else
            {
                base.RegisterStartupScript( "", "<script>alert('提交不成功!');window.location.href='forum_ForumsTree.aspx';</script>");
            }

            #endregion
        }
Example #13
0
 /// <summary>
 /// 检查用户下载附件的权限
 /// </summary>
 /// <param name="forum">版块信息</param>
 /// <param name="userGroupInfo">当前用户的用户组信息</param>
 /// <param name="userId">当前用户Id</param>
 /// <param name="msg">提示信息</param>
 /// <returns></returns>
 public static bool CheckUsertAttachAuthority(ForumInfo forum, UserGroupInfo userGroupInfo, int userId, ref string msg)
 {
     if (!Forums.AllowGetAttachByUserID(forum.Permuserlist, userId))
     {
         if (Utils.StrIsNullOrEmpty(forum.Getattachperm) && userGroupInfo.Allowgetattach != 1)// 验证用户是否有下载附件的权限
         {
             msg = string.Format("您当前的身份 \"{0}\" 没有下载或查看附件的权限", userGroupInfo.Grouptitle);
         }
         else
         {
             if (!Forums.AllowGetAttach(forum.Getattachperm, userGroupInfo.Groupid))
             {
                 msg = "您没有在该版块下载附件的权限";
                 return false;
             }
         }
     }
     return true;
 }
Example #14
0
        public void SaveForumsInfo(ForumInfo forumInfo)
        {
            SqlConnection conn = new SqlConnection(DbHelper.ConnectionString);
            conn.Open();
            using (SqlTransaction trans = conn.BeginTransaction())
            {
                try
                {
                    DbParameter[] parms = {
                        DbHelper.MakeInParam("@parentid", (DbType)SqlDbType.SmallInt, 2, forumInfo.Parentid),
				        DbHelper.MakeInParam("@layer", (DbType)SqlDbType.Int, 4, forumInfo.Layer),
				        DbHelper.MakeInParam("@pathlist", (DbType)SqlDbType.NChar, 3000, Utils.StrIsNullOrEmpty(forumInfo.Pathlist) ? " " : forumInfo.Pathlist),
				        DbHelper.MakeInParam("@parentidlist", (DbType)SqlDbType.NChar, 300, Utils.StrIsNullOrEmpty(forumInfo.Parentidlist) ? " " : forumInfo.Parentidlist),
				        DbHelper.MakeInParam("@subforumcount", (DbType)SqlDbType.Int, 4, forumInfo.Subforumcount),
						DbHelper.MakeInParam("@name", (DbType)SqlDbType.NChar, 50, forumInfo.Name),
						DbHelper.MakeInParam("@status", (DbType)SqlDbType.Int, 4, forumInfo.Status),
						DbHelper.MakeInParam("@colcount", (DbType)SqlDbType.SmallInt, 4, forumInfo.Colcount),
						DbHelper.MakeInParam("@displayorder", (DbType)SqlDbType.Int, 4, forumInfo.Displayorder),
						DbHelper.MakeInParam("@templateid", (DbType)SqlDbType.SmallInt, 2, forumInfo.Templateid),
						DbHelper.MakeInParam("@topics", (DbType)SqlDbType.Int, 4, forumInfo.Topics),
                        DbHelper.MakeInParam("@curtopics", (DbType)SqlDbType.Int, 4, forumInfo.CurrentTopics),
                        DbHelper.MakeInParam("@posts", (DbType)SqlDbType.Int, 4, forumInfo.Posts),
                        DbHelper.MakeInParam("@todayposts", (DbType)SqlDbType.Int, 4, forumInfo.Todayposts),
                        DbHelper.MakeInParam("@lasttid", (DbType)SqlDbType.Int, 4, forumInfo.Lasttid),
                        DbHelper.MakeInParam("@lasttitle", (DbType)SqlDbType.NChar, 60, forumInfo.Lasttitle),
                        DbHelper.MakeInParam("@lastpost", (DbType)SqlDbType.DateTime, 8, forumInfo.Lastpost),
                        DbHelper.MakeInParam("@lastposterid", (DbType)SqlDbType.Int, 4, forumInfo.Lastposterid),
                        DbHelper.MakeInParam("@lastposter", (DbType)SqlDbType.NChar, 20, forumInfo.Lastposter),
                        DbHelper.MakeInParam("@allowsmilies", (DbType)SqlDbType.Int, 4, forumInfo.Allowsmilies),
						DbHelper.MakeInParam("@allowrss", (DbType)SqlDbType.Int, 4, forumInfo.Allowrss),
						DbHelper.MakeInParam("@allowhtml", (DbType)SqlDbType.Int, 4, forumInfo.Allowhtml),
						DbHelper.MakeInParam("@allowbbcode", (DbType)SqlDbType.Int, 4, forumInfo.Allowbbcode),
						DbHelper.MakeInParam("@allowimgcode", (DbType)SqlDbType.Int, 4, forumInfo.Allowimgcode),
						DbHelper.MakeInParam("@allowblog", (DbType)SqlDbType.Int, 4, forumInfo.Allowblog),
                        DbHelper.MakeInParam("@istrade", (DbType)SqlDbType.Int, 4, forumInfo.Istrade),
                        DbHelper.MakeInParam("@allowpostspecial",(DbType)SqlDbType.Int,4,forumInfo.Allowpostspecial),
                        DbHelper.MakeInParam("@allowspecialonly",(DbType)SqlDbType.Int,4,forumInfo.Allowspecialonly),
						DbHelper.MakeInParam("@alloweditrules", (DbType)SqlDbType.Int, 4, forumInfo.Alloweditrules),
						DbHelper.MakeInParam("@allowthumbnail", (DbType)SqlDbType.Int, 4, forumInfo.Allowthumbnail),
                        DbHelper.MakeInParam("@allowtag",(DbType)SqlDbType.Int,4,forumInfo.Allowtag),
						DbHelper.MakeInParam("@recyclebin", (DbType)SqlDbType.Int, 4, forumInfo.Recyclebin),
						DbHelper.MakeInParam("@modnewposts", (DbType)SqlDbType.Int, 4, forumInfo.Modnewposts),
						DbHelper.MakeInParam("@jammer", (DbType)SqlDbType.Int, 4, forumInfo.Jammer),
						DbHelper.MakeInParam("@disablewatermark", (DbType)SqlDbType.Int, 4, forumInfo.Disablewatermark),
						DbHelper.MakeInParam("@inheritedmod", (DbType)SqlDbType.Int, 4, forumInfo.Inheritedmod),
						DbHelper.MakeInParam("@autoclose", (DbType)SqlDbType.SmallInt, 2, forumInfo.Autoclose),
						DbHelper.MakeInParam("@fid", (DbType)SqlDbType.Int, 4, forumInfo.Fid),
						DbHelper.MakeInParam("@password", (DbType)SqlDbType.NVarChar, 16, forumInfo.Password),
						DbHelper.MakeInParam("@icon", (DbType)SqlDbType.VarChar, 255, forumInfo.Icon),
                        DbHelper.MakeInParam("@postcredits", (DbType)SqlDbType.VarChar, 255, forumInfo.Postcredits),
                        DbHelper.MakeInParam("@replycredits", (DbType)SqlDbType.VarChar, 255, forumInfo.Replycredits),
						DbHelper.MakeInParam("@redirect", (DbType)SqlDbType.VarChar, 255, forumInfo.Redirect),
						DbHelper.MakeInParam("@attachextensions", (DbType)SqlDbType.VarChar, 255, forumInfo.Attachextensions),
						DbHelper.MakeInParam("@rules", (DbType)SqlDbType.NText, 0, forumInfo.Rules),
						DbHelper.MakeInParam("@topictypes", (DbType)SqlDbType.Text, 0, forumInfo.Topictypes),
						DbHelper.MakeInParam("@viewperm", (DbType)SqlDbType.Text, 0, forumInfo.Viewperm),
						DbHelper.MakeInParam("@postperm", (DbType)SqlDbType.Text, 0, forumInfo.Postperm),
						DbHelper.MakeInParam("@replyperm", (DbType)SqlDbType.Text, 0, forumInfo.Replyperm),
						DbHelper.MakeInParam("@getattachperm", (DbType)SqlDbType.Text, 0, forumInfo.Getattachperm),
						DbHelper.MakeInParam("@postattachperm", (DbType)SqlDbType.Text, 0, forumInfo.Postattachperm),
                        DbHelper.MakeInParam("@moderators", (DbType)SqlDbType.Text, 0, forumInfo.Moderators),
						DbHelper.MakeInParam("@description", (DbType)SqlDbType.NText, 0, forumInfo.Description),
                        DbHelper.MakeInParam("@applytopictype", (DbType)SqlDbType.TinyInt, 1, forumInfo.Applytopictype),
						DbHelper.MakeInParam("@postbytopictype", (DbType)SqlDbType.TinyInt, 1, forumInfo.Postbytopictype),
						DbHelper.MakeInParam("@viewbytopictype", (DbType)SqlDbType.TinyInt, 1, forumInfo.Viewbytopictype),
						DbHelper.MakeInParam("@topictypeprefix", (DbType)SqlDbType.TinyInt, 1, forumInfo.Topictypeprefix),
                        DbHelper.MakeInParam("@permuserlist", (DbType)SqlDbType.NText, 0, forumInfo.Permuserlist),
						DbHelper.MakeInParam("@seokeywords", (DbType)SqlDbType.NVarChar, 500, forumInfo.Seokeywords),
                        DbHelper.MakeInParam("@seodescription", (DbType)SqlDbType.NVarChar, 500, forumInfo.Seodescription),
                        DbHelper.MakeInParam("@rewritename", (DbType)SqlDbType.NVarChar, 20, forumInfo.Rewritename)
					};
                    DbHelper.ExecuteNonQuery(trans, CommandType.StoredProcedure, string.Format("{0}updateforumsinfo", BaseConfigs.GetTablePrefix), parms);

                    trans.Commit();
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    throw ex;
                }
            }
            conn.Close();
        }
Example #15
0
 public static bool DownloadAttachment(ForumInfo forum, int userid, UserGroupInfo usergroupinfo)
 {
     bool allowdownloadattach = false;
     //当前用户是否有允许下载附件权限
     if (Forums.AllowGetAttachByUserID(forum.Permuserlist, userid))
     {
         allowdownloadattach = true;
     }
     else
     {
         if (Utils.StrIsNullOrEmpty(forum.Getattachperm)) //权限设置为空时,根据用户组权限判断
         {
             // 验证用户是否有有允许下载附件权限
             if (usergroupinfo.Allowgetattach == 1)
                 allowdownloadattach = true;
         }
         else if (Forums.AllowGetAttach(forum.Getattachperm, usergroupinfo.Groupid))
             allowdownloadattach = true;
     }
     return allowdownloadattach;
 }
Example #16
0
 public static bool PostReply(ForumInfo forum, int userid, UserGroupInfo usergroupinfo, TopicInfo topic)
 {
     bool canreply = (usergroupinfo.Radminid == 1);
     //是否有回复的权限
     if (topic.Closed == 0)
     {
         if (userid > -1 && Forums.AllowReplyByUserID(forum.Permuserlist, userid))
         {
             canreply = true;
         }
         else
         {
             if (Utils.StrIsNullOrEmpty(forum.Replyperm)) //权限设置为空时,根据用户组权限判断
             {
                 // 验证用户是否有发表主题的权限
                 if (usergroupinfo.Allowreply == 1)
                     canreply = true;
             }
             else if (Forums.AllowReply(forum.Replyperm, usergroupinfo.Groupid))
                 canreply = true;
         }
     }
     return canreply;
 }
Example #17
0
 /// <summary>
 /// 发主题是否需要审核
 /// </summary>
 /// <param name="forum">主题所在的版块</param>
 /// <param name="useradminid">用户的管理组ID</param>
 /// <param name="userid">用户ID</param>
 /// <param name="userGroup">当前用户的用户组</param>
 /// <returns>true需要审核;false不需要审核</returns>
 public static bool NeedAudit(ForumInfo forum, int useradminid, int userid, UserGroupInfo userGroup)
 {
     if (useradminid == 1 || Moderators.IsModer(useradminid, userid, forum.Fid))
         return false;
     if (Scoresets.BetweenTime(GeneralConfigs.GetConfig().Postmodperiods) || forum.Modnewtopics == 1 || userGroup.ModNewTopics == 1)
         return true;
     return false;
 }
Example #18
0
        /// <summary>
        /// 发回复是否需要审核
        /// </summary>
        /// <param name="forum">主题所在的版块</param>
        /// <param name="useradminid">用户的管理组ID</param>
        ///<param name="topicInfo">所回复的主题信息</param>
        /// <param name="userid">用户ID</param>
        /// <param name="disablepost">是否受灌水限制</param>
        /// <returns>true需要审核;false不需要审核</returns>
        public static bool NeedAudit(ForumInfo forum, int useradminid, TopicInfo topicInfo, int userid, int disablepost, UserGroupInfo userGroup)
        {
            if (useradminid == 1 || Moderators.IsModer(useradminid, userid, forum.Fid))
                return false;
            if (Scoresets.BetweenTime(GeneralConfigs.GetConfig().Postmodperiods))
                return true;
            if (forum.Modnewposts == 1 || userGroup.ModNewPosts == 1)
                return true;
            else if (topicInfo.Displayorder == -2)
                return true;
            return false;

            //bool needaudit = false; //是否需要审核
            //if (Scoresets.BetweenTime(GeneralConfigs.GetConfig().Postmodperiods))
            //{
            //    needaudit = true;
            //}
            //else
            //{
            //    if (forum.Modnewposts == 1 && useradminid != 1)
            //    {
            //        if (useradminid > 1)
            //        {
            //            if (disablepost == 1 && topicInfo.Displayorder != -2)
            //            {
            //                if (useradminid == 3 && !Moderators.IsModer(useradminid, userid, forum.Fid))
            //                    needaudit = true;
            //            }
            //            else
            //                needaudit = true;
            //        }
            //        else
            //            needaudit = true;
            //    }
            //    else if (userGroup.ModNewPosts == 1 && !Moderators.IsModer(useradminid, userid, forum.Fid) && useradminid != 1)
            //        needaudit = true;
            //    else if (useradminid != 1 && topicInfo.Displayorder == -2)
            //        needaudit = true;
            //}
            //return needaudit;
        }
Example #19
0
        /// <summary>
        /// 获取主题帖是否可见信息
        /// </summary>
        /// <param name="forum">版块信息</param>
        /// <param name="useradminid">当前用户adminid</param>
        /// <param name="uid">当前用户id</param>
        /// <param name="userGroup">当前用户组信息</param>
        /// <param name="postinfo">帖子信息</param>
        /// <returns>0显示;1隐藏</returns>
        public static int GetTopicPostInvisible(ForumInfo forum, int useradminid, int uid, UserGroupInfo userGroup, PostInfo postinfo)
        {
            if (useradminid == 1 || Moderators.IsModer(useradminid, uid, forum.Fid))
                return 0;

            if (!ForumUtils.HasAuditWord(postinfo.Message) && forum.Modnewtopics == 0 && userGroup.ModNewTopics == 0 && !Scoresets.BetweenTime(GeneralConfigs.GetConfig().Postmodperiods))
                return 0;

            return 1;
        }
Example #20
0
 /// <summary>
 /// 是否允许发特殊主题
 /// </summary>
 /// <param name="forum">版块信息</param>
 /// <param name="type">特殊主题类型</param>
 /// <returns></returns>
 public static bool PostSpecialAuthority(ForumInfo forum, string type, ref string msg)
 {
     string[] special = { "" };
     if (forum.Allowpostspecial > 0)
     {
         if (type == "poll" && (forum.Allowpostspecial & 1) != 1)
         {
             msg = string.Format("当前版块 \"{0}\" 不允许发表投票", forum.Name);
             return false;
         }
         if (type == "bonus" && (forum.Allowpostspecial & 4) != 4)
         {
             msg = string.Format("当前版块 \"{0}\" 不允许发表悬赏", forum.Name);
             return false;
         }
         if (type == "debate" && (forum.Allowpostspecial & 16) != 16)
         {
             msg = string.Format("当前版块 \"{0}\" 不允许发表辩论", forum.Name);
             return false;
         }
     }
     return true;
 }
Example #21
0
 public int GetLastPostTid(ForumInfo forumInfo, string visibleForums)
 {
     DbParameter[] parms = {
                                 DbHelper.MakeInParam("@fid", (DbType)SqlDbType.Int, 4, forumInfo.Fid),
                                 DbHelper.MakeInParam("@visibleforums", (DbType)SqlDbType.VarChar, 4000, visibleForums)
                           };
     return TypeConverter.ObjectToInt(DbHelper.ExecuteScalar(CommandType.StoredProcedure, string.Format("{0}getlastposttid", BaseConfigs.GetTablePrefix), parms), -1);
 }
Example #22
0
        protected override void ShowPage()
        {
            if (oluserinfo.Groupid == 4)
            {
                AddErrLine("你所在的用户组,为禁止发言"); return;
            }

            #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);
                if (userinfo != null)
                {
                    usergroupinfo = UserGroups.GetUserGroupInfo(userinfo.Groupid);
                    usergroupid = usergroupinfo.Groupid;
                    useradminid = userinfo.Adminid;
                }
            }

            #region 获取并检查版块信息
            forum = Forums.GetForumInfo(forumid);
            if (forum == null || forum.Layer == 0)
            {
                allowposttopic = false;
                AddErrLine("错误的论坛ID"); return;
            }

            pagetitle = Utils.RemoveHtml(forum.Name);
            enabletag = (config.Enabletag & forum.Allowtag) == 1;

            if (forum.Applytopictype == 1)  //启用主题分类
                topictypeselectoptions = Forums.GetCurrentTopicTypesOption(forum.Fid, forum.Topictypes);

            if (forum.Password != "" && Utils.MD5(forum.Password) != ForumUtils.GetCookie("forum" + forumid + "password"))
            {
                AddErrLine("本版块被管理员设置了密码");
                SetBackLink(base.ShowForumAspxRewrite(forumid, 0)); return;
            }
            needaudit = UserAuthority.NeedAudit(forum, useradminid, userid);
            smileyoff = 1 - forum.Allowsmilies;
            bbcodeoff = (forum.Allowbbcode == 1 && usergroupinfo.Allowcusbbcode == 1) ? 0 : 1;
            allowimg = forum.Allowimgcode;
            #endregion

            #region 访问和发帖权限校验
            if (!UserAuthority.VisitAuthority(forum, usergroupinfo, userid, ref msg))
            {
                AddErrLine(msg);
                needlogin = true; return;
            }

            if (!UserAuthority.PostAuthority(forum, usergroupinfo, userid, ref msg))
            {
                AddErrLine(msg);
                needlogin = true; return;
            }
            #endregion

            #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

            #region 判断是否是灌水
            AdminGroupInfo admininfo = AdminGroups.GetAdminGroupInfo(usergroupid);
            if (admininfo != null)
                disablepost = admininfo.Disablepostctrl;

            if (!UserAuthority.CheckPostTimeSpan(usergroupinfo, admininfo, oluserinfo, ref msg))
            {
                AddErrLine(msg); return;
            }
            #endregion

            #region 积分信息
            creditstrans = Scoresets.GetTopicAttachCreditsTrans();
            userextcreditsinfo = Scoresets.GetScoreSet(creditstrans);
            bonusextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetBonusCreditsTrans());
            #endregion

            #region 特殊主题权限判断
            if (forum.Allowspecialonly > 0 && Utils.StrIsNullOrEmpty(type))
            {
                AddErrLine(string.Format("当前版块 \"{0}\" 不允许发表普通主题", forum.Name)); return;
            }
            if (!UserAuthority.PostSpecialAuthority(forum, type, ref msg))
            {
                AddErrLine(msg); return;
            }
            if (!UserAuthority.PostSpecialAuthority(usergroupinfo, type, ref msg))
            {
                AddErrLine(msg);
                needlogin = true; return;
            }
            if (type == "bonus")
            {
                int creditTrans = Scoresets.GetBonusCreditsTrans();
                //当“交易积分设置”有效时(1-8的整数):
                if (creditTrans <= 0)
                {
                    //AddErrLine(string.Format("系统未设置\"交易积分设置\", 无法判断当前要使用的(扩展)积分字段, 暂时无法发布悬赏", usergroupinfo.Grouptitle)); return;
                    AddErrLine("系统未设置\"交易积分设置\", 无法判断当前要使用的(扩展)积分字段, 暂时无法发布悬赏"); return;
                }
                mybonustranscredits = Users.GetUserExtCredits(userid, creditTrans);
            }
            #endregion

            //如果是提交...
            if (ispost)
            {
                SetBackLink(string.Format("posttopic.aspx?forumid={0}&restore=1&type={1}", forumid, type));

                ForumUtils.WriteCookie("postmessage", postmessage);

                #region 验证提交信息
                //常规项验证
                NormalValidate(admininfo, postmessage, userinfo);
                if (IsErr()) return;

                // 如果用户上传了附件,则检测用户是否有上传附件的权限
                if (ForumUtils.IsPostFile())
                {
                    if (Utils.StrIsNullOrEmpty(Attachments.GetAttachmentTypeArray(attachmentTypeSelect)))
                        AddErrLine("系统不允许上传附件");

                    if (!UserAuthority.PostAttachAuthority(forum, usergroupinfo, userid, ref msg))
                        AddErrLine(msg);
                }

                //发悬赏校验
                int topicprice = 0;
                bool isbonus = type == "bonus";
                ValidateBonus(ref topicprice, ref isbonus);

                //发特殊主题校验
                ValidatePollAndDebate();

                if (IsErr())
                    return;
                #endregion

                int hide = (ForumUtils.IsHidePost(postmessage) && usergroupinfo.Allowhidecode == 1) ? 1 : 0;

                TopicInfo topicinfo = CreateTopic(admininfo, postmessage, isbonus, topicprice);
                if (IsErr())
                    return;

                PostInfo postinfo = CreatePost(topicinfo);
                if (IsErr())
                    return;

                //处理附件
                StringBuilder sb = new StringBuilder();
                AttachmentInfo[] attachmentinfo = ForumUtils.SaveRequestFiles(forumid, config.Maxattachments, usergroupinfo.Maxsizeperday, usergroupinfo.Maxattachsize, MaxTodaySize, attachextensions, forum.Disablewatermark == 1 ? 0 : config.Watermarkstatus, config, "postfile");
                Attachments.UpdateAttachment(attachmentinfo, topicinfo.Tid, postinfo.Pid, postinfo, ref sb, userid, config, usergroupinfo);

                //加入相册
                if (!tempaccountspost && config.Enablealbum == 1 && apb != null)
                    sb.Append(apb.CreateAttachment(attachmentinfo, usergroupid, userid, username));

                #region 添加日志的操作
                SpacePluginBase spb = SpacePluginProvider.GetInstance();
                if (DNTRequest.GetFormString("addtoblog") == "on" && spb != null)
                {
                    if (userid != -1 && userinfo.Spaceid > 0)
                        spb.CreateTopic(topicinfo, postinfo, attachmentinfo);
                    else
                        AddMsgLine("您的个人空间尚未开通, 无法同时添加为日志");
                }
                #endregion

                OnlineUsers.UpdateAction(olid, UserAction.PostTopic.ActionID, forumid, forum.Name, -1, "", config.Onlinetimeout);
                // 更新在线表中的用户最后发帖时间
                OnlineUsers.UpdatePostTime(olid);

                #region 设置提示信息和跳转链接
                if (sb.Length > 0)
                {
                    SetUrl(base.ShowTopicAspxRewrite(topicinfo.Tid, 0));
                    SetMetaRefresh(5);
                    SetShowBackLink(true);
                    if (infloat == 1)
                    {
                        AddErrLine(sb.ToString());
                        return;
                    }
                    else
                    {
                        sb.Insert(0, "<table cellspacing=\"0\" cellpadding=\"4\" border=\"0\"><tr><td colspan=2 align=\"left\"><span class=\"bold\"><nobr>发表主题成功,但以下附件上传失败:</nobr></span><br /></td></tr>");
                        AddMsgLine(sb.Append("</table>").ToString());
                    }
                }
                else
                {
                    SetShowBackLink(false);
                    if (useradminid != 1)
                    {
                        //是否需要审核
                        if (UserAuthority.NeedAudit(forum, useradminid, topicinfo, userid, disablepost))
                        {
                            SetUrl(base.ShowForumAspxRewrite(forumid, forumpageid));
                            SetMetaRefresh();
                            AddMsgLine("发表主题成功, 但需要经过审核才可以显示. 返回该版块");
                        }
                        else
                            PostTopicSucceed(Forums.GetValues(forum.Postcredits), topicinfo, topicinfo.Tid);
                    }
                    else
                        PostTopicSucceed(Forums.GetValues(forum.Postcredits), topicinfo, topicinfo.Tid);
                }
                #endregion

                ForumUtils.WriteCookie("postmessage", "");
                SetLastPostedForumCookie();

                //如果已登录就不需要再登录
                if (needlogin && userid > 0)
                    needlogin = false;
            }
            else //非提交操作
                AddLinkCss(BaseConfigs.GetForumPath + "templates/" + templatepath + "/editor.css", "css");
        }
Example #23
0
 public void UpdateLastPost(ForumInfo forumInfo, PostInfo postInfo)
 {
     UpdateLastPost(postInfo.Tid, postInfo.Topictitle, postInfo.Postdatetime.ToString(), postInfo.Posterid, postInfo.Poster, forumInfo.Fid, forumInfo.Parentidlist);
 }
Example #24
0
		public int InsertForumsInf(ForumInfo foruminfo)
		{
			IDataParameter[] prams = {
									  DbHelper.MakeInParam("@parentid", (DbType)SqlDbType.SmallInt, 2, foruminfo.Parentid),
									  DbHelper.MakeInParam("@layer", (DbType)SqlDbType.Int, 4, foruminfo.Layer),
									  DbHelper.MakeInParam("@pathlist", (DbType)SqlDbType.NChar, 3000, foruminfo.Pathlist == null ? " " : foruminfo.Pathlist),
									  DbHelper.MakeInParam("@parentidlist", (DbType)SqlDbType.NChar, 300, foruminfo.Parentidlist== null ? " " : foruminfo.Parentidlist),
									  DbHelper.MakeInParam("@subforumcount", (DbType)SqlDbType.Int, 4, foruminfo.Subforumcount),
									  DbHelper.MakeInParam("@name", (DbType)SqlDbType.NChar, 50, foruminfo.Name),
									  DbHelper.MakeInParam("@status", (DbType)SqlDbType.Int, 4, foruminfo.Status),
									  DbHelper.MakeInParam("@colcount", (DbType)SqlDbType.SmallInt, 4, foruminfo.Colcount),
									  DbHelper.MakeInParam("@displayorder", (DbType)SqlDbType.Int, 4, foruminfo.Displayorder),
									  DbHelper.MakeInParam("@templateid", (DbType)SqlDbType.SmallInt, 2, foruminfo.Templateid),
									  DbHelper.MakeInParam("@allowsmilies", (DbType)SqlDbType.Int, 4, foruminfo.Allowsmilies),
									  DbHelper.MakeInParam("@allowrss", (DbType)SqlDbType.Int, 6, foruminfo.Allowrss),
									  DbHelper.MakeInParam("@allowhtml", (DbType)SqlDbType.Int, 4, foruminfo.Allowhtml),
									  DbHelper.MakeInParam("@allowbbcode", (DbType)SqlDbType.Int, 4, foruminfo.Allowbbcode),
									  DbHelper.MakeInParam("@allowimgcode", (DbType)SqlDbType.Int, 4, foruminfo.Allowimgcode),
									  DbHelper.MakeInParam("@allowblog", (DbType)SqlDbType.Int, 4, foruminfo.Allowblog),
									  DbHelper.MakeInParam("@allowtrade", (DbType)SqlDbType.Int, 4, foruminfo.Allowtrade),
									  DbHelper.MakeInParam("@alloweditrules", (DbType)SqlDbType.Int, 4, foruminfo.Alloweditrules),
									  DbHelper.MakeInParam("@allowthumbnail", (DbType)SqlDbType.Int, 4, foruminfo.Allowthumbnail),
									  DbHelper.MakeInParam("@recyclebin", (DbType)SqlDbType.Int, 4, foruminfo.Recyclebin),
									  DbHelper.MakeInParam("@modnewposts", (DbType)SqlDbType.Int, 4, foruminfo.Modnewposts),
									  DbHelper.MakeInParam("@jammer", (DbType)SqlDbType.Int, 4, foruminfo.Jammer),
									  DbHelper.MakeInParam("@disablewatermark", (DbType)SqlDbType.Int, 4, foruminfo.Disablewatermark),
									  DbHelper.MakeInParam("@inheritedmod", (DbType)SqlDbType.Int, 4, foruminfo.Inheritedmod),
									  DbHelper.MakeInParam("@autoclose", (DbType)SqlDbType.SmallInt, 2, foruminfo.Autoclose)
								  };
			string sql = "INSERT INTO [" + BaseConfigs.GetTablePrefix + "forums] ([parentid],[layer],[pathlist],[parentidlist],[subforumcount],[name],[status],[colcount],[displayorder],[templateid],[allowsmilies],[allowrss],[allowhtml],[allowbbcode],[allowimgcode],[allowblog],[allowtrade],[alloweditrules],[recyclebin],[modnewposts],[jammer],[disablewatermark],[inheritedmod],[autoclose],[allowthumbnail]) VALUES (@parentid,@layer,@pathlist,@parentidlist,@subforumcount,@name,@status, @colcount, @displayorder,@templateid,@allowsmilies,@allowrss,@allowhtml,@allowbbcode,@allowimgcode,@allowblog,@allowtrade,@alloweditrules,@recyclebin,@modnewposts,@jammer,@disablewatermark,@inheritedmod,@autoclose,@allowthumbnail)";
			DbHelper.ExecuteNonQuery(CommandType.Text, sql, prams);

			int fid = GetMaxForumId();

			IDataParameter[] prams1 = {
									   DbHelper.MakeInParam("@fid", (DbType)SqlDbType.Int, 4, fid),
									   DbHelper.MakeInParam("@description", (DbType)SqlDbType.NText, 0, foruminfo.Description),
									   DbHelper.MakeInParam("@password", (DbType)SqlDbType.VarChar, 16, foruminfo.Password),
									   DbHelper.MakeInParam("@icon", (DbType)SqlDbType.VarChar, 255, foruminfo.Icon),
									   DbHelper.MakeInParam("@postcredits", (DbType)SqlDbType.VarChar, 255, foruminfo.Postcredits),
									   DbHelper.MakeInParam("@replycredits", (DbType)SqlDbType.VarChar, 255, foruminfo.Replycredits),
									   DbHelper.MakeInParam("@redirect", (DbType)SqlDbType.VarChar, 255, foruminfo.Redirect),
									   DbHelper.MakeInParam("@attachextensions", (DbType)SqlDbType.VarChar, 255, foruminfo.Attachextensions),
									   DbHelper.MakeInParam("@moderators", (DbType)SqlDbType.Text, 0, foruminfo.Moderators),
									   DbHelper.MakeInParam("@rules", (DbType)SqlDbType.Text, 0, foruminfo.Rules),
									   DbHelper.MakeInParam("@topictypes", (DbType)SqlDbType.Text, 0, foruminfo.Topictypes),
									   DbHelper.MakeInParam("@viewperm", (DbType)SqlDbType.Text, 0, foruminfo.Viewperm),
									   DbHelper.MakeInParam("@postperm", (DbType)SqlDbType.Text, 0, foruminfo.Postperm),
									   DbHelper.MakeInParam("@replyperm", (DbType)SqlDbType.Text, 0, foruminfo.Replyperm),
									   DbHelper.MakeInParam("@getattachperm", (DbType)SqlDbType.Text, 0, foruminfo.Getattachperm),
									   DbHelper.MakeInParam("@postattachperm", (DbType)SqlDbType.Text, 0, foruminfo.Postattachperm)
								   };
			sql = "INSERT INTO [" + BaseConfigs.GetTablePrefix + "forumfields] ([fid],[description],[password],[icon],[postcredits],[replycredits],[redirect],[attachextensions],[moderators],[rules],[topictypes],[viewperm],[postperm],[replyperm],[getattachperm],[postattachperm]) VALUES (@fid,@description,@password,@icon,@postcredits,@replycredits,@redirect,@attachextensions,@moderators,@rules,@topictypes,@viewperm,@postperm,@replyperm,@getattachperm,@postattachperm)";
			DbHelper.ExecuteDataset(CommandType.Text, sql, prams1);
			return fid;
		}
Example #25
0
        public int InsertForumsInf(ForumInfo forumInfo)
        {
            DbParameter[] parms = {
				DbHelper.MakeInParam("@parentid", (DbType)SqlDbType.Int, 4, forumInfo.Parentid),
				DbHelper.MakeInParam("@layer", (DbType)SqlDbType.Int, 4, forumInfo.Layer),
				DbHelper.MakeInParam("@pathlist", (DbType)SqlDbType.NChar, 3000, Utils.StrIsNullOrEmpty(forumInfo.Pathlist) ? " " : forumInfo.Pathlist),
				DbHelper.MakeInParam("@parentidlist", (DbType)SqlDbType.NChar, 300, Utils.StrIsNullOrEmpty(forumInfo.Parentidlist) ? " " : forumInfo.Parentidlist),
				DbHelper.MakeInParam("@subforumcount", (DbType)SqlDbType.Int, 4, forumInfo.Subforumcount),
				DbHelper.MakeInParam("@name", (DbType)SqlDbType.NChar, 50, forumInfo.Name),
				DbHelper.MakeInParam("@status", (DbType)SqlDbType.Int, 4, forumInfo.Status),
				DbHelper.MakeInParam("@colcount", (DbType)SqlDbType.SmallInt, 4, forumInfo.Colcount),
				DbHelper.MakeInParam("@displayorder", (DbType)SqlDbType.Int, 4, forumInfo.Displayorder),
				DbHelper.MakeInParam("@templateid", (DbType)SqlDbType.SmallInt, 2, forumInfo.Templateid),
				DbHelper.MakeInParam("@allowsmilies", (DbType)SqlDbType.Int, 4, forumInfo.Allowsmilies),
				DbHelper.MakeInParam("@allowrss", (DbType)SqlDbType.Int, 4, forumInfo.Allowrss),
				DbHelper.MakeInParam("@allowhtml", (DbType)SqlDbType.Int, 4, forumInfo.Allowhtml),
				DbHelper.MakeInParam("@allowbbcode", (DbType)SqlDbType.Int, 4, forumInfo.Allowbbcode),
				DbHelper.MakeInParam("@allowimgcode", (DbType)SqlDbType.Int, 4, forumInfo.Allowimgcode),
				DbHelper.MakeInParam("@allowblog", (DbType)SqlDbType.Int, 4, forumInfo.Allowblog),
				DbHelper.MakeInParam("@istrade", (DbType)SqlDbType.Int, 4, forumInfo.Istrade),
				DbHelper.MakeInParam("@alloweditrules", (DbType)SqlDbType.Int, 4, forumInfo.Alloweditrules),
				DbHelper.MakeInParam("@allowthumbnail", (DbType)SqlDbType.Int, 4, forumInfo.Allowthumbnail),
                DbHelper.MakeInParam("@allowtag",(DbType)SqlDbType.Int,4,forumInfo.Allowtag),
				DbHelper.MakeInParam("@recyclebin", (DbType)SqlDbType.Int, 4, forumInfo.Recyclebin),
				DbHelper.MakeInParam("@modnewposts", (DbType)SqlDbType.Int, 4, forumInfo.Modnewposts),
				DbHelper.MakeInParam("@jammer", (DbType)SqlDbType.Int, 4, forumInfo.Jammer),
				DbHelper.MakeInParam("@disablewatermark", (DbType)SqlDbType.Int, 4, forumInfo.Disablewatermark),
				DbHelper.MakeInParam("@inheritedmod", (DbType)SqlDbType.Int, 4, forumInfo.Inheritedmod),
				DbHelper.MakeInParam("@autoclose", (DbType)SqlDbType.SmallInt, 2, forumInfo.Autoclose),                
                DbHelper.MakeInParam("@allowpostspecial",(DbType)SqlDbType.Int,4,forumInfo.Allowpostspecial),
                DbHelper.MakeInParam("@allowspecialonly",(DbType)SqlDbType.Int,4,forumInfo.Allowspecialonly),
				DbHelper.MakeInParam("@description", (DbType)SqlDbType.NText, 0, forumInfo.Description),
				DbHelper.MakeInParam("@password", (DbType)SqlDbType.VarChar, 16, forumInfo.Password),
				DbHelper.MakeInParam("@icon", (DbType)SqlDbType.VarChar, 255, forumInfo.Icon),
				DbHelper.MakeInParam("@postcredits", (DbType)SqlDbType.VarChar, 255, forumInfo.Postcredits),
				DbHelper.MakeInParam("@replycredits", (DbType)SqlDbType.VarChar, 255, forumInfo.Replycredits),
				DbHelper.MakeInParam("@redirect", (DbType)SqlDbType.VarChar, 255, forumInfo.Redirect),
				DbHelper.MakeInParam("@attachextensions", (DbType)SqlDbType.VarChar, 255, forumInfo.Attachextensions),
				DbHelper.MakeInParam("@moderators", (DbType)SqlDbType.Text, 0, forumInfo.Moderators),
				DbHelper.MakeInParam("@rules", (DbType)SqlDbType.NText, 0, forumInfo.Rules),
				DbHelper.MakeInParam("@topictypes", (DbType)SqlDbType.Text, 0, forumInfo.Topictypes),
				DbHelper.MakeInParam("@viewperm", (DbType)SqlDbType.Text, 0, forumInfo.Viewperm),
				DbHelper.MakeInParam("@postperm", (DbType)SqlDbType.Text, 0, forumInfo.Postperm),
				DbHelper.MakeInParam("@replyperm", (DbType)SqlDbType.Text, 0, forumInfo.Replyperm),
				DbHelper.MakeInParam("@getattachperm", (DbType)SqlDbType.Text, 0, forumInfo.Getattachperm),
				DbHelper.MakeInParam("@postattachperm", (DbType)SqlDbType.Text, 0, forumInfo.Postattachperm),
				DbHelper.MakeInParam("@seokeywords", (DbType)SqlDbType.NVarChar, 500, forumInfo.Seokeywords),
                DbHelper.MakeInParam("@seodescription", (DbType)SqlDbType.NVarChar, 500, forumInfo.Seodescription),
                DbHelper.MakeInParam("@rewritename", (DbType)SqlDbType.NVarChar, 20, forumInfo.Rewritename)
			};
            DbHelper.ExecuteDataset(CommandType.StoredProcedure, string.Format("{0}insertforumsinfo", BaseConfigs.GetTablePrefix), parms);
            return GetMaxForumId();
        }
Example #26
0
 /// <summary>
 /// 上传附件权限控制
 /// </summary>
 /// <param name="forum">版块信息</param>
 /// <param name="usergroupinfo">当前用户的用户组信息</param>
 /// <param name="userId">当前用户Id</param>
 /// <returns></returns>
 public static bool PostAttachAuthority(ForumInfo forum, UserGroupInfo userGroupInfo, int userId, ref string msg)
 {
     if (!Forums.AllowPostAttachByUserID(forum.Permuserlist, userId))
     {
         if (!Forums.AllowPostAttach(forum.Postattachperm, userGroupInfo.Groupid))
         {
             msg = "您没有在该版块上传附件的权限";
             return false;
         }
         else if (userGroupInfo.Allowpostattach != 1)
         {
             msg = string.Format("您当前的身份 \"{0}\" 没有上传附件的权限", userGroupInfo.Grouptitle);
             return false;
         }
     }
     return true;
 }
Example #27
0
		public void SaveForumsInfo(ForumInfo foruminfo)
		{
			SqlConnection conn = new SqlConnection(DbHelper.ConnectionString);
			conn.Open();
			using (SqlTransaction trans = conn.BeginTransaction())
			{
				try
				{
					IDataParameter[] prams = {
											  DbHelper.MakeInParam("@name", (DbType)SqlDbType.NChar, 50, foruminfo.Name),
											  DbHelper.MakeInParam("@status", (DbType)SqlDbType.Int, 4, foruminfo.Status),
											  DbHelper.MakeInParam("@colcount", (DbType)SqlDbType.SmallInt, 4, foruminfo.Colcount),
											  DbHelper.MakeInParam("@templateid", (DbType)SqlDbType.SmallInt, 2, foruminfo.Templateid),
											  DbHelper.MakeInParam("@allowsmilies", (DbType)SqlDbType.Int, 4, foruminfo.Allowsmilies),
											  DbHelper.MakeInParam("@allowrss", (DbType)SqlDbType.Int, 6, foruminfo.Allowrss),
											  DbHelper.MakeInParam("@allowhtml", (DbType)SqlDbType.Int, 4, foruminfo.Allowhtml),
											  DbHelper.MakeInParam("@allowbbcode", (DbType)SqlDbType.Int, 4, foruminfo.Allowbbcode),
											  DbHelper.MakeInParam("@allowimgcode", (DbType)SqlDbType.Int, 4, foruminfo.Allowimgcode),
											  DbHelper.MakeInParam("@allowblog", (DbType)SqlDbType.Int, 4, foruminfo.Allowblog),
											  DbHelper.MakeInParam("@allowtrade", (DbType)SqlDbType.Int, 4, foruminfo.Allowtrade),
											  DbHelper.MakeInParam("@alloweditrules", (DbType)SqlDbType.Int, 4, foruminfo.Alloweditrules),
											  DbHelper.MakeInParam("@allowthumbnail", (DbType)SqlDbType.Int, 4, foruminfo.Allowthumbnail),
											  DbHelper.MakeInParam("@recyclebin", (DbType)SqlDbType.Int, 4, foruminfo.Recyclebin),
											  DbHelper.MakeInParam("@modnewposts", (DbType)SqlDbType.Int, 4, foruminfo.Modnewposts),
											  DbHelper.MakeInParam("@jammer", (DbType)SqlDbType.Int, 4, foruminfo.Jammer),
											  DbHelper.MakeInParam("@disablewatermark", (DbType)SqlDbType.Int, 4, foruminfo.Disablewatermark),
											  DbHelper.MakeInParam("@inheritedmod", (DbType)SqlDbType.Int, 4, foruminfo.Inheritedmod),
											  DbHelper.MakeInParam("@autoclose", (DbType)SqlDbType.SmallInt, 2, foruminfo.Autoclose),
											  DbHelper.MakeInParam("@displayorder", (DbType)SqlDbType.Int, 4, foruminfo.Displayorder),
											  DbHelper.MakeInParam("@fid", (DbType)SqlDbType.Int, 4, foruminfo.Fid)
										  };
					string sql = "UPDATE [" + BaseConfigs.GetTablePrefix + "forums] SET [name]=@name, [status]=@status, [colcount]=@colcount, [templateid]=@templateid,[allowsmilies]=@allowsmilies ,[allowrss]=@allowrss, [allowhtml]=@allowhtml, [allowbbcode]=@allowbbcode, [allowimgcode]=@allowimgcode, [allowblog]=@allowblog,[allowtrade]=@allowtrade,[alloweditrules]=@alloweditrules ,[allowthumbnail]=@allowthumbnail ,[recyclebin]=@recyclebin, [modnewposts]=@modnewposts,[jammer]=@jammer,[disablewatermark]=@disablewatermark,[inheritedmod]=@inheritedmod,[autoclose]=@autoclose,[displayorder]=@displayorder WHERE [fid]=@fid";
					DbHelper.ExecuteNonQuery(trans, CommandType.Text, sql, prams);

					IDataParameter[] prams1 = {
											   DbHelper.MakeInParam("@description", (DbType)SqlDbType.NText, 0, foruminfo.Description),
											   DbHelper.MakeInParam("@password", (DbType)SqlDbType.NVarChar, 16, foruminfo.Password),
											   DbHelper.MakeInParam("@icon", (DbType)SqlDbType.VarChar, 255, foruminfo.Icon),
											   DbHelper.MakeInParam("@redirect", (DbType)SqlDbType.VarChar, 255, foruminfo.Redirect),
											   DbHelper.MakeInParam("@attachextensions", (DbType)SqlDbType.VarChar, 255, foruminfo.Attachextensions),
											   DbHelper.MakeInParam("@rules", (DbType)SqlDbType.Text, 0, foruminfo.Rules),
											   DbHelper.MakeInParam("@topictypes", (DbType)SqlDbType.Text, 0, foruminfo.Topictypes),
											   DbHelper.MakeInParam("@viewperm", (DbType)SqlDbType.Text, 0, foruminfo.Viewperm),
											   DbHelper.MakeInParam("@postperm", (DbType)SqlDbType.Text, 0, foruminfo.Postperm),
											   DbHelper.MakeInParam("@replyperm", (DbType)SqlDbType.Text, 0, foruminfo.Replyperm),
											   DbHelper.MakeInParam("@getattachperm", (DbType)SqlDbType.Text, 0, foruminfo.Getattachperm),
											   DbHelper.MakeInParam("@postattachperm", (DbType)SqlDbType.Text, 0, foruminfo.Postattachperm),
											   DbHelper.MakeInParam("@applytopictype", (DbType)SqlDbType.TinyInt, 1, foruminfo.Applytopictype),
											   DbHelper.MakeInParam("@postbytopictype", (DbType)SqlDbType.TinyInt, 1, foruminfo.Postbytopictype),
											   DbHelper.MakeInParam("@viewbytopictype", (DbType)SqlDbType.TinyInt, 1, foruminfo.Viewbytopictype),
											   DbHelper.MakeInParam("@topictypeprefix", (DbType)SqlDbType.TinyInt, 1, foruminfo.Topictypeprefix),
											   DbHelper.MakeInParam("@permuserlist", (DbType)SqlDbType.NText, 0, foruminfo.Permuserlist),
											   DbHelper.MakeInParam("@fid", (DbType)SqlDbType.Int, 4, foruminfo.Fid)
										   };
					sql = "UPDATE [" + BaseConfigs.GetTablePrefix + "forumfields] SET [description]=@description,[password]=@password,[icon]=@icon,[redirect]=@redirect,"
						+ "[attachextensions]=@attachextensions,[rules]=@rules,[topictypes]=@topictypes,[viewperm]=@viewperm,[postperm]=@postperm,[replyperm]=@replyperm,"
						+ "[getattachperm]=@getattachperm,[postattachperm]=@postattachperm,[applytopictype]=@applytopictype,[postbytopictype]=@postbytopictype,"
						+ "[viewbytopictype]=@viewbytopictype,[topictypeprefix]=@topictypeprefix,[permuserlist]=@permuserlist WHERE [fid]=@fid";
					
					DbHelper.ExecuteNonQuery(trans, CommandType.Text, sql, prams1);

					trans.Commit();
				}
				catch (Exception ex)
				{
					trans.Rollback();
					throw ex;
				}
			}
			conn.Close();
		}
Example #28
0
        private string condition = ""; //查询条件

        protected override void ShowPage()
        {
            if (userid > 0 && useradminid > 0)
                admingroupinfo = AdminGroups.GetAdminGroupInfo(usergroupid);

            if (config.Rssstatus == 1)
                AddLinkRss("tools/rss.aspx", "最新主题");
            
            #region 版块信息设置
            //当所选论坛为多个时或全部时
            if (forumid == -1)
            {
                //用户点选相应的论坛
                forums = (!Utils.StrIsNullOrEmpty(DNTRequest.GetString("fidlist")) ? DNTRequest.GetString("fidlist") : DNTRequest.GetString("forums")).ToLower();
                //如果是选择全部版块
                if (forums == "all")
                    forums = "";

                if (forums == "")
                {
                    foreach (ForumInfo forumInfo in Forums.GetForumList())
                        forums += string.Format(",{0}", forumInfo.Fid);
                }
                forums = Utils.StrIsNullOrEmpty(forums) ? GetAllowviewForums(forums.Trim(',')) : GetAllowviewForums(forums);
            }

            navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname);
            if (forumid > 0)
            {
                forum = Forums.GetForumInfo(forumid);
                pagetitle = Utils.RemoveHtml(forum.Name);
                forumnav = ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname);
                showforumlogin = ShowForumLogin();

                if (!UserAuthority.VisitAuthority(forum, usergroupinfo, userid, ref msg))
                {
                    AddErrLine(msg);
                    return;
                }
                // 得到子版块列表
                subforumlist = Forums.GetSubForumCollection(forumid, forum.Colcount, config.Hideprivate, usergroupid, config.Moddisplay);
            }
            #endregion

            //设置查询条件
            SetCondition();

            if (IsErr()) return;

            pagetitle = (type == "digest" ? "查看精华" : "查看新帖");

            pmlist = (newpmcount > 0 ? PrivateMessages.GetPrivateMessageListForIndex(userid, 5, 1, 1) : null);
            SetPageIdAndNumber();
            topiclist = Topics.GetTopicListByCondition(tpp, pageid, 0, 10, config.Hottopic, forum.Autoclose, forum.Topictypeprefix, condition, GetOrder(), direct);

            OnlineUsers.UpdateAction(olid, UserAction.ShowForum.ActionID, forumid, config.Onlinetimeout);
            ForumUtils.UpdateVisitedForumsOptions(forumid);
        }
Example #29
0
		public bool BatchSetForumInf(ForumInfo foruminfo, BatchSetParams bsp, string fidlist)
		{
			StringBuilder forums = new StringBuilder();
			StringBuilder forumfields = new StringBuilder();

			forums.Append("UPDATE [" + BaseConfigs.GetTablePrefix + "forums] SET ");
			if (bsp.SetSetting)
			{
				forums.Append("[Allowsmilies]='" + foruminfo.Allowsmilies + "' ,");
				forums.Append("[Allowrss]='" + foruminfo.Allowrss + "' ,");
				forums.Append("[Allowhtml]='" + foruminfo.Allowhtml + "' ,");
				forums.Append("[Allowbbcode]='" + foruminfo.Allowbbcode + "' ,");
				forums.Append("[Allowimgcode]='" + foruminfo.Allowimgcode + "' ,");
				forums.Append("[Allowblog]='" + foruminfo.Allowblog + "' ,");
				forums.Append("[Allowtrade]='" + foruminfo.Allowtrade + "' ,");
				forums.Append("[Alloweditrules]='" + foruminfo.Alloweditrules + "' ,");
				forums.Append("[allowthumbnail]='" + foruminfo.Allowthumbnail + "' ,");
				forums.Append("[Recyclebin]='" + foruminfo.Recyclebin + "' ,");
				forums.Append("[Modnewposts]='" + foruminfo.Modnewposts + "' ,");
				forums.Append("[Jammer]='" + foruminfo.Jammer + "' ,");
				forums.Append("[Disablewatermark]='" + foruminfo.Disablewatermark + "' ,");
				forums.Append("[Inheritedmod]='" + foruminfo.Inheritedmod + "' ,");
			}
			if (forums.ToString().EndsWith(","))
			{
				forums.Remove(forums.Length - 1, 1);
			}
			forums.Append("WHERE [fid] IN(" + fidlist + ")");


			forumfields.Append("UPDATE [" + BaseConfigs.GetTablePrefix + "forumfields] SET ");

			if (bsp.SetPassWord)
			{
				forumfields.Append("[password]='" + foruminfo.Password + "' ,");
			}

			if (bsp.SetAttachExtensions)
			{
				forumfields.Append("[attachextensions]='" + foruminfo.Attachextensions + "' ,");
			}

			if (bsp.SetPostCredits)
			{
				forumfields.Append("[postcredits]='" + foruminfo.Postcredits + "' ,");
			}

			if (bsp.SetReplyCredits)
			{
				forumfields.Append("[replycredits]='" + foruminfo.Replycredits + "' ,");
			}


			if (bsp.SetViewperm)
			{
				forumfields.Append("[Viewperm]='" + foruminfo.Viewperm + "' ,");
			}

			if (bsp.SetPostperm)
			{
				forumfields.Append("[Postperm]='" + foruminfo.Postperm + "' ,");
			}

			if (bsp.SetReplyperm)
			{
				forumfields.Append("[Replyperm]='" + foruminfo.Replyperm + "' ,");
			}

			if (bsp.SetGetattachperm)
			{
				forumfields.Append("[Getattachperm]='" + foruminfo.Getattachperm + "' ,");
			}

			if (bsp.SetPostattachperm)
			{
				forumfields.Append("[Postattachperm]='" + foruminfo.Postattachperm + "' ,");
			}

			if (forumfields.ToString().EndsWith(","))
			{
				forumfields.Remove(forumfields.Length - 1, 1);
			}

			forumfields.Append("WHERE [fid] IN(" + fidlist + ")");


			SqlConnection conn = new SqlConnection(DbHelper.ConnectionString);
			conn.Open();
			using (SqlTransaction trans = conn.BeginTransaction())
			{
				try
				{
					if (forums.ToString().IndexOf("SET WHERE") < 0)
					{
						DbHelper.ExecuteNonQuery(trans, CommandType.Text, forums.ToString());
					}

					if (forumfields.ToString().IndexOf("SET WHERE") < 0)
					{
						DbHelper.ExecuteNonQuery(trans, CommandType.Text, forumfields.ToString());
					}
					trans.Commit();
				}
				catch
				{
					trans.Rollback();
					return false;
				}
			}
			return true;
		}
Example #30
0
        /// <summary>
        /// 基本状况
        /// </summary>
        private void Default()
        {
            lastmember = Statistics.GetStatisticsRowItem("lastusername");
            //StatVarInfo[] mainstatvars = Stats.GetStatVarsByType("main");
            foreach (string key in mainstats.Keys)
            {
                statvars[key] = mainstats[key].ToString();
            }

            if (!statvars.ContainsKey("lastupdate") || (DateTime.Now - DateTime.Parse(statvars["lastupdate"])).TotalMinutes > statscachelife)
            {
                statvars.Clear();
                statvars["lastupdate"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                Stats.UpdateStatVars("main", "lastupdate", statvars["lastupdate"]);
            }

            forums = Stats.GetForumCount();
            topics = Stats.GetTopicCount();
            posts = Stats.GetPostCount();
            members = Stats.GetMemberCount();

            //运行时间 从第一帖到现在
            if (statvars.ContainsKey("runtime"))
            {
                runtime = Utils.StrToInt(statvars["runtime"], 0);
            }
            else 
            {
                runtime = (DateTime.Now - Convert.ToDateTime(monthpostsstats["starttime"])).Days;
                //runtime = Stats.GetRuntime();
                Stats.UpdateStatVars("main", "runtime", runtime.ToString());
            }

            //今日新增帖数
            if (statvars.ContainsKey("postsaddtoday"))
            {
                postsaddtoday = statvars["postsaddtoday"];
            }
            else 
            {
                postsaddtoday = Stats.GetTodayPostCount().ToString();
                Stats.UpdateStatVars("main", "postsaddtoday", postsaddtoday);
            }

            //今日新增会员数
            if (statvars.ContainsKey("membersaddtoday"))
            {
                membersaddtoday = statvars["membersaddtoday"];
            }
            else
            {
                membersaddtoday = Stats.GetTodayNewMemberCount().ToString();
                Stats.UpdateStatVars("main", "membersaddtoday", membersaddtoday);
            }

            //管理人员数
            if (statvars.ContainsKey("admins"))
            {
                admins = statvars["admins"];
            }
            else
            {
                admins = Stats.GetAdminCount().ToString();
                Stats.UpdateStatVars("main", "admins", admins);
            }

            //未发帖会员数
            if (statvars.ContainsKey("memnonpost"))
            {
                memnonpost = Utils.StrToInt(statvars["memnonpost"], 0);
            }
            else
            {
                memnonpost = Stats.GetNonPostMemCount();
                Stats.UpdateStatVars("main", "memnonpost", memnonpost.ToString());
            }

            //热门论坛
            if (statvars.ContainsKey("hotforum"))
            {
                hotforum = (ForumInfo)SerializationHelper.DeSerialize(typeof(ForumInfo), statvars["hotforum"]);
            }
            else
            {
                hotforum = Stats.GetHotForum();
                Stats.UpdateStatVars("main", "hotforum", SerializationHelper.Serialize(hotforum));
            }

            //今日最佳会员及其今日帖数
            if (statvars.ContainsKey("bestmem") && statvars.ContainsKey("bestmemposts"))
            {
                bestmem = statvars["bestmem"];
                bestmemposts = Utils.StrToInt(statvars["bestmemposts"], 0);
            }
            else
            {
                Stats.GetBestMember(out bestmem, out bestmemposts);

                Stats.UpdateStatVars("main", "bestmem", bestmem);
                Stats.UpdateStatVars("main", "bestmemposts", bestmemposts.ToString());

            }
            mempost = members - memnonpost;
            mempostavg = (double)Math.Round((double)posts / (double)members, 2);
            topicreplyavg = (double)Math.Round((double)(posts - topics) / (double)topics, 2);
            mempostpercent = (double)Math.Round((double)(mempost * 100) / (double)members, 2);
            postsaddavg = (double)Math.Round((double)posts / (double)runtime, 2);
            membersaddavg = members / runtime;

            int visitors = Utils.StrToInt(totalstats["members"], 0) + Utils.StrToInt(totalstats["guests"], 0);
            totalstats["visitors"] = visitors;
            pageviewavg = (double)Math.Round((double)Utils.StrToInt(totalstats["hits"], 0) / (double)(visitors == 0 ? 1 : visitors), 2);
            activeindex = ((Math.Round(membersaddavg /(double) (members == 0 ? 1 : members), 2) + Math.Round(postsaddavg /(double) (posts == 0 ? 1 : posts), 2)) * 1500.00 + topicreplyavg * 10.00 + mempostavg + Math.Round(mempostpercent / 10.00, 2) + pageviewavg).ToString();

            if (statstatus)
            {
                monthofstatsbar = Stats.GetStatsDataHtml("month", monthstats, maxmonth);
            }
            else
            {
                monthpostsofstatsbar = Stats.GetStatsDataHtml("monthposts", monthpostsstats, maxmonthposts);
                daypostsofstatsbar = Stats.GetStatsDataHtml("dayposts", daypostsstats, maxdayposts);
            }

            lastupdate = statvars["lastupdate"];
            nextupdate = DateTime.Parse(statvars["lastupdate"]).AddMinutes(statscachelife).ToString("yyyy-MM-dd HH:mm:ss");

            
        }