/// <summary>
		/// 添加用户组信息
		/// </summary>
        /// <param name="userGroupInfo"></param>
		/// <returns></returns>
		public static bool AddUserGroupInfo(UserGroupInfo userGroupInfo)
		{
			try
			{
				int Creditshigher = userGroupInfo.Creditshigher;
				int Creditslower = userGroupInfo.Creditslower;
                DataTable dt = Discuz.Data.UserGroups.GetUserGroupByCreditsHigherAndLower(Creditshigher, Creditslower);
                if (dt.Rows.Count > 0)
                    return false;

				if (userGroupInfo.Radminid == 0 && !SystemCheckCredits("add", ref Creditshigher, ref Creditslower, 0))
					return false;

                userGroupInfo.Creditshigher = Creditshigher;
                userGroupInfo.Creditslower = Creditslower;
                Data.UserGroups.CreateUserGroup(userGroupInfo);
                Data.OnlineUsers.AddOnlineList(userGroupInfo.Grouptitle);

                Caches.ReSetAdminGroupList();
                Caches.ReSetUserGroupList();
				return true;
			}
			catch
			{
				return false;
			}
		}
示例#2
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;
     }
示例#3
0
        /// <summary>
        /// 通过好友的请求信息
        /// </summary>
        /// <param name="fromUid">请求人ID</param>
        /// <param name="toUid">被请求人ID</param>
        /// <param name="toUserGroupInfo">被请求人用户组信息</param>
        /// <param name="groupId">被请求人将请求人划分的好友组,0表示不分组</param>
        /// <returns></returns>
        public static PassFriendshipEnum PassFriendship(int fromUid, int toUid, UserGroupInfo toUserGroupInfo, int groupId)
        {
            if (fromUid <= 0 || toUid <= 0 || fromUid == toUid)
                return PassFriendshipEnum.MessageError;

            FriendshipRequestInfo requestInfo = GetUserFriendRequestInfo(fromUid, toUid);

            if (requestInfo == null || requestInfo.FromUid == 0 || requestInfo.ToUid == 0 || requestInfo.ToUid == requestInfo.FromUid)
                return PassFriendshipEnum.MessageError;

            //如果用户之间已经是好友了
            if (IsFriendshipExist(requestInfo.FromUid, requestInfo.ToUid) == IsFriendshipExistEnum.Exist)
                return PassFriendshipEnum.FriendshipAlreadyExists;

            if (Friendship.GetUserFriendsCount(toUid) >= toUserGroupInfo.MaxFriendsCount)
                return PassFriendshipEnum.ToUserFriendshipOverflow;

            UserGroupInfo fromUserGroupInfo = UserGroups.GetUserGroupInfo(Users.GetShortUserInfo(fromUid).Groupid);

            if (Friendship.GetUserFriendsCount(fromUid) >= fromUserGroupInfo.MaxFriendsCount)
                return PassFriendshipEnum.FromUserFriendshipOverflow;

            if (Data.Friendship.PassFriendship(requestInfo, groupId) == (int)PassFriendshipEnum.Success)
                return PassFriendshipEnum.Success;

            return PassFriendshipEnum.MessageError;
        }
示例#4
0
        /// <summary>
        /// 创建好友请求信息
        /// </summary>
        /// <param name="friendshipRequestInfo">好友请求信息</param>
        /// <param name="userGroupInfo">当前用户用户组信息</param>
        /// <returns></returns>
        public static CreateNewFriendshipRequestEnum CreateNewFriendshipRequest(FriendshipRequestInfo friendshipRequestInfo, UserGroupInfo userGroupInfo)
        {
            if (friendshipRequestInfo.FromUid <= 0 || friendshipRequestInfo.ToUid <= 0 || friendshipRequestInfo.FromUid == friendshipRequestInfo.ToUid)
                return CreateNewFriendshipRequestEnum.MessageError;
            //如果用户之间已经是好友或者用户之间已经有一方请求的
            IsFriendshipExistEnum existResult = IsFriendshipExist(friendshipRequestInfo.FromUid, friendshipRequestInfo.ToUid);

            if (existResult == IsFriendshipExistEnum.Exist)
                return CreateNewFriendshipRequestEnum.FriendshipAlreadyExists;

            if (existResult == IsFriendshipExistEnum.RequestExist)
                return CreateNewFriendshipRequestEnum.RequestAlreadyExists;

            if (GetUserFriendsCount(friendshipRequestInfo.FromUid) >= userGroupInfo.MaxFriendsCount)
                return CreateNewFriendshipRequestEnum.UserFriendshipOverflow;

            if (Data.Friendship.CreateNewFriendshipRequest(friendshipRequestInfo) == (int)CreateNewFriendshipRequestEnum.Success)
            {
                int olId = OnlineUsers.GetOlidByUid(friendshipRequestInfo.ToUid);

                if (olId > 0)//如果被请求用户在线,则更新其在线状态
                    OnlineUsers.UpdateNewFriendsRequest(olId, 1);

                return CreateNewFriendshipRequestEnum.Success;
            }

            return CreateNewFriendshipRequestEnum.MessageError;
        }
        public void LoadUserGroupInf(int groupid)
        {
            #region 加载相关组信息

            __usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(groupid);

            groupTitle.Text = Utils.RemoveFontTag(__usergroupinfo.Grouptitle);
            creditshigher.Text = __usergroupinfo.Creditshigher.ToString();
            creditslower.Text = __usergroupinfo.Creditslower.ToString();
            stars.Text = __usergroupinfo.Stars.ToString();
            color.Text = __usergroupinfo.Color;
            groupavatar.Text = __usergroupinfo.Groupavatar;
            readaccess.Text = __usergroupinfo.Readaccess.ToString();
            maxprice.Text = __usergroupinfo.Maxprice.ToString();
            maxpmnum.Text = __usergroupinfo.Maxpmnum.ToString();
            maxsigsize.Text = __usergroupinfo.Maxsigsize.ToString();
            maxattachsize.Text = __usergroupinfo.Maxattachsize.ToString();
            maxsizeperday.Text = __usergroupinfo.Maxsizeperday.ToString();

            if (groupid > 0 && groupid <= 3) radminid.Enabled = false;

            radminid.SelectedValue = __usergroupinfo.Radminid.ToString();

            attachextensions.SetSelectByID(__usergroupinfo.Attachextensions.Trim());

            //设置用户权限组初始化信息
            __admingroupinfo = AdminUserGroups.AdminGetAdminGroupInfo(__usergroupinfo.Groupid);
            usergrouppowersetting.Bind(__usergroupinfo);

            if (__admingroupinfo != null)
            {
                //设置管理权限组初始化信息
                admingroupright.SelectedIndex = -1;
                admingroupright.Items[0].Selected = __admingroupinfo.Alloweditpost == 1;
                admingroupright.Items[1].Selected = __admingroupinfo.Alloweditpoll == 1;
                admingroupright.Items[2].Selected = __admingroupinfo.Allowdelpost == 1;
                admingroupright.Items[3].Selected = __admingroupinfo.Allowmassprune == 1;
                admingroupright.Items[4].Selected = __admingroupinfo.Allowviewip == 1;
                admingroupright.Items[5].Selected = __admingroupinfo.Allowedituser == 1;
                admingroupright.Items[6].Selected = __admingroupinfo.Allowviewlog == 1;
                admingroupright.Items[7].Selected = __admingroupinfo.Disablepostctrl == 1;
                admingroupright.Items[8].Selected = __admingroupinfo.Allowviewrealname == 1;
                admingroupright.Items[9].Selected = __admingroupinfo.Allowbanuser == 1;
                admingroupright.Items[10].Selected = __admingroupinfo.Allowbanip == 1;
                GeneralConfigInfo configinfo = GeneralConfigs.Deserialize(Server.MapPath("../../config/general.config"));
                admingroupright.Items[11].Selected = ("," + configinfo.Reportusergroup + ",").IndexOf("," + groupid + ",") != -1; //是否允许接收举报信息
                admingroupright.Items[12].Selected = ("," + configinfo.Photomangegroups + ",").IndexOf("," + groupid + ",") != -1;//是否允许管理图片评论
                if (__admingroupinfo.Allowstickthread.ToString() != "") allowstickthread.SelectedValue = __admingroupinfo.Allowstickthread.ToString();

            }

            if (radminid.SelectedValue == "1")
            {
                allowstickthread.Enabled = false;
                allowstickthread.SelectedValue = "3";
            }

            #endregion
        }
        public void LoadUserGroupInf(int groupid)
        {
            #region 加载相关组信息

            userGroupInfo = AdminUserGroups.AdminGetUserGroupInfo(groupid);

            groupTitle.Text = Utils.RemoveFontTag(userGroupInfo.Grouptitle);

            stars.Text = userGroupInfo.Stars.ToString();
            color.Text = userGroupInfo.Color;
            groupavatar.Text = userGroupInfo.Groupavatar;
            readaccess.Text = userGroupInfo.Readaccess.ToString();
            maxprice.Text = userGroupInfo.Maxprice.ToString();
            maxpmnum.Text = userGroupInfo.Maxpmnum.ToString();
            maxsigsize.Text = userGroupInfo.Maxsigsize.ToString();
            maxattachsize.Text = userGroupInfo.Maxattachsize.ToString();
            maxsizeperday.Text = userGroupInfo.Maxsizeperday.ToString();
            maxspaceattachsize.Text = userGroupInfo.Maxspaceattachsize.ToString();
            maxspacephotosize.Text = userGroupInfo.Maxspacephotosize.ToString();
            //maxfriendscount.Text = userGroupInfo.MaxFriendsCount.ToString();

            radminid.SelectedValue = userGroupInfo.Radminid == -1 ? "0" : userGroupInfo.Radminid.ToString();
            ViewState["radminid"] = userGroupInfo.Radminid;

            //DataTable dt = DbHelper.ExecuteDataset("Select id,extension  From [" + BaseConfigs.GetTablePrefix + "attachtypes]  Order By [id] ASC").Tables[0];
            DataTable dt = Attachments.GetAttachmentType();
            attachextensions.SetSelectByID(userGroupInfo.Attachextensions.Trim());

            //设置用户权限组初始化信息
            //if (__usergroupinfo.Allowvisit == 1) usergroupright.Items[0].Selected = true;
            //if (__usergroupinfo.Allowpost == 1) usergroupright.Items[1].Selected = true;
            //if (__usergroupinfo.Allowreply == 1) usergroupright.Items[2].Selected = true;
            //if (__usergroupinfo.Allowpostpoll == 1) usergroupright.Items[3].Selected = true;
            //if (__usergroupinfo.Allowgetattach == 1) usergroupright.Items[4].Selected = true;
            //if (__usergroupinfo.Allowpostattach == 1) usergroupright.Items[5].Selected = true;
            //if (__usergroupinfo.Allowvote == 1) usergroupright.Items[6].Selected = true;
            //if (__usergroupinfo.Allowsetreadperm == 1) usergroupright.Items[7].Selected = true;
            //if (__usergroupinfo.Allowsetattachperm == 1) usergroupright.Items[8].Selected = true;
            //if (__usergroupinfo.Allowhidecode == 1) usergroupright.Items[9].Selected = true;
            //if (__usergroupinfo.Allowcusbbcode == 1) usergroupright.Items[10].Selected = true;
            //if (__usergroupinfo.Allowsigbbcode == 1) usergroupright.Items[11].Selected = true;
            //if (__usergroupinfo.Allowsigimgcode == 1) usergroupright.Items[12].Selected = true;
            //if (__usergroupinfo.Allowviewpro == 1) usergroupright.Items[13].Selected = true;
            //if (__usergroupinfo.Disableperiodctrl == 1) usergroupright.Items[14].Selected = true;

            //if (__usergroupinfo.Allowsearch.ToString() == "0") allowsearch.Items[0].Selected = true;
            //if (__usergroupinfo.Allowsearch.ToString() == "1") allowsearch.Items[1].Selected = true;
            //if (__usergroupinfo.Allowsearch.ToString() == "2") allowsearch.Items[2].Selected = true;

            //if (__usergroupinfo.Allowavatar >= 0) allowavatar.Items[__usergroupinfo.Allowavatar].Selected = true;

            usergrouppowersetting.Bind(userGroupInfo);
            if (userGroupInfo.System == 1) DeleteUserGroupInf.Enabled = false;

            #endregion
        }
