示例#1
0
        public void ValidateCode(string actionType, string id, ValidateCodeTemplate template)
        {
            if (ValidateCodeManager.HasValidateCode(actionType) == false)
            {
                return;
            }


            string tip;

            ValidateCodeType validateCodeType = ValidateCodeManager.GetValidateCodeTypeByAction(actionType);

            if (validateCodeType == null)
            {
                return;
            }

            tip = validateCodeType.Tip;

            if (id == null)
            {
                id = string.Empty;
            }
            bool   disableIme = validateCodeType.DisableIme;
            string inputName  = string.Format(Consts.ValidateCode_InputName, actionType, id);
            string imageUrl   = ValidateCodeManager.GetValidateCodeImageUrl(actionType, false, id);

            template(inputName, tip, imageUrl, disableIme);
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EnableChatFunction)
            {
                ShowError("管理员已关闭对话功能!");
                return;
            }

            //验证码频率计数(页面调用次数计数)
            ValidateCodeManager.CreateValidateCodeActionRecode(validateActionName);

            m_ToUserID = _Request.Get <int>("to", Method.Get, 0);

            if (m_ToUserID <= 0)
            {
                ShowError(new UserNotExistsError("to", m_ToUserID));
            }

            m_ChatUser = UserBO.Instance.GetSimpleUser(m_ToUserID, true);

            if (m_ChatUser == null)
            {
                ShowError(new UserNotExistsError("to", m_ToUserID));
            }

            m_ChatMessageList = ChatBO.Instance.GetLastChatMessages(MyUserID, m_ToUserID, 0, 20);
        }
示例#3
0
        public void RecoverPassword()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("email", "username", GetValidateCodeInputName("recoverpassword"));

            using (ErrorScope es = new ErrorScope())
            {
                ValidateCodeManager.CreateValidateCodeActionRecode("recoverpassword");

                if (CheckValidateCode("recoverpassword", msgDisplay))
                {
                    string username = _Request.Get("username", Method.Post, string.Empty, false);
                    string email    = _Request.Get("email", Method.Post, string.Empty, false);

                    UserBO.Instance.TryRecoverPassword(username, email);

                    if (es.HasUnCatchedError)
                    {
                        es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            msgDisplay.AddError(error);
                        });
                    }
                    else
                    {
                        ShowSuccess("已经有一封邮件发到你的邮箱,请收取邮件,按照提示进行下一步操作", IndexUrl);
                        //msgDisplay.ShowInfoPage(this);
                    }
                }
            }
        }
示例#4
0
        private void AdminLogin()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("password", "vcode");

            ValidateCodeManager.CreateValidateCodeActionRecode(validateActionName);
            if (!CheckValidateCode(validateActionName, msgDisplay))
            {
                msgDisplay.AddError("vcode", "验证码错误!");
                return;
            }

            string password = _Request.Get("password", Method.Post, string.Empty, false);

            Guid sessionid;

            if (!UserBO.Instance.AdminLogin(MyUserID, password, out sessionid))
            {
                msgDisplay.AddError("password", "密码错误!");
                return;
            }
            else
            {
                Session[AdminSessionKey] = new AdminSessionStruct(sessionid, DateTimeUtil.Now, My.Password);
                Response.Redirect(RawUrl);
            }
        }
示例#5
0
        private void Hail()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay(GetValidateCodeInputName(validateActionName));

            int    HailID  = _Request.Get <int>("HailID", Method.Post, 0);
            string note    = _Request.Get("Note");
            string IP      = _Request.IpAddress;
            bool   success = false;

            using (ErrorScope es = new ErrorScope())
            {
                ValidateCodeManager.CreateValidateCodeActionRecode(validateActionName);

                if (this.TheNotify == null && !CheckValidateCode(validateActionName, msgDisplay))
                {
                    return;
                }
                else
                {
                    try
                    {
                        Notify notify = new HailNotify(MyUserID, HailID, note);
                        notify.UserID = UserID;
                        NotifyBO.Instance.AddNotify(My, notify);
                        NotifyBO.Instance.DeleteNotify(My, NotifyID);
                        success = true;
                    }
                    catch (Exception ex)
                    {
                        msgDisplay.AddException(ex);
                        return;
                    }
                }

                if (es.HasUnCatchedError)
                {
                    es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
            }

            if (success)
            {
                ShowSuccess("已成功送出了您的问候!", 1);
                return;
            }
        }
示例#6
0
        private void UserLogin()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("username", "password", "noActive", GetValidateCodeInputName(validateActionName));
            string         email      = _Request.Get("email", Method.Post, string.Empty, false);
            string         username   = _Request.Get("username", Method.Post, string.Empty, false);
            string         password   = _Request.Get("password", Method.Post, string.Empty, false);
            bool           autoLogin  = !string.IsNullOrEmpty(_Request.Get("autologin", Method.Post));
            bool           invisible  = _Request.Get("invisible", Method.Post) == "true";

            string account = username == string.Empty ? email : username;

            string ip = _Request.IpAddress;

            //如果全局UserLoginType为Username -或者- 全局UserLoginType为All且用户选择了账号登陆  则为true
            bool IsUsernameLogin = (LoginType == UserLoginType.Username || (LoginType == UserLoginType.All && _Request.Get <int>("logintype", Method.Post, 0) == 0));

            ValidateCodeManager.CreateValidateCodeActionRecode(validateActionName);
            if (!CheckValidateCode(validateActionName, msgDisplay))
            {
                return;
            }

            try
            {
                Success = UserBO.Instance.Login(account, password, ip, autoLogin, IsUsernameLogin);
            }
            catch (Exception ex)
            {
                msgDisplay.AddException(ex);
                Success = false;
            }

            if (Success)
            {
#if !Passport
                UpdateOnlineStatus(OnlineAction.OtherAction, 0, "");
                OnlineUserPool.Instance.Update(My, invisible);
                ShowSuccess("登录成功", true);
#endif
            }
            else
            {
                CatchError <ErrorInfo>(delegate(ErrorInfo error)
                {
                    msgDisplay.AddError(error);
                });
            }
        }
