Пример #1
0
        protected override bool SetSettingItemValue(SettingBase setting, System.Reflection.PropertyInfo property)
        {
            if (property.Name == "ViewIPFields")
            {
                SiteSettings   temp       = (SiteSettings)setting;
                MessageDisplay msgDisplay = CreateMessageDisplay("ViewIPFields", "new_ViewIPFields");
                temp.ViewIPFields = new ExceptableSetting.ExceptableItem_Int().GetExceptable("ViewIPFields", msgDisplay);

                if (msgDisplay.HasAnyError())
                {
                    ThrowError <Errors.CustomError>(new Errors.CustomError("", ""));
                    return(false);
                }
                return(true);
            }
            else if (property.Name == "ScopeList")
            {
                SiteSettings temp = (SiteSettings)setting;
                temp.ScopeList = SiteSettings.ScopeList;
                return(true);
            }

            else
            {
                return(base.SetSettingItemValue(setting, property));
            }
        }
        private bool CreateExtendField(ExtendedFieldType fieldType)
        {
            MessageDisplay msgDisplay  = CreateMessageDisplay();
            ExtendedField  extendFiled = GetExtendFieldInfo(fieldType);

            extendFiled.Key = Guid.NewGuid().ToString();

            ExtendedFieldSettings settings = SettingManager.CloneSetttings <ExtendedFieldSettings>(AllSettings.Current.ExtendedFieldSettings);

            settings.Version = Guid.NewGuid().ToString();

            foreach (ExtendedField field in AllSettings.Current.ExtendedFieldSettings.Fields)
            {
                if (string.Compare(extendFiled.Name, field.Name, true) == 0)
                {
                    msgDisplay.AddError("已经存在同名的扩展字段\"" + field.Name + "\",请更换名称");
                    break;
                }
            }

            if (msgDisplay.HasAnyError())
            {
                return(false);
            }

            settings.Fields.Add(extendFiled);

            SettingManager.SaveSettings(settings);
            return(true);
        }
Пример #3
0
        private void checkNewItem(Exceptable <T1> items, ExceptionItem <T1> item, string name, List <int> sortOrders, List <Guid> roleIDs, MessageDisplay msgDisplay)
        {
            if (item != null)
            {
                if (item.SortOrder == -1)
                {
                    int maxSortOrder = 0;
                    foreach (int sortOrder in sortOrders)
                    {
                        if (sortOrder > maxSortOrder)
                        {
                            maxSortOrder = sortOrder;
                        }
                    }
                    item.SortOrder = maxSortOrder + 1;
                }
                else if (sortOrders.Contains(item.SortOrder) && msgDisplay.HasAnyError() == false)
                {
                    msgDisplay.AddError("new_" + name, "排序数字不能重复");
                }

                if (item.RoleID != Guid.Empty && roleIDs.Contains(item.RoleID))
                {
                    msgDisplay.AddError("new_" + name, "已经存在对用户组“" + AllSettings.Current.RoleSettings.GetRole(item.RoleID).Name + "”的例外设置,不能重复设置");
                }
                else
                {
                    if (item.RoleID != Guid.Empty)
                    {
                        roleIDs.Add(item.RoleID);
                    }
                }
                items.Add(item);
            }
        }
Пример #4
0
        private void ShieldUser()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("username", "banneddate");

            string   username   = _Request.Get("username", Method.Post, string.Empty, false);
            DateTime bannedDate = DateTimeUtil.ParseEndDateTime(_Request.Get("banneddate", Method.Post));
            User     user       = UserBO.Instance.GetUser(username);

            if (user == null)
            {
                msgDisplay.AddError("用户名错误!");
            }

            if (bannedDate < DateTimeUtil.Now)
            {
                msgDisplay.AddError("您输入的日期已过时!");
            }

            if (msgDisplay.HasAnyError())
            {
                return;
            }


            if (AllSettings.Current.ManageForumPermissionSet.Nodes.GetPermission(Forum.ForumID).Can(My, ManageForumPermissionSetNode.ActionWithTarget.BanUser, user.UserID))
            {
                UserBO.Instance.BanUser(My, user.UserID, Forum.ForumID, bannedDate, string.Empty);
                _Request.Clear(Method.Post);
            }
            else
            {
                msgDisplay.AddError(string.Format("您没有权限在 {0} 版块屏蔽用户 {1}", Forum.ForumName, user.Username));
            }
        }
