Ejemplo n.º 1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!ForumModeratorAccess)
            {
                Data.AccessDenied();
            }

            if (!IsPostBack)
            {
                FindUsers.Text = GetText("FIND");
                Update.Text    = GetText("UPDATE");
                Cancel.Text    = GetText("CANCEL");

                PageLinks.AddLink(BoardSettings.Name, Forum.GetLink(Pages.forum));
                PageLinks.AddLink(PageCategoryName, Forum.GetLink(Pages.forum, "c={0}", PageCategoryID));
                PageLinks.AddForumLinks(PageForumID);
                PageLinks.AddLink(GetText("TITLE"), Utils.GetSafeRawUrl());

                BindData();
                if (Request.QueryString["u"] != null)
                {
                    using (DataTable dt = DB.userforum_list(Request.QueryString["u"], PageForumID))
                    {
                        foreach (DataRow row in dt.Rows)
                        {
                            UserName.Text     = row["Name"].ToString();
                            UserName.Enabled  = false;
                            FindUsers.Visible = false;
                            AccessMaskID.Items.FindByValue(row["AccessMaskID"].ToString()).Selected = true;
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsHostAdmin)
            {
                Data.AccessDenied();
            }

            if (!IsPostBack)
            {
                PageLinks.AddLink(BoardSettings.Name, Forum.GetLink(Pages.forum));
                PageLinks.AddLink("Administration", Forum.GetLink(Pages.admin_admin));
                PageLinks.AddLink("Host Settings", Forum.GetLink(Pages.admin_hostsettings));

                BindData();
            }

            // set widths manually since ASP.NET "forgets" to do it for browsers other then IE
            SmiliesPerRow.Attributes.Add("style", "width:25px");
            SmiliesColumns.Attributes.Add("style", "width:25px");
            ForumEmailEdit.Attributes.Add("style", "width:200px");
            ForumSmtpServer.Attributes.Add("style", "width:200px");
            ForumSmtpUserName.Attributes.Add("style", "width:200px");
            ForumSmtpUserPass.Attributes.Add("style", "width:200px");
            AcceptedHTML.Attributes.Add("style", "width:200px");
        }
Ejemplo n.º 3
0
        private void BindData()
        {
            using (DataTable dt = DB.userpmessage_list(Request.QueryString["pm"]))
            {
                foreach (DataRow row in dt.Rows)
                {
                    if ((int)row["ToUserID"] != PageUserID && (int)row["FromUserID"] != PageUserID)
                    {
                        Data.AccessDenied();
                    }

                    PageLinks.AddLink(BoardSettings.Name, Forum.GetLink(Pages.forum));
                    PageLinks.AddLink(PageUserName, Forum.GetLink(Pages.cp_profile));
                    if ((int)row["ToUserID"] == PageUserID)
                    {
                        PageLinks.AddLink(GetText("INBOX"), Forum.GetLink(Pages.cp_inbox));
                    }
                    else
                    {
                        PageLinks.AddLink(GetText("SENTITEMS"), Forum.GetLink(Pages.cp_inbox, "sent=1"));
                    }
                    PageLinks.AddLink(row["Subject"].ToString(), Utils.GetSafeRawUrl());
                }
                Inbox.DataSource = dt;
            }
            DataBind();
            DB.pmessage_markread(Request.QueryString["pm"]);
        }
Ejemplo n.º 4
0
        private void Page_Load(object sender, EventArgs e)
        {
            if (!User.IsAuthenticated)
            {
                Data.AccessDenied();
            }

            if (!IsPostBack)
            {
                Send.Text = GetText("SEND");
                From.Text = PageUserName;
                using (DataTable dt = DB.user_list(PageBoardID, Request.QueryString["u"], null))
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        PageLinks.AddLink(BoardSettings.Name, Forum.GetLink(Pages.forum));
                        PageLinks.AddLink(row["user_nick"].ToString(), string.Format("userinfo.aspx?id={0}", row["User_ID"]));
                        PageLinks.AddLink(GetText("TITLE"), Forum.GetLink(Pages.im_icq, "u={0}", row["User_ID"]));
                        ViewState["to"] = (int)row["user_ICQ"];
                        Status.Src      = string.Format("http://web.icq.com/whitepages/online?icq={0}&img=5", row["ICQ"]);
                        break;
                    }
                }
                using (DataTable dt = DB.user_list(PageBoardID, PageUserID, null))
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        Email.Text = row["user_mail"].ToString();
                        break;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        private void MoveTopic_Click(object sender, System.EventArgs e)
        {
            if (!ForumModeratorAccess)
            {
                Data.AccessDenied(/*"You are not a forum moderator."*/);
            }

            Forum.Redirect(Pages.movetopic, "t={0}", PageTopicID);
        }
Ejemplo n.º 6
0
        private void DeleteTopic_Click(object sender, System.EventArgs e)
        {
            if (!ForumModeratorAccess)
            {
                Data.AccessDenied(/*"You don't have access to delete topics."*/);
            }

            DB.topic_delete(PageTopicID);
            Forum.Redirect(Pages.topics, "f={0}", PageForumID);
        }
Ejemplo n.º 7
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!User.CanLogin)
            {
                Data.AccessDenied();
            }

            FormsAuthentication.SignOut();
            Session.Abandon();
            Forum.Redirect(Pages.forum);
        }