示例#7
0
        private void ProcessVote()
        {
            string         validateCodeAction = "Vote";
            MessageDisplay msgDisplay         = CreateMessageDisplay("vote");

            if (CheckValidateCode(validateCodeAction, msgDisplay))
            {
                int[] itemIDs = _Request.GetList <int>("pollItem", Method.Post, new int[0] {
                });

                try
                {
                    bool success = PostBOV5.Instance.Vote(My, itemIDs, ThreadID);
                    if (success == false)
                    {
                        CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            if (error is UserPointOverMinValueError)
                            {
                                msgDisplay.AddError("vote", "您的积分不足,不能进行投票");
                            }
                            else
                            {
                                msgDisplay.AddError("vote", error.Message);
                            }
                        });
                    }
                    else
                    {
                        _Request.Clear();
                        ValidateCodeManager.CreateValidateCodeActionRecode(validateCodeAction);
                        AlertSuccess("投票成功");
                    }
                }
                catch (Exception ex)
                {
                    LogManager.LogException(ex);
                    msgDisplay.AddError("vote", ex.Message);
                }
            }
        }
示例#8
0
        public void ProcessRequest(System.Web.HttpContext context)
        {
            RequestVariable _request = RequestVariable.Current;

            string validateCode;
            string type = _request.Get("type", Method.Get, string.Empty);

            string isStyleType = _request.Get("isstyletype", Method.Get, "0");

            string id = _request.Get("id", Method.Get, string.Empty);

            byte[] image;

            if (isStyleType == "1")
            {
                ValidateCodeType validateCodeType = ValidateCodeManager.GetValidateCodeType(type);

                if (validateCodeType == null)
                {
                    return;
                }

                image = validateCodeType.CreateImage(out validateCode);
            }
            else
            {
                image = MaxLabs.bbsMax.ValidateCodes.ValidateCodeManager.CreateImage(type, out validateCode);
            }

            context.Session[Consts.ValidateCode_SessionKey_Prefix + type.ToLower() + id.ToLower().Trim()] = validateCode;

            context.Response.Clear();
            context.Response.ContentType = "image/gif";
            context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
            context.Response.Cache.SetNoStore();
            context.Response.BinaryWrite(image);
            context.Response.End();
        }
示例#9
0
        private void AddComment()
        {
            int targetID = _Request.Get <int>("targetid", Method.Post, 0);

            m_CommentListPageNumber = _Request.Get <int>("clpn", Method.Post, 1);
            m_CommentListTargetID   = _Request.Get <int>("cld", Method.Post, 0);

            MessageDisplay msgDisplay = CreateMessageDisplayForForm("form_" + targetID, "content", GetValidateCodeInputName("CreateComment", targetID.ToString()));

            if (CheckValidateCode("CreateComment", targetID.ToString(), msgDisplay))
            {
                string content  = _Request.Get("content", Method.Post, string.Empty);
                string createIP = _Request.IpAddress;
                int    userID   = MyUserID;

                int replyUserID    = _Request.Get <int>("replyuserid", Method.Post, 0);
                int replyCommentID = _Request.Get <int>("replycommentid", Method.Post, 0);

                bool isReply = replyUserID > 0;

                try
                {
                    using (new ErrorScope())
                    {
                        int    newCommentId;
                        string newContent;
                        bool   success = CommentBO.Instance.AddComment(My, targetID, replyCommentID, CommentType.Doing, content, createIP, isReply, replyUserID, out newCommentId, out newContent);
                        if (success == false)
                        {
                            CatchError <ErrorInfo>(delegate(ErrorInfo error)
                            {
                                if (error is UnapprovedError)
                                {
                                    AlertWarning(error.Message);
                                }
                                else
                                {
                                    msgDisplay.AddError(error);
                                }
                            });
                        }
                        else
                        {
                            Doing doing = DoingBO.Instance.GetDoing(targetID);
                            if (doing != null)
                            {
                                m_CommentListPageNumber = doing.TotalComments / CommentPageSize;
                                if (doing.TotalComments % CommentPageSize > 0)
                                {
                                    m_CommentListPageNumber += 1;
                                }
                            }

                            ValidateCodeManager.CreateValidateCodeActionRecode("CreateComment");
                        }
                    }
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }
            }
        }
示例#10
0
        private void SaveValidateStyle()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            string actiontype = _Request.Get("actiontype", Method.Get, string.Empty);

            string validateCodeStyle = _Request.Get("validateCodeStyle", Method.Post, string.Empty);

            bool isInvalidActionType = true;

            foreach (ValidateCodeAction action in ValidateCodeManager.GetAllValidateCodeActions())
            {
                if (string.Compare(action.Type, actiontype, true) == 0)
                {
                    isInvalidActionType = false;
                    break;
                }
            }

            if (isInvalidActionType == true)
            {
                msgDisplay.AddError(new InvalidParamError("actiontype").Message);
            }


            ValidateCodeCollection tempValidateCodes = new ValidateCodeCollection();

            bool hasAdd = false;

            foreach (ValidateCode validateCode in AllSettings.Current.ValidateCodeSettings.ValidateCodes)
            {
                if (string.Compare(validateCode.ActionType, actiontype, true) == 0)
                {
                    ValidateCode tempValidateCode = (ValidateCode)validateCode.Clone();

                    tempValidateCode.ValidateCodeType = validateCodeStyle;

                    tempValidateCodes.Add(tempValidateCode);

                    hasAdd = true;
                }
                else
                {
                    tempValidateCodes.Add(validateCode);
                }
            }

            if (hasAdd == false)
            {
                ValidateCode validateCode = new ValidateCode();

                validateCode.ValidateCodeType = validateCodeStyle;
                validateCode.ActionType       = actiontype;

                tempValidateCodes.Add(validateCode);
            }


            try
            {
                using (new ErrorScope())
                {
                    ValidateCodeSettings setting = (ValidateCodeSettings)AllSettings.Current.ValidateCodeSettings.Clone();

                    setting.ValidateCodes = tempValidateCodes;

                    Success = SettingManager.SaveSettings(setting);

                    if (!Success)
                    {
                        CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            msgDisplay.AddError(error);
                        });
                    }
                    else
                    {
                        Return(true);
                    }
                }
            }
            catch (Exception ex)
            {
                msgDisplay.AddError(ex.Message);
            }
        }
示例#11
0
 protected string GetValidateCodeImageUrl(string type)
 {
     return(ValidateCodeManager.GetValidateCodeImageUrl(type, true, null));
 }
示例#12
0
 public override void Initialize()
 {
     ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style13());
     ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style14());
 }