示例#7
0
        protected override void ShowPage()
        {
            pagetitle = "查看用户信息";

            if (usergroupinfo.Allowviewpro != 1)
            {
                AddErrLine(string.Format("您当前的身份 \"{0}\" 没有查看用户资料的权限", usergroupinfo.Grouptitle));
                if (userid < 1)
                    needlogin = true;

                return;
            }

            if (DNTRequest.GetString("username").Trim() == "" && DNTRequest.GetString("userid").Trim() == "")
            {
                AddErrLine("错误的URL链接");
                return;
            }


            int id = DNTRequest.GetInt("userid", -1);
            if (id == -1)
                id = Users.GetUserId(Utils.UrlDecode(DNTRequest.GetString("username")));

            if (id == -1)
            {
                AddErrLine("该用户不存在");
                return;
            }

            user = Users.GetUserInfo(id);
            if (user == null)
            {
                AddErrLine("该用户不存在");
                return;
            }

            //用户设定Email保密时,清空用户的Email属性以避免被显示
            if (user.Showemail != 1 && id != userid)
                user.Email = "";

            //获取积分机制和用户组信息,底层有缓存
            score = Scoresets.GetValidScoreName();
            group = UserGroups.GetUserGroupInfo(user.Groupid);
            admininfo = AdminUserGroups.AdminGetAdminGroupInfo(usergroupid);
            score1 = ((decimal)user.Extcredits1).ToString();
            score2 = ((decimal)user.Extcredits2).ToString();
            score3 = ((decimal)user.Extcredits3).ToString();
            score4 = ((decimal)user.Extcredits4).ToString();
            score5 = ((decimal)user.Extcredits5).ToString();
            score6 = ((decimal)user.Extcredits6).ToString();
            score7 = ((decimal)user.Extcredits7).ToString();
            score8 = ((decimal)user.Extcredits8).ToString();
        }
示例#8
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;
        }