Ejemplo n.º 8
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!ForumReadAccess)
            {
                Data.AccessDenied();
            }

            if (Request.QueryString["t"] != null)
            {
                repLastPosts.DataSource = DB.post_list_reverse10(Request.QueryString["t"]);
                repLastPosts.DataBind();
            }
        }
Ejemplo n.º 9
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsModerator)
            {
                Data.AccessDenied();
            }

            if (!IsPostBack)
            {
                PageLinks.AddLink(BoardSettings.Name, Forum.GetLink(Pages.forum));
                PageLinks.AddLink(GetText("MODERATE_DEFAULT", "TITLE"), Forum.GetLink(Pages.moderate_index));
                BindData();
            }
        }
Ejemplo n.º 10
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            using (DataTable dt = DB.forum_list(PageBoardID, PageForumID))
                forum = dt.Rows[0];
            topic = DB.topic_info(PageTopicID);

            if (!IsPostBack)
            {
                if (!ForumModeratorAccess && !ForumUploadAccess)
                {
                    Data.AccessDenied();
                }

                if (!ForumReadAccess)
                {
                    Data.AccessDenied();
                }

                if (((int)topic["Flags"] & (int)TopicFlags.Locked) == (int)TopicFlags.Locked)
                {
                    Data.AccessDenied(/*"The topic is closed."*/);
                }

                if (((int)forum["Flags"] & (int)ForumFlags.Locked) == (int)ForumFlags.Locked)
                {
                    Data.AccessDenied(/*"The forum is closed."*/);
                }

                // Check that non-moderators only edit messages they have written
                if (!ForumModeratorAccess)
                {
                    using (DataTable dt = DB.message_list(Request.QueryString["m"]))
                        if ((int)dt.Rows[0]["UserID"] != PageUserID)
                        {
                            Data.AccessDenied(/*"You didn't post this message."*/);
                        }
                }

                PageLinks.AddLink(BoardSettings.Name, Forum.GetLink(Pages.forum));
                PageLinks.AddLink(PageCategoryName, Forum.GetLink(Pages.forum, "c={0}", PageCategoryID));
                PageLinks.AddForumLinks(PageForumID);
                PageLinks.AddLink(PageTopicName, Forum.GetLink(Pages.posts, "t={0}", PageTopicID));
                PageLinks.AddLink(GetText("TITLE"), Utils.GetSafeRawUrl());

                Back.Text   = GetText("BACK");
                Upload.Text = GetText("UPLOAD");

                BindData();
            }
        }
Ejemplo n.º 11
0
        private void NewTopic_Click(object sender, System.EventArgs e)
        {
            if (((int)forum["Flags"] & (int)ForumFlags.Locked) == (int)ForumFlags.Locked)
            {
                AddLoadMessage(GetText("WARN_FORUM_LOCKED"));
                return;
            }

            if (!ForumPostAccess)
            {
                Data.AccessDenied(/*"You don't have access to post new topics in this forum."*/);
            }

            Forum.Redirect(Pages.postmessage, "f={0}", PageForumID);
        }
Ejemplo n.º 12
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsHostAdmin)
            {
                Data.AccessDenied();
            }

            if (!IsPostBack)
            {
                PageLinks.AddLink(BoardSettings.Name, Forum.GetLink(Pages.forum));
                PageLinks.AddLink("Administration", Forum.GetLink(Pages.admin_admin));
                PageLinks.AddLink("Boards", Forum.GetLink(Pages.admin_boards));

                BindData();
            }
        }
Ejemplo n.º 13
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!ForumModeratorAccess)
            {
                Data.AccessDenied();
            }

            if (!IsPostBack)
            {
                AddUser.Text = GetText("INVITE");

                PageLinks.AddLink(BoardSettings.Name, Forum.GetLink(Pages.forum));
                PageLinks.AddLink(PageCategoryName, Forum.GetLink(Pages.forum, "c={0}", PageCategoryID));
                PageLinks.AddForumLinks(PageForumID);
                PageLinks.AddLink(GetText("TITLE"), Utils.GetSafeRawUrl());
            }
            BindData();
        }
Ejemplo n.º 14
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!User.CanLogin || BoardSettings.DisableRegistrations)
            {
                Data.AccessDenied();
            }

            if (!IsPostBack)
            {
                PageLinks.AddLink(BoardSettings.Name, Forum.GetLink(Pages.forum));
                ForumRegister.Text = GetText("register");
                cancel.Text        = GetText("Cancel");

                TimeZones.DataSource = Data.TimeZones();
                DataBind();
                TimeZones.Items.FindByValue("0").Selected = true;
            }
        }