示例#13
0
        private void Register()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("username", "password", "password2", "email", "serial", "inviterid", GetValidateCodeInputName(validateCodeAction));
            string         password   = _Request.Get("password", Method.Post, string.Empty, false);

            if (password != _Request.Get("password2", Method.Post, string.Empty, false))
            {
                _Request.Remove("password2", Method.Post);
                ThrowError(new PasswordInconsistentError("password2"));
            }

            string username   = _Request.Get("username", Method.Post, string.Empty, false).Trim();
            string email      = _Request.Get("email", Method.Post, string.Empty, false).Trim();
            string inviteCode = _Request.Get("invite", Method.All, string.Empty).Trim();
            int    userid     = 0;

            //if (string.IsNullOrEmpty(inviteCode)) inviteCode = _Request.Get("invite", Method.Get);

            int?inviterID = _Request.Get <int>("inviterid");

            if (_Request.Get("agree", Method.Post) != "1")
            {
                ThrowError(new NotAgreeError("notagreeerror"));
            }

            //验证码检查
            bool isRightValidateCode = CheckValidateCode(validateCodeAction, msgDisplay);
            //if (!CheckValidateCode(validateCodeAction, msgDisplay))
            //{
            //    return;
            //}

            UserRegisterState state = UserRegisterState.Failure;

            try
            {
                if (!HasUnCatchedError)
                {
                    state = UserBO.Instance.Register(ref userid, username, password, email, _Request.IpAddress, inviteCode, null, isRightValidateCode);
                }
            }
            catch (Exception ex)
            {
                msgDisplay.AddException(ex);
            }

            switch (state)
            {
            case UserRegisterState.Success:
                BbsRouter.JumpTo("default");
                ValidateCodeManager.CreateValidateCodeActionRecode(validateCodeAction);
                break;

            case UserRegisterState.NeedActive:
                ValidateCodeManager.CreateValidateCodeActionRecode(validateCodeAction);
                password = SecurityUtil.Encrypt(EncryptFormat.bbsMax, password);
                //已经发送过邮件了,跳转后,不需要再次提示发送邮件.
                string reactiveUrl = UrlHelper.GetSendEmailUrl(ValidateEmailAction.ActivingUser, userid, password, true);
                Response.Redirect(reactiveUrl);
                break;

            case UserRegisterState.Failure:
                //失败
                CatchError <ErrorInfo>(delegate(ErrorInfo error)
                {
                    msgDisplay.AddError(error);
                });
                break;
            }
        }
示例#14
0
        private void SaveValidateRole()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            string actiontype = _Request.Get("actiontype", Method.Get, string.Empty);


            string roleIDString = _Request.Get("validateCodeRole", Method.Post, string.Empty);

            if (roleIDString.Length == 0)
            {
                return;
            }


            bool isInvalidActionType = true;

            foreach (ValidateCodeAction action in ValidateCodeManager.GetAllValidateCodeActions())
            {
                if (string.Compare(action.Type, actiontype, true) == 0)
                {
                    if (action.CanSetExceptRoleId == false)
                    {
                        msgDisplay.AddError(string.Format(Lang_Error.ValidateCode_ValidateCodeActionCannotSetExceptRoleID, action.Name));
                        return;
                    }
                    isInvalidActionType = false;
                    break;
                }
            }

            if (isInvalidActionType == true)
            {
                msgDisplay.AddError(new InvalidParamError("actiontype").Message);
            }


            StringList exceptRoleIDs = new StringList();

            foreach (string roleID in roleIDString.Split(','))
            {
                exceptRoleIDs.Add(roleID);
            }


            ValidateCodeCollection tempValidateCodes = new ValidateCodeCollection();

            bool hasAdd = false;

            foreach (ValidateCode validateCode in AllSettings.Current.ValidateCodeSettings.ValidateCodes)
            {
                if (string.Compare(validateCode.ActionType, actiontype, true) == 0)
                {
                    ValidateCode tempValidateCode = (ValidateCode)validateCode.Clone();

                    tempValidateCode.ExceptRoleIds = exceptRoleIDs;

                    tempValidateCodes.Add(tempValidateCode);

                    hasAdd = true;
                }
                else
                {
                    tempValidateCodes.Add(validateCode);
                }
            }

            if (hasAdd == false)
            {
                ValidateCode validateCode = new ValidateCode();

                validateCode.ExceptRoleIds = exceptRoleIDs;
                validateCode.ActionType    = actiontype;

                tempValidateCodes.Add(validateCode);
            }


            try
            {
                using (new ErrorScope())
                {
                    ValidateCodeSettings setting = (ValidateCodeSettings)AllSettings.Current.ValidateCodeSettings.Clone();

                    setting.ValidateCodes = tempValidateCodes;

                    bool success = SettingManager.SaveSettings(setting);

                    if (!success)
                    {
                        CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            msgDisplay.AddError(error);
                        });
                    }
                    else
                    {
                        Return(true);
                    }
                }
            }
            catch (Exception ex)
            {
                msgDisplay.AddError(ex.Message);
            }
        }
示例#15
0
        private void CreateComment()
        {
            m_CommentFeedID   = _Request.Get <int>("commentfeedid", Method.Post, 0);
            m_GetCommentCount = _Request.Get <int>("getcommentcount", Method.Post, 0);

            string validateCodeActionType = "CreateComment";
            int    feedID = _Request.Get <int>("feedID", Method.Post, 0);

            MessageDisplay msgDisplay = CreateMessageDisplay("content", ValidateCodeManager.GetValidateCodeInputName(validateCodeActionType, feedID.ToString()));

            if (CheckValidateCode(validateCodeActionType, feedID.ToString(), msgDisplay))
            {
                string content = _Request.Get("comment_content", Method.Post, string.Empty);

                int  targetID   = _Request.Get <int>("targetID", Method.Post, 0);
                int  actionType = _Request.Get <int>("actiontype", Method.Post, 0);
                Guid appID      = new Guid(_Request.Get("appid", Method.Post, string.Empty));

                CommentType commentType       = CommentBO.Instance.GetCommentType(appID, actionType);
                int         replyTargetUserID = _Request.Get <int>("replyuserid", Method.Post, 0);
                int         replycommentid    = _Request.Get <int>("replycommentid", Method.Post, 0);
                bool        isReply           = replyTargetUserID > 0;

                int    tempCommentID;
                string tempContent;

                bool success;
                try
                {
                    success = CommentBO.Instance.AddComment(My, targetID, replycommentid, commentType, content, _Request.IpAddress, isReply, replyTargetUserID, out tempCommentID, out tempContent);
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                    success = false;
                }

                if (success == false)
                {
                    CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        if (error is UnapprovedError)
                        {
                            _Request.Clear();
                            AlertWarning(error.Message);
                        }
                        else
                        {
                            msgDisplay.AddError(error);
                            AlertError(error.Message);
                        }
                    });
                }
                else
                {
                    ValidateCodeManager.CreateValidateCodeActionRecode(validateCodeActionType);
                }
            }
            else
            {
                AlertError("验证码错误!");
            }
        }
