public override void ProcessItemTemplate( newtelligence.DasBlog.Runtime.Entry item, Control ContentPlaceHolder ) { base.ProcessItemTemplate( item, ContentPlaceHolder ); }
/// <summary>Fills a DasBlog entry from a MetaWeblog Post structure.</summary> /// <param name="entry">DasBlog entry to fill.</param> /// <param name="post">MetaWeblog post structure to fill from.</param> /// <returns>TrackbackInfoCollection of posts to send trackback pings.</returns> private TrackbackInfoCollection FillEntryFromMetaWeblogPost( Entry entry, newtelligence.DasBlog.Web.Services.MetaWeblog.Post post ) { // W.Bloggar doesn't pass in the DataCreated, // so we have to check for that if ( post.dateCreated != DateTime.MinValue ) { entry.CreatedUtc = post.dateCreated.ToUniversalTime(); } //Patched to avoid html entities in title entry.Title = HttpUtility.HtmlDecode(post.title); entry.Content = post.description; entry.Description = noNull( post.mt_excerpt ); // If mt_allow_comments is null, then the sender did not specify. Use default dasBlog behavior in that case if ( post.mt_allow_comments != null ) { int nAllowComments = Convert.ToInt32( post.mt_allow_comments ); if ( nAllowComments == 0 || nAllowComments == 2 ) entry.AllowComments = false; else entry.AllowComments = true; } if ( post.categories != null && post.categories.Length > 0 ) { // handle categories string categories = ""; System.Text.StringBuilder sb = new System.Text.StringBuilder(); bool needSemi = false; post.categories = RemoveDups( post.categories, true ); foreach( string category in post.categories ) { //watch for "" as a category if( category.Length > 0 ) { if ( needSemi ) sb.Append( ";" ); sb.Append( category ); needSemi = true; } } categories = sb.ToString(); if ( categories.Length > 0 ) entry.Categories = categories; } // We'll always return at least an empty collection TrackbackInfoCollection trackbackList = new TrackbackInfoCollection(); // Only MT supports trackbacks in the post if ( post.mt_tb_ping_urls != null ) { foreach ( string trackbackUrl in post.mt_tb_ping_urls ) { trackbackList.Add( new TrackbackInfo( trackbackUrl, SiteUtilities.GetPermaLinkUrl( siteConfig, entry ), entry.Title, entry.Description, siteConfig.Title ) ); } } return trackbackList; }
private void FillBloggerPostFromEntry( Entry entry, ref newtelligence.DasBlog.Web.Services.Blogger.Post post ) { post.content = noNull( string.Format( "<title>{0}</title>{1}", entry.Title, entry.Content ) ); post.dateCreated = entry.CreatedUtc; post.postid = noNull(entry.EntryId); post.userid = noNull(entry.Author); }
bool IMovableType.mt_setPostCategories(string postid, string username, string password, newtelligence.DasBlog.Web.Services.MovableType.Category[] categories) { if ( !siteConfig.EnableBloggerApi ) { throw new ServiceDisabledException(); } UserToken token = SiteSecurity.Login(username, password); if (token == null) { throw new System.Security.SecurityException(); } Entry entry = dataService.GetEntryForEdit(postid); if ( entry != null ) { string cats = ""; foreach( newtelligence.DasBlog.Web.Services.MovableType.Category mcat in categories ) { if ( cats.Length>0) cats+=";"; cats += mcat.categoryId; } entry.Categories = cats; dataService.SaveEntry(entry); // give the XSS upstreamer a hint that things have changed XSSUpstreamer.TriggerUpstreaming(); return true; } else { return false; } }
string IMetaWeblog.metaweblog_newPost(string blogid, string username, string password, newtelligence.DasBlog.Web.Services.MetaWeblog.Post post, bool publish) { if ( !siteConfig.EnableBloggerApi ) { throw new ServiceDisabledException(); } UserToken token = SiteSecurity.Login(username, password); if (token == null) { throw new System.Security.SecurityException(); } Entry newPost = new Entry(); newPost.Initialize(); newPost.Author = username; TrackbackInfoCollection trackbackList = FillEntryFromMetaWeblogPost( newPost, post ); newPost.IsPublic = publish; newPost.Syndicated = publish; // give the XSS upstreamer a hint that things have changed //FIX: XSSUpstreamer.TriggerUpstreaming(); SiteUtilities.SaveEntry(newPost, trackbackList, siteConfig, this.logService, this.dataService); return newPost.EntryId; }
// Metaweblog bool IMetaWeblog.metaweblog_editPost(string postid, string username, string password, newtelligence.DasBlog.Web.Services.MetaWeblog.Post post, bool publish) { if ( !siteConfig.EnableBloggerApi ) { throw new ServiceDisabledException(); } UserToken token = SiteSecurity.Login(username, password); if (token == null) { throw new System.Security.SecurityException(); } Entry entry = dataService.GetEntryForEdit( postid ); if ( entry != null ) { entry.Author = username; TrackbackInfoCollection trackbackList = FillEntryFromMetaWeblogPost( entry, post ); entry.IsPublic = publish; entry.Syndicated = publish; // give the XSS upstreamer a hint that things have changed //FIX: XSSUpstreamer.TriggerUpstreaming(); SiteUtilities.SaveEntry(entry, trackbackList, siteConfig, this.logService, this.dataService); } return true; }