Ejemplo n.º 15
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (Request.QueryString["u"] == null)
            {
                Data.AccessDenied();
            }

            if (!IsPostBack)
            {
                userGroupsRow.Visible = BoardSettings.ShowGroupsProfile || IsAdmin;
                SuspendUnit.Items.Add(new ListItem(GetText("DAYS"), "1"));
                SuspendUnit.Items.Add(new ListItem(GetText("HOURS"), "2"));
                SuspendUnit.Items.Add(new ListItem(GetText("MINUTES"), "3"));
                SuspendUnit.Items.FindByValue("2").Selected = true;
                SuspendCount.Text = "2";

                BindData();
            }
        }
Ejemplo n.º 16
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (Request.QueryString["t"] == null || !ForumReadAccess)
            {
                Data.AccessDenied();
            }

            ShowToolBar = false;

            if (!IsPostBack)
            {
                PageLinks.AddLink(BoardSettings.Name, Forum.GetLink(Pages.forum));
                PageLinks.AddLink(PageCategoryName, Forum.GetLink(Pages.forum, "c={0}", PageCategoryID));
                PageLinks.AddForumLinks(PageForumID);
                PageLinks.AddLink(PageTopicName, Forum.GetLink(Pages.posts, "t={0}", PageTopicID));

                Posts.DataSource = DB.post_list(PageTopicID, 1);
                DataBind();
            }
        }
Ejemplo n.º 17
0
        private void Page_Load(object sender, EventArgs e)
        {
            if (!User.IsAuthenticated)
            {
                Data.AccessDenied();
            }

            if (!IsPostBack)
            {
                using (DataTable dt = DB.user_list(PageBoardID, Request.QueryString["u"], null))
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        PageLinks.AddLink(BoardSettings.Name, Forum.GetLink(Pages.forum));
                        PageLinks.AddLink(row["user_nick"].ToString(), string.Format("userinfo.aspx?id={0}", row["User_ID"]));
                        PageLinks.AddLink(GetText("TITLE"), Forum.GetLink(Pages.im_email, "u={0}", row["User_ID"]));
                        break;
                    }
                }
                Send.Text = GetText("SEND");
            }
        }
Ejemplo n.º 18
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (Request.QueryString["t"] == null || !ForumModeratorAccess)
            {
                Data.AccessDenied();
            }

            if (!IsPostBack)
            {
                PageLinks.AddLink(BoardSettings.Name, Forum.GetLink(Pages.forum));
                PageLinks.AddLink(PageCategoryName, Forum.GetLink(Pages.forum, "c={0}", PageCategoryID));
                PageLinks.AddForumLinks(PageForumID);
                PageLinks.AddLink(PageTopicName, Forum.GetLink(Pages.posts, "t={0}", PageTopicID));

                Move.Text = GetText("move");

                ForumList.DataSource = DB.forum_listall(PageBoardID, PageUserID);
                //ForumList.DataSource = DB.forum_listread(PageBoardID,PageUserID,null,null);
                DataBind();
                ForumList.Items.FindByValue(PageForumID.ToString()).Selected = true;
            }
        }
Ejemplo n.º 19
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (Request.QueryString["t"] == null || !ForumReadAccess)
            {
                Data.AccessDenied();
            }

            if (!IsPostBack)
            {
                PageLinks.AddLink(BoardSettings.Name, Forum.GetLink(Pages.forum));
                PageLinks.AddLink(PageCategoryName, Forum.GetLink(Pages.forum, "c={0}", PageCategoryID));
                PageLinks.AddForumLinks(PageForumID);
                PageLinks.AddLink(PageTopicName, Forum.GetLink(Pages.posts, "t={0}", PageTopicID));

                SendEmail.Text = GetText("send");

                Subject.Text = PageTopicName;
                string msg = Utils.ReadTemplate("emailtopic.txt");
                msg          = msg.Replace("{link}", String.Format("{0}{1}", ServerURL, Forum.GetLink(Pages.posts, "t={0}", PageTopicID)));
                msg          = msg.Replace("{user}", PageUserName);
                Message.Text = msg;
            }
        }
Ejemplo n.º 20
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!User.IsAuthenticated)
            {
                Data.AccessDenied();
            }

            if (!IsPostBack)
            {
                using (DataTable dt = DB.user_list(PageBoardID, Request.QueryString["u"], null))
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        PageLinks.AddLink(BoardSettings.Name, Forum.GetLink(Pages.forum));
                        PageLinks.AddLink(row["Name"].ToString(), string.Format("userinfo.aspx?id={0}", row["UserID"]));
                        PageLinks.AddLink(GetText("TITLE"), Forum.GetLink(Pages.im_yim, "u={0}", row["UserID"]));
                        Img.Src         = string.Format("http://opi.yahoo.com/online?u={0}&m=g&t=2", row["YIM"]);
                        Msg.NavigateUrl = string.Format("http://edit.yahoo.com/config/send_webmesg?.target={0}&.src=pg", row["YIM"]);
                        break;
                    }
                }
            }
        }