示例#9
0
		protected override void ShowPage()
		{
			pagetitle = "查看用户信息";
			
			if (usergroupinfo.Allowviewpro != 1)
			{
				AddErrLine(string.Format("您当前的身份 \"{0}\" 没有查看用户资料的权限", usergroupinfo.Grouptitle));
                if (userid < 1)
                    needlogin = true;
				return;
			}

			if (DNTRequest.GetString("username").Trim() == "" && DNTRequest.GetString("userid").Trim() == "")
			{
				AddErrLine("错误的URL链接");
				return;
			}

			int id = DNTRequest.GetInt("userid", -1);
			
			if (id == -1)
			{
				id = Discuz.Forum.Users.GetUserID(Utils.UrlDecode(DNTRequest.GetString("username")));
			}

			if (id == -1)
			{
				AddErrLine("该用户不存在");
				return;
			}

			user = Discuz.Forum.Users.GetUserInfo(id);
			if (user == null)
			{
				AddErrLine("该用户不存在");
				return;
			}

			//用户设定Email保密时,清空用户的Email属性以避免被显示
			if (user.Showemail != 1)
			{
				user.Email = "";
			}
			//获取金币机制和用户组信息,底层有缓存
            score = Scoresets.GetValidScoreName();
			group = UserGroups.GetUserGroupInfo(user.Groupid);
            admininfo = AdminUserGroups.AdminGetAdminGroupInfo(usergroupid);
            
		}
        public void Bind(UserGroupInfo usergroupinfo)
        {
            if (usergroupinfo.Allowsearch.ToString() == "0") allowsearch.Items[0].Selected = true;
            if (usergroupinfo.Allowsearch.ToString() == "1") allowsearch.Items[1].Selected = true;
            if (usergroupinfo.Allowsearch.ToString() == "2") allowsearch.Items[2].Selected = true;

            //if (usergroupinfo.Allowavatar >= 0) allowavatar.Items[usergroupinfo.Allowavatar].Selected = true;
            reasonpm.Items[usergroupinfo.Reasonpm].Selected = true;

            if (usergroupinfo.Allowvisit == 1) usergroupright.Items[0].Selected = true; //是否允许访问论坛
            if (usergroupinfo.Allowpost == 1) usergroupright.Items[1].Selected = true; //是否允许发帖
            if (usergroupinfo.Allowreply == 1) usergroupright.Items[2].Selected = true; //是否允许回复
            if (usergroupinfo.Allowpostpoll == 1) usergroupright.Items[3].Selected = true; //是否允许发起投票
            if (usergroupinfo.Allowvote == 1) usergroupright.Items[4].Selected = true; //是否允许参与投票
            if (usergroupinfo.Allowpostattach == 1) usergroupright.Items[5].Selected = true; //是否发布附件
            if (usergroupinfo.Allowgetattach == 1) usergroupright.Items[6].Selected = true; //是否允许下载附件
            if (usergroupinfo.Allowsetreadperm == 1) usergroupright.Items[7].Selected = true; //是否允许设置主题阅读积分权限
            if (usergroupinfo.Allowsetattachperm == 1) usergroupright.Items[8].Selected = true; //是否允许设置附件阅读积分限制
            if (usergroupinfo.Allowhidecode == 1) usergroupright.Items[9].Selected = true; //是否允许使用hide代码
            if (usergroupinfo.Allowcusbbcode == 1) usergroupright.Items[10].Selected = true; //是否允许使用Discuz!NT代码
            if (usergroupinfo.Allowsigbbcode == 1) usergroupright.Items[11].Selected = true; //签名是否支持Discuz!NT代码
            if (usergroupinfo.Allowsigimgcode == 1) usergroupright.Items[12].Selected = true; //签名是否支持图片代码
            if (usergroupinfo.Allowviewpro == 1) usergroupright.Items[13].Selected = true; //是否允许查看用户资料
            if (usergroupinfo.Disableperiodctrl == 1) usergroupright.Items[14].Selected = true; //是否不受时间段限制
            if (usergroupinfo.Allowdebate == 1) usergroupright.Items[15].Selected = true; //是否允许辩论
            if (usergroupinfo.Allowbonus == 1) usergroupright.Items[16].Selected = true; //是否允许悬赏
            if (usergroupinfo.Allowviewstats == 1) usergroupright.Items[17].Selected = true; //是否允许查看统计数据
            if (usergroupinfo.Allowdiggs == 1) usergroupright.Items[18].Selected = true; //是否允许辩论支持
            if (usergroupinfo.Allowhtmltitle == 1) usergroupright.Items[19].Selected = true;//是否允许html标题
            if (usergroupinfo.Allowhtml == 1) usergroupright.Items[20].Selected = true; //是否允许html
            if (usergroupinfo.ModNewTopics == 1) usergroupright.Items[21].Selected = true;//发主题是否需要审核
            if (usergroupinfo.ModNewPosts == 1) usergroupright.Items[22].Selected = true;//发回复是否需要审核
            if (usergroupinfo.Ignoreseccode == 1) usergroupright.Items[23].Selected = true;//是否允许忽略检测验证码
            if (MallPluginProvider.GetInstance() != null && usergroupinfo.Allowtrade == 1) usergroupright.Items[usergroupright.Items.Count - 1].Selected = true; //是否允许交易

            string strScript = "<script type='text/javascript'>\r\nfunction insertBonusPrice()\r\n{\r\n\t";
            strScript += "\r\n\tvar tdelement = document.getElementById('" + usergroupright.ClientID + "_16').parentNode;";
            strScript += "\r\n\ttdelement.innerHTML += '&nbsp;最低悬赏价格:<input type=\"text\" name=\"minbonusprice\" id=\"minbonusprice\" class=\"FormBase\" onblur=\"this.className=\\'FormBase\\';\" onfocus=\"this.className=\\'FormFocus\\';\" size=\"4\" maxlength=\"5\" value=\"" + usergroupinfo.Minbonusprice + "\"" + (usergroupinfo.Allowbonus == 0 ? " disabled=\"disabled \"" : "") + " />'";
            strScript += "\r\n\ttdelement.innerHTML += '&nbsp;最高悬赏价格:<input type=\"text\" name=\"maxbonusprice\" id=\"maxbonusprice\" class=\"FormBase\" onblur=\"this.className=\\'FormBase\\';\" onfocus=\"this.className=\\'FormFocus\\';\" size=\"4\" maxlength=\"5\" value=\"" + usergroupinfo.Maxbonusprice + "\"" + (usergroupinfo.Allowbonus == 0 ? " disabled=\"disabled \"" : "") + " />'";
            strScript += "\r\n}\r\ninsertBonusPrice();\r\n</script>\r\n";
            outscript.Text = strScript;
            usergroupright.Items[16].Attributes.Add("onclick", "bonusPriceSet(this.checked)");
        }
        public void LoadUserGroupInf(int groupid)
        {
            #region 加载相关组信息

            userGroupInfo = AdminUserGroups.AdminGetUserGroupInfo(groupid);

            groupTitle.Text = Utils.RemoveFontTag(userGroupInfo.Grouptitle);
            creditshigher.Text = userGroupInfo.Creditshigher.ToString();
            creditslower.Text = userGroupInfo.Creditslower.ToString();

            DataTable dt = UserGroups.GetUserGroupExceptGroupid(groupid);
            if (dt.Rows.Count == 0)
            {
                creditshigher.Enabled = false;
                creditslower.Enabled = false;
            }

            ViewState["creditshigher"] = userGroupInfo.Creditshigher.ToString();
            ViewState["creditslower"] = userGroupInfo.Creditslower.ToString();

            stars.Text = userGroupInfo.Stars.ToString();
            color.Text = userGroupInfo.Color;
            groupavatar.Text = userGroupInfo.Groupavatar;
            readaccess.Text = userGroupInfo.Readaccess.ToString();
            maxprice.Text = userGroupInfo.Maxprice.ToString();
            maxpmnum.Text = userGroupInfo.Maxpmnum.ToString();
            maxsigsize.Text = userGroupInfo.Maxsigsize.ToString();
            maxattachsize.Text = userGroupInfo.Maxattachsize.ToString();
            maxsizeperday.Text = userGroupInfo.Maxsizeperday.ToString();
            maxspaceattachsize.Text = userGroupInfo.Maxspaceattachsize.ToString();
            maxspacephotosize.Text = userGroupInfo.Maxspacephotosize.ToString();
            //maxfriendscount.Text = userGroupInfo.MaxFriendsCount.ToString();


            dt = Attachments.GetAttachmentType();
            attachextensions.SetSelectByID(userGroupInfo.Attachextensions.Trim());
            //绑定权限信息
            usergrouppowersetting.Bind(userGroupInfo);

            if (userGroupInfo.System == 1) DeleteUserGroupInf.Enabled = false;

            #endregion
        }
示例#12
0
        /// <summary>
        /// 绑定附件数组中的参数,返回新上传的附件个数
        /// </summary>
        /// <param name="attachmentInfo">提交的附件列表</param>
        /// <param name="topicId">当前主题id</param>
        /// <param name="postId">当前帖子id</param>
        /// <param name="userId">当前用户id</param>
        /// <param name="userGroupInfo">当前用户用户组</param>
        /// <returns></returns>
        public static int BindAttachment(AttachmentInfo[] attachmentInfo, int topicId, int postId, int userId, UserGroupInfo userGroupInfo)
        {
            //附件阅读权限
            //string[] readperm = String.IsNullOrEmpty(DNTRequest.GetString("readperm")) ? null : DNTRequest.GetString("readperm").Split(',');
            //string[] attachdesc = DNTRequest.GetString("attachdesc") == null ? null : DNTRequest.GetString("attachdesc").Split(',');
            //string[] localid = DNTRequest.GetString("localid") == null ? null : DNTRequest.GetString("localid").Split(',');
            ////附件价格
            //string[] attachprice = DNTRequest.GetString("attachprice") == null ? null : DNTRequest.GetString("attachprice").Split(',');

            int newAttachCount = 0;
            int i_readperm = 0;

            for (int i = 0; i < attachmentInfo.Length; i++)
            {
                if (attachmentInfo[i] == null)
                    continue;

                if (attachmentInfo[i].Pid == 0)//如果附件pid=0,就代表它是新上传的附件
                    newAttachCount++;
                string aid = attachmentInfo[i].Aid.ToString();
                attachmentInfo[i].Uid = userId;
                attachmentInfo[i].Tid = topicId;
                attachmentInfo[i].Pid = postId;
                attachmentInfo[i].Postdatetime = Utils.GetDateTime();
                attachmentInfo[i].Readperm = 0;
                //attachmentInfo[i].Attachprice = attachprice != null ? UserGroups.CheckUserGroupMaxPrice(userGroupInfo, Utils.StrToInt(attachprice[i], 0)) : 0;
                int attachprice = Utils.StrToInt(DNTRequest.GetString("attachprice_" + aid),0);
                attachmentInfo[i].Attachprice = attachprice == 0 ? 0 : UserGroups.CheckUserGroupMaxPrice(userGroupInfo, attachprice);
                int readperm = Utils.StrToInt(DNTRequest.GetString("readperm_" + aid), 0);
                if (readperm != 0)
                {
                    i_readperm = readperm;
                    //当为最大阅读仅限(255)时
                    i_readperm = i_readperm > 255 ? 255 : i_readperm;
                    attachmentInfo[i].Readperm = i_readperm;
                }
                //if (attachdesc != null && !attachdesc[i].Equals(""))
                    attachmentInfo[i].Description = Utils.HtmlEncode(DNTRequest.GetString("attachdesc_" + aid));
            }
            return newAttachCount;
        }
