protected void BtnSubmit_Click(object sender, EventArgs e)
 {
     if (base.IsValid)
     {
         SiteConfigInfo config = SiteConfig.ConfigReadFromFile();
         config.IPLockConfig.LockIPType       = this.RdnLockIPType.SelectedValue;
         config.IPLockConfig.LockIPWhite      = this.IPLockWhite.Value;
         config.IPLockConfig.LockIPBlack      = this.IPLockBlack.Value;
         config.IPLockConfig.AdminLockIPType  = this.RdnAdminLockIPType.SelectedValue;
         config.IPLockConfig.AdminLockIPWhite = this.IPLockAdminWhite.Value;
         config.IPLockConfig.AdminLockIPBlack = this.IPLockAdminBlack.Value;
         try
         {
             new SiteConfig().Update(config);
             SiteCache.Remove("EasyOneSiteConfig");
             AdminPage.WriteSuccessMsg("IP访问限定配置!", "IPLockConfig.aspx");
         }
         catch (SecurityException exception)
         {
             AdminPage.WriteErrMsg(exception.Message);
         }
         catch (UnauthorizedAccessException exception2)
         {
             AdminPage.WriteErrMsg(exception2.Message);
         }
     }
 }
Beispiel #2
0
 protected void BtnShowTemplate_Click(object sender, EventArgs e)
 {
     if (XmlManage.SaveFileNode(this.xmlfilepath, "root", "LabelTemplate", this.TxtTemplate.Text))
     {
         File.Copy(this.xmlfilepath, HttpContext.Current.Server.MapPath(this.m_LabelLibPath) + @"\" + this.m_LabelName + ".config", true);
     }
     SiteCache.Remove("pe_labdefing_" + this.m_LabelName);
     if (!string.IsNullOrEmpty(this.TxtTemplateTest.Text))
     {
         TemplateInfo        templateInfo = new TemplateInfo();
         NameValueCollection values       = new NameValueCollection();
         values.Add("id", "1");
         templateInfo.QueryList       = values;
         templateInfo.TemplateContent = this.TxtTemplateTest.Text;
         templateInfo.CurrentPage     = DataConverter.CLng(this.TxtTempPage.Text);
         templateInfo.RootPath        = HttpContext.Current.Request.PhysicalApplicationPath;
         templateInfo.PageName        = this.TxtTempPageName.Text;
         templateInfo      = TemplateTransform.GetHtml(templateInfo);
         this.LabShow.Text = templateInfo.TemplateContent;
         if (templateInfo.TotalPub > 0)
         {
             this.LabShow.Text = this.LabShow.Text + "<br/>本页取得的总数据输出量为:" + templateInfo.TotalPub.ToString();
         }
         if (templateInfo.PageNum > 0)
         {
             this.LabShow.Text = this.LabShow.Text + "<br/>本页分页数为:" + templateInfo.PageNum.ToString();
         }
     }
 }
 protected void BtnSubmit_Click(object sender, EventArgs e)
 {
     if (base.IsValid)
     {
         SiteConfigInfo config = SiteConfig.ConfigReadFromFile();
         config.SiteInfo.SiteName        = this.TxtSiteName.Text.Trim();
         config.SiteInfo.SiteTitle       = this.TxtSiteTitle.Text.Trim();
         config.SiteInfo.SiteUrl         = this.TxtSiteUrl.Text.Trim();
         config.SiteInfo.LogoUrl         = this.TxtLogoUrl.Text.Trim();
         config.SiteInfo.BannerUrl       = this.TxtBannerUrl.Text.Trim();
         config.SiteInfo.Webmaster       = this.TxtWebmaster.Text.Trim();
         config.SiteInfo.WebmasterEmail  = this.TxtWebmasterEmail.Text.Trim();
         config.SiteInfo.Copyright       = this.TxtCopyright.Text.Trim();
         config.SiteInfo.MetaDescription = this.TxtMeta_Description.Text.Trim();
         config.SiteInfo.MetaKeywords    = this.TxtMeta_Keywords.Text.Trim();
         try
         {
             new SiteConfig().Update(config);
             SiteCache.Remove("EasyOneSiteConfig");
             AdminPage.WriteSuccessMsg("网站信息配置保存成功!", "SiteInfo.aspx");
         }
         catch (SecurityException exception)
         {
             AdminPage.WriteErrMsg(exception.Message);
         }
         catch (UnauthorizedAccessException exception2)
         {
             AdminPage.WriteErrMsg(exception2.Message);
         }
     }
 }
Beispiel #4
0
        protected void EBtnBatchDelete_Click(object sender, EventArgs e)
        {
            this.PermissionDetection();
            StringBuilder selectList = this.EgvContent.SelectList;

            if (selectList.Length == 0)
            {
                AdminPage.WriteErrMsg("<li>对不起,您还没选择要删除的项目!</li>", string.Concat(new object[] { "ContentArchivingManage.aspx?NodeID=", BasePage.RequestInt32("NodeID"), "&ListType=", this.HdnListType.Value }));
            }
            else if (ContentManage.UpdateStatus(selectList.ToString(), -3))
            {
                PermissionContent.Delete(selectList.ToString());
                EasyOne.Contents.ContentCharge.Delete(selectList.ToString());
                SiteCache.Remove("CK_Page_Category_" + this.m_NodeId.ToString());
                if (SiteConfig.SmsConfig.IsAutoSendStateMessage)
                {
                    AdminPage.WriteSuccessMsg("<li>删除成功!</li><br /> " + this.ChangeStateSendMessageToUser(-3), string.Concat(new object[] { "ContentArchivingManage.aspx?NodeID=", BasePage.RequestInt32("NodeID"), "&ListType=", this.HdnListType.Value }));
                }
                else
                {
                    AdminPage.WriteSuccessMsg("<li>删除成功!</li>", string.Concat(new object[] { "ContentArchivingManage.aspx?NodeID=", BasePage.RequestInt32("NodeID"), "&ListType=", this.HdnListType.Value }));
                }
            }
            else
            {
                AdminPage.WriteErrMsg("<li>删除项目失败!</li>", string.Concat(new object[] { "ContentArchivingManage.aspx?NodeID=", BasePage.RequestInt32("NodeID"), "&ListType=", this.HdnListType.Value }));
            }
        }
        private void Add()
        {
            DataTable newContentData = ContentManage.GetNewContentData(this.GetDataTableFromRepeater());

            if (ContentManage.Add(this.m_ModelId, newContentData))
            {
                ModelInfo modelInfoById = ModelManager.GetModelInfoById(this.m_ModelId);
                if (modelInfoById.EnableSignIn)
                {
                    this.AddSignin(newContentData);
                }
                this.AddPermissionAndCharge(newContentData, modelInfoById.EnableCharge);
                this.SavePresentExp(newContentData, true);
                if (((SignInType)Enum.Parse(typeof(SignInType), this.DrpSigninType.SelectedValue)) != SignInType.EnableSignInPrivate)
                {
                    HtmlContent.CreateHtml(newContentData);
                }
                this.AddKeywordsToTable(newContentData);
                int generalId = GetGeneralId(newContentData);
                if (modelInfoById.EnbaleVote)
                {
                    this.Vote.Add(generalId);
                }
                SiteCache.Remove("CK_Page_Category_" + this.m_NodeId.ToString());
                BasePage.ResponseRedirect(AdminPage.AppendSecurityCode("ContentShowSuccess.aspx?Action=Add&GeneralID=" + generalId.ToString() + "&NodeID=" + this.m_NodeId.ToString() + "&ModelID=" + this.m_ModelId.ToString() + "&ContentFieldName=" + this.m_ContentFieldName));
            }
        }
        private void Update()
        {
            DataTable dataTableFromRepeater = this.GetDataTableFromRepeater();
            int       generalId             = BasePage.RequestInt32("GeneralID");

            this.SavePresentExp(dataTableFromRepeater, false);
            if (ContentManage.Update(generalId, ContentManage.GetNewContentData(dataTableFromRepeater)))
            {
                ModelInfo modelInfoById = ModelManager.GetModelInfoById(this.m_ModelId);
                this.AddPermissionAndCharge(dataTableFromRepeater, modelInfoById.EnableCharge);
                if (modelInfoById.EnableSignIn)
                {
                    this.UpdateSignin(generalId, dataTableFromRepeater);
                }
                if (((SignInType)Enum.Parse(typeof(SignInType), this.DrpSigninType.SelectedValue)) != SignInType.EnableSignInPrivate)
                {
                    HtmlContent.CreateHtml(dataTableFromRepeater);
                }
                this.UpdateKeywordsToTable(generalId, dataTableFromRepeater);
                if (modelInfoById.EnbaleVote)
                {
                    this.Vote.Add(generalId);
                }
                SiteCache.Remove("CK_Page_Category_" + this.m_NodeId.ToString());
                BasePage.ResponseRedirect(AdminPage.AppendSecurityCode("ContentShowSuccess.aspx?Action=Modify&GeneralID=" + generalId.ToString() + "&NodeID=" + this.m_NodeId.ToString() + "&ModelID=" + this.m_ModelId.ToString() + "&ContentFieldName=" + this.m_ContentFieldName));
            }
            else
            {
                AdminPage.WriteErrMsg("修改失败!");
            }
        }
Beispiel #7
0
 protected void BtnSubmit_Click(object sender, EventArgs e)
 {
     if (base.IsValid)
     {
         SiteConfigInfo config = SiteConfig.ConfigReadFromFile();
         config.SiteOption.RssEnable = DataConverter.CBoolean(this.RssEnable.SelectedValue);
         config.SiteOption.WapEnable = DataConverter.CBoolean(this.WapEnable.SelectedValue);
         try
         {
             new SiteConfig().Update(config);
             SiteCache.Remove("EasyOneSiteConfig");
             AdminPage.WriteSuccessMsg("RSS/WAP配置保存成功!", "RssConfig.aspx");
         }
         catch (FileNotFoundException)
         {
             AdminPage.WriteErrMsg("<li>文件未找到</li>", "RssConfig.aspx");
         }
         catch (UnauthorizedAccessException)
         {
             AdminPage.WriteErrMsg("<li>检查您的服务器是否给配置文件或文件夹写入权限。</li>", "RssConfig.aspx");
         }
         catch (ConfigurationErrorsException)
         {
             AdminPage.WriteErrMsg("<li>检查您的服务器是否给配置文件或文件夹写入权限。</li>", "RssConfig.aspx");
         }
     }
 }
 protected void BtnShowTemplate_Click(object sender, EventArgs e)
 {
     if (XmlManage.SaveFileNode(this.xmlfilepath, "root", "LabelTemplate", this.TxtTemplate.Text))
     {
         File.Copy(this.xmlfilepath, HttpContext.Current.Server.MapPath(this.m_LabelLibPath) + @"\" + this.labelname + ".config", true);
     }
     SiteCache.Remove("pe_labdefing_" + this.labelname);
     if (!string.IsNullOrEmpty(this.TxtTemplateTest.Text))
     {
         TemplateInfo        templateInfo = new TemplateInfo();
         NameValueCollection values       = new NameValueCollection();
         values.Add("id", "1");
         templateInfo.QueryList       = values;
         templateInfo.TemplateContent = this.TxtTemplateTest.Text;
         templateInfo.CurrentPage     = 1;
         templateInfo.RootPath        = HttpContext.Current.Request.PhysicalApplicationPath;
         templateInfo.PageName        = string.Empty;
         templateInfo      = TemplateTransform.GetHtml(templateInfo);
         this.LabShow.Text = templateInfo.TemplateContent;
     }
     else
     {
         this.LabShow.Text = "请输入测试标签";
     }
 }
        internal async Task RemoveSiteDefinitionAsync()
        {
            SiteDefinition site = Manager.CurrentSite;

            if (site.IsDefaultSite)
            {
                throw new Error(this.__ResStr("cantDeleteDefault", "The default site of a YetaWF instance cannot be removed"));
            }

            using (await lockObject.LockAsync()) { // protect SiteCache locally
                // remove all saved data
                SiteCache.Remove(site.SiteDomain.ToLower());
                if (!string.IsNullOrWhiteSpace(site.StaticDomain))
                {
                    StaticSiteCache.Remove(site.StaticDomain.ToLower());
                }
                if (!string.IsNullOrWhiteSpace(site.SiteTestDomain))
                {
                    TestSiteCache.Remove(site.SiteTestDomain.ToLower());
                }

                await Package.RemoveSiteDataAsync(Manager.SiteFolder);

                await DataProvider.RemoveAsync(site.SiteDomain);// remove domain
            }
            await Auditing.AddAuditAsync($"{nameof(SiteDefinitionDataProvider)}.{nameof(SaveSiteDefinitionAsync)}", site.SiteDomain, Guid.Empty,
                                         "Remove Site",
                                         DataBefore : site,
                                         DataAfter : null,
                                         ExpensiveMultiInstance : true
                                         );
        }
 protected void EgvCache_RowCommand(object sender, CommandEventArgs e)
 {
     if (e.CommandName == "Del")
     {
         string str = e.CommandArgument.ToString();
         if (!string.IsNullOrEmpty(str))
         {
             SiteCache.Remove(str);
             AdminPage.WriteSuccessMsg("清除缓存成功!", "CacheManage.aspx");
         }
     }
 }
Beispiel #11
0
 protected void BtnSubmit_Click(object sender, EventArgs e)
 {
     if (base.IsValid)
     {
         SiteConfigInfo config = SiteConfig.ConfigReadFromFile();
         config.SmsConfig.UserName               = this.TxtUserName.Text.Trim();
         config.SmsConfig.MD5Key                 = this.TxtMD5Key.Text.Trim();
         config.SmsConfig.AdminPhoneNumber       = this.TxtAdminPhoneNumber.Text.Trim();
         config.SmsConfig.IsAutoSendMessage      = DataConverter.CBoolean(this.RadlIsAutoSend.SelectedValue);
         config.SmsConfig.AdminPhoneNumber       = this.TxtAdminPhoneNumber.Text.Trim();
         config.SmsConfig.OrderMessage           = this.TxtOrderMessage.Text.Trim();
         config.SmsConfig.IsAutoSendCardNumber   = DataConverter.CBoolean(this.RadlIsAutoSendCardNumber.SelectedValue);
         config.SmsConfig.ConfirmOrderMessage    = this.TxtConfirmOrderMessage.Text.Trim();
         config.SmsConfig.RemitMessage           = this.TxtRemitMessage.Text.Trim();
         config.SmsConfig.RefundmentMessage      = this.TxtRefundmentMessage.Text.Trim();
         config.SmsConfig.InvoiceMessage         = this.TxtInvoiceMessage.Text.Trim();
         config.SmsConfig.ConsignmentMessage     = this.TxtConsignmentMessage.Text.Trim();
         config.SmsConfig.SendCardNumberMessage  = this.TxtSendCardNumberMessage.Text.Trim();
         config.SmsConfig.UseLabel               = this.TxtUseLabel.Text.Trim();
         config.SmsConfig.BankLogMessage         = this.TxtBankLogMessage.Text.Trim();
         config.SmsConfig.IncomeLogMessage       = this.TxtIncomeLogMessage.Text.Trim();
         config.SmsConfig.PayoutLogMessage       = this.TxtPayoutLogMessage.Text.Trim();
         config.SmsConfig.ExchangePointMessage   = this.TxtExchangePointMessage.Text.Trim();
         config.SmsConfig.EncouragePointMessage  = this.TxtEncouragePointMessage.Text.Trim();
         config.SmsConfig.PayoutPointMessage     = this.TxtPayoutPointMessage.Text.Trim();
         config.SmsConfig.ExchangePeriodMessage  = this.TxtExchangePeriodMessage.Text.Trim();
         config.SmsConfig.EncouragePeriodMessage = this.TxtEncouragePeriodMessage.Text.Trim();
         config.SmsConfig.PayoutPeriodMessage    = this.TxtPayoutPeriodMessage.Text.Trim();
         config.SmsConfig.CartInformMessage      = this.TxtCartInformMessage.Text.Trim();
         config.SmsConfig.IsAutoSendStateMessage = DataConverter.CBoolean(this.RadlIsAutoSendStateMessage.SelectedValue);
         config.SmsConfig.ChangeStateMessage     = this.TxtChangeStateMessage.Text.Trim();
         try
         {
             new SiteConfig().Update(config);
             SiteCache.Remove("EasyOneSiteConfig");
             AdminPage.WriteSuccessMsg("手机短信配置保存成功!", "SmsConfig.aspx");
         }
         catch (SecurityException exception)
         {
             AdminPage.WriteErrMsg(exception.Message);
         }
         catch (UnauthorizedAccessException exception2)
         {
             AdminPage.WriteErrMsg(exception2.Message);
         }
     }
 }
 protected void BtnSubmit_Click(object sender, EventArgs e)
 {
     if (base.IsValid)
     {
         SiteConfigInfo config = SiteConfig.ConfigReadFromFile();
         config.ThumbsConfig.ThumbsWidth  = DataConverter.CLng(this.TxtThumbsWidth.Text);
         config.ThumbsConfig.ThumbsHeight = DataConverter.CLng(this.TxtThumbsHeight.Text);
         config.ThumbsConfig.ThumbsMode   = DataConverter.CLng(this.RadThumbsMode.SelectedValue);
         config.ThumbsConfig.AddBackColor = this.TxtBgColor.Text.Trim();
         if (this.RadText.Checked)
         {
             config.WaterMarkConfig.WaterMarkType = 0;
         }
         else
         {
             config.WaterMarkConfig.WaterMarkType = 1;
         }
         config.WaterMarkConfig.WaterMarkTextInfo.Text                = this.TxtWaterMarkText.Text.Trim();
         config.WaterMarkConfig.WaterMarkTextInfo.FoneType            = this.DropWaterMarkTextFoneType.SelectedValue;
         config.WaterMarkConfig.WaterMarkTextInfo.FoneSize            = DataConverter.CLng(this.TxtWaterMarkTextFoneSize.Text);
         config.WaterMarkConfig.WaterMarkTextInfo.FoneColor           = this.TxtWaterMarkTextFoneColor.Text.Trim();
         config.WaterMarkConfig.WaterMarkTextInfo.FoneStyle           = this.DropWaterMarkTextFoneStyle.SelectedValue.Trim();
         config.WaterMarkConfig.WaterMarkTextInfo.FoneBorderColor     = this.TxtWaterMarkTextFoneBorderColor.Text.Trim();
         config.WaterMarkConfig.WaterMarkTextInfo.FoneBorder          = DataConverter.CLng(this.TxtWaterMarkTextFoneBorder.Text);
         config.WaterMarkConfig.WaterMarkTextInfo.WaterMarkPosition   = this.DropWaterMarkTextPosition.SelectedValue;
         config.WaterMarkConfig.WaterMarkTextInfo.WaterMarkPositionX  = DataConverter.CLng(this.TxtWaterMarketTextPositionX.Text);
         config.WaterMarkConfig.WaterMarkTextInfo.WaterMarkPositionY  = DataConverter.CLng(this.TxtWaterMarketTextPositionY.Text);
         config.WaterMarkConfig.WaterMarkImageInfo.ImagePath          = this.TxtWaterMarkImagePath.Text.Trim();
         config.WaterMarkConfig.WaterMarkImageInfo.WaterMarkPosition  = this.DropWaterMarkImagePosition.SelectedValue;
         config.WaterMarkConfig.WaterMarkImageInfo.WaterMarkPositionX = DataConverter.CLng(this.TxtWaterMarkImagePositionX.Text);
         config.WaterMarkConfig.WaterMarkImageInfo.WaterMarkPositionY = DataConverter.CLng(this.TxtWaterMarkImagePositionY.Text);
         try
         {
             new SiteConfig().Update(config);
             SiteCache.Remove("EasyOneSiteConfig");
             AdminPage.WriteSuccessMsg("缩略图配置保存成功!", "ThumbConfig.aspx");
         }
         catch (SecurityException exception)
         {
             AdminPage.WriteErrMsg(exception.Message);
         }
         catch (UnauthorizedAccessException exception2)
         {
             AdminPage.WriteErrMsg(exception2.Message);
         }
     }
 }
Beispiel #13
0
 protected void EgvContent_RowCommand(object sender, CommandEventArgs e)
 {
     if (e.CommandName == "DeleteContent")
     {
         int generalId = DataConverter.CLng(e.CommandArgument.ToString());
         if (ContentManage.UpdateStatus(generalId, -3))
         {
             PermissionContent.Delete(generalId);
             EasyOne.Contents.ContentCharge.Delete(generalId);
             SiteCache.Remove("CK_Page_Category_" + this.m_NodeId.ToString());
             AdminPage.WriteSuccessMsg("<li>删除成功!</li>", "ContentManage.aspx?NodeID=" + BasePage.RequestInt32("NodeID"));
         }
         else
         {
             AdminPage.WriteErrMsg("<li>删除失败!</li>", "ContentManage.aspx?NodeID=" + BasePage.RequestInt32("NodeID"));
         }
     }
 }
Beispiel #14
0
        protected void EBtnBatchDelete_Click(object sender, EventArgs e)
        {
            this.PermissionDetection(this.m_isManage);
            StringBuilder selectList = this.EgvContent.SelectList;

            if (selectList.Length == 0)
            {
                AdminPage.WriteErrMsg("<li>对不起,您还没选择要删除的项目!</li>", "ContentManage.aspx?NodeID=" + BasePage.RequestInt32("NodeID"));
            }
            else if (ContentManage.UpdateStatus(selectList.ToString(), -3))
            {
                PermissionContent.Delete(selectList.ToString());
                EasyOne.Contents.ContentCharge.Delete(selectList.ToString());
                SiteCache.Remove("CK_Page_Category_" + this.m_NodeId.ToString());
                AdminPage.WriteSuccessMsg("<li>删除成功!</li>", "ContentManage.aspx?NodeID=" + BasePage.RequestInt32("NodeID"));
            }
            else
            {
                AdminPage.WriteErrMsg("<li>删除项目失败!</li>", "ContentManage.aspx?NodeID=" + BasePage.RequestInt32("NodeID"));
            }
        }
Beispiel #15
0
 protected void BtnSubmit_Click(object sender, EventArgs e)
 {
     if (base.IsValid)
     {
         SiteConfigInfo config = SiteConfig.ConfigReadFromFile();
         config.MailConfig.MailServer         = this.TxtMailServer.Text.Trim();
         config.MailConfig.MailServerUserName = this.TxtMailServerUserName.Text.Trim();
         config.MailConfig.MailServerPassWord = this.TxtMailServerPassWord.Text.Trim();
         config.MailConfig.MailFrom           = this.TxtMailFrom.Text.Trim();
         config.MailConfig.Port       = DataConverter.CLng(this.TxtPort.Text);
         config.MailConfig.EnabledSsl = this.ChkSsl.Checked;
         if (this.RadBasic.Checked)
         {
             config.MailConfig.AuthenticationType = AuthenticationType.Basic;
         }
         else if (this.RadNTLM.Checked)
         {
             config.MailConfig.AuthenticationType = AuthenticationType.Ntlm;
         }
         else
         {
             config.MailConfig.AuthenticationType = AuthenticationType.None;
         }
         try
         {
             new SiteConfig().Update(config);
             SiteCache.Remove("EasyOneSiteConfig");
             AdminPage.WriteSuccessMsg("邮件参数配置成功!", "MailConfig.aspx");
         }
         catch (SecurityException exception)
         {
             AdminPage.WriteErrMsg(exception.Message);
         }
         catch (UnauthorizedAccessException exception2)
         {
             AdminPage.WriteErrMsg(exception2.Message);
         }
     }
 }
Beispiel #16
0
        protected void EgvContent_RowCommand(object sender, CommandEventArgs e)
        {
            int    generalId   = DataConverter.CLng(e.CommandArgument.ToString());
            string commandName = e.CommandName;

            if (commandName != null)
            {
                if (!(commandName == "CancelArchiving"))
                {
                    if (!(commandName == "DeleteContent"))
                    {
                        return;
                    }
                }
                else
                {
                    if (ContentManage.UpdateStatus(generalId, 0))
                    {
                        AdminPage.WriteSuccessMsg("<li>取消归档成功!</li>", string.Concat(new object[] { "ContentArchivingManage.aspx?NodeID=", BasePage.RequestInt32("NodeID"), "&Status=102&ListType=", this.HdnListType.Value }));
                        return;
                    }
                    AdminPage.WriteErrMsg("<li>取消归档失败!</li>", string.Concat(new object[] { "ContentArchivingManage.aspx?NodeID=", BasePage.RequestInt32("NodeID"), "&Status=102&ListType=", this.HdnListType.Value }));
                    return;
                }
                if (ContentManage.UpdateStatus(generalId, -3))
                {
                    PermissionContent.Delete(generalId);
                    EasyOne.Contents.ContentCharge.Delete(generalId);
                    SiteCache.Remove("CK_Page_Category_" + this.m_NodeId.ToString());
                    AdminPage.WriteSuccessMsg("<li>删除成功!</li>", string.Concat(new object[] { "ContentArchivingManage.aspx?NodeID=", BasePage.RequestInt32("NodeID"), "&Status=102&ListType=", this.HdnListType.Value }));
                }
                else
                {
                    AdminPage.WriteErrMsg("<li>删除失败!</li>", string.Concat(new object[] { "ContentArchivingManage.aspx?NodeID=", BasePage.RequestInt32("NodeID"), "&Status=102&ListType=", this.HdnListType.Value }));
                }
            }
        }
 protected void BtnSubmit_Click(object sender, EventArgs e)
 {
     if (base.IsValid)
     {
         SiteConfigInfo config = SiteConfig.ConfigReadFromFile();
         SiteConfigInfo info2  = SiteConfig.ConfigInfo();
         bool           flag   = false;
         config.SiteOption.EnableSiteManageCode = DataConverter.CBoolean(this.RadlEnableSiteManageCode.SelectedValue);
         if (config.SiteOption.EnableSiteManageCode && string.IsNullOrEmpty(this.TxtSiteManageCode.Text.Trim()))
         {
             AdminPage.WriteErrMsg("请指定后台管理认证码!");
         }
         config.SiteOption.SiteManageCode     = this.TxtSiteManageCode.Text.Trim();
         config.SiteOption.TicketTime         = DataConverter.CLng(this.TxtTicketTime.Text.Trim());
         config.SiteOption.EnableSoftKey      = DataConverter.CBoolean(this.RadlEnableSoftKey.SelectedValue);
         config.SiteOption.ManageDir          = this.TxtManageDir.Text.Trim();
         config.SiteOption.EnableUploadFiles  = DataConverter.CBoolean(this.RadlEnableUploadFiles.SelectedValue);
         config.SiteOption.UploadFilePathRule = this.TxtUploadFilePathRule.Value;
         config.SiteOption.UploadFileMaxSize  = DataConverter.CLng(this.TxtUploadFileMaxSize.Text);
         config.SiteOption.TemplateDir        = this.TxtTemplateDir.Text.Trim();
         config.SiteOption.IncludeFilePath    = this.TxtIncludeFilePath.Text.Trim();
         config.SiteOption.IsAbsoluatePath    = DataConverter.CBoolean(this.RadlUrlType.SelectedValue);
         config.SiteOption.IsAutoSignIn       = DataConverter.CBoolean(this.RadlIsAutoSignin.SelectedValue);
         config.SiteOption.AutoSignInTime     = DataConverter.CLng(this.TxtAutoSigninTime.Text);
         config.SiteOption.RefreshQueueSize   = DataConverter.CLng(this.TxtRefreshQueueSize.Text);
         config.SiteOption.CollectionSleep    = DataConverter.CLng(this.TxtCollectionSleep.Text);
         if (info2.SiteOption.EnablePointMoneyExp != DataConverter.CBoolean(this.RadlEnablePointMoneyExp.SelectedValue))
         {
             config.SiteOption.EnablePointMoneyExp = DataConverter.CBoolean(this.RadlEnablePointMoneyExp.SelectedValue);
             flag = true;
         }
         System.Configuration.Configuration configuration = WebConfigurationManager.OpenWebConfiguration("~/");
         ConnectionStringsSection           section       = configuration.Sections["connectionStrings"] as ConnectionStringsSection;
         bool flag2 = false;
         if (section != null)
         {
             if (this.RadlConnProtecte.SelectedValue == "true")
             {
                 if (!section.SectionInformation.IsProtected)
                 {
                     section.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider");
                     flag2 = true;
                 }
             }
             else if (section.SectionInformation.IsProtected)
             {
                 section.SectionInformation.UnprotectSection();
                 flag2 = true;
             }
         }
         try
         {
             string str = "";
             if (this.CheckFolder(config.SiteOption.AdvertisementDir, this.TxtADDir.Text.Trim()))
             {
                 str = "因为修改了广告目录,请去手动修改Config/QueryStirng.config中的url=\"~/IAA/ADCount.aspx\"中的IAA为新的广告目录";
             }
             this.CheckFolder(config.SiteOption.UploadDir, this.TxtUploadDir.Text.Trim());
             if (string.Compare(config.SiteOption.CreateHtmlPath, "/", StringComparison.OrdinalIgnoreCase) == 0)
             {
                 config.SiteOption.CreateHtmlPath = string.Empty;
             }
             else
             {
                 this.CheckFolder(config.SiteOption.CreateHtmlPath, this.TxtCreateHtmlPath.Text.Trim());
             }
             config.SiteOption.CreateHtmlPath   = this.TxtCreateHtmlPath.Text.Trim();
             config.SiteOption.AdvertisementDir = this.TxtADDir.Text.Trim();
             config.SiteOption.UploadDir        = this.TxtUploadDir.Text.Trim();
             new SiteConfig().Update(config);
             SiteCache.Remove("EasyOneSiteConfig");
             if (string.Compare(this.ViewState["TemplateDir"].ToString(), config.SiteOption.TemplateDir, StringComparison.Ordinal) != 0)
             {
                 SiteCache.RemoveByPattern(@"CK_Label_\S*");
             }
             if (flag2)
             {
                 configuration.Save();
             }
             if (config.SiteOption.SiteManageCode == "8888")
             {
                 str = str + "后台管理认证码使用的是系统默认值,为了网站安全,请及时修改!";
             }
             if (config.SiteOption.ManageDir == "Admin")
             {
                 str = str + "后台管理目录名使用的是系统默认值,为了网站安全,请及时修改!";
             }
             if ((string.Compare(this.HdnManageDir.Value.Trim(), this.TxtManageDir.Text.Trim(), StringComparison.Ordinal) == 0) && !flag)
             {
                 AdminPage.WriteSuccessMsg("<font color='red'>" + str + "</font><br>网站信息配置保存成功!", "SiteOption.aspx");
             }
             else
             {
                 this.Session["IndexRightUrl"] = "Configuration/SiteOption.aspx";
                 this.Session["IndexLeftUrl"]  = "Configuration/SiteConfigGuide.aspx";
                 base.Response.Write("<script>alert('" + str + @"\n网站信息配置保存成功!'); top.location = '../../" + this.TxtManageDir.Text.Trim() + "/index.aspx';</script>");
             }
         }
         catch (FileNotFoundException)
         {
             AdminPage.WriteErrMsg("<li>文件未找到</li>", "SiteOption.aspx");
         }
         catch (UnauthorizedAccessException)
         {
             AdminPage.WriteErrMsg("<li>检查您的服务器是否给配置文件或文件夹写入权限。</li>", "SiteOption.aspx");
         }
         catch (ConfigurationErrorsException)
         {
             AdminPage.WriteErrMsg("<li>检查您的服务器是否给配置文件或文件夹写入权限。</li>", "SiteOption.aspx");
         }
     }
 }
        /// <summary>
        /// Save the site definition for the current site
        /// </summary>
        internal async Task SaveSiteDefinitionAsync(SiteDefinition site)
        {
            SiteDefinition origSite = YetaWF.Core.Audit.Auditing.Active ? await LoadSiteDefinitionAsync(site.OriginalSiteDomain) : null;

            using (await lockObject.LockAsync()) { // protect SiteCache locally
                SiteCache.Remove(site.SiteDomain.ToLower());
                if (!string.IsNullOrWhiteSpace(site.StaticDomain))
                {
                    StaticSiteCache.Remove(site.StaticDomain.ToLower());
                }
                if (!string.IsNullOrWhiteSpace(site.SiteTestDomain))
                {
                    TestSiteCache.Remove(site.SiteTestDomain.ToLower());
                }
                SiteCache.Add(site.SiteDomain.ToLower(), site);
                if (!string.IsNullOrWhiteSpace(site.StaticDomain))
                {
                    StaticSiteCache.Add(site.StaticDomain.ToLower(), site);
                }
                if (!string.IsNullOrWhiteSpace(site.SiteTestDomain))
                {
                    TestSiteCache.Add(site.SiteTestDomain.ToLower(), site);
                }

                AddLockedStatus(site);
                CleanData(site);
                await SaveImagesAsync(ModuleDefinition.GetPermanentGuid(typeof(SitePropertiesModule)), site);

                if (site.OriginalSiteDomain != null)
                {
                    UpdateStatusEnum status = await DataProvider.UpdateAsync(site.OriginalSiteDomain, site.SiteDomain, site);

                    if (status != UpdateStatusEnum.OK)
                    {
                        throw new Error(this.__ResStr("updFail", "Can't update site definition - it may have already been removed", site.OriginalSiteDomain));
                    }
                }
                else
                {
                    if (!await DataProvider.AddAsync(site))
                    {
                        throw new Error(this.__ResStr("siteExists", "Can't add new site \"{0}\" - site already exists", site.SiteDomain));
                    }
                    site.OriginalSiteDomain = site.SiteDomain;
                }
                // update appsettings.json
                if (string.Compare(YetaWFManager.DefaultSiteName, site.OriginalSiteDomain, true) == 0 && site.SiteDomain != site.OriginalSiteDomain)
                {
                    WebConfigHelper.SetValue <string>(YetaWF.Core.Controllers.AreaRegistration.CurrentPackage.AreaName, "DEFAULTSITE", site.SiteDomain);
                    await WebConfigHelper.SaveAsync();

                    await Auditing.AddAuditAsync($"{nameof(SiteDefinitionDataProvider)}.{nameof(SaveSiteDefinitionAsync)}", site.OriginalSiteDomain, Guid.Empty,
                                                 $"DEFAULTSITE", RequiresRestart : true
                                                 );
                }
                // Save a json representation of the site (can be used for batch mode initialization to avoid having to need a SiteProperties reference and access to DB)
                await FileSystem.FileSystemProvider.CreateDirectoryAsync(Path.Combine(YetaWFManager.RootFolderWebProject, Globals.DataFolder, "Sites"));

                string file = Path.Combine(YetaWFManager.RootFolderWebProject, Globals.DataFolder, "Sites", site.SiteDomain + ".json".ToLower());
                string json = Utility.JsonSerialize(site, true);
                await FileSystem.FileSystemProvider.WriteAllTextAsync(file, json);
            }
            await Auditing.AddAuditAsync($"{nameof(SiteDefinitionDataProvider)}.{nameof(SaveSiteDefinitionAsync)}", site.OriginalSiteDomain, Guid.Empty,
                                         "Save Site Settings",
                                         DataBefore : origSite,
                                         DataAfter : site,
                                         ExpensiveMultiInstance : true
                                         );
        }
Beispiel #19
0
 public static void RemoveCacheByNodeId(int nodeId)
 {
     SiteCache.Remove("CK_Content_NodeInfo_NodeId_" + nodeId.ToString());
 }