Exemple #1
0
    private void ExtractURLParams()
    {
        ViewingMember = ExtractPageParams.GetMember(this.Page, this.Context);

        // if no member name was givent then it is likely to be a video page
        if (ViewingMember == null)
        {
            // get the video and extact the member
            DefaultVideo  = ExtractPageParams.GetVideo(this.Page, this.Context);
            ViewingMember = new Member(DefaultVideo.MemberID);
        }

        NumberOfComments          = AjaxComment.GetNumberOfCommentByObjectID(ViewingMember.MemberID, (int)CommentType.Wall);
        NumberOfMemberSubscribers = SubscriptionMember.GetSubscriberCountByMemberID(ViewingMember.MemberID).ToString();
        ViewingMemberProfile      = ViewingMember.MemberProfile[0];

        try
        {
            NumberOfVideos  = ViewingMemberProfile.NumberOfVideos;
            NumberOfPhotos  = ViewingMemberProfile.NumberOfPhotos;
            NumberOfFriends = FriendRequest.GetNumberOfFriends(ViewingMember.MemberID);
        }
        catch { }

        try
        {
            ResourceFile PhotoRes = new ResourceFile(ViewingMember.ProfilePhotoResourceFileID);
            PhotoURL      = ParallelServer.Get(PhotoRes.FullyQualifiedURL) + PhotoRes.FullyQualifiedURL;
            LargePhotoURL = ParallelServer.Get("/pmed/" + PhotoRes.FileName) + @"user/" + ViewingMember.NickName + "/pmed/" + PhotoRes.FileName;
        }
        catch { }

        ViewingMemberProfile = ViewingMember.MemberProfile[0];

        ViewingMemberProfile.NumberOfViews++;
    }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        LoginUrl = @"/signup/?u=" + Request.Url.AbsoluteUri;
        string strLiveBroadcastID = Request.Params["l"];

        member = (Member)Session["Member"];

        if (member != null)
        {
            IsLoggedIn = true;
        }

        DefaultVideo = ExtractPageParams.GetVideo(this.Page, this.Context);
        string FormattedTitle = RegexPatterns.FormatHTMLTitle(DefaultVideo.Title);

        FormattedTitle = RegexPatterns.FormatStringForURL(FormattedTitle);
        ThisURL        = "/video/" + FormattedTitle + "/" + DefaultVideo.WebVideoID;

        if (DefaultVideo != null)
        {
            string VideoTitle = ExtractPageParams.GetVideoTitle(this.Page, this.Context);

            // SEO: if the title has changed then send a redirect request to the browser
            if (FormattedTitle != VideoTitle)
            {
                HTTPResponse.PermamentlyMoved301(Context, ThisURL);

                //Context.Response.Status = "301 Moved Permanently";
                //Context.Response.StatusCode = 301;
                //Context.Response.AddHeader("location", "/videos/" + FormattedTitle + "/" + DefaultVideo.WebVideoID);
                //Context.Response.Redirect("/video/" + FormattedTitle + "/" + DefaultVideo.WebVideoID);
            }

            NumberOfComments     = DefaultVideo.NumberOfComments;
            ViewingMember        = new Member(DefaultVideo.MemberID);
            PageType             = DefaultPageType.Video;
            DefaultVideoURL      = DefaultVideo.VideoResourceFile.FullyQualifiedURL;
            DefaultMediaID       = DefaultVideo.WebVideoID;
            DefaultVoteCount     = DefaultVideo.TotalVoteScore.ToString();
            VideoURL             = DefaultVideo.VideoResourceFile.FullyQualifiedURL;
            DefaultNumberOfViews = (++DefaultVideo.NumberOfViews).ToString();

            int    ViewerMemberID = (member != null) ? member.MemberID : 0;
            string IPAddress      = Request.UserHostAddress;

            Video.IncreaseWatchedCount(DefaultVideo.WebVideoID, ViewerMemberID, IPAddress);

            // no need to save anymore
            //DefaultVideo.Save();
            PermaLink = WebRoot + "video/" + RegexPatterns.FormatStringForURL(DefaultVideo.Title) + "/" + DefaultVideo.WebVideoID;
            EmbedLink = @"<object width=""480"" height=""400""><param name=""movie"" value=""http://www.next2friends.com/flvplayer.swf""></param><param name=""wmode"" value=""transparent""></param><embed src=""http://www.next2friends.com/flvplayer.swf?file=" + VideoURL + @""" type=""application/x-shockwave-flash"" wmode=""transparent"" width=""480"" height=""400""></embed></object>";

            MainTitle    = DefaultVideo.Title;
            MainSubTitle = DefaultVideo.Description;

            if (IsLoggedIn)
            {
                ReportAbuseLink     = "/ReportAbuse.aspx?r=" + DefaultMediaID;
                DefaultVoteUpLink   = @"javascript:vote('v','" + DefaultMediaID + "', true);";
                DefaultVoteDownLink = @"javascript:vote('v','" + DefaultMediaID + "', false);";
                AddFavouritesLink   = @"javascript:addToFavourites('" + CommentType.Video.ToString() + "','" + DefaultMediaID + "');";
            }
            else
            {
                ReportAbuseLink     = @"/signup.aspx?u=ReportAbuse.aspx?r=" + DefaultMediaID + "&url=" + Request.Url.AbsoluteUri;
                DefaultVoteUpLink   = LoginUrl;
                DefaultVoteDownLink = LoginUrl;
                AddFavouritesLink   = LoginUrl;
            }

            Comments1.ObjectId    = DefaultVideo.VideoID;
            Comments1.ObjectWebId = DefaultVideo.WebVideoID;
            Comments1.CommentType = CommentType.Video;

            forwardToFriend.ObjectWebID = DefaultVideo.WebVideoID;
            forwardToFriend.ContentType = CommentType.Video;
        }
        else
        {
            //404 - The video was not found
            HTTPResponse.FileNotFound404(Context);
            Server.Transfer("/NotAvailable.aspx?rt=v");
        }

        //RenderVideoSlider();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        AjaxPro.Utility.RegisterTypeForAjax(typeof(MiniVideoPage));

        member = (Member)Session["Member"];

        if (member == null)
        {
            Utility.RememberMeLogin();
        }

        if (member != null)
        {
            IsLoggedIn = true;
        }

        string IsVideoOnly = Request.Params["VideoOnly"];

        if (IsVideoOnly != null)
        {
            VideoOnly = true;
        }

        // the value we pass to this page is the webvideoid from the url
        DefaultVideo = ExtractPageParams.GetVideo(this.Page, this.Context);

        string FormattedTitle = RegexPatterns.FormatHTMLTitle(DefaultVideo.Title);

        FormattedTitle = RegexPatterns.FormatStringForURL(FormattedTitle);
        ThisURL        = "/video/" + FormattedTitle + "/" + DefaultVideo.WebVideoID;

        if (DefaultVideo != null)
        {
            string VideoTitle = ExtractPageParams.GetVideoTitle(this.Page, this.Context);

            NumberOfComments     = DefaultVideo.NumberOfComments;
            ViewingMember        = new Member(DefaultVideo.MemberID);
            PageType             = DefaultPageType.Video;
            DefaultVideoURL      = DefaultVideo.VideoResourceFile.FullyQualifiedURL;
            DefaultMediaID       = DefaultVideo.WebVideoID;
            DefaultVoteCount     = DefaultVideo.TotalVoteScore.ToString();
            VideoURL             = DefaultVideo.VideoResourceFile.FullyQualifiedURL;
            DefaultNumberOfViews = (++DefaultVideo.NumberOfViews).ToString();

            int    ViewerMemberID = (member != null) ? member.MemberID : 0;
            string IPAddress      = Request.UserHostAddress;

            Video.IncreaseWatchedCount(DefaultVideo.WebVideoID, ViewerMemberID, IPAddress);

            // no need to save anymore
            //DefaultVideo.Save();
            PermaLink = WebRoot + "video/" + RegexPatterns.FormatStringForURL(DefaultVideo.Title) + "/" + DefaultVideo.WebVideoID;
            EmbedLink = @"<object width=""480"" height=""400""><param name=""movie"" value=""http://www.next2friends.com/flvplayer.swf""></param><param name=""wmode"" value=""transparent""></param><embed src=""http://www.next2friends.com/flvplayer.swf?file=" + VideoURL + @""" type=""application/x-shockwave-flash"" wmode=""transparent"" width=""480"" height=""400""></embed></object>";

            MainTitle    = DefaultVideo.Title;
            MainSubTitle = DefaultVideo.Description;

            if (IsLoggedIn)
            {
                ReportAbuseLink     = "/ReportAbuse.aspx?r=" + DefaultMediaID;
                DefaultVoteUpLink   = @"javascript:vote('" + DefaultMediaID + "', true);";
                DefaultVoteDownLink = @"javascript:vote('" + DefaultMediaID + "', false);";
                AddFavouritesLink   = @"javascript:addToFavourites('" + CommentType.Video.ToString() + "','" + DefaultMediaID + "');";
            }
            else
            {
                ReportAbuseLink     = @"/signup.aspx?u=ReportAbuse.aspx?r=" + DefaultMediaID + "&url=" + Request.Url.AbsoluteUri;
                DefaultVoteUpLink   = LoginUrl;
                DefaultVoteDownLink = LoginUrl;
                AddFavouritesLink   = LoginUrl;
            }

            if (member != null)
            {
                if (!Utility.IsMe(ViewingMember, member))
                {
                    Utility.ContentViewed(member, ViewingMember.MemberID, CommentType.Member);
                }
            }

            //    Comments1.ObjectId = DefaultVideo.VideoID;
            //    Comments1.ObjectWebId = DefaultVideo.WebVideoID;
            //    Comments1.CommentType = CommentType.Video;

            //    forwardToFriend.ObjectWebID = DefaultVideo.WebVideoID;
            //    forwardToFriend.ContentType = CommentType.Video;
        }
        else
        {
            //404 - The video was not found
            HTTPResponse.FileNotFound404(Context);
            Server.Transfer("/NotAvailable.aspx?rt=v");
        }
    }