コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TypedMessageList" /> class.
 /// </summary>
 /// <param name="messageid">The messageid.</param>
 /// <param name="userid">The userid.</param>
 /// <param name="username">The username.</param>
 /// <param name="message">The message.</param>
 /// <param name="topicid">The topicid.</param>
 /// <param name="forumid">The forumid.</param>
 /// <param name="topic">The topic.</param>
 /// <param name="priority">The priority.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="topicownerid">The topicownerid.</param>
 /// <param name="edited">The edited.</param>
 /// <param name="topicflags">The topicflags.</param>
 /// <param name="forumflags">The forumflags.</param>
 /// <param name="editreason">The editreason.</param>
 /// <param name="position">The position.</param>
 /// <param name="ismoderatorchanged">The ismoderatorchanged.</param>
 /// <param name="deletereason">The deletereason.</param>
 /// <param name="blogpostid">The blogpostid.</param>
 /// <param name="pollid">The pollid.</param>
 /// <param name="ip">The ip.</param>
 /// <param name="replyTo">The reply to.</param>
 /// <param name="externalmessageid">The externalmessageid.</param>
 /// <param name="referencemessageid">The referencemessageid.</param>
 /// <param name="description">The description.</param>
 /// <param name="status">The status.</param>
 /// <param name="styles">The styles.</param>
 public TypedMessageList(
     int?messageid,
     int?userid,
     [CanBeNull] string username,
     [CanBeNull] string message,
     int?topicid,
     int?forumid,
     [CanBeNull] string topic,
     int?priority,
     [CanBeNull] MessageFlags flags,
     int?topicownerid,
     DateTime?edited,
     [CanBeNull] TopicFlags topicflags,
     [CanBeNull] ForumFlags forumflags,
     [CanBeNull] string editreason,
     int?position,
     bool?ismoderatorchanged,
     [CanBeNull] string deletereason,
     [CanBeNull] string blogpostid,
     int?pollid,
     [CanBeNull] string ip,
     int?replyTo,
     [CanBeNull] string externalmessageid,
     [CanBeNull] string referencemessageid,
     [CanBeNull] string description,
     [CanBeNull] string status,
     [CanBeNull] string styles)
 {
     this.MessageID          = messageid;
     this.UserID             = userid;
     this.UserName           = username;
     this.Message            = message;
     this.TopicID            = topicid;
     this.ForumID            = forumid;
     this.Topic              = topic;
     this.Priority           = priority;
     this.Flags              = flags;
     this.TopicOwnerID       = topicownerid;
     this.Edited             = edited;
     this.TopicFlags         = topicflags;
     this.ForumFlags         = forumflags;
     this.EditReason         = editreason;
     this.Position           = position;
     this.IsModeratorChanged = ismoderatorchanged;
     this.DeleteReason       = deletereason;
     this.BlogPostID         = blogpostid;
     this.PollID             = pollid;
     this.IP                 = ip;
     this.ReplyTo            = replyTo;
     this.ExternalMessageId  = externalmessageid;
     this.ReferenceMessageId = referencemessageid;
     this.Status             = status;
     this.Styles             = styles;
     this.Description        = description;
 }
コード例 #2
0
		protected void ForumList1_ItemCreated( object sender, RepeaterItemEventArgs e )
		{
			if ( e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem )
			{
				DataRow row = ( DataRow )e.Item.DataItem;
				ForumFlags flags = new ForumFlags(row["Flags"]);
				DateTime lastRead = Mession.GetForumRead( ( int )row ["ForumID"] );
				DateTime lastPosted = row ["LastPosted"] != DBNull.Value ? ( DateTime )row ["LastPosted"] : lastRead;

				ThemeImage forumIcon = e.Item.FindControl( "ThemeForumIcon" ) as ThemeImage;

				forumIcon.ThemeTag = "FORUM";
				forumIcon.LocalizedTitlePage = "ICONLEGEND";
				forumIcon.LocalizedTitleTag = "NO_NEW_POSTS";

				try
				{
					if ( flags.IsLocked )
					{
						forumIcon.ThemeTag = "FORUM_LOCKED";
						forumIcon.LocalizedTitlePage = "ICONLEGEND";
						forumIcon.LocalizedTitleTag = "FORUM_LOCKED";
					}
					else if ( lastPosted > lastRead )
					{
						forumIcon.ThemeTag = "FORUM_NEW";
						forumIcon.LocalizedTitlePage = "ICONLEGEND";
						forumIcon.LocalizedTitleTag = "NEW_POSTS";
					}
					else
					{
						forumIcon.ThemeTag = "FORUM";
						forumIcon.LocalizedTitlePage = "ICONLEGEND";
						forumIcon.LocalizedTitleTag = "NO_NEW_POSTS";
					}
				}
				catch
				{

				}
				
				if ( !PageContext.BoardSettings.ShowModeratorList )
				{
					// hide moderator list...
					HtmlTableCell moderatorColumn = e.Item.FindControl( "ModeratorListTD" ) as HtmlTableCell;
					ForumModeratorList modList = e.Item.FindControl( "ModeratorList" ) as ForumModeratorList;

					// set them as invisible...
					moderatorColumn.Visible = false;
					modList.Visible = false;
				}
			}
		}
コード例 #3
0
        protected void ForumList1_ItemCreated(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataRow    row        = ( DataRow )e.Item.DataItem;
                ForumFlags flags      = new ForumFlags(row["Flags"]);
                DateTime   lastRead   = Mession.GetForumRead(( int )row ["ForumID"]);
                DateTime   lastPosted = row ["LastPosted"] != DBNull.Value ? ( DateTime )row ["LastPosted"] : lastRead;

                ThemeImage forumIcon = e.Item.FindControl("ThemeForumIcon") as ThemeImage;

                forumIcon.ThemeTag           = "FORUM";
                forumIcon.LocalizedTitlePage = "ICONLEGEND";
                forumIcon.LocalizedTitleTag  = "NO_NEW_POSTS";

                try
                {
                    if (flags.IsLocked)
                    {
                        forumIcon.ThemeTag           = "FORUM_LOCKED";
                        forumIcon.LocalizedTitlePage = "ICONLEGEND";
                        forumIcon.LocalizedTitleTag  = "FORUM_LOCKED";
                    }
                    else if (lastPosted > lastRead)
                    {
                        forumIcon.ThemeTag           = "FORUM_NEW";
                        forumIcon.LocalizedTitlePage = "ICONLEGEND";
                        forumIcon.LocalizedTitleTag  = "NEW_POSTS";
                    }
                    else
                    {
                        forumIcon.ThemeTag           = "FORUM";
                        forumIcon.LocalizedTitlePage = "ICONLEGEND";
                        forumIcon.LocalizedTitleTag  = "NO_NEW_POSTS";
                    }
                }
                catch
                {
                }

                if (!PageContext.BoardSettings.ShowModeratorList)
                {
                    // hide moderator list...
                    HtmlTableCell      moderatorColumn = e.Item.FindControl("ModeratorListTD") as HtmlTableCell;
                    ForumModeratorList modList         = e.Item.FindControl("ModeratorList") as ForumModeratorList;

                    // set them as invisible...
                    moderatorColumn.Visible = false;
                    modList.Visible         = false;
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// Saves a Forum or if forumId is null creates a new Forum
        /// </summary>
        /// <param name="repository">
        /// The repository.
        /// </param>
        /// <param name="forumID">
        /// The forum id.
        /// </param>
        /// <param name="categoryID">
        /// The category id.
        /// </param>
        /// <param name="parentID">
        /// The parent id.
        /// </param>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <param name="description">
        /// The description.
        /// </param>
        /// <param name="sortOrder">
        /// The sort order.
        /// </param>
        /// <param name="locked">
        /// The locked.
        /// </param>
        /// <param name="hidden">
        /// The hidden.
        /// </param>
        /// <param name="isTest">
        /// The is test.
        /// </param>
        /// <param name="moderated">
        /// The moderated.
        /// </param>
        /// <param name="moderatedPostCount">
        /// The moderated post count.
        /// </param>
        /// <param name="isModeratedNewTopicOnly">
        /// The is moderated new topic only.
        /// </param>
        /// <param name="remoteURL">
        /// The remote url.
        /// </param>
        /// <param name="themeURL">
        /// The theme url.
        /// </param>
        /// <param name="imageURL">
        /// The image url.
        /// </param>
        /// <param name="styles">
        /// The styles.
        /// </param>
        /// <returns>
        /// The <see cref="int"/>.
        /// </returns>
        public static int Save(
            [NotNull] this IRepository <Forum> repository,
            [NotNull] int?forumID,
            [NotNull] int categoryID,
            [CanBeNull] int?parentID,
            [NotNull] string name,
            [NotNull] string description,
            [NotNull] int sortOrder,
            [NotNull] bool locked,
            [NotNull] bool hidden,
            [NotNull] bool isTest,
            [NotNull] bool moderated,
            [CanBeNull] int?moderatedPostCount,
            [NotNull] bool isModeratedNewTopicOnly,
            [NotNull] string remoteURL,
            [NotNull] string themeURL,
            [NotNull] string imageURL,
            [NotNull] string styles)
        {
            if (parentID.HasValue && parentID.Equals(0))
            {
                parentID = null;
            }

            var flags = new ForumFlags
            {
                IsLocked = locked, IsHidden = hidden, IsTest = isTest, IsModerated = moderated
            };

            return(repository.Upsert(
                       new Forum
            {
                ParentID = parentID,
                ID = forumID ?? 0,
                Name = name,
                Description = description,
                SortOrder = sortOrder,
                CategoryID = categoryID,
                RemoteURL = remoteURL,
                ThemeURL = themeURL,
                ImageURL = imageURL,
                Styles = styles,
                Flags = flags.BitValue,
                ModeratedPostCount = moderatedPostCount,
                IsModeratedNewTopicOnly = isModeratedNewTopicOnly
            }));
        }
コード例 #5
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                PageLinks.AddLink(PageContext.BoardSettings.Name, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.forum));
                PageLinks.AddLink("Administration", YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.admin_admin));
                PageLinks.AddLink("Forums", "");

                BindData();
                if (Request.QueryString ["f"] != null)
                {
                    using (DataTable dt = YAF.Classes.Data.DB.forum_list(PageContext.PageBoardID, Request.QueryString ["f"]))
                    {
                        DataRow    row   = dt.Rows [0];
                        ForumFlags flags = new ForumFlags(row["Flags"]);
                        Name.Text            = ( string )row ["Name"];
                        Description.Text     = ( string )row ["Description"];
                        SortOrder.Text       = row ["SortOrder"].ToString();
                        HideNoAccess.Checked = flags.IsHidden;
                        Locked.Checked       = flags.IsLocked;
                        IsTest.Checked       = flags.IsTest;
                        ForumNameTitle.Text  = Name.Text;
                        Moderated.Checked    = flags.IsModerated;

                        CategoryList.SelectedValue = row ["CategoryID"].ToString();
                        // populate parent forums list with forums according to selected category
                        BindParentList();

                        if (!row.IsNull("ParentID"))
                        {
                            ParentList.SelectedValue = row ["ParentID"].ToString();
                        }
                        if (!row.IsNull("ThemeURL"))
                        {
                            ThemeList.SelectedValue = row ["ThemeURL"].ToString();
                        }

                        remoteurl.Text = row ["RemoteURL"].ToString();
                    }
                    NewGroupRow.Visible = false;
                }
            }
        }