示例#13
0
        public void LoadUserGroupInf(int groupid)
        {
            #region 加载相关组信息

            __usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(groupid);

            groupTitle.Text = Utils.RemoveFontTag(__usergroupinfo.Grouptitle);
            creditshigher.Text = __usergroupinfo.Creditshigher.ToString();
            creditslower.Text = __usergroupinfo.Creditslower.ToString();

            DataTable dt = DatabaseProvider.GetInstance().GetUserGroupExceptGroupid(groupid);
            if (dt.Rows.Count == 0)
            {
                creditshigher.Enabled = false;
                creditslower.Enabled = false;
            }

            ViewState["creditshigher"] = __usergroupinfo.Creditshigher.ToString();
            ViewState["creditslower"] = __usergroupinfo.Creditslower.ToString();

            stars.Text = __usergroupinfo.Stars.ToString();
            color.Text = __usergroupinfo.Color;
            groupavatar.Text = __usergroupinfo.Groupavatar;
            readaccess.Text = __usergroupinfo.Readaccess.ToString();
            maxprice.Text = __usergroupinfo.Maxprice.ToString();
            maxpmnum.Text = __usergroupinfo.Maxpmnum.ToString();
            maxsigsize.Text = __usergroupinfo.Maxsigsize.ToString();
            maxattachsize.Text = __usergroupinfo.Maxattachsize.ToString();
            maxsizeperday.Text = __usergroupinfo.Maxsizeperday.ToString();

            dt = DatabaseProvider.GetInstance().GetAttchType().Tables[0];
            attachextensions.SetSelectByID(__usergroupinfo.Attachextensions.Trim());
            //绑定权限信息
            usergrouppowersetting.Bind(__usergroupinfo);

            if (__usergroupinfo.System == 1) DeleteUserGroupInf.Enabled = false;

            #endregion
        }
示例#14
0
        public void GetSetting(ref UserGroupInfo usergroupinfo)
        {
            usergroupinfo.Allowsearch = Convert.ToInt32(allowsearch.SelectedValue);
            usergroupinfo.Allowavatar = Convert.ToInt32(allowavatar.SelectedValue);
            usergroupinfo.Reasonpm = Convert.ToInt32(reasonpm.SelectedValue);

            usergroupinfo.Allowvisit = usergroupright.Items[0].Selected ? 1 : 0; //是否允许访问论坛
            usergroupinfo.Allowpost = usergroupright.Items[1].Selected ? 1 : 0; //是否允许发帖
            usergroupinfo.Allowreply = usergroupright.Items[2].Selected ? 1 : 0; //是否允许回复
            usergroupinfo.Allowpostpoll = usergroupright.Items[3].Selected ? 1 : 0; //是否允许发起投票
            usergroupinfo.Allowvote = usergroupright.Items[4].Selected ? 1 : 0; //是否允许参与投票
            usergroupinfo.Allowpostattach = usergroupright.Items[5].Selected ? 1 : 0; //是否发布附件
            usergroupinfo.Allowgetattach = usergroupright.Items[6].Selected ? 1 : 0; //是否允许下载附件
            usergroupinfo.Allowsetreadperm = usergroupright.Items[7].Selected ? 1 : 0; //是否允许设置主题阅读金币权限
            usergroupinfo.Allowsetattachperm = usergroupright.Items[8].Selected ? 1 : 0; //是否允许设置附件阅读金币限制
            usergroupinfo.Allowhidecode = usergroupright.Items[9].Selected ? 1 : 0; //是否允许使用hide代码
            usergroupinfo.Allowcusbbcode = usergroupright.Items[10].Selected ? 1 : 0; //是否允许使用Discuz!NT代码
            usergroupinfo.Allowsigbbcode = usergroupright.Items[11].Selected ? 1 : 0; //签名是否支持Discuz!NT代码
            usergroupinfo.Allowsigimgcode = usergroupright.Items[12].Selected ? 1 : 0; //签名是否支持图片代码
            usergroupinfo.Allowviewpro = usergroupright.Items[13].Selected ? 1 : 0; //是否允许查看用户资料
            usergroupinfo.Disableperiodctrl = usergroupright.Items[14].Selected ? 1 : 0; //是否不受时间段限制

            usergroupinfo.Allowdebate = usergroupright.Items[15].Selected ? 1 : 0; //是否允许辩论
            usergroupinfo.Allowbonus = usergroupright.Items[16].Selected ? 1 : 0; //是否允许悬赏
            //如果勾选允许悬赏
            if (usergroupright.Items[16].Selected)
            {
                usergroupinfo.Minbonusprice = DNTRequest.GetInt("minbonusprice", 0);
                usergroupinfo.Maxbonusprice = DNTRequest.GetInt("maxbonusprice", 0);
            }
            else
            {
                usergroupinfo.Minbonusprice = 0;
                usergroupinfo.Maxbonusprice = 0;
            }
            usergroupinfo.Allowviewstats = usergroupright.Items[17].Selected ? 1 : 0; //是否允许查看统计数据
            usergroupinfo.Allowdiggs = usergroupright.Items[18].Selected ? 1 : 0;   //是否允许辩论支持
        }
示例#15
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;
 }
        public void LoadUserGroupInf(int groupid)
        {
            #region 加载相关组信息

            userGroupInfo = AdminUserGroups.AdminGetUserGroupInfo(groupid);

            groupTitle.Text = Utils.RemoveFontTag(userGroupInfo.Grouptitle);
            creditshigher.Text = userGroupInfo.Creditshigher.ToString();
            creditslower.Text = userGroupInfo.Creditslower.ToString();
            stars.Text = userGroupInfo.Stars.ToString();
            color.Text = userGroupInfo.Color;
            groupavatar.Text = userGroupInfo.Groupavatar;
            readaccess.Text = userGroupInfo.Readaccess.ToString();
            maxprice.Text = userGroupInfo.Maxprice.ToString();
            maxpmnum.Text = userGroupInfo.Maxpmnum.ToString();
            maxsigsize.Text = userGroupInfo.Maxsigsize.ToString();
            maxattachsize.Text = userGroupInfo.Maxattachsize.ToString();
            maxsizeperday.Text = userGroupInfo.Maxsizeperday.ToString();
            maxspaceattachsize.Text = userGroupInfo.Maxspaceattachsize.ToString();
            maxspacephotosize.Text = userGroupInfo.Maxspacephotosize.ToString();

            attachextensions.SetSelectByID(userGroupInfo.Attachextensions.Trim());

            if (groupid > 0 && groupid <= 3) radminid.Enabled = false;
            radminid.SelectedValue = userGroupInfo.Radminid.ToString();

            usergrouppowersetting.Bind(userGroupInfo);

            if (radminid.SelectedValue == "1")
            {
                allowstickthread.Enabled = false;
                allowstickthread.SelectedValue = "3";
            }

            #endregion
        }
示例#17
0
 public static string GetPostMessage(UserGroupInfo usergroupinfo, AdminGroupInfo adminGroupInfo, string postmessage, bool ishtmlon)
 {
     string message;
     if (adminGroupInfo != null && adminGroupInfo.Admingid == 1)
     {
         if (usergroupinfo.Allowhtml == 0)
             message = Utils.HtmlEncode(postmessage);
         else
             message = ishtmlon ? postmessage : Utils.HtmlEncode(postmessage);
     }
     else
     {
         if (usergroupinfo.Allowhtml == 0)
             message = Utils.HtmlEncode(ForumUtils.BanWordFilter(postmessage));
         else
             message = ishtmlon ? ForumUtils.BanWordFilter(postmessage) : Utils.HtmlEncode(ForumUtils.BanWordFilter(postmessage));
     }
     return message;
 }
        private void UpdateUserGroupInf_Click(object sender, EventArgs e)
        {
            #region 更新系统管理组信息

            if (this.CheckCookie())
            {
                userGroupInfo = AdminUserGroups.AdminGetUserGroupInfo(DNTRequest.GetInt("groupid", -1));
                userGroupInfo.System = 0;
                userGroupInfo.Type = 0;
                userGroupInfo.Readaccess = Convert.ToInt32(readaccess.Text);
                userGroupInfo.Allowviewstats = 0;
                userGroupInfo.Allownickname = 0;
                userGroupInfo.Allowhtml = 0;
                userGroupInfo.Allowcstatus = 0;
                userGroupInfo.Allowuseblog = 0;
                userGroupInfo.Allowinvisible = 0;
                userGroupInfo.Allowtransfer = 0;
                userGroupInfo.Allowmultigroups = 0;
                userGroupInfo.Reasonpm = 0;

                //if (radminid.SelectedValue == "0") //当未选取任何管理模板时
                //{
                //    Discuz.Forum.AdminGroups.DeleteAdminGroupInfo((short)userGroupInfo.Groupid);
                //    userGroupInfo.Radminid = 0;
                //}

                Users.UpdateUserAdminIdByGroupId(userGroupInfo.Radminid, userGroupInfo.Groupid);
                userGroupInfo.Grouptitle = groupTitle.Text;
                userGroupInfo.Creditshigher = Convert.ToInt32(creditshigher.Text);
                userGroupInfo.Creditslower = Convert.ToInt32(creditslower.Text);
                userGroupInfo.Stars = Convert.ToInt32(stars.Text);
                userGroupInfo.Color = color.Text;
                userGroupInfo.Groupavatar = groupavatar.Text;
                userGroupInfo.Maxprice = Convert.ToInt32(maxprice.Text);
                userGroupInfo.Maxpmnum = Convert.ToInt32(maxpmnum.Text);
                userGroupInfo.Maxsigsize = Convert.ToInt32(maxsigsize.Text);
                userGroupInfo.Maxattachsize = Convert.ToInt32(maxattachsize.Text);
                userGroupInfo.Maxsizeperday = Convert.ToInt32(maxsizeperday.Text);
                userGroupInfo.Maxspaceattachsize = Convert.ToInt32(maxspaceattachsize.Text);
                userGroupInfo.Maxspacephotosize = Convert.ToInt32(maxspacephotosize.Text);
                userGroupInfo.Attachextensions = attachextensions.GetSelectString(",");

                usergrouppowersetting.GetSetting(ref userGroupInfo);

                if (AdminUserGroups.UpdateUserGroupInfo(userGroupInfo))
                {
                    Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList");
                    Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/AdminGroupList");
                    AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台更新系统组", "组ID:" + DNTRequest.GetInt("groupid", -1));
                    base.RegisterStartupScript( "PAGE",  "window.location.href='global_sysadminusergroupgrid.aspx';");
                }
                else
                {
                    base.RegisterStartupScript( "", "<script>alert('操作失败');window.location.href='global_sysadminusergroupgrid.aspx';</script>");
                }
            }

            #endregion
        }