Пример #5
0
        private void SaveSetting()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("EnableShareFunction", "HotDays");

            ShareSettings shareSettings = new ShareSettings();

            shareSettings.EnableShareFunction = _Request.Get <bool>("EnableShareFunction", Method.Post, true);
            shareSettings.HotShareSortType    = _Request.Get <HotShareSortType>("HotShareSortType", Method.Post, HotShareSortType.ShareCount);

            int hotDays = _Request.Get <int>("HotDays", Method.Post, 3);


            if (hotDays < 1)
            {
                msgDisplay.AddError("HotDays", "天数必须大于0");
                return;
            }

            shareSettings.HotDays = hotDays;

            if (!msgDisplay.HasAnyError())
            {
                SettingManager.SaveSettings(shareSettings);
            }
        }
Пример #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (_Request.IsClick("search"))
            {
                MessageDisplay msgDisplay = CreateMessageDisplay();
                int            beginID    = _Request.Get <int>("beginid", Method.Post, 1);
                int            endID      = _Request.Get <int>("endid", Method.Post, 0);

                if (endID == 0)
                {
                    msgDisplay.AddError("请输入要结束的用户ID");
                }
                else if (endID < beginID)
                {
                    msgDisplay.AddError("结束的用户ID必须大于开始的用户ID");
                }
                if (msgDisplay.HasAnyError())
                {
                    m_UserIDs = new List <int>();
                    return;
                }

                HasGet        = true;
                m_BeginUserID = beginID.ToString();
                m_EndUserID   = endID.ToString();
                m_UserIDs     = UserBO.Instance.GetNotUserIDs(beginID, endID, 1, PageSize, out TotalCount);
                isSearch      = true;
                SetPager("list", Dialog + "/user-notuseids.aspx?page={0}&beginid=" + beginID + "&endid=" + endID, 1, PageSize, TotalCount);
                //Response.Redirect("user-notuserids.aspx?beginid=" + beginID + "&endid=" + endID);
            }
            else if (_Request.Get("beginid", Method.Get, null) != null)
            {
                HasGet = true;
            }
        }
Пример #7
0
        private void checkItem(Exceptable <T1> items, ExceptionItem <T1> item, string name, int id, List <int> sortOrders, List <Guid> roleIDs, MessageDisplay msgDisplay)
        {
            if (item != null)
            {
                //msgDisplay.HasAnyError == false 是为避免  有两个SortOrder 不为数字出错了(这时都为0)  而这里又提示重复
                if (id != 0 && sortOrders.Contains(item.SortOrder) && msgDisplay.HasAnyError() == false)
                {
                    msgDisplay.AddError(name, id, "排序数字不能重复");
                }
                else
                {
                    if (id != 0)
                    {
                        sortOrders.Add(item.SortOrder);
                    }
                    //items.Add(item);
                }

                if (item.RoleID != Guid.Empty && roleIDs.Contains(item.RoleID))
                {
                    msgDisplay.AddError(name, id, "已经存在对用户组“" + AllSettings.Current.RoleSettings.GetRole(item.RoleID).Name + "”的例外设置,不能重复设置");
                }
                else
                {
                    if (item.RoleID != Guid.Empty)
                    {
                        roleIDs.Add(item.RoleID);
                    }
                    items.Add(item);
                }
            }
        }
