/// <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) { this._messageRow = null; if (this.Get<HttpRequestBase>().QueryString.GetFirstOrDefault("m") != null) { this._messageRow = LegacyDb.message_list( Security.StringToLongOrRedirect(this.Get<HttpRequestBase>().QueryString.GetFirstOrDefault("m"))). GetFirstRowOrInvalid(); if (!this.PageContext.ForumModeratorAccess && this.PageContext.PageUserID != (int)this._messageRow["UserID"]) { YafBuildLink.AccessDenied(); } } this._forumFlags = new ForumFlags(this._messageRow["ForumFlags"]); this._topicFlags = new TopicFlags(this._messageRow["TopicFlags"]); this._ownerUserId = (int)this._messageRow["UserID"]; this._isModeratorChanged = this.PageContext.PageUserID != this._ownerUserId; if (this.PageContext.PageForumID == 0) { YafBuildLink.AccessDenied(); } if (this.Get<HttpRequestBase>().QueryString.GetFirstOrDefault("t") == null && !this.PageContext.ForumPostAccess) { YafBuildLink.AccessDenied(); } if (this.Get<HttpRequestBase>().QueryString.GetFirstOrDefault("t") != null && !this.PageContext.ForumReplyAccess) { YafBuildLink.AccessDenied(); } if (this.IsPostBack) { return; } // setup page links this.PageLinks.AddLink(this.Get<YafBoardSettings>().Name, YafBuildLink.GetLink(ForumPages.forum)); this.PageLinks.AddLink( this.PageContext.PageCategoryName, YafBuildLink.GetLink(ForumPages.forum, "c={0}", this.PageContext.PageCategoryID)); this.PageLinks.AddForumLinks(this.PageContext.PageForumID); this.EraseMessage.Checked = false; this.ViewState["delAll"] = false; this.EraseRow.Visible = false; this.DeleteReasonRow.Visible = false; this.LinkedPosts.Visible = false; this.ReasonEditor.Attributes.Add("style", "width:100%"); this.Cancel.Text = this.GetText("Cancel"); if (this.Get<HttpRequestBase>().QueryString.GetFirstOrDefault("m") == null) { return; } // delete message... this.PreviewRow.Visible = true; DataTable tempdb = LegacyDb.message_getRepliesList(this.Get<HttpRequestBase>().QueryString.GetFirstOrDefault("m")); if (tempdb.Rows.Count > 0 && (this.PageContext.ForumModeratorAccess || this.PageContext.IsAdmin)) { this.LinkedPosts.Visible = true; this.LinkedPosts.DataSource = tempdb; this.LinkedPosts.DataBind(); } if (this.Get<HttpRequestBase>().QueryString.GetFirstOrDefault("action").ToLower() == "delete") { this.Title.Text = this.GetText("EDIT"); // GetText("EDIT"); this.Delete.Text = this.GetText("DELETE"); // "GetText("Save"); if (this.PageContext.IsAdmin) { this.EraseRow.Visible = true; } } else { this.Title.Text = this.GetText("EDIT"); this.Delete.Text = this.GetText("UNDELETE"); // "GetText("Save"); } this.Subject.Text = Convert.ToString(this._messageRow["Topic"]); this.DeleteReasonRow.Visible = true; this.ReasonEditor.Text = Convert.ToString(this._messageRow["DeleteReason"]); // populate the message preview with the message datarow... this.MessagePreview.Message = this._messageRow["message"].ToString(); this.MessagePreview.MessageFlags = new MessageFlags(this._messageRow["Flags"]); }
/// <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.IsGuest) { // The html code for "Favorite Topic" theme buttons. string tagButtonHTML = "'<a class=\"yafcssbigbutton rightItem\" href=\"javascript:addFavoriteTopic(' + res.d + ');\" onclick=\"jQuery(this).blur();\" title=\"{0}\"><span>{1}</span></a>'" .FormatWith(this.GetText("BUTTON_TAGFAVORITE_TT"), this.GetText("BUTTON_TAGFAVORITE")); string untagButtonHTML = "'<a class=\"yafcssbigbutton rightItem\" href=\"javascript:removeFavoriteTopic(' + res.d + ');\" onclick=\"jQuery(this).blur();\" title=\"{0}\"><span>{1}</span></a>'" .FormatWith(this.GetText("BUTTON_UNTAGFAVORITE_TT"), this.GetText("BUTTON_UNTAGFAVORITE")); // Register the client side script for the "Favorite Topic". var favoriteTopicJs = JavaScriptBlocks.AddFavoriteTopicJs(untagButtonHTML) + Environment.NewLine + JavaScriptBlocks.RemoveFavoriteTopicJs(tagButtonHTML); YafContext.Current.PageElements.RegisterJsBlockStartup("favoriteTopicJs", favoriteTopicJs); YafContext.Current.PageElements.RegisterJsBlockStartup("asynchCallFailedJs", "function CallFailed(res){ alert('Error Occurred'); }"); // Has the user already tagged this topic as favorite? if (this.Get<IFavoriteTopic>().IsFavoriteTopic(this.PageContext.PageTopicID)) { // Generate the "Untag" theme button with appropriate JS calls for onclick event. this.TagFavorite1.NavigateUrl = "javascript:removeFavoriteTopic({0});".FormatWith(this.PageContext.PageTopicID); this.TagFavorite2.NavigateUrl = "javascript:removeFavoriteTopic({0});".FormatWith(this.PageContext.PageTopicID); this.TagFavorite1.TextLocalizedTag = "BUTTON_UNTAGFAVORITE"; this.TagFavorite1.TitleLocalizedTag = "BUTTON_UNTAGFAVORITE_TT"; this.TagFavorite2.TextLocalizedTag = "BUTTON_UNTAGFAVORITE"; this.TagFavorite2.TitleLocalizedTag = "BUTTON_UNTAGFAVORITE_TT"; } else { // Generate the "Tag" theme button with appropriate JS calls for onclick event. this.TagFavorite1.NavigateUrl = "javascript:addFavoriteTopic({0});".FormatWith(this.PageContext.PageTopicID); this.TagFavorite2.NavigateUrl = "javascript:addFavoriteTopic({0});".FormatWith(this.PageContext.PageTopicID); this.TagFavorite1.TextLocalizedTag = "BUTTON_TAGFAVORITE"; this.TagFavorite1.TitleLocalizedTag = "BUTTON_TAGFAVORITE_TT"; this.TagFavorite2.TextLocalizedTag = "BUTTON_TAGFAVORITE"; this.TagFavorite2.TitleLocalizedTag = "BUTTON_TAGFAVORITE_TT"; } } else { this.TagFavorite1.Visible = false; this.TagFavorite2.Visible = false; } this._quickReplyEditor.BaseDir = "{0}Scripts".FormatWith(YafForumInfo.ForumClientFileRoot); this._quickReplyEditor.StyleSheet = this.Get<ITheme>().BuildThemePath("theme.css"); this._topic = LegacyDb.topic_info(this.PageContext.PageTopicID); // in case topic is deleted or not existant if (this._topic == null) { YafBuildLink.RedirectInfoPage(InfoMessage.Invalid); } // get topic flags this._topicFlags = new TopicFlags(this._topic["Flags"]); using (DataTable dt = LegacyDb.forum_list(this.PageContext.PageBoardID, this.PageContext.PageForumID)) { this._forum = dt.Rows[0]; } this._forumFlags = new ForumFlags(this._forum["Flags"]); if (this.PageContext.IsGuest && !this.PageContext.ForumReadAccess) { // attempt to get permission by redirecting to login... this.Get<IPermissions>().HandleRequest(ViewPermissions.RegisteredUsers); } else if (!this.PageContext.ForumReadAccess) { YafBuildLink.AccessDenied(); } var yafBoardSettings = this.Get<YafBoardSettings>(); if (!this.IsPostBack) { // Clear Multiquotes if topic is different if (this.Get<IYafSession>().MultiQuoteIds != null) { if (!this.Get<IYafSession>().MultiQuoteIds.Any(m => m.TopicID.Equals(this.PageContext.PageTopicID))) { this.Get<IYafSession>().MultiQuoteIds = null; } } if (this.PageContext.Settings.LockedForum == 0) { this.PageLinks.AddRoot(); this.PageLinks.AddLink( this.PageContext.PageCategoryName, YafBuildLink.GetLink(ForumPages.forum, "c={0}", this.PageContext.PageCategoryID)); } this.NewTopic2.NavigateUrl = this.NewTopic1.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.postmessage, "f={0}", this.PageContext.PageForumID); this.MoveTopic1.NavigateUrl = this.MoveTopic2.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.movetopic, "t={0}", this.PageContext.PageTopicID); this.PostReplyLink1.NavigateUrl = this.PostReplyLink2.NavigateUrl = YafBuildLink.GetLinkNotEscaped( ForumPages.postmessage, "t={0}&f={1}", this.PageContext.PageTopicID, this.PageContext.PageForumID); this.QuickReply.Text = this.GetText("POSTMESSAGE", "SAVE"); this.DataPanel1.TitleText = this.GetText("QUICKREPLY"); this.DataPanel1.ExpandText = this.GetText("QUICKREPLY_SHOW"); this.DataPanel1.CollapseText = this.GetText("QUICKREPLY_HIDE"); this.PageLinks.AddForum(this.PageContext.PageForumID); this.PageLinks.AddLink( this.Get<IBadWordReplace>().Replace(this.Server.HtmlDecode(this.PageContext.PageTopicName)), string.Empty); var topicSubject = this.Get<IBadWordReplace>().Replace(this.HtmlEncode(this._topic["Topic"])); if (this._topic["Status"].ToString().IsSet() && yafBoardSettings.EnableTopicStatus) { var topicStatusIcon = this.Get<ITheme>().GetItem("TOPIC_STATUS", this._topic["Status"].ToString()); if (topicStatusIcon.IsSet() && !topicStatusIcon.Contains("[TOPIC_STATUS.")) { topicSubject = @"<img src=""{0}"" alt=""{1}"" title=""{1}"" class=""topicStatusIcon"" /> {2}" .FormatWith( this.Get<ITheme>().GetItem("TOPIC_STATUS", this._topic["Status"].ToString()), this.GetText("TOPIC_STATUS", this._topic["Status"].ToString()), topicSubject); } else { topicSubject = "[{0}] {1}".FormatWith( this.GetText("TOPIC_STATUS", this._topic["Status"].ToString()), topicSubject); } } if (!this._topic["Description"].IsNullOrEmptyDBField() && yafBoardSettings.EnableTopicDescription) { this.TopicTitle.Text = "{0} - <em>{1}</em>".FormatWith( topicSubject, this.Get<IBadWordReplace>().Replace(this.HtmlEncode(this._topic["Description"]))); } else { this.TopicTitle.Text = this.Get<IBadWordReplace>().Replace(topicSubject); } this.TopicLink.ToolTip = this.Get<IBadWordReplace>().Replace( this.HtmlEncode(this._topic["Description"])); this.TopicLink.NavigateUrl = YafBuildLink.GetLinkNotEscaped( ForumPages.posts, "t={0}", this.PageContext.PageTopicID); this.ViewOptions.Visible = yafBoardSettings.AllowThreaded; this.ForumJumpHolder.Visible = yafBoardSettings.ShowForumJump && this.PageContext.Settings.LockedForum == 0; this.RssTopic.NavigateUrl = YafBuildLink.GetLinkNotEscaped( ForumPages.rsstopic, "pg={0}&t={1}", YafRssFeeds.Posts.ToInt(), this.PageContext.PageTopicID); this.RssTopic.Visible = yafBoardSettings.ShowRSSLink; this.QuickReplyPlaceHolder.Visible = yafBoardSettings.ShowQuickAnswer; if ((this.PageContext.IsGuest && yafBoardSettings.EnableCaptchaForGuests) || (yafBoardSettings.EnableCaptchaForPost && !this.PageContext.IsCaptchaExcluded)) { this.imgCaptcha.ImageUrl = "{0}resource.ashx?c=1".FormatWith(YafForumInfo.ForumClientFileRoot); this.CaptchaDiv.Visible = true; } if (!this.PageContext.ForumPostAccess || (this._forumFlags.IsLocked && !this.PageContext.ForumModeratorAccess)) { this.NewTopic1.Visible = false; this.NewTopic2.Visible = false; } // Ederon : 9/9/2007 - moderators can reply in locked topics if (!this.PageContext.ForumReplyAccess || ((this._topicFlags.IsLocked || this._forumFlags.IsLocked) && !this.PageContext.ForumModeratorAccess)) { this.PostReplyLink1.Visible = this.PostReplyLink2.Visible = false; this.QuickReplyPlaceHolder.Visible = false; } if (this.PageContext.ForumModeratorAccess) { this.MoveTopic1.Visible = true; this.MoveTopic2.Visible = true; } else { this.MoveTopic1.Visible = false; this.MoveTopic2.Visible = false; } if (!this.PageContext.ForumModeratorAccess) { this.LockTopic1.Visible = false; this.UnlockTopic1.Visible = false; this.DeleteTopic1.Visible = false; this.LockTopic2.Visible = false; this.UnlockTopic2.Visible = false; this.DeleteTopic2.Visible = false; } else { this.LockTopic1.Visible = !this._topicFlags.IsLocked; this.UnlockTopic1.Visible = !this.LockTopic1.Visible; this.LockTopic2.Visible = this.LockTopic1.Visible; this.UnlockTopic2.Visible = !this.LockTopic2.Visible; } if (this.PageContext.ForumReplyAccess || ((!this._topicFlags.IsLocked || !this._forumFlags.IsLocked) && this.PageContext.ForumModeratorAccess)) { YafContext.Current.PageElements.RegisterJsBlockStartup( "SelectedQuotingJs", JavaScriptBlocks.SelectedQuotingJs( YafBuildLink.GetLinkNotEscaped( ForumPages.postmessage, "t={0}&f={1}", this.PageContext.PageTopicID, this.PageContext.PageForumID), this.GetText("POSTS", "QUOTE_SELECTED"))); } } #endregion this.BindData(); if (!this.Get<IPermissions>().Check(yafBoardSettings.ShowShareTopicTo) || !Config.FacebookAPIKey.IsSet()) { return; } YafContext.Current.PageElements.RegisterJsBlockStartup("facebookInitJs", JavaScriptBlocks.FacebookInitJs); var message = BBCodeHelper.StripBBCode( HtmlHelper.StripHtml(HtmlHelper.CleanHtmlString((string)this._topic["Topic"]))).RemoveMultipleWhitespace(); var meta = this.Page.Header.FindControlType<HtmlMeta>().ToList(); string description = string.Empty; if (meta.Any(x => x.Name.Equals("description"))) { var descriptionMeta = meta.FirstOrDefault(x => x.Name.Equals("description")); if (descriptionMeta != null) { description = descriptionMeta.Content; } } YafContext.Current.PageElements.RegisterJsBlockStartup( "facebookPostJs", JavaScriptBlocks.FacebookPostJs( this.Server.HtmlEncode(message), this.Server.HtmlEncode(description), this.Get<HttpRequestBase>().Url.ToString(), "{0}/YAFLogo.jpg".FormatWith( Path.Combine(YafForumInfo.ForumBaseUrl, YafBoardFolders.Current.Images)), "Logo")); }
/// <summary> /// The init reply to topic. /// </summary> private void InitReplyToTopic() { DataRow topic = LegacyDb.topic_info(this.TopicID); var topicFlags = new TopicFlags(topic["Flags"].ToType<int>()); // Ederon : 9/9/2007 - moderators can reply in locked topics if (topicFlags.IsLocked && !this.PageContext.ForumModeratorAccess) { this.Response.Redirect(this.Get<HttpRequestBase>().UrlReferrer.ToString()); } this.PriorityRow.Visible = false; this.SubjectRow.Visible = false; this.DescriptionRow.Visible = false; this.StatusRow.Visible = false; this.StyleRow.Visible = false; this.Title.Text = this.GetText("reply"); // add topic link... this.PageLinks.AddLink( this.Server.HtmlDecode(topic["Topic"].ToString()), YafBuildLink.GetLink(ForumPages.posts, "t={0}", this.TopicID)); // add "reply" text... this.PageLinks.AddLink(this.GetText("reply")); // show attach file option if its a reply... if (this.PageContext.ForumUploadAccess) { this.PostOptions1.Visible = true; this.PostOptions1.AttachOptionVisible = true; // this.Attachments1.Visible = true; } // show the last posts AJAX frame... this.LastPosts1.Visible = true; this.LastPosts1.TopicID = this.TopicID.Value; }
/// <summary> /// The get topic image. /// </summary> /// <param name="o"> /// The o. /// </param> /// <param name="imgTitle"> /// The img title. /// </param> /// <returns> /// Returns the Topic Image /// </returns> protected string GetTopicImage([NotNull] object o, [NotNull] ref string imgTitle) { CodeContracts.ArgumentNotNull(o, "o"); CodeContracts.ArgumentNotNull(imgTitle, "imgTitle"); var row = (DataRowView)o; if (this.ShowTopicImages()) { if (row["TopicImage"].ToString().Length > 0) { // remote imgTitle = HttpUtility.HtmlEncode(row["Subject"].ToString()); if (this.Get<YafBoardSettings>().TopicImageDirectThumbnail) { // local image thumbnail return "{0}resource.ashx?ti={1}&thumb={2}".FormatWith( YafForumInfo.ForumClientFileRoot, row["TopicID"].ToType<int>(), this.Server.UrlEncode(ImagePathHelper.GetThumbnailImageRealFileName(row["TopicImage"].ToString(), "thumb"))); } // Remote image. if (row["TopicImage"].ToString().Contains("http")) { return "{0}resource.ashx?ti={1}&url={2}&width={3}&height={4}&remote=1".FormatWith( YafForumInfo.ForumClientFileRoot, row["TopicID"].ToType<int>(), this.Server.UrlEncode(row["TopicImage"].ToString()), this.Get<YafBoardSettings>().TopicImageWidth, this.Get<YafBoardSettings>().TopicImageHeight); } else { return "{0}resource.ashx?ti={1}&thumb={2}&type={3}".FormatWith( YafForumInfo.ForumClientFileRoot, row["TopicID"].ToType<int>(), this.Server.UrlEncode(row["TopicImage"].ToString()), row["TopicImageType"]); } } if (row["TopicImageBin"] != null && row["TopicImageBin"].ToString().Length > 0) { imgTitle = HttpUtility.HtmlEncode(row["Subject"].ToString()); return "{0}resource.ashx?ti={1}".FormatWith( YafForumInfo.ForumClientFileRoot, row["TopicID"].ToType<int>()); } } DateTime lastPosted = row["LastPosted"] != DBNull.Value ? (DateTime)row["LastPosted"] : DateTimeHelper.SqlDbMinTime(); var topicFlags = new TopicFlags(row["TopicFlags"]); var forumFlags = new ForumFlags(row["ForumFlags"]); var isHot = this.IsPopularTopic(lastPosted, row); if (topicFlags.IsDeleted) { imgTitle = this.GetText("DELETED"); return this.Get<ITheme>().GetItem("ICONS", "TOPIC_DELETED"); } if (row["TopicMovedID"].ToString().Length > 0) { imgTitle = this.GetText("MOVED"); return this.Get<ITheme>().GetItem("ICONS", "TOPIC_MOVED"); } DateTime lastRead = this.Get<IReadTrackCurrentUser>().GetForumTopicRead( row["ForumID"].ToType<int>(), row["TopicID"].ToType<int>(), row["LastForumAccess"].IsNullOrEmptyDBField() ? DateTimeHelper.SqlDbMinTime() : row["LastForumAccess"].ToType<DateTime?>(), row["LastTopicAccess"].IsNullOrEmptyDBField() ? DateTimeHelper.SqlDbMinTime() : row["LastForumAccess"].ToType<DateTime?>()); if (lastPosted > lastRead) { this.Get<IYafSession>().UnreadTopics++; if (row["PollID"] != DBNull.Value) { imgTitle = this.GetText("POLL_NEW"); return this.Get<ITheme>().GetItem("ICONS", "TOPIC_POLL_NEW"); } switch (row["Priority"].ToString()) { case "1": imgTitle = this.GetText("STICKY_NEW"); return this.Get<ITheme>().GetItem("ICONS", "TOPIC_STICKY_NEW"); case "2": imgTitle = this.GetText("ANNOUNCEMENT"); return this.Get<ITheme>().GetItem("ICONS", "TOPIC_ANNOUNCEMENT_NEW"); default: if (topicFlags.IsLocked || forumFlags.IsLocked) { imgTitle = this.GetText("NEW_POSTS_LOCKED"); return this.Get<ITheme>().GetItem("ICONS", "TOPIC_NEW_LOCKED"); } if (isHot) { imgTitle = this.GetText("ICONLEGEND", "HOT_NEW_POSTS"); return this.Get<ITheme>().GetItem( "ICONS", "TOPIC_HOT_NEW", this.Get<ITheme>().GetItem("ICONS", "TOPIC_NEW")); } imgTitle = this.GetText("ICONLEGEND", "NEW_POSTS"); return this.Get<ITheme>().GetItem("ICONS", "TOPIC_NEW"); } } if (row["PollID"] != DBNull.Value) { imgTitle = this.GetText("POLL"); return this.Get<ITheme>().GetItem("ICONS", "TOPIC_POLL"); } switch (row["Priority"].ToString()) { case "1": imgTitle = this.GetText("STICKY"); return this.Get<ITheme>().GetItem("ICONS", "TOPIC_STICKY"); case "2": imgTitle = this.GetText("ANNOUNCEMENT"); return this.Get<ITheme>().GetItem("ICONS", "TOPIC_ANNOUNCEMENT"); default: if (topicFlags.IsLocked || forumFlags.IsLocked) { imgTitle = this.GetText("NO_NEW_POSTS_LOCKED"); return this.Get<ITheme>().GetItem("ICONS", "TOPIC_LOCKED"); } if (isHot) { imgTitle = this.GetText("HOT_NO_NEW_POSTS"); return this.Get<ITheme>().GetItem( "ICONS", "TOPIC_HOT", this.Get<ITheme>().GetItem("ICONS", "TOPIC")); } imgTitle = this.GetText("NO_NEW_POSTS"); return this.Get<ITheme>().GetItem("ICONS", "TOPIC"); } }
/// <summary> /// The get topic image. /// </summary> /// <param name="o"> /// The o. /// </param> /// <param name="imgTitle"> /// The img title. /// </param> /// <returns> /// Returns the Topic Image /// </returns> protected string GetTopicImage([NotNull] object o, [NotNull] ref string imgTitle) { CodeContracts.ArgumentNotNull(o, "o"); CodeContracts.ArgumentNotNull(imgTitle, "imgTitle"); var row = (DataRowView)o; DateTime lastPosted = row["LastPosted"] != DBNull.Value ? (DateTime)row["LastPosted"] : new DateTime(2000, 1, 1); var topicFlags = new TopicFlags(row["TopicFlags"]); var forumFlags = new ForumFlags(row["ForumFlags"]); var isHot = this.IsPopularTopic(lastPosted, row); if (row["TopicMovedID"].ToString().Length > 0) { imgTitle = this.GetText("MOVED"); return this.Get<ITheme>().GetItem("ICONS", "TOPIC_MOVED"); } DateTime lastRead = this.Get<IReadTrackCurrentUser>().GetForumTopicRead( row["ForumID"].ToType<int>(), row["TopicID"].ToType<int>(), row["LastForumAccess"].IsNullOrEmptyDBField() ? DateTime.MinValue : row["LastForumAccess"].ToType<DateTime?>(), row["LastTopicAccess"].IsNullOrEmptyDBField() ? DateTime.MinValue : row["LastForumAccess"].ToType<DateTime?>()); if (lastPosted > lastRead) { this.Get<IYafSession>().UnreadTopics++; if (row["PollID"] != DBNull.Value) { imgTitle = this.GetText("POLL_NEW"); return this.Get<ITheme>().GetItem("ICONS", "TOPIC_POLL_NEW"); } switch (row["Priority"].ToString()) { case "1": imgTitle = this.GetText("STICKY_NEW"); return this.Get<ITheme>().GetItem("ICONS", "TOPIC_STICKY_NEW"); case "2": imgTitle = this.GetText("ANNOUNCEMENT"); return this.Get<ITheme>().GetItem("ICONS", "TOPIC_ANNOUNCEMENT_NEW"); default: if (topicFlags.IsLocked || forumFlags.IsLocked) { imgTitle = this.GetText("NEW_POSTS_LOCKED"); return this.Get<ITheme>().GetItem("ICONS", "TOPIC_NEW_LOCKED"); } if (isHot) { imgTitle = this.GetText("ICONLEGEND", "HOT_NEW_POSTS"); return this.Get<ITheme>().GetItem( "ICONS", "TOPIC_HOT_NEW", this.Get<ITheme>().GetItem("ICONS", "TOPIC_NEW")); } imgTitle = this.GetText("ICONLEGEND", "NEW_POSTS"); return this.Get<ITheme>().GetItem("ICONS", "TOPIC_NEW"); } } if (row["PollID"] != DBNull.Value) { imgTitle = this.GetText("POLL"); return this.Get<ITheme>().GetItem("ICONS", "TOPIC_POLL"); } switch (row["Priority"].ToString()) { case "1": imgTitle = this.GetText("STICKY"); return this.Get<ITheme>().GetItem("ICONS", "TOPIC_STICKY"); case "2": imgTitle = this.GetText("ANNOUNCEMENT"); return this.Get<ITheme>().GetItem("ICONS", "TOPIC_ANNOUNCEMENT"); default: if (topicFlags.IsLocked || forumFlags.IsLocked) { imgTitle = this.GetText("NO_NEW_POSTS_LOCKED"); return this.Get<ITheme>().GetItem("ICONS", "TOPIC_LOCKED"); } if (isHot) { imgTitle = this.GetText("HOT_NO_NEW_POSTS"); return this.Get<ITheme>().GetItem( "ICONS", "TOPIC_HOT", this.Get<ITheme>().GetItem("ICONS", "TOPIC")); } imgTitle = this.GetText("NO_NEW_POSTS"); return this.Get<ITheme>().GetItem("ICONS", "TOPIC"); } }
/// <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) { this._messageRow = null; if (this.Get<HttpRequestBase>().QueryString.GetFirstOrDefault("m") != null) { int messageId; if (!int.TryParse(this.Get<HttpRequestBase>().QueryString.GetFirstOrDefault("m"), out messageId)) { YafBuildLink.RedirectInfoPage(InfoMessage.Invalid); } this._messageRow = CommonDb.MessageList(PageContext.PageModuleID, messageId).FirstOrDefault(); // first message should not be deleted if (this._messageRow == null || (int)this._messageRow.Position <= 0) { YafBuildLink.RedirectInfoPage(InfoMessage.Invalid); } if (!this.PageContext.ForumModeratorAccess && this.PageContext.PageUserID != this._messageRow.UserID) { YafBuildLink.AccessDenied(); } } this._forumFlags = this._messageRow.ForumFlags; this._topicFlags = this._messageRow.TopicFlags; this._ownerUserId = (int)this._messageRow.UserID; this._isModeratorChanged = this.PageContext.PageUserID != this._ownerUserId; if (this.PageContext.PageForumID == 0) { YafBuildLink.AccessDenied(); } if (this.Get<HttpRequestBase>().QueryString.GetFirstOrDefault("t") == null && !this.PageContext.ForumPostAccess) { YafBuildLink.AccessDenied(); } if (this.Get<HttpRequestBase>().QueryString.GetFirstOrDefault("t") != null && !this.PageContext.ForumReplyAccess) { YafBuildLink.AccessDenied(); } if (this.IsPostBack) { return; } // setup page links this.PageLinks.AddLink(this.Get<YafBoardSettings>().Name, YafBuildLink.GetLink(ForumPages.forum)); this.PageLinks.AddLink( this.PageContext.PageCategoryName, YafBuildLink.GetLink(ForumPages.forum, "c={0}", this.PageContext.PageCategoryID)); this.PageLinks.AddForumLinks(this.PageContext.PageForumID); this.EraseMessage.Checked = false; this.ViewState["delAll"] = false; this.EraseRow.Visible = false; this.DeleteReasonRow.Visible = false; this.LinkedPosts.Visible = false; this.ReasonEditor.Attributes.Add("style", "width:100%"); this.Cancel.Text = this.GetText("Cancel"); if (this.Get<HttpRequestBase>().QueryString.GetFirstOrDefault("m") == null) { return; } // delete message... this.PreviewRow.Visible = true; DataTable tempdb = CommonDb.message_getRepliesList( PageContext.PageModuleID, this.Get<HttpRequestBase>().QueryString.GetFirstOrDefault("m")); if (tempdb.Rows.Count > 0 && (this.PageContext.ForumModeratorAccess || this.PageContext.IsAdmin)) { this.LinkedPosts.Visible = true; this.LinkedPosts.DataSource = tempdb; this.LinkedPosts.DataBind(); } if (this.Get<HttpRequestBase>().QueryString.GetFirstOrDefault("action").ToLower() == "delete") { this.Title.Text = this.GetText("EDIT"); // GetText("EDIT"); this.Delete.Text = this.GetText("DELETE"); // "GetText("Save"); if (this.PageContext.IsAdmin) { this.EraseRow.Visible = true; } } else { this.Title.Text = this.GetText("EDIT"); this.Delete.Text = this.GetText("UNDELETE"); // "GetText("Save"); } this.Subject.Text = Convert.ToString(this._messageRow.Topic); this.DeleteReasonRow.Visible = true; this.ReasonEditor.Text = Convert.ToString(this._messageRow.DeleteReason); // populate the message preview with the message datarow... this.MessagePreview.Message = this._messageRow.Message; this.MessagePreview.MessageFlags = this._messageRow.Flags; }