示例#19
0
 public void UpdateUserGroup(UserGroupInfo userGroupInfo)
 {
     DbParameter[] parms =
             {
                 DbHelper.MakeInParam("@Radminid",(DbType)SqlDbType.Int,4,(userGroupInfo.Groupid == 1) ? 1 : userGroupInfo.Radminid),
                 DbHelper.MakeInParam("@Grouptitle",(DbType)SqlDbType.NVarChar,50, Utils.RemoveFontTag(userGroupInfo.Grouptitle)),
                 DbHelper.MakeInParam("@Creditshigher",(DbType)SqlDbType.Int,4,userGroupInfo.Creditshigher),
                 DbHelper.MakeInParam("@Creditslower",(DbType)SqlDbType.Int,4, userGroupInfo.Creditslower),
                 DbHelper.MakeInParam("@Stars",(DbType)SqlDbType.Int,4,userGroupInfo.Stars),
                 DbHelper.MakeInParam("@Color",(DbType)SqlDbType.Char,7,userGroupInfo.Color),
                 DbHelper.MakeInParam("@Groupavatar",(DbType)SqlDbType.NVarChar,60,userGroupInfo.Groupavatar),
                 DbHelper.MakeInParam("@Readaccess",(DbType)SqlDbType.Int,4,userGroupInfo.Readaccess),
                 DbHelper.MakeInParam("@Allowvisit",(DbType)SqlDbType.Int,4,userGroupInfo.Allowvisit),
                 DbHelper.MakeInParam("@Allowpost",(DbType)SqlDbType.Int,4,userGroupInfo.Allowpost),
                 DbHelper.MakeInParam("@Allowreply",(DbType)SqlDbType.Int,4,userGroupInfo.Allowreply),
                 DbHelper.MakeInParam("@Allowpostpoll",(DbType)SqlDbType.Int,4,userGroupInfo.Allowpostpoll),
                 DbHelper.MakeInParam("@Allowdirectpost",(DbType)SqlDbType.Int,4,userGroupInfo.Allowdirectpost),
                 DbHelper.MakeInParam("@Allowgetattach",(DbType)SqlDbType.Int,4,userGroupInfo.Allowgetattach),
                 DbHelper.MakeInParam("@Allowpostattach",(DbType)SqlDbType.Int,4,userGroupInfo.Allowpostattach),
                 DbHelper.MakeInParam("@Allowvote",(DbType)SqlDbType.Int,4,userGroupInfo.Allowvote),
                 DbHelper.MakeInParam("@Allowmultigroups",(DbType)SqlDbType.Int,4,userGroupInfo.Allowmultigroups),
                 DbHelper.MakeInParam("@Allowsearch",(DbType)SqlDbType.Int,4,userGroupInfo.Allowsearch),
                 DbHelper.MakeInParam("@Allowavatar",(DbType)SqlDbType.Int,4,userGroupInfo.Allowavatar),
                 DbHelper.MakeInParam("@Allowcstatus",(DbType)SqlDbType.Int,4,userGroupInfo.Allowcstatus),
                 DbHelper.MakeInParam("@Allowuseblog",(DbType)SqlDbType.Int,4,userGroupInfo.Allowuseblog),
                 DbHelper.MakeInParam("@Allowinvisible",(DbType)SqlDbType.Int,4,userGroupInfo.Allowinvisible),
                 DbHelper.MakeInParam("@Allowtransfer",(DbType)SqlDbType.Int,4,userGroupInfo.Allowtransfer),
                 DbHelper.MakeInParam("@Allowsetreadperm",(DbType)SqlDbType.Int,4,userGroupInfo.Allowsetreadperm),
                 DbHelper.MakeInParam("@Allowsetattachperm",(DbType)SqlDbType.Int,4,userGroupInfo.Allowsetattachperm),
                 DbHelper.MakeInParam("@Allowhidecode",(DbType)SqlDbType.Int,4,userGroupInfo.Allowhidecode),
                 DbHelper.MakeInParam("@Allowhtml",(DbType)SqlDbType.Int,4,userGroupInfo.Allowhtml),
                 DbHelper.MakeInParam("@Allowhtmltitle",(DbType)SqlDbType.Int,4,userGroupInfo.Allowhtmltitle),
                 DbHelper.MakeInParam("@Allowcusbbcode",(DbType)SqlDbType.Int,4,userGroupInfo.Allowcusbbcode),
                 DbHelper.MakeInParam("@Allownickname",(DbType)SqlDbType.Int,4,userGroupInfo.Allownickname),
                 DbHelper.MakeInParam("@Allowsigbbcode",(DbType)SqlDbType.Int,4,userGroupInfo.Allowsigbbcode),
                 DbHelper.MakeInParam("@Allowsigimgcode",(DbType)SqlDbType.Int,4,userGroupInfo.Allowsigimgcode),
                 DbHelper.MakeInParam("@Allowviewpro",(DbType)SqlDbType.Int,4,userGroupInfo.Allowviewpro),
                 DbHelper.MakeInParam("@Allowviewstats",(DbType)SqlDbType.Int,4,userGroupInfo.Allowviewstats),
                 DbHelper.MakeInParam("@Allowtrade",(DbType)SqlDbType.Int,4,userGroupInfo.Allowtrade),
                 DbHelper.MakeInParam("@Allowdiggs",(DbType)SqlDbType.Int,4,userGroupInfo.Allowdiggs),
                 DbHelper.MakeInParam("@Disableperiodctrl",(DbType)SqlDbType.Int,4,userGroupInfo.Disableperiodctrl),
                 DbHelper.MakeInParam("@Allowdebate",(DbType)SqlDbType.Int,4,userGroupInfo.Allowdebate),
                 DbHelper.MakeInParam("@Allowbonus",(DbType)SqlDbType.Int,4,userGroupInfo.Allowbonus),
                 DbHelper.MakeInParam("@Minbonusprice",(DbType)SqlDbType.Int,4,userGroupInfo.Minbonusprice),
                 DbHelper.MakeInParam("@Maxbonusprice",(DbType)SqlDbType.Int,4,userGroupInfo.Maxbonusprice),
                 DbHelper.MakeInParam("@Reasonpm",(DbType)SqlDbType.Int,4,userGroupInfo.Reasonpm),
                 DbHelper.MakeInParam("@Maxprice",(DbType)SqlDbType.SmallInt,2,userGroupInfo.Maxprice),
                 DbHelper.MakeInParam("@Maxpmnum",(DbType)SqlDbType.SmallInt,2,userGroupInfo.Maxpmnum),
                 DbHelper.MakeInParam("@Maxsigsize",(DbType)SqlDbType.SmallInt,2,userGroupInfo.Maxsigsize),
                 DbHelper.MakeInParam("@Maxattachsize",(DbType)SqlDbType.Int,4,userGroupInfo.Maxattachsize),
                 DbHelper.MakeInParam("@Maxsizeperday",(DbType)SqlDbType.Int,4,userGroupInfo.Maxsizeperday),
                 DbHelper.MakeInParam("@Attachextensions",(DbType)SqlDbType.Char,100,userGroupInfo.Attachextensions),
                 DbHelper.MakeInParam("@Maxspaceattachsize",(DbType)SqlDbType.Int,4,userGroupInfo.Maxspaceattachsize),
                 DbHelper.MakeInParam("@Maxspacephotosize",(DbType)SqlDbType.Int,4,userGroupInfo.Maxspacephotosize),
                 DbHelper.MakeInParam("@Groupid",(DbType)SqlDbType.Int,4,userGroupInfo.Groupid),
                 //DbHelper.MakeInParam("@Maxfriendscount",(DbType)SqlDbType.Int,4,userGroupInfo.MaxFriendsCount),
                 DbHelper.MakeInParam("@ModNewTopics",(DbType)SqlDbType.SmallInt,2,userGroupInfo.ModNewTopics),
                 DbHelper.MakeInParam("@ModNewPosts",(DbType)SqlDbType.SmallInt,2,userGroupInfo.ModNewPosts),
                 DbHelper.MakeInParam("@Ignoreseccode",(DbType)SqlDbType.Int,4,userGroupInfo.Ignoreseccode)
     };
     DbHelper.ExecuteNonQuery(CommandType.StoredProcedure, string.Format("{0}updateusergroup", BaseConfigs.GetTablePrefix), parms);
 }
