public static SourceContainsTarget ( |
||
sourceUrl | The source URL. | |
targetUrl | The target URL. | |
Résultat | bool |
private bool IsSourceVerification(Uri sourceUrl, Uri entryUrl) { EventHandler <SourceVerificationEventArgs> handler = SourceVerification; if (handler != null) { var args = new SourceVerificationEventArgs(sourceUrl, entryUrl); handler(this, args); return(args.Verified); } return(Verifier.SourceContainsTarget(sourceUrl, entryUrl)); }
public string pingBack(string sourceURI, string targetURI) { if (!Blog.TrackbacksEnabled) { return("Pingbacks are not enabled for this site."); } string pageTitle; // GetPostIDFromUrl returns the postID int?id = SubtextContext.RequestContext.GetIdFromRequest(); if (id == null) { throw new XmlRpcFaultException(33, Resources.XmlRcpFault_DidNotLinkToPermalink); } Uri sourceUrl = sourceURI.ParseUri(); Uri targetUrl = targetURI.ParseUri(); // does the sourceURI actually contain the permalink ? if (sourceUrl == null || targetUrl == null || !Verifier.SourceContainsTarget(sourceUrl, targetUrl, out pageTitle)) { throw new XmlRpcFaultException(17, Resources.XmlRcpFault_InvalidLink); } //PTR = Pingback - TrackBack - Referral var trackback = new Trackback(id.Value, HtmlHelper.SafeFormat(pageTitle, SubtextContext.HttpContext.Server), new Uri(sourceURI), string.Empty, HtmlHelper.SafeFormat(pageTitle, SubtextContext.HttpContext.Server), Blog.TimeZone.Now); ICommentSpamService feedbackService = null; if (Blog.FeedbackSpamServiceEnabled) { feedbackService = new AkismetSpamService(Blog.FeedbackSpamServiceKey, Blog, null, Url); } var commentService = new CommentService(SubtextContext, new CommentFilter(SubtextContext, feedbackService)); commentService.Create(trackback, true /*runFilters*/); //TODO: Create this using IoC container var emailService = new EmailService(EmailProvider.Instance(), new EmbeddedTemplateEngine(), SubtextContext); emailService.EmailCommentToBlogAuthor(trackback); return(String.Format(CultureInfo.InvariantCulture, Resources.XmlRpcMessage_ThanksForThePingback, sourceURI)); }