Ejemplo n.º 21
0
        private void Page_Load(object sender, EventArgs e)
        {
            if (!User.IsAuthenticated)
            {
                Data.AccessDenied();
            }

            if (!IsPostBack)
            {
                using (DataTable dt = DB.user_list(PageBoardID, Request.QueryString["u"], null))
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        PageLinks.AddLink(BoardSettings.Name, Forum.GetLink(Pages.forum));
                        PageLinks.AddLink(row["user_nick"].ToString(), string.Format("userinfo.aspx?id={0}", row["User_ID"]));
                        PageLinks.AddLink(GetText("TITLE"), Forum.GetLink(Pages.im_aim, "u={0}", row["User_ID"]));

                        Msg.NavigateUrl   = string.Format("aim:goim?screenname={0}&message=Hi.+Are+you+there?", row["user_AIM"]);
                        Buddy.NavigateUrl = string.Format("aim:addbuddy?screenname={0}", row["user_AIM"]);
                        break;
                    }
                }
            }
        }
Ejemplo n.º 22
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here
            RssFeed rf = new RssFeed();

            XmlTextWriter writer = new XmlTextWriter(Response.OutputStream, System.Text.Encoding.UTF8);

            writer.Formatting = Formatting.Indented;
            rf.WriteRSSPrologue(writer, this);

            // Usage rf.AddRSSItem(writer, "Item Title", "http://test.com", "This is a test item");

            switch (Request.QueryString["pg"])
            {
            case "posts":
                if (!ForumReadAccess)
                {
                    Data.AccessDenied();
                }

                if (Request.QueryString["t"] != null)
                {
                    using (DataTable dt = DB.post_list(PageTopicID, 1))
                    {
                        foreach (DataRow row in dt.Rows)
                        {
                            rf.AddRSSItem(writer, row["Subject"].ToString(), ServerURL + Forum.GetLink(Pages.posts, "t={0}", Request.QueryString["t"]), row["Message"].ToString());
                        }
                    }
                }

                break;

            case "forum":
                using (DataTable dt = DB.forum_listread(PageBoardID, PageUserID, null, null))
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        rf.AddRSSItem(writer, row["Forum"].ToString(), ServerURL + Forum.GetLink(Pages.posts, "t={0}", row["LastTopicID"]), row["Description"].ToString());
                    }
                }
                break;

            case "topics":
                if (!ForumReadAccess)
                {
                    Data.AccessDenied();
                }

                if (Request.QueryString["f"] != null)
                {
                    using (DataTable dt = DB.GetData("select Topic = a.Topic, TopicID = a.TopicID, Name = b.Name from yaf_Topic a, yaf_Forum b where a.ForumID=" + Request.QueryString["f"] + " and b.ForumID = a.ForumID"))
                    {
                        foreach (DataRow row in dt.Rows)
                        {
                            rf.AddRSSItem(writer, row["Topic"].ToString(), ServerURL + Forum.GetLink(Pages.posts, "t={0}", row["TopicID"]), row["Topic"].ToString());
                        }
                    }
                }

                break;

            case "active":
                using (DataTable dt = DB.topic_active(PageBoardID, PageUserID, DateTime.Now + TimeSpan.FromHours(-24), ForumControl.CategoryID))
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        rf.AddRSSItem(writer, row["Subject"].ToString(), ServerURL + Forum.GetLink(Pages.posts, "t={0}", row["LinkTopicID"]), row["Subject"].ToString());
                    }
                }
                break;

            default:
                break;
            }

            rf.WriteRSSClosing(writer);
            writer.Flush();

            writer.Close();

            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.ContentType     = "text/xml";
            Response.Cache.SetCacheability(HttpCacheability.Public);

            Response.End();
        }
