protected void Page_Load(object sender, EventArgs e) { if (!B_Admin.IsSuperManage(badmin.GetAdminLogin().AdminId)) { function.WriteErrMsg("只有超级管理员才能访问该页!!"); } if (function.isAjax()) { //返回进度 Response.Write(ZipClass.GetPercent(ZipClass.zipTotal, ZipClass.zipProgress)); Response.Flush(); Response.End(); } database = StrHelper.GetAttrByStr(SqlHelper.ConnectionString, "initial catalog"); if (!IsPostBack) { if (!B_ARoleAuth.Check(ZLEnum.Auth.other, "DevCenter")) { function.WriteErrMsg("你没有对该模块的访问权限"); } if (!badmin.CheckSPwd(Session["Spwd"] as string)) { SPwd.Visible = true; } else { maindiv.Visible = true; } this.DatabasePath.Value = DateTime.Now.ToString("MMdd") + "ZoomlaCMS"; this.SiteText.Value = DateTime.Now.ToString("yyyyMMdd_HHmmss") + "全站备份"; MyBind(); Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "I/Main.aspx'>工作台</a></li><li><a href='DatalistProfile.aspx'>扩展功能</a></li> <li><a href='RunSql.aspx'>开发中心</a></li><li><a href='BackupRestore.aspx'>备份与还原数据</a></li>" + Call.GetHelp(69)); } }
protected void Page_Load(object sender, EventArgs e) { //http://update.z01.com/Template/Bear/view.jpg if (function.isAjax()) { string action = Request.Form["action"]; string value = Request.Form["value"]; int userID = buser.GetLogin().UserID; Response.Clear(); switch (action) { case "getTempP": Response.Write(ZipClass.GetPercent(Convert.ToInt64(Application[userID + "downTempT"]), Convert.ToInt64(Application[userID + "downTempP"]))); break; case "setdefault": string tempdir = @"/Template/" + value; SiteConfig.SiteOption.TemplateDir = tempdir; SiteConfig.SiteOption.CssDir = tempdir + "/style"; SiteConfig.Update(); Response.Write(""); break; } Response.End(); } //EC.GetRemoteObj remote = new EC.GetRemoteObj(); //remote.Urlutf8("" + serverdomain + "/api/gettemplate.aspx?menu=getprojectinfodir&proname=" + Server.UrlEncode(proname)); if (!IsPostBack) { Panel1.Visible = true; LblTitle.Text = ProName + "[作者:" + GetAuthor() + "]"; tempname.Text = ProName; string prodir = "/template/" + ProDir + "/"; tempimg.Text = "<a class=\"lightbox\" href=\"" + serverdomain + prodir + "view.jpg\"><img src=\"" + serverdomain + prodir + "View.jpg\"></a>"; DownFile dw = DownFileWork; string TempUrl = serverdomain + "/template/" + ProDir + ".zip"; string TempZipFile = SiteConfig.SiteMapath() + "\\template\\" + ProDir + ".zip"; TempUrl = TempUrl.Replace(@"\\", @"\"); TempZipFile = TempZipFile.Replace("/", @"\").Replace(@"\\", @"\"); //function.WriteErrMsg(TempZipFile + "||||" + TempUrl); Application[buser.GetLogin().UserID + "downTempT"] = GetFileSize(TempUrl); dw.BeginInvoke(buser.GetLogin().UserID, HttpContext.Current, TempUrl, TempZipFile, null, null, null); Call.SetBreadCrumb(Master, "<li><a href='" + customPath2 + "Main.aspx'>工作台</a></li><li><a href='TemplateSetOfficial.aspx'>方案设置</a></li><li class=\"active\">下载方案</li>"); } }
protected void Page_Load(object sender, EventArgs e) { IdentityAnalogue ia = new IdentityAnalogue(); ia.CheckEnableSA(); //---------------指定管理员权限管理 M_Site_SiteList siteM = new M_Site_SiteList(); B_Site_SiteList siteBll = new B_Site_SiteList(); if (badmin.CheckLogin()) { //如果是管理员登录则不判断 } else if (buser.CheckLogin()) { string siteID = iis.Sites[siteName].Id.ToString(); //非管理员用户登录,开始判断 siteM = siteBll.SelByUserID(buser.GetLogin().UserID.ToString());//查找有无为该用户分配权限 if (siteM == null || !siteBll.AuthCheck(siteID, buser.GetLogin().UserID.ToString())) { function.WriteErrMsg("你没有管理站点的权限"); } this.Title = "独立控制台-文件浏览"; } else { function.WriteErrMsg("无权访问该页面"); return; } //-------------- if (function.isAjax())//删除 { string[] siteInfo; //站点名,索引,目标文件 string action = Request.Form["action"]; if (action.Equals("beginDown"))//开始下载 { siteInfo = Request.Form["fullPath"].Split(':'); Int32.TryParse(siteInfo[1], out index); StationGroup.RootPath = iis.Sites[siteInfo[0]].Applications[0].VirtualDirectories[index].PhysicalPath; if (!Directory.Exists(StationGroup.RootPath + StationGroup.ZipSavePath)) { Directory.CreateDirectory(StationGroup.RootPath + StationGroup.ZipSavePath); } if (File.Exists(StationGroup.RootPath + StationGroup.ZipSavePath + StationGroup.ZipName)) { File.Delete(StationGroup.RootPath + StationGroup.ZipSavePath + StationGroup.ZipName); } //ThreadPool.QueueUserWorkItem(MyThreadWork, tempPath + StationGroup.ZipName); ThreadPool.QueueUserWorkItem(MyThreadWork, sg); Response.End(); } else if (action.Equals("getProgress")) { Response.Write(progStatus); Response.End(); } else if (action.Equals("getUnZipProg")) { //根据长度 ,计算出百分比值后返回 Response.Write(ZipClass.GetPercent(ZipClass.unZipTotal, ZipClass.unZipProgress)); Response.End(); } siteInfo = Request.Form["fullPath"].Split(':'); int i = 0; if (siteInfo.Length < 3 || !Int32.TryParse(siteInfo[1], out i)) { Response.Write("信息错误,无法删除"); Response.Flush(); Response.End(); } string path = GetPath(siteInfo[0], i, siteInfo[2]);//获取全路径 if (action.Equals("del")) { try { if (!DeleteDirAndFile(path)) { Response.Write("文件不存在"); Response.Flush(); Response.End(); } } catch (Exception ex) { Response.Write(ex.Message); Response.Flush(); Response.End(); }//Response.Write("删除失败,目标文件正在使用或你无权限删除"); } else if (action.Equals("rename")) { string newPath = GetPath(siteInfo[0], i, "\\" + siteInfo[3]); //Response.Write(siteInfo[2]+":"+siteInfo[3]); if (!path.Equals(newPath)) { RenameDirAndFile(path.Trim(), newPath.Trim()); } } Response.Clear(); Response.Write(1); Response.Flush(); Response.End(); } //----------------AJAX END; siteName = Server.HtmlEncode(Request.QueryString["siteName"]); if (string.IsNullOrEmpty(siteName) || string.IsNullOrEmpty(Request.QueryString["index"]) || iis.Sites[siteName] == null) { function.WriteErrMsg("未选择要访问的站点名或该站点不存在."); } Int32.TryParse(Request.QueryString["index"], out index); StationGroup.RootPath = iis.Sites[siteName].Applications[0].VirtualDirectories[index].PhysicalPath; if (string.IsNullOrEmpty(iis.Sites[siteName].Bindings[index].Host)) { url = "http://LocalHost:" + iis.Sites[siteName].Bindings[index].EndPoint.Port; } else { url = "http://" + iis.Sites[siteName].Bindings[index].Host + ":" + iis.Sites[siteName].Bindings[index].EndPoint.Port; } if (!IsPostBack) { Call.HideBread(Master); Repeater1.DataSource = GetDirAndFileList(); Repeater1.DataBind(); string command = Request["command"];//如beginSetup开始安装等,快云安装传过来的 if (!string.IsNullOrEmpty(command)) { switch (command) { case "beginSetup": Page.ClientScript.RegisterStartupScript(this.GetType(), "", "beginDown();", true); //调用前台开始下载方法 break; default: break; } }//Command End; } }