public override async Task Execute() { await PingHelper.NotifySites(); IEnumerable <Uri> urlsFromContent = GetUrlsFromContent(this.item.Content); foreach (Uri uri in urlsFromContent) { bool trackbackSent = false; if (this.configuration.Tracking.EnableTrackBackSend) { trackbackSent = await TrackbackHelper.Notify(this.item, uri); } if (!trackbackSent && this.configuration.Tracking.EnablePingBackSend) { await PingbackHelper.Notify(this.item, uri); } } }
protected override void RenderContents(HtmlTextWriter output) { string sTrackback = ControlUtilities.GetManifestResourceStream("Carrotware.CMS.UI.Controls.Trackback.txt"); ContentPage cp = cu.GetContainerContentPage(this); if (cp != null) { sTrackback = sTrackback.Replace("{URL}", SiteData.CurrentSite.ConstructedCanonicalURL(cp)); sTrackback = sTrackback.Replace("{TB_TITLE}", cp.NavMenuText); sTrackback = sTrackback.Replace("{TB_URL_ID}", SiteData.CurrentSite.ConstructedCanonicalURL(TrackBackURI) + "?id=" + HttpUtility.UrlEncode(cp.FileName)); output.Write(sTrackback); } if (IsPostBack && EnableDirectTrackback) { TrackbackHelper tbh = new TrackbackHelper(); tbh.ProcessTrackback(HttpContext.Current, false); } }
public static string AddStory(int hostID, string title, string description, string url, short categoryID, User user, string ipAddress) { if (user.IsBanned) { return(GetStoryIdentifier(title)); //to stop the spammers } //TODO: improve the validation string storyIdentifier = GetStoryIdentifier(title); if (description.Length > 2500) { description = description.Substring(0, 2500); } url = url.Trim(); if (url.Length > 980) { throw new Exception("The url is too long"); } title = HttpUtility.HtmlEncode(title); description = HttpUtility.HtmlEncode(description); Story story = new Story(); story.HostID = hostID; story.StoryIdentifier = storyIdentifier; story.Title = title; story.Description = description; story.Url = url; story.CategoryID = categoryID; story.UserID = user.UserID; story.KickCount = 0; story.SpamCount = 0; story.ViewCount = 0; story.CommentCount = 0; story.IsPublishedToHomepage = false; story.IsSpam = false; story.AdsenseID = user.AdsenseID; story.IPAddress = ipAddress; story.PublishedOn = DateTime.Now; story.UpdatedOn = DateTime.Now; story.Save(); UserAction.RecordStorySubmission(hostID, user, story); UserCache.KickStory(story.StoryID, user.UserID, hostID, ipAddress); TagBR.AddUserStoryTags(CategoryCache.GetCategory(categoryID, hostID).TagIdentifier, user, story.StoryID, hostID); System.Diagnostics.Trace.WriteLine("AddStory: " + title); //now send a trackback ping Host host = HostCache.GetHost(hostID); string storyUrl = host.RootUrl + "/" + CategoryCache.GetCategory(categoryID, hostID).CategoryIdentifier + "/" + story.StoryIdentifier; TrackbackHelper.SendTrackbackPing_Begin(url, title, storyUrl, "You've been kicked (a good thing) - Trackback from " + host.SiteTitle, host.SiteTitle); return(story.StoryIdentifier); }