Ejemplo n.º 23
0
        private void PostReply_Click(object sender, System.EventArgs e)
        {
            if (SubjectRow.Visible && Subject.Text.Length <= 0)
            {
                AddLoadMessage(GetText("need_subject"));
                return;
            }

            if (PollRow1.Visible)
            {
                if (Question.Text.Trim().Length == 0)
                {
                    AddLoadMessage(GetText("NEED_QUESTION"));
                    return;
                }

                string p1 = PollChoice1.Text.Trim();
                string p2 = PollChoice2.Text.Trim();
                if (p1.Length == 0 || p2.Length == 0)
                {
                    AddLoadMessage(GetText("NEED_CHOICES"));
                    return;
                }
            }


            // see if there is a post delay
            if (!(IsAdmin || IsModerator) && BoardSettings.PostFloodDelay > 0)
            {
                // see if they've past that delay point
                if (Mession.LastPost > DateTime.Now.AddSeconds(-BoardSettings.PostFloodDelay) && Request.QueryString["m"] == null)
                {
                    AddLoadMessage(String.Format(GetText("wait"), (Mession.LastPost - DateTime.Now.AddSeconds(-BoardSettings.PostFloodDelay)).Seconds));
                    return;
                }
            }

            long   TopicID;
            long   nMessageID = 0;
            object replyTo    = null;

            if (Request.QueryString["q"] != null)
            {
                replyTo = int.Parse(Request.QueryString["q"]);
            }
            else
            {
                // Let save procedure find first post
                replyTo = -1;
            }

            string msg = Message.Text;

            Mession.LastPost = DateTime.Now;

            if (Request.QueryString["t"] != null)
            {
                if (!ForumReplyAccess)
                {
                    Data.AccessDenied();
                }

                TopicID = long.Parse(Request.QueryString["t"]);
                // make message flags
                MessageFlags tFlags = new MessageFlags();

                tFlags.IsHTML   = Message.UsesHTML;
                tFlags.IsBBCode = Message.UsesBBCode;

                if (!DB.message_save(TopicID, PageUserID, msg, User.IsAuthenticated ? null : From.Text, Request.UserHostAddress, null, replyTo, tFlags.BitValue, ref nMessageID))
                {
                    TopicID = 0;
                }
            }
            else if (Request.QueryString["m"] != null)
            {
                if (!ForumEditAccess)
                {
                    Data.AccessDenied();
                }

                string SubjectSave = "";
                if (Subject.Enabled)
                {
                    SubjectSave = Server.HtmlEncode(Subject.Text);
                }

                // make message flags
                MessageFlags tFlags = new MessageFlags();

                tFlags.IsHTML   = Message.UsesHTML;
                tFlags.IsBBCode = Message.UsesBBCode;

                DB.message_update(Request.QueryString["m"], Priority.SelectedValue, msg, SubjectSave, tFlags.BitValue);
                TopicID    = PageTopicID;
                nMessageID = long.Parse(Request.QueryString["m"]);
            }
            else
            {
                if (!ForumPostAccess)
                {
                    Data.AccessDenied();
                }

                object PollID = null;

                if (PollRow1.Visible)
                {
                    PollID = DB.poll_save(Question.Text,
                                          PollChoice1.Text,
                                          PollChoice2.Text,
                                          PollChoice3.Text,
                                          PollChoice4.Text,
                                          PollChoice5.Text,
                                          PollChoice6.Text,
                                          PollChoice7.Text,
                                          PollChoice8.Text,
                                          PollChoice9.Text);
                }

                // make message flags
                MessageFlags tFlags = new MessageFlags();

                tFlags.IsHTML   = Message.UsesHTML;
                tFlags.IsBBCode = Message.UsesBBCode;

                string subject = Server.HtmlEncode(Subject.Text);
                TopicID = DB.topic_save(PageForumID, subject, msg, PageUserID, Priority.SelectedValue, PollID, User.IsAuthenticated ? null : From.Text, Request.UserHostAddress, null, tFlags.BitValue, ref nMessageID);
            }

            // Check if message is approved
            bool bApproved = false;

            using (DataTable dt = DB.message_list(nMessageID))
                foreach (DataRow row in dt.Rows)
                {
                    bApproved = ((int)row["Flags"] & 16) == 16;
                }

            // Create notification emails
            if (bApproved)
            {
                //TO DO: não funciona o Watch Email
                //Utils.CreateWatchEmail(this,nMessageID);
                Forum.Redirect(Pages.posts, "m={0}&#{0}", nMessageID);
            }
            else
            {
                // Tell user that his message will have to be approved by a moderator
                //AddLoadMessage("Since you posted to a moderated forum, a forum moderator must approve your post before it will become visible.");
                string url = Forum.GetLink(Pages.topics, "f={0}", PageForumID);
                if (Config.IsRainbow)
                {
                    Forum.Redirect(Pages.info, "i=1");
                }
                else
                {
                    Forum.Redirect(Pages.info, "i=1&url={0}", Server.UrlEncode(url));
                }
            }
        }