コード例 #6
0
		protected void Page_Load( object sender, System.EventArgs e )
		{
			if ( !IsPostBack )
			{
				PageLinks.AddLink( PageContext.BoardSettings.Name, YAF.Classes.Utils.YafBuildLink.GetLink( YAF.Classes.Utils.ForumPages.forum ) );
				PageLinks.AddLink( "Administration", YAF.Classes.Utils.YafBuildLink.GetLink( YAF.Classes.Utils.ForumPages.admin_admin ) );
				PageLinks.AddLink( "Forums", "" );

				BindData();
				if ( Request.QueryString ["f"] != null )
				{
					using ( DataTable dt = YAF.Classes.Data.DB.forum_list( PageContext.PageBoardID, Request.QueryString ["f"] ) )
					{
						DataRow row = dt.Rows [0];
						ForumFlags flags = new ForumFlags(row["Flags"]);
						Name.Text = ( string ) row ["Name"];
						Description.Text = ( string ) row ["Description"];
						SortOrder.Text = row ["SortOrder"].ToString();
						HideNoAccess.Checked = flags.IsHidden;
						Locked.Checked = flags.IsLocked;
						IsTest.Checked = flags.IsTest;
						ForumNameTitle.Text = Name.Text;
						Moderated.Checked = flags.IsModerated;

						CategoryList.SelectedValue = row ["CategoryID"].ToString();
						// populate parent forums list with forums according to selected category
						BindParentList();

						if ( !row.IsNull( "ParentID" ) )
							ParentList.SelectedValue = row ["ParentID"].ToString();
						if ( !row.IsNull( "ThemeURL" ) )
							ThemeList.SelectedValue = row ["ThemeURL"].ToString();

						remoteurl.Text = row ["RemoteURL"].ToString();
					}
					NewGroupRow.Visible = false;
				}
			}
		}
コード例 #7
0
        /// <summary>
        /// Saves a Forum or if forumId is null creates a new Forum
        /// </summary>
        /// <param name="repository">
        /// The repository.
        /// </param>
        /// <param name="forumID">
        /// The forum id.
        /// </param>
        /// <param name="categoryID">
        /// The category id.
        /// </param>
        /// <param name="parentID">
        /// The parent id.
        /// </param>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <param name="description">
        /// The description.
        /// </param>
        /// <param name="sortOrder">
        /// The sort order.
        /// </param>
        /// <param name="locked">
        /// The locked.
        /// </param>
        /// <param name="hidden">
        /// The hidden.
        /// </param>
        /// <param name="isTest">
        /// The is test.
        /// </param>
        /// <param name="moderated">
        /// The moderated.
        /// </param>
        /// <param name="moderatedPostCount">
        /// The moderated post count.
        /// </param>
        /// <param name="isModeratedNewTopicOnly">
        /// The is moderated new topic only.
        /// </param>
        /// <param name="remoteURL">
        /// The remote url.
        /// </param>
        /// <param name="themeURL">
        /// The theme url.
        /// </param>
        /// <param name="imageURL">
        /// The image url.
        /// </param>
        /// <param name="styles">
        /// The styles.
        /// </param>
        /// <returns>
        /// The <see cref="int"/>.
        /// </returns>
        public static int Save(
            [NotNull] this IRepository <Forum> repository,
            [CanBeNull] int?forumID,
            [NotNull] int categoryID,
            [CanBeNull] int?parentID,
            [NotNull] string name,
            [NotNull] string description,
            [NotNull] int sortOrder,
            [NotNull] bool locked,
            [NotNull] bool hidden,
            [NotNull] bool isTest,
            [NotNull] bool moderated,
            [CanBeNull] int?moderatedPostCount,
            [NotNull] bool isModeratedNewTopicOnly,
            [CanBeNull] string remoteURL,
            [CanBeNull] string themeURL,
            [CanBeNull] string imageURL,
            [CanBeNull] string styles)
        {
            CodeContracts.VerifyNotNull(repository);

            if (parentID.HasValue && parentID.Equals(0))
            {
                parentID = null;
            }

            var flags = new ForumFlags
            {
                IsLocked = locked, IsHidden = hidden, IsTest = isTest, IsModerated = moderated
            };

            if (!forumID.HasValue)
            {
                var newForumId = repository.Insert(
                    new Forum
                {
                    ParentID                = parentID,
                    Name                    = name,
                    Description             = description,
                    SortOrder               = sortOrder,
                    CategoryID              = categoryID,
                    RemoteURL               = remoteURL,
                    ThemeURL                = themeURL,
                    ImageURL                = imageURL,
                    Styles                  = styles,
                    Flags                   = flags.BitValue,
                    ModeratedPostCount      = moderatedPostCount,
                    IsModeratedNewTopicOnly = isModeratedNewTopicOnly
                });

                repository.FireNew(newForumId);

                return(newForumId);
            }

            repository.UpdateOnly(
                () => new Forum
            {
                ParentID                = parentID,
                Name                    = name,
                Description             = description,
                SortOrder               = sortOrder,
                CategoryID              = categoryID,
                RemoteURL               = remoteURL,
                ThemeURL                = themeURL,
                ImageURL                = imageURL,
                Styles                  = styles,
                Flags                   = flags.BitValue,
                ModeratedPostCount      = moderatedPostCount,
                IsModeratedNewTopicOnly = isModeratedNewTopicOnly
            },
                f => f.ID == forumID);

            repository.FireUpdated(forumID.Value);

            // empty out access table(s)
            BoardContext.Current.GetRepository <Active>().DeleteAll();
            BoardContext.Current.GetRepository <ActiveAccess>().DeleteAll();

            return(forumID.Value);
        }
コード例 #8
0
ファイル: editforum.ascx.cs プロジェクト: wangyoutian/YAFNET
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">
        /// The source of the event.
        /// </param>
        /// <param name="e">
        /// The <see cref="EventArgs"/> instance containing the event data.
        /// </param>
        protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
        {
            if (this.IsPostBack)
            {
                return;
            }

            this.ModerateAllPosts.Text = this.GetText("MODERATE_ALL_POSTS");

            // Populate Forum Images Table
            this.CreateImagesDataTable();

            this.ForumImages.Attributes["onchange"] = "getElementById('{1}').src='{0}{2}/' + this.value".FormatWith(
                YafForumInfo.ForumClientFileRoot,
                this.Preview.ClientID,
                YafBoardFolders.Current.Forums);

            this.BindData();

            var forumId = this.GetQueryStringAsInt("fa") ?? this.GetQueryStringAsInt("copy");

            if (!forumId.HasValue)
            {
                // Currently creating a New Forum, and auto fill the Forum Sort Order + 1
                using (var dt = LegacyDb.forum_list(this.PageContext.PageBoardID, null))
                {
                    var sortOrder = 1;

                    try
                    {
                        var highestRow = dt.Rows[dt.Rows.Count - 1];

                        sortOrder = (short)highestRow["SortOrder"] + sortOrder;
                    }
                    catch
                    {
                        sortOrder = 1;
                    }

                    this.SortOrder.Text = sortOrder.ToString();

                    return;
                }
            }

            using (var dt = LegacyDb.forum_list(this.PageContext.PageBoardID, forumId.Value))
            {
                var row   = dt.Rows[0];
                var flags = new ForumFlags(row["Flags"]);
                this.Name.Text            = row["Name"].ToString();
                this.Description.Text     = row["Description"].ToString();
                this.SortOrder.Text       = row["SortOrder"].ToString();
                this.HideNoAccess.Checked = flags.IsHidden;
                this.Locked.Checked       = flags.IsLocked;
                this.IsTest.Checked       = flags.IsTest;
                this.ForumNameTitle.Text  = this.Label1.Text = this.Name.Text;
                this.Moderated.Checked    = flags.IsModerated;

                this.ModeratedPostCountRow.Visible   = this.Moderated.Checked;
                this.ModerateNewTopicOnlyRow.Visible = this.Moderated.Checked;

                if (row["ModeratedPostCount"].IsNullOrEmptyDBField())
                {
                    this.ModerateAllPosts.Checked = true;
                }
                else
                {
                    this.ModerateAllPosts.Checked   = false;
                    this.ModeratedPostCount.Visible = true;
                    this.ModeratedPostCount.Text    = row["ModeratedPostCount"].ToString();
                }

                this.ModerateNewTopicOnly.Checked = row["IsModeratedNewTopicOnly"].ToType <bool>();

                this.Styles.Text = row["Styles"].ToString();

                this.CategoryList.SelectedValue = row["CategoryID"].ToString();

                this.Preview.Src =
                    YafForumInfo.GetURLToContent("images/spacer.gif"); // use spacer.gif for Description Entry

                var item = this.ForumImages.Items.FindByText(row["ImageURL"].ToString());
                if (item != null)
                {
                    item.Selected    = true;
                    this.Preview.Src = "{0}{2}/{1}".FormatWith(
                        YafForumInfo.ForumClientFileRoot,
                        row["ImageURL"],
                        YafBoardFolders.Current.Forums); // path corrected
                }

                // populate parent forums list with forums according to selected category
                this.BindParentList();

                if (!row.IsNull("ParentID"))
                {
                    this.ParentList.SelectedValue = row["ParentID"].ToString();
                }

                if (!row.IsNull("ThemeURL"))
                {
                    this.ThemeList.SelectedValue = row["ThemeURL"].ToString();
                }

                this.remoteurl.Text = row["RemoteURL"].ToString();
            }

            this.NewGroupRow.Visible = false;
        }
