Beispiel #1
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();
            }
        }
Beispiel #2
0
 // Token: 0x06000057 RID: 87 RVA: 0x00007994 File Offset: 0x00005B94
 protected override void View()
 {
     this.appinfo = DbHelper.ExecuteModel <AppInfo>(this.appid);
     if (this.appinfo.id == 0)
     {
         this.ShowErr("该应用不存在或已被删除。");
     }
     else
     {
         if (this.ispost)
         {
             string mapPath  = FPUtils.GetMapPath(this.webpath + "cache");
             string fileName = Path.GetFileName(FPRequest.Files["uploadfile"].FileName);
             string a        = Path.GetExtension(fileName).ToLower();
             if (a != ".fpk" && a != ".zip")
             {
                 this.ShowErr("对不起,该文件不是方配系统应用更新文件类型。");
                 return;
             }
             if (!Directory.Exists(mapPath))
             {
                 Directory.CreateDirectory(mapPath);
             }
             if (File.Exists(mapPath + "\\" + fileName))
             {
                 File.Delete(mapPath + "\\" + fileName);
             }
             FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + fileName);
             if (Directory.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName)))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
             }
             FPZip.UnZipFile(mapPath + "\\" + fileName, "");
             File.Delete(mapPath + "\\" + fileName);
             if (!File.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\app.config"))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
                 this.ShowErr("应用配置文件不存在或有错误。");
                 return;
             }
             AppInfo appInfo = FPSerializer.Load <AppInfo>(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\app.config");
             if (this.appinfo.guid == "")
             {
                 this.ShowErr("对不起,该应用标识码错误,更新失败。");
                 return;
             }
             SqlParam sqlParam = DbHelper.MakeAndWhere("guid", this.appinfo.guid);
             this.appinfo = DbHelper.ExecuteModel <AppInfo>(new SqlParam[]
             {
                 sqlParam
             });
             if (this.appinfo.id == 0)
             {
                 this.ShowErr("对不起,该应用不存在或已被删除。");
                 return;
             }
             Version v  = new Version(FPUtils.StrToDecimal(appInfo.version).ToString("0.0"));
             Version v2 = new Version(FPUtils.StrToDecimal(this.appinfo.version).ToString("0.0"));
             if (v < v2)
             {
                 this.ShowErr("对不起,您更新的版本比安装版本还低,不能更新");
                 return;
             }
             this.appinfo.name    = appInfo.name;
             this.appinfo.version = appInfo.version;
             this.appinfo.notes   = appInfo.notes;
             this.appinfo.author  = appInfo.author;
             string mapPath2   = FPUtils.GetMapPath(this.webpath + this.appinfo.installpath);
             string sourcePath = mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName);
             this.appinfo.files = appupdate.CopyDirectory(sourcePath, mapPath2, "", this.appinfo.files);
             if (DbHelper.ExecuteUpdate <AppInfo>(this.appinfo) > 0)
             {
                 foreach (string strContent in appInfo.sortapps.Split(new char[]
                 {
                     '|'
                 }))
                 {
                     string[] array2 = FPUtils.SplitString(strContent, ",", 4);
                     if (!(array2[0] == ""))
                     {
                         SqlParam[] sqlparams = new SqlParam[]
                         {
                             DbHelper.MakeAndWhere("appid", this.appinfo.id),
                             DbHelper.MakeAndWhere("name", array2[0])
                         };
                         SortAppInfo sortAppInfo = DbHelper.ExecuteModel <SortAppInfo>(sqlparams);
                         if (sortAppInfo.id > 0)
                         {
                             sortAppInfo.name      = array2[0];
                             sortAppInfo.markup    = array2[1];
                             sortAppInfo.indexpage = array2[2];
                             sortAppInfo.viewpage  = array2[3];
                             DbHelper.ExecuteUpdate <SortAppInfo>(sortAppInfo);
                         }
                         else
                         {
                             sortAppInfo.appid     = this.appinfo.id;
                             sortAppInfo.name      = array2[0];
                             sortAppInfo.markup    = array2[1];
                             sortAppInfo.indexpage = array2[2];
                             sortAppInfo.viewpage  = array2[3];
                             DbHelper.ExecuteInsert <SortAppInfo>(sortAppInfo);
                         }
                     }
                 }
             }
             Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
             CacheBll.RemoveSortCache();
             base.Response.Redirect("appmanage.aspx");
         }
         base.SaveRightURL();
     }
 }