示例#16
0
        //快速发帖
        private void ProcessThread()
        {
            string         validateCodeAction = "CreateTopic";
            MessageDisplay msgDisplay         = CreateMessageDisplay();

            if (CheckValidateCode(validateCodeAction, msgDisplay))
            {
                string posterName;
                if (IsLogin == false)
                {
                    if (EnableGuestNickName)
                    {
                        posterName = _Request.Get("guestNickName", Method.Post, string.Empty);
                    }
                    else
                    {
                        posterName = "";
                    }
                }
                else
                {
                    posterName = My.Name;
                }

                string subject   = _Request.Get("Subject", Method.Post, string.Empty);
                string content   = _Request.Get("Editor", Method.Post, string.Empty, false);
                string ipAddress = _Request.IpAddress;

                //string enableItems = _Request.Get("enableItem", Method.Post, string.Empty);

                bool enableHtml     = false;
                bool enableMaxCode3 = false;
                if (AllowHtml && AllowMaxcode)
                {
                    enableHtml = _Request.Get <int>("eritoSellect", Method.Post, 0) == 1;
                    //enableHtml = StringUtil.EqualsIgnoreCase(_Request.Get("contentFormat", Method.Post, ""), "enablehtml");
                    if (enableHtml == false)
                    {
                        enableMaxCode3 = true;
                    }
                }
                else if (AllowHtml)
                {
                    enableHtml = true;
                }
                else if (AllowMaxcode)
                {
                    enableMaxCode3 = true;
                }

                bool enableEmoticons   = true; //(enableItems.IndexOf("enableemoticons", StringComparison.OrdinalIgnoreCase) > -1);
                bool enableSignature   = true; //(enableItems.IndexOf("enablesignature", StringComparison.OrdinalIgnoreCase) > -1);
                bool enableReplyNotice = true; //(enableItems.IndexOf("enablereplynotice", StringComparison.OrdinalIgnoreCase) > -1);

                int threadCatalogID = _Request.Get <int>("threadCatalogs", Method.Post, 0);


                int  threadID = 0, postID = 0;
                bool success       = false;
                bool hasCatchError = false;
                try
                {
                    success = PostBOV5.Instance.CreateThread(
                        My, false, enableEmoticons, ForumID, threadCatalogID, 0, subject
                        , string.Empty, 0, posterName, false, false, content, enableHtml, enableMaxCode3, enableSignature
                        , enableReplyNotice, ipAddress, new AttachmentCollection(), out threadID, out postID
                        );
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                    hasCatchError = true;
                }

                if (hasCatchError == false)
                {
                    if (success == false)
                    {
                        CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            if (error is UnapprovedError)
                            {
                                m_PageNumber = PageNumber;
                                _Request.Clear();
                                AlertWarning(error.Message);
                            }
                            else
                            {
                                msgDisplay.AddError(error);
                            }
                        });
                    }
                    else
                    {
                        ValidateCodeManager.CreateValidateCodeActionRecode(validateCodeAction);
                        if (IsAjaxRequest)
                        {
                            m_PageNumber = PageNumber;

                            AlertSuccess("操作成功");
                            _Request.Clear();
                        }
                        else
                        {
                            string returnUrl = BbsUrlHelper.GetForumUrl(Forum.CodeName, Action, PageNumber);
                            Response.Redirect(returnUrl);
                        }
                    }
                }
            }
        }
示例#17
0
        private void Add()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay(GetValidateCodeInputName(validateActionName));

            int    friendGroupID = _Request.Get <int>("ToFriendGroupID", Method.Post, 0);
            string message       = _Request.Get("Note", Method.Post);
            string IP            = _Request.IpAddress;

            //if (!FriendPO.GetInstance(MyUserID).CanAddFriend(friendUserID))
            //{
            //    //没权限添加好友
            //}

            ValidateCodeManager.CreateValidateCodeActionRecode(validateActionName);

            if (IsMyFriend == false && !CheckValidateCode(validateActionName, msgDisplay))
            {
                return;
            }

            if (CreateGroup)
            {
                string groupName = _Request.Get("newgroup", Method.Post);
                friendGroupID = FriendBO.Instance.AddFriendGroup(MyUserID, groupName);

                if (HasUnCatchedError)
                {
                    CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                    return;
                }
            }

            bool success = false;

            using (ErrorScope es = new ErrorScope())
            {
                try
                {
                    if (IsMyFriend)
                    {
                        success = FriendBO.Instance.MoveFriends(MyUserID, new int[] { m_UserIDToAdd }, friendGroupID);
                    }
                    else
                    {
                        success = FriendBO.Instance.TryAddFriend(My, m_UserIDToAdd, friendGroupID, message);
                    }
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }

                if (success == false)
                {
                    es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
            }

            if (success)
            {
                //JsonBuilder json = new JsonBuilder();
                //json.Set("friendUserID", friendUserID);
                //json.Set("friendGroupID", friendGroupID);
                //Return(json);
                if (IsMyFriend)
                {
                    Return(true);
                }
                else
                {
                    ShowSuccess("已经申请添加对方为好友,请等待对方答复");
                }
            }
        }