コード例 #9
0
ファイル: topics.ascx.cs プロジェクト: ahsan-sally/demo
        /// <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)
        {
            this.Get <IYafSession>().UnreadTopics = 0;

            this.RssFeed.AdditionalParameters =
                "f={0}".FormatWith(this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("f"));

            this.ForumJumpHolder.Visible = this.Get <YafBoardSettings>().ShowForumJump &&
                                           this.PageContext.Settings.LockedForum == 0;

            this.LastPostImageTT = this.GetText("DEFAULT", "GO_LAST_POST");

            if (this.ForumSearchHolder.Visible)
            {
                this.forumSearch.Attributes["onkeydown"] =
                    "if(event.which || event.keyCode){{if ((event.which == 13) || (event.keyCode == 13)) {{document.getElementById('{0}').click();return false;}}}} else {{return true}}; "
                    .FormatWith(this.forumSearchOK.ClientID);
            }

            if (!this.IsPostBack)
            {
                // PageLinks.Clear();
                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.PageLinks.AddForum(this.PageContext.PageForumID, true);

                this.ShowList.DataSource     = StaticDataHelper.TopicTimes();
                this.ShowList.DataTextField  = "TopicText";
                this.ShowList.DataValueField = "TopicValue";
                this._showTopicListSelected  = (this.Get <IYafSession>().ShowList == -1)
                                                  ? this.Get <YafBoardSettings>().ShowTopicsDefault
                                                  : this.Get <IYafSession>().ShowList;

                this.moderate1.NavigateUrl     =
                    this.moderate2.NavigateUrl =
                        YafBuildLink.GetLinkNotEscaped(ForumPages.moderating, "f={0}", this.PageContext.PageForumID);

                this.NewTopic1.NavigateUrl     =
                    this.NewTopic2.NavigateUrl =
                        YafBuildLink.GetLinkNotEscaped(ForumPages.postmessage, "f={0}", this.PageContext.PageForumID);

                this.HandleWatchForum();
            }

            if (this.Request.QueryString.GetFirstOrDefault("f") == null)
            {
                YafBuildLink.AccessDenied();
            }

            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();
            }

            using (var dt = LegacyDb.forum_list(this.PageContext.PageBoardID, this.PageContext.PageForumID))
            {
                this._forum = dt.Rows[0];
            }

            if (this._forum["RemoteURL"] != DBNull.Value)
            {
                this.Response.Clear();
                this.Response.Redirect((string)this._forum["RemoteURL"]);
            }

            this._forumFlags = new ForumFlags(this._forum["Flags"]);

            this.PageTitle.Text = this._forum["Description"].ToString().IsSet()
                                      ? "{0} - <em>{1}</em>".FormatWith(
                this.HtmlEncode(this._forum["Name"]),
                this.HtmlEncode(this._forum["Description"]))
                                      : this.HtmlEncode(this._forum["Name"]);

            this.BindData(); // Always because of yaf:TopicLine

            if (!this.PageContext.ForumPostAccess ||
                (this._forumFlags.IsLocked && !this.PageContext.ForumModeratorAccess))
            {
                this.NewTopic1.Visible = false;
                this.NewTopic2.Visible = false;
            }

            if (this.PageContext.ForumModeratorAccess)
            {
                return;
            }

            this.moderate1.Visible = false;
            this.moderate2.Visible = false;
        }
コード例 #10
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)
        {
            this._messageRow = null;

            if (this.Request.QueryString.GetFirstOrDefault("m") != null)
            {
                this._messageRow =
                    DBHelper.GetFirstRowOrInvalid(DB.message_list(Security.StringToLongOrRedirect(this.Request.QueryString.GetFirstOrDefault("m"))));

                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.Request["t"] == null && !this.PageContext.ForumPostAccess)
            {
                YafBuildLink.AccessDenied();
            }

            if (this.Request["t"] != null && !this.PageContext.ForumReplyAccess)
            {
                YafBuildLink.AccessDenied();
            }

            if (!this.IsPostBack)
            {
                // setup page links
                this.PageLinks.AddLink(this.PageContext.BoardSettings.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.Request.QueryString.GetFirstOrDefault("m") != null)
                {
                    // delete message...
                    this.PreviewRow.Visible = true;

                    DataTable tempdb = DB.message_getRepliesList(this.Request.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.Request.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"]);
                }
            }
        }
コード例 #11
0
		protected void Page_Load( object sender, System.EventArgs e )
		{
			Mession.UnreadTopics = 0;
			RssFeed.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.rsstopic, "pg=topics&f={0}", Request.QueryString["f"]);
			RssFeed.Text = GetText( "RSSFEED" );
			RssFeed.Visible = PageContext.BoardSettings.ShowRSSLink;
			MarkRead.Text = GetText( "MARKREAD" );
			RSSLinkSpacer.Visible = PageContext.BoardSettings.ShowRSSLink;
			ForumJumpHolder.Visible = PageContext.BoardSettings.ShowForumJump && PageContext.Settings.LockedForum == 0;

			if ( !IsPostBack )
			{
				//PageLinks.Clear();

				if ( PageContext.Settings.LockedForum == 0 )
				{
					PageLinks.AddLink( PageContext.BoardSettings.Name, YAF.Classes.Utils.YafBuildLink.GetLink( YAF.Classes.Utils.ForumPages.forum ) );
					PageLinks.AddLink( PageContext.PageCategoryName, YAF.Classes.Utils.YafBuildLink.GetLink( YAF.Classes.Utils.ForumPages.forum, "c={0}", PageContext.PageCategoryID ) );
				}

				PageLinks.AddForumLinks( PageContext.PageForumID, true );

				ShowList.DataSource = YafStaticData.TopicTimes( );
				ShowList.DataTextField = "TopicText";
				ShowList.DataValueField = "TopicValue";
				_showTopicListSelected = ( Mession.ShowList == -1 ) ? PageContext.BoardSettings.ShowTopicsDefault : Mession.ShowList;

				HandleWatchForum();
			}

			if ( Request.QueryString ["f"] == null )
				YafBuildLink.AccessDenied();

			if ( !PageContext.ForumReadAccess )
				YafBuildLink.AccessDenied();

			using ( DataTable dt = YAF.Classes.Data.DB.forum_list( PageContext.PageBoardID, PageContext.PageForumID ) )
				_forum = dt.Rows [0];

			if ( _forum ["RemoteURL"] != DBNull.Value )
			{
				Response.Clear();
				Response.Redirect( ( string ) _forum ["RemoteURL"] );
			}

			_forumFlags = new ForumFlags(_forum["Flags"]);

			PageTitle.Text = ( string ) _forum ["Name"];

			BindData();	// Always because of yaf:TopicLine

			if ( !PageContext.ForumPostAccess || ( _forumFlags.IsLocked && !PageContext.ForumModeratorAccess ) )
			{
				NewTopic1.Visible = false;
				NewTopic2.Visible = false;
			}

			if ( !PageContext.ForumModeratorAccess )
			{
				moderate1.Visible = false;
				moderate2.Visible = false;
			}
		}
コード例 #12
0
ファイル: posts.ascx.cs プロジェクト: coredweller/PhishMarket
		protected void Page_Load( object sender, System.EventArgs e )
		{
			_quickReplyEditor.BaseDir = YafForumInfo.ForumRoot + "editors";
			_quickReplyEditor.StyleSheet = YafBuildLink.ThemeFile( "theme.css" );

			_topic = YAF.Classes.Data.DB.topic_info( PageContext.PageTopicID );

			// in case topic is deleted or not existant
			if (_topic == null)
				YafBuildLink.Redirect(ForumPages.info, "i=6");	// invalid argument message

			// get topic flags
			_topicFlags = new TopicFlags(_topic["Flags"]);

			using ( DataTable dt = YAF.Classes.Data.DB.forum_list( PageContext.PageBoardID, PageContext.PageForumID ) )
				_forum = dt.Rows [0];

			_forumFlags=new ForumFlags(_forum["Flags"]);

			if ( !PageContext.ForumReadAccess )
				YafBuildLink.AccessDenied();

			#region Initial Setup
			if ( !IsPostBack )
			{
				if ( PageContext.Settings.LockedForum == 0 )
				{
					PageLinks.AddLink( PageContext.BoardSettings.Name, YAF.Classes.Utils.YafBuildLink.GetLink( YAF.Classes.Utils.ForumPages.forum ) );
					PageLinks.AddLink( PageContext.PageCategoryName, YAF.Classes.Utils.YafBuildLink.GetLink( YAF.Classes.Utils.ForumPages.forum, "c={0}", PageContext.PageCategoryID ) );
				}

				QuickReply.Text = GetText( "POSTMESSAGE", "SAVE" );
				DataPanel1.TitleText = GetText( "QUICKREPLY" );
				DataPanel1.ExpandText = GetText( "QUICKREPLY_SHOW" );
				DataPanel1.CollapseText = GetText( "QUICKREPLY_HIDE" );

				PageLinks.AddForumLinks( PageContext.PageForumID );
				PageLinks.AddLink( General.BadWordReplace( Server.HtmlDecode( PageContext.PageTopicName ) ), "" );

				TopicTitle.Text = General.BadWordReplace( ( string )_topic ["Topic"] );

				ViewOptions.Visible = PageContext.BoardSettings.AllowThreaded;
				ForumJumpHolder.Visible = PageContext.BoardSettings.ShowForumJump && PageContext.Settings.LockedForum == 0;

				RssTopic.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLinkNotEscaped( YAF.Classes.Utils.ForumPages.rsstopic, "pg={0}&t={1}", Request.QueryString ["g"], PageContext.PageTopicID );
				RssTopic.Visible = PageContext.BoardSettings.ShowRSSLink;

				QuickReplyPlaceHolder.Visible = PageContext.BoardSettings.ShowQuickAnswer;

				if ( ( PageContext.IsGuest && PageContext.BoardSettings.EnableCaptchaForGuests ) ||
					( PageContext.BoardSettings.EnableCaptchaForPost && !PageContext.IsCaptchaExcluded ) )
				{
					Session ["CaptchaImageText"] = General.GetCaptchaString();
					imgCaptcha.ImageUrl = String.Format( "{0}resource.ashx?c=1", YafForumInfo.ForumRoot );
					CaptchaDiv.Visible = true;
				}

				if ( !PageContext.ForumPostAccess || ( _forumFlags.IsLocked && !PageContext.ForumModeratorAccess ) )
				{
					NewTopic1.Visible = false;
					NewTopic2.Visible = false;
				}

				// Ederon : 9/9/2007 - moderators can relpy in locked topics
				if ( !PageContext.ForumReplyAccess ||
					( ( _topicFlags.IsLocked || _forumFlags.IsLocked ) && !PageContext.ForumModeratorAccess ) )
				{
					PostReplyLink1.Visible = PostReplyLink2.Visible = false;
					QuickReplyPlaceHolder.Visible = false;
				}

				if ( PageContext.ForumModeratorAccess )
				{
					MoveTopic1.Visible = true;
					MoveTopic2.Visible = true;
				}
				else
				{
					MoveTopic1.Visible = false;
					MoveTopic2.Visible = false;
				}

				if ( !PageContext.ForumModeratorAccess )
				{
					LockTopic1.Visible = false;
					UnlockTopic1.Visible = false;
					DeleteTopic1.Visible = false;
					LockTopic2.Visible = false;
					UnlockTopic2.Visible = false;
					DeleteTopic2.Visible = false;
				}
				else
				{
					LockTopic1.Visible = !_topicFlags.IsLocked;
					UnlockTopic1.Visible = !LockTopic1.Visible;
					LockTopic2.Visible = LockTopic1.Visible;
					UnlockTopic2.Visible = !LockTopic2.Visible;
				}

				// handle custom BBCode javascript or CSS...
				BBCode.RegisterCustomBBCodePageElements( Page, this.GetType() );
			} 
			#endregion

			// Mark topic read
			Mession.SetTopicRead( PageContext.PageTopicID, DateTime.Now );

			BindData();
		}
