Ejemplo n.º 1
0
        // Token: 0x0600002D RID: 45 RVA: 0x00004C98 File Offset: 0x00002E98
        protected override void View()
        {
            this.sysconfiginfo = SysConfigs.GetConfig();
            this.sitelist      = SiteBll.GetSiteList();
            Configuration configuration = WebConfigurationManager.OpenWebConfiguration("~");

            if (configuration.AppSettings.Settings["sitepath"] != null)
            {
                this.mainsite = configuration.AppSettings.Settings["sitepath"].Value;
            }
            CustomErrorsSection customErrorsSection = (CustomErrorsSection)configuration.GetSection("system.web/customErrors");

            if (customErrorsSection.Mode == CustomErrorsMode.Off)
            {
                this.customerror = 1;
            }
            this.adminsiteconfig = SiteConfigs.LoadConfig(FPUtils.GetMapPath(this.webpath + this.sysconfiginfo.adminpath + "/site.config"));
            if (this.ispost)
            {
                if (!this.isperm)
                {
                    this.ShowErr("对不起,您没有限权进行修改配置。");
                    return;
                }
                this.sysconfiginfo = FPRequest.GetModel <SysConfig>(this.sysconfiginfo);
                if (this.sysconfiginfo.admintitle == "")
                {
                    this.sysconfiginfo.admintitle = this.adminsiteconfig.sitetitle;
                }
                this.sysconfiginfo.passwordkey = WMSUtils.CreateAuthStr(10);
                WMSCookie.WriteCookie("password", DES.Encode(this.user.password, this.sysconfiginfo.passwordkey));
                SysConfigs.SaveConfig(this.sysconfiginfo);
                SysConfigs.ResetConfig();
                if (FPRequest.GetInt("customerror") != this.customerror)
                {
                    this.customerror = FPRequest.GetInt("customerror");
                    if (this.customerror == 1)
                    {
                        customErrorsSection.Mode = CustomErrorsMode.Off;
                    }
                    else
                    {
                        customErrorsSection.Mode = CustomErrorsMode.RemoteOnly;
                    }
                }
                if (configuration.AppSettings.Settings["sitepath"] != null)
                {
                    configuration.AppSettings.Settings["sitepath"].Value = FPRequest.GetString("mainsite");
                }
                else
                {
                    configuration.AppSettings.Settings.Add("sitepath", FPRequest.GetString("mainsite"));
                }
                configuration.Save(ConfigurationSaveMode.Modified);
                WebConfig.ReSet();
                base.AddMsg("更新配置成功!");
            }
            base.SaveRightURL();
        }