示例#18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //关闭侧边栏
            if (_Request.IsClick("Default_Close_Sidebar"))
            {
                ProcessUpdateUserOption(true);
            }
            //开启侧边栏
            if (_Request.IsClick("Default_Open_Sidebar"))
            {
                ProcessUpdateUserOption(false);
            }

            //快速登录
            if (_Request.IsClick("btLogin"))
            {
                MessageDisplay msgDisplay = CreateMessageDisplay();

                using (ErrorScope es = new ErrorScope())
                {
                    if (CheckValidateCode("login", msgDisplay))
                    {
                        ValidateCodeManager.CreateValidateCodeActionRecode("login");
                        string username = _Request.Get("username", Method.Post, string.Empty, false);
                        string password = _Request.Get("password", Method.Post, string.Empty, false);

                        //如果全局UserLoginType为Username -或者- 后台设置全局UserLoginType为All且用户选择了账号登陆  则为true
                        UserLoginType loginType       = _Request.Get <UserLoginType>("logintype", Method.Post, UserLoginType.Username);
                        bool          isUsernameLogin = (LoginType == UserLoginType.Username || (LoginType == UserLoginType.All && loginType == UserLoginType.Username));

                        int  cookieTime = _Request.Get <int>("cookietime", Method.Post, 0);
                        bool success;

                        try
                        {
                            success = UserBO.Instance.Login(username, password, _Request.IpAddress, cookieTime > 0, isUsernameLogin);
                            if (success == false)
                            {
                                if (es.HasUnCatchedError)
                                {
                                    es.CatchError <UserNotActivedError>(delegate(UserNotActivedError err)
                                    {
                                        Response.Redirect(err.ActiveUrl);
                                    });
                                    es.CatchError <EmailNotValidatedError>(delegate(EmailNotValidatedError err)
                                    {
                                        Response.Redirect(err.ValidateUrl);
                                    });
                                    es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                                    {
                                        msgDisplay.AddError(error);
                                    });
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            msgDisplay.AddException(ex);
                            success = false;
                        }

                        if (success)
                        {
                            BbsRouter.JumpToCurrentUrl();
                        }
                    }
                }
            }
            else
            {
                UpdateOnlineStatus(OnlineAction.ViewIndexPage, 0, "");

                //OnlineManager.UpdateOnlineUser(MyUserID, 0, 0, My.OnlineStatus, OnlineAction.ViewIndexPage, Request, Response);

                AddNavigationItem("欢迎光临,现在是" + UserNow);
            }

            ForumCollection tempForums = new ForumCollection();

            foreach (Forum forum in ForumCatalogs)
            {
                WaitForFillSimpleUsers <Moderator>(forum.Moderators);
                foreach (Forum subForum in forum.SubForumsForList)
                {
                    WaitForFillSimpleUsers <Moderator>(subForum.Moderators);
                }
                tempForums.AddRange(forum.SubForumsForList);
            }

            ForumBO.Instance.SetForumsLastThread(tempForums);

            SubmitFillUsers();
        }
示例#19
0
        private void Create(PrivacyType privacyType)
        {
            string         validateCodeAction = "CreateShare";
            MessageDisplay msgDisplay         = CreateMessageDisplay("description", "subject", GetValidateCodeInputName(validateCodeAction));

            if (CheckValidateCode(validateCodeAction, msgDisplay) == false)
            {
                return;
            }


            string description  = _Request.Get("description", Method.Post, string.Empty);
            string content      = _Request.Get("content", Method.Post, string.Empty, false).Replace(tempReplace_rn, "\r\n").Replace(tempReplace_n, "\n");
            string title        = _Request.Get("title", Method.Post, string.Empty, false);
            string url          = _Request.Get("url", Method.Post, string.Empty, false);
            string securityCode = _Request.Get("securityCode", Method.Post, string.Empty);
            //string securityCode2 = _Request.Get("securityCode2", Method.Post, string.Empty);
            string urlSecurityCode = _Request.Get("urlSecurityCode", Method.Post, string.Empty);
            int    targetUserID    = _Request.Get <int>("userid", Method.Post, 0);

            //int ptype = _Request.Get<int>("privacytype", Method.Post, 0);
            //if (ptype > 2 || ptype < 0)
            //    ptype = 0;

            //PrivacyType privacyType = (PrivacyType)ptype;

            ShareType?shareCatagory = _Request.Get <ShareType>("ShareType", Method.Post);

            if (shareCatagory == null)
            {
                ShowError(new InvalidShareContentError("ShareType").Message);
                return;
            }

            if (GetShareContentSafeSerial(BbsRouter.ReplaceUrlTag(content), targetUserID) != securityCode)
            {
                ShowError(new InvalidShareContentError("ShareContent").Message);
                return;
            }

            if (string.IsNullOrEmpty(title))
            {
                msgDisplay.AddError("subject", "标题不能为空");
                return;
            }

            if (GetShareContentSafeSerial(BbsRouter.ReplaceUrlTag(url), targetUserID) != urlSecurityCode)
            {
                ShowError(new InvalidShareContentError("ShareUrl").Message);
                return;
            }


            int refShareID = _Request.Get <int>("refshareid", 0);

            try
            {
                using (new ErrorScope())
                {
                    bool success;

                    if (refShareID == 0)
                    {
                        int targetID = _Request.Get <int>("targetID", Method.Get, 0);
                        int shareID;

                        if (shareCatagory.Value == ShareType.Video ||
                            shareCatagory.Value == ShareType.URL ||
                            shareCatagory.Value == ShareType.Music ||
                            shareCatagory.Value == ShareType.Flash)
                        {
                            success = ShareBO.Instance.CreateShare(MyUserID, privacyType, url, title, description);
                        }
                        else
                        {
                            success = ShareBO.Instance.CreateShare(MyUserID, targetUserID, shareCatagory.Value, privacyType, url, title, content, description, targetID, out shareID);
                        }
                    }
                    else
                    {
                        success = ShareBO.Instance.ReShare(My, refShareID, privacyType, title, description);
                    }

                    if (!success)
                    {
                        CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            msgDisplay.AddError(error);
                        });
                    }
                    else
                    {
                        ValidateCodeManager.CreateValidateCodeActionRecode(validateCodeAction);
                        //msgDisplay.ShowInfo(this);
                        ShowSuccess(privacyType == PrivacyType.SelfVisible ? "收藏成功" : "分享成功", new object());
                    }
                }
            }
            catch (Exception ex)
            {
                msgDisplay.AddError(ex.Message);
            }
        }
