Esempio n. 1
0
        private void save_Click(object sender, EventArgs e)
        {
            string body = sig.Text;

            body = FormatMsg.RepairHtml(this, body, false);

            if (sig.Text.Length > 0)
            {
                DB.user_savesignature(PageUserID, body);
            }
            else
            {
                DB.user_savesignature(PageUserID, DBNull.Value);
            }
            Forum.Redirect(Pages.cp_profile);
        }
        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>";
        }
Esempio n. 3
0
        protected string FormatUserBox()
        {
            System.Data.DataRowView row = DataRow;
            string html = "";

            // Avatar
            if (ForumPage.BoardSettings.AvatarUpload && row["HasAvatarImage"] != null && long.Parse(row["HasAvatarImage"].ToString()) > 0)
            {
                html += String.Format("<img src='{1}image.aspx?u={0}'><br clear=\"all\"/>", row["UserID"], Data.ForumRoot);
            }
            else if (row["user_avatar"].ToString().Length > 0)
            {
                string s = row["user_avatar"].ToString();
                if (s == null || s == string.Empty)
                {
                    s = User.DefaultAvatar;
                }
                html += String.Format("<img src='{0}' width='50px' height='50px'><br clear=\"all\"/>",
                                      s
                                      );
            }

            // Rank Image
            if (row["RankImage"].ToString().Length > 0)
            {
                html += String.Format("<img align=left src=\"{0}images/ranks/{1}\"/><br clear=\"all\"/>", Data.ForumRoot, row["RankImage"]);
            }

            // Rank
            html += String.Format("{0}: {1}<br clear=\"all\"/>", ForumPage.GetText("rank"), row["RankName"]);

            // Groups
            if (ForumPage.BoardSettings.ShowGroups)
            {
                using (DataTable dt = DB.usergroup_list(row["UserID"]))
                {
                    html += String.Format("{0}: ", ForumPage.GetText("groups"));
                    bool bFirst = true;
                    foreach (DataRow grp in dt.Rows)
                    {
                        if (bFirst)
                        {
                            html  += grp["Name"].ToString();
                            bFirst = false;
                        }
                        else
                        {
                            html += String.Format(", {0}", grp["Name"]);
                        }
                    }
                    html += "<br/>";
                }
            }

            // Extra row
            html += "<br/>";

            // Joined
            html += String.Format("{0}: {1}<br/>", ForumPage.GetText("joined"), ForumPage.FormatDateShort((DateTime)row["user_registDate"]));

            // Posts
            html += String.Format("{0}: {1:N0}<br/>", ForumPage.GetText("posts"), row["Posts"]);

            // Location
            if (row["Location"].ToString().Length > 0)
            {
                html += String.Format("{0}: {1}<br/>", ForumPage.GetText("location"), FormatMsg.RepairHtml(ForumPage, row["Location"].ToString(), false));
            }

            return(html);
        }