コード例 #13
0
		protected void Page_Load( object sender, System.EventArgs e )
		{
			_messageRow = null;

			if ( Request.QueryString ["m"] != null )
			{
				using ( DataTable dt = DB.message_list( Request.QueryString ["m"] ) )
				{
					_messageRow = dt.Rows [0];
				}

				if ( !PageContext.ForumModeratorAccess && PageContext.PageUserID != ( int )_messageRow ["UserID"] )
				{
					YafBuildLink.AccessDenied();
				}
			}

			_forumFlags = new ForumFlags( _messageRow ["ForumFlags"] );
			_topicFlags = new TopicFlags( _messageRow ["TopicFlags"] );
			_ownerUserId = ( int )_messageRow ["UserID"];
			_isModeratorChanged = ( PageContext.PageUserID != _ownerUserId );

			if ( PageContext.PageForumID == 0 )
				YafBuildLink.AccessDenied();
			if ( Request ["t"] == null && !PageContext.ForumPostAccess )
				YafBuildLink.AccessDenied();
			if ( Request ["t"] != null && !PageContext.ForumReplyAccess )
				YafBuildLink.AccessDenied();

			if ( !IsPostBack )
			{
				// setup page links
				PageLinks.AddLink( PageContext.BoardSettings.Name, YafBuildLink.GetLink( ForumPages.forum ) );
				PageLinks.AddLink( PageContext.PageCategoryName, YafBuildLink.GetLink( ForumPages.forum, "c={0}", PageContext.PageCategoryID ) );
				PageLinks.AddForumLinks( PageContext.PageForumID );

				EraseMessage.Checked = false;
				ViewState ["delAll"] = false;
				EraseRow.Visible = false;
				DeleteReasonRow.Visible = false;
				LinkedPosts.Visible = false;
				ReasonEditor.Attributes.Add( "style", "width:100%" );
				Cancel.Text = GetText( "Cancel" );

				if ( Request.QueryString ["m"] != null )
				{
					// delete message...
					PreviewRow.Visible = true;

					DataTable tempdb = DB.message_getRepliesList( Request.QueryString ["m"] );

					if ( tempdb.Rows.Count != 0 && (PageContext.ForumModeratorAccess || PageContext.IsAdmin) )
					{
						LinkedPosts.Visible = true;
						LinkedPosts.DataSource = tempdb;
						LinkedPosts.DataBind();
					}

					if ( Request.QueryString ["action"].ToLower() == "delete" )
					{
						Title.Text = GetText( "EDIT" ); //GetText("EDIT");
						Delete.Text = GetText( "DELETE" ); // "GetText("Save");

						if ( PageContext.IsAdmin )
						{
							EraseRow.Visible = true;
						}
					}
					else
					{
						Title.Text = GetText( "EDIT" );
						Delete.Text = GetText( "UNDELETE" ); // "GetText("Save");
					}

					Subject.Text = Convert.ToString( _messageRow ["Topic"] );
					DeleteReasonRow.Visible = true;
					ReasonEditor.Text = Convert.ToString( _messageRow ["DeleteReason"] );

					// populate the message preview with the message datarow...
					MessagePreview.Message = _messageRow["message"].ToString();
					MessagePreview.MessageFlags.BitValue = Convert.ToInt32( _messageRow ["Flags"] );
				}
			}
		}
コード例 #14
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 (!IsPostBack)
            {
                this.PageLinks.AddLink(PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum));
                this.PageLinks.AddLink("Administration", YafBuildLink.GetLink(ForumPages.admin_admin));
                this.PageLinks.AddLink("Forums", string.Empty);

                // Populate Forum Images Table
                this.CreateImagesDataTable();

                this.ForumImages.Attributes["onchange"] = "getElementById('{1}').src='{0}{2}/' + this.value".FormatWith(YafForumInfo.ForumClientFileRoot, this.Preview.ClientID, YafBoardFolders.Current.Forums);

                this.BindData();

                if (Request.QueryString.GetFirstOrDefault("f") != null)
                {
                    using (DataTable dt = DB.forum_list(PageContext.PageBoardID, Request.QueryString.GetFirstOrDefault("f")))
                    {
                        DataRow row   = dt.Rows[0];
                        var     flags = new ForumFlags(row["Flags"]);
                        this.Name.Text            = (string)row["Name"];
                        this.Description.Text     = (string)row["Description"];
                        this.SortOrder.Text       = row["SortOrder"].ToString();
                        this.HideNoAccess.Checked = flags.IsHidden;
                        this.Locked.Checked       = flags.IsLocked;
                        this.IsTest.Checked       = flags.IsTest;
                        this.ForumNameTitle.Text  = this.Name.Text;
                        this.Moderated.Checked    = flags.IsModerated;
                        this.Styles.Text          = row["Styles"].ToString();

                        this.CategoryList.SelectedValue = row["CategoryID"].ToString();

                        this.Preview.Src = "{0}images/spacer.gif".FormatWith(YafForumInfo.ForumClientFileRoot);

                        ListItem item = this.ForumImages.Items.FindByText(row["ImageURL"].ToString());
                        if (item != null)
                        {
                            item.Selected    = true;
                            this.Preview.Src = "{0}{2}/{1}".FormatWith(YafForumInfo.ForumClientFileRoot, row["ImageURL"], YafBoardFolders.Current.Forums); // path corrected
                        }

                        // populate parent forums list with forums according to selected category
                        this.BindParentList();

                        if (!row.IsNull("ParentID"))
                        {
                            this.ParentList.SelectedValue = row["ParentID"].ToString();
                        }

                        if (!row.IsNull("ThemeURL"))
                        {
                            this.ThemeList.SelectedValue = row["ThemeURL"].ToString();
                        }

                        this.remoteurl.Text = row["RemoteURL"].ToString();
                    }

                    this.NewGroupRow.Visible = false;
                }
            }
        }
コード例 #15
0
        /// <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)
            {
                if (this.PageContext.User.Activity)
                {
                    this.GetRepository <Activity>().UpdateTopicNotification(
                        this.PageContext.PageUserID,
                        this.PageContext.PageTopicID);
                }

                // The html code for "Favorite Topic" theme buttons.
                var tagButtonHtml =
                    $"'<a class=\"btn btn-secondary\" href=\"javascript:addFavoriteTopic(' + response + ');\" title=\"{this.GetText("BUTTON_TAGFAVORITE_TT")}\"><span><i class=\"fa fa-star fa-fw\"></i>&nbsp;{this.GetText("BUTTON_TAGFAVORITE")}</span></a>'";
                var untagButtonHtml =
                    $"'<a class=\"btn btn-secondary\" href=\"javascript:removeFavoriteTopic(' + response + ');\" title=\"{this.GetText("BUTTON_UNTAGFAVORITE_TT")}\"><span><i class=\"fa fa-star fa-fw\"></i>&nbsp;{this.GetText("BUTTON_UNTAGFAVORITE")}</span></a>'";

                // Register the client side script for the "Favorite Topic".
                var favoriteTopicJs = JavaScriptBlocks.AddFavoriteTopicJs(untagButtonHtml) + Environment.NewLine +
                                      JavaScriptBlocks.RemoveFavoriteTopicJs(tagButtonHtml);

                this.PageContext.PageElements.RegisterJsBlockStartup("favoriteTopicJs", favoriteTopicJs);
                this.PageContext.PageElements.RegisterJsBlockStartup("asynchCallFailedJs", "function CallFailed(res){ console.log(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({this.PageContext.PageTopicID});";
                    this.TagFavorite2.NavigateUrl       = $"javascript:removeFavoriteTopic({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({this.PageContext.PageTopicID});";
                    this.TagFavorite2.NavigateUrl       = $"javascript:addFavoriteTopic({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.topic = this.GetRepository <Topic>().GetById(this.PageContext.PageTopicID);

            // in case topic is deleted or not existent
            if (this.topic == null)
            {
                BuildLink.RedirectInfoPage(InfoMessage.Invalid);
            }

            if (this.topic.PollID.HasValue)
            {
                this.PollList.TopicId = this.PageContext.PageTopicID;
                this.PollList.Visible = true;
                this.PollList.PollId  = this.topic.PollID.Value;
            }

            this.BindData();

            var firstPost = ((List <PagedMessage>) this.MessageList.DataSource).FirstOrDefault();

            this.forumFlags = new ForumFlags(firstPost.ForumFlags);

            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)
            {
                BuildLink.AccessDenied();
            }

            var yafBoardSettings = this.PageContext.BoardSettings;

            if (this.IsPostBack)
            {
                return;
            }

            // Clear Multi-quotes if topic is different
            if (this.Get <ISession>().MultiQuoteIds != null)
            {
                if (!this.Get <ISession>().MultiQuoteIds.Any(m => m.TopicID.Equals(this.PageContext.PageTopicID)))
                {
                    this.Get <ISession>().MultiQuoteIds = null;
                }
            }

            this.NewTopic2.NavigateUrl     =
                this.NewTopic1.NavigateUrl =
                    BuildLink.GetLink(ForumPages.PostTopic, "f={0}", this.PageContext.PageForumID);

            this.PostReplyLink1.NavigateUrl     =
                this.PostReplyLink2.NavigateUrl =
                    BuildLink.GetLink(
                        ForumPages.PostMessage,
                        "t={0}&f={1}",
                        this.PageContext.PageTopicID,
                        this.PageContext.PageForumID);

            var topicSubject = this.Get <IBadWordReplace>().Replace(this.HtmlEncode(this.topic.TopicName));

            this.TopicTitle.Text = this.topic.Description.IsSet()
                ? $"{topicSubject} - <em>{this.Get<IBadWordReplace>().Replace(this.HtmlEncode(this.topic.Description))}</em>"
                : this.Get <IBadWordReplace>().Replace(topicSubject);

            this.TopicLink.ToolTip = this.Get <IBadWordReplace>().Replace(
                this.HtmlEncode(this.topic.Description));
            this.TopicLink.NavigateUrl = BuildLink.GetLink(
                ForumPages.Posts,
                "t={0}&name={1}",
                this.PageContext.PageTopicID,
                this.PageContext.PageTopicName);

            this.QuickReplyDialog.Visible = yafBoardSettings.ShowQuickAnswer;
            this.QuickReplyLink1.Visible  = yafBoardSettings.ShowQuickAnswer;
            this.QuickReplyLink2.Visible  = yafBoardSettings.ShowQuickAnswer;

            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.topic.TopicFlags.IsLocked || this.forumFlags.IsLocked) && !this.PageContext.ForumModeratorAccess)
            {
                this.PostReplyLink1.Visible   = this.PostReplyLink2.Visible = false;
                this.QuickReplyDialog.Visible = false;
                this.QuickReplyLink1.Visible  = false;
                this.QuickReplyLink2.Visible  = false;
            }

            if (this.PageContext.ForumModeratorAccess)
            {
                this.MoveTopic1.Visible = true;
                this.MoveTopic2.Visible = true;

                this.Tools1.Visible = true;
                this.Tools2.Visible = true;
            }
            else
            {
                this.MoveTopic1.Visible = false;
                this.MoveTopic2.Visible = false;

                this.Tools1.Visible = false;
                this.Tools2.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.topic.TopicFlags.IsLocked;
                this.UnlockTopic1.Visible = !this.LockTopic1.Visible;
                this.LockTopic2.Visible   = this.LockTopic1.Visible;
                this.UnlockTopic2.Visible = !this.LockTopic2.Visible;
            }
        }
