private void BindData() { Groups.DataSource = YAF.Classes.Data.DB.usergroup_list(PageContext.PageUserID); // Bind DataBind(); YafCombinedUserData userData = new YafCombinedUserData(PageContext.PageUserID); //TitleUserName.Text = HtmlEncode( userData.Membership.UserName ); AccountEmail.Text = userData.Membership.Email; Name.Text = HtmlEncode(userData.Membership.UserName); Joined.Text = YafDateTime.FormatDateTime(userData.Joined); NumPosts.Text = String.Format("{0:N0}", userData.NumPosts); if (PageContext.BoardSettings.AvatarUpload && userData.HasAvatarImage) { AvatarImage.ImageUrl = String.Format("{0}resource.ashx?u={1}", YafForumInfo.ForumRoot, PageContext.PageUserID); } else if (!String.IsNullOrEmpty(userData.Avatar)) // Took out PageContext.BoardSettings.AvatarRemote { AvatarImage.ImageUrl = String.Format("{3}resource.ashx?url={0}&width={1}&height={2}", Server.UrlEncode(userData.Avatar), PageContext.BoardSettings.AvatarWidth, PageContext.BoardSettings.AvatarHeight, YafForumInfo.ForumRoot); } else { AvatarImage.Visible = false; } }
/// <summary> /// Bind data for this control. /// </summary> private void BindData() { // get user's info using (DataTable dt = YAF.Classes.Data.DB.user_list(PageContext.PageBoardID, CurrentUserID, null)) { // there is no such user if (dt.Rows.Count < 1) { YafBuildLink.AccessDenied(/*No such user exists*/); } // get user's data in form of data row DataRow user = dt.Rows [0]; // if user is not suspended, hide row with suspend information and remove suspension button SuspendedRow.Visible = !user.IsNull("Suspended"); // is user suspended? if (!user.IsNull("Suspended")) { // get time when his suspension expires to the view state ViewState ["SuspendedUntil"] = YafDateTime.FormatDateTime(user ["Suspended"]); // localize remove suspension button RemoveSuspension.Text = PageContext.Localization.GetText("PROFILE", "REMOVESUSPENSION"); } // localize suspend button Suspend.Text = PageContext.Localization.GetText("PROFILE", "SUSPEND"); } }
protected void LatestPosts_ItemDataBound(object sender, RepeaterItemEventArgs e) { // populate the controls here... if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView currentRow = ( DataRowView )e.Item.DataItem; // make message url... string messageUrl = YAF.Classes.Utils.YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.posts, "m={0}#post{0}", currentRow ["LastMessageID"]); // get the controls HyperLink textMessageLink = (HyperLink)e.Item.FindControl("TextMessageLink"); HyperLink imageMessageLink = (HyperLink)e.Item.FindControl("ImageMessageLink"); ThemeImage lastPostedImage = (ThemeImage)e.Item.FindControl("LastPostedImage"); UserLink lastUserLink = ( UserLink )e.Item.FindControl("LastUserLink"); Label lastPostedDateLabel = ( Label )e.Item.FindControl("LastPostedDateLabel"); HyperLink forumLink = ( HyperLink )e.Item.FindControl("ForumLink"); // populate them... textMessageLink.Text = YAF.Classes.Utils.General.BadWordReplace(currentRow["Topic"].ToString()); textMessageLink.NavigateUrl = messageUrl; imageMessageLink.NavigateUrl = messageUrl; // Just in case... if (currentRow ["LastUserID"] != DBNull.Value) { lastUserLink.UserID = Convert.ToInt32(currentRow ["LastUserID"]); lastUserLink.UserName = currentRow ["LastUserName"].ToString(); } if (currentRow ["LastPosted"] != DBNull.Value) { lastPostedDateLabel.Text = YafDateTime.FormatDateTimeTopic(currentRow ["LastPosted"]); lastPostedImage.ThemeTag = (DateTime.Parse(currentRow ["LastPosted"].ToString()) > YAF.Classes.Utils.Mession.GetTopicRead(Convert.ToInt32(currentRow ["TopicID"]))) ? "ICON_NEWEST" : "ICON_LATEST"; } forumLink.Text = currentRow["Forum"].ToString(); forumLink.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.topics, "f={0}", currentRow ["ForumID"]); } }
void ForumLastPost_PreRender(object sender, EventArgs e) { if (DataRow != null) { if (int.Parse(DataRow ["ReadAccess"].ToString()) == 0) { TopicInPlaceHolder.Visible = false; } if (DataRow ["LastPosted"] != DBNull.Value) { LastPosted.Text = YafDateTime.FormatDateTimeTopic(DataRow ["LastPosted"]); topicLink.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.posts, "t={0}", DataRow ["LastTopicID"]); topicLink.Text = General.Truncate(General.BadWordReplace(DataRow ["LastTopicName"].ToString()), 50); ProfileUserLink.UserID = Convert.ToInt32(DataRow ["LastUserID"]); ProfileUserLink.UserName = DataRow ["LastUser"].ToString(); LastTopicImgLink.ToolTip = PageContext.Localization.GetText("GO_LAST_POST"); LastTopicImgLink.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.posts, "m={0}#post{0}", DataRow ["LastMessageID"]); Icon.ThemeTag = (DateTime.Parse(Convert.ToString(DataRow ["LastPosted"])) > Mession.GetTopicRead(( int )DataRow ["LastTopicID"])) ? "ICON_NEWEST" : "ICON_LATEST"; LastPostedHolder.Visible = true; NoPostsLabel.Visible = false; } else { // show "no posts" LastPostedHolder.Visible = false; NoPostsLabel.Visible = true; } } }
protected string FormatLastPosted(object o) { DataRowView row = ( DataRowView )o; if (row ["LastPosted"].ToString().Length == 0) { return(" "); } string link = String.Format("<a href=\"{0}\">{1}</a>", YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.profile, "u={0}", row ["LastUserID"]), row ["LastUserName"] ); string by = String.Format(GetText("lastpostlink"), YafDateTime.FormatDateTime(( DateTime )row ["LastPosted"]), link); string html = String.Format("{0} <a href=\"{1}\"><img src=\"{2}\"'></a>", by, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.posts, "m={0}#{0}", row ["LastMessageID"]), GetThemeContents("ICONS", "ICON_LATEST") ); return(html); }
protected string GetThreadedRow(object o) { DataRowView row = ( DataRowView )o; if (!IsThreaded || CurrentMessage == ( int )row ["MessageID"]) { return(""); } System.Text.StringBuilder html = new System.Text.StringBuilder(1000); // Threaded string brief = row ["Message"].ToString(); RegexOptions options = RegexOptions.IgnoreCase /*| RegexOptions.Singleline | RegexOptions.Multiline*/; options |= RegexOptions.Singleline; while (Regex.IsMatch(brief, @"\[quote=(.*?)\](.*)\[/quote\]", options)) { brief = Regex.Replace(brief, @"\[quote=(.*?)\](.*)\[/quote\]", "", options); } while (Regex.IsMatch(brief, @"\[quote\](.*)\[/quote\]", options)) { brief = Regex.Replace(brief, @"\[quote\](.*)\[/quote\]", "", options); } while (Regex.IsMatch(brief, @"<.*?>", options)) { brief = Regex.Replace(brief, @"<.*?>", "", options); } while (Regex.IsMatch(brief, @"\[.*?\]", options)) { brief = Regex.Replace(brief, @"\[.*?\]", "", options); } brief = General.BadWordReplace(brief); if (brief.Length > 42) { brief = brief.Substring(0, 40) + "..."; } brief = FormatMsg.AddSmiles(brief); html.AppendFormat("<tr class='post'><td colspan='3' nowrap>"); html.AppendFormat(GetIndentImage(row ["Indent"])); html.AppendFormat("\n<a href='{0}'>{2} ({1}", YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.posts, "m={0}#{0}", row ["MessageID"]), row ["UserName"], brief); html.AppendFormat(" - {0})</a>", YafDateTime.FormatDateTimeShort(row ["Posted"])); html.AppendFormat("</td></tr>"); return(html.ToString()); }
protected void Page_Load(object sender, System.EventArgs e) { if (PageContext.IsPrivate && User == null) { // Ederon : guess we don't need this if anymore //if ( CanLogin ) YAF.Classes.Utils.YafBuildLink.Redirect(YAF.Classes.Utils.ForumPages.login, "ReturnUrl={0}", Request.RawUrl); //else // YAF.Classes.Utils.YafBuildLink.Redirect( YAF.Classes.Utils.ForumPages.forum ); } if (PageContext.BoardSettings.ShowRSSLink) { RssFeed.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.rsstopic, "pg=active"); RssFeed.Text = GetText("RSSFEED"); RssFeed.Visible = true; } else { RssFeed.Visible = false; } if (!IsPostBack) { PageLinks.AddLink(PageContext.BoardSettings.Name, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.forum)); PageLinks.AddLink(GetText("TITLE"), ""); ForumJumpHolder.Visible = PageContext.BoardSettings.ShowForumJump && PageContext.Settings.LockedForum == 0; Since.Items.Add(new ListItem(String.Format(GetText("last_visit"), YafDateTime.FormatDateTime(Mession.LastVisit)), "0")); Since.Items.Add(new ListItem(GetText("last_hour"), "-1")); Since.Items.Add(new ListItem(GetText("last_two_hours"), "-2")); Since.Items.Add(new ListItem(GetText("last_day"), "1")); Since.Items.Add(new ListItem(GetText("last_two_days"), "2")); Since.Items.Add(new ListItem(GetText("last_week"), "7")); Since.Items.Add(new ListItem(GetText("last_two_weeks"), "14")); Since.Items.Add(new ListItem(GetText("last_month"), "31")); } BindData(); }
protected void BindData() { // Active users // Call this before forum_stats to clean up active users ActiveUsers1.ActiveUserTable = YAF.Classes.Data.DB.active_list(PageContext.PageBoardID, null); // "Active Users" Count and Most Users Count DataRow activeStats = YAF.Classes.Data.DB.active_stats(PageContext.PageBoardID); ActiveUserCount.Text = FormatActiveUsers(activeStats); // Forum Statistics string key = YafCache.GetBoardCacheKey(Constants.Cache.BoardStats); DataRow statisticsDataRow = ( DataRow )Cache [key]; if (statisticsDataRow == null) { statisticsDataRow = YAF.Classes.Data.DB.board_poststats(PageContext.PageBoardID); Cache.Insert(key, statisticsDataRow, null, DateTime.Now.AddMinutes(PageContext.BoardSettings.ForumStatisticsCacheTimeout), TimeSpan.Zero); } // show max users... if (!statisticsDataRow.IsNull("MaxUsers")) { MostUsersCount.Text = String.Format(PageContext.Localization.GetText("MAX_ONLINE"), statisticsDataRow ["MaxUsers"], YafDateTime.FormatDateTimeTopic(statisticsDataRow ["MaxUsersWhen"])); } else { MostUsersCount.Text = String.Format(PageContext.Localization.GetText("MAX_ONLINE"), activeStats ["ActiveUsers"], YafDateTime.FormatDateTimeTopic(DateTime.Now)); } // Posts and Topic Count... StatsPostsTopicCount.Text = String.Format(PageContext.Localization.GetText("stats_posts"), statisticsDataRow ["posts"], statisticsDataRow ["topics"], statisticsDataRow ["forums"]); // Last post if (!statisticsDataRow.IsNull("LastPost")) { StatsLastPostHolder.Visible = true; LastPostUserLink.UserID = Convert.ToInt32(statisticsDataRow ["LastUserID"]); LastPostUserLink.UserName = statisticsDataRow ["LastUser"].ToString(); StatsLastPost.Text = String.Format(PageContext.Localization.GetText("stats_lastpost"), YafDateTime.FormatDateTimeTopic(( DateTime )statisticsDataRow ["LastPost"])); } else { StatsLastPostHolder.Visible = false; } // Member Count StatsMembersCount.Text = String.Format(PageContext.Localization.GetText("stats_members"), statisticsDataRow ["members"]); // Newest Member StatsNewestMember.Text = PageContext.Localization.GetText("stats_lastmember"); NewestMemberUserLink.UserID = Convert.ToInt32(statisticsDataRow ["LastMemberID"]); NewestMemberUserLink.UserName = statisticsDataRow ["LastMember"].ToString(); }
private void BindData() { int userID = ( int )Security.StringToLongOrRedirect(Request.QueryString ["u"]); MembershipUser user = UserMembershipHelper.GetMembershipUser(userID); if (user == null) { YafBuildLink.AccessDenied(/*No such user exists*/); } YafCombinedUserData userData = new YafCombinedUserData(user, userID); // populate user information controls... UserName.Text = HtmlEncode(userData.Membership.UserName); Name.Text = HtmlEncode(userData.Membership.UserName); Joined.Text = String.Format("{0}", YafDateTime.FormatDateLong(Convert.ToDateTime(userData.Joined))); LastVisit.Text = YafDateTime.FormatDateTime(userData.LastVisit); Rank.Text = userData.RankName; Location.Text = HtmlEncode(General.BadWordReplace(userData.Profile.Location)); RealName.InnerHtml = HtmlEncode(General.BadWordReplace(userData.Profile.RealName)); Interests.InnerHtml = HtmlEncode(General.BadWordReplace(userData.Profile.Interests)); Occupation.InnerHtml = HtmlEncode(General.BadWordReplace(userData.Profile.Occupation)); Gender.InnerText = GetText("GENDER" + userData.Profile.Gender); PageLinks.Clear(); PageLinks.AddLink(PageContext.BoardSettings.Name, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.forum)); PageLinks.AddLink(GetText("MEMBERS"), YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.members)); PageLinks.AddLink(userData.Membership.UserName, ""); double dAllPosts = 0.0; if (SqlDataLayerConverter.VerifyInt32(userData.DBRow["NumPostsForum"]) > 0) { dAllPosts = 100.0 * SqlDataLayerConverter.VerifyInt32(userData.DBRow["NumPosts"]) / SqlDataLayerConverter.VerifyInt32(userData.DBRow["NumPostsForum"]); } Stats.InnerHtml = String.Format("{0:N0}<br/>[{1} / {2}]", userData.DBRow ["NumPosts"], String.Format(GetText("NUMALL"), dAllPosts), String.Format(GetText("NUMDAY"), (double)SqlDataLayerConverter.VerifyInt32(userData.DBRow["NumPosts"]) / SqlDataLayerConverter.VerifyInt32(userData.DBRow["NumDays"])) ); // private messages ///CHANGED THIS ON 12/1/2010 //PM.Visible = !userData.IsGuest && User != null && PageContext.BoardSettings.AllowPrivateMessages; PM.Visible = false; PM.NavigateUrl = YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.pmessage, "u={0}", userData.UserID); // email link Email.Visible = !userData.IsGuest && User != null && PageContext.BoardSettings.AllowEmailSending; Email.NavigateUrl = YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.im_email, "u={0}", userData.UserID); if (PageContext.IsAdmin) { Email.TitleNonLocalized = userData.Membership.Email; } // homepage link Home.Visible = !String.IsNullOrEmpty(userData.Profile.Homepage); SetupThemeButtonWithLink(Home, userData.Profile.Homepage); // blog link Blog.Visible = !String.IsNullOrEmpty(userData.Profile.Blog); SetupThemeButtonWithLink(Blog, userData.Profile.Blog); MSN.Visible = (User != null && !String.IsNullOrEmpty(userData.Profile.MSN)); MSN.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.im_email, "u={0}", userData.UserID); YIM.Visible = (User != null && !String.IsNullOrEmpty(userData.Profile.YIM)); YIM.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.im_yim, "u={0}", userData.UserID); AIM.Visible = (User != null && !String.IsNullOrEmpty(userData.Profile.AIM)); AIM.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.im_aim, "u={0}", userData.UserID); ICQ.Visible = (User != null && !String.IsNullOrEmpty(userData.Profile.ICQ)); ICQ.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.im_icq, "u={0}", userData.UserID); Skype.Visible = (User != null && !String.IsNullOrEmpty(userData.Profile.Skype)); Skype.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.im_skype, "u={0}", userData.UserID); // localize tab titles... AboutTab.HeaderText = GetText("ABOUT"); StatisticsTab.HeaderText = GetText("STATISTICS"); AvatarTab.HeaderText = GetText("AVATAR"); Last10PostsTab.HeaderText = GetText("LAST10"); if (PageContext.BoardSettings.AvatarUpload && userData.HasAvatarImage) { Avatar.ImageUrl = YafForumInfo.ForumRoot + "resource.ashx?u=" + (userID); } else if (!String.IsNullOrEmpty(userData.Avatar)) // Took out PageContext.BoardSettings.AvatarRemote { Avatar.ImageUrl = String.Format("{3}resource.ashx?url={0}&width={1}&height={2}", Server.UrlEncode(userData.Avatar), PageContext.BoardSettings.AvatarWidth, PageContext.BoardSettings.AvatarHeight, YafForumInfo.ForumRoot); } else { Avatar.Visible = false; AvatarTab.Visible = false; } Groups.DataSource = Roles.GetRolesForUser(UserMembershipHelper.GetUserNameFromID(userID)); //EmailRow.Visible = PageContext.IsAdmin; ModerateTab.Visible = PageContext.IsAdmin || PageContext.IsForumModerator; AdminUserButton.Visible = PageContext.IsAdmin; if (LastPosts.Visible) { LastPosts.DataSource = YAF.Classes.Data.DB.post_last10user(PageContext.PageBoardID, Request.QueryString ["u"], PageContext.PageUserID); SearchUser.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.search, "postedby={0}", userData.Membership.UserName); } DataBind(); }
void ForumWelcome_PreRender(object sender, EventArgs e) { TimeNow.Text = String.Format(PageContext.Localization.GetText("Current_Time"), YafDateTime.FormatTime(DateTime.Now)); TimeLastVisit.Text = String.Format(PageContext.Localization.GetText("last_visit"), YafDateTime.FormatDateTime(Mession.LastVisit)); if (PageContext.UnreadPrivate > 0) { UnreadMsgs.Visible = true; UnreadMsgs.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.cp_pm); if (PageContext.UnreadPrivate == 1) { UnreadMsgs.Text = String.Format(PageContext.Localization.GetText("unread1"), PageContext.UnreadPrivate); } else { UnreadMsgs.Text = String.Format(PageContext.Localization.GetText("unread0"), PageContext.UnreadPrivate); } } }
private void DisplayPost_PreRender(object sender, EventArgs e) { Attach.Visible = !PostDeleted && CanAttach && !IsLocked; Attach.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.attachments, "m={0}", MessageId); Edit.Visible = !PostDeleted && CanEditPost && !IsLocked; Edit.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.postmessage, "m={0}", MessageId); MovePost.Visible = PageContext.ForumModeratorAccess && !IsLocked; MovePost.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.movemessage, "m={0}", MessageId); Delete.Visible = !PostDeleted && CanDeletePost && !IsLocked; Delete.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.deletemessage, "m={0}&action=delete", MessageId); UnDelete.Visible = CanUnDeletePost && !IsLocked; UnDelete.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.deletemessage, "m={0}&action=undelete", MessageId); Quote.Visible = !PostDeleted && CanReply && !IsLocked; Quote.NavigateUrl = YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.postmessage, "t={0}&f={1}&q={2}", PageContext.PageTopicID, PageContext.PageForumID, MessageId); // report posts ReportButton.Visible = PageContext.BoardSettings.AllowReportAbuse && !IsGuest; // Mek Addition 08/18/2007 ReportButton.Text = PageContext.Localization.GetText("REPORTPOST"); // Mek Addition 08/18/2007 ReportButton.Attributes.Add("onclick", String.Format("return confirm('{0}');", PageContext.Localization.GetText("CONFIRM_REPORTPOST"))); // report spam ReportSpamButton.Visible = PageContext.BoardSettings.AllowReportSpam && !IsGuest; // Mek Addition 08/18/2007 ReportSpamButton.Text = PageContext.Localization.GetText("REPORTSPAM"); // Mek Addition 08/18/2007 ReportSpamButton.Attributes.Add("onclick", String.Format("return confirm('{0}');", PageContext.Localization.GetText("CONFIRM_REPORTSPAM"))); // private messages Pm.Visible = !IsGuest && !PostDeleted && PageContext.User != null && PageContext.BoardSettings.AllowPrivateMessages && !IsSponserMessage; Pm.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.pmessage, "u={0}", UserId); // emailing Email.Visible = !IsGuest && !PostDeleted && PageContext.User != null && PageContext.BoardSettings.AllowEmailSending && !IsSponserMessage; Email.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.im_email, "u={0}", UserId); // home page Home.Visible = !PostDeleted && !String.IsNullOrEmpty(UserProfile.Homepage); SetupThemeButtonWithLink(Home, UserProfile.Homepage); // blog page Blog.Visible = !PostDeleted && !String.IsNullOrEmpty(UserProfile.Blog); SetupThemeButtonWithLink(Blog, UserProfile.Blog); // MSN Msn.Visible = !PostDeleted && PageContext.User != null && !String.IsNullOrEmpty(UserProfile.MSN); Msn.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.im_email, "u={0}", UserId); // Yahoo IM Yim.Visible = !PostDeleted && PageContext.User != null && !String.IsNullOrEmpty(UserProfile.YIM); Yim.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.im_yim, "u={0}", UserId); // AOL IM Aim.Visible = !PostDeleted && PageContext.User != null && !String.IsNullOrEmpty(UserProfile.AIM); Aim.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.im_aim, "u={0}", UserId); // ICQ Icq.Visible = !PostDeleted && PageContext.User != null && !String.IsNullOrEmpty(UserProfile.ICQ); Icq.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.im_icq, "u={0}", UserId); // Skype Skype.Visible = !PostDeleted && PageContext.User != null && !String.IsNullOrEmpty(UserProfile.Skype); Skype.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.im_skype, "u={0}", UserId); if (!PostDeleted) { AdminInformation.InnerHtml = @"<span class=""smallfont"">"; if (Convert.ToDateTime(DataRow ["Edited"]) > Convert.ToDateTime(DataRow ["Posted"]).AddSeconds(PageContext.BoardSettings.EditTimeOut)) { // message has been edited // show, why the post was edited or deleted? string whoChanged = (Convert.ToBoolean(DataRow["IsModeratorChanged"])) ? PageContext.Localization.GetText("EDITED_BY_MOD") : PageContext.Localization.GetText("EDITED_BY_USER"); AdminInformation.InnerHtml += String.Format(@"| <span class=""editedinfo"">{0} {1}:</span> {2}", PageContext.Localization.GetText("EDITED"), whoChanged, YafDateTime.FormatDateTimeShort(Convert.ToDateTime(DataRow["Edited"]))); if (Server.HtmlDecode(Convert.ToString(DataRow ["EditReason"])) != "") { // reason was specified AdminInformation.InnerHtml += String.Format(" |<b> {0}:</b> {1}", PageContext.Localization.GetText("EDIT_REASON"), FormatMsg.RepairHtml((string)DataRow["EditReason"], true)); } else { //reason was not specified AdminInformation.InnerHtml += String.Format(" |<b> {0}:</b> {1}", PageContext.Localization.GetText("EDIT_REASON"), PageContext.Localization.GetText("EDIT_REASON_NA")); } } } else { AdminInformation.InnerHtml = @"<span class=""smallfont"">"; if (Server.HtmlDecode(Convert.ToString(DataRow ["DeleteReason"])) != String.Empty) { // reason was specified AdminInformation.InnerHtml += String.Format(" |<b> {0}:</b> {1}", PageContext.Localization.GetText("EDIT_REASON"), FormatMsg.RepairHtml((string)DataRow["DeleteReason"], true)); } else { //reason was not specified AdminInformation.InnerHtml += String.Format(" |<b> {0}:</b> {1}", PageContext.Localization.GetText("EDIT_REASON"), PageContext.Localization.GetText("EDIT_REASON_NA")); } } // display admin only info if (PageContext.IsAdmin) { AdminInformation.InnerHtml += String.Format(" |<b> {0}:</b> {1}", PageContext.Localization.GetText("IP"), DataRow["IP"].ToString()); } AdminInformation.InnerHtml += "</span>"; }
protected string GetPrintHeader(object o) { DataRowView row = ( DataRowView )o; return(String.Format("<b>{2}: {0}</b> - {1}", row ["UserName"], YafDateTime.FormatDateTime(( DateTime )row ["Posted"]), GetText("postedby"))); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here if (!IsPostBack) { // localize button label Continue.Text = GetText("continue"); // get redirect URL from parameter if (Request.QueryString["url"] != null) { // unescape ampersands RefreshURL = Request.QueryString["url"].Replace("&", "&"); } // try to get infomessage code from parameter try { // compare it converted to enumeration switch ((InfoMessage)int.Parse(Request.QueryString["i"])) { case InfoMessage.Moderated: /// Moderated Title.Text = GetText("title_moderated"); Info.Text = GetText("moderated"); break; case InfoMessage.Suspended: /// Suspended Title.Text = GetText("title_suspended"); Info.Text = String.Format(GetText("suspended"), YafDateTime.FormatDateTime(PageContext.SuspendedUntil)); break; case InfoMessage.RegistrationEmail: /// Registration email Title.Text = GetText("title_registration"); Info.Text = GetText("registration"); RefreshTime = 10; RefreshURL = YafBuildLink.GetLink(ForumPages.login); break; case InfoMessage.AccessDenied: /// Access Denied Title.Text = GetText("title_accessdenied"); Info.Text = GetText("accessdenied"); RefreshTime = 10; RefreshURL = YafBuildLink.GetLink(ForumPages.forum); break; case InfoMessage.Disabled: /// Disabled feature Title.Text = GetText("TITLE_ACCESSDENIED"); Info.Text = GetText("DISABLED"); RefreshTime = 10; RefreshURL = YafBuildLink.GetLink(ForumPages.forum); break; case InfoMessage.Invalid: /// Invalid argument! Title.Text = GetText("TITLE_INVALID"); Info.Text = GetText("INVALID"); RefreshTime = 10; RefreshURL = YafBuildLink.GetLink(ForumPages.forum); break; case InfoMessage.Failure: // some sort of failure Title.Text = GetText("TITLE_FAILURE"); Info.Text = GetText("FAILURE"); RefreshTime = 10; RefreshURL = YafBuildLink.GetLink(ForumPages.forum); break; } } // exception was thrown catch (Exception) { // get title for exception message Title.Text = GetText("title_exception"); // exception message Info.Text = string.Format("{1} <b>{0}</b>.", PageContext.PageUserName, GetText("exception")); // redirect to forum main after 2 seconds RefreshTime = 2; RefreshURL = YafBuildLink.GetLink(ForumPages.forum); } // set continue button URL and visibility Continue.NavigateUrl = RefreshURL; Continue.Visible = RefreshURL != null; // create page links - must be placed after switch to display correct title (last breadcrumb trail) CreatePageLinks(); } }