Ejemplo n.º 2
0
        // Token: 0x0600002A RID: 42 RVA: 0x000047AC File Offset: 0x000029AC
        protected override void View()
        {
            string mapPath = FPUtils.GetMapPath(this.webpath + "sites/" + this.m_sitepath);

            if (!File.Exists(mapPath + "\\site.config"))
            {
                this.ShowErr("该站点不存在或已被删除。");
            }
            else
            {
                this.m_siteconfig = SiteConfigs.LoadConfig(mapPath + "\\site.config");
                if (this.ispost)
                {
                    string mapPath2 = FPUtils.GetMapPath(this.webpath + "cache");
                    string fileName = Path.GetFileName(FPRequest.Files["uploadfile"].FileName);
                    string a        = Path.GetExtension(fileName).ToLower();
                    if (a != ".fpsite" && a != ".zip")
                    {
                        this.ShowErr("对不起,该文件不是方配站点更新文件类型。");
                        return;
                    }
                    if (!Directory.Exists(mapPath2))
                    {
                        Directory.CreateDirectory(mapPath2);
                    }
                    if (File.Exists(mapPath2 + "\\" + fileName))
                    {
                        File.Delete(mapPath2 + "\\" + fileName);
                    }
                    FPRequest.Files["uploadfile"].SaveAs(mapPath2 + "\\" + fileName);
                    if (Directory.Exists(mapPath2 + "\\" + Path.GetFileNameWithoutExtension(fileName)))
                    {
                        Directory.Delete(mapPath2 + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
                    }
                    FPZip.UnZipFile(mapPath2 + "\\" + fileName, "");
                    File.Delete(mapPath2 + "\\" + fileName);
                    if (!File.Exists(mapPath2 + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\site.config"))
                    {
                        Directory.Delete(mapPath2 + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
                        this.ShowErr("站点配置文件不存在或有错误。");
                        return;
                    }
                    SiteConfig siteConfig = SiteConfigs.LoadConfig(mapPath2 + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\site.config");
                    Version    v          = new Version(FPUtils.StrToDecimal(this.m_siteconfig.version).ToString("0.0"));
                    Version    v2         = new Version(FPUtils.StrToDecimal(siteConfig.version).ToString("0.0"));
                    if (v > v2)
                    {
                        this.ShowErr("对不起,您更新的版本比安装版本还低,不能更新");
                        return;
                    }
                    string mapPath3   = FPUtils.GetMapPath(this.webpath + "sites/" + this.siteconfig.sitepath);
                    string sourcePath = mapPath2 + "\\" + Path.GetFileNameWithoutExtension(fileName);
                    siteupdate.CopyDirectory(sourcePath, mapPath3);
                    Directory.Delete(mapPath2 + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
                    base.Response.Redirect("sitemanage.aspx");
                }
                base.SaveRightURL();
            }
        }
Ejemplo n.º 3
0
        // Token: 0x06000262 RID: 610 RVA: 0x00007E4C File Offset: 0x0000604C
        public static SiteConfig GetSiteConfig(string sitepath)
        {
            string     mapPath    = FPUtils.GetMapPath(WebConfig.WebPath + "sites/" + sitepath + "/site.config");
            SiteConfig siteConfig = SiteConfigs.LoadConfig(mapPath);

            siteConfig.sitepath = sitepath;
            return(siteConfig);
        }
Ejemplo n.º 4
0
        // Token: 0x06000261 RID: 609 RVA: 0x00007DAC File Offset: 0x00005FAC
        public static List <SiteConfig> GetSiteList()
        {
            List <SiteConfig> list    = new List <SiteConfig>();
            string            mapPath = FPUtils.GetMapPath(WebConfig.WebPath + "sites");

            if (Directory.Exists(mapPath))
            {
                DirectoryInfo directoryInfo = new DirectoryInfo(mapPath);
                foreach (DirectoryInfo directoryInfo2 in directoryInfo.GetDirectories())
                {
                    SiteConfig siteConfig = SiteConfigs.LoadConfig(directoryInfo2.FullName + "\\site.config");
                    siteConfig.sitepath = directoryInfo2.Name;
                    list.Add(siteConfig);
                }
            }
            return(list);
        }
Ejemplo n.º 5
0
 // Token: 0x0600000D RID: 13 RVA: 0x000029C8 File Offset: 0x00000BC8
 protected override void View()
 {
     this.appinfo = DbHelper.ExecuteModel <AppInfo>(this.id);
     if (this.appinfo.id == 0)
     {
         this.ShowErr("对不起,该应用已被删除或不存在。");
     }
     else
     {
         string mapPath = FPUtils.GetMapPath(this.webpath + this.appinfo.installpath);
         if (this.ispost)
         {
             string @string = FPRequest.GetString("setpath");
             if (@string == "")
             {
                 this.ShowErr("对不起,应用默认安装目录名称不能为空。");
             }
             else
             {
                 string pattern = "^[a-zA-Z0-9_\\w]+$";
                 if (this.err == 0 && !Regex.IsMatch(@string.Trim(), pattern, RegexOptions.IgnoreCase))
                 {
                     base.AddErr("默认安装目录名称只能由数字、字母或下划线组成。");
                 }
                 this.appinfo.setpath = @string;
                 DbHelper.ExecuteUpdate <AppInfo>(this.appinfo);
                 FPSerializer.Save <AppInfo>(this.appinfo, FPUtils.GetMapPath(this.webpath + this.appinfo.installpath + "/app.config"));
                 string str = this.appinfo.name + ".fpk";
                 if (this.appinfo.files != "")
                 {
                     using (FPZip fpzip = new FPZip())
                     {
                         foreach (string text in FPUtils.SplitString(this.appinfo.files))
                         {
                             if (text.StartsWith("bin/"))
                             {
                                 fpzip.AddFile(FPUtils.GetMapPath(WebConfig.WebPath + text), text);
                             }
                             else
                             {
                                 fpzip.AddFile(mapPath + "/" + text, text);
                             }
                         }
                         fpzip.ZipDown(FPUtils.UrlEncode(str));
                     }
                 }
                 else
                 {
                     using (FPZip fpzip = new FPZip())
                     {
                         DirectoryInfo directoryInfo = new DirectoryInfo(mapPath);
                         foreach (DirectoryInfo directoryInfo2 in directoryInfo.GetDirectories())
                         {
                             fpzip.AddDirectory(directoryInfo2.FullName);
                         }
                         foreach (FileInfo fileInfo in directoryInfo.GetFiles())
                         {
                             if (fileInfo.Name != "site.config")
                             {
                                 fpzip.AddFile(fileInfo.FullName, "");
                             }
                         }
                         string mapPath2 = FPUtils.GetMapPath(this.webpath + "sites/" + this.appinfo.installpath + "/site.config");
                         if (File.Exists(mapPath2))
                         {
                             SiteConfig siteConfig = SiteConfigs.LoadConfig(mapPath2);
                             if (siteConfig.inherits != "")
                             {
                                 if (siteConfig.inherits.EndsWith(".Controller"))
                                 {
                                     fpzip.AddFile(FPUtils.GetMapPath(this.webpath + "bin/" + siteConfig.inherits.Replace(".Controller", "") + ".dll"), "bin/" + siteConfig.inherits.Replace(".Controller", "") + ".dll");
                                 }
                                 else
                                 {
                                     fpzip.AddFile(FPUtils.GetMapPath(this.webpath + "bin/" + siteConfig.inherits + ".dll"), "bin/" + siteConfig.inherits + ".dll");
                                 }
                             }
                             if (siteConfig.import != "")
                             {
                                 foreach (string text in siteConfig.import.Split(new string[]
                                 {
                                     "\r\n",
                                     ";",
                                     ",",
                                     "|"
                                 }, StringSplitOptions.RemoveEmptyEntries))
                                 {
                                     fpzip.AddFile(FPUtils.GetMapPath(this.webpath + "bin/" + text + ".dll"), "bin/" + text + ".dll");
                                 }
                             }
                         }
                         fpzip.ZipDown(FPUtils.UrlEncode(str));
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 6
0
 // Token: 0x06000068 RID: 104 RVA: 0x000093E8 File Offset: 0x000075E8
 protected override void View()
 {
     if (this.ispost)
     {
         string mapPath = FPUtils.GetMapPath(this.webpath + "cache");
         if (this.step == "step1")
         {
             this.filename = Path.GetFileName(FPRequest.Files["uploadfile"].FileName);
             string a = Path.GetExtension(this.filename).ToLower();
             if (a != ".zip" && a != ".fpsite")
             {
                 this.ShowErr("该文件不是方配站点安装文件类型");
                 return;
             }
             if (!Directory.Exists(mapPath))
             {
                 Directory.CreateDirectory(mapPath);
             }
             if (File.Exists(mapPath + "\\" + this.filename))
             {
                 File.Delete(mapPath + "\\" + this.filename);
             }
             FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + this.filename);
             if (Directory.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename)))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename), true);
             }
             FPZip.UnZipFile(mapPath + "\\" + this.filename, "");
             File.Delete(mapPath + "\\" + this.filename);
             if (!File.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename) + "\\site.config"))
             {
                 string mapPath2   = FPUtils.GetMapPath(this.webpath + "sites");
                 string sourcePath = mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename);
                 siteinstall.CopyDirectory(sourcePath, mapPath2);
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename), true);
                 base.Response.Redirect("sitemanage.aspx");
             }
             else
             {
                 this.siteinfo = SiteConfigs.LoadConfig(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename) + "\\site.config");
             }
         }
         else if (this.step == "step2")
         {
             string text = FPRequest.GetString("installpath").ToLower();
             if (text == "")
             {
                 this.ShowErr("安装目录不能为空。");
                 return;
             }
             this.filename          = FPRequest.GetString("filename");
             this.siteinfo          = SiteConfigs.LoadConfig(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename) + "\\site.config");
             this.siteinfo.sitepath = text;
             string mapPath2    = FPUtils.GetMapPath(this.webpath + "sites/" + this.siteinfo.sitepath);
             string sourcePath2 = mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename);
             siteinstall.CopyDirectory(sourcePath2, mapPath2);
             Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(this.filename), true);
             base.Response.Redirect("sitemanage.aspx");
         }
     }
     base.SaveRightURL();
 }