コード例 #16
0
        /// <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)
        {
            if (this.IsPostBack)
            {
                return;
            }

            this.PageLinks.AddRoot();
            this.PageLinks.AddLink(
                this.GetText("ADMIN_ADMIN", "Administration"), YafBuildLink.GetLink(ForumPages.admin_admin));

            this.PageLinks.AddLink(this.GetText("TEAM", "FORUMS"), YafBuildLink.GetLink(ForumPages.admin_forums));
            this.PageLinks.AddLink(this.GetText("ADMIN_EDITFORUM", "TITLE"), string.Empty);

            this.Page.Header.Title = "{0} - {1} - {2}".FormatWith(
                this.GetText("ADMIN_ADMIN", "Administration"),
                this.GetText("TEAM", "FORUMS"),
                this.GetText("ADMIN_EDITFORUM", "TITLE"));

            this.Save.Text   = this.GetText("SAVE");
            this.Cancel.Text = this.GetText("CANCEL");

            // Populate Forum Images Table
            this.CreateImagesDataTable();

            this.ForumImages.Attributes["onchange"] =
                "getElementById('{1}').src='{0}{2}/' + this.value".FormatWith(
                    YafForumInfo.ForumClientFileRoot, this.Preview.ClientID, YafBoardFolders.Current.Forums);

            this.BindData();

            var forumId = this.GetQueryStringAsInt("fa") ?? this.GetQueryStringAsInt("copy");

            if (!forumId.HasValue)
            {
                // Currently creating a New Forum, and auto fill the Forum Sort Order + 1
                using (
                    DataTable dt = LegacyDb.forum_list(this.PageContext.PageBoardID, null))
                {
                    int sortOrder = 1;

                    try
                    {
                        DataRow highestRow = dt.Rows[dt.Rows.Count - 1];

                        sortOrder = (short)highestRow["SortOrder"] + sortOrder;
                    }
                    catch
                    {
                        sortOrder = 1;
                    }

                    this.SortOrder.Text = sortOrder.ToString();

                    return;
                }
            }

            using (DataTable dt = LegacyDb.forum_list(this.PageContext.PageBoardID, forumId.Value))
            {
                DataRow row   = dt.Rows[0];
                var     flags = new ForumFlags(row["Flags"]);
                this.Name.Text            = (string)row["Name"];
                this.Description.Text     = (string)row["Description"];
                this.SortOrder.Text       = row["SortOrder"].ToString();
                this.HideNoAccess.Checked = flags.IsHidden;
                this.Locked.Checked       = flags.IsLocked;
                this.IsTest.Checked       = flags.IsTest;
                this.ForumNameTitle.Text  = this.Name.Text;
                this.Moderated.Checked    = flags.IsModerated;
                this.Styles.Text          = row["Styles"].ToString();

                this.CategoryList.SelectedValue = row["CategoryID"].ToString();

                this.Preview.Src = "{0}images/spacer.gif".FormatWith(YafForumInfo.ForumClientFileRoot);

                ListItem item = this.ForumImages.Items.FindByText(row["ImageURL"].ToString());
                if (item != null)
                {
                    item.Selected    = true;
                    this.Preview.Src = "{0}{2}/{1}".FormatWith(
                        YafForumInfo.ForumClientFileRoot, row["ImageURL"], YafBoardFolders.Current.Forums); // path corrected
                }

                // populate parent forums list with forums according to selected category
                this.BindParentList();

                if (!row.IsNull("ParentID"))
                {
                    this.ParentList.SelectedValue = row["ParentID"].ToString();
                }

                if (!row.IsNull("ThemeURL"))
                {
                    this.ThemeList.SelectedValue = row["ThemeURL"].ToString();
                }

                this.remoteurl.Text = row["RemoteURL"].ToString();
            }

            this.NewGroupRow.Visible = false;
        }
コード例 #17
0
ファイル: TopicLine.ascx.cs プロジェクト: RichardBer/ParkCMS
        /// <summary>
        /// The get topic image.
        /// </summary>
        /// <param name="o">
        /// The o.
        /// </param>
        /// <param name="imgTitle">
        /// The img title.
        /// </param>
        /// <returns>
        /// The get 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"]);

            // Obsolette : Ederon
            // bool isLocked = General.BinaryAnd(row["TopicFlags"], TopicFlags.Locked);
            imgTitle = "???";

            try
            {
                // Obsolette : Ederon
                // bool bIsLocked = isLocked || General.BinaryAnd( row ["ForumFlags"], ForumFlags.Locked );
                if (row["TopicMovedID"].ToString().Length > 0)
                {
                    imgTitle = this.PageContext.Localization.GetText("MOVED");
                    return(this.PageContext.Theme.GetItem("ICONS", "TOPIC_MOVED"));
                }

                DateTime lastRead      = YafContext.Current.Get <YafSession>().GetTopicRead((int)row["TopicID"]);
                DateTime lastReadForum = YafContext.Current.Get <YafSession>().GetForumRead((int)row["ForumID"]);
                if (lastReadForum > lastRead)
                {
                    lastRead = lastReadForum;
                }

                if (lastPosted > lastRead)
                {
                    YafContext.Current.Get <YafSession>().UnreadTopics++;

                    if (row["PollID"] != DBNull.Value)
                    {
                        imgTitle = this.PageContext.Localization.GetText("POLL_NEW");
                        return(this.PageContext.Theme.GetItem("ICONS", "TOPIC_POLL_NEW"));
                    }
                    else if (row["Priority"].ToString() == "1")
                    {
                        imgTitle = this.PageContext.Localization.GetText("STICKY");
                        return(this.PageContext.Theme.GetItem("ICONS", "TOPIC_STICKY"));
                    }
                    else if (row["Priority"].ToString() == "2")
                    {
                        imgTitle = this.PageContext.Localization.GetText("ANNOUNCEMENT");
                        return(this.PageContext.Theme.GetItem("ICONS", "TOPIC_ANNOUNCEMENT_NEW"));
                    }
                    else if (topicFlags.IsLocked || forumFlags.IsLocked)
                    {
                        imgTitle = this.PageContext.Localization.GetText("NEW_POSTS_LOCKED");
                        return(this.PageContext.Theme.GetItem("ICONS", "TOPIC_NEW_LOCKED"));
                    }
                    else
                    {
                        imgTitle = this.PageContext.Localization.GetText("NEW_POSTS");
                        return(this.PageContext.Theme.GetItem("ICONS", "TOPIC_NEW"));
                    }
                }
                else
                {
                    if (row["PollID"] != DBNull.Value)
                    {
                        imgTitle = this.PageContext.Localization.GetText("POLL");
                        return(this.PageContext.Theme.GetItem("ICONS", "TOPIC_POLL"));
                    }
                    else if (row["Priority"].ToString() == "1")
                    {
                        imgTitle = this.PageContext.Localization.GetText("STICKY");
                        return(this.PageContext.Theme.GetItem("ICONS", "TOPIC_STICKY"));
                    }
                    else if (row["Priority"].ToString() == "2")
                    {
                        imgTitle = this.PageContext.Localization.GetText("ANNOUNCEMENT");
                        return(this.PageContext.Theme.GetItem("ICONS", "TOPIC_ANNOUNCEMENT"));
                    }
                    else if (topicFlags.IsLocked || forumFlags.IsLocked)
                    {
                        imgTitle = this.PageContext.Localization.GetText("NO_NEW_POSTS_LOCKED");
                        return(this.PageContext.Theme.GetItem("ICONS", "TOPIC_LOCKED"));
                    }
                    else
                    {
                        imgTitle = this.PageContext.Localization.GetText("NO_NEW_POSTS");
                        return(this.PageContext.Theme.GetItem("ICONS", "TOPIC"));
                    }
                }
            }
            catch (Exception)
            {
                return(this.PageContext.Theme.GetItem("ICONS", "TOPIC"));
            }
        }
コード例 #18
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
        {
            this._messageRow = null;

            if (this.Get <HttpRequestBase>().QueryString.Exists("m"))
            {
                this._messageRow = this.GetRepository <Message>().ListAsDataTable(
                    Security.StringToIntOrRedirect(this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("m")))
                                   .GetFirstRowOrInvalid();

                if (!this.PageContext.ForumModeratorAccess &&
                    this.PageContext.PageUserID != (int)this._messageRow["UserID"])
                {
                    BuildLink.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)
            {
                BuildLink.AccessDenied();
            }

            if (!this.Get <HttpRequestBase>().QueryString.Exists("t") &&
                !this.PageContext.ForumPostAccess)
            {
                BuildLink.AccessDenied();
            }

            if (this.Get <HttpRequestBase>().QueryString.Exists("t") &&
                !this.PageContext.ForumReplyAccess)
            {
                BuildLink.AccessDenied();
            }

            if (this.IsPostBack)
            {
                return;
            }

            this.EraseMessage.Checked    = false;
            this.EraseMessage.Text       = this.GetText("erasemessage");
            this.EraseRow.Visible        = false;
            this.DeleteReasonRow.Visible = false;
            this.LinkedPosts.Visible     = false;

            if (!this.Get <HttpRequestBase>().QueryString.Exists("m"))
            {
                return;
            }

            // delete message...
            this.PreviewRow.Visible = true;

            var tempdb = this.GetRepository <Message>().RepliesListAsDataTable(
                this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("m").ToType <int>());

            if (tempdb.HasRows() && (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");
                this.Delete.TextLocalizedTag = "DELETE";

                if (this.PageContext.IsAdmin)
                {
                    this.EraseRow.Visible = true;
                }
            }
            else
            {
                this.Title.Text = this.GetText("EDIT");
                this.Delete.TextLocalizedTag = "UNDELETE";
                this.Delete.Icon             = "trash-restore";
            }

            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 data-row...
            this.MessagePreview.Message = this._messageRow["message"].ToString();

            var messageFlags = new MessageFlags(this._messageRow["Flags"])
            {
                IsDeleted = false
            };

            this.MessagePreview.MessageFlags = messageFlags;
        }
コード例 #19
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)
        {
            YafContext.Current.Get <YafSession>().UnreadTopics = 0;
            this.AtomFeed.AdditionalParameters = "f={0}".FormatWith(this.Request.QueryString.GetFirstOrDefault("f"));
            this.RssFeed.AdditionalParameters  = "f={0}".FormatWith(this.Request.QueryString.GetFirstOrDefault("f"));
            this.MarkRead.Text           = GetText("MARKREAD");
            this.ForumJumpHolder.Visible = PageContext.BoardSettings.ShowForumJump && PageContext.Settings.LockedForum == 0;
            this.lastPostImageTT         = this.PageContext.Localization.GetText("DEFAULT", "GO_LAST_POST");

            if (!IsPostBack)
            {
                // PageLinks.Clear();
                if (PageContext.Settings.LockedForum == 0)
                {
                    this.PageLinks.AddLink(PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum));
                    this.PageLinks.AddLink(PageContext.PageCategoryName, YafBuildLink.GetLink(ForumPages.forum, "c={0}", PageContext.PageCategoryID));
                }

                this.PageLinks.AddForumLinks(PageContext.PageForumID, true);

                this.ShowList.DataSource     = StaticDataHelper.TopicTimes();
                this.ShowList.DataTextField  = "TopicText";
                this.ShowList.DataValueField = "TopicValue";
                this._showTopicListSelected  = (YafContext.Current.Get <YafSession>().ShowList == -1) ? PageContext.BoardSettings.ShowTopicsDefault : YafContext.Current.Get <YafSession>().ShowList;

                HandleWatchForum();
            }

            if (Request.QueryString.GetFirstOrDefault("f") == null)
            {
                YafBuildLink.AccessDenied();
            }

            if (this.PageContext.IsGuest && !this.PageContext.ForumReadAccess)
            {
                // attempt to get permission by redirecting to login...
                this.Get <YafPermissions>().HandleRequest(ViewPermissions.RegisteredUsers);
            }
            else if (!this.PageContext.ForumReadAccess)
            {
                YafBuildLink.AccessDenied();
            }

            using (DataTable dt = DB.forum_list(PageContext.PageBoardID, PageContext.PageForumID))
            {
                this._forum = dt.Rows[0];
            }

            if (this._forum["RemoteURL"] != DBNull.Value)
            {
                Response.Clear();
                Response.Redirect((string)this._forum["RemoteURL"]);
            }

            this._forumFlags = new ForumFlags(this._forum["Flags"]);

            this.PageTitle.Text = HtmlEncode((string)this._forum["Name"]);

            BindData(); // Always because of yaf:TopicLine

            if (!PageContext.ForumPostAccess || (this._forumFlags.IsLocked && !PageContext.ForumModeratorAccess))
            {
                this.NewTopic1.Visible = false;
                this.NewTopic2.Visible = false;
            }

            if (!PageContext.ForumModeratorAccess)
            {
                this.moderate1.Visible = false;
                this.moderate2.Visible = false;
            }
        }