示例#20
0
        private void UserLogin()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("username", "password", "noActive", GetValidateCodeInputName(validateActionName));

            string username  = _Request.Get("username", Method.Post, string.Empty, false);
            string password  = _Request.Get("password", Method.Post, string.Empty, false);
            bool   autoLogin = !string.IsNullOrEmpty(_Request.Get("autologin", Method.Post));
            bool   invisible = _Request.Get("invisible", Method.Post) == "true";

            string ip = _Request.IpAddress;

            //如果全局UserLoginType为Username -或者- 后台设置全局UserLoginType为All且用户选择了账号登陆  则为true
            UserLoginType loginType       = _Request.Get <UserLoginType>("logintype", Method.Post, UserLoginType.Username);
            bool          isUsernameLogin = (LoginType == UserLoginType.Username || (LoginType == UserLoginType.All && loginType == UserLoginType.Username));

            ValidateCodeManager.CreateValidateCodeActionRecode(validateActionName);

            if (!CheckValidateCode(validateActionName, msgDisplay))
            {
                return;
            }

            using (ErrorScope es = new ErrorScope())
            {
                bool success;
                try
                {
                    success = UserBO.Instance.Login(username, password, ip, autoLogin, isUsernameLogin);
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                    success = false;
                }

                if (success)
                {
#if !Passport
                    UpdateOnlineStatus(OnlineAction.OtherAction, 0, "");
                    OnlineUserPool.Instance.Update(My, invisible);
#endif
                    Response.Redirect(ReturnUrl, true);
                }
                else
                {
                    if (es.HasUnCatchedError)
                    {
                        es.CatchError <UserNotActivedError>(delegate(UserNotActivedError err)
                        {
                            Response.Redirect(err.ActiveUrl);
                        });
                        es.CatchError <EmailNotValidatedError>(delegate(EmailNotValidatedError err)
                        {
                            Response.Redirect(err.ValidateUrl);
                        });
                        es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            msgDisplay.AddError(error);
                        });
                    }
                }
            }
        }
示例#21
0
        protected void ProcessPost()
        {
            string         validateCodeAction = "ReplyTopic";
            MessageDisplay msgDisplay         = CreateMessageDisplay();

            if (CheckValidateCode(validateCodeAction, msgDisplay))
            {
                PostType postType        = (PostType)_Request.Get <int>("viewPointType", Method.Post, 0);
                bool     isReplyPolemize = _Request.Get <bool>("isReplyPolemize", Method.Post, false);

                if (isReplyPolemize && postType == PostType.Normal)
                {
                    msgDisplay.AddError("请选择您的观点!");
                    return;
                }

                string postNickName;
                if (IsLogin == false)
                {
                    if (EnableGuestNickName)
                    {
                        postNickName = _Request.Get("guestNickName", Method.Post, "");
                    }
                    else
                    {
                        postNickName = "";
                    }
                }
                else
                {
                    postNickName = My.Name;
                }
                string subject   = _Request.Get("Subject", Method.Post, string.Empty);
                string content   = _Request.Get("Editor", Method.Post, string.Empty, false);
                string iPAddress = _Request.IpAddress;

                //string enableItems = _Request.Get("enableItem", Method.Post, string.Empty);

                bool enableHTML     = false;
                bool enableMaxCode3 = false;
                if (AllowHtml && AllowMaxcode)
                {
                    enableHTML = _Request.Get <int>("eritoSellect", Method.Post, 0) == 1;

                    if (enableHTML == false)
                    {
                        enableMaxCode3 = true;
                    }
                }
                else if (AllowHtml)
                {
                    enableHTML = true;
                }

                else if (AllowMaxcode)
                {
                    enableMaxCode3 = true;
                }

                bool enableEmoticons   = true; // (enableItems.IndexOf("enableemoticons", StringComparison.OrdinalIgnoreCase) > -1);
                bool enableSignature   = true; //(enableItems.IndexOf("enablesignature", StringComparison.OrdinalIgnoreCase) > -1);
                bool enableReplyNotice = true; //(enableItems.IndexOf("enablereplynotice", StringComparison.OrdinalIgnoreCase) > -1);

                int  postID        = 0;
                bool success       = false;
                bool hasCatchError = false;
                try
                {
                    success = PostBOV5.Instance.ReplyThread(
                        My, ThreadID, postType, 0, subject, content, enableEmoticons, enableHTML, enableMaxCode3, enableSignature
                        , enableReplyNotice, ForumID, postNickName, iPAddress, 0, new AttachmentCollection(), false, out postID);
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                    hasCatchError = true;
                }

                if (hasCatchError == false)
                {
                    if (success == false)
                    {
                        CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            if (error is UnapprovedError)
                            {
                                _Request.Clear();
                                AlertWarning(error.Message);
                            }
                            else
                            {
                                msgDisplay.AddError(error);
                            }
                        });
                    }
                    else
                    {
                        ValidateCodeManager.CreateValidateCodeActionRecode(validateCodeAction);
                        bool returnLastUrl = _Request.Get <int>("tolastpage", Method.Post, 0) == 1;

                        UserBO.Instance.UpdateUserReplyReturnThreadLastPage(My, returnLastUrl);

                        if (IsAjaxRequest)
                        {
                            AlertSuccess("操作成功");//告诉客户端操作成功
                            if (returnLastUrl)
                            {
                                PageNumber = PostBOV5.Instance.GetThread(ThreadID).TotalPages;
                            }
                            else
                            {
                                PageNumber         = PageNumber;
                                m_ThreadLastPostID = postID;
                            }
                            //_Request.Clear();
                        }
                        else
                        {
                            string returnUrl;
                            if (returnLastUrl)
                            {
                                returnUrl = BbsUrlHelper.GetLastThreadUrl(Forum.CodeName, ThreadID, postID, PostBOV5.Instance.GetThread(ThreadID).TotalPages, true);
                            }
                            else
                            {
                                returnUrl = BbsUrlHelper.GetThreadUrl(Forum.CodeName, ThreadID, PostBOV5.Instance.GetThread(ThreadID).ThreadTypeString, PageNumber) + "?lastPostID=" + postID;
                            }
                            Response.Redirect(returnUrl);
                        }
                    }
                }
            }
        }
示例#22
0
 protected string GetImageUrl(string actionType)
 {
     return(ValidateCodeManager.GetValidateCodeImageUrl(actionType, false, null));
 }
