/// <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; } this.PageLinks.AddRoot(); this.PageLinks.AddLink( this.Get <BoardSettings>().EnableDisplayName ? this.PageContext.CurrentUserData.DisplayName : this.PageContext.PageUserName, BuildLink.GetLink(ForumPages.cp_profile)); this.ActivityPlaceHolder.Visible = this.Get <BoardSettings>().EnableActivityStream; }
/// <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; } this.PageLinks.AddRoot() .AddLink(this.GetText("ADMIN_ADMIN", "Administration"), BuildLink.GetLink(ForumPages.admin_admin)) .AddLink(this.GetText("ADMIN_REPLACEWORDS", "TITLE")); this.Page.Header.Title = $"{this.GetText("ADMIN_ADMIN", "Administration")} - {this.GetText("ADMIN_REPLACEWORDS", "TITLE")}"; this.BindData(); }
/// <summary> /// Creates navigation page links on top of forum (breadcrumbs). /// </summary> protected override void CreatePageLinks() { // beard index this.PageLinks.AddLink(this.PageContext.BoardSettings.Name, BuildLink.GetLink(ForumPages.forum)); // administration index this.PageLinks.AddLink( this.GetText("ADMIN_ADMIN", "Administration"), BuildLink.GetLink(ForumPages.Admin_Admin)); // current page label (no link) this.PageLinks.AddLink(this.GetText("ADMIN_PAGEACCESSEDIT", "TITLE"), string.Empty); this.Page.Header.Title = $"{this.GetText("ADMIN_ADMIN", "Administration")} - {this.GetText("ADMIN_PAGEACCESSLIST", "TITLE")} - {this.GetText("ADMIN_PAGEACCESSEDIT", "TITLE")}"; }
/// <summary> /// Creates navigation page links on top of forum (breadcrumbs). /// </summary> protected override void CreatePageLinks() { // link to board index this.PageLinks.AddRoot(); // link to administration index this.PageLinks.AddLink( this.GetText("ADMIN_ADMIN", "Administration"), BuildLink.GetLink(ForumPages.admin_admin)); // current page label (no link) this.PageLinks.AddLink(this.GetText("ADMIN_USERS", "TITLE"), string.Empty); this.Page.Header.Title = $"{this.GetText("ADMIN_ADMIN", "Administration")} - {this.GetText("ADMIN_USERS", "TITLE")}"; }
/// <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="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { this.LoadHelpContent(); if (this.IsPostBack) { return; } this.PageLinks.AddRoot(); this.PageLinks.AddLink( this.GetText("SUBTITLE"), BuildLink.GetLink(ForumPages.Help)); if (this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("faq").IsSet()) { var faqPage = this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("faq"); if (faqPage.Equals("index")) { faqPage = "SEARCHHELP"; } this.PageLinks.AddLink( this.GetText( "HELP_INDEX", $"{faqPage}TITLE"), string.Empty); this.Page.Header.Title = $"{this.GetText("SUBTITLE")} - {this.GetText("HELP_INDEX", $"{faqPage}TITLE")}"; this.BindData(); } else { this.PageLinks.AddLink(this.GetText("HELP_INDEX", "SEARCHHELPTITLE"), string.Empty); this.Page.Header.Title = $"{this.GetText("SUBTITLE")} - {this.GetText("HELP_INDEX", "SEARCHHELPTITLE")}"; // Load Index and Search this.SearchHolder.Visible = true; this.SubTitle.Text = this.GetText("subtitle"); this.HelpContent.Text = this.GetText("welcome"); } }
/// <summary> /// Binds the data. /// </summary> private void BindData() { this.ViewPostsLink.NavigateUrl = BuildLink.GetLink( ForumPages.Search, "postedby={0}", !this.User.Item1.IsGuest.Value ? this.Get <IUserDisplayName>().GetName(this.User.Item1) : this.Get <IAspNetUsersHelper>().GuestUserName); this.ReportUserRow.Visible = this.Get <BoardSettings>().StopForumSpamApiKey.IsSet(); // load ip address history for user... this.IPAddresses.Take(5).ForEach( ipAddress => this.IpAddresses.Text += $@"<a href=""{string.Format(this.Get<BoardSettings>().IPInfoPageURL, ipAddress)}"" target=""_blank"" title=""{this.GetText("COMMON", "TT_IPDETAILS")}""> {ipAddress} </a> <br />"); // if no ip disable BanIp checkbox if (!this.IPAddresses.Any()) { this.BanIps.Checked = false; this.BanIps.Enabled = false; this.ReportUserRow.Visible = false; } // show post count... this.PostCount.Text = this.AllPostsByUser.Count().ToString(); // get user's info this.CurrentUser = this.GetRepository <User>().GetById( this.CurrentUserId); if (this.CurrentUser.Suspended.HasValue) { this.SuspendedTo.Visible = true; // is user suspended? this.SuspendedTo.Text = $"<div class=\"alert alert-info\" role=\"alert\">{this.GetText("PROFILE", "ENDS")} {this.Get<IDateTime>().FormatDateTime(this.CurrentUser.Suspended)}</div>"; } this.DataBind(); }
/// <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 user = UserMembershipHelper.GetMembershipUserById( Security.StringToLongOrRedirect(this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("u"))); if (user == null) { // No such user exists BuildLink.AccessDenied(); } if (user.IsApproved == false) { BuildLink.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 <BoardSettings>().EnableDisplayName ? displayName : UserMembershipHelper.GetUserNameFromID( Security.StringToLongOrRedirect( this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("u"))), BuildLink.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> /// Render Admin database sub menu /// </summary> /// <param name="pagesAccess"> /// The pages access. /// </param> private void RenderAdminDatabase(IReadOnlyCollection <AdminPageUserAccess> pagesAccess) { RenderMenuItem( this.MenuHolder, "dropdown-item dropdown-toggle subdropdown-toggle", this.GetText("ADMINMENU", "Database"), "#", this.PageContext.ForumPageType == ForumPages.Admin_ReIndex || this.PageContext.ForumPageType == ForumPages.Admin_RunSql, true, "database"); var list = new HtmlGenericControl("ul"); list.Attributes.Add("class", "dropdown-menu dropdown-submenu"); // Admin ReIndex if (this.PageContext.IsHostAdmin || pagesAccess.Any( x => x.PageName == "Admin_ReIndex")) { RenderMenuItem( list, "dropdown-item dropdown", this.GetText("ADMINMENU", "admin_ReIndex"), BuildLink.GetLink(ForumPages.Admin_ReIndex), this.PageContext.ForumPageType == ForumPages.Admin_ReIndex, false, "database"); } // Admin RunSql if (this.PageContext.IsHostAdmin || pagesAccess.Any( x => x.PageName == "Admin_RunSql")) { RenderMenuItem( list, "dropdown-item dropdown", this.GetText("ADMINMENU", "admin_RunSql"), BuildLink.GetLink(ForumPages.Admin_RunSql), this.PageContext.ForumPageType == ForumPages.Admin_RunSql, false, "database"); } this.MenuHolder.Controls.Add(list); }
/// <summary> /// Sends a spam bot notification to admins. /// </summary> /// <param name="user">The user.</param> /// <param name="userId">The user id.</param> public void SendSpamBotNotificationToAdmins([NotNull] AspNetUsers user, int userId) { // Get Admin Group ID var adminGroupId = this.GetRepository <Group>().List(boardId: BoardContext.Current.PageBoardID) .Where(group => group.Name.Contains("Admin")).Select(group => group.ID).FirstOrDefault(); if (adminGroupId <= 0) { return; } var emails = this.GetRepository <User>().GroupEmails(adminGroupId); emails.ForEach( email => { var emailAddress = email; if (emailAddress.IsNotSet()) { return; } var subject = this.Get <ILocalization>().GetTextFormatted( "COMMON", "NOTIFICATION_ON_BOT_USER_REGISTER_EMAIL_SUBJECT", this.BoardSettings.Name); var notifyAdmin = new TemplateEmail("NOTIFICATION_ON_BOT_USER_REGISTER") { TemplateParams = { ["{adminlink}"] = BuildLink.GetLink( ForumPages.Admin_EditUser, true, "u={0}", userId), ["{user}"] = user.UserName, ["{email}"] = user.Email } }; notifyAdmin.SendEmail(new MailAddress(emailAddress), subject); }); }
/// <summary> /// Adds the Reply to the User's ActivityStream /// </summary> /// <param name="forumID">The forum unique identifier.</param> /// <param name="topicID">The topic unique identifier.</param> /// <param name="messageID">The message unique identifier.</param> /// <param name="topicTitle">The topic title.</param> /// <param name="message">The message.</param> public void AddReplyToStream(int forumID, long topicID, int messageID, string topicTitle, string message) { message = BBCodeHelper.StripBBCode( HtmlHelper.StripHtml(HtmlHelper.CleanHtmlString(message))) .RemoveMultipleWhitespace(); var user = UserController.Instance.GetCurrentUserInfo(); var portalSettings = PortalSettings.Current; var ji = new JournalItem { PortalId = portalSettings.PortalId, ProfileId = user.UserID, UserId = user.UserID, Title = topicTitle, ItemData = new ItemData { Url = BuildLink.GetLink( ForumPages.Posts, "m={0}#post{0}", messageID) }, Summary = message.Truncate(150), Body = message, JournalTypeId = 6, SecuritySet = GetSecuritySet(forumID, portalSettings.PortalId), ObjectKey = $"{forumID.ToString()}:{topicID.ToString()}:{messageID.ToString()}" }; if (JournalController.Instance.GetJournalItemByKey(portalSettings.PortalId, ji.ObjectKey) != null) { JournalController.Instance.DeleteJournalItemByKey(portalSettings.PortalId, ji.ObjectKey); } // TODO: /*if (SocialGroupId > 0) * { * ji.SocialGroupId = SocialGroupId; * }*/ JournalController.Instance.SaveJournalItem(ji, -1); }
/// <summary> /// The render menu item. /// </summary> /// <param name="stringBuilder"> /// The string builder. /// </param> /// <param name="cssClass"> /// The CSS class. /// </param> /// <param name="page"> /// The page. /// </param> /// <param name="getText"> /// The get text. /// </param> /// <param name="icon"> /// The icon. /// </param> /// <param name="parameter"> /// The URL Parameter /// </param> private void RenderMenuItem( StringBuilder stringBuilder, string cssClass, ForumPages page, string getText, string icon, string parameter = null) { stringBuilder.AppendFormat( this.PageContext.ForumPageType == page ? @"<a class=""{3} active"" href=""{0}"" title=""{2}"" data-toggle=""tooltip""><i class=""fas fa-{4} mr-1 text-light""></i>{1}</a>" : @"<a class=""{3}"" href=""{0}"" title=""{2}"" data-toggle=""tooltip""><i class=""fas fa-{4} mr-1 text-secondary""></i>{1}</a>", parameter.IsSet() ? BuildLink.GetLink(page, parameter) : BuildLink.GetLink(page), getText, getText, cssClass, icon); }
/// <summary> /// Creates page links for this page. /// </summary> protected override void CreatePageLinks() { // forum index this.PageLinks.AddRoot(); // users control panel this.PageLinks.AddLink( this.Get <IUserDisplayName>().GetName(this.PageContext.CurrentUser), BuildLink.GetLink(ForumPages.MyAccount)); // private messages this.PageLinks.AddLink( this.GetText(ForumPages.MyMessages.ToString(), "TITLE"), BuildLink.GetLink(ForumPages.MyMessages)); // post new message this.PageLinks.AddLink(this.GetText("TITLE")); }
/// <summary> /// The manage variable value. /// </summary> /// <param name="variableName"> /// The variable name. /// </param> /// <param name="variableValue"> /// The variable value. /// </param> /// <param name="handlingValue"> /// The handling value. /// </param> /// <returns> /// The <see cref="string"/>. /// </returns> protected override string ManageVariableValue(string variableName, string variableValue, string handlingValue) { if (variableName != "post" && variableName != "topic") { return(variableValue); } if (!int.TryParse(variableValue, out var id)) { return(variableValue); } return(variableName switch { "post" => BuildLink.GetLink(ForumPages.Posts, "m={0}#post{0}", id), "topic" => BuildLink.GetLink(ForumPages.Posts, "t={0}", id), _ => variableValue });
/// <summary> /// Creates page links for this page. /// </summary> protected override void CreatePageLinks() { // forum index this.PageLinks.AddRoot(); // administration index this.PageLinks.AddAdminIndex(); this.PageLinks.AddLink( this.GetText("ADMIN_MEDALS", "TITLE"), BuildLink.GetLink(ForumPages.Admin_Medals)); // current page label (no link) this.PageLinks.AddLink(this.GetText("ADMIN_EDITMEDAL", "TITLE"), string.Empty); this.Page.Header.Title = $"{this.GetText("ADMIN_ADMIN", "Administration")} - {this.GetText("ADMIN_MEDALS", "TITLE")} - {this.GetText("ADMIN_EDITMEDAL", "TITLE")}"; }
/// <summary> /// Creates navigation page links on top of forum (breadcrumbs). /// </summary> protected override void CreatePageLinks() { // beard index this.PageLinks.AddRoot(); // administration index this.PageLinks.AddAdminIndex(); this.PageLinks.AddLink( this.GetText("ADMIN_ACCESSMASKS", "TITLE"), BuildLink.GetLink(ForumPages.Admin_AccessMasks)); // current page label (no link) this.PageLinks.AddLink(this.GetText("ADMIN_EDITACCESSMASKS", "TITLE"), string.Empty); this.Page.Header.Title = $"{this.GetText("ADMIN_ADMIN", "Administration")} - {this.GetText("ADMIN_ACCESSMASKS", "TITLE")} - {this.GetText("ADMIN_EDITACCESSMASKS", "TITLE")}"; }
/// <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="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (this.IsPostBack) { return; } this.BindData(); this.PageLinks.AddRoot(); this.PageLinks.AddLink( this.Get <BoardSettings>().EnableDisplayName ? this.PageContext.CurrentUserData.DisplayName : this.PageContext.PageUserName, BuildLink.GetLink(ForumPages.Account)); this.PageLinks.AddLink(this.GetText("TITLE"), string.Empty); this.DailyDigestRow.Visible = this.Get <BoardSettings>().AllowDigestEmail; this.PMNotificationRow.Visible = this.Get <BoardSettings>().AllowPMEmailNotification; var items = EnumHelper.EnumToDictionary <UserNotificationSetting>(); if (!this.Get <BoardSettings>().AllowNotificationAllPostsAllTopics) { // remove it... items.Remove(UserNotificationSetting.AllTopics.ToInt()); } this.rblNotificationType.Items.AddRange( items.Select(x => new ListItem(this.GetText(x.Value), x.Key.ToString())).ToArray()); var setting = this.rblNotificationType.Items.FindByValue( this.PageContext.CurrentUserData.NotificationSetting.ToInt().ToString()) ?? this.rblNotificationType.Items.FindByValue(0.ToString()); if (setting != null) { setting.Selected = true; } // update the ui... this.UpdateSubscribeUi(this.PageContext.CurrentUserData.NotificationSetting); }
/// <summary> /// Render Admin Upgrade sub menu /// </summary> /// <param name="pagesAccess"> /// The pages access. /// </param> private void RenderAdminUpgrade(IReadOnlyCollection <AdminPageUserAccess> pagesAccess) { RenderMenuItem( this.MenuHolder, "dropdown-item dropdown-toggle subdropdown-toggle", this.GetText("ADMINMENU", "Upgrade"), "#", this.PageContext.ForumPageType == ForumPages.Admin_Version, true, "download"); var list = new HtmlGenericControl("ul"); list.Attributes.Add("class", "dropdown-menu dropdown-submenu"); // Admin Version if (this.PageContext.IsHostAdmin || pagesAccess.Any( x => x.PageName == "Admin_Version")) { RenderMenuItem( list, "dropdown-item dropdown", this.GetText("ADMINMENU", "admin_Version"), BuildLink.GetLink(ForumPages.Admin_Version), this.PageContext.ForumPageType == ForumPages.Admin_Version, false, "info"); } // Admin Version if (this.PageContext.IsHostAdmin) { RenderMenuItem( list, "dropdown-item dropdown", this.GetText("ADMINMENU", "Upgrade"), this.ResolveUrl("~/install/default.aspx"), false, false, "download"); } this.MenuHolder.Controls.Add(list); }
/// <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 <HttpRequestBase>().QueryString.Exists("t") || !this.PageContext.ForumReadAccess || !this.PageContext.BoardSettings.AllowEmailTopic) { BuildLink.AccessDenied(); } if (this.IsPostBack) { return; } if (this.PageContext.Settings.LockedForum == 0) { this.PageLinks.AddLink(this.PageContext.BoardSettings.Name, BuildLink.GetLink(ForumPages.forum)); this.PageLinks.AddLink( this.PageContext.PageCategoryName, BuildLink.GetLink(ForumPages.forum, "c={0}", this.PageContext.PageCategoryID)); } this.PageLinks.AddForum(this.PageContext.PageForumID); this.PageLinks.AddLink( this.PageContext.PageTopicName, BuildLink.GetLink(ForumPages.posts, "t={0}", this.PageContext.PageTopicID)); this.Subject.Text = this.PageContext.PageTopicName; var emailTopic = new TemplateEmail { TemplateParams = { ["{link}"] = BuildLink.GetLinkNotEscaped( ForumPages.posts, true, "t={0}", this.PageContext.PageTopicID), ["{user}"] = this.PageContext.PageUserName } }; this.Message.Text = emailTopic.ProcessTemplate("EMAILTOPIC"); }
/// <summary> /// The send password reset. /// </summary> /// <param name="user"> /// The user. /// </param> /// <param name="code"> /// The code. /// </param> public void SendPasswordReset([NotNull] AspNetUsers user, [NotNull] string code) { // re-send verification email instead of lost password... var verifyEmail = new TemplateEmail("RESET_PASS"); var subject = this.Get <ILocalization>().GetTextFormatted( "RESET_PASS_EMAIL_SUBJECT", this.Get <BoardSettings>().Name); verifyEmail.TemplateParams["{link}"] = BuildLink.GetLink( ForumPages.Account_ResetPassword, true, "code={0}", code); verifyEmail.TemplateParams["{forumname}"] = this.Get <BoardSettings>().Name; verifyEmail.TemplateParams["{forumlink}"] = $"{BoardInfo.ForumURL}"; verifyEmail.SendEmail(new MailAddress(user.Email, user.UserName), subject); }
/// <summary> /// The page_ load. /// </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.PageContext.ForumModeratorAccess) { BuildLink.AccessDenied(); } if (!this.PageContext.IsForumModerator || !this.PageContext.IsAdmin) { this.ModerateUsersHolder.Visible = false; } if (!this.IsPostBack) { if (this.PageContext.Settings.LockedForum == 0) { this.PageLinks.AddRoot(); this.PageLinks.AddLink( this.PageContext.PageCategoryName, BuildLink.GetLink(ForumPages.forum, "c={0}", this.PageContext.PageCategoryID)); } this.PageLinks.AddForum(this.PageContext.PageForumID); this.PageLinks.AddLink(this.GetText("MODERATE", "TITLE"), string.Empty); this.PagerTop.PageSize = 25; var showMoved = this.Get <BoardSettings>().ShowMoved; // Ederon : 7/14/2007 - by default, leave pointer is set on value defined on host level this.LeavePointer.Checked = showMoved; this.trLeaveLink.Visible = showMoved; this.trLeaveLinkDays.Visible = showMoved; if (showMoved) { this.LinkDays.Text = "1"; } } this.BindData(); }
/// <summary> /// Handles the PreRender event of the ForumPage control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> private void CurrentForumPage_PreRender([NotNull] object sender, [NotNull] EventArgs e) { const string TopicLinkParams = "t={0}&name={1}"; var head = this.ForumControl.Page.Header ?? this.CurrentForumPage.FindControlRecursiveBothAs <HtmlHead>("YafHead"); if (head == null) { return; } // in cases where we are not going to index, but follow, we will not add a canonical tag. if (this.ForumPageType == ForumPages.Posts) { if (this.Get <HttpRequestBase>().QueryString.Exists("m") || this.Get <HttpRequestBase>().QueryString.Exists("find")) { // add no-index tag head.Controls.Add(ControlHelper.MakeMetaNoIndexControl()); } else { var topicUrl = BuildLink.GetLink( ForumPages.Posts, true, TopicLinkParams, this.PageContext.PageTopicID, this.PageContext.PageTopicName); head.Controls.Add(new LiteralControl($"<link rel=\"canonical\" href=\"{topicUrl}\" />")); } } else if (this.ForumPageType != ForumPages.Board && this.ForumPageType != ForumPages.Topics) { // there is not much SEO value to having lists indexed // because they change as soon as some adds a new topic // or post so don't index them, but follow the links // add no-index tag head.Controls.Add(ControlHelper.MakeMetaNoIndexControl()); } }
/// <summary> /// Creates page links for this page. /// </summary> protected override void CreatePageLinks() { // forum index this.PageLinks.AddRoot(); // users control panel this.PageLinks.AddLink( this.Get <BoardSettings>().EnableDisplayName ? this.PageContext.CurrentUserData.DisplayName : this.PageContext.PageUserName, BuildLink.GetLink(ForumPages.Account)); // private messages this.PageLinks.AddLink( this.GetText(ForumPages.PM.ToString(), "TITLE"), BuildLink.GetLink(ForumPages.PM)); // post new message this.PageLinks.AddLink(this.GetText("TITLE")); }
protected string FormatThanksInfo([NotNull] string rawString) { var sb = new StringBuilder(); sb.Append("<ol>"); var showDate = this.Get <BoardSettings>().ShowThanksDate; // Extract all user IDs, user name's and (If enabled thanks dates) related to this message. rawString.Split(',').ForEach( chunk => { var subChunks = chunk.Split('|'); var userId = int.Parse(subChunks[0]); var thanksDate = DateTime.Parse(subChunks[1]); // Get the username related to this User ID var displayName = this.Get <IUserDisplayName>().GetName(userId); sb.AppendFormat( @"<li><a id=""{0}"" href=""{1}""><u>{2}</u></a>", userId, BuildLink.GetLink(ForumPages.Profile, "u={0}&name={1}", userId, displayName), this.Get <HttpServerUtilityBase>().HtmlEncode(displayName)); // If showing thanks date is enabled, add it to the formatted string. if (showDate) { sb.AppendFormat( " {0}", this.GetTextFormatted("ONDATE", this.Get <IDateTime>().FormatDateShort(thanksDate))); } sb.Append("</li>"); }); sb.Append("</ol>"); return(sb.ToString()); }
/// <summary> /// Adds page links to the page /// </summary> protected override void CreatePageLinks() { this.PageLinks.AddRoot(); if (this.categoryId > 0) { this.PageLinks.AddLink( this.PageContext.PageCategoryName, BuildLink.GetLink(ForumPages.Board, "c={0}", this.categoryId)); } if (this.returnForum > 0) { var name = this.GetRepository <Forum>().GetById(this.returnForum.Value).Name; this.PageLinks.AddLink(name, BuildLink.GetLink(ForumPages.Topics, "f={0}", this.returnForum)); } if (this.forumId > 0) { var name = this.GetRepository <Forum>().GetById(this.forumId.Value).Name; this.PageLinks.AddLink(name, BuildLink.GetLink(ForumPages.Topics, "f={0}", this.forumId)); } if (this.topicId > 0) { this.PageLinks.AddLink( this.topicInfo.TopicName, BuildLink.GetLink(ForumPages.Posts, "t={0}", this.topicId)); } if (this.editMessageId > 0) { this.PageLinks.AddLink( this.topicInfo.TopicName, BuildLink.GetLink(ForumPages.PostMessage, "m={0}", this.editMessageId)); } this.PageLinks.AddLink(this.GetText("POLLEDIT", "EDITPOLL"), string.Empty); }
/// <summary> /// The forum page_ pre render. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> private void ForumPage_PreRender([NotNull] object sender, [NotNull] EventArgs e) { var bannerLink = this.CurrentForumPage.FindControlRecursiveBothAs <HyperLink>("BannerLink"); if (bannerLink == null) { return; } bannerLink.NavigateUrl = BuildLink.GetLink(ForumPages.Board); bannerLink.ToolTip = this.GetText("TOOLBAR", "FORUM_TITLE"); var logoUrl = $"{BoardInfo.ForumClientFileRoot}{BoardFolders.Current.Logos}/{BoardContext.Current.BoardSettings.ForumLogo}"; bannerLink.Attributes.Add("style", $"background: url('{logoUrl}') no-repeat"); if (!this.CurrentForumPage.ShowToolBar) { bannerLink.Visible = false; } }
/// <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) { // Disable Avatar edit in dnn because it is already handled in the dnn profile page. if (Config.IsDotNetNuke) { this.RedirectNoAccess(); } if (this.IsPostBack) { return; } this.PageLinks.AddRoot(); this.PageLinks.AddLink( this.Get <BoardSettings>().EnableDisplayName ? this.PageContext.CurrentUserData.DisplayName : this.PageContext.PageUserName, BuildLink.GetLink(ForumPages.cp_profile)); this.PageLinks.AddLink(this.GetText("TITLE"), string.Empty); }
/// <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 <BoardSettings>().AllowEmailSending) { BuildLink.AccessDenied(); } if (this.IsPostBack) { return; } // get user data... var user = this.Get <IAspNetUsersHelper>().GetMembershipUserById(this.UserId); if (user == null) { // No such user exists BuildLink.AccessDenied(); } else { if (user.IsApproved == false) { BuildLink.AccessDenied(); } var displayName = this.Get <IAspNetUsersHelper>().GetDisplayNameFromID(this.UserId); this.PageLinks.AddRoot(); this.PageLinks.AddLink( this.PageContext.BoardSettings.EnableDisplayName ? displayName : user.UserName, BuildLink.GetLink( ForumPages.UserProfile, "u={0}&name={1}", this.UserId, this.PageContext.BoardSettings.EnableDisplayName ? displayName : user.UserName)); this.PageLinks.AddLink(this.GetText("TITLE"), string.Empty); } }
/// <summary> /// Adds page links to the page /// </summary> private void AddPageLinks() { this.PageLinks.AddRoot(); if (this._categoryId > 0) { this.PageLinks.AddLink( this.PageContext.PageCategoryName, BuildLink.GetLink(ForumPages.forum, "c={0}", this._categoryId)); } var name = this.GetRepository <Forum>().List(this.PageContext.PageBoardID, this._returnForum) .FirstOrDefault().Name; if (this._returnForum > 0) { this.PageLinks.AddLink(name, BuildLink.GetLink(ForumPages.topics, "f={0}", this._returnForum)); } if (this._forumId > 0) { this.PageLinks.AddLink(name, BuildLink.GetLink(ForumPages.topics, "f={0}", this._forumId)); } if (this._topicId > 0) { this.PageLinks.AddLink( this.topicInfo.TopicName, BuildLink.GetLink(ForumPages.posts, "t={0}", this._topicId)); } if (this._editMessageId > 0) { this.PageLinks.AddLink( this.topicInfo.TopicName, BuildLink.GetLink(ForumPages.postmessage, "m={0}", this._editMessageId)); } this.PageLinks.AddLink(this.GetText("POLLEDIT", "EDITPOLL"), string.Empty); }
/// <summary> /// Initializes a new instance of the <see cref="YafSyndicationFeed" /> class. /// </summary> /// <param name="subTitle">The sub title.</param> /// <param name="feedType">The feed source.</param> /// <param name="sf">The feed type Atom/RSS.</param> /// <param name="urlAlphaNum">The alphanumerically encoded base site Url.</param> public YafSyndicationFeed([NotNull] string subTitle, RssFeeds feedType, int sf, [NotNull] string urlAlphaNum) { this.Copyright = new TextSyndicationContent($"Copyright {DateTime.Now.Year} {BoardContext.Current.BoardSettings.Name}"); this.Description = new TextSyndicationContent( $"{BoardContext.Current.BoardSettings.Name} - {(sf == SyndicationFormats.Atom.ToInt() ? BoardContext.Current.Get<ILocalization>().GetText("ATOMFEED") : BoardContext.Current.Get<ILocalization>().GetText("RSSFEED"))}"); this.Title = new TextSyndicationContent( $"{(sf == SyndicationFormats.Atom.ToInt() ? BoardContext.Current.Get<ILocalization>().GetText("ATOMFEED") : BoardContext.Current.Get<ILocalization>().GetText("RSSFEED"))} - {BoardContext.Current.BoardSettings.Name} - {subTitle}"); // Alternate link this.Links.Add(SyndicationLink.CreateAlternateLink(new Uri(BaseUrlBuilder.BaseUrl))); // Self Link var slink = new Uri( BuildLink.GetLink(ForumPages.RssTopic, true, $"pg={feedType.ToInt()}&ft={sf}")); this.Links.Add(SyndicationLink.CreateSelfLink(slink)); this.Generator = "YetAnotherForum.NET"; this.LastUpdatedTime = DateTime.UtcNow; this.Language = BoardContext.Current.Get <ILocalization>().LanguageCode; this.ImageUrl = new Uri( $"{BaseUrlBuilder.BaseUrl}{BoardInfo.ForumClientFileRoot}{BoardFolders.Current.Logos}/{BoardContext.Current.BoardSettings.ForumLogo}"); this.Id = $"urn:{urlAlphaNum}:{(sf == SyndicationFormats.Atom.ToInt() ? BoardContext.Current.Get<ILocalization>().GetText("ATOMFEED") : BoardContext.Current.Get<ILocalization>().GetText("RSSFEED"))}:{BoardContext.Current.BoardSettings.Name}:{subTitle}:{BoardContext.Current.PageBoardID}" .Unidecode(); this.Id = this.Id.Replace(" ", string.Empty); // this.Id = "urn:uuid:{0}".FormatWith(Guid.NewGuid().ToString("D")); this.BaseUri = slink; this.Authors.Add( new SyndicationPerson( BoardContext.Current.BoardSettings.ForumEmail, "Forum Admin", BaseUrlBuilder.BaseUrl)); this.Categories.Add(new SyndicationCategory(FeedCategories)); }
private string GetThanks([NotNull] int messageId) { var filler = new StringBuilder(); var thanks = this.GetRepository <Thanks>().MessageGetThanksList(messageId); filler.Append("<ol>"); thanks.ForEach( dr => { var name = this.Get <BoardSettings>().EnableDisplayName ? this.Get <HttpServerUtilityBase>() .HtmlEncode(dr.Item2.DisplayName) : this.Get <HttpServerUtilityBase>().HtmlEncode(dr.Item2.Name); // vzrus: quick fix for the incorrect link. URL rewriting don't work :( filler.AppendFormat( @"<li class=""list-inline-item""><a id=""{0}"" href=""{1}""><u>{2}</u></a>", dr.Item2.ID, BuildLink.GetLink(ForumPages.Profile, "u={0}&name={1}", dr.Item2.ID, name), name); if (this.Get <BoardSettings>().ShowThanksDate) { filler.AppendFormat( " {0}", this.Get <ILocalization>().GetTextFormatted( "ONDATE", this.Get <IDateTime>().FormatDateShort(dr.Item1.ThanksDate))); } filler.Append("</li>"); }); filler.Append("</ol>"); return(filler.ToString()); }