コード例 #20
0
ファイル: deletemessage.ascx.cs プロジェクト: zghlx/YAFNET
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</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.AddRoot();
            this.PageLinks.AddLink(
                this.PageContext.PageCategoryName,
                YafBuildLink.GetLink(ForumPages.forum, "c={0}", this.PageContext.PageCategoryID));
            this.PageLinks.AddForum(this.PageContext.PageForumID);

            this.EraseMessage.Checked    = false;
            this.EraseRow.Visible        = false;
            this.DeleteReasonRow.Visible = false;
            this.LinkedPosts.Visible     = false;

            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.HasRows() && (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");
                this.Delete.Text = this.GetText("DELETE");

                if (this.PageContext.IsAdmin)
                {
                    this.EraseRow.Visible = true;
                }
            }
            else
            {
                this.Title.Text  = this.GetText("EDIT");
                this.Delete.Text = this.GetText("UNDELETE");
            }

            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"]);
        }
コード例 #21
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            _messageRow = null;

            if (Request.QueryString ["m"] != null)
            {
                using (DataTable dt = DB.message_list(Request.QueryString ["m"]))
                {
                    _messageRow = dt.Rows [0];
                }

                if (!PageContext.ForumModeratorAccess && PageContext.PageUserID != ( int )_messageRow ["UserID"])
                {
                    YafBuildLink.AccessDenied();
                }
            }

            _forumFlags         = new ForumFlags(_messageRow ["ForumFlags"]);
            _topicFlags         = new TopicFlags(_messageRow ["TopicFlags"]);
            _ownerUserId        = ( int )_messageRow ["UserID"];
            _isModeratorChanged = (PageContext.PageUserID != _ownerUserId);

            if (PageContext.PageForumID == 0)
            {
                YafBuildLink.AccessDenied();
            }
            if (Request ["t"] == null && !PageContext.ForumPostAccess)
            {
                YafBuildLink.AccessDenied();
            }
            if (Request ["t"] != null && !PageContext.ForumReplyAccess)
            {
                YafBuildLink.AccessDenied();
            }

            if (!IsPostBack)
            {
                // setup page links
                PageLinks.AddLink(PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum));
                PageLinks.AddLink(PageContext.PageCategoryName, YafBuildLink.GetLink(ForumPages.forum, "c={0}", PageContext.PageCategoryID));
                PageLinks.AddForumLinks(PageContext.PageForumID);

                EraseMessage.Checked    = false;
                ViewState ["delAll"]    = false;
                EraseRow.Visible        = false;
                DeleteReasonRow.Visible = false;
                LinkedPosts.Visible     = false;
                ReasonEditor.Attributes.Add("style", "width:100%");
                Cancel.Text = GetText("Cancel");

                if (Request.QueryString ["m"] != null)
                {
                    // delete message...
                    PreviewRow.Visible = true;

                    DataTable tempdb = DB.message_getRepliesList(Request.QueryString ["m"]);

                    if (tempdb.Rows.Count != 0 && (PageContext.ForumModeratorAccess || PageContext.IsAdmin))
                    {
                        LinkedPosts.Visible    = true;
                        LinkedPosts.DataSource = tempdb;
                        LinkedPosts.DataBind();
                    }

                    if (Request.QueryString ["action"].ToLower() == "delete")
                    {
                        Title.Text  = GetText("EDIT");                          //GetText("EDIT");
                        Delete.Text = GetText("DELETE");                        // "GetText("Save");

                        if (PageContext.IsAdmin)
                        {
                            EraseRow.Visible = true;
                        }
                    }
                    else
                    {
                        Title.Text  = GetText("EDIT");
                        Delete.Text = GetText("UNDELETE");                           // "GetText("Save");
                    }

                    Subject.Text            = Convert.ToString(_messageRow ["Topic"]);
                    DeleteReasonRow.Visible = true;
                    ReasonEditor.Text       = Convert.ToString(_messageRow ["DeleteReason"]);

                    // populate the message preview with the message datarow...
                    MessagePreview.Message = _messageRow["message"].ToString();
                    MessagePreview.MessageFlags.BitValue = Convert.ToInt32(_messageRow ["Flags"]);
                }
            }
        }
コード例 #22
0
        /// <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)
        {
            if (!this.PageContext.IsGuest)
            {
                // Register Ajax Pro.
                Utility.RegisterTypeForAjax(typeof(YafFavoriteTopic));

                // The html code for "Favorite Topic" theme buttons.
                string tagButtonHTML =
                    "'<a class=\"yafcssbigbutton rightItem\" href=\"javascript:addFavoriteTopic(' + res.value + ');\" onclick=\"blur();\" title=\"{0}\"><span>{1}</span></a>'"
                    .FormatWith(
                        this.PageContext.Localization.GetText("BUTTON_TAGFAVORITE_TT"),
                        this.PageContext.Localization.GetText("BUTTON_TAGFAVORITE"));
                string untagButtonHTML =
                    "'<a class=\"yafcssbigbutton rightItem\" href=\"javascript:removeFavoriteTopic(' + res.value + ');\" onclick=\"blur();\" title=\"{0}\"><span>{1}</span></a>'"
                    .FormatWith(
                        this.PageContext.Localization.GetText("BUTTON_UNTAGFAVORITE_TT"),
                        this.PageContext.Localization.GetText("BUTTON_UNTAGFAVORITE"));

                // Register the client side script for the "Favorite Topic".
                YafContext.Current.PageElements.RegisterJsBlockStartup(
                    "addFavoriteTopicJs", JavaScriptBlocks.addFavoriteTopicJs(untagButtonHTML));
                YafContext.Current.PageElements.RegisterJsBlockStartup(
                    "removeFavoriteTopicJs", JavaScriptBlocks.removeFavoriteTopicJs(tagButtonHTML));
                YafContext.Current.PageElements.RegisterJsBlockStartup(
                    "asynchCallFailedJs", JavaScriptBlocks.asynchCallFailedJs);

                // Has the user already tagged this topic as favorite?
                if (this.Get <YafFavoriteTopic>().IsFavoriteTopic(this.PageContext.PageTopicID))
                {
                    // Generate the "Untag" theme button with appropriate JS calls for onclick event.
                    this.TagFavorite1.NavigateUrl       = "javascript:removeFavoriteTopic(" + this.PageContext.PageTopicID + ");";
                    this.TagFavorite2.NavigateUrl       = "javascript:removeFavoriteTopic(" + 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(" + this.PageContext.PageTopicID + ");";
                    this.TagFavorite2.NavigateUrl       = "javascript:addFavoriteTopic(" + 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    = YafForumInfo.ForumClientFileRoot + "editors";
            this._quickReplyEditor.StyleSheet = this.PageContext.Theme.BuildThemePath("theme.css");

            this._topic = DB.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 = DB.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 <YafPermissions>().HandleRequest(ViewPermissions.RegisteredUsers);
            }
            else if (!this.PageContext.ForumReadAccess)
            {
                YafBuildLink.AccessDenied();
            }

            if (!this.IsPostBack)
            {
                if (this.PageContext.Settings.LockedForum == 0)
                {
                    this.PageLinks.AddLink(this.PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum));
                    this.PageLinks.AddLink(
                        this.PageContext.PageCategoryName,
                        YafBuildLink.GetLink(ForumPages.forum, "c={0}", this.PageContext.PageCategoryID));
                }

                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.AddForumLinks(this.PageContext.PageForumID);
                this.PageLinks.AddLink(
                    this.Get <YafBadWordReplace>().Replace(this.Server.HtmlDecode(this.PageContext.PageTopicName)), string.Empty);

                this.TopicTitle.Text = this.Get <YafBadWordReplace>().Replace(this.HtmlEncode((string)this._topic["Topic"]));

                this.ViewOptions.Visible     = this.PageContext.BoardSettings.AllowThreaded;
                this.ForumJumpHolder.Visible = this.PageContext.BoardSettings.ShowForumJump &&
                                               this.PageContext.Settings.LockedForum == 0;

                this.RssTopic.NavigateUrl = YafBuildLink.GetLinkNotEscaped(
                    ForumPages.rsstopic,
                    "pg={0}&t={1}",
                    this.Request.QueryString.GetFirstOrDefault("g"),
                    this.PageContext.PageTopicID);
                this.RssTopic.Visible = this.PageContext.BoardSettings.ShowRSSLink;

                this.QuickReplyPlaceHolder.Visible = this.PageContext.BoardSettings.ShowQuickAnswer;

                if ((this.PageContext.IsGuest && this.PageContext.BoardSettings.EnableCaptchaForGuests) ||
                    (this.PageContext.BoardSettings.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;
                }
            }

            // Mark topic read
            YafContext.Current.Get <YafSession>().SetTopicRead(this.PageContext.PageTopicID, DateTime.UtcNow);

            this.BindData();
        }
コード例 #23
0
        /// <summary>
        /// Gets the topic image.
        /// </summary>
        /// <param name="row">The row.</param>
        /// <param name="imgTitle">The image title.</param>
        /// <returns>
        /// Returns the Topic Image
        /// </returns>
        protected string GetTopicImage([NotNull] DataRowView row, [NotNull] ref string imgTitle)
        {
            CodeContracts.VerifyNotNull(row, "row");
            CodeContracts.VerifyNotNull(imgTitle, "imgTitle");

            var 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);
            var theme = this.Get <ITheme>();

            if (row["TopicMovedID"].ToString().Length > 0)
            {
                imgTitle = this.GetText("MOVED");
                return(theme.GetItem("ICONS", "TOPIC_MOVED"));
            }

            var 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(theme.GetItem("ICONS", "TOPIC_POLL_NEW"));
                }

                switch (row["Priority"].ToString())
                {
                case "1":
                    imgTitle = this.GetText("STICKY_NEW");
                    return(theme.GetItem("ICONS", "TOPIC_STICKY_NEW"));

                case "2":
                    imgTitle = this.GetText("ANNOUNCEMENT");
                    return(theme.GetItem("ICONS", "TOPIC_ANNOUNCEMENT_NEW"));

                default:
                    if (topicFlags.IsLocked || forumFlags.IsLocked)
                    {
                        imgTitle = this.GetText("NEW_POSTS_LOCKED");
                        return(theme.GetItem("ICONS", "TOPIC_NEW_LOCKED"));
                    }

                    if (isHot)
                    {
                        imgTitle = this.GetText("ICONLEGEND", "HOT_NEW_POSTS");
                        return(theme.GetItem("ICONS", "TOPIC_HOT_NEW", theme.GetItem("ICONS", "TOPIC_NEW")));
                    }

                    imgTitle = this.GetText("ICONLEGEND", "NEW_POSTS");
                    return(theme.GetItem("ICONS", "TOPIC_NEW"));
                }
            }

            if (row["PollID"] != DBNull.Value)
            {
                imgTitle = this.GetText("POLL");
                return(theme.GetItem("ICONS", "TOPIC_POLL"));
            }

            switch (row["Priority"].ToString())
            {
            case "1":
                imgTitle = this.GetText("STICKY");
                return(theme.GetItem("ICONS", "TOPIC_STICKY"));

            case "2":
                imgTitle = this.GetText("ANNOUNCEMENT");
                return(theme.GetItem("ICONS", "TOPIC_ANNOUNCEMENT"));

            default:
                if (topicFlags.IsLocked || forumFlags.IsLocked)
                {
                    imgTitle = this.GetText("NO_NEW_POSTS_LOCKED");
                    return(theme.GetItem("ICONS", "TOPIC_LOCKED"));
                }

                if (isHot)
                {
                    imgTitle = this.GetText("HOT_NO_NEW_POSTS");
                    return(theme.GetItem("ICONS", "TOPIC_HOT", theme.GetItem("ICONS", "TOPIC")));
                }

                imgTitle = this.GetText("NO_NEW_POSTS");
                return(theme.GetItem("ICONS", "TOPIC"));
            }
        }
