/// <summary> /// Query data list /// </summary> public static List<Maticsoft.Model.SysManage.ErrorLog> DataTableToList(DataTable dt) { List<Maticsoft.Model.SysManage.ErrorLog> modelList = new List<Maticsoft.Model.SysManage.ErrorLog>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Maticsoft.Model.SysManage.ErrorLog model; for (int n = 0; n < rowsCount; n++) { model = new Maticsoft.Model.SysManage.ErrorLog(); if (dt.Rows[n]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[n]["ID"].ToString()); } if (dt.Rows[n]["OPTime"].ToString() != "") { model.OPTime = DateTime.Parse(dt.Rows[n]["OPTime"].ToString()); } model.Url = dt.Rows[n]["Url"].ToString(); model.Loginfo = dt.Rows[n]["Loginfo"].ToString(); model.StackTrace = dt.Rows[n]["StackTrace"].ToString(); modelList.Add(model); } } return modelList; }
public static List<Maticsoft.Model.SysManage.ErrorLog> DataTableToList(DataTable dt) { List<Maticsoft.Model.SysManage.ErrorLog> list = new List<Maticsoft.Model.SysManage.ErrorLog>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { Maticsoft.Model.SysManage.ErrorLog item = new Maticsoft.Model.SysManage.ErrorLog(); if (dt.Rows[i]["ID"].ToString() != "") { item.ID = int.Parse(dt.Rows[i]["ID"].ToString()); } if (dt.Rows[i]["OPTime"].ToString() != "") { item.OPTime = DateTime.Parse(dt.Rows[i]["OPTime"].ToString()); } item.Url = dt.Rows[i]["Url"].ToString(); item.Loginfo = dt.Rows[i]["Loginfo"].ToString(); item.StackTrace = dt.Rows[i]["StackTrace"].ToString(); list.Add(item); } } return list; }
public static void AddErrorLog(string Loginfo, string StackTrace, string ClassName) { Maticsoft.Model.SysManage.ErrorLog model = new Maticsoft.Model.SysManage.ErrorLog { Loginfo = Loginfo, StackTrace = "", Url = ClassName }; Maticsoft.BLL.SysManage.ErrorLog.Add(model); }
public static void AddErrorLog(string Loginfo, string StackTrace, Page page) { Maticsoft.Model.SysManage.ErrorLog model = new Maticsoft.Model.SysManage.ErrorLog { Loginfo = Loginfo, StackTrace = StackTrace, Url = page.Request.Url.AbsoluteUri }; Maticsoft.BLL.SysManage.ErrorLog.Add(model); }
protected override void ControllerException(ExceptionContext filterContext) { filterContext.ExceptionHandled = true; string content = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">"; content = (content + string.Format("<title>系统发生错误 MaticsoftFK {0}{1}</title>", MvcApplication.Version, MvcApplication.IsAuthorize ? "" : ControllerBaseAbs.P_DATA) + "<style>body{\tfont-family: 'Microsoft Yahei', Verdana, arial, sans-serif;\tfont-size:14px;}a{text-decoration:none;color:#174B73;}a:hover{ text-decoration:none;color:#FF6600;}h2{\tborder-bottom:1px solid #DDD;\tpadding:8px 0; font-size:25px;}.title{\tmargin:4px 0;\tcolor:#F60;\tfont-weight:bold;}.message,#trace{\tpadding:1em;\tborder:solid 1px #000;\tmargin:10px 0;\tbackground:#FFD;\tline-height:150%;}.message{\tbackground:#FFD;\tcolor:#2E2E2E;\t\tborder:1px solid #E0E0E0;}#trace{\tbackground:#E7F7FF;\tborder:1px solid #E0E0E0;\tcolor:#535353;\tword-wrap: break-word;}.notice{ padding:10px;\tmargin:5px;\tcolor:#666;\tbackground:#FCFCFC;\tborder:1px solid #E0E0E0;}.red{\tcolor:red;\tfont-weight:bold;}</style></head>") + "<body><div class=\"notice\"><h2>系统发生错误 </h2>" + "<div>您可以选择 [ <a href=\"javascript:location.reload();\" >重试</a> ] [ <a href=\"javascript:history.back()\">返回</a> ] 或者 [ <a target=\"_blank\" href=\"http://bbs.maticsoft.com/\">去官方论坛找找答案</a> ]</div>"; Maticsoft.Model.SysManage.ErrorLog model = new Maticsoft.Model.SysManage.ErrorLog(); Exception e = filterContext.Exception; HttpContextBase httpContext = filterContext.HttpContext; httpContext.Response.Clear(); StackTrace trace = new StackTrace(e, true); int fileLineNumber = trace.GetFrame(0).GetFileLineNumber(); int fileColumnNumber = trace.GetFrame(0).GetFileColumnNumber(); string fileName = trace.GetFrame(0).GetFileName(); object obj2 = content; content = string.Concat(new object[] { obj2, "<p><strong>错误位置:</strong> File: <span class=\"red\">", fileName, "</span> Line: <span class=\"red\">", fileLineNumber, "</span> Column: <span class=\"red\">", fileColumnNumber, "</span></p>" }) + "<p class=\"title\">[ 错误信息 ]</p>"; if (e is SqlException) { SqlException exception2 = (SqlException) e; if (exception2 != null) { string sqlExceptionMessage = this.GetSqlExceptionMessage(exception2.Number); if (exception2.Number == 0x223) { content = content + "<p class=\"message\">" + sqlExceptionMessage + "</p>"; } else { content = content + "<p class=\"message\">" + sqlExceptionMessage + "</p>"; model.Loginfo = sqlExceptionMessage; model.StackTrace = e.ToString(); model.Url = httpContext.Request.Url.AbsoluteUri; } } } else { content = (((content + "<p class=\"message\">" + e.Message + "</p>") + "<p class=\"title\">[ StackTrace ]</p><p id=\"trace\">" + e.StackTrace + "</p></div>") + string.Format("<div align=\"center\" style=\"color:#FF3300;margin:5pt;font-family:Verdana\"> MaticsoftFK <sup style=\"color:gray;font-size:9pt\">{0}</sup>", MvcApplication.Version)) + "<span style=\"color:silver\"> { Building & OOP MVC Maticsoft Framework } -- [ WE CAN DO IT JUST HAPPY WORKING ]</span></div>" + "</body><style type=\"text/css\"></style></html>"; model.Loginfo = e.Message; model.StackTrace = e.ToString(); model.Url = httpContext.Request.Url.AbsoluteUri; } Maticsoft.BLL.SysManage.ErrorLog.Add(model); if (!base.HttpContext.IsDebuggingEnabled && e.TargetSite.ToString().StartsWith("System.Web.Mvc.ViewEngineResult FindView")) { filterContext.Result = new HttpNotFoundResult(); httpContext.Server.ClearError(); } else { filterContext.Result = base.Content(content); httpContext.Server.ClearError(); } }
public override void ProcessRequest(HttpContext context) { context.Response.ContentType = this.ResponseContentType; HttpPostedFile httpPostedFile = this.GetHttpPostedFile(context); if (httpPostedFile == null) { throw new FileNotFoundException("UpdateFile Not Found! HttpPostedFile Is NULL!"); } if (httpPostedFile.FileName.Length >= 1) { string fileName = this.GenerateFileName(httpPostedFile); try { if (this.IsLocalSave) { string uploadPath = this.GetUploadPath(context); if (!Directory.Exists(uploadPath)) { Directory.CreateDirectory(uploadPath); } this.SaveAs(uploadPath, fileName, httpPostedFile); } else { int contentLength = httpPostedFile.ContentLength; byte[] buffer = new byte[contentLength]; httpPostedFile.InputStream.Read(buffer, 0, contentLength); string imageUrl = ""; if (UpYunManager.UploadExecute(buffer, fileName, this.ApplicationKeyType, out imageUrl)) { fileName = imageUrl; } } this.ProcessSub(context, this.UploadTempFolder, fileName); } catch (Exception exception) { Maticsoft.Model.SysManage.ErrorLog model = new Maticsoft.Model.SysManage.ErrorLog { Loginfo = exception.Message, StackTrace = exception.ToString(), Url = context.Request.Url.AbsoluteUri }; Maticsoft.BLL.SysManage.ErrorLog.Add(model); throw; } } }
public override void ProcessRequest(HttpContext context) { try { context.Response.ContentType = this.ResponseContentType; HttpFileCollection httpPostedFile = this.GetHttpPostedFile(context); if (httpPostedFile == null) { throw new FileNotFoundException("UpdateFile Not Found! HttpPostedFile Is NULL!"); } string path = "/Upload/Temp/" + DateTime.Now.ToString("yyyyMMdd") + "/"; string str2 = context.Server.MapPath(path); if (!Directory.Exists(str2)) { Directory.CreateDirectory(str2); } string str3 = string.Empty; for (int i = 0; i < httpPostedFile.Count; i++) { HttpPostedFile file = httpPostedFile[i]; string str4 = DateTime.Now.ToString("yyyyMMddHHmmssfffffff") + Path.GetExtension(file.FileName); file.SaveAs(str2 + str4); string str5 = "T300X400_" + str4; ImageTools.MakeThumbnail(str2 + str4, str2 + str5, 300, 400, MakeThumbnailMode.HW, InterpolationMode.High, SmoothingMode.HighQuality); str3 = str3 + "|" + str5; } JsonObject obj2 = new JsonObject(); obj2.Put("success", true); obj2.Put("path", path + "{0}"); obj2.Put("names", str3.TrimStart(new char[] { '|' })); context.Response.Write(obj2.ToString()); } catch (Exception exception) { Maticsoft.Model.SysManage.ErrorLog model = new Maticsoft.Model.SysManage.ErrorLog { Loginfo = exception.Message, StackTrace = exception.ToString(), Url = context.Request.Url.AbsoluteUri }; Maticsoft.BLL.SysManage.ErrorLog.Add(model); throw; } }
protected override void PageError(object sender, EventArgs e) { string s = ""; Maticsoft.Model.SysManage.ErrorLog model = new Maticsoft.Model.SysManage.ErrorLog(); Exception lastError = base.Server.GetLastError(); if (lastError is SqlException) { SqlException exception2 = (SqlException) lastError; if (exception2 != null) { string sqlExceptionMessage = this.GetSqlExceptionMessage(exception2.Number); if (exception2.Number == 0x223) { string str3 = s; s = str3 + "<h1 class=\"SystemTip\">" + Site.ErrorSystemTip + "</h1><br/> <font class=\"ErrorPageText\">" + sqlExceptionMessage + "</font>"; } else { string str4 = s; s = str4 + "<h1 class=\"ErrorMessage\">" + Site.ErrorSystemTip + "</h1><hr/> 该信息已被系统记录,请稍后重试或与管理员联系。<br/>错误信息: <font class=\"ErrorPageText\">" + sqlExceptionMessage + "</font>"; model.Loginfo = sqlExceptionMessage; model.StackTrace = lastError.ToString(); model.Url = base.Request.Url.AbsoluteUri; } } } else { string str5 = s; s = str5 + "<h1 class=\"ErrorMessage\">" + Site.ErrorSystemTip + "</h1><hr/> 该信息已被系统记录,请稍后重试或与管理员联系。<br/>错误信息: <font class=\"ErrorPageText\">" + lastError.Message.ToString() + "<hr/><b>Stack Trace:</b><br/>" + lastError.ToString() + "</font>"; model.Loginfo = lastError.Message; model.StackTrace = lastError.ToString(); model.Url = base.Request.Url.AbsoluteUri; } Maticsoft.BLL.SysManage.ErrorLog.Add(model); base.Response.Write(s); base.Server.ClearError(); }
private void BindArea(int City_iID) { try { this.ddlArea.DataSource = this.bll.GetDistrictByParentId(City_iID); this.ddlArea.DataTextField = "RegionName"; this.ddlArea.DataValueField = "RegionId"; this.ddlArea.DataBind(); if (this._visibleall) { this.ddlArea.Items.Insert(0, new ListItem(this._visiblealltext, "0")); this.ddlArea.SelectedValue = "0"; } } catch (Exception exception) { Maticsoft.Model.SysManage.ErrorLog model = new Maticsoft.Model.SysManage.ErrorLog { Loginfo = exception.Message, StackTrace = exception.StackTrace, Url = base.Request.Url.AbsoluteUri }; Maticsoft.BLL.SysManage.ErrorLog.Add(model); } }
public Maticsoft.Model.SysManage.ErrorLog GetModel(int ID) { StringBuilder builder = new StringBuilder(); builder.Append("select top 1 ID,OPTime,Url,Loginfo,StackTrace from SA_ErrorLog "); builder.Append(" where ID=@ID "); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@ID", SqlDbType.Int, 4) }; cmdParms[0].Value = ID; Maticsoft.Model.SysManage.ErrorLog log = new Maticsoft.Model.SysManage.ErrorLog(); DataSet set = DbHelperSQL.Query(builder.ToString(), cmdParms); if (set.Tables[0].Rows.Count <= 0) { return null; } if (set.Tables[0].Rows[0]["ID"].ToString() != "") { log.ID = int.Parse(set.Tables[0].Rows[0]["ID"].ToString()); } if (set.Tables[0].Rows[0]["OPTime"].ToString() != "") { log.OPTime = DateTime.Parse(set.Tables[0].Rows[0]["OPTime"].ToString()); } log.Url = set.Tables[0].Rows[0]["Url"].ToString(); log.Loginfo = set.Tables[0].Rows[0]["Loginfo"].ToString(); log.StackTrace = set.Tables[0].Rows[0]["StackTrace"].ToString(); return log; }
public void SendWeiBo(string bindIds, string content, string url, string imageUrl = new string()) { string strWhere = ""; if (!string.IsNullOrWhiteSpace(bindIds)) { strWhere = strWhere + " BindId in (" + bindIds + ")"; } List<Maticsoft.Model.Members.UserBind> modelList = this.GetModelList(strWhere); if ((modelList != null) && (modelList.Count != 0)) { if (string.IsNullOrWhiteSpace(url)) { url = "http://" + Globals.DomainFullName; } foreach (Maticsoft.Model.Members.UserBind bind in modelList) { string str6; switch (bind.MediaID) { case 3: { string clientId = ConfigSystem.GetValueByCache("Social_SinaAppId"); string clientSecret = ConfigSystem.GetValueByCache("Social_SinaSercet"); IOAuth2ServiceProvider<Maticsoft.OAuth.Sina.IWeibo> provider = new Maticsoft.OAuth.Sina.WeiboServiceProvider(clientId, clientSecret); Maticsoft.OAuth.Sina.IWeibo weibo = provider.GetApi(new AccessGrant(bind.TokenAccess, new string[] { bind.MediaUserID })); try { if (string.IsNullOrWhiteSpace(imageUrl)) { weibo.UpdateStatusAsync(content + " " + url).Wait(); } else { string path = imageUrl; if (imageUrl.Contains("http://")) { System.Net.WebClient client = new System.Net.WebClient(); string str5 = "/Upload/Temp/" + DateTime.Now.ToString("yyyyMMdd") + "/"; if (!Directory.Exists(HttpContext.Current.Server.MapPath(str5))) { Directory.CreateDirectory(HttpContext.Current.Server.MapPath(str5)); } path = str5 + this.CreateIDCode() + ".jpg"; client.DownloadFile(imageUrl, HttpContext.Current.Server.MapPath(path)); } weibo.UploadStatusAsync(content + url, new FileInfo(HttpContext.Current.Server.MapPath(path))).Wait(); } } catch (Exception exception) { Maticsoft.Model.SysManage.ErrorLog model = new Maticsoft.Model.SysManage.ErrorLog { Loginfo = exception.Message, OPTime = DateTime.Now, StackTrace = exception.StackTrace, Url = "" }; Maticsoft.BLL.SysManage.ErrorLog.Add(model); } break; } case 13: goto Label_0201; } continue; Label_0201: str6 = ConfigSystem.GetValueByCache("Social_QQAppId"); string valueByCache = ConfigSystem.GetValueByCache("Social_QQSercet"); IOAuth2ServiceProvider<IQConnect> provider2 = new QConnectServiceProvider(str6, valueByCache); IQConnect api = provider2.GetApi(new AccessGrant(bind.TokenAccess, new string[] { bind.MediaUserID })); try { if (string.IsNullOrWhiteSpace(imageUrl)) { api.UpdateStatusAsync(content + url).Wait(); } else { string str8 = imageUrl; if (imageUrl.Contains("http://")) { System.Net.WebClient client2 = new System.Net.WebClient(); string str9 = "/Upload/Temp/" + DateTime.Now.ToString("yyyyMMdd") + "/"; if (!Directory.Exists(HttpContext.Current.Server.MapPath(str9))) { Directory.CreateDirectory(HttpContext.Current.Server.MapPath(str9)); } str8 = str9 + this.CreateIDCode() + ".jpg"; client2.DownloadFile(imageUrl, HttpContext.Current.Server.MapPath(str8)); } api.UploadStatusAsync(content + url, new FileInfo(HttpContext.Current.Server.MapPath(str8))).Wait(); } continue; } catch (Exception exception2) { Maticsoft.Model.SysManage.ErrorLog log2 = new Maticsoft.Model.SysManage.ErrorLog { Loginfo = exception2.Message, OPTime = DateTime.Now, StackTrace = exception2.StackTrace, Url = "" }; Maticsoft.BLL.SysManage.ErrorLog.Add(log2); continue; } } } }
public void SendWeiBo(int userId, string mediaIDs, string content, string url, string imageUrl = new string()) { string strWhere = " userid=" + userId; if (!string.IsNullOrWhiteSpace(mediaIDs)) { strWhere = strWhere + " and MediaID in (" + mediaIDs + ")"; } List<Maticsoft.Model.Members.UserBind> modelList = this.GetModelList(strWhere); if ((modelList != null) && (modelList.Count != 0)) { if (string.IsNullOrWhiteSpace(url)) { url = "http://" + Globals.DomainFullName; } foreach (Maticsoft.Model.Members.UserBind bind in modelList) { switch (bind.MediaID) { case 3: { string clientId = ConfigSystem.GetValueByCache("Social_SinaAppId"); string str3 = ConfigSystem.GetValueByCache("Social_SinaSercet"); IOAuth2ServiceProvider<Maticsoft.OAuth.Sina.IWeibo> provider = new Maticsoft.OAuth.Sina.WeiboServiceProvider(clientId, str3); Maticsoft.OAuth.Sina.IWeibo weibo = provider.GetApi(new AccessGrant(bind.TokenAccess, new string[] { bind.MediaUserID })); try { if (string.IsNullOrWhiteSpace(imageUrl)) { weibo.UpdateStatusAsync(content + " " + url).Wait(); } else { string str4 = imageUrl; if (imageUrl.Contains("http://")) { System.Net.WebClient client = new System.Net.WebClient(); string str5 = "/Upload/Temp/" + DateTime.Now.ToString("yyyyMMdd") + "/"; if (!Directory.Exists(HttpContext.Current.Server.MapPath(str5))) { Directory.CreateDirectory(HttpContext.Current.Server.MapPath(str5)); } str4 = str5 + this.CreateIDCode() + ".jpg"; client.DownloadFile(imageUrl, HttpContext.Current.Server.MapPath(str4)); } weibo.UploadStatusAsync(content + url, new FileInfo(HttpContext.Current.Server.MapPath(str4))).Wait(); } } catch (Exception exception) { Maticsoft.Model.SysManage.ErrorLog model = new Maticsoft.Model.SysManage.ErrorLog { Loginfo = exception.Message, OPTime = DateTime.Now, StackTrace = exception.StackTrace, Url = "" }; Maticsoft.BLL.SysManage.ErrorLog.Add(model); } continue; } case 4: break; case 13: { string str6 = ConfigSystem.GetValueByCache("Social_QQAppId"); string str7 = ConfigSystem.GetValueByCache("Social_QQSercet"); IOAuth2ServiceProvider<IQConnect> provider2 = new QConnectServiceProvider(str6, str7); IQConnect connect = provider2.GetApi(new AccessGrant(bind.TokenAccess, new string[] { bind.MediaUserID })); try { if (string.IsNullOrWhiteSpace(imageUrl)) { connect.UpdateStatusAsync(content + url).Wait(); } else { string str8 = imageUrl; if (imageUrl.Contains("http://")) { System.Net.WebClient client2 = new System.Net.WebClient(); string str9 = "/Upload/Temp/" + DateTime.Now.ToString("yyyyMMdd") + "/"; if (!Directory.Exists(HttpContext.Current.Server.MapPath(str9))) { Directory.CreateDirectory(HttpContext.Current.Server.MapPath(str9)); } str8 = str9 + this.CreateIDCode() + ".jpg"; client2.DownloadFile(imageUrl, HttpContext.Current.Server.MapPath(str8)); } connect.UploadStatusAsync(content + url, new FileInfo(HttpContext.Current.Server.MapPath(str8))).Wait(); } } catch (Exception exception2) { Maticsoft.Model.SysManage.ErrorLog log2 = new Maticsoft.Model.SysManage.ErrorLog { Loginfo = exception2.Message, OPTime = DateTime.Now, StackTrace = exception2.StackTrace, Url = "" }; Maticsoft.BLL.SysManage.ErrorLog.Add(log2); } continue; } default: { continue; } } string valueByCache = ConfigSystem.GetValueByCache("Social_TencentAppId"); string clientSecret = ConfigSystem.GetValueByCache("Social_TencentSercet"); IOAuth2ServiceProvider<Maticsoft.OAuth.Tencent.Weibo.IWeibo> provider3 = new Maticsoft.OAuth.Tencent.Weibo.WeiboServiceProvider(valueByCache, clientSecret); string[] strArray = bind.MediaUserID.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); if (strArray.Length < 2) { throw new ArgumentNullException(" OpenIdKeys is NULL !"); } Maticsoft.OAuth.Tencent.Weibo.IWeibo api = provider3.GetApi(new AccessGrant(bind.TokenAccess, new string[] { strArray[0], strArray[1], Globals.ClientIP })); if (string.IsNullOrWhiteSpace(imageUrl)) { api.UpdateStatusAsync(content + url).Wait(); continue; } string path = imageUrl; if (imageUrl.Contains("http://")) { System.Net.WebClient client3 = new System.Net.WebClient(); string str13 = "/Upload/Temp/" + DateTime.Now.ToString("yyyyMMdd") + "/"; if (!Directory.Exists(HttpContext.Current.Server.MapPath(str13))) { Directory.CreateDirectory(HttpContext.Current.Server.MapPath(str13)); } path = str13 + this.CreateIDCode() + ".jpg"; client3.DownloadFile(imageUrl, HttpContext.Current.Server.MapPath(path)); } api.UploadStatusAsync(content + url, new FileInfo(HttpContext.Current.Server.MapPath(path))).Wait(); } } }
public static bool GenImageJs() { Encoding encoding = Encoding.GetEncoding("utf-8"); StreamWriter writer = null; string str = null; string path = "/Scripts/maticsoft.collection.min.js"; string str3 = "(function(){function t(e,t,n){e.attachEvent?(e[\"e\"+t+n]=n,e[t+n]=function(){e[\"e\"+t+n](window.event)},e.attachEvent(\"on\"+t,e[t+n])):e.addEventListener(t,n,!1)}function n(e,t){return e.className.match(RegExp(\"(\\\\s|^)\"+t+\"(\\\\s|$)\"))}function r(e,t){n(e,t)||(e.className+=\" \"+t)}function i(e,t){n(e,t)&&(e.className=e.className.replace(RegExp(\"(\\\\s|^)\"+t+\"(\\\\s|$)\"),\" \"))}var e=\""; string str4 = "\";var s=!!window.ActiveXObject,o=s&&!window.XMLHttpRequest,u=function(e){for(var e=e.split(\",\"),t=e.length,n=[],r=0;r<t;r++){var i=document.getElementById(e[r]);i&&n.push(i)}return n},a=function(e,t){if(document.getElementsByClassName)return(t||document).getElementsByClassName(e);t=t||document,tag=\"*\";for(var n=[],r=tag===\"*\"&&t.all?t.all:t.getElementsByTagName(tag),i=r.length,e=e.replace(/\\-/g,\"\\\\-\"),s=RegExp(\"(^|\\\\s)\"+e+\"(\\\\s|$)\");--i>=0;)s.test(r[i].className)&&n.push(r[i]);return n},l=function(){for(var e=u(\"maticsoftShareBg,maticsoftShareToolBar,maticsoftShareBtn,maticsoftShareContent,maticsoftShareScript,maticsoftShareStyle\"),t=e.length,n=0;n<t;n++){var r=e[n],i=r.parentNode;i&&i.removeChild(r)}};if(u(\"maticsoftShareToolBar\").length!=0||u(\"maticsoftShareBtn\").length!=0)l();else{var c=location.hostname,h=new RegExp(c,\"i\");if(h.test(e))alert(\"您就在本站,不能采集本站的图片\");else{var p=function(){for(var e=[{name:\"duitang\",r:/duitang.com/i},{name:\"meilishuo\",r:/meilishuo.com/i},{name:\"huaban\",r:/huaban.com/i},{name:\"pinterest\",r:/pinterest.com/i}],t=0;t<e.length;t++)if(e[t].r.test(c))return e[t].name;return!1};if(!function(e){var t=/tmall.com/i,n=/auction\\d?.paipai.com/i,r=/buy.caomeipai.com\\/goods/i,i=/www.360buy.com\\/product/i,s=/product.dangdang.com\\/Product.aspx\\?product_id=/i,o=/book.360buy.com/i,u=/www.vancl.com\\/StyleDetail/i,a=/www.vancl.com\\/Product/i,f=/vt.vancl.com\\/item/i,l=/item.vancl.com\\/\\d+/i,c=/mbaobao.com\\/pshow/i,h=/[www|us].topshop.com\\/webapp\\/wcs\\/stores\\/servlet\\/ProductDisplay/i,p=/quwan.com\\/goods/i,d=/nala.com.cn\\/product/i,v=/maymay.cn\\/pitem/i,m=/asos.com/i;return/item(.lp)?.taobao.com\\/(.?)[item.htm|item_num_id|item_detail|itemID|item_id|default_item_id]/i.test(e)||t.test(e)||o.test(e)||i.test(e)||n.test(e)||r.test(e)||s.test(e)||u.test(e)||a.test(e)||f.test(e)||l.test(e)||c.test(e)||h.test(e)||p.test(e)||d.test(e)||v.test(e)||m.test(e)}(location.href)){var d=\"#maticsoftShareBg {background-color:#f2f2f2; height:100%; width:100%; left:0px; top:0px; zoom:1; position:fixed; z-index:100000; opacity:0.8; FILTER:alpha(opacity=80); } #maticsoftShareContent {position:absolute; top:66px; left:0; z-index:100001; } #maticsoftShareContent .mgsFeed {width:200px; height:200px; border-right:1px solid #e7e7e7; border-bottom:1px solid #e7e7e7; float:left; cursor:pointer; text-align:center; background-color:#FFF; overflow:hidden; position:relative; } #maticsoftShareContent .mgsPic {max-height:200px; max-width:200px; } #maticsoftShareContent .mgsSize {position:absolute; bottom:5px; left:0; width:200px; text-align:center; } #maticsoftShareContent .mgsSize span {display:inline-block; background-color:#FFF; border-radius:4px; padding:0 2px; } #maticsoftShareContent .mgsSelect {position:absolute; right:12px; bottom:10px; width:28px; height:28px; background:url(\"+e+\"/images/select.png) 0 0 no-repeat; } #maticsoftShareContent .selected {background-position:0 -50px;} #maticsoftShareToolBar {position:fixed; top:0; left:0; z-index:100002; height:75px; width:100%; overflow:hidden; background:url(\"+e+\"/images/mgs_bar_bg.png) top repeat-x; } #maticsoftShareToolBar .maticsoftShadow {position:absolute; width:100%; height:9px; overflow:hidden; top:65px; left:0; background:url(\"+e+\"/images/mgs_bar_bg_sd.png) repeat-x; } #maticsoftShareToolBar .maticsoftLogo {position:absolute; right:25px; top:15px; } #maticsoftShareToolBar .maticsoftPub {position:absolute; left:25px; top:8px; width:156px; height:49px; background:url(\"+e+\"/images/publish.gif) no-repeat; } #maticsoftShareToolBar .maticsoftPub {position:absolute; left:190px; top:8px; width:156px; height:49px; background:url(\"+e+\"/images/publish.gif) no-repeat; } #maticsoftShareToolBar .maticsoftCancel {position:absolute; right:25px; top:16px; width:69px; height:31px; background:url(\"+e+\"/images/cancel.png) no-repeat; }#maticsoftShareToolBar .maticsoftNotice{position: absolute;font-size:14px;top:23px;left:360px;color:#555}\",v='body{background-attachment:fixed; background-image:url(\"about:blank\");}#maticsoftShareBg {background-color:#f2f2f2; height:expression(document.body.clientHeight); width:100%; left:0px; zoom:1; z-index:100000; FILTER:alpha(opacity=80); position:absolute; top:expression(document.compatMode && document.compatMode==\"CSS1Compat\" ? documentElement.scrollTop:document.body.scrollTop ); } #maticsoftShareContent {position:absolute; top:66px; left:0; z-index:100001; } #maticsoftShareContent .mgsFeed {width:200px; height:200px; border-right:1px solid #e7e7e7; border-bottom:1px solid #e7e7e7; float:left; cursor:pointer; text-align:center; background-color:#FFF; overflow:hidden; position:relative; } #maticsoftShareContent .mgsPic {max-height:200px; max-width:200px; } #maticsoftShareContent .mgsSize {position:absolute; bottom:5px; left:0; width:200px; text-align:center; } #maticsoftShareContent .mgsSize span {display:inline-block; background-color:#FFF; border-radius:4px; padding:0 2px; } #maticsoftShareContent .mgsSelect {position:absolute; right:12px; bottom:10px; width:28px; height:28px; background:url('+e+'/images/select.png) 0 0 no-repeat; } #maticsoftShareContent .selected {background-position:0 -50px;} #maticsoftShareToolBar {position:absolute; top:expression(document.compatMode && document.compatMode==\"CSS1Compat\" ? documentElement.scrollTop:document.body.scrollTop ); left:0; z-index:100002; height:75px; width:100%; overflow:hidden; background:url('+e+'/images/mgs_bar_bg.png) top repeat-x; } #maticsoftShareToolBar .maticsoftShadow {position:absolute; width:100%; height:9px; overflow:hidden; top:65px; left:0; FILTER:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\"'+e+'/images/mgs_bar_bg_sd.png\",sizingMethod=\"scale\"); background-image:none } #maticsoftShareToolBar .maticsoftLogo {position:absolute; right:25px; top:15px; } #maticsoftShareToolBar .maticsoftPub {position:absolute; left:25px; top:8px; width:156px; height:49px; background:url('+e+\"/images/publish.gif) no-repeat; } #maticsoftShareToolBar .maticsoftPub {position:absolute; left:190px; top:8px; width:156px; height:49px; background:url(\"+e+\"/images/publish.gif) no-repeat; } #maticsoftShareToolBar .maticsoftCancel {position:absolute; right:25px; top:16px; width:69px; height:31px; background:url(\"+e+\"/images/cancel.png) no-repeat; }#maticsoftShareToolBar .maticsoftNotice{position: absolute;font-size:14px;top:23px;left:360px;color:#555}\",m='<div class=\"mgsFeed\"><img class=\"mgsPic\" alt=\"{alt}\" style=\"{style}\" src=\"{picUrl}\" osrc=\"{opicUrl}\" ><div class=\"mgsSize\"><span>{width}x{height}</span></div><i class=\"mgsSelect\"></i></div>',g=[],b=p();b&&(m='<div class=\"mgsFeed\"><img class=\"mgsPic\" alt=\"{alt}\" style=\"{style}\" src=\"{picUrl}\" osrc=\"{opicUrl}\"><div class=\"mgsSize\"></div><i class=\"mgsSelect\"></i></div>');for(var p=function(e){var t=new Image;t.src=e.src;var n=t.height,r=t.width,i=t.src,t=t.src,e=e.alt;if(b){var s=t=i;switch(b){case\"duitang\":s=/\\.thumb.200_0\\./,s=t.replace(s,\".\");break;case\"meilishuo\":s=/\\/pic\\/r\\//,s=t.replace(s,\"/pic/_o/\");break;case\"huaban\":s=/_fw192|_fw554/,s=t.replace(s,\"\");break;case\"pinterest\":s=/_b\\.|_c\\./,s=t.replace(s,\".\")}t=s,b==\"huaban\"&&(i=t)}return{w:r,h:n,src:i,osrc:t,alt:e}},w=function(e){var t=\"\";return o&&(t+=\"width:\"+e.w+\"px;height:\"+e.h+\"px;\"),Math.max(e.h,e.w)>199?e.h<e.w&&(t+=\"margin-top: \"+parseInt(100-100*(e.h/e.w))+\"px;\"):t+=\"margin-top: \"+parseInt(100-e.h/2)+\"px;\",t},E=0;E<document.images.length;E++){var S=document.images[E],S=p(S);S.w>80&&S.h>80&&(S.h>109||S.w>109)&&(S=m.replace(/{style}/,w(S)).replace(/{picUrl}/,S.src).replace(/{opicUrl}/,S.osrc).replace(/{width}/,S.w).replace(/{height}/,S.h).replace(/{alt}/,S.alt),g.push(S))}m='<div id=\"maticsoftShareBg\"></div><div id=\"maticsoftShareToolBar\"><a class=\"maticsoftPub\" href=\"javascript:;\"></a><a class=\"maticsoftCancel\" href=\"javascript:;\"></a><span class=\"maticsoftNotice\"><span class=\"maticsoftNoticeText\" >请选择要发表的图片(可多选)</span><b style=\"margin:0 5px;\" ><input id=\"select_all\" type=\"checkbox\" />全选</b></span><div class=\"maticsoftShadow\"></div></div>'+'<div id=\"maticsoftShareContent\">{content}</div>'.replace(/{content}/,g.join(\"\")),g=document.createElement(\"div\"),g.innerHTML=m,document.body.appendChild(g),s?(f=document.createElement(\"style\"),f.type=\"text/css\",f.media=\"screen\",f.id=\"maticsoftShareStyle\",f.styleSheet.cssText=o?v:d,document.getElementsByTagName(\"head\")[0].appendChild(f)):(f=document.createElement(\"style\"),f.id=\"maticsoftShareStyle\",f.innerHTML=d,document.body.appendChild(f)),window.scrollTo(0,0),s=a(\"maticsoftCancel\",u(\"maticsoftShareToolBar\")[0],\"a\"),t(s[0],\"click\",function(){l()});for(var x=a(\"mgsFeed\",u(\"maticsoftShareContent\")[0]),T=x.length,E=0;E<T;E++)t(x[E],\"click\",function(){if(n(this,\"checked\")){var e=a(\"mgsSelect\",this);i(e[0],\"selected\"),i(this,\"checked\")}else r(this,\"checked\"),e=a(\"mgsSelect\",this),r(e[0],\"selected\");N()});var N=function(){var e=a(\"checked\",u(\"maticsoftShareContent\")[0]).length;a(\"maticsoftNoticeText\",u(\"maticsoftShareToolBar\")[0])[0].innerHTML=e==0?\"请选择要发表的图片(可多选)\":'已选择<em style=\"color:#690;font-weight: bold;padding:0 2px;\">'+e+\"</em>张图片\"};t(u(\"select_all\")[0],\"click\",function(){if(this.checked)for(e=0;e<T;e++)r(x[e],\"checked\"),t=a(\"mgsSelect\",x[e]),r(t[0],\"selected\");else for(var e=0;e<T;e++){var t=a(\"mgsSelect\",x[e]);i(t[0],\"selected\"),i(x[e],\"checked\")}N()});var s=a(\"maticsoftPub\",u(\"maticsoftShareToolBar\")[0]),C=function(e){var t=[];t.push(e),t.push(\"?\");var e=a(\"checked\",u(\"maticsoftShareContent\")[0]),n=e.length;if(n<1)alert(\"请选择至少一张图片。\");else if(n>10)alert(\"一次最多只能分享10张\");else{for(var r=0;r<n;r++){var i=a(\"mgsPic\",e[r]),s=i[0].getAttribute(\"osrc\"),i=i[0].alt;t.push(\"pics[]=\"+encodeURIComponent(s)+\"----\"+i+\"&\")}t.push(\"type=img\"),window.open(t.join(\"\"),\"maticsoftShare\"+(new Date).getTime(),\"status=no,resizable=no,scrollbars=yes,personalbar=no,directories=no,location=no,toolbar=no,menubar=no,left=0,top=0\"),l()}};t(s[0],\"click\",function(){C(e+\"/home/ShareImage/\")}),t(d[0],\"click\",function(){C(e+\"/home/ShareImage/\")})}else{var d=\"#maticsoftShareBg {background-color:#f2f2f2; height:100%; width:100%; left:0px; top:0px; zoom:1; position:fixed; z-index:100000; opacity:0.8; FILTER:alpha(opacity=80); } #maticsoftShareBtn{position:absolute;top:50%;left:50%;width:480px;height:160px;margin:-80px 0 0 -240px;z-index: 100001;background:url(\"+e+\"/images/publish.gif) no-repeat;} #maticsoftShareBtn .maticsoftPub{height:37px;width:144px;position:absolute;left:80px;top:79px;display:block;} #maticsoftShareBtn .maticsoftPub{height:37px;width:144px;position:absolute;left:255px;top:79px;display:block;} #maticsoftShareBtn .maticsoftCancel{height:38px;width:80px;position:absolute;top:0;right:0;}\",v='body{background-attachment:fixed; background-image:url(\"about:blank\");}#maticsoftShareBg {background-color:#f2f2f2; height:expression(document.body.clientHeight); width:100%; left:0px; zoom:1; z-index:100000; FILTER:alpha(opacity=80); position:absolute; top:expression(document.compatMode && document.compatMode==\"CSS1Compat\" ? documentElement.scrollTop:document.body.scrollTop ); } #maticsoftShareBtn{position:absolute;top:50%;left:50%;width:480px;height:160px;margin:-80px 0 0 -240px;z-index: 100001; background:url('+e+\"/images/publish.gif) no-repeat;} #maticsoftShareBtn .maticsoftPub{height:37px;width:144px;position:absolute;left:80px;top:79px;display:block;} #maticsoftShareBtn .maticsoftPub{height:37px;width:144px;position:absolute;left:255px;top:79px;display:block;} #maticsoftShareBtn .maticsoftCancel{height:38px;width:80px;position:absolute;top:0;right:0;}\",m='<div id=\"maticsoftShareBg\"></div><div id=\"maticsoftShareBtn\"><a class=\"maticsoftPub\" href=\"javascript:;\"></a><a class=\"maticsoftPub\" href=\"javascript:;\"></a><a class=\"maticsoftCancel\" href=\"javascript:;\"></a></div>',g=document.createElement(\"div\");g.innerHTML=m,document.body.appendChild(g),s?(f=document.createElement(\"style\"),f.type=\"text/css\",f.media=\"screen\",f.id=\"maticsoftShareStyle\",f.styleSheet.cssText=o?v:d,document.getElementsByTagName(\"head\")[0].appendChild(f)):(f=document.createElement(\"style\"),f.id=\"maticsoftShareStyle\",f.innerHTML=d,document.body.appendChild(f)),window.scrollTo(0,0);var s=a(\"maticsoftPub\",u(\"maticsoftShareToolBar\")[0]),y=function(e){var t=[];return t.push(e),t.push(\"?\"),t.push(\"type=goods&\"),t.push(\"goods=\"+encodeURIComponent(location.href)),t.join(\"\")};s=a(\"maticsoftCancel\",u(\"maticsoftShareToolBar\")[0],\"a\"),t(s[0],\"click\",function(){l()})}}}})();"; try { str = str3 + "http://" + Globals.DomainFullName + str4; FileInfo info = new FileInfo(HttpContext.Current.Server.MapPath(path)); if (!info.Directory.Exists) { info.Directory.Create(); } writer = new StreamWriter(HttpContext.Current.Server.MapPath(path), false, encoding); writer.Write(str); writer.Flush(); return true; } catch (Exception exception) { Maticsoft.Model.SysManage.ErrorLog model = new Maticsoft.Model.SysManage.ErrorLog { OPTime = DateTime.Now, Loginfo = "请求路径为【" + path + "】的静态化写入失败", Url = "http://" + Globals.DomainFullName + path, StackTrace = exception.StackTrace }; Maticsoft.BLL.SysManage.ErrorLog.Add(model); } finally { writer.Close(); } return false; }
public static bool HttpToStatic(string VirtualRequestUrl, string SaveVirtualPath) { bool flag; Encoding encoding = Encoding.GetEncoding("utf-8"); StreamReader reader = null; StreamWriter writer = null; string str = null; string applicationPath = HttpContext.Current.Request.ApplicationPath; if (applicationPath == "/") { applicationPath = ""; } string requestUriString = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + applicationPath + VirtualRequestUrl; if (VirtualRequestUrl.Contains("http://")) { requestUriString = VirtualRequestUrl; } try { reader = new StreamReader(WebRequest.Create(requestUriString).GetResponse().GetResponseStream(), encoding); str = reader.ReadToEnd(); } catch (Exception exception) { Maticsoft.Model.SysManage.ErrorLog model = new Maticsoft.Model.SysManage.ErrorLog { OPTime = DateTime.Now, Loginfo = "请求路径为【" + VirtualRequestUrl + "】的文章静态化读取失败", Url = "http://" + Globals.DomainFullName + VirtualRequestUrl, StackTrace = exception.Message }; Maticsoft.BLL.SysManage.ErrorLog.Add(model); return false; } finally { reader.Close(); } try { FileInfo info = new FileInfo(HttpContext.Current.Server.MapPath(SaveVirtualPath)); if (!info.Directory.Exists) { info.Directory.Create(); } writer = new StreamWriter(HttpContext.Current.Server.MapPath(SaveVirtualPath), false, encoding); writer.Write(str); writer.Flush(); flag = true; } catch (Exception exception2) { Maticsoft.Model.SysManage.ErrorLog log2 = new Maticsoft.Model.SysManage.ErrorLog { OPTime = DateTime.Now, Loginfo = "请求路径为【" + VirtualRequestUrl + "】的文章静态化写入失败", Url = "http://" + Globals.DomainFullName + VirtualRequestUrl, StackTrace = exception2.Message }; Maticsoft.BLL.SysManage.ErrorLog.Add(log2); flag = false; } finally { writer.Close(); } return flag; }
public void HtmlJSRedirect(string Filename, string RedirectUrl) { string str = "<script language=javascript>this.location = '" + RedirectUrl + "';</script>"; if (System.IO.File.Exists(HttpContext.Current.Server.MapPath(Filename))) { Encoding encoding = Encoding.GetEncoding("utf-8"); try { StreamReader reader = new StreamReader(HttpContext.Current.Server.MapPath(Filename)); str = str + reader.ReadToEnd(); reader.Close(); } catch (Exception exception) { Maticsoft.Model.SysManage.ErrorLog model = new Maticsoft.Model.SysManage.ErrorLog { OPTime = DateTime.Now, Loginfo = "读取文件【" + Filename + "】失败", Url = "", StackTrace = exception.Message }; Maticsoft.BLL.SysManage.ErrorLog.Add(model); throw exception; } System.IO.File.Delete(HttpContext.Current.Server.MapPath(Filename)); try { FileInfo info = new FileInfo(HttpContext.Current.Server.MapPath(Filename)); if (!info.Directory.Exists) { info.Directory.Create(); } StreamWriter writer = new StreamWriter(HttpContext.Current.Server.MapPath(Filename), false, encoding); writer.Write(str); writer.Flush(); } catch (Exception exception2) { Maticsoft.Model.SysManage.ErrorLog log2 = new Maticsoft.Model.SysManage.ErrorLog { OPTime = DateTime.Now, Loginfo = "写入文件【" + Filename + "】失败", Url = "", StackTrace = exception2.Message }; Maticsoft.BLL.SysManage.ErrorLog.Add(log2); throw exception2; } } }
protected void BindPrivoces() { try { DataSet privoces = this.bll.GetPrivoces(); this.ddlProvince.DataSource = privoces; this.ddlProvince.DataTextField = "RegionName"; this.ddlProvince.DataValueField = "RegionId"; this.ddlProvince.DataBind(); if (this._visibleall) { this.ddlProvince.Items.Insert(0, new ListItem(this._visiblealltext, "0")); this.ddlProvince.SelectedValue = "0"; } } catch (Exception exception) { Maticsoft.Model.SysManage.ErrorLog model = new Maticsoft.Model.SysManage.ErrorLog { Loginfo = exception.Message, StackTrace = exception.StackTrace, Url = base.Request.Url.AbsoluteUri }; Maticsoft.BLL.SysManage.ErrorLog.Add(model); } }
public bool SendRegisterEmail(string username, string EmailUrl) { string str = Guid.NewGuid().ToString().Replace("-", ""); Maticsoft.BLL.SysManage.VerifyMail mail = new Maticsoft.BLL.SysManage.VerifyMail(); Maticsoft.Model.SysManage.VerifyMail model = new Maticsoft.Model.SysManage.VerifyMail { UserName = username, KeyValue = str, CreatedDate = DateTime.Now, Status = 0, ValidityType = 0 }; mail.Add(model); int templetId = Globals.SafeInt(ConfigSystem.GetValueByCache("EmailTemplet_Register"), 0); Maticsoft.Model.Ms.EmailTemplet modelByCache = this.GetModelByCache(templetId); if (modelByCache != null) { string body = this.ReplaceTag(modelByCache.EmailBody, new string[][] { new string[] { "{Domain}", HttpContext.Current.Request.Url.Authority }, new string[] { "{CreatedDate}", DateTime.Now.ToString("yyyy-MM-dd") }, new string[] { "{SecretKey}", str }, new string[] { "{UserName}", username } }); try { Maticsoft.Model.MailConfig config = this.config.GetModel(); if ((model != null) && !string.IsNullOrWhiteSpace(config.Mailaddress)) { MailSender.Send(config.SMTPServer, config.Username, DESEncrypt.Decrypt(config.Password), config.Mailaddress, EmailUrl, "", "", modelByCache.EmailSubject, body, true, Encoding.UTF8, true, config.SMTPSSL, null); return true; } return true; } catch (Exception exception) { Maticsoft.Model.SysManage.ErrorLog log = new Maticsoft.Model.SysManage.ErrorLog { Loginfo = "邮件发送失败!错误信息为:" + exception.StackTrace, OPTime = DateTime.Now, Url = "", StackTrace = exception.StackTrace }; Maticsoft.BLL.SysManage.ErrorLog.Add(log); return false; } } return false; }