Пример #8
0
        private void SaveUserSettings()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            UserSettings userSetting = new UserSettings();

            userSetting.SignatureFormat = new ExceptableItem_Enum <SignatureFormat>().GetExceptable("SignatureFormat", msgDisplay);
            userSetting.AllowFlashTag   = new ExceptableItem_bool().GetExceptable("AllowFlashTag", msgDisplay);
            userSetting.AllowImageTag   = new ExceptableItem_bool().GetExceptable("AllowImageTag", msgDisplay);
            userSetting.AllowTableTag   = new ExceptableItem_bool().GetExceptable("EnableDisk", msgDisplay);
            userSetting.AllowUrlTag     = new ExceptableItem_bool().GetExceptable("AllowUrlTag", msgDisplay);
            userSetting.AllowVideoTag   = new ExceptableItem_bool().GetExceptable("AllowVideoTag", msgDisplay);
            userSetting.AllowAudioTag   = new ExceptableItem_bool().GetExceptable("AllowAudioTag", msgDisplay);

            userSetting.AllowDefaultEmoticon = new ExceptableItem_bool().GetExceptable("AllowDefaultEmoticon", msgDisplay);
            userSetting.AllowUserEmoticon    = new ExceptableItem_bool().GetExceptable("AllowUserEmoticon", msgDisplay);

            userSetting.SignatureHeight = new ExceptableItem_Int().GetExceptable("SignatureHeight", msgDisplay);
            userSetting.SignatureLength = new ExceptableItem_Int().GetExceptable("SignatureLength", msgDisplay);


            if (!msgDisplay.HasAnyError())
            {
                SettingManager.SaveSettings(userSetting);
            }
        }
Пример #9
0
        private void SaveSetting()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("executetime", "days");

            DeleteOperationLogJobSettings setting = new DeleteOperationLogJobSettings();

            string valueString = _Request.Get("executetime", Method.Post, string.Empty);
            int    value;

            if (!int.TryParse(valueString, out value))
            {
                msgDisplay.AddError("executetime", Lang_Error.Feed_FeedJobExecuteTimeFormatError);
            }
            else if (value < 0 || value > 23)
            {
                msgDisplay.AddError("executetime", Lang_Error.Feed_FeedJobInvalidExecuteTimeError);
            }
            else
            {
                setting.ExecuteTime = value;
            }


            setting.SaveLogDays   = _Request.Get <int>("SaveDays", Method.Post, 30);
            setting.DataClearMode = _Request.Get <JobDataClearMode>("DataClearMode", JobDataClearMode.Disabled);
            setting.SaveLogRows   = _Request.Get <int>("SaveRows", Method.Post, 10000);

            if (msgDisplay.HasAnyError())
            {
                return;
            }

            try
            {
                using (new ErrorScope())
                {
                    bool success = SettingManager.SaveSettings(setting);

                    if (!success)
                    {
                        CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            msgDisplay.AddError(error);
                        });
                    }
                    else
                    {
                        string rawUrl = Request.RawUrl;

                        BbsRouter.JumpToUrl(rawUrl, "success=1");
                    }
                }
            }
            catch (Exception ex)
            {
                msgDisplay.AddError(ex.Message);
            }
        }
Пример #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (_Request.IsClick("CreateImpression"))
            {
                MessageDisplay msgDisplay = CreateMessageDisplayForForm("ImpressionForum");
                string         text       = _Request.Get("Text", Method.Post, string.Empty);

                bool success;

                using (ErrorScope es = new ErrorScope())
                {
                    try
                    {
                        success = ImpressionBO.Instance.CreateImpression(My, User, text);
                        if (success == false)
                        {
                            es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                            {
                                msgDisplay.AddError(error);
                            });
                        }
                        else
                        {
                            m_IsShowImpressionInput = false;
                        }
                    }
                    catch (Exception ex)
                    {
                        msgDisplay.AddException(ex);
                    }

                    if (msgDisplay.HasAnyError())
                    {
                        m_IsShowImpressionInput = true;
                    }
                }
            }
            else if (_Request.Get <int>("typeid", Method.Get, 0) > 0)
            {
                MessageDisplay msgDisplay = CreateMessageDisplay();
                int            typeID     = _Request.Get <int>("TypeID", Method.Get, 0);
                using (ErrorScope es = new ErrorScope())
                {
                    try
                    {
                        ImpressionBO.Instance.DeleteImpressionTypeForUser(My, typeID);
                    }
                    catch (Exception ex)
                    {
                        msgDisplay.AddError(ex.Message);
                    }
                }
            }

            WaitForFillSimpleUsers <ImpressionRecord>(ImpressionRecordList, 0);
            WaitForFillSimpleUsers <Impression>(ImpressionList);
        }
