Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Request.QueryString["id"]) && string.IsNullOrEmpty(Request.QueryString["user"]))
            {
                Response.Redirect("home");
            }
            else
            {
                myTag     = MediaTag.Select(Convert.ToInt32(Request.QueryString["id"]));
                myTagUser = ParsnipData.Accounts.User.Select(Convert.ToInt32(Request.QueryString["user"]));
                string focus = Request.QueryString["focus"];

                if (myTagUser == null)
                {
                    if (string.IsNullOrEmpty(focus))
                    {
                        myUser = Account.SecurePage($"tag?id={myTag.Id}", this, Data.DeviceType, "admin");
                    }
                    else
                    {
                        myUser = Account.SecurePage($"tag?id={myTag.Id}&{focus}", this, Data.DeviceType, "admin");
                    }
                }
                else
                {
                    if (string.IsNullOrEmpty(focus))
                    {
                        myUser = Account.SecurePage($"tag?user={myTagUser.Id}", this, Data.DeviceType, "admin");
                    }
                    else
                    {
                        myUser = Account.SecurePage($"tag?user={myTagUser.Id}&{focus}", this, Data.DeviceType, "admin");
                    }
                }
            }

            if (myTagUser == null)
            {
                Page.Title = $"Tag: {myTag.Name}";
            }
            else
            {
                Page.Title = $"Tag: {myTagUser.Forename}";
            }

            TagName.InnerText = string.IsNullOrEmpty(myTag.Name) ? myTagUser.FullName : myTag.Name;

            if (myTag != null)
            {
                UploadMediaControl.Initialise(myUser, this);
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Request.QueryString["id"]) && string.IsNullOrEmpty(Request.QueryString["user"]))
            {
                Response.Redirect("home");
            }
            else
            {
                var tagId        = Convert.ToInt32(Request.QueryString["id"]);
                var taggedUserId = Convert.ToInt32(Request.QueryString["user"]);

                if (tagId != default)
                {
                    myTag = MediaTag.Select(tagId);
                }

                if (taggedUserId != default)
                {
                    myTaggedUser = ParsnipData.Accounts.User.Select(taggedUserId);
                }

                string focus = Request.QueryString["focus"];

                if (myTag != null)
                {
                    if (string.IsNullOrEmpty(focus))
                    {
                        myUser = Account.SecurePage(this, Data.DeviceType, "user", $"#{myTag.Name}");
                    }
                    else
                    {
                        myUser = Account.SecurePage(this, Data.DeviceType, "user", $"#{myTag.Name}");
                    }
                }
                else if (myTaggedUser != null)
                {
                    if (string.IsNullOrEmpty(focus))
                    {
                        myUser = Account.SecurePage(this, Data.DeviceType, "user", $"@{myTaggedUser.Username}");
                    }
                    else
                    {
                        myUser = Account.SecurePage(this, Data.DeviceType, "user", $"@{myTaggedUser.Username}");
                    }
                }
                else
                {
                    var param = "";

                    if (tagId != default)
                    {
                        param = $"id={tagId}";
                    }
                    if (taggedUserId != default)
                    {
                        param = $"user={taggedUserId}";
                    }

                    myUser = Account.SecurePage(this, Data.DeviceType, "user", $"No tag found");
                    param += string.IsNullOrEmpty(param) ? "" : "&";

                    if (string.IsNullOrEmpty(Request.QueryString["alert"]))
                    {
                        Response.Redirect($"tag?{param}alert=P104");
                    }
                }

                if (myTag != null)
                {
                    TagName.InnerText        = $"#{myTag.Name}";
                    TagDescription.InnerText = myTag.Description;
                }
                else if (myTaggedUser != null)
                {
                    TagName.InnerText        = $"@{myTaggedUser.Username}";
                    TagDescription.InnerText = $"Everything {myTaggedUser.Forename} has been tagged in";
                }

                NewMenu.LoggedInUser = myUser;
                NewMenu.Upload       = true;
                if (myTag != null || myTaggedUser != null)
                {
                    var tagText = myTag == null ? $"@{myTaggedUser.Username}" : $"#{myTag.Name}";
                    NewMenu.HighlightButtonsForPage(PageIndex.Tag, tagText);
                }
                else
                {
                    NewMenu.SelectedPage = PageIndex.Tag;
                }
            }

            if (myTag != null)
            {
                Page.Header.Controls.Add(new LiteralControl($"<meta property=\"og:title\" content=\"{myTag.Name}\" />"));
                Page.Header.Controls.Add(new LiteralControl($"<meta property=\"og:description\" content=\"{myTag.Description}\" />"));
                //Page.Header.Controls.Add(new LiteralControl($"<meta property=\"og:image\" content=\"{Request.Url.GetLeftPart(UriPartial.Authority)}/Resources/Media/Images/Local/Dirt_On_You.jpg\" />"));
                Page.Header.Controls.Add(new LiteralControl(string.Format("<meta property=\"og:alt\" content=\"{0}\" />", myTag.Description)));

                Page.Title = $"Tag: {myTag.Name}";
            }
            else if (myTaggedUser != null)
            {
                Page.Header.Controls.Add(new LiteralControl($"<meta property=\"og:title\" content=\"{myTaggedUser.FullName} was tagged in...\" />"));
                Page.Header.Controls.Add(new LiteralControl($"<meta property=\"og:description\" content=\"See pictures and videos which {myTaggedUser.FullName} has been tagged in!\" />"));
                //Page.Header.Controls.Add(new LiteralControl($"<meta property=\"og:image\" content=\"{Request.Url.GetLeftPart(UriPartial.Authority)}/Resources/Media/Images/Local/Dirt_On_You.jpg\" />"));
                Page.Header.Controls.Add(new LiteralControl(string.Format($"<meta property=\"og:alt\" content=\"See pictures and videos which {myTaggedUser.FullName} has been tagged in!\" />")));

                Page.Title = $"Tag: {myTaggedUser.Forename}";
            }

            //This will break youtube videos which have not had their thumbnail regenerated
            Page.Header.Controls.Add(new LiteralControl("<meta property=\"og:type\" content=\"website\" />"));
            Page.Header.Controls.Add(new LiteralControl(string.Format("<meta property=\"og:url\" content=\"{0}\" />", Request.Url.ToString())));
            Page.Header.Controls.Add(new LiteralControl("<meta property=\"fb:app_id\" content=\"521313871968697\" />"));

            if (myTag != null)
            {
                UploadMediaControl.Initialise(myUser, myTag, this);
            }
            else if (myTaggedUser != null)
            {
                UploadMediaControl.Initialise(myUser, myTaggedUser.Id, this);
            }
            else
            {
                UploadMediaControl.Initialise(myUser, this);
            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("Writing sessionId cookie = " + Session.SessionID.ToString());
            Cookie.WriteSession("sessionId", Session.SessionID.ToString());

            var url = Request.QueryString["url"];


            if (url != null)
            {
                var uri    = new Uri($"{Request.Url.GetLeftPart(UriPartial.Authority)}/{url}");
                int tagId  = default;
                int userId = default;

                if (url.Contains("tag?id="))
                {
                    tagId = Convert.ToInt32(HttpUtility.ParseQueryString(uri.Query).Get("id"));
                }
                else if (url.Contains("tag?user="******"user"));
                }
                else
                {
                    foreach (var id in (Data.MediaTagIds[])Enum.GetValues(typeof(Data.MediaTagIds)))
                    {
                        if (uri.ToString().Contains(id.ToString().ToLower()) || uri.ToString().Contains(id.ToString()))
                        {
                            tagId = (int)id;
                            break;
                        }
                    }
                }

                if (tagId != default)
                {
                    var myTag = MediaTag.Select(tagId);
                    if (myTag != null)
                    {
                        Page.Header.Controls.Add(new LiteralControl($"<meta property=\"og:title\" content=\"CLICK to 👀 #{myTag.Name} content!\" />"));
                        Page.Header.Controls.Add(new LiteralControl($"<meta property=\"og:description\" content=\"{myTag.Description}\" />"));
                        Page.Header.Controls.Add(new LiteralControl($"<meta property=\"og:image\" content=\"{Request.Url.GetLeftPart(UriPartial.Authority)}/Resources/Media/Images/Web_Media/Lock.jpg\" />"));
                        Page.Header.Controls.Add(new LiteralControl(string.Format("<meta property=\"og:alt\" content=\"{0}\" />", myTag.Description)));

                        Page.Title = $"Tag: {myTag.Name}";
                    }
                }

                if (Request.QueryString["url"].Contains("tag?user="******"<meta property=\"og:title\" content=\"@{myTagUser.Username} ({myTagUser.Forename}) was tagged in these 👀...\" />"));
                        Page.Header.Controls.Add(new LiteralControl($"<meta property=\"og:description\" content=\"See pictures and videos which {myTagUser.FullName} has been tagged in!\" />"));
                        Page.Header.Controls.Add(new LiteralControl($"<meta property=\"og:image\" content=\"{Request.Url.GetLeftPart(UriPartial.Authority)}/Resources/Media/Images/Web_Media/Lock.jpg\" />"));
                        Page.Header.Controls.Add(new LiteralControl(string.Format($"<meta property=\"og:alt\" content=\"See photos and videos which @{myTagUser.Username} ({myTagUser.FullName}) has been tagged in!\" />")));

                        Page.Title = $"Tag: {myTagUser.Forename}";
                    }
                }
            }

            Page.Header.Controls.Add(new LiteralControl("<meta property=\"og:image:width\" content=\"853\" />"));
            Page.Header.Controls.Add(new LiteralControl("<meta property=\"og:image:height\" content=\"480\" />"));
            Page.Header.Controls.Add(new LiteralControl("<meta property=\"og:type\" content=\"website\" />"));
            Page.Header.Controls.Add(new LiteralControl($"<meta property=\"og:url\" content=\"{Request.Url}\" />"));
            Page.Header.Controls.Add(new LiteralControl("<meta property=\"fb:app_id\" content=\"521313871968697\" />"));
        }