Beispiel #1
0
    public string BlogFavePost(int userID, string postGuid)
    {
        SueetieBlogPost sueetieBlogPost = SueetieBlogs.GetSueetieBlogPost(postGuid);

        if (userID > 0)
        {
            if (sueetieBlogPost.SueetiePostID > 0)
            {
                string      result      = "You have tagged " + sueetieBlogPost.Title + " as a favorite!";
                UserContent userContent = new UserContent
                {
                    ContentID = sueetieBlogPost.ContentID,
                    UserID    = userID
                };

                int favoriteID = SueetieUsers.CreateFavorite(userContent);
                if (favoriteID < 0)
                {
                    result = "You already tagged this post as a favorite.";
                }

                return(result);
            }
            else
            {
                return("Sorry, we added favorites after this post was published. Please consider tagging more recent posts as favorites.");
            }
        }
        else
        {
            return("Please login or become a member to tag this post as a favorite");
        }
    }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Sueetie Modified - Add Calendar Control
        if (this.Post != null && this.Post.Id != null)
        {
            SueetieBlogPost sueetieBlogPost = SueetieBlogs.GetSueetieBlogPost(Post.Id.ToString());

            calendarControl = new CalendarControl();
            calendarControl.CalendarSueetieBlogPost = sueetieBlogPost;
            phCalendarControl.Controls.Add(calendarControl);
        }
    }
Beispiel #3
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load"/> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs"/> object that contains the event data.</param>
        /// <remarks>
        /// Lets process our .Body content and build up our controls collection
        /// inside the 'BodyContent' placeholder.
        /// User controls are insterted into the blog in the following format..
        /// [UserControl:~/path/usercontrol.ascx]
        /// TODO : Expose user control parameters.
        /// </remarks>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // Sueetie Modified - Create Current Sueetie Blog Post
            this.CurrentSueetieBlogPost = SueetieBlogs.GetSueetieBlogPost(this.Post.Id.ToString());
            this.CurrentSueetieBlog     = SueetieBlogs.GetSueetieBlog(SueetieApplications.Current.ApplicationKey);

            var bodyContent = (PlaceHolder)this.FindControl("BodyContent");

            if (bodyContent == null)
            {
                // We have no placeholder so we assume this is an old style <% =Body %> theme and do nothing.
            }
            else
            {
                Utils.InjectUserControls(bodyContent, this.Body);
            }
        }
Beispiel #4
0
    public string BlogAuthorFollow(int userID, string postGuid)
    {
        SueetieBlogPost sueetieBlogPost = SueetieBlogs.GetSueetieBlogPost(postGuid);

        if (userID > 0)
        {
            if (sueetieBlogPost.SueetiePostID > 0)
            {
                string        result        = "You are now following " + sueetieBlogPost.DisplayName;
                SueetieFollow sueetieFollow = new SueetieFollow
                {
                    FollowerUserID    = userID,
                    FollowingUserID   = sueetieBlogPost.UserID,
                    ContentIDFollowed = sueetieBlogPost.SueetiePostID
                };

                if (sueetieFollow.FollowerUserID == sueetieFollow.FollowingUserID)
                {
                    result = "Sorry, you cannot follow yourself...";
                }
                else
                {
                    int followID = SueetieUsers.FollowUser(sueetieFollow);
                    if (followID < 0)
                    {
                        result = "You are already following " + sueetieBlogPost.DisplayName;
                    }

                    SueetieLogs.LogUserEntry(UserLogCategoryType.Following, sueetieBlogPost.UserID, userID);
                }
                return(result);
            }
            else
            {
                return("Sorry, we added following after this post was written. Please use a more current post to follow this member.");
            }
        }
        else
        {
            return("Please login or become a member to follow this person.");
        }
    }