Пример #11
0
        private void ExchangePoint()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("password", "pointvalue", "pointtype", "targetpointtype");

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

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

            int pointValue;

            if (!int.TryParse(valueString, out pointValue))
            {
                msgDisplay.AddError("pointvalue", Lang_Error.User_UserPointExechangePointValueError);
            }

            valueString = _Request.Get("pointtype", Method.Post, string.Empty);
            if (string.Empty == valueString)
            {
                msgDisplay.AddError("pointtype", Lang_Error.User_UserPointEmptyExchangePointTypeError);
            }

            UserPointType pointType = StringUtil.TryParse <UserPointType>(valueString, UserPointType.Point1);

            valueString = _Request.Get("targetpointtype", Method.Post, string.Empty);
            if (string.Empty == valueString)
            {
                msgDisplay.AddError("targetpointtype", Lang_Error.User_UserPointEmptyExchangeTargetPointTypeError);
            }


            UserPointType targetPointType = StringUtil.TryParse <UserPointType>(valueString, UserPointType.Point1);

            if (msgDisplay.HasAnyError())
            {
                return;
            }

            try
            {
                if (!UserBO.Instance.ExechangePoint(My, password, pointType, targetPointType, pointValue))
                {
                    CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
                else
                {
                    _Request.Clear(Method.Post);
                }
            }
            catch (Exception ex)
            {
                msgDisplay.AddException(ex);
            }
        }
Пример #12
0
        public void SaveEmotSettings()
        {
            MessageDisplay            msgdisplay   = CreateMessageDisplay("shortcut");
            DefaultEmoticonCollection tempEmotList = new DefaultEmoticonCollection(EmotGroup);

            foreach (DefaultEmoticon emot in this.PagedEmoticons)
            {
                DefaultEmoticon tempEmot = new DefaultEmoticon(EmotGroup);
                tempEmot.FileName  = emot.FileName;
                tempEmot.SortOrder = _Request.Get <int>("sortorder." + emot.EmoticonID, Method.Post, 0);
                tempEmot.Shortcut  = _Request.Get("shortcut." + emot.EmoticonID, Method.Post, "_null_");
                tempEmot.Group     = emot.Group;
                tempEmotList.Add(tempEmot);
            }

            int line = 0;

            foreach (DefaultEmoticon emot in tempEmotList)
            {
                if (string.IsNullOrEmpty(emot.Shortcut))
                {
                    msgdisplay.AddError("shortcut", line, "表情的快捷方式不能为空!");
                }

                if (emot.Shortcut.IndexOf('"') > -1 || emot.Shortcut.IndexOf('>') > -1 || emot.Shortcut.IndexOf('<') > -1)
                {
                    msgdisplay.AddError("shortcut", line, "表情的快捷方式不能包含&nbsp;\"&nbsp;&lt;&nbsp;&gt;");
                }
                line++;
            }



            if (!msgdisplay.HasAnyError())
            {
                foreach (DefaultEmoticon emot in this.PagedEmoticons)
                {
                    foreach (DefaultEmoticon tempemot in tempEmotList)
                    {
                        if (emot.FileName == tempemot.FileName)
                        {
                            emot.Shortcut  = tempemot.Shortcut;
                            emot.SortOrder = tempemot.SortOrder;
                        }
                    }
                }

                SettingManager.SaveSettings(AllSettings.Current.DefaultEmotSettings);

                EmotGroup.Reorder();
            }
            else
            {
                msgdisplay.AddError(new DataNoSaveError());
            }
        }