示例#23
0
        public void ProcessRequest(System.Web.HttpContext context)
        {
            int    maxId = 0, userId = 0, targetUserID = 0, messageCount = 0;
            string action = context.Request["issend"];
            string data   = string.Empty;

            userId = UserBO.Instance.GetCurrentUserID();
            int.TryParse(context.Request["maxid"], out maxId);
            int.TryParse(context.Request["tuid"], out targetUserID);
            int.TryParse(context.Request["count"], out messageCount);

            context.Response.CacheControl = "no-cache";

            ChatMessageCollection messages;

            string validateActionName = "sendmessage";

            //messages = ChatBO.Instance.GetMessages(userId, targetUserID, maxId, messageCount);

            if (action != "true")
            {
                messages = ChatBO.Instance.GetLastChatMessages(userId, targetUserID, maxId, messageCount);
            }
            else
            {
                //ChatMessage message;
                string content = context.Request["content"];

                using (ErrorScope es = new ErrorScope())
                {
                    if (!ValidateCodeManager.CheckValidateCode(validateActionName, false))
                    {
                        context.Response.Write("{state:2,data:'验证码错误'}");
                        context.Response.End();
                        return;
                    }
                    else
                    {
                        messages = ChatBO.Instance.SendMessage(userId, targetUserID, content, IPUtil.GetCurrentIP(), true, maxId);
                    }

                    if (es.HasUnCatchedError)
                    {
                        es.CatchError <ErrorInfo>(delegate(ErrorInfo er)
                        {
                            if (!string.IsNullOrEmpty(data))
                            {
                                data += "<br />";
                            }
                            data += er.Message;
                        });
                        context.Response.Write("{state:1,data:'" + StringUtil.ToJavaScriptString(data) + "'}");
                        context.Response.End();
                        return;
                    }
                }

                //messages = new ChatMessageCollection();
                //if (message != null)
                //    messages.Add(message);
            }

            data = JsonBuilder.GetJson(messages);
            context.Response.ClearContent();

            if (messages.Count > 0)
            {
                context.Response.Write("{state:0,data:" + data + "}");
            }
            else
            {
                context.Response.Write("null");
            }
            context.Response.End();
        }
示例#24
0
        protected override void OnLoadComplete(EventArgs e)
        {
            if (AllSettings.Current.SpacePermissionSet.Can(My, SpacePermissionSet.Action.UseBlog) == false)
            {
                ShowError("您所在的用户组没有发表日志的权限");
            }

            if (My.Roles.IsInRole(Role.FullSiteBannedUsers))
            {
                ShowError("您已经被整站屏蔽不能发表日志");
            }

            if (_Request.IsClick("save"))
            {
                #region 页面提交时

                int id         = _Request.Get <int>("id", 0);
                int?categoryID = _Request.Get <int>("category");

                string subject   = _Request.Get("subject");
                string content   = _Request.Get("content", Method.Post, string.Empty, false);
                string password  = _Request.Get("password");
                string tagNames  = _Request.Get("tag", Method.Post, string.Empty);
                string currentIP = _Request.IpAddress;

                bool enableComment = _Request.IsChecked("enablecomment", Method.Post, true);

                PrivacyType privacyType = _Request.Get <PrivacyType>("privacytype", PrivacyType.SelfVisible);

                using (ErrorScope es = new ErrorScope())
                {
                    MessageDisplay md = CreateMessageDisplay(GetValidateCodeInputName("CreateBlogArticle"));

                    if (CheckValidateCode("CreateBlogArticle", md))
                    {
                        bool succeed = false;

                        bool useHtml = _Request.Get("format") == "html";
                        bool useUbb  = _Request.Get("format") == "ubb";

                        if (IsEditMode)
                        {
                            succeed = BlogBO.Instance.UpdateBlogArticle(MyUserID, currentIP, id, subject, content, categoryID, tagNames.Split(','), enableComment, privacyType, password, useHtml, useUbb);
                        }
                        else
                        {
                            succeed = BlogBO.Instance.CreateBlogArticle(MyUserID, currentIP, subject, content, categoryID, tagNames.Split(','), enableComment, privacyType, password, useHtml, useUbb, out id);
                        }

                        if (succeed)
                        {
                            ValidateCodeManager.CreateValidateCodeActionRecode("CreateBlogArticle");

                            BbsRouter.JumpTo("app/blog/index");
                        }
                        else
                        {
                            if (es.HasError)
                            {
                                es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                                {
                                    md.AddError(error);
                                });
                            }
                        }
                    }
                }

                #endregion
            }
            else if (_Request.IsClick("addcategory"))
            {
                AddCategory();
            }


            #region 正常页面加载

            if (IsEditMode)
            {
                using (ErrorScope es = new ErrorScope())
                {
                    int?articleID = _Request.Get <int>("id");

                    if (articleID.HasValue)
                    {
                        m_Article = BlogBO.Instance.GetBlogArticleForEdit(MyUserID, articleID.Value);

                        if (m_Article != null)
                        {
                            string[] tagNames = new string[m_Article.Tags.Count];

                            for (int i = 0; i < tagNames.Length; i++)
                            {
                                tagNames[i] = m_Article.Tags[i].Name;
                            }

                            m_ArticleTagList = StringUtil.Join(tagNames);

                            m_CategoryList = BlogBO.Instance.GetUserBlogCategories(m_Article.UserID);
                        }
                    }

                    if (m_Article == null)
                    {
                        ShowError("日志不存在");
                    }

                    if (es.HasUnCatchedError)
                    {
                        es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            ShowError(error);
                        });
                    }

                    base.OnLoadComplete(e);
                }

                AddNavigationItem(FunctionName, BbsRouter.GetUrl("app/blog/index"));
                AddNavigationItem("编辑日志");
            }
            else
            {
                m_Article = new BlogArticle();

                m_ArticleTagList = string.Empty;

                m_CategoryList = BlogBO.Instance.GetUserBlogCategories(MyUserID);

                AddNavigationItem(FunctionName, BbsRouter.GetUrl("app/blog/index"));
                AddNavigationItem("发表新日志");
            }


            m_ArticleList = BlogBO.Instance.GetUserBlogArticles(MyUserID, MyUserID, null, null, 1, 5);
            #endregion
        }
