RedirectHome() публичный статический Метод

Redirects to the default page of the current namespace.
public static RedirectHome ( ) : void
Результат void
Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            page = Pages.FindPage(Request["Page"]);
            if (page == null)
            {
                UrlTools.RedirectHome();
            }

            // Check permissions
            bool canView = false;

            if (Request["Discuss"] == null)
            {
                canView = AuthChecker.CheckActionForPage(page, Actions.ForPages.ReadPage,
                                                         SessionFacade.GetCurrentUsername(), SessionFacade.GetCurrentGroupNames());
            }
            else
            {
                canView = AuthChecker.CheckActionForPage(page, Actions.ForPages.ReadDiscussion,
                                                         SessionFacade.GetCurrentUsername(), SessionFacade.GetCurrentGroupNames());
            }
            if (!canView)
            {
                UrlTools.Redirect("AccessDenied.aspx");
            }

            content = Content.GetPageContent(page, true);

            Page.Title = FormattingPipeline.PrepareTitle(content.Title, false, FormattingContext.PageContent, page) + " - " + Settings.WikiTitle;

            PrintContent();
        }
Пример #2
0
        protected void btnConfirm_Click(object sender, EventArgs e)
        {
            Log.LogEntry("Account deletion requested", EntryType.General, currentUser.Username, currentWiki);
            UserInfo user = Users.FindUser(currentWiki, currentUser.Username);

            Users.RemoveUser(currentWiki, user);
            UrlTools.RedirectHome(currentWiki);
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = Properties.Messages.OperationTitle + " - " + Settings.WikiTitle;

            if (Request["Operation"] == null)
            {
                UrlTools.RedirectHome();
            }

            op = Request["Operation"].ToLowerInvariant();

            switch (op)
            {
            case "deletemessage":
                Page.Title = "Delete Message - " + Settings.WikiTitle;
                mlwOperation.ActiveViewIndex = 0;
                PrepareDeleteMessage();
                break;
            }
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            currentWiki = DetectWiki();

            page = Pages.FindPage(currentWiki, Request["Page"]);
            if (page == null)
            {
                UrlTools.RedirectHome(currentWiki);
            }

            // Check permissions
            bool        canView     = false;
            AuthChecker authChecker = new AuthChecker(Collectors.CollectorsBox.GetSettingsProvider(currentWiki));

            if (Request["Discuss"] == null)
            {
                canView = authChecker.CheckActionForPage(page.FullName, Actions.ForPages.ReadPage,
                                                         SessionFacade.GetCurrentUsername(), SessionFacade.GetCurrentGroupNames(currentWiki));
            }
            else
            {
                canView = authChecker.CheckActionForPage(page.FullName, Actions.ForPages.ReadDiscussion,
                                                         SessionFacade.GetCurrentUsername(), SessionFacade.GetCurrentGroupNames(currentWiki));
            }
            if (!canView)
            {
                UrlTools.Redirect("AccessDenied.aspx");
            }

            Page.Title = FormattingPipeline.PrepareTitle(currentWiki, page.Title, false, FormattingContext.PageContent, page.FullName) + " - " + Settings.GetWikiTitle(currentWiki);

            Literal canonical = new Literal();

            canonical.Text = Tools.GetCanonicalUrlTag(Request.Url.ToString(), page.FullName, Pages.FindNamespace(currentWiki, NameTools.GetNamespace(page.FullName)));
            Page.Header.Controls.Add(canonical);

            PrintContent();
        }
Пример #5
0
 private void Redirect()
 {
     UrlTools.RedirectHome();
 }