Пример #13
0
        protected override bool SetSettingItemValue(SettingBase setting, System.Reflection.PropertyInfo property)
        {
            MessageDisplay msgDisplay = MsgDisplayForSaveSettings;

            if (property.Name == "DisplaySignature")
            {
                BbsSettings temp = (BbsSettings)setting;
                temp.DisplaySignature = new ExceptableSetting.ExceptableItem_bool().GetExceptable("DisplaySignature", msgDisplay);

                if (msgDisplay.HasAnyError())
                {
                    //ThrowError<Errors.CustomError>(new Errors.CustomError("", ""));
                    return false;
                }
                return true;
            }
            else if (property.Name == "MaxAttachmentCountInDay")
            {
                BbsSettings temp = (BbsSettings)setting;
                temp.MaxAttachmentCountInDay = new ExceptableSetting.ExceptableItem_Int().GetExceptable("MaxAttachmentCountInDay", msgDisplay);

                if (msgDisplay.HasAnyError())
                {
                    //ThrowError<Errors.CustomError>(new Errors.CustomError("", ""));
                    return false;
                }
                return true;
            }
            else if (property.Name == "MaxTotalAttachmentsSizeInDay")
            {
                BbsSettings temp = (BbsSettings)setting;
                temp.MaxTotalAttachmentsSizeInDay = new ExceptableSetting.ExceptableItem_FileSize().GetExceptable("MaxTotalAttachmentsSizeInDay", msgDisplay);

                if (msgDisplay.HasAnyError())
                {
                    //ThrowError<Errors.CustomError>(new Errors.CustomError("", ""));
                    return false;
                }
                return true;
            }
            else
                return base.SetSettingItemValue(setting, property);
        }
Пример #14
0
        private void SaveEmailSettings()
        {
            MessageDisplay            msgDisplay = CreateMessageDisplay("smtpserver", "SmtpServerAccount", "SmtpServerPassword", "SenderEmail", "Port");
            int                       line       = 0;
            EmailSendServerCollection emails     = new EmailSendServerCollection();

            int[] emailIDs = _Request.GetList <int>("emailids", Method.Post, new int[0]);

            EmailSettings settings = new EmailSettings();

            bool enableSend = _Request.Get <bool>("EnableSendEmail", Method.Post, false);

            if (enableSend)
            {
                foreach (int i in emailIDs)
                {
                    bool            isnew     = _Request.Get <bool>("isnew." + i, Method.Post, false);
                    string          keysubfix = isnew ? ".new." + i : "." + i;
                    EmailSendServer email     = new EmailSendServer();

                    email.EmailID            = i;
                    email.SmtpServer         = _Request.Get("smtpserver" + keysubfix, Method.Post);
                    email.SmtpServerAccount  = _Request.Get("SmtpServerAccount" + keysubfix, Method.Post);
                    email.SmtpServerPassword = _Request.Get("SmtpServerPassword" + keysubfix, Method.Post);
                    email.SenderEmail        = _Request.Get("senderemail" + keysubfix, Method.Post);
                    email.EnableSSL          = _Request.Get <bool>("EnableSSL" + keysubfix, Method.Post, false);
                    email.Port = _Request.Get <int>("Port" + keysubfix, Method.Post, 0);

                    ValidateEmail(email, msgDisplay, line);

                    emails.Add(email);

                    line++;
                }
                settings.SendServers = emails;

                if (emails.Count == 0)
                {
                    msgDisplay.AddError(new CustomError("开启邮件发送功能时至少填写一个Email帐号"));
                }
            }
            else
            {
                settings.SendServers = AllSettings.Current.EmailSettings.SendServers;
            }

            settings.EnableSendEmail = enableSend;

            if (!msgDisplay.HasAnyError())
            {
                SettingManager.SaveSettings(settings);
            }

            m_Emails = settings.SendServers;
        }