Beispiel #5
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        if (!Security.IsAuthorizedTo(Rights.ViewPublicPosts))
        {
            Response.Redirect("~/");
        }

        bool shouldThrow404 = false;


        CommentView1.Visible = ShowCommentsForm;
        disqus_box.Visible   = ShowDisqusForm;

        var  requestId = Request.QueryString["id"];
        Guid id;

        if ((!Utils.StringIsNullOrWhitespace(requestId)) && requestId.TryParse(out id))
        {
            Post post = Post.GetPost(id);

            if (post != null)
            {
                if (!Page.IsPostBack && !Page.IsCallback && Request.RawUrl.Contains("?id="))
                {
                    // If there's more than one post that has the same RelativeLink
                    // this post has then don't do a 301 redirect.

                    if (Post.Posts.FindAll(delegate(Post p)
                                           { return(p.RelativeLink.Equals(post.RelativeLink)); }
                                           ).Count < 2)
                    {
                        Response.Clear();
                        Response.StatusCode = 301;
                        Response.AppendHeader("location", post.RelativeLink.ToString());
                        Response.End();
                    }
                }
                else if (!post.IsVisible)
                {
                    shouldThrow404 = true;
                }
                else
                {
                    this.Post = post;

                    var    settings         = BlogSettings.Instance;
                    string encodedPostTitle = Server.HtmlEncode(Post.Title);
                    string path             = Utils.RelativeWebRoot + "themes/" + settings.Theme + "/PostView.ascx";

                    PostViewBase postView = (PostViewBase)LoadControl(path);
                    postView.Post     = Post;
                    postView.ID       = Post.Id.ToString().Replace("-", string.Empty);
                    postView.Location = ServingLocation.SinglePost;
                    pwPost.Controls.Add(postView);

                    if (settings.EnableRelatedPosts)
                    {
                        related.Visible = true;
                        related.Item    = this.Post;
                    }

                    CommentView1.Post = Post;

                    Page.Title = encodedPostTitle;
                    AddMetaKeywords();
                    AddMetaDescription();
                    base.AddMetaTag("author", Server.HtmlEncode(Post.AuthorProfile == null ? Post.Author : Post.AuthorProfile.FullName));

                    List <Post> visiblePosts = Post.Posts.FindAll(delegate(Post p) { return(p.IsVisible); });
                    if (visiblePosts.Count > 0)
                    {
                        AddGenericLink("last", visiblePosts[0].Title, visiblePosts[0].RelativeLink);
                        AddGenericLink("first", visiblePosts[visiblePosts.Count - 1].Title, visiblePosts[visiblePosts.Count - 1].RelativeLink);
                    }

                    InitNavigationLinks();

                    phRDF.Visible = settings.EnableTrackBackReceive;

                    base.AddGenericLink("application/rss+xml", "alternate", encodedPostTitle + " (RSS)", postView.CommentFeed + "?format=ATOM");
                    base.AddGenericLink("application/rss+xml", "alternate", encodedPostTitle + " (ATOM)", postView.CommentFeed + "?format=ATOM");

                    if (BlogSettings.Instance.EnablePingBackReceive)
                    {
                        Response.AppendHeader("x-pingback", "http://" + Request.Url.Authority + Utils.RelativeWebRoot + "pingback.axd");
                    }

                    string commentNotificationUnsubscribeEmailAddress = Request.QueryString["unsubscribe-email"];
                    if (!string.IsNullOrEmpty(commentNotificationUnsubscribeEmailAddress))
                    {
                        if (Post.NotificationEmails.Contains(commentNotificationUnsubscribeEmailAddress))
                        {
                            Post.NotificationEmails.Remove(commentNotificationUnsubscribeEmailAddress);
                            Post.Save();
                            phCommentNotificationUnsubscription.Visible = true;
                        }
                    }

                    // Sueetie Modified - Set CurrentContentID
                    if (SueetieBlogs.GetSueetieBlogPost(post.Id.ToString()) != null)
                    {
                        base.CurrentContentID = SueetieBlogs.GetSueetieBlogPost(post.Id.ToString()).ContentID;
                    }
                    else
                    {
                        base.CurrentContentID = -1;
                    }
                }
            }
        }

        else
        {
            shouldThrow404 = true;
        }

        if (shouldThrow404)
        {
            Response.Redirect(Utils.RelativeWebRoot + "error404.aspx", true);
        }
    }