示例#1
0
        /// <summary>
        /// The init edited post.
        /// </summary>
        /// <param name="currentRow">
        /// The current row.
        /// </param>
        /// <param name="message">
        /// The message.
        /// </param>
        /// <param name="messageFlags">
        /// The message flags.
        /// </param>
        private void InitEditedPost(DataRow currentRow, string message, MessageFlags messageFlags)
        {
            // If the message is in YafBBCode but the editor uses HTML, convert the message text to HTML
            if (messageFlags.IsBBCode && this._forumEditor.UsesHTML)
            {
                message = YafBBCode.ConvertBBCodeToHtmlForEdit(message);
            }

            this._forumEditor.Text = message;

            this.Title.Text = this.GetText("EDIT");

            // add topic link...
            this.PageLinks.AddLink(
                this.Server.HtmlDecode(currentRow["Topic"].ToString()),
                YafBuildLink.GetLink(ForumPages.posts, "m={0}", this.EditMessageID));

            // editing..
            this.PageLinks.AddLink(this.GetText("EDIT"));

            string blogPostID = currentRow["BlogPostID"].ToString();

            if (blogPostID != string.Empty)
            {
                // The user used this post to blog
                this.BlogPostID.Value   = blogPostID;
                this.PostToBlog.Checked = true;
                this.BlogRow.Visible    = true;
            }

            this.TopicSubjectTextBox.Text = this.Server.HtmlDecode(Convert.ToString(currentRow["Topic"]));

            if ((Convert.ToInt32(currentRow["TopicOwnerID"]) == Convert.ToInt32(currentRow["UserID"])) ||
                this.PageContext.ForumModeratorAccess)
            {
                // allow editing of the topic subject
                this.TopicSubjectTextBox.Enabled = true;
            }
            else
            {
                // disable the subject
                this.TopicSubjectTextBox.Enabled = false;
            }

            this.Priority.SelectedItem.Selected = false;
            this.Priority.Items.FindByValue(currentRow["Priority"].ToString()).Selected = true;
            this.EditReasonRow.Visible          = true;
            this.ReasonEditor.Text              = this.Server.HtmlDecode(Convert.ToString(currentRow["EditReason"]));
            this.PostOptions1.PersistantChecked = messageFlags.IsPersistent;
        }
示例#2
0
        /// <summary>
        /// The init quoted reply.
        /// </summary>
        /// <param name="currentRow">
        /// The current row.
        /// </param>
        /// <param name="message">
        /// The message.
        /// </param>
        /// <param name="messageFlags">
        /// The message flags.
        /// </param>
        private void InitQuotedReply(DataRow currentRow, string message, MessageFlags messageFlags)
        {
            if (this.PageContext.BoardSettings.RemoveNestedQuotes)
            {
                message = YafFormatMessage.RemoveNestedQuotes(message);
            }

            // If the message being quoted in YafBBCode but the editor uses HTML, convert the message text to HTML
            if (messageFlags.IsBBCode && this._forumEditor.UsesHTML)
            {
                message = YafBBCode.ConvertBBCodeToHtmlForEdit(message);
            }

            // Ensure quoted replies have bad words removed from them
            message = this.Get <YafBadWordReplace>().Replace(message);

            // Quote the original message
            this._forumEditor.Text = "[quote={0};{1}]{2}[/quote]\n".FormatWith(this.PageContext.UserDisplayName.GetName(currentRow.Field <int>("UserID")), currentRow.Field <int>("MessageID"), message).TrimStart();
        }
示例#3
0
        /// <summary>
        /// The page_ load.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void Page_Load(object sender, EventArgs e)
        {
            // check if this feature is disabled
            if (!this.PageContext.BoardSettings.AllowPrivateMessages)
            {
                YafBuildLink.RedirectInfoPage(InfoMessage.Disabled);
            }

            if (!this.IsPostBack)
            {
                if (this.Request.QueryString.GetFirstOrDefault("pm").IsNotSet())
                {
                    YafBuildLink.AccessDenied();
                }

                this.PageLinks.AddLink(this.PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum));
                this.PageLinks.AddLink(this.PageContext.PageUserName, YafBuildLink.GetLink(ForumPages.cp_profile));

                // handle custom YafBBCode javascript or CSS...
                YafBBCode.RegisterCustomBBCodePageElements(this.Page, this.GetType());

                this.BindData();
            }
        }