Пример #15
0
        public bool SaveSettings()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("OtherAliasName");

            int[]    postIndexs = _Request.GetList <int>("postindex", Method.Post, new int[0]);
            string[] aliasNames = StringUtil.Split(_Request.Get("newAlias", Method.Post));

            PostIndexAliasSettings settings;

            settings = new PostIndexAliasSettings();

            string otherName = _Request.Get("OtherAliasName", Method.Post);

            if (string.IsNullOrEmpty(otherName))
            {
                msgDisplay.AddError("通用楼层别名错误");
            }
            else
            {
                string s;
                try
                {
                    s = string.Format(otherName, 1);
                }
                catch
                {
                    msgDisplay.AddError("通用楼层别名无效");
                }
            }


            PostAliasNameCollection alias = new PostAliasNameCollection();

            for (int i = 0; i < postIndexs.Length; i++)
            {
                if (!alias.ContainsKey(postIndexs[i]))
                {
                    alias.Add(new PostAliasNameItem(postIndexs[i], aliasNames[i]));
                }
                else
                {
                    msgDisplay.AddError("重复的楼层编号");
                }
            }
            if (!msgDisplay.HasAnyError())
            {
                settings.AliasNames     = alias;
                settings.OtherAliasName = otherName;
                SettingManager.SaveSettings(settings);

                return(true);
            }
            return(false);
        }
Пример #16
0
        public void Success(string form, SuccessTemplate template)
        {
            MessageDisplay messageDisplay = MessageDisplay.GetFrom(form);

            if (messageDisplay != null)
            {
                if (messageDisplay.HasAnyError() == false)
                {
                    template();
                }
            }
        }
Пример #17
0
        public bool HasAnyErrorFunction(string form)
        {
            MessageDisplay messageDisplay = MessageDisplay.GetFrom(form);

            if (messageDisplay == null)
            {
                return(false);
            }
            else
            {
                return(messageDisplay.HasAnyError());
            }
        }
Пример #18
0
        private void SaveSetting()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("EnableFavoriteFunction");

            FavoriteSettings favoriteSettings = new FavoriteSettings();

            favoriteSettings.EnableFavoriteFunction = _Request.Get <bool>("EnableFavoriteFunction", Method.Post, true);

            if (!msgDisplay.HasAnyError())
            {
                SettingManager.SaveSettings(favoriteSettings);
            }
        }
Пример #19
0
        public void DeleteEmotGroup()
        {
            MessageDisplay msgdisplay = CreateMessageDisplay();

            AllSettings.Current.DefaultEmotSettings.DeleteGroup(Group.GroupID, msgdisplay);
            if (msgdisplay.HasAnyError())
            {
            }
            else
            {
                Return(true);
            }
        }
Пример #20
0
        private void SaveSetting()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("AllowGuestAccess");

            SpaceSettings spaceSettings = new SpaceSettings();

            spaceSettings.AllowGuestAccess = _Request.Get <bool>("AllowGuestAccess", Method.Post, false);

            if (!msgDisplay.HasAnyError())
            {
                SettingManager.SaveSettings(spaceSettings);
            }
        }
Пример #21
0
        private void CreateGroup()
        {
            MessageDisplay msgdisply = CreateMessageDisplay();
            string         groupname = _Request.Get("groupname", Method.Post, string.Empty, false);
            int            sortorder = _Request.Get <int>("sortorder", Method.Post, 0);

            AllSettings.Current.DefaultEmotSettings.CreateGroup(sortorder, groupname, msgdisply);

            if (!msgdisply.HasAnyError())
            {
                Return(true);
            }
        }
