コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (User == null)
            {
                YafBuildLink.Redirect(ForumPages.login, "ReturnUrl={0}", General.GetSafeRawUrl());
            }

            // check if this feature is disabled
            if (!PageContext.BoardSettings.AllowPrivateMessages)
            {
                YafBuildLink.Redirect(ForumPages.info, "i=5");
            }

            if (!IsPostBack)
            {
                if (String.IsNullOrEmpty(Request.QueryString ["pm"]))
                {
                    YafBuildLink.AccessDenied();
                }

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

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

                BindData();
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!PageContext.ForumReadAccess)
            {
                YafBuildLink.AccessDenied();
            }

            if (Request.QueryString ["t"] != null)
            {
                repLastPosts.DataSource = YAF.Classes.Data.DB.post_list_reverse10(Request.QueryString ["t"]);
                repLastPosts.DataBind();
            }

            // handle custom BBCode javascript or CSS...
            BBCode.RegisterCustomBBCodePageElements(Page, this.GetType());
        }
コード例 #3
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();
        }
コード例 #4
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // check access permissions
            General.HandleRequest(PageContext, PageContext.BoardSettings.SearchPermissions);

            //Page.Reg
            //if(IsPostBack) throw new ApplicationException(Request.Form["__EVENTTARGET"]);

            if (!IsPostBack)
            {
                // 20050909 CHP : BEGIN
                if (PageContext.IsPrivate && User == null)
                {
                    // Ederon : guess we don't need this if anymore
                    //if ( CanLogin )
                    YAF.Classes.Utils.YafBuildLink.Redirect(YAF.Classes.Utils.ForumPages.login, "ReturnUrl={0}", Request.RawUrl);
                    //else
                    //	YAF.Classes.Utils.YafBuildLink.Redirect( YAF.Classes.Utils.ForumPages.forum );
                }
                // 20050909 CHP : END

                PageLinks.AddLink(PageContext.BoardSettings.Name,
                                  YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.forum));
                PageLinks.AddLink(GetText("TITLE"), "");
                btnSearch.Text = GetText("btnsearch");

                // Load result dropdown
                listResInPage.Items.Add(new ListItem(GetText("result5"), "5"));
                listResInPage.Items.Add(new ListItem(GetText("result10"), "10"));
                listResInPage.Items.Add(new ListItem(GetText("result25"), "25"));
                listResInPage.Items.Add(new ListItem(GetText("result50"), "50"));

                // Load searchwhere dropdown
                // listSearchWhere.Items.Add( new ListItem( GetText( "posts" ), "0" ) );
                // listSearchWhere.Items.Add( new ListItem( GetText( "postedby" ), "1" ) );

                //Load listSearchFromWho dropdown
                listSearchFromWho.Items.Add(new ListItem(GetText("match_all"), "0"));
                listSearchFromWho.Items.Add(new ListItem(GetText("match_any"), "1"));
                listSearchFromWho.Items.Add(new ListItem(GetText("match_exact"), "2"));

                // Load listSearchWhat dropdown
                listSearchWhat.Items.Add(new ListItem(GetText("match_all"), "0"));
                listSearchWhat.Items.Add(new ListItem(GetText("match_any"), "1"));
                listSearchWhat.Items.Add(new ListItem(GetText("match_exact"), "2"));
                ;

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

                //Load forum's combo
                //listForum.Items.Add( new ListItem( GetText( "allforums" ), "-1" ) );
                //DataTable dt = YAF.Classes.Data.DB.forum_listread( PageContext.PageBoardID, PageContext.PageUserID, null, null );

                //int nOldCat = 0;
                //for ( int i = 0; i < dt.Rows.Count; i++ )
                //{
                //    DataRow row = dt.Rows [i];
                //    if ( ( int ) row ["CategoryID"] != nOldCat )
                //    {
                //        nOldCat = ( int ) row ["CategoryID"];
                //        listForum.Items.Add( new ListItem( ( string ) row ["Category"], "-1" ) );
                //    }
                //    listForum.Items.Add( new ListItem( " - " + ( string ) row ["Forum"], row ["ForumID"].ToString() ) );
                //}

                LoadingModal.HeaderText = GetText("LOADING");
                LoadingModal.MainText   = GetText("LOADING_SEARCH");

                listForum.DataSource     = DB.forum_listall_sorted(PageContext.PageBoardID, PageContext.PageUserID);
                listForum.DataValueField = "ForumID";
                listForum.DataTextField  = "Title";
                listForum.DataBind();
                listForum.Items.Insert(0, new ListItem(GetText("allforums"), "0"));

                bool doSearch = false;

                string searchString = Request.QueryString["search"];
                if (!String.IsNullOrEmpty(searchString) && searchString.Length < 50)
                {
                    txtSearchStringWhat.Text = searchString;
                    doSearch = true;
                }

                string postedBy = Request.QueryString["postedby"];
                if (!String.IsNullOrEmpty(postedBy) && postedBy.Length < 50)
                {
                    txtSearchStringFromWho.Text = postedBy;
                    doSearch = true;
                }

                if (doSearch)
                {
                    SearchBindData(true);
                }
            }
        }