Ejemplo n.º 24
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            DataRow msg = null;

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

                if (!ForumModeratorAccess && PageUserID != (int)msg["UserID"])
                {
                    Data.AccessDenied();
                }
            }

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

            //Message.EnableRTE = BoardSettings.AllowRichEdit;
            Message.BaseDir = Data.ForumRoot + "editors";

            Title.Text = GetText("NEWTOPIC");

            if (!IsPostBack)
            {
                Priority.Items.Add(new ListItem(GetText("normal"), "0"));
                Priority.Items.Add(new ListItem(GetText("sticky"), "1"));
                Priority.Items.Add(new ListItem(GetText("announcement"), "2"));
                Priority.SelectedIndex = 0;

                Preview.Text    = GetText("preview");
                PostReply.Text  = GetText("Save");
                Cancel.Text     = GetText("Cancel");
                CreatePoll.Text = GetText("createpoll");

                PriorityRow.Visible   = ForumPriorityAccess;
                CreatePollRow.Visible = Request.QueryString["t"] == null && ForumPollAccess;

                PageLinks.AddLink(BoardSettings.Name, Forum.GetLink(Pages.forum));
                PageLinks.AddLink(PageCategoryName, Forum.GetLink(Pages.forum, "c={0}", PageCategoryID));
                PageLinks.AddForumLinks(PageForumID);

                if (Request.QueryString["t"] != null)
                {
                    // new post...
                    DataRow topic = DB.topic_info(Request.QueryString["t"]);
                    if (((int)topic["Flags"] & (int)TopicFlags.Locked) == (int)TopicFlags.Locked)
                    {
                        Response.Redirect(Request.UrlReferrer.ToString());
                    }
                    SubjectRow.Visible = false;
                    Title.Text         = GetText("reply");

                    if (Config.IsDotNetNuke || Config.IsRainbow)
                    {
                        // can't use the last post iframe
                        LastPosts.Visible    = true;
                        LastPosts.DataSource = DB.post_list_reverse10(Request.QueryString["t"]);
                        LastPosts.DataBind();
                    }
                    else
                    {
                        LastPostsIFrame.Visible = true;
                        LastPostsIFrame.Attributes.Add("src", "framehelper.aspx?g=lastposts&t=" + Request.QueryString["t"]);
                    }
                }

                if (Request.QueryString["q"] != null)
                {
                    // reply to post...
                    bool isHtml = msg["Message"].ToString().IndexOf('<') >= 0;

                    string tmpMessage = msg["Message"].ToString();

                    if (BoardSettings.RemoveNestedQuotes)
                    {
                        RegexOptions m_options = RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Singleline;
                        Regex        quote     = new Regex(@"\[quote(\=.*)?\](.*?)\[/quote\]", m_options);
                        // remove quotes from old messages
                        tmpMessage = quote.Replace(tmpMessage, "");
                    }

                    if (isHtml)
                    {
                        Message.Text = String.Format("[quote={0}]{1}[/quote]", msg["username"], FormatMsg.HtmlToForumCode(tmpMessage));
                    }
                    else
                    {
                        Message.Text = String.Format("[quote={0}]{1}[/quote]", msg["username"], tmpMessage);
                    }
                }
                else if (Request.QueryString["m"] != null)
                {
                    // edit message...
                    string body   = msg["message"].ToString();
                    bool   isHtml = body.IndexOf('<') >= 0;
                    if (isHtml)
                    {
                        //throw new Exception("TODO: Convert this html message to forumcodes");
                        body = FormatMsg.HtmlToForumCode(body);
                    }
                    Message.Text = body;
                    Title.Text   = GetText("EDIT");

                    Subject.Text = Server.HtmlDecode(Convert.ToString(msg["Topic"]));

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

                    CreatePollRow.Visible          = false;
                    Priority.SelectedItem.Selected = false;
                    Priority.Items.FindByValue(msg["Priority"].ToString()).Selected = true;
                }

                From.Text = PageUserName;
                if (User.IsAuthenticated)
                {
                    FromRow.Visible = false;
                }
            }
        }
Ejemplo n.º 25
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            Mession.UnreadTopics  = 0;
            RssFeed.NavigateUrl   = Forum.GetLink(Pages.rsstopic, "pg=topics&f={0}", Request.QueryString["f"]);
            RssFeed.Text          = GetText("RSSFEED");
            RssFeed.Visible       = BoardSettings.ShowRSSLink;
            RSSLinkSpacer.Visible = BoardSettings.ShowRSSLink;
            ForumJumpLine.Visible = BoardSettings.ShowForumJump;

            if (!IsPostBack)
            {
                PageLinks.AddLink(BoardSettings.Name, Forum.GetLink(Pages.forum));
                PageLinks.AddLink(PageCategoryName, Forum.GetLink(Pages.forum, "c={0}", PageCategoryID));
                PageLinks.AddForumLinks(PageForumID);

                moderate1.Text    = GetThemeContents("BUTTONS", "MODERATE");
                moderate1.ToolTip = "Moderate this forum";
                moderate2.Text    = moderate1.Text;
                moderate2.ToolTip = moderate1.ToolTip;
                MarkRead.Text     = GetText("MARKREAD");

                NewTopic1.Text    = GetThemeContents("BUTTONS", "NEWTOPIC");
                NewTopic1.ToolTip = "Post new topic";
                NewTopic2.Text    = NewTopic1.Text;
                NewTopic2.ToolTip = NewTopic1.ToolTip;

                ShowList.DataSource     = Data.TopicTimes(this);
                ShowList.DataTextField  = "TopicText";
                ShowList.DataValueField = "TopicValue";
                ShowTopicListSelected   = (Mession.ShowList == -1) ? BoardSettings.ShowTopicsDefault : Mession.ShowList;

                HandleWatchForum();
            }

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

            if (!ForumReadAccess)
            {
                Data.AccessDenied();
            }

            using (DataTable dt = DB.forum_list(PageBoardID, PageForumID))
                forum = dt.Rows[0];

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

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

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

            if (!ForumPostAccess)
            {
                NewTopic1.Visible = false;
                NewTopic2.Visible = false;
            }

            if (!ForumModeratorAccess)
            {
                moderate1.Visible = false;
                moderate2.Visible = false;
            }
        }
