private void UpLoadFile(HttpContext context) { Rain.Model.siteconfig siteconfig = new Rain.BLL.siteconfig().loadConfig(); string _filepath = DTRequest.GetString("DelFilePath"); HttpPostedFile file = context.Request.Files["Filedata"]; bool isWater = false; bool isThumbnail = false; if (DTRequest.GetQueryString("IsWater") == "1") { isWater = true; } if (DTRequest.GetQueryString("IsThumbnail") == "1") { isThumbnail = true; } if (file == null) { context.Response.Write("{\"status\": 0, \"msg\": \"请选择要上传文件!\"}"); } else { string s = new UpLoad().fileSaveAs(file, isThumbnail, isWater); if (!string.IsNullOrEmpty(_filepath) && _filepath.IndexOf("../") == -1 && _filepath.ToLower().StartsWith(siteconfig.webpath.ToLower() + siteconfig.filepath.ToLower())) { Utils.DeleteUpFile(_filepath); } context.Response.Write(s); context.Response.End(); } }
public static oauth_config get_config(string oauth_name) { Rain.Model.user_oauth_app model = new Rain.BLL.user_oauth_app().GetModel(oauth_name); if (model == null) { return((oauth_config)null); } Rain.Model.siteconfig siteconfig = new Rain.BLL.siteconfig().loadConfig(); return(new oauth_config() { oauth_name = model.api_path.Trim(), oauth_app_id = model.app_id.Trim(), oauth_app_key = model.app_key.Trim(), return_uri = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + siteconfig.webpath + "api/oauth/" + model.api_path + "/return_url.aspx" }); }
private void ManagerFile(HttpContext context) { Rain.Model.siteconfig siteconfig = new Rain.BLL.siteconfig().loadConfig(); string strPath = siteconfig.webpath + siteconfig.filepath + "/"; string str1 = siteconfig.webpath + siteconfig.filepath + "/"; string str2 = "gif,jpg,jpeg,png,bmp"; string mapPath = Utils.GetMapPath(strPath); string str3 = context.Request.QueryString["dir"]; string str4 = context.Request.QueryString["path"]; string input1 = string.IsNullOrEmpty(str4) ? "" : str4; string path; string str5; string input2; string str6; if (input1 == "") { path = mapPath; str5 = str1; input2 = ""; str6 = ""; } else { path = mapPath + input1; str5 = str1 + input1; input2 = input1; str6 = Regex.Replace(input2, "(.*?)[^\\/]+\\/$", "$1"); } string str7 = context.Request.QueryString["order"]; string str8 = string.IsNullOrEmpty(str7) ? "" : str7.ToLower(); if (Regex.IsMatch(input1, "\\.\\.")) { context.Response.Write("Access is not allowed."); context.Response.End(); } if (input1 != "" && !input1.EndsWith("/")) { context.Response.Write("Parameter is not valid."); context.Response.End(); } if (!Directory.Exists(path)) { context.Response.Write("Directory does not exist."); context.Response.End(); } string[] directories = Directory.GetDirectories(path); string[] files = Directory.GetFiles(path); switch (str8) { case "size": Array.Sort((Array)directories, (IComparer) new upload_ajax.NameSorter()); Array.Sort((Array)files, (IComparer) new upload_ajax.SizeSorter()); break; case "type": Array.Sort((Array)directories, (IComparer) new upload_ajax.NameSorter()); Array.Sort((Array)files, (IComparer) new upload_ajax.TypeSorter()); break; default: Array.Sort((Array)directories, (IComparer) new upload_ajax.NameSorter()); Array.Sort((Array)files, (IComparer) new upload_ajax.NameSorter()); break; } Hashtable hashtable = new Hashtable(); hashtable[(object)"moveup_dir_path"] = (object)str6; hashtable[(object)"current_dir_path"] = (object)input2; hashtable[(object)"current_url"] = (object)str5; hashtable[(object)"total_count"] = (object)(directories.Length + files.Length); List <Hashtable> hashtableList = new List <Hashtable>(); hashtable[(object)"file_list"] = (object)hashtableList; for (int index = 0; index < directories.Length; ++index) { DirectoryInfo directoryInfo = new DirectoryInfo(directories[index]); hashtableList.Add(new Hashtable() { [(object)"is_dir"] = (object)true, [(object)"has_file"] = (object)(directoryInfo.GetFileSystemInfos().Length > 0), [(object)"filesize"] = (object)0, [(object)"is_photo"] = (object)false, [(object)"filetype"] = (object)"", [(object)"filename"] = (object)directoryInfo.Name, [(object)"datetime"] = (object)directoryInfo.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss") }); } for (int index = 0; index < files.Length; ++index) { FileInfo fileInfo = new FileInfo(files[index]); hashtableList.Add(new Hashtable() { [(object)"is_dir"] = (object)false, [(object)"has_file"] = (object)false, [(object)"filesize"] = (object)fileInfo.Length, [(object)"is_photo"] = (object)(Array.IndexOf <string>(str2.Split(','), fileInfo.Extension.Substring(1).ToLower()) >= 0), [(object)"filetype"] = (object)fileInfo.Extension.Substring(1), [(object)"filename"] = (object)fileInfo.Name, [(object)"datetime"] = (object)fileInfo.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss") }); } context.Response.AddHeader("Content-Type", "application/json; charset=UTF-8"); context.Response.Write(JsonHelper.ObjectToJSON((object)hashtable)); context.Response.End(); }
private void ReUrl_BeginRequest(object sender, EventArgs e) { HttpContext context = ((HttpApplication) sender).Context; Rain.Model.siteconfig siteconfig = new Rain.BLL.siteconfig().loadConfig(); string lower1 = context.Request.Path.ToLower(); if (this.IsDirExist("dt_cache_site_directory", siteconfig.webpath, siteconfig.webpath, lower1)) return; string lower2 = context.Request.Url.Authority.ToLower(); string sitePath = this.GetSitePath(siteconfig.webpath, lower1, lower2); string str = this.CutStringPath(siteconfig.webpath, sitePath, lower1); if (siteconfig.staticstatus == 0) { foreach (Rain.Model.url_rewrite url in SiteUrls.GetUrls().Urls) { if (url.page == lower1.Substring(lower1.LastIndexOf("/") + 1)) { if (url.type == "plugin") { context.RewritePath(string.Format("{0}{1}/{2}{3}", (object) siteconfig.webpath, (object) "aspx", (object) "plugin", (object) str)); break; } context.RewritePath(string.Format("{0}{1}/{2}{3}", (object) siteconfig.webpath, (object) "aspx", (object) sitePath, (object) str)); break; } } } else { foreach (Rain.Model.url_rewrite url in SiteUrls.GetUrls().Urls) { if (url.url_rewrite_items.Count == 0 && Utils.GetUrlExtension(url.page, siteconfig.staticextension) == lower1.Substring(lower1.LastIndexOf("/") + 1)) { if (url.type == "plugin") { context.RewritePath(string.Format("{0}{1}/{2}/{3}", (object) siteconfig.webpath, (object) "aspx", (object) "plugin", (object) url.page)); break; } context.RewritePath(string.Format("{0}{1}/{2}/{3}", (object) siteconfig.webpath, (object) "aspx", (object) sitePath, (object) url.page)); break; } foreach (url_rewrite_item urlRewriteItem in url.url_rewrite_items) { string urlExtension = Utils.GetUrlExtension(urlRewriteItem.pattern, siteconfig.staticextension); if (Regex.IsMatch(str, string.Format("^/{0}$", (object) urlExtension), RegexOptions.IgnoreCase) || url.page == "index.aspx" && Regex.IsMatch(str, string.Format("^/{0}$", (object) urlRewriteItem.pattern), RegexOptions.IgnoreCase)) { if (siteconfig.staticstatus == 2 && (url.channel.Length > 0 || url.page.ToLower() == "index.aspx")) { context.RewritePath(siteconfig.webpath + "html/" + sitePath + Utils.GetUrlExtension(str, siteconfig.staticextension, true)); return; } if (url.type == "plugin") { string queryString = Regex.Replace(str, string.Format("/{0}", (object) urlExtension), urlRewriteItem.querystring, RegexOptions.IgnoreCase); context.RewritePath(string.Format("{0}{1}/{2}/{3}", (object) siteconfig.webpath, (object) "aspx", (object) "plugin", (object) url.page), string.Empty, queryString); return; } string queryString1 = Regex.Replace(str, string.Format("/{0}", (object) urlExtension), urlRewriteItem.querystring, RegexOptions.IgnoreCase); context.RewritePath(string.Format("{0}{1}/{2}/{3}", (object) siteconfig.webpath, (object) "aspx", (object) sitePath, (object) url.page), string.Empty, queryString1); return; } } } } }
protected void Page_Load(object sender, EventArgs e) { Rain.Model.siteconfig siteconfig = new Rain.BLL.siteconfig().loadConfig(); TenpayUtil tenpayUtil = new TenpayUtil(); string upper = DTRequest.GetFormString("pay_order_no").ToUpper(); Decimal formDecimal = DTRequest.GetFormDecimal("pay_order_amount", new Decimal(0)); string formString1 = DTRequest.GetFormString("pay_user_name"); string formString2 = DTRequest.GetFormString("pay_subject"); string str = string.Empty; if (upper == "" || formDecimal == new Decimal(0)) { this.Response.Redirect(new BasePage().linkurl("error", (object)("?msg=" + Utils.UrlEncode("对不起,您提交的参数有误!")))); } else { if (upper.StartsWith("R")) { Rain.Model.user_recharge model = new Rain.BLL.user_recharge().GetModel(upper); if (model == null) { this.Response.Redirect(new BasePage().linkurl("error", (object)("?msg=" + Utils.UrlEncode("对不起,您充值的订单号不存在或已删除!")))); return; } if (model.amount != formDecimal) { this.Response.Redirect(new BasePage().linkurl("error", (object)("?msg=" + Utils.UrlEncode("对不起,您充值的订单金额与实际金额不一致!")))); return; } str = "2"; } else { Rain.Model.orders model = new Rain.BLL.orders().GetModel(upper); if (model == null) { this.Response.Redirect(new BasePage().linkurl("error", (object)("?msg=" + Utils.UrlEncode("对不起,您支付的订单号不存在或已删除!")))); return; } if (model.order_amount != formDecimal) { this.Response.Redirect(new BasePage().linkurl("error", (object)("?msg=" + Utils.UrlEncode("对不起,您支付的订单金额与实际金额不一致!")))); return; } str = "1"; } string parameterValue = string.IsNullOrEmpty(formString1) ? "匿名用户" : "支付会员:" + formString1; RequestHandler requestHandler = new RequestHandler(this.Context); requestHandler.init(); requestHandler.setKey(tenpayUtil.key); requestHandler.setGateUrl("https://gw.tenpay.com/gateway/pay.htm"); requestHandler.setParameter("partner", tenpayUtil.partner); requestHandler.setParameter("out_trade_no", upper); requestHandler.setParameter("total_fee", (Convert.ToDouble(formDecimal) * 100.0).ToString()); requestHandler.setParameter("return_url", tenpayUtil.return_url); requestHandler.setParameter("notify_url", tenpayUtil.notify_url); requestHandler.setParameter("body", parameterValue); requestHandler.setParameter("bank_type", "DEFAULT"); requestHandler.setParameter("spbill_create_ip", this.Page.Request.UserHostAddress); requestHandler.setParameter("fee_type", "1"); requestHandler.setParameter("subject", siteconfig.webname + "-" + formString2); requestHandler.setParameter("sign_type", "MD5"); requestHandler.setParameter("service_version", "1.0"); requestHandler.setParameter("input_charset", "UTF-8"); requestHandler.setParameter("sign_key_index", "1"); requestHandler.setParameter("product_fee", "0"); requestHandler.setParameter("transport_fee", "0"); requestHandler.setParameter("time_start", DateTime.Now.ToString("yyyyMMddHHmmss")); requestHandler.setParameter("time_expire", ""); requestHandler.setParameter("buyer_id", ""); requestHandler.setParameter("goods_tag", ""); requestHandler.setParameter("trade_mode", tenpayUtil.type); requestHandler.setParameter("transport_desc", ""); requestHandler.setParameter("trans_type", "1"); requestHandler.setParameter("agentid", ""); requestHandler.setParameter("agent_type", ""); requestHandler.setParameter("seller_id", ""); requestHandler.getRequestURL(); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("<form id='tenpaysubmit' name='tenpaysubmit' action='" + requestHandler.getGateUrl() + "' method='get'>"); foreach (DictionaryEntry allParameter in requestHandler.getAllParameters()) { stringBuilder.Append("<input type=\"hidden\" name=\"" + allParameter.Key + "\" value=\"" + allParameter.Value + "\" >\n"); } stringBuilder.Append("<input type='submit' value='确认' style='display:none;'></form>"); stringBuilder.Append("<script>document.forms['tenpaysubmit'].submit();</script>"); this.Response.Write(stringBuilder.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { Rain.Model.siteconfig siteconfig = new Rain.BLL.siteconfig().loadConfig(); string upper = DTRequest.GetFormString("pay_order_no").ToUpper(); Decimal formDecimal = DTRequest.GetFormDecimal("pay_order_amount", new Decimal(0)); string formString1 = DTRequest.GetFormString("pay_user_name"); string formString2 = DTRequest.GetFormString("pay_subject"); string empty1 = string.Empty; string empty2 = string.Empty; string str1 = string.Empty; string empty3 = string.Empty; string empty4 = string.Empty; if (string.IsNullOrEmpty(upper) || formDecimal == new Decimal(0)) { this.Response.Redirect(new BasePage().linkurl("error", (object)("?msg=" + Utils.UrlEncode("对不起,您提交的参数有误!")))); } else { string str2; string address; string telphone; string mobile; if (upper.StartsWith("R")) { Rain.Model.user_recharge model1 = new Rain.BLL.user_recharge().GetModel(upper); if (model1 == null) { this.Response.Redirect(new BasePage().linkurl("error", (object)("?msg=" + Utils.UrlEncode("对不起,您充值的订单号不存在或已删除!")))); return; } if (model1.amount != formDecimal) { this.Response.Redirect(new BasePage().linkurl("error", (object)("?msg=" + Utils.UrlEncode("对不起,您充值的订单金额与实际金额不一致!")))); return; } Rain.Model.users model2 = new Rain.BLL.users().GetModel(model1.user_id); if (model2 == null) { this.Response.Redirect(new BasePage().linkurl("error", (object)("?msg=" + Utils.UrlEncode("对不起,用户账户不存在或已删除!")))); return; } str2 = model2.nick_name; address = model2.address; telphone = model2.telphone; mobile = model2.mobile; } else { Rain.Model.orders model = new Rain.BLL.orders().GetModel(upper); if (model == null) { this.Response.Redirect(new BasePage().linkurl("error", (object)("?msg=" + Utils.UrlEncode("对不起,您支付的订单号不存在或已删除!")))); return; } if (model.order_amount != formDecimal) { this.Response.Redirect(new BasePage().linkurl("error", (object)("?msg=" + Utils.UrlEncode("对不起,您支付的订单金额与实际金额不一致!")))); return; } str2 = model.accept_name; address = model.address; str1 = model.post_code; telphone = model.telphone; mobile = model.mobile; } string str3 = !(formString1 != "") ? "匿名用户" : "支付会员:" + formString1; if (Config.Type == "1") { this.Response.Write(new Service().Create_direct_pay_by_user(new SortedDictionary <string, string>() { { "payment_type", "1" }, { "show_url", siteconfig.weburl }, { "out_trade_no", upper }, { "subject", siteconfig.webname + "-" + formString2 }, { "body", str3 }, { "total_fee", formDecimal.ToString() }, { "paymethod", "" }, { "defaultbank", "" }, { "anti_phishing_key", "" }, { "exter_invoke_ip", DTRequest.GetIP() }, { "buyer_email", "" }, { "royalty_type", "" }, { "royalty_parameters", "" } })); } else { this.Response.Write(new Service().Create_partner_trade_by_buyer(new SortedDictionary <string, string>() { { "payment_type", "1" }, { "out_trade_no", upper }, { "subject", siteconfig.webname + "-" + formString2 }, { "price", formDecimal.ToString() }, { "quantity", "1" }, { "logistics_fee", "0.00" }, { "logistics_type", "EXPRESS" }, { "logistics_payment", "SELLER_PAY" }, { "body", str3 }, { "show_url", siteconfig.weburl }, { "receive_name", str2 }, { "receive_address", address }, { "receive_zip", str1 }, { "receive_phone", telphone }, { "receive_mobile", mobile } })); } } }