Пример #22
0
        private void DeleteAttachment()
        {
            int?atttachmentID = _Request.Get <int>("attachmentID", Method.Post);
            int?forumID       = _Request.Get <int>("forumID", Method.Post);

            bool success = false;

            using (ErrorScope es = new ErrorScope())
            {
                MessageDisplay msgDisplay = CreateMessageDisplay();


                if (atttachmentID == null)
                {
                    msgDisplay.AddError(new InvalidParamError("atttachmentID").Message);
                }

                if (forumID == null)
                {
                    msgDisplay.AddError(new InvalidParamError("forumID").Message);
                }

                if (msgDisplay.HasAnyError())
                {
                    return;
                }

                try
                {
                    success = PostBOV5.Instance.DeleteAttachments(My, forumID.Value, new int[] { atttachmentID.Value });
                }
                catch (Exception ex)
                {
                    msgDisplay.AddException(ex);
                }

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

            if (success)
            {
                Return(atttachmentID.Value);
            }
        }
Пример #23
0
        private void SaveSetting()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("MaxAlbumCapacity", "MaxPhotoFileSize", "new_MaxAlbumCapacity", "new_MaxPhotoFileSize");

            AlbumSettings albumSettings = new AlbumSettings();

            albumSettings.EnableAlbumFunction = _Request.Get <bool>("EnableAlbumFunction", Method.Post, true);
            albumSettings.MaxAlbumCapacity    = new ExceptableItem_FileSize().GetExceptable("MaxAlbumCapacity", msgDisplay);
            albumSettings.MaxPhotoFileSize    = new ExceptableItem_FileSize().GetExceptable("MaxPhotoFileSize", msgDisplay);

            if (!msgDisplay.HasAnyError())
            {
                SettingManager.SaveSettings(albumSettings);
            }
        }
Пример #24
0
        private void SaveSetting()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("EnableImpressionFunction", "TimeLimit");

            ImpressionSettings settings = new ImpressionSettings();

            settings.EnableImpressionFunction = _Request.Get <bool>("EnableBlogFunction", Method.Post, true);
            settings.TimeLimit = _Request.Get <int>("TimeLimit", Method.Post, 0);

            if (!msgDisplay.HasAnyError())
            {
                SettingManager.SaveSettings(settings);

                string rawUrl = Request.RawUrl;

                BbsRouter.JumpToUrl(rawUrl, "success=1");
            }
        }
Пример #25
0
        private void SaveSetting()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("EnableDoingFunction");

            DoingSettings doingSettings = new DoingSettings();

            doingSettings.EnableDoingFunction = _Request.Get <bool>("EnableDoingFunction", Method.Post, true);
            doingSettings.EveryDayPostLimit   = new ExceptableItem_Int().GetExceptable("EveryDayPostLimit", msgDisplay);

            if (!msgDisplay.HasAnyError())
            {
                SettingManager.SaveSettings(doingSettings);

                string rawUrl = Request.RawUrl;

                BbsRouter.JumpToUrl(rawUrl, "success=1");
            }
        }
Пример #26
0
        private void SaveSetting()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("EnableBlogFunction", "AllowHtml", "AllowUbb", "new_AllowHtml", "new_AllowUbb");

            BlogSettings blogSettings = new BlogSettings();

            blogSettings.EnableBlogFunction = _Request.Get <bool>("EnableBlogFunction", Method.Post, true);
            blogSettings.AllowHtml          = new ExceptableItem_bool().GetExceptable("AllowHtml", msgDisplay);
            blogSettings.AllowUbb           = new ExceptableItem_bool().GetExceptable("AllowUbb", msgDisplay);

            if (!msgDisplay.HasAnyError())
            {
                SettingManager.SaveSettings(blogSettings);

                string rawUrl = Request.RawUrl;

                BbsRouter.JumpToUrl(rawUrl, "success=1");
            }
        }
Пример #27
0
        private void SaveEmoticonSetting()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("Import", "Export", "MaxEmoticonCount", "MaxEmoticonFileSize", "MaxEmoticonSpace", "EnableUserEmoticons"
                                                             , "new_Import", "new_Export", "new_MaxEmoticonCount", "new_MaxEmoticonFileSize", "new_MaxEmoticonSpace", "new_EnableUserEmoticons");

            EmoticonSettings emoticonSetting = new EmoticonSettings();

            emoticonSetting.Import              = new ExceptableItem_bool().GetExceptable("Import", msgDisplay);
            emoticonSetting.Export              = new ExceptableItem_bool().GetExceptable("Export", msgDisplay);
            emoticonSetting.MaxEmoticonCount    = new ExceptableItem_Int_MoreThenZero().GetExceptable("MaxEmoticonCount", msgDisplay);
            emoticonSetting.MaxEmoticonFileSize = new ExceptableItem_FileSize().GetExceptable("MaxEmoticonFileSize", msgDisplay);
            emoticonSetting.MaxEmoticonSpace    = new ExceptableItem_FileSize().GetExceptable("MaxEmoticonSpace", msgDisplay);
            emoticonSetting.EnableUserEmoticons = _Request.Get <bool>("EnableUserEmoticons", Method.Post, false);

            if (!msgDisplay.HasAnyError())
            {
                SettingManager.SaveSettings(emoticonSetting);
            }
        }
