/// <summary> /// The Page_ Load Event. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { var userId = Security.StringToIntOrRedirect(this.Request.QueryString.GetFirstOrDefault("u")); if (userId != this.PageContext.PageUserID) { this.MenuHolder.Visible = false; } if (!this.IsPostBack) { var displayName = this.PageContext.BoardSettings.EnableDisplayName ? UserMembershipHelper.GetDisplayNameFromID(userId) : UserMembershipHelper.GetUserNameFromID(userId); this.PageLinks.Clear(); this.PageLinks.AddLink(this.PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); this.PageLinks.AddLink( displayName, YafBuildLink.GetLink(ForumPages.profile, "u={0}", userId, displayName)); this.PageLinks.AddLink(this.GetText("TITLE"), string.Empty); } var thanksInfo = this.GetRepository <Thanks>().ViewAllThanksByUserAsDataTable(userId, this.PageContext.PageUserID); this.InitializeThanksList(this.ThanksFromList, ThanksListMode.FromUser, userId, thanksInfo); this.InitializeThanksList(this.ThanksToList, ThanksListMode.ToUser, userId, thanksInfo); }
protected void Page_Load(object sender, EventArgs e) { if (User == null) { YafBuildLink.AccessDenied(); } if (!IsPostBack) { // get user data... MembershipUser user = UserMembershipHelper.GetMembershipUserById(UserID); if (user == null) { YafBuildLink.AccessDenied(/*No such user exists*/); } string displayName = UserMembershipHelper.GetDisplayNameFromID(UserID); PageLinks.AddLink(PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); PageLinks.AddLink(!string.IsNullOrEmpty(displayName) ? displayName : user.UserName, YafBuildLink.GetLink(ForumPages.profile, "u={0}", UserID)); PageLinks.AddLink(GetText("TITLE"), ""); // get full user data... CombinedUserDataHelper userData = new CombinedUserDataHelper(user, UserID); Msg.NavigateUrl = "msnim:chat?contact={0}".FormatWith(userData.Profile.MSN); //Msg.Attributes.Add( "onclick", "return skypeCheck();" ); Img.Src = "http://messenger.services.live.com/users/{0}/presenceimage".FormatWith(userData.Profile.MSN); } }
/// <summary> /// The page_ load. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (this.User == null) { YafBuildLink.AccessDenied(); } if (!this.IsPostBack) { // get user data... MembershipUser user = UserMembershipHelper.GetMembershipUserById(this.UserID); if (user == null) { YafBuildLink.AccessDenied(/*No such user exists*/); } string displayName = UserMembershipHelper.GetDisplayNameFromID(this.UserID); this.PageLinks.AddLink(this.PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); this.PageLinks.AddLink( this.PageContext.BoardSettings.EnableDisplayName ? displayName : user.UserName, YafBuildLink.GetLink(ForumPages.profile, "u={0}", this.UserID)); this.PageLinks.AddLink(this.GetText("TITLE"), string.Empty); // get full user data... var userData = new CombinedUserDataHelper(user, this.UserID); this.Msg.NavigateUrl = "skype:{0}?call".FormatWith(userData.Profile.Skype); this.Msg.Attributes.Add("onclick", "return skypeCheck();"); this.Img.Src = "http://mystatus.skype.com/bigclassic/{0}".FormatWith(userData.Profile.Skype); } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (this.User == null || !this.Get <YafBoardSettings>().AllowEmailSending) { YafBuildLink.AccessDenied(); } if (this.IsPostBack) { return; } // get user data... var user = UserMembershipHelper.GetMembershipUserById(this.UserId); if (user == null) { YafBuildLink.AccessDenied(/*No such user exists*/); } else { var displayName = UserMembershipHelper.GetDisplayNameFromID(this.UserId); this.PageLinks.AddRoot(); this.PageLinks.AddLink( this.PageContext.BoardSettings.EnableDisplayName ? displayName : user.UserName, YafBuildLink.GetLink( ForumPages.profile, "u={0}&name={1}", this.UserId, this.PageContext.BoardSettings.EnableDisplayName ? displayName : user.UserName)); this.PageLinks.AddLink(this.GetText("TITLE"), string.Empty); } }
/// <summary> /// The page_ load. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (this.User == null) { YafBuildLink.AccessDenied(); } if (!this.IsPostBack) { // get user data... MembershipUser user = UserMembershipHelper.GetMembershipUserById(this.UserID); if (user == null) { YafBuildLink.AccessDenied(/*No such user exists*/); } string displayName = UserMembershipHelper.GetDisplayNameFromID(this.UserID); this.PageLinks.AddLink(this.PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); this.PageLinks.AddLink(this.PageContext.BoardSettings.EnableDisplayName ? displayName : user.UserName, YafBuildLink.GetLink(ForumPages.profile, "u={0}", this.UserID)); this.PageLinks.AddLink(this.GetText("TITLE"), string.Empty); // get full user data... var userData = new CombinedUserDataHelper(user, this.UserID); this.Img.Src = "http://opi.yahoo.com/online?u={0}&m=g&t=2".FormatWith(userData.Profile.YIM); this.Msg.NavigateUrl = "http://edit.yahoo.com/config/send_webmesg?.target={0}&.src=pg".FormatWith(userData.Profile.YIM); } }
/// <summary> /// The page_ load. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (this.User == null || !this.PageContext.BoardSettings.AllowEmailSending) { YafBuildLink.AccessDenied(); } if (!this.IsPostBack) { // get user data... MembershipUser user = UserMembershipHelper.GetMembershipUserById(this.UserID); if (user == null) { YafBuildLink.AccessDenied(/*No such user exists*/); } string displayName = UserMembershipHelper.GetDisplayNameFromID(this.UserID); this.PageLinks.AddLink(this.PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); this.PageLinks.AddLink( !string.IsNullOrEmpty(displayName) ? displayName : user.UserName, YafBuildLink.GetLink(ForumPages.profile, "u={0}", this.UserID)); this.PageLinks.AddLink(this.GetText("TITLE"), string.Empty); this.Send.Text = this.GetText("SEND"); } }
/// <summary> /// Bans the user IP Addresses. /// </summary> private void BanUserIps() { var allIps = this.GetRepository <BannedIP>().Get(x => x.BoardID == this.PageContext.PageBoardID) .Select(x => x.Mask).ToList(); // ban user ips... var name = UserMembershipHelper.GetDisplayNameFromID(this.CurrentUserId?.ToType <int>() ?? -1); if (name.IsNotSet()) { name = UserMembershipHelper.GetUserNameFromID(this.CurrentUserId?.ToType <int>() ?? -1); } foreach (var ip in this.IPAddresses.Except(allIps).ToList()) { if (!ip.IsSet()) { continue; } var linkUserBan = this.Get <ILocalization>().GetTextFormatted( "ADMIN_EDITUSER", "LINK_USER_BAN", this.CurrentUserId, YafBuildLink.GetLink(ForumPages.profile, "u={0}&name={1}", this.CurrentUserId, name), this.HtmlEncode(name)); this.GetRepository <BannedIP>().Save(null, ip, linkUserBan, this.PageContext.PageUserID); } // Clear cache this.Get <IDataCache>().Remove(Constants.Cache.BannedIP); }
private string MatchUserBoxAvatar([NotNull] string userBox) { var filler = string.Empty; var rx = this.GetRegex(Constants.UserBox.Avatar); if (!this.PostDeleted) { var avatarUrl = this.Get <IAvatars>().GetAvatarUrlForUser(this.UserId); var displayName = this.Get <YafBoardSettings>().EnableDisplayName ? UserMembershipHelper.GetDisplayNameFromID(this.UserId) : UserMembershipHelper.GetUserNameFromID(this.UserId); if (avatarUrl.IsSet()) { filler = this.Get <YafBoardSettings>().UserBoxAvatar.FormatWith( @"<a href=""{1}"" title=""{2}""><img class=""avatarimage"" src=""{0}"" alt=""{2}"" title=""{2}"" /></a>" .FormatWith( avatarUrl, YafBuildLink.GetLinkNotEscaped(ForumPages.profile, "u={0}&name={1}", this.UserId, displayName), Page.HtmlEncode( displayName))); } } // replaces template placeholder with actual avatar userBox = rx.Replace(userBox, filler); return(userBox); }
protected void Page_Load(object sender, System.EventArgs e) { if (User == null) { YafBuildLink.AccessDenied(); } if (!IsPostBack) { // get user data... MembershipUser user = UserMembershipHelper.GetMembershipUserById(UserID); if (user == null) { YafBuildLink.AccessDenied(/*No such user exists*/); } string displayName = UserMembershipHelper.GetDisplayNameFromID(UserID); PageLinks.AddLink(PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); PageLinks.AddLink(!string.IsNullOrEmpty(displayName) ? displayName : user.UserName, YafBuildLink.GetLink(ForumPages.profile, "u={0}", UserID)); PageLinks.AddLink(GetText("TITLE"), ""); // get full user data... CombinedUserDataHelper userData = new CombinedUserDataHelper(user, UserID); Msg.NavigateUrl = "aim:goim?screenname={0}&message=Hi.+Are+you+there?".FormatWith(userData.Profile.AIM); Buddy.NavigateUrl = "aim:addbuddy?screenname={0}".FormatWith(userData.Profile.AIM); } }
protected void Page_Load(object sender, System.EventArgs e) { if (User == null) { YafBuildLink.AccessDenied(); } if (!IsPostBack) { Send.Text = GetText("SEND"); From.Text = PageContext.User.UserName; Email.Text = PageContext.User.Email; // get user data... MembershipUser user = UserMembershipHelper.GetMembershipUserById(UserID); if (user == null) { YafBuildLink.AccessDenied(/*No such user exists*/); } string displayName = UserMembershipHelper.GetDisplayNameFromID(UserID); PageLinks.AddLink(PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); PageLinks.AddLink(!string.IsNullOrEmpty(displayName) ? displayName : user.UserName, YafBuildLink.GetLink(ForumPages.profile, "u={0}", UserID)); PageLinks.AddLink(GetText("TITLE"), ""); // get full user data... CombinedUserDataHelper userData = new CombinedUserDataHelper(user, UserID); ViewState ["to"] = userData.Profile.ICQ; Status.Src = "http://web.icq.com/whitepages/online?icq={0}&img=5".FormatWith(userData.Profile.ICQ); } }
/// <summary> /// The page_ load. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (this.User == null) { YafBuildLink.AccessDenied(); } if (!this.IsPostBack) { // get user data... MembershipUser user = UserMembershipHelper.GetMembershipUserById(this.UserID); if (user == null) { YafBuildLink.AccessDenied(/*No such user exists*/); } string displayName = UserMembershipHelper.GetDisplayNameFromID(this.UserID); this.PageLinks.AddLink(this.PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); this.PageLinks.AddLink( this.PageContext.BoardSettings.EnableDisplayName ? displayName : user.UserName, YafBuildLink.GetLink(ForumPages.profile, "u={0}", this.UserID)); this.PageLinks.AddLink(this.GetText("TITLE"), string.Empty); // get full user data... var userData = new CombinedUserDataHelper(user, this.UserID); this.Msg.NavigateUrl = "aim:goim?screenname={0}&message=Hi.+Are+you+there?".FormatWith(userData.Profile.AIM); this.Buddy.NavigateUrl = "aim:addbuddy?screenname={0}".FormatWith(userData.Profile.AIM); } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (this.IsPostBack) { return; } var displayName = this.PageContext.BoardSettings.EnableDisplayName ? UserMembershipHelper.GetDisplayNameFromID(this.PageContext.PageUserID) : UserMembershipHelper.GetUserNameFromID(this.PageContext.PageUserID); this.PageLinks.Clear(); this.PageLinks.AddLink(this.PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); this.PageLinks.AddLink( displayName, YafBuildLink.GetLink(ForumPages.profile, "u={0}", this.PageContext.PageUserID, displayName)); this.PageLinks.AddLink(this.GetText("TITLE"), string.Empty); this.Back.Text = this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("t").IsNotSet() ? this.GetText("BACK") : this.GetText("COMMON", "CONTINUE"); this.BindData(); }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (!this.Get <YafBoardSettings>().EnableAlbum) { YafBuildLink.AccessDenied(); } if (this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("u") == null) { YafBuildLink.AccessDenied(); } var displayName = UserMembershipHelper.GetDisplayNameFromID( Security.StringToLongOrRedirect(this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("u"))); // Generate the Page Links. this.PageLinks.Clear(); this.PageLinks.AddRoot(); this.PageLinks.AddLink( this.Get <YafBoardSettings>().EnableDisplayName ? displayName : UserMembershipHelper.GetUserNameFromID( Security.StringToLongOrRedirect(this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("u"))), YafBuildLink.GetLink( ForumPages.profile, "u={0}", this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("u"))); this.PageLinks.AddLink(this.GetText("ALBUMS"), string.Empty); // Initialize the Album List control. this.AlbumList1.UserID = this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("u").ToType <int>(); }
/// <summary> /// Bans the user IP Addresses. /// </summary> private void BanUserIps() { var usr = LegacyDb.UserList( this.PageContext.PageBoardID, this.CurrentUserID.ToType <int?>(), null, null, null, false).FirstOrDefault(); if (usr != null) { this.Logger .Log( this.PageContext.PageUserID, "YAF.Controls.EditUsersKill", "User {0} was killed by {1}".FormatWith( this.Get <YafBoardSettings>().EnableDisplayName ? usr.DisplayName : usr.Name, this.Get <YafBoardSettings>().EnableDisplayName ? this.PageContext.CurrentUserData.DisplayName : this.PageContext.CurrentUserData.UserName), EventLogTypes.UserSuspended); } var allIps = this.GetRepository <BannedIP>().ListTyped().Select(x => x.Mask).ToList(); // ban user ips... string name = UserMembershipHelper.GetDisplayNameFromID( this.CurrentUserID == null ? -1 : this.CurrentUserID.ToType <int>()); if (name.IsNotSet()) { name = UserMembershipHelper.GetUserNameFromID( this.CurrentUserID == null ? -1 : this.CurrentUserID.ToType <int>()); } foreach (var ip in this.IPAddresses.Except(allIps).ToList()) { string linkUserBan = this.Get <ILocalization>() .GetText("ADMIN_EDITUSER", "LINK_USER_BAN") .FormatWith( this.CurrentUserID, YafBuildLink.GetLink(ForumPages.profile, "u={0}&name={1}", this.CurrentUserID, name), this.HtmlEncode(name)); this.GetRepository <BannedIP>().Save(null, ip, linkUserBan, this.PageContext.PageUserID); } if (this.SuspendUser.Checked && this.CurrentUserID > 0) { LegacyDb.user_suspend(this.CurrentUserID, DateTime.UtcNow.AddYears(5)); } }
/// <summary> /// The page_ load. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (this.User == null) { YafBuildLink.AccessDenied(); } if (!this.IsPostBack) { // get user data... var userHe = UserMembershipHelper.GetMembershipUserById(this.UserID); var displayNameHe = UserMembershipHelper.GetDisplayNameFromID(this.UserID); this.PageLinks.AddLink(this.PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); this.PageLinks.AddLink( this.PageContext.BoardSettings.EnableDisplayName ? displayNameHe : userHe.UserName, YafBuildLink.GetLink( ForumPages.profile, "u={0}&name={1}", this.UserID, this.PageContext.BoardSettings.EnableDisplayName ? displayNameHe : userHe.UserName)); this.PageLinks.AddLink(this.GetText("TITLE"), string.Empty); if (this.UserID == this.PageContext.PageUserID) { this.NotifyLabel.Text = this.GetText("SERVERYOU"); this.Alert.Type = MessageTypes.warning; } else { if (userHe == null) { YafBuildLink.AccessDenied(/*No such user exists*/); } // Data for current page user var userMe = UserMembershipHelper.GetMembershipUserById(this.PageContext.PageUserID); // get full user data... var userDataHe = new CombinedUserDataHelper(userHe, this.UserID); var userDataMe = new CombinedUserDataHelper(userMe, this.PageContext.PageUserID); var serverHe = userDataHe.Profile.XMPP .Substring(userDataHe.Profile.XMPP.IndexOf("@", StringComparison.Ordinal) + 1).Trim(); var serverMe = userDataMe.Profile.XMPP .Substring(userDataMe.Profile.XMPP.IndexOf("@", StringComparison.Ordinal) + 1).Trim(); this.NotifyLabel.Text = serverMe == serverHe ? this.GetTextFormatted("SERVERSAME", userDataHe.Profile.XMPP) : this.GetTextFormatted("SERVEROTHER", $"http://{serverHe}"); this.Alert.Type = MessageTypes.info; } } }
/// <summary> /// Add a new syndication person. /// </summary> /// <param name="userEmail">The email.</param> /// <param name="userId">The user Id.</param> /// <param name="userName">The user name.</param> /// <param name="userDisplayName"> The user dispaly name.</param> /// <returns>The SyndicationPerson.</returns> public static SyndicationPerson NewSyndicationPerson(string userEmail, long userId, string userName, string userDisplayName) { string userNameToShow; if (YafContext.Current.BoardSettings.EnableDisplayName) { userNameToShow = userDisplayName.IsNotSet() ? UserMembershipHelper.GetDisplayNameFromID(userId) : userDisplayName; } else { userNameToShow = userName.IsNotSet() ? UserMembershipHelper.GetUserNameFromID(userId) : userName; } return(new SyndicationPerson(userEmail, userNameToShow, YafBuildLink.GetLinkNotEscaped(ForumPages.profile, true, "u={0}", userId))); }
/// <summary> /// The page_ load. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> protected void Page_Load(object sender, EventArgs e) { if (User == null) { YafBuildLink.AccessDenied(); } if (!IsPostBack) { // get user data... MembershipUser userHe = UserMembershipHelper.GetMembershipUserById(this.UserID); string displayNameHe = UserMembershipHelper.GetDisplayNameFromID(this.UserID); this.PageLinks.AddLink(PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); this.PageLinks.AddLink(!string.IsNullOrEmpty(displayNameHe) ? displayNameHe : userHe.UserName, YafBuildLink.GetLink(ForumPages.profile, "u={0}", this.UserID)); this.PageLinks.AddLink(GetText("TITLE"), string.Empty); if (this.UserID == PageContext.PageUserID) { NotifyLabel.Text = GetText("SERVERYOU"); } else { if (userHe == null) { YafBuildLink.AccessDenied(/*No such user exists*/); } // Data for current page user MembershipUser userMe = UserMembershipHelper.GetMembershipUserById(PageContext.PageUserID); // get full user data... var userDataHe = new CombinedUserDataHelper(userHe, this.UserID); var userDataMe = new CombinedUserDataHelper(userMe, PageContext.PageUserID); string serverHe = userDataHe.Profile.XMPP.Substring(userDataHe.Profile.XMPP.IndexOf("@") + 1).Trim(); string serverMe = userDataMe.Profile.XMPP.Substring(userDataMe.Profile.XMPP.IndexOf("@") + 1).Trim(); if (serverMe == serverHe) { NotifyLabel.Text = GetTextFormatted("SERVERSAME", userDataHe.Profile.XMPP); } else { NotifyLabel.Text = GetTextFormatted("SERVEROTHER", "http://" + serverHe); } } } }
/// <summary> /// Creates page links for this page. /// </summary> protected override void CreatePageLinks() { // forum index this.PageLinks.AddLink(YafContext.Current.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); // users control panel string displayName = UserMembershipHelper.GetDisplayNameFromID(this.PageContext.PageUserID); this.PageLinks.AddLink(!string.IsNullOrEmpty(displayName) ? displayName : this.PageContext.PageUserName, YafBuildLink.GetLink(ForumPages.cp_profile)); // private messages this.PageLinks.AddLink(YafContext.Current.Localization.GetText(ForumPages.cp_pm.ToString(), "TITLE"), YafBuildLink.GetLink(ForumPages.cp_pm)); // post new message this.PageLinks.AddLink(GetText("TITLE")); }
/// <summary> /// Called when the page loads /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (this.IsPostBack) { return; } var umhdn = UserMembershipHelper.GetDisplayNameFromID(this.UserID); this.AlbumHeaderLabel.Param0 = this.Get <YafBoardSettings>().EnableDisplayName ? this.HtmlEncode(umhdn) : this.HtmlEncode(UserMembershipHelper.GetUserNameFromID(this.UserID)); this.BindData(); HttpContext.Current.Session["imagePreviewWidth"] = this.Get <YafBoardSettings>().ImageAttachmentResizeWidth; HttpContext.Current.Session["imagePreviewHeight"] = this.Get <YafBoardSettings>().ImageAttachmentResizeHeight; HttpContext.Current.Session["imagePreviewCropped"] = this.Get <YafBoardSettings>().ImageAttachmentResizeCropped; HttpContext.Current.Session["localizationFile"] = this.Get <ILocalization>().LanguageFileName; // Show Albums Max Info if (this.UserID == this.PageContext.PageUserID) { this.albumsInfo.Text = this.Get <ILocalization>().GetTextFormatted( "ALBUMS_INFO", this.PageContext.NumAlbums, this.PageContext.UsrAlbums); if (this.PageContext.UsrAlbums > this.PageContext.NumAlbums) { this.AddAlbum.Visible = true; } this.albumsInfo.Text = this.PageContext.UsrAlbums > 0 ? this.Get <ILocalization>().GetTextFormatted( "ALBUMS_INFO", this.PageContext.NumAlbums, this.PageContext.UsrAlbums) : this.Get <ILocalization>().GetText("ALBUMS_NOTALLOWED"); this.albumsInfo.Visible = true; } if (this.AddAlbum.Visible) { this.AddAlbum.TextLocalizedPage = "BUTTON"; this.AddAlbum.TextLocalizedTag = "BUTTON_ADDALBUM"; } }
/// <summary> /// The page load event. /// </summary> /// <param name = "sender"> /// the sender. /// </param> /// <param name = "e"> /// the e. /// </param> protected void Page_Load(object sender, EventArgs e) { if (!this.PageContext.BoardSettings.EnableAlbum) { YafBuildLink.AccessDenied(); } if (this.Request.QueryString.GetFirstOrDefault("u") == null) { YafBuildLink.AccessDenied(); } // setup jQuery, LightBox and YAF JS... YafContext.Current.PageElements.RegisterJQuery(); YafContext.Current.PageElements.RegisterJsResourceInclude("yafjs", "js/yaf.js"); YafContext.Current.PageElements.RegisterJsBlock("toggleMessageJs", JavaScriptBlocks.ToggleMessageJs); // lightbox only need if the browser is not IE6... if (!UserAgentHelper.IsBrowserIE6()) { YafContext.Current.PageElements.RegisterJsResourceInclude("lightboxjs", "js/jquery.lightbox.min.js"); YafContext.Current.PageElements.RegisterCssIncludeResource("css/jquery.lightbox.css"); YafContext.Current.PageElements.RegisterJsBlock("lightboxloadjs", JavaScriptBlocks.LightBoxLoadJs); } string displayName = UserMembershipHelper.GetDisplayNameFromID( Security.StringToLongOrRedirect(this.Request.QueryString.GetFirstOrDefault("u"))); // Generate the Page Links. this.PageLinks.Clear(); this.PageLinks.AddLink(this.PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); this.PageLinks.AddLink( displayName.IsSet() ? displayName : UserMembershipHelper.GetUserNameFromID( Security.StringToLongOrRedirect(this.Request.QueryString.GetFirstOrDefault("u"))), YafBuildLink.GetLink(ForumPages.profile, "u={0}", this.Request.QueryString.GetFirstOrDefault("u"))); this.PageLinks.AddLink(this.GetText("ALBUMS"), string.Empty); // Initialize the Album List control. this.AlbumList1.UserID = this.Request.QueryString.GetFirstOrDefault("u").ToType <int>(); }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.PreRender"/> event. /// </summary> /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param> protected override void OnPreRender([NotNull] EventArgs e) { CodeContracts.VerifyNotNull(this.MessageFlags, "MessageFlags"); this.MessageID = this.CurrentMessage.ID; if (!this.MessageFlags.IsDeleted) { // populate DisplayUserID if (!UserMembershipHelper.IsGuestUser(this.CurrentMessage.UserID)) { this.DisplayUserID = this.CurrentMessage.UserID; } this.IsAlt = this.IsAltMessage; this.RowColSpan = this.ColSpan; if (this.ShowAttachments) { if (this.CurrentMessage.HasAttachments ?? false) { // add attached files control... var attached = new MessageAttached { MessageID = this.CurrentMessage.ID }; if (this.CurrentMessage.UserID > 0 && YafContext.Current.Get <YafBoardSettings>().EnableDisplayName) { attached.UserName = UserMembershipHelper.GetDisplayNameFromID(this.CurrentMessage.UserID); } else { attached.UserName = this.CurrentMessage.UserName; } this.Controls.Add(attached); } } } base.OnPreRender(e); }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (!this.Get <BoardSettings>().EnableAlbum) { BuildLink.AccessDenied(); } if (!this.Get <HttpRequestBase>().QueryString.Exists("u")) { BuildLink.AccessDenied(); } var userId = Security.StringToLongOrRedirect(this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("u")); var user = UserMembershipHelper.GetMembershipUserById(userId); if (user == null) { // No such user exists BuildLink.AccessDenied(); } if (user.IsApproved == false) { BuildLink.AccessDenied(); } var displayName = UserMembershipHelper.GetDisplayNameFromID(userId); // Generate the Page Links. this.PageLinks.Clear(); this.PageLinks.AddRoot(); this.PageLinks.AddLink( this.Get <BoardSettings>().EnableDisplayName ? displayName : UserMembershipHelper.GetUserNameFromID(userId), BuildLink.GetLink(ForumPages.Profile, "u={0}", userId)); this.PageLinks.AddLink(this.GetText("ALBUMS"), string.Empty); // Initialize the Album List control. this.AlbumList1.UserID = userId.ToType <int>(); }
/// <summary> /// Called when the page loads /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (this.IsPostBack) { return; } this.IconHeader.Param0 = this.HtmlEncode( this.Get <BoardSettings>().EnableDisplayName ? UserMembershipHelper.GetDisplayNameFromID(this.UserID) : UserMembershipHelper.GetUserNameFromID(this.UserID)); this.BindData(); HttpContext.Current.Session["localizationFile"] = this.Get <ILocalization>().LanguageFileName; // Show Albums Max Info if (this.UserID == this.PageContext.PageUserID) { this.albumsInfo.Text = this.Get <ILocalization>().GetTextFormatted( "ALBUMS_INFO", this.PageContext.NumAlbums, this.PageContext.UsrAlbums); if (this.PageContext.UsrAlbums > this.PageContext.NumAlbums) { this.AddAlbum.Visible = true; } this.albumsInfo.Text = this.PageContext.UsrAlbums > 0 ? this.Get <ILocalization>().GetTextFormatted( "ALBUMS_INFO", this.PageContext.NumAlbums, this.PageContext.UsrAlbums) : this.Get <ILocalization>().GetText("ALBUMS_NOTALLOWED"); this.albumsInfo.Visible = true; } if (!this.AddAlbum.Visible) { return; } this.AddAlbum.TextLocalizedPage = "BUTTON"; this.AddAlbum.TextLocalizedTag = "BUTTON_ADDALBUM"; }
/// <summary> /// The Page_ Load Event. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { var userID = (int)Security.StringToLongOrRedirect(this.Request.QueryString.GetFirstOrDefault("u")); if (!this.IsPostBack) { this.PageLinks.Clear(); this.PageLinks.AddLink(this.PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); this.PageLinks.AddLink( this.PageContext.BoardSettings.EnableDisplayName ? UserMembershipHelper.GetDisplayNameFromID(userID) : UserMembershipHelper.GetUserNameFromID(userID), YafBuildLink.GetLink(ForumPages.profile, "u={0}", userID)); this.PageLinks.AddLink(this.GetText("TITLE"), string.Empty); } DataTable thanksInfo = LegacyDb.user_viewallthanks(userID, this.PageContext.PageUserID); this.InitializeThanksList(this.ThanksFromList, ThanksListMode.FromUser, userID, thanksInfo); this.InitializeThanksList(this.ThanksToList, ThanksListMode.ToUser, userID, thanksInfo); }
/* Methods */ #region Methods /// <summary> /// The Page_ Load Event. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> protected void Page_Load(object sender, EventArgs e) { var userID = (int)Security.StringToLongOrRedirect(this.Request.QueryString.GetFirstOrDefault("u")); string displayName = UserMembershipHelper.GetDisplayNameFromID(userID); if (!IsPostBack) { this.PageLinks.Clear(); this.PageLinks.AddLink(this.PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); this.PageLinks.AddLink(!string.IsNullOrEmpty(displayName) ? displayName : UserMembershipHelper.GetUserNameFromID(userID), YafBuildLink.GetLink(ForumPages.profile, "u={0}", userID)); this.PageLinks.AddLink(this.GetText("TITLE"), string.Empty); } DataTable thanksInfo = DB.user_viewallthanks(userID, PageContext.PageUserID); InitializeThanksList(ThanksFromList, ThanksListMode.FromUser, userID, thanksInfo); InitializeThanksList(ThanksToList, ThanksListMode.ToUser, userID, thanksInfo); // Set the DNA Views' titles. this.ThanksTabs.Views[0].Text = this.GetText("VIEWTHANKS", "ThanksFromUser").FormatWith(displayName); this.ThanksTabs.Views[1].Text = this.GetText("VIEWTHANKS", "ThanksToUser").FormatWith(displayName); }
/// <summary> /// A method to get profile path string. /// </summary> /// <param name="forumPageAttributes"> /// The forum page attributes. /// </param> /// <returns> /// The profile. /// </returns> private string Profile([NotNull] string forumPageAttributes) { var outstring = string.Empty; var userId = forumPageAttributes.Substring(forumPageAttributes.IndexOf("u=", StringComparison.Ordinal) + 2); userId = userId.Contains("&") ? userId.Substring(0, userId.IndexOf("&", StringComparison.Ordinal)).Trim() : userId.Substring(0).Trim(); if (ValidationHelper.IsValidInt(userId.Trim())) { if (userId.ToType <int>() != this.UserID) { var displayName = HttpUtility.HtmlEncode(UserMembershipHelper.GetDisplayNameFromID(userId.ToType <long>())); if (displayName.IsNotSet()) { displayName = HttpUtility.HtmlEncode(UserMembershipHelper.GetUserNameFromID(userId.ToType <long>())); } outstring += this.GetText("ACTIVELOCATION", "PROFILE_OFUSER").FormatWith(); outstring += @"<a href=""{0}"" id=""profileuserid_{1}"" title=""{2}"" alt=""{2}"" runat=""server""> {3} </a>" .FormatWith( YafBuildLink.GetLink(ForumPages.profile, "u={0}&name={1}", userId, displayName), userId + this.PageContext.PageUserID, this.GetText("COMMON", "VIEW_USRPROFILE"), HttpUtility.HtmlEncode(displayName)); } else { outstring += this.GetText("ACTIVELOCATION", "PROFILE_OWN").FormatWith(); } } else { outstring += this.GetText("ACTIVELOCATION", "PROFILE").FormatWith(); } return(outstring); }
/// <summary> /// The page_ load. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (this.User == null) { YafBuildLink.AccessDenied(); } if (!this.IsPostBack) { this.Send.Text = this.GetText("SEND"); this.From.Text = this.PageContext.User.UserName; this.Email.Text = this.PageContext.User.Email; // get user data... MembershipUser user = UserMembershipHelper.GetMembershipUserById(this.UserID); if (user == null) { YafBuildLink.AccessDenied(/*No such user exists*/); } string displayName = UserMembershipHelper.GetDisplayNameFromID(this.UserID); this.PageLinks.AddLink(this.PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); this.PageLinks.AddLink( this.PageContext.BoardSettings.EnableDisplayName ? displayName : user.UserName, YafBuildLink.GetLink( ForumPages.profile, "u={0}&name={1}", this.UserID, this.PageContext.BoardSettings.EnableDisplayName ? displayName : user.UserName)); this.PageLinks.AddLink(this.GetText("TITLE"), string.Empty); // get full user data... var userData = new CombinedUserDataHelper(user, this.UserID); this.ViewState["to"] = userData.Profile.ICQ; this.Status.Src = "http://web.icq.com/whitepages/online?icq={0}&img=5".FormatWith(userData.Profile.ICQ); } }
/// <summary> /// The ban user ips. /// </summary> private void BanUserIps() { var ips = IPAddresses; var allIps = DB.bannedip_list(PageContext.PageBoardID, null).GetColumnAsList <string>("Mask").ToList(); // remove all IPs from ips if they already exist in allIps... ips.RemoveAll(allIps.Contains); // ban user ips... string name = UserMembershipHelper.GetDisplayNameFromID(this.CurrentUserID == null? -1: (int)this.CurrentUserID); if (string.IsNullOrEmpty(name)) { name = UserMembershipHelper.GetUserNameFromID(this.CurrentUserID == null ? -1 : (int)this.CurrentUserID); } IPAddresses.ForEach(x => DB.bannedip_save(null, PageContext.PageBoardID, x, @"User <a id=""usr{0}"" href=""{1}"">{2}</a> is banned by IP".FormatWith(this.CurrentUserID, YafBuildLink.GetLink(ForumPages.profile, "u={0}", this.CurrentUserID), this.HtmlEncode(name)), this.PageContext.PageUserID)); // clear cache of banned IPs for this board PageContext.Cache.Remove(YafCache.GetBoardCacheKey(Constants.Cache.BannedIP)); }
private SimpleTopic LoadSimpleTopic([NotNull] DataRow row, [NotNull] SimpleForum forum) { CodeContracts.VerifyNotNull(row, "row"); CodeContracts.VerifyNotNull(forum, "forum"); return(new SimpleTopic { TopicID = row.Field <int>("TopicID"), CreatedDate = row.Field <DateTime>("Posted"), Subject = row.Field <string>("Subject"), StartedUserID = row.Field <int>("UserID"), StartedUserName = UserMembershipHelper.GetDisplayNameFromID(row.Field <int>("UserID")), Replies = row.Field <int>("Replies"), LastPostDate = row.Field <DateTime>("LastPosted"), LastUserID = row.Field <int>("LastUserID"), LastUserName = UserMembershipHelper.GetDisplayNameFromID(row.Field <int>("LastUserID")), LastMessageID = row.Field <int>("LastMessageID"), FirstMessage = row.Field <string>("FirstMessage"), LastMessage = LegacyDb.MessageList(row.Field <int>("LastMessageID")).First().Message, Forum = forum }); }
/// <summary> /// The page_ load. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (this.User == null) { YafBuildLink.AccessDenied(); } if (!this.IsPostBack) { // get user data... var user = UserMembershipHelper.GetMembershipUserById(this.UserID); if (user == null) { YafBuildLink.AccessDenied(/*No such user exists*/); } var displayName = UserMembershipHelper.GetDisplayNameFromID(this.UserID); this.PageLinks.AddLink(this.PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); this.PageLinks.AddLink( this.PageContext.BoardSettings.EnableDisplayName ? displayName : user.UserName, YafBuildLink.GetLink( ForumPages.profile, "u={0}&name={1}", this.UserID, this.PageContext.BoardSettings.EnableDisplayName ? displayName : user.UserName)); this.PageLinks.AddLink(this.GetText("TITLE"), string.Empty); // get full user data... var userData = new CombinedUserDataHelper(user, this.UserID); this.Msg.NavigateUrl = "msnim:chat?contact={0}".FormatWith(userData.Profile.MSN); // Msg.Attributes.Add( "onclick", "return skypeCheck();" ); this.Img.Src = "http://messenger.services.live.com/users/{0}/presenceimage".FormatWith(userData.Profile.MSN); } }