Ejemplo n.º 26
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            topic = DB.topic_info(PageTopicID);
            using (DataTable dt = DB.forum_list(PageBoardID, PageForumID))
                forum = dt.Rows[0];

            if (!ForumReadAccess)
            {
                Data.AccessDenied();
            }

            if (!IsPostBack)
            {
                PageLinks.AddLink(BoardSettings.Name, Forum.GetLink(Pages.forum));
                PageLinks.AddLink(PageCategoryName, Forum.GetLink(Pages.forum, "c={0}", PageCategoryID));
                PageLinks.AddForumLinks(PageForumID);
                PageLinks.AddLink(Utils.BadWordReplace(PageTopicName), Forum.GetLink(Pages.posts, "t={0}", PageTopicID));
                TopicTitle.Text       = Utils.BadWordReplace((string)topic["Topic"]);
                ViewOptions.Visible   = BoardSettings.AllowThreaded;
                ForumJumpLine.Visible = BoardSettings.ShowForumJump;

                RssTopic.NavigateUrl = Forum.GetLink(Pages.rsstopic, "pg={0}&t={1}", Request.QueryString["g"], PageTopicID);
                RssTopic.Visible     = BoardSettings.ShowRSSLink;

                if (!ForumPostAccess)
                {
                    NewTopic1.Visible = false;
                    NewTopic2.Visible = false;
                }

                if (!ForumReplyAccess || ((int)topic["Flags"] & (int)TopicFlags.Locked) == (int)TopicFlags.Locked)
                {
                    PostReplyLink1.Visible = false;
                    PostReplyLink2.Visible = false;
                }

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

                PostReplyLink1.Text    = GetThemeContents("BUTTONS", "POSTREPLY");
                PostReplyLink1.ToolTip = "Post reply";
                PostReplyLink2.Text    = PostReplyLink1.Text;
                PostReplyLink2.ToolTip = PostReplyLink1.ToolTip;
                NewTopic1.Text         = GetThemeContents("BUTTONS", "NEWTOPIC");
                NewTopic1.ToolTip      = "Post new topic";
                NewTopic2.Text         = NewTopic1.Text;
                NewTopic2.ToolTip      = NewTopic1.ToolTip;
                DeleteTopic1.Text      = GetThemeContents("BUTTONS", "DELETETOPIC");
                DeleteTopic1.ToolTip   = "Delete this topic";
                DeleteTopic2.Text      = DeleteTopic1.Text;
                DeleteTopic2.ToolTip   = DeleteTopic1.ToolTip;
                LockTopic1.Text        = GetThemeContents("BUTTONS", "LOCKTOPIC");
                LockTopic1.ToolTip     = "Lock this topic";
                LockTopic2.Text        = LockTopic1.Text;
                LockTopic2.ToolTip     = LockTopic1.ToolTip;
                UnlockTopic1.Text      = GetThemeContents("BUTTONS", "UNLOCKTOPIC");
                UnlockTopic1.ToolTip   = "Unlock this topic";
                UnlockTopic2.Text      = UnlockTopic1.Text;
                UnlockTopic2.ToolTip   = UnlockTopic1.ToolTip;
                MoveTopic1.Text        = GetThemeContents("BUTTONS", "MOVETOPIC");
                MoveTopic1.ToolTip     = "Move this topic";
                MoveTopic2.Text        = MoveTopic1.Text;
                MoveTopic2.ToolTip     = MoveTopic1.ToolTip;

                if (!ForumModeratorAccess)
                {
                    LockTopic1.Visible   = false;
                    UnlockTopic1.Visible = false;
                    DeleteTopic1.Visible = false;
                    LockTopic2.Visible   = false;
                    UnlockTopic2.Visible = false;
                    DeleteTopic2.Visible = false;
                }
                else
                {
                    LockTopic1.Visible   = ((int)topic["Flags"] & (int)TopicFlags.Locked) != (int)TopicFlags.Locked;
                    UnlockTopic1.Visible = !LockTopic1.Visible;
                    LockTopic2.Visible   = LockTopic1.Visible;
                    UnlockTopic2.Visible = !LockTopic2.Visible;
                }
            }
            // Mark topic read
            SetTopicRead(PageTopicID, DateTime.Now);
            BindData();
        }