コード例 #24
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Mession.UnreadTopics    = 0;
            RssFeed.NavigateUrl     = YAF.Classes.Utils.YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.rsstopic, "pg=topics&f={0}", Request.QueryString["f"]);
            RssFeed.Text            = GetText("RSSFEED");
            RssFeed.Visible         = PageContext.BoardSettings.ShowRSSLink;
            MarkRead.Text           = GetText("MARKREAD");
            RSSLinkSpacer.Visible   = PageContext.BoardSettings.ShowRSSLink;
            ForumJumpHolder.Visible = PageContext.BoardSettings.ShowForumJump && PageContext.Settings.LockedForum == 0;

            if (!IsPostBack)
            {
                //PageLinks.Clear();

                if (PageContext.Settings.LockedForum == 0)
                {
                    PageLinks.AddLink(PageContext.BoardSettings.Name, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.forum));
                    PageLinks.AddLink(PageContext.PageCategoryName, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.forum, "c={0}", PageContext.PageCategoryID));
                }

                PageLinks.AddForumLinks(PageContext.PageForumID, true);

                ShowList.DataSource     = YafStaticData.TopicTimes( );
                ShowList.DataTextField  = "TopicText";
                ShowList.DataValueField = "TopicValue";
                _showTopicListSelected  = (Mession.ShowList == -1) ? PageContext.BoardSettings.ShowTopicsDefault : Mession.ShowList;

                HandleWatchForum();
            }

            if (Request.QueryString ["f"] == null)
            {
                YafBuildLink.AccessDenied();
            }

            if (!PageContext.ForumReadAccess)
            {
                YafBuildLink.AccessDenied();
            }

            using (DataTable dt = YAF.Classes.Data.DB.forum_list(PageContext.PageBoardID, PageContext.PageForumID))
                _forum = dt.Rows [0];

            if (_forum ["RemoteURL"] != DBNull.Value)
            {
                Response.Clear();
                Response.Redirect(( string )_forum ["RemoteURL"]);
            }

            _forumFlags = new ForumFlags(_forum["Flags"]);

            PageTitle.Text = ( string )_forum ["Name"];

            BindData();                 // Always because of yaf:TopicLine

            if (!PageContext.ForumPostAccess || (_forumFlags.IsLocked && !PageContext.ForumModeratorAccess))
            {
                NewTopic1.Visible = false;
                NewTopic2.Visible = false;
            }

            if (!PageContext.ForumModeratorAccess)
            {
                moderate1.Visible = false;
                moderate2.Visible = false;
            }
        }
