public object ResolveEntityPropertyValue(string rawValue, Type propertyType) { if (String.IsNullOrEmpty(rawValue)) { return(null); } try { if (rawValue.IsGuid()) { Guid linkId = new Guid(rawValue); Item item = Context.Database.GetItem(new ID(linkId)); return(new Link { Id = linkId, LinkType = LinkTypes.Internal, Caption = item.Name, Url = item.GetItemUrl() }); } else { XDocument xmlField = XDocument.Parse(rawValue); XElement linkElement = xmlField.Element("link"); return(LinkUrl.GetUrl(linkElement, Context.Database)); } } catch (Exception) { // not xml or guid return(null); } }
public static string LinkFieldUrl(this Item item, ID fieldId) { var field = item?.Fields?[fieldId]; if (field == null) { return(string.Empty); } var linkUrl = new LinkUrl(); return(linkUrl.GetUrl(item, fieldId.ToString())); }
/// <summary> /// AppStore跳转地址编码 /// </summary> public void AppStoreUrlEncode() { if (LinkType == 1) { string appid = net91com.Core.Util.CryptoHelper.DES_Encrypt(SoftID.ToString(), "91appuse"); string appStoreUrl = System.Web.HttpUtility.UrlEncode(LinkUrl.Trim()); string channel = net91com.Stat.Core.UtilHelper.EncryptDES(Channel, "5a@4a$0e", "e2Eb9A82"); LinkUrl = string.Format(@"http://funcstatic.sj.91.com/link.ashx?id={0}&mt={1}&v={2}&chl={3}&url={4}", appid, Platform, AppVersion.Trim(), channel, appStoreUrl); } if (ID == 0 && string.IsNullOrEmpty(LinkTag)) { LinkTag = net91com.Stat.Core.UtilHelper.ShortUrl(SoftID + "_" + Platform + "_" + DateTime.Now.Ticks)[0]; } }
List <LogAssociation> FindLinkClickAssociations(Session MainLog, List <Session> SessionList, RefererAssociationType RefAssoType) { List <LogAssociation> Associations = new List <LogAssociation>(); if (MainLog.Response == null) { return(Associations); } //Match link urls with absolute match foreach (string LinkUrl in MainLog.Response.Html.GetDecodedValues("a", "href")) { try { Request LinkReq = new Request(LinkUrl.Trim()); foreach (Session Sess in SessionList) { if (!Sess.Request.Method.Equals("GET", StringComparison.OrdinalIgnoreCase)) { continue; } if (Sess.Request.FullUrl.Equals(LinkReq.FullUrl) && Sess.Response != null) { LogAssociation LogAsso = new LogAssociation(LogAssociationType.LinkClick, RefAssoType, IronHtml.UrlInHtmlMatch.FullAbsolute, LogAssociationMatchLevel.UrlMatchOnly, MainLog, Sess); Associations.Add(LogAsso); } } } catch { Request LinkReq = new Request(MainLog.Request.RelativeUrlToAbsoluteUrl(LinkUrl.Trim())); foreach (Session Sess in SessionList) { if (!Sess.Request.Method.Equals("GET", StringComparison.OrdinalIgnoreCase)) { continue; } if (Sess.Request.FullUrl.Equals(LinkReq.FullUrl) && Sess.Response != null) { LogAssociation LogAsso = new LogAssociation(LogAssociationType.LinkClick, RefAssoType, IronHtml.UrlInHtmlMatch.FullRelative, LogAssociationMatchLevel.UrlMatchOnly, MainLog, Sess); Associations.Add(LogAsso); } } } } return(Associations); }
public static string LinkFieldUrl(this Item item, ID fieldID) { if (item == null) { throw new ArgumentNullException(nameof(item)); } if (ID.IsNullOrEmpty(fieldID)) { throw new ArgumentNullException(nameof(fieldID)); } var field = item.Fields[fieldID]; if (field == null) { return string.Empty; } var linkUrl = new LinkUrl(); return linkUrl.GetUrl(item, fieldID.ToString()); }
protected void btnPost_Click(object sender, EventArgs e) { LinkUrl lnk = new LinkUrl(); lnk.Title = txtTitle.Text.Trim(); lnk.Desc = txtDesc.Text.Trim(); lnk.Url = txtLink.Text.Trim(); lnk.CreateTime = DateTime.Now; lnk.CreateUser = Profile.AccountInfo.UserID; bool r = LinkUrls.LinkUrlAdd(lnk); if (r) { base.ExecuteJs("msg('成功新增一条常用链接!',true);", false); } else { base.ExecuteJs("msg('无法新增常用链接,请联系管理员!');", false); } }
public static string LinkFieldUrl(this Item item, ID fieldID) { if (item == null) { throw new ArgumentNullException(nameof(item)); } if (ID.IsNullOrEmpty(fieldID)) { throw new ArgumentNullException(nameof(fieldID)); } var field = item.Fields[fieldID]; if (field == null) { return(string.Empty); } var linkUrl = new LinkUrl(); return(linkUrl.GetUrl(item, fieldID.ToString())); }
public async Task MakeTestAsync(string host) { List <string> urlAddresses = new LinkUrl(host).GetURLAddresses(); if (urlAddresses == null) { throw new ValidationException("Don't have any URL", ""); } ProgressHub.SendMessage("determining sitemap", 5); List <Task> tasks = new List <Task>(); percent = 500; int execPer = 8500 / urlAddresses.Count; foreach (var url in urlAddresses) { tasks.Add(MakeOnePageAsync(url, execPer)); } await Task.WhenAll(tasks); ProgressHub.SendMessage("evaluating the time server response", 90); Test test = new Test() { Host = Database.Hosts.GetAll() .Where(h => h.HostURL == host).FirstOrDefault() ?? new Host() { HostURL = host }, TestDate = DateTime.Now, Pages = pages }; Database.Tests.Create(test); Database.Save(); ProgressHub.SendMessage("saving test", 95); }
private void SequenceWidget_Click(object sender, MouseEventArgs e) { if (this.LinkUrl != null) { if (LinkUrl.StartsWith("http", StringComparison.OrdinalIgnoreCase)) { ApplicationController.LaunchBrowser(LinkUrl); } else { try { if (aggRenderer.RootWidget.Parents <MarkdownWidget>().FirstOrDefault() is MarkdownWidget markdownWidget) { markdownWidget.LoadUri(new Uri(LinkUrl)); } } catch { } } } }
public static string LinkFieldUrl(this Item item, string fieldName) { var linkUrl = new LinkUrl(); return(linkUrl.GetUrl(item, fieldName)); }
// POST api/Reports public void Post([FromBody] string value) { // Parts received separated by , // PageUrl -- The Url of the page being reported [0] // SrcUrl -- The SrcUrl of any Image being reported [1] // LinkUrl -- The Url of any link that is being reported [2] // SelectionText -- Any Text that is being reported [3..n] try { if (value != null) { // Get the Reported values and Hashes of them string pu = GetPageUrl(value); string pageUrlHash = GetSHA512(pu); string pageUrl = Security.Encrypt(pu, pageUrlHash); string srcUrl = Security.Encrypt(GetSrcUrl(value), pageUrlHash); //string pageUrl = pu; //string srcUrl = GetSrcUrl(value); string srcUrlHash = null; if (!string.IsNullOrEmpty(srcUrl)) { srcUrlHash = GetSHA512(srcUrl); } string lulu = GetLinkUrl(value); string linkUrlHash = null; if (!string.IsNullOrEmpty(lulu)) { linkUrlHash = GetSHA512(lulu); } string linkUrl = Security.Encrypt(lulu, linkUrlHash); //string linkUrl = lulu; string stst = GetSelectionText(value); string selectionTextHash = null; if (!string.IsNullOrEmpty(stst)) { selectionTextHash = GetSHA512(stst); } string selectionText = Security.Encrypt(stst, selectionTextHash); //string selectionText = stst; ReportItEntities rie = new ReportItEntities(); rie.Database.Connection.Open(); // Connect to the Database // Generate our tables EUReported eur = new EUReported(); SrcUrl su = new SrcUrl(); ReportedSrcUrl rsu = new ReportedSrcUrl(); LinkUrl lu = new LinkUrl(); ReportedLinkUrl rlu = new ReportedLinkUrl(); SelectionText st = new SelectionText(); ReportedSelectedText rst = new ReportedSelectedText(); if (!string.IsNullOrEmpty(pageUrl)) { GenerateReportedSrcsTables(pageUrl, pageUrlHash, srcUrl, srcUrlHash, rie, su, rsu); GenerateReportedLinksTables(pageUrl, pageUrlHash, linkUrl, linkUrlHash, rie, lu, rlu); GenerateReportedSelectedTextTables(pageUrl, pageUrlHash, selectionText, selectionTextHash, rie, st, rst); } else { //Just drop out the bottom -no PageUrl == nothing to process } rie.Database.Connection.Close(); } // return "Nothing received"; } catch (Exception) { // return ex.InnerException.ToString(); } }
private void GenerateReportedLinksTables(string pageUrl, string pageUrlHash, string linkUrl, string linkUrlHash, ReportItEntities rie, LinkUrl lu, ReportedLinkUrl rlu) { if (!string.IsNullOrEmpty(linkUrl)) { // Does the pageUrl exist? // Does the srcUrl exist? // Do they both exist in the ReportedSrcUrls table? They should be it is nice to have a sanity check EUReported puRecord = GetPageUrlRecord(rie, pageUrlHash); if (puRecord == null) { // The page record has never been created // Create Page Record puRecord = new EUReported(); puRecord.Count = 1; puRecord.PageUrl = pageUrl; puRecord.PageUrlHash = pageUrlHash; puRecord.Processed = false; puRecord.CreatedOn = DateTime.UtcNow; puRecord.UpdatedOn = DateTime.UtcNow; rie.EUReporteds.Add(puRecord); } else { // The page record has been created - update count puRecord.Count = puRecord.Count + 1; puRecord.UpdatedOn = DateTime.UtcNow; } // Ok now check to see if the SrcUrl exists lu = GetLinkUrlRecord(rie, linkUrlHash); if (lu == null) { // The SrcUrl record has never been created // Create SrcUrl record lu = new LinkUrl(); lu.Count = 1; lu.Processed = false; lu.LinkUrl1 = linkUrl; lu.LinkUrlHash = linkUrlHash; lu.CreatedOn = DateTime.UtcNow; lu.UpdatedOn = DateTime.UtcNow; rie.LinkUrls.Add(lu); } else { // The srcUrl record has been created - update count lu.Count = lu.Count + 1; lu.UpdatedOn = DateTime.UtcNow; } // Ok Now the Sanity Check to make sure that the Many to Many table is correctly populated if (!ReportedLinkUrlsExists(rie, pageUrlHash, linkUrlHash)) { rlu.PageUrlHash = pageUrlHash; rlu.LinkUrlHash = linkUrlHash; rie.ReportedLinkUrls.Add(rlu); } rie.SaveChanges(); } }
public string GenerateQuery() { var query = $@" IF(NOT EXISTS(SELECT TOP (1) 1 from [dbo].[GenericAnnouncements] where ExternalId={ID.Safe()} )) BEGIN INSERT INTO [dbo].[GenericAnnouncements] ([Id] ,[ExternalId] ,[HostSite] ,[Title] ,[Description] ,[Owner] ,[Images] ,[ThumbImages] ,[SmallImages] ,[LargeUrls] ,[Price] ,[First_Publication_Date] ,[Expiration_Date] ,[Category_Id] ,[Category_Name] ,[LinkUrl] ,[Extra] ,[LinkText] ,[City] ,[Latitude] ,[Langitude] ,[Region] ,[SourceType]) VALUES (NEWID() ,{ID.Safe()} ,{HostSite.Safe()} ,{Title.Safe()} ,{Description.Safe()} ,{Owner.Safe()} ,{Images.Safe()} ,{ThumbImages.Safe()} ,{SmallImages.Safe()} ,{LargeUrls.Safe()} ,{Price.Safe()} ,{first_publication_date.Safe()} ,{expiration_date.Safe()} ,{category_id.Safe()} ,{category_name.Safe()} ,{LinkUrl.Safe()} ,{Extra.Safe()} ,{LinkText.Safe()} ,{City.Safe()} ,{Latitude.Safe()} ,{Langitude.Safe()} ,{Region.Safe()} ,0) END; ELSE BEGIN UPDATE [dbo].[GenericAnnouncements] SET [HostSite] = {HostSite.Safe()} ,[Title] = {Title.Safe()} ,[Description] = {Description.Safe()} ,[Owner] = {Owner.Safe()} ,[Images] = {Images.Safe()} ,[ThumbImages] = {ThumbImages.Safe()} ,[SmallImages] = {SmallImages.Safe()} ,[LargeUrls] = {LargeUrls.Safe()} ,[Price] = {Price.Safe()} ,[First_Publication_Date] = {first_publication_date.Safe()} ,[Expiration_Date] = {expiration_date.Safe()} ,[Category_Id] = {category_id.Safe()} ,[Category_Name] = {category_name.Safe()} ,[LinkUrl] = {LinkUrl.Safe()} ,[Extra] = {Extra.Safe()} ,[LinkText] = {LinkText.Safe()} ,[City] = {City.Safe()} ,[Latitude] = {Latitude.Safe()} ,[Langitude] = {Langitude.Safe()} ,[Region] = {Region.Safe()} --,[SourceType] = <SourceType, int,> WHERE ExternalId={ID.Safe()} END; "; return(query); }
public static string LinkFieldUrl(this Item item, string fieldName) { var linkUrl = new LinkUrl(); return linkUrl.GetUrl(item, fieldName); }
public void Post([FromBody]string value) { // Parts received separated by , // PageUrl -- The Url of the page being reported [0] // SrcUrl -- The SrcUrl of any Image being reported [1] // LinkUrl -- The Url of any link that is being reported [2] // SelectionText -- Any Text that is being reported [3..n] try { if (value != null) { // Get the Reported values and Hashes of them string pu = GetPageUrl(value); string pageUrlHash = GetSHA512(pu); string pageUrl = Security.Encrypt(pu, pageUrlHash); string srcUrl = Security.Encrypt(GetSrcUrl(value), pageUrlHash); //string pageUrl = pu; //string srcUrl = GetSrcUrl(value); string srcUrlHash = null; if (!string.IsNullOrEmpty(srcUrl)) srcUrlHash = GetSHA512(srcUrl); string lulu = GetLinkUrl(value); string linkUrlHash = null; if (!string.IsNullOrEmpty(lulu)) linkUrlHash = GetSHA512(lulu); string linkUrl = Security.Encrypt(lulu, linkUrlHash); //string linkUrl = lulu; string stst = GetSelectionText(value); string selectionTextHash = null; if (!string.IsNullOrEmpty(stst)) selectionTextHash = GetSHA512(stst); string selectionText = Security.Encrypt(stst, selectionTextHash); //string selectionText = stst; ReportItEntities rie = new ReportItEntities(); rie.Database.Connection.Open(); // Connect to the Database // Generate our tables EUReported eur = new EUReported(); SrcUrl su = new SrcUrl(); ReportedSrcUrl rsu = new ReportedSrcUrl(); LinkUrl lu = new LinkUrl(); ReportedLinkUrl rlu = new ReportedLinkUrl(); SelectionText st = new SelectionText(); ReportedSelectedText rst = new ReportedSelectedText(); if (!string.IsNullOrEmpty(pageUrl)) { GenerateReportedSrcsTables(pageUrl, pageUrlHash, srcUrl, srcUrlHash, rie, su, rsu); GenerateReportedLinksTables(pageUrl, pageUrlHash, linkUrl, linkUrlHash, rie, lu, rlu); GenerateReportedSelectedTextTables(pageUrl, pageUrlHash, selectionText, selectionTextHash, rie, st, rst); } else { //Just drop out the bottom -no PageUrl == nothing to process } rie.Database.Connection.Close(); } // return "Nothing received"; } catch (Exception) { // return ex.InnerException.ToString(); } }
public abstract bool LinkUrlAdd(LinkUrl lnk);
private void GenerateReportedLinksTables(string pageUrl, string pageUrlHash, string linkUrl, string linkUrlHash, ReportItEntities rie, LinkUrl lu, ReportedLinkUrl rlu) { if (!string.IsNullOrEmpty(linkUrl)) { // Does the pageUrl exist? // Does the srcUrl exist? // Do they both exist in the ReportedSrcUrls table? They should be it is nice to have a sanity check EUReported puRecord = GetPageUrlRecord(rie, pageUrlHash); if (puRecord == null) { // The page record has never been created // Create Page Record puRecord = new EUReported(); puRecord.Count = 1; puRecord.PageUrl = pageUrl; puRecord.PageUrlHash = pageUrlHash; puRecord.Processed = false; puRecord.CreatedOn = DateTime.UtcNow; puRecord.UpdatedOn = DateTime.UtcNow; rie.EUReporteds.Add(puRecord); } else { // The page record has been created - update count puRecord.Count = puRecord.Count + 1; puRecord.UpdatedOn = DateTime.UtcNow; } // Ok now check to see if the SrcUrl exists lu = GetLinkUrlRecord(rie, linkUrlHash); if (lu == null) { // The SrcUrl record has never been created // Create SrcUrl record lu = new LinkUrl(); lu.Count = 1; lu.Processed = false; lu.LinkUrl1 = linkUrl; lu.LinkUrlHash = linkUrlHash; lu.CreatedOn = DateTime.UtcNow; lu.UpdatedOn = DateTime.UtcNow; rie.LinkUrls.Add(lu); } else { // The srcUrl record has been created - update count lu.Count = lu.Count + 1; lu.UpdatedOn = DateTime.UtcNow; } // Ok Now the Sanity Check to make sure that the Many to Many table is correctly populated if (!ReportedLinkUrlsExists(rie, pageUrlHash, linkUrlHash)) { rlu.PageUrlHash = pageUrlHash; rlu.LinkUrlHash = linkUrlHash; rie.ReportedLinkUrls.Add(rlu); } rie.SaveChanges(); } }
// public MenuItem() { this.url = new LinkUrl(); }