Ejemplo n.º 27
0
        private void BindData()
        {
            using (DataTable dt = DB.user_list(PageBoardID, Request.QueryString["u"], true))
            {
                if (dt.Rows.Count < 1)
                {
                    Data.AccessDenied(/*No such user exists*/);
                }
                DataRow user = dt.Rows[0];

                PageLinks.AddLink(BoardSettings.Name, Forum.GetLink(Pages.forum));
                PageLinks.AddLink(GetText("MEMBERS"), Forum.GetLink(Pages.members));
                PageLinks.AddLink(Server.HtmlEncode(user["user_nick"].ToString()), Utils.GetSafeRawUrl());

                // populate user information controls...
                UserName.Text    = Server.HtmlEncode(user["user_nick"].ToString());
                Name.Text        = Server.HtmlEncode(user["user_nick"].ToString());
                Joined.Text      = String.Format("{0}", FormatDateLong((DateTime)user["user_registDate"]));
                LastVisit.Text   = FormatDateTime((DateTime)user["user_lastLogin"]);
                Rank.Text        = user["RankName"].ToString();
                Location.Text    = Server.HtmlEncode(Utils.BadWordReplace(user["user_Location"].ToString()));
                Gender.InnerText = GetText("GENDER" + user["user_Gender"].ToString());

                double dAllPosts = 0.0;
                if ((int)user["NumPostsForum"] > 0)
                {
                    dAllPosts = 100.0 * (int)user["user_NumPosts"] / (int)user["NumPostsForum"];
                }

                Stats.InnerHtml = String.Format("{0:N0}<br/>[{1} / {2}]",
                                                user["user_NumPosts"],
                                                String.Format(GetText("NUMALL"), dAllPosts),
                                                String.Format(GetText("NUMDAY"), (double)(int)user["user_NumPosts"] / (int)user["NumDays"])
                                                );

                // private messages
                Pm.Visible     = User.IsAuthenticated && BoardSettings.AllowPrivateMessages;
                Pm.Text        = GetThemeContents("BUTTONS", "PM");
                Pm.NavigateUrl = Forum.GetLink(Pages.pmessage, "u={0}", user["User_ID"]);
                // email link
                Email.Visible     = User.IsAuthenticated && BoardSettings.AllowEmailSending;
                Email.Text        = GetThemeContents("BUTTONS", "EMAIL");
                Email.NavigateUrl = Forum.GetLink(Pages.im_email, "u={0}", user["User_ID"]);
                if (IsAdmin)
                {
                    Email.ToolTip = user["user_mail"].ToString();
                }
                Home.Visible     = user["user_website"] != DBNull.Value;
                Home.NavigateUrl = user["user_website"].ToString();
                Home.Text        = GetThemeContents("BUTTONS", "WWW");
                Msn.Visible      = User.IsAuthenticated && user["user_MSN"] != DBNull.Value;
                Msn.Text         = GetThemeContents("BUTTONS", "MSN");
                Msn.NavigateUrl  = Forum.GetLink(Pages.im_email, "u={0}", user["User_ID"]);
                Yim.Visible      = User.IsAuthenticated && user["user_yahoo"] != DBNull.Value;
                Yim.NavigateUrl  = Forum.GetLink(Pages.im_yim, "u={0}", user["User_ID"]);
                Yim.Text         = GetThemeContents("BUTTONS", "YAHOO");
                Aim.Visible      = User.IsAuthenticated && user["user_AIM"] != DBNull.Value;
                Aim.Text         = GetThemeContents("BUTTONS", "AIM");
                Aim.NavigateUrl  = Forum.GetLink(Pages.im_aim, "u={0}", user["User_ID"]);
                Icq.Visible      = User.IsAuthenticated && user["user_ICQ"] != DBNull.Value;
                Icq.Text         = GetThemeContents("BUTTONS", "ICQ");
                Icq.NavigateUrl  = Forum.GetLink(Pages.im_icq, "u={0}", user["User_ID"]);

                /*if(BoardSettings.AvatarUpload && user["HasAvatarImage"]!=null && long.Parse(user["HasAvatarImage"].ToString())>0)
                 * {
                 *      Avatar.ImageUrl = Data.ForumRoot + "image.aspx?u=" + (Request.QueryString["u"]);
                 * }
                 * else if(user["Avatar"].ToString().Length>0) // Took out BoardSettings.AvatarRemote
                 * {
                 *      Avatar.ImageUrl = String.Format("{3}image.aspx?url={0}&width={1}&height={2}",
                 *              Server.UrlEncode(user["Avatar"].ToString()),
                 *              BoardSettings.AvatarWidth,
                 *              BoardSettings.AvatarHeight,
                 *              Data.ForumRoot);
                 * }
                 * else
                 * {
                 *      Avatar.Visible = false;
                 * }*/

                Groups.DataSource = DB.usergroup_list(Request.QueryString["u"]);

                //EmailRow.Visible = IsAdmin;
                ModeratorInfo.Visible = IsAdmin || IsForumModerator;

                /*SuspendedRow.Visible = !user.IsNull("Suspended");
                 * if(!user.IsNull("Suspended"))
                 *      ViewState["SuspendedTo"] = FormatDateTime(user["Suspended"]);
                 */
                RemoveSuspension.Text = GetText("REMOVESUSPENSION");
                Suspend.Text          = GetText("SUSPEND");

                if (IsAdmin || IsForumModerator)
                {
                    using (DataTable dt2 = DB.user_accessmasks(PageBoardID, Request.QueryString["u"]))
                    {
                        System.Text.StringBuilder html = new System.Text.StringBuilder();
                        int nLastForumID = 0;
                        foreach (DataRow row in dt2.Rows)
                        {
                            if (nLastForumID != (int)row["ForumID"])
                            {
                                if (nLastForumID != 0)
                                {
                                    html.AppendFormat("</td></tr>");
                                }
                                html.AppendFormat("<tr><td width='50%' class='postheader'>{0}</td><td width='50%' class='post'>", row["ForumName"]);
                                nLastForumID = (int)row["ForumID"];
                            }
                            else
                            {
                                html.AppendFormat(", ");
                            }
                            html.AppendFormat("{0}", row["AccessMaskName"]);
                        }
                        if (nLastForumID != 0)
                        {
                            html.AppendFormat("</td></tr>");
                        }
                        AccessMaskRow.Text = html.ToString();
                    }
                }
            }

            LastPosts.DataSource = DB.post_last10user(PageBoardID, Request.QueryString["u"], PageUserID);

            DataBind();
        }