Example #1
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        private void BindData()
        {
            this.ViewPostsLink.NavigateUrl = YafBuildLink.GetLinkNotEscaped(
                ForumPages.search,
                "postedby={0}",
                !this.CurrentUserDataHelper.IsGuest
                    ? (this.Get <YafBoardSettings>().EnableDisplayName
                           ? this.CurrentUserDataHelper.DisplayName
                           : this.CurrentUserDataHelper.UserName)
                    : UserMembershipHelper.GuestUserName);

            this.Kill.Text = this.GetText("ADMIN_EDITUSER", "HEAD_KILL_USER");
            ControlHelper.AddOnClickConfirmDialog(this.Kill, this.GetText("ADMIN_EDITUSER", "KILL_USER_CONFIRM"));

            this.ReportUserRow.Visible = this.Get <YafBoardSettings>().StopForumSpamApiKey.IsSet();

            // load ip address history for user...
            foreach (var ipAddress in this.IPAddresses)
            {
                this.IpAddresses.Text +=
                    "<a href=\"{0}\" target=\"_blank\" title=\"{1}\">{2}</a><br />".FormatWith(
                        this.Get <YafBoardSettings>().IPInfoPageURL.FormatWith(ipAddress),
                        this.GetText("COMMON", "TT_IPDETAILS"),
                        ipAddress);
            }

            // 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.Rows.Count.ToString();

            // get user's info
            this.CurrentUser =
                LegacyDb.UserList(
                    this.PageContext.PageBoardID,
                    this.CurrentUserID.ToType <int?>(),
                    null,
                    null,
                    null,
                    false).FirstOrDefault();

            // there is no such user
            if (this.CurrentUser != null && this.CurrentUser.Suspended.HasValue)
            {
                this.SuspendedTo.Visible = true;

                // is user suspended?
                this.SuspendedTo.Text = "({0} {1})".FormatWith(
                    this.GetText("PROFILE", "ENDS"),
                    this.Get <IDateTime>().FormatDateTime(this.CurrentUser.Suspended));
            }

            this.DataBind();
        }
Example #2
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        private void BindData()
        {
            this.ViewPostsLink.NavigateUrl = YafBuildLink.GetLinkNotEscaped(
                ForumPages.search,
                "postedby={0}",
                !this.CurrentUserDataHelper.IsGuest
                    ? this.Get <YafBoardSettings>().EnableDisplayName ? this.CurrentUserDataHelper.DisplayName :
                this.CurrentUserDataHelper.UserName
                    : UserMembershipHelper.GuestUserName);

            this.ReportUserRow.Visible = this.Get <YafBoardSettings>().StopForumSpamApiKey.IsSet();

            // load ip address history for user...
            this.IPAddresses.Take(5).ForEach(
                ipAddress => this.IpAddresses.Text +=
                    $@"<a href=""{string.Format(this.Get<YafBoardSettings>().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>().UserList(
                this.PageContext.PageBoardID,
                this.CurrentUserId.ToType <int?>(),
                null,
                null,
                null,
                false).FirstOrDefault();

            // there is no such user
            if (this.CurrentUser?.Suspended != null)
            {
                this.SuspendedTo.Visible = true;

                // is user suspended?
                this.SuspendedTo.Text =
                    $"({this.GetText("PROFILE", "ENDS")} {this.Get<IDateTime>().FormatDateTime(this.CurrentUser.Suspended)})";
            }

            this.DataBind();
        }