示例#25
0
        /// <summary>
        /// 初始化业务逻辑层
        /// </summary>
        ///
        public static void Init()
        {
            //TODO:错误处理,不能因为异常导致程序启动失败

            //注册应用程序
            AppManager.RegisterApp(new BasicApp());

            #region 注册AppHandler

            AppHandlerManager.RegisterAppHandler(new DownloadHandler());
            AppHandlerManager.RegisterAppHandler(new DeleteTempFileHandler());
            AppHandlerManager.RegisterAppHandler(new OutputValidateCodeHandler());
            AppHandlerManager.RegisterAppHandler(new ExecuteJobHandler());
            AppHandlerManager.RegisterAppHandler(new StepByStepTaskHandler());
            AppHandlerManager.RegisterAppHandler(new UploadTempFileHandler());

            AppHandlerManager.RegisterAppHandler(new RegValidateHandler());
            AppHandlerManager.RegisterAppHandler(new ChatMessageHandler());
            AppHandlerManager.RegisterAppHandler(new AvatarHandler());
            AppHandlerManager.RegisterAppHandler(new TempDataHandler());
#if !Passport
            AppHandlerManager.RegisterAppHandler(new Js_EmoticonHandler());
            AppHandlerManager.RegisterAppHandler(new NotifyHandler());
            AppHandlerManager.RegisterAppHandler(new DoingHandler());
            AppHandlerManager.RegisterAppHandler(new ChangeSkinHandler());
            AppHandlerManager.RegisterAppHandler(new OnlineInfoHandler());
            AppHandlerManager.RegisterAppHandler(new PostAuthorInfoHandler());
            //AppHandlerManager.RegisterAppHandler(new AttachmentHandler());
#endif

            #endregion

            #region 注册积分动作规则

            PointActionManager.RegisterPointActionType(UserPointAction.Instance);
            PointActionManager.RegisterPointActionType(InvitePointAction.Instance);
#if !Passport
            PointActionManager.RegisterPointActionType(SharePointAction.Instance);
            PointActionManager.RegisterPointActionType(BlogPointAction.Instance);
            //PointActionManager.RegisterPointActionType(PointShowPointAction.Instance);
            PointActionManager.RegisterPointActionType(CommentPointAction.Instance);
            PointActionManager.RegisterPointActionType(AlbumPointAction.Instance);
            PointActionManager.RegisterPointActionType(DoingPointAction.Instance);
            PointActionManager.RegisterPointActionType(ForumPointAction.Instance);
#endif
            #endregion

            #region 注册验证码样式

            ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style1());
            ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style2());
            ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style3());
            ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style4());
            ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style5());
            ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style6());
            ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style7());
            ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style8());
            ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style9());
            ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style10());
            ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style11());
            ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style12());

            #endregion

            #region 注册验证码动作

            ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("注册", "Register", false));
            ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("登录", "Login", false));
            ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("管理员登陆", "ManageLogin", false));
            ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("找回密码", "recoverpassword", false));

            ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("发表分享", "CreateShare", true));
            //ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("发表收藏", "CreateCollection", true));
            ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("发表日志", "CreateBlogArticle", true));
            //ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("发表记录", "CreateDoing", true));
            ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("发表评论", "CreateComment", true));

            //论坛---
            ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("发表主题", "CreateTopic", true));
            ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("回复主题", "ReplyTopic", true));
            ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("参与投票", "Vote", true));
            ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("登陆带密码版块", "SignInForum", true));
            ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("加好友", "AddFriend", true));
            ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("对话", "SendMessage", true));
            ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("打招呼", "Hail", true));
            #endregion

            #region 注册XCmd

            XCmdManager.RegisterXCmd(new DeleteFileCmd());
            XCmdManager.RegisterXCmd(new ResetVarsCacheCmd());
            XCmdManager.RegisterXCmd(new ResetUserCacheCmd());

            XCmdManager.RegisterXCmd(new RecodeTodayPostsCmd());

#if !Passport
            XCmdManager.RegisterXCmd(new ResetAuthUserCacheCmd());
            XCmdManager.RegisterXCmd(new ResetAlbumCacheCmd());
            XCmdManager.RegisterXCmd(new ResetDenouncingCacheCmd());
            XCmdManager.RegisterXCmd(new ResetFeedCommentInfoCmd());
#endif

            #endregion

#if !Passport
            #region 注册 PermissionSetWithNode

            SettingManager.RegisterPermissionWithNode(new ForumPermissionSetNode().TypeName, new ForumPermissionSet());
            SettingManager.RegisterPermissionWithNode(new ManageForumPermissionSetNode().TypeName, new ManageForumPermissionSet());

            #endregion

            #region 注册UploadAction

            FileManager.RegisterUploadAction(new UploadAttachmentAction());
            FileManager.RegisterUploadAction(new UploadAlbumPhotoAction());
            FileManager.RegisterUploadAction(new UploadDiskFileAction());

            #endregion

            #region 注册 IShareProvider

            ProviderManager.Add <IShareProvider>(new ShareBlogArticleProvider());
            ProviderManager.Add <IShareProvider>(new ShareAlbumProvider());
            ProviderManager.Add <IShareProvider>(new SharePhotoProvider());
            ProviderManager.Add <IShareProvider>(new ShareUserProvider());
            ProviderManager.Add <IShareProvider>(new ShareThreadProvider());

            #endregion
#endif

            #region 取数据库时间和时区作为当前时间和时区,避免web和数据库时间不同步

            SetTimeAsDatabase();

            #endregion

            #region 注册计划任务

            JobManager.RegisterJob(new BeforeRequestInDay0AM());
            JobManager.RegisterJob(new BeforeRequestIn5M());



            JobManager.RegisterJob(new AfterRequestIn5M());
            JobManager.RegisterJob(new AfterRequestIn3H());
            JobManager.RegisterJob(new AfterRequestInDay3AM());

            JobManager.RegisterJob(new ClearNotifyJob());
            JobManager.RegisterJob(new ClearChatMessageJob());
            JobManager.RegisterJob(new ClearPointLogJob());

#if !Passport
            JobManager.RegisterJob(new UpdateThreadViewsJob());
            JobManager.RegisterJob(new SaveOnlineUserJob());

            JobManager.RegisterJob(new DeleteFeedJob());
            JobManager.RegisterJob(new DeletePropLogJob());
            JobManager.RegisterJob(new DeleteOperationLogJob());

            JobManager.RegisterJob(new BaiduPageOpJop());
#endif
            //在所有计划任务注册完之后  启动线程
            JobManager.StartJobThread();

            #endregion

            #region 初始化PASSPORT指令引擎

            if (AllSettings.Current.PassportServerSettings.EnablePassportService)
            {
                PassportBO.StartInstructEngine();
            }

            #endregion
        }