Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["text"] == null)
            {
                myUser = Account.SecurePage(this, Data.DeviceType);
            }
            else
            {
                myUser = Account.SecurePage(this, Data.DeviceType, "user", $"\"{Request.QueryString["text"]}\"");
            }

            SearchMediaControl.Focus();
            NewMenu.LoggedInUser = myUser;
            NewMenu.Upload       = true;
            NewMenu.HighlightButtonsForPage(PageIndex.Search, "Search");

            UploadMediaControl.Initialise(myUser, this, false);

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

            if (!IsPostBack && text != null)
            {
                SearchMediaControl.TextBoxValue = text;
                DoSearch(text);
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MOTD_div.InnerHtml = ConfigurationManager.AppSettings["MOTD"];

            myUser = ParsnipData.Accounts.User.LogIn();
            if (string.IsNullOrEmpty(Data.DeviceType))
            {
                Response.Redirect("get_device_info?url=home");
            }

            if (myUser == null)
            {
                PleaseLogin.Visible = true;
            }
            else
            {
                MyMediaTitle.Visible = true;
                WelcomeLabel.Text    =
                    string.Format($"Hiya {myUser.Forename}, welcome back!");

                UploadMediaControl.Initialise(myUser, this);

                foreach (MediaControl mediaControl in MediaControl.GetUserMediaAsMediaControls(myUser.Id, myUser.Id))
                {
                    DynamicMediaDiv.Controls.Add(mediaControl);
                }
            }

            new LogEntry(Log.Debug)
            {
                text = string.Format("The home page was accessed by {0} from {1} {2} device.",
                                     myUser == null ? "someone who was not logged in" : myUser.Forename,
                                     myUser == null ? "their" : myUser.PosessivePronoun, Data.DeviceType)
            };
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            myUser = Account.SecurePage(this, Data.DeviceType);

            TagName.InnerText        = $"#{PhotosMediaTag.Name}";
            TagDescription.InnerText = PhotosMediaTag.Description;

            NewMenu.SelectedPage = PageIndex.Photos;
            NewMenu.LoggedInUser = myUser;
            NewMenu.Upload       = true;
            UploadMediaControl.Initialise(myUser, PhotosMediaTag, this);
        }