示例#20
0
 public void UpdateOnlineList(UserGroupInfo userGroupInfo)
 {
     DbParameter[] parms = {
                                 DbHelper.MakeInParam("@groupid", (DbType)SqlDbType.Int, 4, userGroupInfo.Groupid),
                                 DbHelper.MakeInParam("@title", (DbType)SqlDbType.NVarChar, 50, Utils.RemoveFontTag(userGroupInfo.Grouptitle))
                             };
     DbHelper.ExecuteNonQueryInMasterDB(CommandType.StoredProcedure, string.Format("{0}updateonlinelist", BaseConfigs.GetTablePrefix), parms);
 }
示例#21
0
 public void UpdateOnlineList(UserGroupInfo userGroupInfo)
 {
     DbParameter[] parms = { 
                                 DbHelper.MakeInParam("@groupid", (DbType)SqlDbType.Int, 4, userGroupInfo.Groupid),
                                 DbHelper.MakeInParam("@title", (DbType)SqlDbType.NVarChar, 50, Utils.RemoveFontTag(userGroupInfo.Grouptitle))
                             };
     string commandText = string.Format("UPDATE [{0}onlinelist] SET [title]=@title WHERE [groupid]=@groupid", BaseConfigs.GetTablePrefix);
     DbHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
 }
示例#22
0
        /// <summary>
        /// 搜索权限判断
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="lastsearchtime"></param>
        /// <param name="useradminid"></param>
        /// <param name="usergroupinfo"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static bool Search(int userid, string lastsearchtime, int useradminid, UserGroupInfo usergroupinfo, ref string msg)
        {
            // 如果当前用户非管理员并且论坛设定了禁止全文搜索时间段,当前时间如果在其中的一个时间段内,不允许全文搜索
            if (useradminid != 1 && DNTRequest.GetInt("keywordtype", 0) == 1 && usergroupinfo.Disableperiodctrl != 1)
            {
                string visittime = "";
                if (Scoresets.BetweenTime(GeneralConfigs.GetConfig().Searchbanperiods, out visittime))
                {
                    msg = "在此时间段( " + visittime + " )内用户不可以进行全文搜索";
                    return false;
                }
            }

            if (useradminid != 1)
            {
                //判断一分钟内搜索的次数是不是超过限制值
                if (!Statistics.CheckSearchCount(GeneralConfigs.GetConfig().Maxspm))
                {
                    msg = "抱歉,系统在一分钟内搜索的次数超过了系统安全设置的上限,请稍候再试";
                    return false;
                }

                int Interval = Utils.StrDateDiffSeconds(lastsearchtime, GeneralConfigs.GetConfig().Searchctrl);
                if (Interval <= 0)
                {
                    msg = "系统规定搜索间隔为" + GeneralConfigs.GetConfig().Searchctrl + "秒, 您还需要等待 " + (Interval * -1) + " 秒";
                    return false;
                }

                //不是管理员,则如果设置搜索扣积分时扣除用户积分
                if (UserCredits.UpdateUserCreditsBySearch(userid) == -1)
                {
                    string addExtCreditsTip = "";
                    if (EPayments.IsOpenEPayments())
                        addExtCreditsTip = "<br/><span><a href=\"usercpcreditspay.aspx\">点击充值积分</a></span>";
                    msg = "您的积分不足, 不能执行搜索操作" + addExtCreditsTip;
                    return false;
                }
            }
            return true;
        }
示例#23
0
        /// <summary>
        /// 搜索权限判断
        /// </summary>
        /// <param name="usergroupinfo"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static bool Search(UserGroupInfo usergroupinfo, ref string msg)
        {
            if (usergroupinfo.Allowsearch == 0)
            {
                msg = "您当前的身份 " + usergroupinfo.Grouptitle + " 没有搜索的权限";
                return false;
            }

            if (usergroupinfo.Allowsearch == 2 && DNTRequest.GetInt("keywordtype", 0) == 1)
            {
                msg = "您当前的身份 " + usergroupinfo.Grouptitle + " 没有全文搜索的权限";
                return false;
            }
            return true;
        }
示例#24
0
		public void UpdateOnlineList(UserGroupInfo usergroupinfo)
		{
			IDataParameter[] parms = { 
									  DbHelper.MakeInParam("@groupid", (DbType)SqlDbType.Int, 4, usergroupinfo.Groupid),
									  DbHelper.MakeInParam("@title", (DbType)SqlDbType.NVarChar, 50, Utils.RemoveFontTag(usergroupinfo.Grouptitle))
								  };
			string sqlstring = "UPDATE [" + BaseConfigs.GetTablePrefix + "onlinelist] SET [title]=@title WHERE [groupid]=@groupid";

			DbHelper.ExecuteNonQuery(CommandType.Text, sqlstring, parms);
		}