Beispiel #3
0
 // Token: 0x0600001E RID: 30 RVA: 0x00003758 File Offset: 0x00001958
 protected override void View()
 {
     if (this.pluname != "")
     {
         this.pluginconfig             = FPSerializer.Load <PluginConfig>(FPUtils.GetMapPath(this.webpath + "plugins/" + this.pluname + "/plugin.config"));
         this.pluginconfig.installpath = this.pluname;
     }
     if (this.ispost)
     {
         string mapPath  = FPUtils.GetMapPath(this.webpath + "cache");
         string fileName = Path.GetFileName(FPRequest.Files["uploadfile"].FileName);
         string a        = Path.GetExtension(fileName).ToLower();
         if (a != ".plu" && a != ".zip")
         {
             this.ShowErr("对不起,该文件不是方配系统插件更新文件类型。");
         }
         else
         {
             if (!Directory.Exists(mapPath))
             {
                 Directory.CreateDirectory(mapPath);
             }
             if (File.Exists(mapPath + "\\" + fileName))
             {
                 File.Delete(mapPath + "\\" + fileName);
             }
             FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + fileName);
             if (Directory.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName)))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
             }
             FPZip.UnZipFile(mapPath + "\\" + fileName, "");
             File.Delete(mapPath + "\\" + fileName);
             if (!File.Exists(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\plugin.config"))
             {
                 Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
                 this.ShowErr("插件配置文件不存在或有错误。");
             }
             else
             {
                 PluginConfig pluginConfig = FPSerializer.Load <PluginConfig>(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName) + "\\plugin.config");
                 if (pluginConfig.guid == "")
                 {
                     this.ShowErr("对不起,该插件标识码错误,更新失败。");
                 }
                 else
                 {
                     Version v  = new Version(FPUtils.StrToDecimal(pluginConfig.version).ToString("0.0"));
                     Version v2 = new Version(FPUtils.StrToDecimal(this.pluginconfig.version).ToString("0.0"));
                     if (v < v2)
                     {
                         this.ShowErr("对不起,您更新的版本比安装版本还低,不能更新");
                     }
                     else
                     {
                         string mapPath2   = FPUtils.GetMapPath(this.webpath + "plugins/" + pluginConfig.installpath);
                         string sourcePath = mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName);
                         pluginupdate.CopyDirectory(sourcePath, mapPath2);
                         Directory.Delete(mapPath + "\\" + Path.GetFileNameWithoutExtension(fileName), true);
                         base.Response.Redirect("pluginmanage.aspx");
                     }
                 }
             }
         }
     }
 }
Beispiel #4
0
 // Token: 0x06000055 RID: 85 RVA: 0x0000760C File Offset: 0x0000580C
 protected override void View()
 {
     if (this.id > 0)
     {
         this.appinfo = DbHelper.ExecuteModel <AppInfo>(this.id);
     }
     if (this.ispost)
     {
         this.appinfo.target = "";
         this.appinfo        = FPRequest.GetModel <AppInfo>(this.appinfo);
         if (this.appinfo.name == "")
         {
             this.ShowErr("应用名称不能为空");
             return;
         }
         if (this.appinfo.installpath == "")
         {
             this.ShowErr("安装目录不能为空");
             return;
         }
         string pattern = "^[a-zA-Z0-9_\\w]+$";
         if (this.err == 0 && !Regex.IsMatch(this.appinfo.installpath.Trim(), pattern, RegexOptions.IgnoreCase))
         {
             base.AddErr("应用安装目录名称只能由数字、字母或下划线组成。");
         }
         if (this.appinfo.guid == "")
         {
             this.appinfo.guid = Guid.NewGuid().ToString();
         }
         if (this.appinfo.target == "")
         {
             this.appinfo.target = "_self";
         }
         if (this.appinfo.setpath == "")
         {
             this.appinfo.setpath = this.appinfo.installpath;
         }
         this.appinfo.version = FPUtils.StrToDecimal(this.appinfo.version).ToString("0.0");
         SqlParam           sqlParam = DbHelper.MakeAndWhere("appid", this.id);
         List <SortAppInfo> list     = DbHelper.ExecuteList <SortAppInfo>(OrderBy.ASC, new SqlParam[]
         {
             sqlParam
         });
         string text = "";
         foreach (SortAppInfo sortAppInfo in list)
         {
             if (text != "")
             {
                 text += "|";
             }
             string text2 = text;
             text = string.Concat(new string[]
             {
                 text2,
                 sortAppInfo.name,
                 ",",
                 sortAppInfo.markup,
                 ",",
                 sortAppInfo.indexpage,
                 ",",
                 sortAppInfo.viewpage
             });
         }
         this.appinfo.sortapps = text;
         if (this.appinfo.id > 0)
         {
             DbHelper.ExecuteUpdate <AppInfo>(this.appinfo);
         }
         else
         {
             this.id = DbHelper.ExecuteInsert <AppInfo>(this.appinfo);
         }
         FPSerializer.Save <AppInfo>(this.appinfo, FPUtils.GetMapPath(this.webpath + this.appinfo.installpath + "/app.config"));
         base.Response.Redirect("appmanage.aspx");
     }
     base.SaveRightURL();
 }