Exemplo n.º 4
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);
            }
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MOTD.InnerHtml = System.Configuration.ConfigurationManager.AppSettings["MOTD"];

            if (string.IsNullOrEmpty(Data.DeviceType))
            {
                Response.Redirect("get_device_info?url=home");
            }

            myUser = Account.PublicPage(this, Data.DeviceType);

            NewMenu.SelectedPage = PageIndex.Home;
            if (myUser != null)
            {
                NewMenu.LoggedInUser = myUser;
                NewMenu.Upload       = true;
            }

            Page httpHandler = (Page)HttpContext.Current.Handler;

            if (myUser == null)
            {
            }
            //LoginNudge.Visible = true;
            else
            {
                UploadMediaControl.Initialise(myUser, this);
                if (myUser.AccountType == "admin" || myUser.AccountType == "member" || myUser.AccountType == "media")
                {
                    uploadForm.Visible          = true;
                    UploadButtonPadding.Visible = true;
                }
            }

            new LogEntry(Log.Debug)
            {
                Text = string.Format("The home page was accessed by {0} from {1} {2} device.",
                                     myUser == null ? "someone who was not logged in" : myUser.Forename,
                                     myUser == null ? "their" : myUser.PosessivePronoun, Data.DeviceType)
            };

            //WelcomeLabel.Text =
            //    string.Format("Hiya {0} to the parsnip website!", myUser == null ?
            //    "stranger, welcome" : myUser.Forename + ", welcome back");

            if (myUser == null)
            {
                MediaTagContainer.InnerHtml = "<label style=\"color:red \">You must <a href=\"login\" style=\"color:blue\">login</a> to see tags!</label>";
            }
            else
            {
                List <ViewTagControl> ViewTagControls = new List <ViewTagControl>();
                foreach (MediaTag mediaTag in MediaTag.GetAllTags())
                {
                    ViewTagControl mediaTagPairViewControl = (ViewTagControl)httpHandler.LoadControl("~/Custom_Controls/Media/ViewTagControl.ascx");
                    mediaTagPairViewControl.MyTag = mediaTag;
                    mediaTagPairViewControl.UpdateLink();
                    MediaTagContainer.Controls.Add(mediaTagPairViewControl);
                    ViewTagControls.Add(mediaTagPairViewControl);
                }

                foreach (ParsnipData.Accounts.User user in ParsnipData.Accounts.User.GetAllUsers())
                {
                    ViewTagControl mediaUserPairViewControl = (ViewTagControl)httpHandler.LoadControl("~/Custom_Controls/Media/ViewTagControl.ascx");
                    mediaUserPairViewControl.MyUser = user;
                    mediaUserPairViewControl.UpdateLink();
                    MediaTagContainer.Controls.Add(mediaUserPairViewControl);
                    ViewTagControls.Add(mediaUserPairViewControl);
                }

                foreach (ViewTagControl control in ViewTagControls.OrderBy(x => x.Name))
                {
                    MediaTagContainer.Controls.Add(control);
                }
            }



            var myImage = new ParsnipData.Media.Image();

            myImage.Id          = MediaId.NewMediaId();
            myImage.Compressed  = "Resources/Media/Images/Local/Dirt_On_You.jpg";
            myImage.Placeholder = "Resources/Media/Images/Local/Dirt_On_You.jpg";

            if (myUser != null)
            {
                myImage.Title = $"Hey {myUser.Forename}, what DIRT do we have on YOU? 😜";
            }
            else
            {
                myImage.Title = $"What DIRT do we have on YOU? 😜";
            }

            var MySeeYourselfControl = (MediaControl)Page.LoadControl("~/Custom_Controls/Media/MediaControl.ascx");

            MySeeYourselfControl.MyMedia    = myImage;
            MySeeYourselfControl.AnchorLink = $"{Request.Url.GetLeftPart(UriPartial.Authority)}/me";

            //seeYourself.Controls.Add(MySeeYourselfControl);
            //seeYourself.Visible = true;

            int   userId      = myUser == null ? 0 : myUser.Id;
            Media latestVideo = Media.SelectLatestVideo(userId);

            if (latestVideo != null)
            {
                var MyVideoControl = (MediaControl)Page.LoadControl("~/Custom_Controls/Media/MediaControl.ascx");


                latestVideo.Title      = "LATEST VIDEO: " + latestVideo.Title;
                MyVideoControl.MyMedia = latestVideo;

                //LatestVideo.Controls.Add(MyVideoControl);
            }
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page httpHandler = (Page)HttpContext.Current.Handler;

            myUser = Account.SecurePage(this, Data.DeviceType);

            NewMenu.LoggedInUser = myUser;
            NewMenu.Upload       = true;
            NewMenu.HighlightButtonsForPage(PageIndex.MyUploads, "My Uploads");

            UploadMediaControl.Initialise(myUser, this);
            if (myUser.AccountType == "admin" || myUser.AccountType == "member" || myUser.AccountType == "media")
            {
                uploadForm.Visible = true;
            }

            var mediaControls = MediaControl.GetUserMediaAsMediaControls(myUser.Id, myUser.Id);

            if (mediaControls.Count != default)
            {
                UploadPrompt.Visible = false;
            }

            foreach (MediaControl mc in mediaControls)
            {
                MyMediaContainer.Controls.Add(mc);
            }



            if (string.IsNullOrEmpty(Data.DeviceType))
            {
                Response.Redirect("get_device_info?url=home");
            }

            new LogEntry(Log.Debug)
            {
                Text = string.Format("The home page was accessed by {0} from {1} {2} device.",
                                     myUser == null ? "someone who was not logged in" : myUser.Forename,
                                     myUser == null ? "their" : myUser.PosessivePronoun, Data.DeviceType)
            };

            //WelcomeLabel.Text =
            //    string.Format("Hiya {0} to the parsnip website!", myUser == null ?
            //    "stranger, welcome" : myUser.Forename + ", welcome back");

            var myImage = new ParsnipData.Media.Image();

            myImage.Id          = MediaId.NewMediaId();
            myImage.Compressed  = "Resources/Media/Images/Local/Dirt_On_You.jpg";
            myImage.Placeholder = "Resources/Media/Images/Local/Dirt_On_You.jpg";

            if (myUser != null)
            {
                myImage.Title = $"Hey {myUser.Forename}, what DIRT do we have on YOU? 😜";
            }
            else
            {
                myImage.Title = $"What DIRT do we have on YOU? 😜";
            }

            var MySeeYourselfControl = (MediaControl)Page.LoadControl("~/Custom_Controls/Media/MediaControl.ascx");

            MySeeYourselfControl.MyMedia    = myImage;
            MySeeYourselfControl.AnchorLink = $"{Request.Url.GetLeftPart(UriPartial.Authority)}/me";

            //seeYourself.Controls.Add(MySeeYourselfControl);
            //seeYourself.Visible = true;

            int   userId      = myUser == null ? 0 : myUser.Id;
            Media latestVideo = Media.SelectLatestVideo(userId);

            if (latestVideo != null)
            {
                var MyVideoControl = (MediaControl)Page.LoadControl("~/Custom_Controls/Media/MediaControl.ascx");


                latestVideo.Title      = "LATEST VIDEO: " + latestVideo.Title;
                MyVideoControl.MyMedia = latestVideo;

                //LatestVideo.Controls.Add(MyVideoControl);
            }
        }
Exemplo n.º 7
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);
            }
        }