示例#25
0
        public void AddUserGroup(UserGroupInfo userGroupInfo)
        {
            DbParameter[] parms = 
					{
						DbHelper.MakeInParam("@Radminid",(DbType)SqlDbType.Int,4,userGroupInfo.Radminid),
						DbHelper.MakeInParam("@Grouptitle",(DbType)SqlDbType.NVarChar,50, Utils.RemoveFontTag(userGroupInfo.Grouptitle)),
						DbHelper.MakeInParam("@Creditshigher",(DbType)SqlDbType.Int,4,userGroupInfo.Creditshigher),
						DbHelper.MakeInParam("@Creditslower",(DbType)SqlDbType.Int,4,userGroupInfo.Creditslower),
						DbHelper.MakeInParam("@Stars",(DbType)SqlDbType.Int,4,userGroupInfo.Stars),
						DbHelper.MakeInParam("@Color",(DbType)SqlDbType.Char,7,userGroupInfo.Color),
						DbHelper.MakeInParam("@Groupavatar",(DbType)SqlDbType.NVarChar,60,userGroupInfo.Groupavatar),
						DbHelper.MakeInParam("@Readaccess",(DbType)SqlDbType.Int,4,userGroupInfo.Readaccess),
						DbHelper.MakeInParam("@Allowvisit",(DbType)SqlDbType.Int,4,userGroupInfo.Allowvisit),
						DbHelper.MakeInParam("@Allowpost",(DbType)SqlDbType.Int,4,userGroupInfo.Allowpost),
						DbHelper.MakeInParam("@Allowreply",(DbType)SqlDbType.Int,4,userGroupInfo.Allowreply),
						DbHelper.MakeInParam("@Allowpostpoll",(DbType)SqlDbType.Int,4,userGroupInfo.Allowpostpoll),
						DbHelper.MakeInParam("@Allowdirectpost",(DbType)SqlDbType.Int,4,userGroupInfo.Allowdirectpost),
						DbHelper.MakeInParam("@Allowgetattach",(DbType)SqlDbType.Int,4,userGroupInfo.Allowgetattach),
						DbHelper.MakeInParam("@Allowpostattach",(DbType)SqlDbType.Int,4,userGroupInfo.Allowpostattach),
						DbHelper.MakeInParam("@Allowvote",(DbType)SqlDbType.Int,4,userGroupInfo.Allowvote),
						DbHelper.MakeInParam("@Allowmultigroups",(DbType)SqlDbType.Int,4,userGroupInfo.Allowmultigroups),
						DbHelper.MakeInParam("@Allowsearch",(DbType)SqlDbType.Int,4,userGroupInfo.Allowsearch),
						DbHelper.MakeInParam("@Allowavatar",(DbType)SqlDbType.Int,4,userGroupInfo.Allowavatar),
						DbHelper.MakeInParam("@Allowcstatus",(DbType)SqlDbType.Int,4,userGroupInfo.Allowcstatus),
						DbHelper.MakeInParam("@Allowuseblog",(DbType)SqlDbType.Int,4,userGroupInfo.Allowuseblog),
						DbHelper.MakeInParam("@Allowinvisible",(DbType)SqlDbType.Int,4,userGroupInfo.Allowinvisible),
						DbHelper.MakeInParam("@Allowtransfer",(DbType)SqlDbType.Int,4,userGroupInfo.Allowtransfer),
						DbHelper.MakeInParam("@Allowsetreadperm",(DbType)SqlDbType.Int,4,userGroupInfo.Allowsetreadperm),
						DbHelper.MakeInParam("@Allowsetattachperm",(DbType)SqlDbType.Int,4,userGroupInfo.Allowsetattachperm),
						DbHelper.MakeInParam("@Allowhidecode",(DbType)SqlDbType.Int,4,userGroupInfo.Allowhidecode),
						DbHelper.MakeInParam("@Allowhtml",(DbType)SqlDbType.Int,4,userGroupInfo.Allowhtml),
						DbHelper.MakeInParam("@Allowcusbbcode",(DbType)SqlDbType.Int,4,userGroupInfo.Allowcusbbcode),
						DbHelper.MakeInParam("@Allownickname",(DbType)SqlDbType.Int,4,userGroupInfo.Allownickname),
						DbHelper.MakeInParam("@Allowsigbbcode",(DbType)SqlDbType.Int,4,userGroupInfo.Allowsigbbcode),
						DbHelper.MakeInParam("@Allowsigimgcode",(DbType)SqlDbType.Int,4,userGroupInfo.Allowsigimgcode),
						DbHelper.MakeInParam("@Allowviewpro",(DbType)SqlDbType.Int,4,userGroupInfo.Allowviewpro),
						DbHelper.MakeInParam("@Allowviewstats",(DbType)SqlDbType.Int,4,userGroupInfo.Allowviewstats),
                        DbHelper.MakeInParam("@Allowtrade",(DbType)SqlDbType.Int,4,userGroupInfo.Allowtrade),
                        DbHelper.MakeInParam("@Allowdiggs",(DbType)SqlDbType.Int,4,userGroupInfo.Allowdiggs),
                        DbHelper.MakeInParam("@Allowdebate",(DbType)SqlDbType.Int,4,userGroupInfo.Allowdebate),
                        DbHelper.MakeInParam("@Allowbonus",(DbType)SqlDbType.Int,4,userGroupInfo.Allowbonus),
                        DbHelper.MakeInParam("@Minbonusprice",(DbType)SqlDbType.Int,4,userGroupInfo.Minbonusprice),
                        DbHelper.MakeInParam("@Maxbonusprice",(DbType)SqlDbType.Int,4,userGroupInfo.Maxbonusprice),
						DbHelper.MakeInParam("@Disableperiodctrl",(DbType)SqlDbType.Int,4,userGroupInfo.Disableperiodctrl),
						DbHelper.MakeInParam("@Reasonpm",(DbType)SqlDbType.Int,4,userGroupInfo.Reasonpm),
						DbHelper.MakeInParam("@Maxprice",(DbType)SqlDbType.SmallInt,2,userGroupInfo.Maxprice),
						DbHelper.MakeInParam("@Maxpmnum",(DbType)SqlDbType.SmallInt,2,userGroupInfo.Maxpmnum),
						DbHelper.MakeInParam("@Maxsigsize",(DbType)SqlDbType.SmallInt,2,userGroupInfo.Maxsigsize),
						DbHelper.MakeInParam("@Maxattachsize",(DbType)SqlDbType.Int,4,userGroupInfo.Maxattachsize),
						DbHelper.MakeInParam("@Maxsizeperday",(DbType)SqlDbType.Int,4,userGroupInfo.Maxsizeperday),
						DbHelper.MakeInParam("@Attachextensions",(DbType)SqlDbType.Char,100,userGroupInfo.Attachextensions),
                        DbHelper.MakeInParam("@Maxspaceattachsize",(DbType)SqlDbType.Int,4,userGroupInfo.Maxspaceattachsize),
                        DbHelper.MakeInParam("@Maxspacephotosize",(DbType)SqlDbType.Int,4,userGroupInfo.Maxspacephotosize),
						DbHelper.MakeInParam("@Raterange",(DbType)SqlDbType.Char,100,userGroupInfo.Raterange)
					};

            string commandText = string.Format("INSERT INTO [{0}usergroups]  ([radminid],[grouptitle],[creditshigher],[creditslower]," +
                                                "[stars] ,[color], [groupavatar],[readaccess], [allowvisit],[allowpost],[allowreply]," +
                                                "[allowpostpoll], [allowdirectpost],[allowgetattach],[allowpostattach],[allowvote],[allowmultigroups]," +
                                                "[allowsearch],[allowavatar],[allowcstatus],[allowuseblog],[allowinvisible],[allowtransfer]," +
                                                "[allowsetreadperm],[allowsetattachperm],[allowhidecode],[allowhtml],[allowcusbbcode],[allownickname]," +
                                                "[allowsigbbcode],[allowsigimgcode],[allowviewpro],[allowviewstats],[allowtrade],[allowdiggs],[disableperiodctrl],[reasonpm]," +
                                                "[maxprice],[maxpmnum],[maxsigsize],[maxattachsize],[maxsizeperday],[attachextensions],[raterange],[maxspaceattachsize]," +
                                                "[maxspacephotosize],[allowdebate],[allowbonus],[minbonusprice],[maxbonusprice]) VALUES(" +
                                                "@Radminid,@Grouptitle,@Creditshigher,@Creditslower,@Stars,@Color,@Groupavatar,@Readaccess,@Allowvisit,@Allowpost,@Allowreply," +
                                                "@Allowpostpoll,@Allowdirectpost,@Allowgetattach,@Allowpostattach,@Allowvote,@Allowmultigroups,@Allowsearch,@Allowavatar,@Allowcstatus," +
                                                "@Allowuseblog,@Allowinvisible,@Allowtransfer,@Allowsetreadperm,@Allowsetattachperm,@Allowhidecode,@Allowhtml,@Allowcusbbcode,@Allownickname," +
                                                "@Allowsigbbcode,@Allowsigimgcode,@Allowviewpro,@Allowviewstats,@Allowtrade,@Allowdiggs,@Disableperiodctrl,@Reasonpm,@Maxprice,@Maxpmnum,@Maxsigsize,@Maxattachsize," +
                                                "@Maxsizeperday,@Attachextensions,@Raterange,@Maxspaceattachsize,@Maxspacephotosize,@Allowdebate,@Allowbonus,@Minbonusprice,@Maxbonusprice)",
                                                 BaseConfigs.GetTablePrefix);

            DbHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
        }
示例#26
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;
 }