Пример #28
0
        private void SaveSetting()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("executetime", "days");

            PointLogClearSettings setting = new PointLogClearSettings();

            setting.SaveLogDays   = _Request.Get <int>("SaveDays", Method.Post, 30);
            setting.DataClearMode = _Request.Get <JobDataClearMode>("DataClearMode", JobDataClearMode.Disabled);
            setting.SaveLogRows   = _Request.Get <int>("SaveRows", Method.Post, 10000);

            if (msgDisplay.HasAnyError())
            {
                return;
            }

            try
            {
                using (new ErrorScope())
                {
                    bool success = SettingManager.SaveSettings(setting);

                    if (!success)
                    {
                        CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            msgDisplay.AddError(error);
                        });
                    }
                    else
                    {
                        string rawUrl = Request.RawUrl;

                        BbsRouter.JumpToUrl(rawUrl, "success=1");
                    }
                }
            }
            catch (Exception ex)
            {
                msgDisplay.AddError(ex.Message);
            }
        }
Пример #29
0
        private void SaveDiskSetting()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("MaxFileCount", "MaxFileSize", "DiskSpaceSize", "EnableDisk", "AllowFileExtensions", "DefaultViewMode"
                                                             , "new_MaxFileCount", "new_MaxFileSize", "new_DiskSpaceSize", "new_EnableDisk", "new_AllowFileExtensions", "new_DefaultViewMode");

            DiskSettings diskSetting = new DiskSettings();

            //diskSetting.Import = new ExceptableItem_bool().GetExceptable("Import", msgDisplay);
            //diskSetting.Export = new ExceptableItem_bool().GetExceptable("Export", msgDisplay);
            diskSetting.MaxFileCount        = new ExceptableItem_Int_MoreThenZero().GetExceptable("MaxFileCount", msgDisplay);
            diskSetting.MaxFileSize         = new ExceptableItem_FileSize().GetExceptable("MaxFileSize", msgDisplay);
            diskSetting.DiskSpaceSize       = new ExceptableItem_FileSize().GetExceptable("DiskSpaceSize", msgDisplay);
            diskSetting.EnableDisk          = _Request.Get <bool>("EnableDisk", Method.Post, false);
            diskSetting.AllowFileExtensions = new ExceptableItem_ExtensionList().GetExceptable("AllowFileExtensions", msgDisplay);
            diskSetting.DefaultViewMode     = new ExceptableItem_Enum <FileViewMode>().GetExceptable("DefaultViewMode", msgDisplay);
            if (!msgDisplay.HasAnyError())
            {
                SettingManager.SaveSettings(diskSetting);

                JumpTo("app/setting-netdisk.aspx?success=1");
            }
        }
Пример #30
0
        private void SaveSetting()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            PropSettings settings = new PropSettings();

            settings.EnablePropFunction = _Request.Get <bool>("EnablePropFunction", Method.Post, true);
            settings.MaxPackageSize     = new ExceptableItem_Int().GetExceptable("MaxPackageSize", msgDisplay);

            settings.SaveLogDays   = _Request.Get <int>("SaveDays", Method.Post, 30);
            settings.DataClearMode = _Request.Get <JobDataClearMode>("DataClearMode", JobDataClearMode.Disabled);
            settings.SaveLogRows   = _Request.Get <int>("SaveRows", Method.Post, 10000);

            if (!msgDisplay.HasAnyError())
            {
                SettingManager.SaveSettings(settings);

                string rawUrl = Request.RawUrl;

                BbsRouter.JumpToUrl(rawUrl, "success=1");
            }
        }