コード例 #25
0
ファイル: ForumList.ascx.cs プロジェクト: RichardBer/ParkCMS
        /// <summary>
        /// The forum list 1_ item created.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void ForumList1_ItemCreated([NotNull] object sender, [NotNull] RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var      row        = (DataRow)e.Item.DataItem;
                var      flags      = new ForumFlags(row["Flags"]);
                DateTime lastRead   = YafContext.Current.Get <YafSession>().GetForumRead((int)row["ForumID"]);
                DateTime lastPosted = row["LastPosted"] != DBNull.Value ? (DateTime)row["LastPosted"] : lastRead;

                if (string.IsNullOrEmpty(row["ImageUrl"].ToString()))
                {
                    var forumIcon = e.Item.FindControl("ThemeForumIcon") as ThemeImage;
                    if (forumIcon != null)
                    {
                        forumIcon.ThemeTag           = "FORUM";
                        forumIcon.LocalizedTitlePage = "ICONLEGEND";
                        forumIcon.LocalizedTitleTag  = "NO_NEW_POSTS";
                        forumIcon.Visible            = true;

                        try
                        {
                            if (flags.IsLocked)
                            {
                                forumIcon.ThemeTag           = "FORUM_LOCKED";
                                forumIcon.LocalizedTitlePage = "ICONLEGEND";
                                forumIcon.LocalizedTitleTag  = "FORUM_LOCKED";
                            }
                            else if (lastPosted > lastRead)
                            {
                                forumIcon.ThemeTag           = "FORUM_NEW";
                                forumIcon.LocalizedTitlePage = "ICONLEGEND";
                                forumIcon.LocalizedTitleTag  = "NEW_POSTS";
                            }
                            else
                            {
                                forumIcon.ThemeTag           = "FORUM";
                                forumIcon.LocalizedTitlePage = "ICONLEGEND";
                                forumIcon.LocalizedTitleTag  = "NO_NEW_POSTS";
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                else
                {
                    var forumImage = e.Item.FindControl("ForumImage1") as HtmlImage;
                    if (forumImage != null)
                    {
                        forumImage.Src = "{0}{1}/{2}".FormatWith(
                            YafForumInfo.ForumServerFileRoot, YafBoardFolders.Current.Forums, row["ImageUrl"].ToString());

                        // TODO: vzrus: needs to be moved to css and converted to a more light control in the future.
                        // Highlight custom icon images and add tool tips to them.
                        try
                        {
                            forumImage.Attributes.Clear();

                            if (flags.IsLocked)
                            {
                                forumImage.Attributes.Add("class", "forum_customimage_locked");
                                forumImage.Attributes.Add("alt", this.PageContext.Localization.GetText("ICONLEGEND", "FORUM_LOCKED"));
                                forumImage.Attributes.Add("title", this.PageContext.Localization.GetText("ICONLEGEND", "FORUM_LOCKED"));
                                forumImage.Attributes.Add(
                                    "src",
                                    "{0}{1}/{2}".FormatWith(
                                        YafForumInfo.ForumServerFileRoot, YafBoardFolders.Current.Forums, row["ImageUrl"].ToString()));
                            }
                            else if (lastPosted > lastRead)
                            {
                                forumImage.Attributes.Add("class", "forum_customimage_newposts");
                                forumImage.Attributes.Add("alt", this.PageContext.Localization.GetText("ICONLEGEND", "NEW_POSTS"));
                                forumImage.Attributes.Add("title", this.PageContext.Localization.GetText("ICONLEGEND", "NEW_POSTS"));
                                forumImage.Attributes.Add(
                                    "src",
                                    "{0}{1}/{2}".FormatWith(
                                        YafForumInfo.ForumServerFileRoot, YafBoardFolders.Current.Forums, row["ImageUrl"].ToString()));
                            }
                            else
                            {
                                forumImage.Attributes.Add("class", "forum_customimage_nonewposts");
                                forumImage.Attributes.Add(
                                    "src",
                                    "{0}{1}/{2}".FormatWith(
                                        YafForumInfo.ForumServerFileRoot, YafBoardFolders.Current.Forums, row["ImageUrl"].ToString()));
                                forumImage.Attributes.Add("alt", this.PageContext.Localization.GetText("ICONLEGEND", "NO_NEW_POSTS"));
                                forumImage.Attributes.Add("title", this.PageContext.Localization.GetText("ICONLEGEND", "NO_NEW_POSTS"));
                            }

                            forumImage.Visible = true;
                        }
                        catch
                        {
                        }

                        forumImage.Visible = true;
                    }
                }

                if (!this.PageContext.BoardSettings.ShowModeratorList)
                {
                    // hide moderator list...
                    var moderatorColumn = e.Item.FindControl("ModeratorListTD") as HtmlTableCell;
                    var modList         = e.Item.FindControl("ModeratorList") as ForumModeratorList;

                    // set them as invisible...
                    if (moderatorColumn != null)
                    {
                        moderatorColumn.Visible = false;
                    }

                    if (modList != null)
                    {
                        modList.Visible = false;
                    }
                }
            }
        }
コード例 #26
0
ファイル: ForumList.ascx.cs プロジェクト: jiangsq123/YAFNET
        /// <summary>
        /// The forum list 1_ item created.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void ForumList1_ItemCreated([NotNull] object sender, [NotNull] RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var row   = (DataRow)e.Item.DataItem;
            var flags = new ForumFlags(row["Flags"]);

            DateTime lastRead =
                this.Get <IReadTrackCurrentUser>().GetForumTopicRead(
                    forumId: row["ForumID"].ToType <int>(),
                    topicId: row["LastTopicID"].ToType <int>(),
                    forumReadOverride: row["LastForumAccess"].ToType <DateTime?>() ?? DateTimeHelper.SqlDbMinTime(),
                    topicReadOverride: row["LastTopicAccess"].ToType <DateTime?>() ?? DateTimeHelper.SqlDbMinTime());

            DateTime lastPosted = row["LastPosted"].ToType <DateTime?>() ?? lastRead;

            if (string.IsNullOrEmpty(row["ImageUrl"].ToString()))
            {
                var forumIcon = e.Item.FindControl("ThemeForumIcon") as ThemeImage;
                if (forumIcon != null)
                {
                    forumIcon.ThemeTag           = "FORUM";
                    forumIcon.LocalizedTitlePage = "ICONLEGEND";
                    forumIcon.LocalizedTitleTag  = "NO_NEW_POSTS";
                    forumIcon.Visible            = true;

                    try
                    {
                        if (flags.IsLocked)
                        {
                            forumIcon.ThemeTag           = "FORUM_LOCKED";
                            forumIcon.LocalizedTitlePage = "ICONLEGEND";
                            forumIcon.LocalizedTitleTag  = "FORUM_LOCKED";
                        }
                        else if (lastPosted > lastRead)
                        {
                            forumIcon.ThemeTag           = "FORUM_NEW";
                            forumIcon.LocalizedTitlePage = "ICONLEGEND";
                            forumIcon.LocalizedTitleTag  = "NEW_POSTS";
                        }
                        else
                        {
                            forumIcon.ThemeTag           = "FORUM";
                            forumIcon.LocalizedTitlePage = "ICONLEGEND";
                            forumIcon.LocalizedTitleTag  = "NO_NEW_POSTS";
                        }
                    }
                    catch
                    {
                    }
                }
            }
            else
            {
                var forumImage = e.Item.FindControl("ForumImage1") as HtmlImage;
                if (forumImage != null)
                {
                    forumImage.Src = "{0}{1}/{2}".FormatWith(
                        YafForumInfo.ForumServerFileRoot, YafBoardFolders.Current.Forums, row["ImageUrl"].ToString());

                    // TODO: vzrus: needs to be moved to css and converted to a more light control in the future.
                    // Highlight custom icon images and add tool tips to them.
                    try
                    {
                        forumImage.Attributes.Clear();

                        if (flags.IsLocked)
                        {
                            forumImage.Attributes.Add("class", "forum_customimage_locked");
                            forumImage.Attributes.Add("alt", this.GetText("ICONLEGEND", "FORUM_LOCKED"));
                            forumImage.Attributes.Add("title", this.GetText("ICONLEGEND", "FORUM_LOCKED"));
                            forumImage.Attributes.Add(
                                "src",
                                "{0}{1}/{2}".FormatWith(
                                    YafForumInfo.ForumServerFileRoot,
                                    YafBoardFolders.Current.Forums,
                                    row["ImageUrl"].ToString()));
                        }
                        else if (lastPosted > lastRead)
                        {
                            forumImage.Attributes.Add("class", "forum_customimage_newposts");
                            forumImage.Attributes.Add("alt", this.GetText("ICONLEGEND", "NEW_POSTS"));
                            forumImage.Attributes.Add("title", this.GetText("ICONLEGEND", "NEW_POSTS"));
                            forumImage.Attributes.Add(
                                "src",
                                "{0}{1}/{2}".FormatWith(
                                    YafForumInfo.ForumServerFileRoot,
                                    YafBoardFolders.Current.Forums,
                                    row["ImageUrl"].ToString()));
                        }
                        else
                        {
                            forumImage.Attributes.Add("class", "forum_customimage_nonewposts");
                            forumImage.Attributes.Add(
                                "src",
                                "{0}{1}/{2}".FormatWith(
                                    YafForumInfo.ForumServerFileRoot,
                                    YafBoardFolders.Current.Forums,
                                    row["ImageUrl"].ToString()));
                            forumImage.Attributes.Add("alt", this.GetText("ICONLEGEND", "NO_NEW_POSTS"));
                            forumImage.Attributes.Add("title", this.GetText("ICONLEGEND", "NO_NEW_POSTS"));
                        }

                        forumImage.Visible = true;
                    }
                    catch
                    {
                    }

                    forumImage.Visible = true;
                }
            }

            if (!this.Get <YafBoardSettings>().ShowModeratorList)
            {
                return;
            }

            if (this.Get <YafBoardSettings>().ShowModeratorListAsColumn)
            {
                // hide moderator list...
                var moderatorColumn = e.Item.FindControl("ModeratorListTD") as HtmlTableCell;
                var modList         = e.Item.FindControl("ModeratorList") as ForumModeratorList;

                if (modList != null)
                {
                    var dra = row.GetChildRows("FK_Moderator_Forum");

                    if (dra.GetLength(0) > 0)
                    {
                        modList.DataSource = dra;
                        modList.Visible    = true;
                        modList.DataBind();
                    }

                    // set them as visible...
                    if (moderatorColumn != null)
                    {
                        moderatorColumn.Visible = true;
                    }
                }
            }
            else
            {
                var moderatorSpan = e.Item.FindControl("ModListMob_Span") as HtmlGenericControl;
                var modList1      = e.Item.FindControl("ForumModeratorListMob") as ForumModeratorList;

                if (modList1 != null)
                {
                    var dra = row.GetChildRows("FK_Moderator_Forum");
                    if (dra.GetLength(0) > 0)
                    {
                        modList1.DataSource = dra;
                        modList1.Visible    = true;
                        modList1.DataBind();

                        // set them as visible...
                        if (moderatorSpan != null)
                        {
                            moderatorSpan.Visible = true;
                        }
                    }
                }
            }
        }
コード例 #27
0
ファイル: posts.ascx.cs プロジェクト: coredweller/PhishMarket
        protected void Page_Load(object sender, System.EventArgs e)
        {
            _quickReplyEditor.BaseDir    = YafForumInfo.ForumRoot + "editors";
            _quickReplyEditor.StyleSheet = YafBuildLink.ThemeFile("theme.css");

            _topic = YAF.Classes.Data.DB.topic_info(PageContext.PageTopicID);

            // in case topic is deleted or not existant
            if (_topic == null)
            {
                YafBuildLink.Redirect(ForumPages.info, "i=6");                  // invalid argument message
            }
            // get topic flags
            _topicFlags = new TopicFlags(_topic["Flags"]);

            using (DataTable dt = YAF.Classes.Data.DB.forum_list(PageContext.PageBoardID, PageContext.PageForumID))
                _forum = dt.Rows [0];

            _forumFlags = new ForumFlags(_forum["Flags"]);

            if (!PageContext.ForumReadAccess)
            {
                YafBuildLink.AccessDenied();
            }

            #region Initial Setup
            if (!IsPostBack)
            {
                if (PageContext.Settings.LockedForum == 0)
                {
                    PageLinks.AddLink(PageContext.BoardSettings.Name, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.forum));
                    PageLinks.AddLink(PageContext.PageCategoryName, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.forum, "c={0}", PageContext.PageCategoryID));
                }

                QuickReply.Text         = GetText("POSTMESSAGE", "SAVE");
                DataPanel1.TitleText    = GetText("QUICKREPLY");
                DataPanel1.ExpandText   = GetText("QUICKREPLY_SHOW");
                DataPanel1.CollapseText = GetText("QUICKREPLY_HIDE");

                PageLinks.AddForumLinks(PageContext.PageForumID);
                PageLinks.AddLink(General.BadWordReplace(Server.HtmlDecode(PageContext.PageTopicName)), "");

                TopicTitle.Text = General.BadWordReplace(( string )_topic ["Topic"]);

                ViewOptions.Visible     = PageContext.BoardSettings.AllowThreaded;
                ForumJumpHolder.Visible = PageContext.BoardSettings.ShowForumJump && PageContext.Settings.LockedForum == 0;

                RssTopic.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.rsstopic, "pg={0}&t={1}", Request.QueryString ["g"], PageContext.PageTopicID);
                RssTopic.Visible     = PageContext.BoardSettings.ShowRSSLink;

                QuickReplyPlaceHolder.Visible = PageContext.BoardSettings.ShowQuickAnswer;

                if ((PageContext.IsGuest && PageContext.BoardSettings.EnableCaptchaForGuests) ||
                    (PageContext.BoardSettings.EnableCaptchaForPost && !PageContext.IsCaptchaExcluded))
                {
                    Session ["CaptchaImageText"] = General.GetCaptchaString();
                    imgCaptcha.ImageUrl          = String.Format("{0}resource.ashx?c=1", YafForumInfo.ForumRoot);
                    CaptchaDiv.Visible           = true;
                }

                if (!PageContext.ForumPostAccess || (_forumFlags.IsLocked && !PageContext.ForumModeratorAccess))
                {
                    NewTopic1.Visible = false;
                    NewTopic2.Visible = false;
                }

                // Ederon : 9/9/2007 - moderators can relpy in locked topics
                if (!PageContext.ForumReplyAccess ||
                    ((_topicFlags.IsLocked || _forumFlags.IsLocked) && !PageContext.ForumModeratorAccess))
                {
                    PostReplyLink1.Visible        = PostReplyLink2.Visible = false;
                    QuickReplyPlaceHolder.Visible = false;
                }

                if (PageContext.ForumModeratorAccess)
                {
                    MoveTopic1.Visible = true;
                    MoveTopic2.Visible = true;
                }
                else
                {
                    MoveTopic1.Visible = false;
                    MoveTopic2.Visible = false;
                }

                if (!PageContext.ForumModeratorAccess)
                {
                    LockTopic1.Visible   = false;
                    UnlockTopic1.Visible = false;
                    DeleteTopic1.Visible = false;
                    LockTopic2.Visible   = false;
                    UnlockTopic2.Visible = false;
                    DeleteTopic2.Visible = false;
                }
                else
                {
                    LockTopic1.Visible   = !_topicFlags.IsLocked;
                    UnlockTopic1.Visible = !LockTopic1.Visible;
                    LockTopic2.Visible   = LockTopic1.Visible;
                    UnlockTopic2.Visible = !LockTopic2.Visible;
                }

                // handle custom BBCode javascript or CSS...
                BBCode.RegisterCustomBBCodePageElements(Page, this.GetType());
            }
            #endregion

            // Mark topic read
            Mession.SetTopicRead(PageContext.PageTopicID, DateTime.Now);

            BindData();
        }