Пример #6
0
        /// <summary>
        /// Prepares the message deletion GUI.
        /// </summary>
        private void PrepareDeleteMessage()
        {
            string ms = Request["Message"];
            string pg = Request["Page"];

            if (ms == null || ms.Length == 0 || pg == null || pg.Length == 0)
            {
                UrlTools.RedirectHome();
            }

            PageInfo page = Pages.FindPage(pg);

            if (page == null)
            {
                UrlTools.RedirectHome();
            }

            if (page.Provider.ReadOnly)
            {
                UrlTools.Redirect(UrlTools.BuildUrl(page.FullName, Settings.PageExtension));
            }

            bool canManageDiscussion = AuthChecker.CheckActionForPage(page, Actions.ForPages.ManageDiscussion,
                                                                      SessionFacade.GetCurrentUsername(), SessionFacade.GetCurrentGroupNames());

            if (!canManageDiscussion)
            {
                UrlTools.Redirect("AccessDenied.aspx");
            }

            int id = -1;

            try {
                id = int.Parse(ms);
            }
            catch {
                UrlTools.RedirectHome();
            }

            Message message = Pages.FindMessage(Pages.GetPageMessages(page), id);

            if (message == null)
            {
                UrlTools.RedirectHome();
            }

            StringBuilder sb = new StringBuilder(500);

            sb.Append("<b>");
            sb.Append(FormattingPipeline.PrepareTitle(message.Subject, false, FormattingContext.MessageBody, page));
            sb.Append("</b><br /><small>");
            sb.Append(Properties.Messages.Posted);
            sb.Append(" ");
            sb.Append(Preferences.AlignWithTimezone(message.DateTime).ToString(Settings.DateTimeFormat));
            sb.Append(" ");
            sb.Append(Properties.Messages.By);
            sb.Append(" ");
            sb.Append(Users.UserLink(message.Username));
            sb.Append("</small><br /><br />");
            sb.Append(FormattingPipeline.FormatWithPhase3(FormattingPipeline.FormatWithPhase1And2(message.Body, false, FormattingContext.MessageBody, page),
                                                          FormattingContext.MessageBody, page));

            lblDeleteMessageContent.Text = sb.ToString();
        }
Пример #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = Properties.Messages.PostTitle + " - " + Settings.WikiTitle;

            if (Request["Page"] == null)
            {
                UrlTools.RedirectHome();
            }
            page = Pages.FindPage(Request["Page"]);
            if (page == null)
            {
                UrlTools.RedirectHome();
            }
            editor.CurrentPage = page;

            if (page.Provider.ReadOnly)
            {
                UrlTools.Redirect(UrlTools.BuildUrl(page.FullName, Settings.PageExtension));
            }

            content = Content.GetPageContent(page, true);
            if (!Page.IsPostBack)
            {
                lblTitle.Text += " - " + FormattingPipeline.PrepareTitle(content.Title, false, FormattingContext.MessageBody, page);
            }

            // Verify permissions and setup captcha
            bool canPostMessage = AuthChecker.CheckActionForPage(page, Actions.ForPages.PostDiscussion,
                                                                 SessionFacade.GetCurrentUsername(), SessionFacade.GetCurrentGroupNames());

            if (!canPostMessage)
            {
                UrlTools.Redirect(UrlTools.BuildUrl(Tools.UrlEncode(page.FullName), Settings.PageExtension));
            }
            captcha.Visible = SessionFacade.LoginKey == null && !Settings.DisableCaptchaControl;

            if (Page.IsPostBack)
            {
                return;
            }

            editor.SetContent("", Settings.UseVisualEditorAsDefault);

            string username = Request.UserHostAddress;

            if (SessionFacade.LoginKey != null)
            {
                username = SessionFacade.CurrentUsername;
            }

            bool edit = Request["Edit"] != null;

            if (!edit)
            {
                if (Request["Parent"] != null)
                {
                    try
                    {
                        int.Parse(Request["Parent"]);
                    }
                    catch
                    {
                        UrlTools.RedirectHome();
                    }
                    var     messages = Pages.GetPageMessages(page);
                    Message parent   = Pages.FindMessage(messages, int.Parse(Request["Parent"]));

                    if (parent != null)
                    {
                        txtSubject.Text = (!parent.Subject.ToLowerInvariant().StartsWith("re:") ? "Re: " : "") + parent.Subject;
                    }
                }
            }
            else
            {
                try
                {
                    int.Parse(Request["Edit"]);
                }
                catch
                {
                    UrlTools.RedirectHome();
                }
                var     messages = Pages.GetPageMessages(page);
                Message msg      = Pages.FindMessage(messages, int.Parse(Request["Edit"]));

                if (msg != null)
                {
                    txtSubject.Text = msg.Subject;
                    editor.SetContent(msg.Body, Settings.UseVisualEditorAsDefault);
                }
                else
                {
                    throw new Exception("Message not found (" + page.FullName + "." + Request["Edit"] + ").");
                }
            }
        }
Пример #8
0
 private void Redirect()
 {
     UrlTools.RedirectHome(currentWiki);
 }