示例#4
0
        /// <summary>
        /// The page_ load.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                this.CreateUserWizard1.MembershipProvider = Config.MembershipProvider;

                this.PageLinks.AddLink(this.PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum));
                this.PageLinks.AddLink(this.GetText("TITLE"));

                // handle the CreateUser Step localization
                this.SetupCreateUserStep();

                // handle other steps localization
                ((Button)this.CreateUserWizard1.FindWizardControlRecursive("ProfileNextButton")).Text = this.GetText("SAVE");
                ((Button)this.CreateUserWizard1.FindWizardControlRecursive("ContinueButton")).Text    = this.GetText("CONTINUE");

                // get the time zone data source
                var timeZones = (DropDownList)this.CreateUserWizard1.FindWizardControlRecursive("TimeZones");
                timeZones.DataSource = StaticDataHelper.TimeZones();

                if (_userIpLocator == null)
                {
                    // vzrus: we should always get not null class here
                    _userIpLocator = new IPDetails().GetData(HttpContext.Current.Request.UserHostAddress, true);
                }
                // fill dst field
                if (this._userIpLocator.Isdst.IsSet() && _userIpLocator.Status.ToUpper() == "OK")
                {
                    this.CreateUserWizard1.FindControlRecursiveAs <CheckBox>("DSTUser").Checked = _userIpLocator.Isdst == "1" ? true : false;
                }
                // fill location field
                if (this._userIpLocator.Isdst.IsSet() && _userIpLocator.Status.ToUpper() == "OK")
                {
                    // Trying to consume data about user IP whereabouts
                    if (_userIpLocator.Status == "OK")
                    {
                        string txtLoc = String.Empty;
                        if (this._userIpLocator.CountryName.IsSet())
                        {
                            txtLoc += _userIpLocator.CountryName;
                        }
                        if (this._userIpLocator.RegionName.IsSet())
                        {
                            txtLoc += ", " + _userIpLocator.RegionName;
                        }
                        if (this._userIpLocator.City.IsSet())
                        {
                            txtLoc += ", " + _userIpLocator.City;
                        }
                        this.CreateUserWizard1.FindControlRecursiveAs <TextBox>("Location").Text = txtLoc;
                    }
                }


                if (!this.PageContext.BoardSettings.EmailVerification)
                {
                    // automatically log in created users
                    this.CreateUserWizard1.LoginCreatedUser   = true;
                    this.CreateUserWizard1.DisableCreatedUser = false;

                    // success notification localization
                    ((Literal)this.CreateUserWizard1.FindWizardControlRecursive("AccountCreated")).Text =
                        YafBBCode.MakeHtml(this.GetText("ACCOUNT_CREATED"), true, false);
                }
                else
                {
                    this.CreateUserWizard1.LoginCreatedUser   = false;
                    this.CreateUserWizard1.DisableCreatedUser = true;

                    // success notification localization
                    ((Literal)this.CreateUserWizard1.FindWizardControlRecursive("AccountCreated")).Text =
                        YafBBCode.MakeHtml(this.GetText("ACCOUNT_CREATED_VERIFICATION"), true, false);
                }

                this.CreateUserWizard1.FinishDestinationPageUrl = YafForumInfo.ForumURL;

                this.DataBind();
                int tz = 0;
                if (_userIpLocator.Status == "OK")
                {
                    if (this._userIpLocator.Gmtoffset.IsSet() && (this._userIpLocator.Isdst.IsSet()))
                    {
                        tz = (Convert.ToInt32(_userIpLocator.Gmtoffset) - Convert.ToInt32(_userIpLocator.Isdst) * 3600) / 60;
                    }
                }

                timeZones.Items.FindByValue(tz.ToString()).Selected = true;
                this.CreateUserWizard1.FindWizardControlRecursive("UserName").Focus();
            }

            // password requirement parameters...
            var requirementText = (LocalizedLabel)this.CreateUserStepContainer.FindControl("LocalizedLabelRequirementsText");

            requirementText.Param0 = this.PageContext.CurrentMembership.MinRequiredPasswordLength.ToString();
            requirementText.Param1 = this.PageContext.CurrentMembership.MinRequiredNonAlphanumericCharacters.ToString();

            // max user name length
            var usernamelehgthText =
                (LocalizedLabel)this.CreateUserStepContainer.FindControl("LocalizedLabelLohgUserNameWarnText");

            usernamelehgthText.Param0 = this.PageContext.BoardSettings.UserNameMaxLength.ToString();

            if (this.PageContext.BoardSettings.CaptchaTypeRegister == 2)
            {
                this.SetupRecaptchaControl();
            }
        }