示例#27
0
		public void UpdateUserGroup(UserGroupInfo __usergroupinfo, int Creditshigher, int Creditslower)
		{
			IDataParameter[] prams = 
					{
						DbHelper.MakeInParam("@Radminid",(DbType)SqlDbType.Int,4,(__usergroupinfo.Groupid == 1) ? 1 : __usergroupinfo.Radminid),
						DbHelper.MakeInParam("@Grouptitle",(DbType)SqlDbType.NVarChar,50, Utils.RemoveFontTag(__usergroupinfo.Grouptitle)),
						DbHelper.MakeInParam("@Creditshigher",(DbType)SqlDbType.Int,4,Creditshigher),
						DbHelper.MakeInParam("@Creditslower",(DbType)SqlDbType.Int,4,Creditslower),
						DbHelper.MakeInParam("@Stars",(DbType)SqlDbType.Int,4,__usergroupinfo.Stars),
						DbHelper.MakeInParam("@Color",(DbType)SqlDbType.Char,7,__usergroupinfo.Color),
						DbHelper.MakeInParam("@Groupavatar",(DbType)SqlDbType.NVarChar,60,__usergroupinfo.Groupavatar),
						DbHelper.MakeInParam("@Readaccess",(DbType)SqlDbType.Int,4,__usergroupinfo.Readaccess),
						DbHelper.MakeInParam("@Allowvisit",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowvisit),
						DbHelper.MakeInParam("@Allowpost",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowpost),
						DbHelper.MakeInParam("@Allowreply",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowreply),
						DbHelper.MakeInParam("@Allowpostpoll",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowpostpoll),
						DbHelper.MakeInParam("@Allowdirectpost",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowdirectpost),
						DbHelper.MakeInParam("@Allowgetattach",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowgetattach),
						DbHelper.MakeInParam("@Allowpostattach",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowpostattach),
						DbHelper.MakeInParam("@Allowvote",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowvote),
						DbHelper.MakeInParam("@Allowmultigroups",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowmultigroups),
						DbHelper.MakeInParam("@Allowsearch",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowsearch),
						DbHelper.MakeInParam("@Allowavatar",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowavatar),
						DbHelper.MakeInParam("@Allowcstatus",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowcstatus),
						DbHelper.MakeInParam("@Allowuseblog",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowuseblog),
						DbHelper.MakeInParam("@Allowinvisible",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowinvisible),
						DbHelper.MakeInParam("@Allowtransfer",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowtransfer),
						DbHelper.MakeInParam("@Allowsetreadperm",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowsetreadperm),
						DbHelper.MakeInParam("@Allowsetattachperm",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowsetattachperm),
						DbHelper.MakeInParam("@Allowhidecode",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowhidecode),
						DbHelper.MakeInParam("@Allowhtml",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowhtml),
						DbHelper.MakeInParam("@Allowcusbbcode",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowcusbbcode),
						DbHelper.MakeInParam("@Allownickname",(DbType)SqlDbType.Int,4,__usergroupinfo.Allownickname),
						DbHelper.MakeInParam("@Allowsigbbcode",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowsigbbcode),
						DbHelper.MakeInParam("@Allowsigimgcode",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowsigimgcode),
						DbHelper.MakeInParam("@Allowviewpro",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowviewpro),
						DbHelper.MakeInParam("@Allowviewstats",(DbType)SqlDbType.Int,4,__usergroupinfo.Allowviewstats),
						DbHelper.MakeInParam("@Disableperiodctrl",(DbType)SqlDbType.Int,4,__usergroupinfo.Disableperiodctrl),
						DbHelper.MakeInParam("@Reasonpm",(DbType)SqlDbType.Int,4,__usergroupinfo.Reasonpm),
						DbHelper.MakeInParam("@Maxprice",(DbType)SqlDbType.SmallInt,2,__usergroupinfo.Maxprice),
						DbHelper.MakeInParam("@Maxpmnum",(DbType)SqlDbType.SmallInt,2,__usergroupinfo.Maxpmnum),
						DbHelper.MakeInParam("@Maxsigsize",(DbType)SqlDbType.SmallInt,2,__usergroupinfo.Maxsigsize),
						DbHelper.MakeInParam("@Maxattachsize",(DbType)SqlDbType.Int,4,__usergroupinfo.Maxattachsize),
						DbHelper.MakeInParam("@Maxsizeperday",(DbType)SqlDbType.Int,4,__usergroupinfo.Maxsizeperday),
						DbHelper.MakeInParam("@Attachextensions",(DbType)SqlDbType.Char,100,__usergroupinfo.Attachextensions),
						DbHelper.MakeInParam("@Maxspaceattachsize",(DbType)SqlDbType.Int,4,__usergroupinfo.Maxspaceattachsize),
						DbHelper.MakeInParam("@Maxspacephotosize",(DbType)SqlDbType.Int,4,__usergroupinfo.Maxspacephotosize),
						DbHelper.MakeInParam("@Groupid",(DbType)SqlDbType.Int,4,__usergroupinfo.Groupid)

					};

			string sqlstring = "UPDATE [" + BaseConfigs.GetTablePrefix + "usergroups]  SET [radminid]=@Radminid,[grouptitle]=@Grouptitle,[creditshigher]=@Creditshigher," +
				"[creditslower]=@Creditslower,[stars]=@Stars,[color]=@Color,[groupavatar]=@Groupavatar,[readaccess]=@Readaccess, [allowvisit]=@Allowvisit,[allowpost]=@Allowpost," +
				"[allowreply]=@Allowreply,[allowpostpoll]=@Allowpostpoll, [allowdirectpost]=@Allowdirectpost,[allowgetattach]=@Allowgetattach,[allowpostattach]=@Allowpostattach," +
				"[allowvote]=@Allowvote,[allowmultigroups]=@Allowmultigroups,[allowsearch]=@Allowsearch,[allowavatar]=@Allowavatar,[allowcstatus]=@Allowcstatus," +
				"[allowuseblog]=@Allowuseblog,[allowinvisible]=@Allowinvisible,[allowtransfer]=@Allowtransfer,[allowsetreadperm]=@Allowsetreadperm," +
				"[allowsetattachperm]=@Allowsetattachperm,[allowhidecode]=@Allowhidecode,[allowhtml]=@Allowhtml,[allowcusbbcode]=@Allowcusbbcode,[allownickname]=@Allownickname," +
				"[allowsigbbcode]=@Allowsigbbcode,[allowsigimgcode]=@Allowsigimgcode,[allowviewpro]=@Allowviewpro,[allowviewstats]=@Allowviewstats," +
				"[disableperiodctrl]=@Disableperiodctrl,[reasonpm]=@Reasonpm,[maxprice]=@Maxprice,[maxpmnum]=@Maxpmnum,[maxsigsize]=@Maxsigsize,[maxattachsize]=@Maxattachsize," +
				"[maxsizeperday]=@Maxsizeperday,[attachextensions]=@Attachextensions,[maxspaceattachsize]=@Maxspaceattachsize,[maxspacephotosize]=@Maxspacephotosize  WHERE [groupid]=@Groupid";


			DbHelper.ExecuteNonQuery(CommandType.Text, sqlstring, prams);
		}
示例#28
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;
 }
示例#29
0
		/// <summary>
		/// 构造函数
		/// </summary>
		public ArchiverPage()
		{
            if (config.Archiverstatus == 2 && DNTRequest.IsSearchEnginesGet())//启用,但当用户从搜索引擎点击时自动转向动态页面
                HttpContext.Current.Response.Redirect(OrganizeURL(HttpContext.Current.Request.Url));

            if (config.Archiverstatus == 3 && DNTRequest.IsBrowserGet())//启用,但当用户使用浏览器访问时自动转向动态页面
                HttpContext.Current.Response.Redirect(OrganizeURL(HttpContext.Current.Request.Url));

            if (OnlineUsers.GetOnlineAllUserCount() >= config.Maxonlines)
                ShowError("抱歉,目前访问人数太多,你暂时无法访问论坛.", 0);
			
			if (config.Nocacheheaders == 1)
			{
				HttpContext.Current.Response.Buffer = true;
				HttpContext.Current.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
				HttpContext.Current.Response.Cache.SetExpires(DateTime.Now.AddDays(-1));
				HttpContext.Current.Response.Expires = 0;
				HttpContext.Current.Response.CacheControl = "no-cache";
				HttpContext.Current.Response.Cache.SetNoStore();
			}

			OnlineUserInfo oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout);

			userid = oluserinfo.Userid;
			useradminid = oluserinfo.Adminid;
			// 如果论坛关闭且当前用户请求页面不是登录页面且用户非管理员, 则跳转至论坛关闭信息页
			if (config.Closed == 1 && oluserinfo.Adminid != 1)
				ShowError("", 1);

			usergroupinfo = UserGroups.GetUserGroupInfo(oluserinfo.Groupid);
		
			// 如果不允许访问论坛则转向到tools/ban.htm
			if (usergroupinfo.Allowvisit != 1)
				ShowError("抱歉, 您所在的用户组不允许访问论坛", 2);

            // 如果IP访问列表有设置则进行判断
            if (config.Ipaccess.Trim() != "" && !Utils.InIPArray(DNTRequest.GetIP(), Utils.SplitString(config.Ipaccess, "\n")))
            {
                ShowError("抱歉, 系统设置了IP访问列表限制, 您无法访问本论坛", 0);
                return;
            }			
			// 如果IP访问列表有设置则进行判断
            if (config.Ipdenyaccess.Trim() != "" && Utils.InIPArray(DNTRequest.GetIP(), Utils.SplitString(config.Ipdenyaccess, "\n")))
            {
                ShowError("由于您严重违反了论坛的相关规定, 已被禁止访问.", 2);
                return;
            }
			// 如果当前用户请求页面不是登录页面并且当前用户非管理员并且论坛设定了时间段,当时间在其中的一个时间段内,则跳转到论坛登录页面
            if (oluserinfo.Adminid != 1 && DNTRequest.GetPageName() != "login.aspx" && Scoresets.BetweenTime(config.Visitbanperiods))
            {
                ShowError("在此时间段内不允许访问本论坛", 2);
                return;
            }

			HttpContext.Current.Response.Write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n");
		
			if (config.Seokeywords != "")
				HttpContext.Current.Response.Write("<meta name=\"keywords\" content=\"" + config.Seokeywords + "\" />\r\n");

            if (config.Seodescription != "")
				HttpContext.Current.Response.Write("<meta name=\"description\" content=\"" + config.Seodescription + "\" />\r\n");

            HttpContext.Current.Response.Write(config.Seohead.Trim());
			HttpContext.Current.Response.Write("\r\n<link href=\"dntarchiver.css\" rel=\"stylesheet\" type=\"text/css\" />");

			if (config.Archiverstatus == 0)
			{
				ShowError("系统禁止使用Archiver",3);
				HttpContext.Current.Response.End();
				return;
			}
		}
示例#30
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;
 }