Example #1
0
        public MoveableType.PostTitle[] mt_getRecentPostTitles(string blogid, string username, string password, int numberOfPosts)
        {
            if (!_dasBlogSettings.SiteConfiguration.EnableBloggerApi)
            {
                throw new ServiceDisabledException();
            }
            UserToken token = _siteSecurity.Login(username, password);

            if (token == null)
            {
                throw new SecurityException();
            }
            EntryCollection entries = _dataService.GetEntriesForDay(DateTime.Now.ToUniversalTime(), TimeZone.CurrentTimeZone, null,
                                                                    _dasBlogSettings.SiteConfiguration.RssDayCount, numberOfPosts, null);
            List <MoveableType.PostTitle> arrayList = new List <MoveableType.PostTitle>();

            foreach (Entry entry in entries)
            {
                MoveableType.PostTitle post = new MoveableType.PostTitle();
                post.title       = NoNull(entry.Title);
                post.dateCreated = entry.CreatedUtc;
                post.postid      = NoNull(entry.EntryId);
                post.userid      = username;
                arrayList.Add(post);
            }
            return(arrayList.ToArray());
        }
Example #2
0
        public MoveableType.PostTitle[] mt_getRecentPostTitles(string blogid, string username, string password, int numberOfPosts)
        {
            if (!dasBlogSettings.SiteConfiguration.EnableBloggerApi)
            {
                throw new ServiceDisabledException();
            }

            if (!VerifyLogin(username, password))
            {
                throw new SecurityException();
            }

            var entries = dataService.GetEntriesForDay(DateTime.Now.ToUniversalTime(), dasBlogSettings.GetConfiguredTimeZone(), null,
                                                       dasBlogSettings.SiteConfiguration.RssDayCount, numberOfPosts, null);
            var arrayList = new List <MoveableType.PostTitle>();

            foreach (Entry entry in entries)
            {
                var post = new MoveableType.PostTitle();
                post.title       = NoNull(entry.Title);
                post.dateCreated = entry.CreatedUtc;
                post.postid      = NoNull(entry.EntryId);
                post.userid      = username;
                arrayList.Add(post);
            }
            return(arrayList.ToArray());
        }