protected void Page_Load(object sender, EventArgs e) { List <PageInfo> pages = Pages.GetPages(Tools.DetectCurrentNamespaceInfo()); Random r = new Random(); UrlTools.Redirect(pages[r.Next(0, pages.Count)].FullName + Settings.PageExtension); }
protected void Page_Load(object sender, EventArgs e) { currentWiki = Tools.DetectCurrentWiki(); if (!Page.IsPostBack) { NamespaceInfo currentNamespace = Tools.DetectCurrentNamespaceInfo(); string currentNamespaceName = currentNamespace != null ? currentNamespace.Name + "." : ""; StringBuilder sb = new StringBuilder(200); sb.Append("<script type=\"text/javascript\">\r\n<!--\r\n"); sb.AppendFormat("\tvar MarkupControl = \"{0}\";\r\n", txtMarkup.ClientID); sb.AppendFormat("\tvar VisualControl = \"{0}\";\r\n", lblWYSIWYG.ClientID); sb.AppendFormat("\tvar CurrentPage = \"{0}\";\r\n", (currentPage != null ? Tools.UrlEncode(currentPage.FullName) : "")); sb.AppendFormat("\tvar CurrentNamespace = \"{0}\";\r\n", Tools.UrlEncode(currentNamespaceName)); sb.Append("// -->\r\n</script>"); lblStrings.Text = sb.ToString(); if (ViewState["ToolbarVisible"] == null) { ViewState["ToolbarVisible"] = true; } InitToolbar(); } if (mlvEditor.ActiveViewIndex == 1) { inWYSIWYG = true; } else { inWYSIWYG = false; } //SelectTab(0); if (ViewState["Tab"] != null) { SelectTab((int)ViewState["Tab"]); } LoadSnippets(); PrintCustomSpecialTags(); }
/// <summary> /// Verifies read permissions for the current user, redirecting to the appropriate page if no valid permissions are found. /// </summary> public static void VerifyReadPermissionsForCurrentNamespace() { var currentUsername = SessionFacade.GetCurrentUsername(); var currentGroups = SessionFacade.GetCurrentGroupNames(); var canViewNamespace = AuthChecker.CheckActionForNamespace( Tools.DetectCurrentNamespaceInfo(), Actions.ForNamespaces.ReadPages, currentUsername, currentGroups); if (!canViewNamespace) { if (SessionFacade.CurrentUsername == null) { UrlTools.Redirect("Login.aspx?Redirect=" + Tools.UrlEncode(Tools.GetCurrentUrlFixed())); } else { UrlTools.Redirect("AccessDenied.aspx"); } } }
/// <summary> /// Verifies read permissions for the current user, redirecting to the appropriate page if no valid permissions are found. /// </summary> public static void VerifyReadPermissionsForCurrentNamespace() { string currentUsername = SessionFacade.GetCurrentUsername(); string[] currentGroups = SessionFacade.GetCurrentGroupNames(); bool canViewNamespace = AuthChecker.CheckActionForNamespace( Tools.DetectCurrentNamespaceInfo(), Actions.ForNamespaces.ReadPages, currentUsername, currentGroups); if (!canViewNamespace) { if (SessionFacade.CurrentUsername == null) { UrlTools.Redirect("Login.aspx?Redirect=" + Tools.UrlEncode(HttpContext.Current.Request.Url.ToString())); } else { UrlTools.Redirect("AccessDenied.aspx"); } } }
/// <summary> /// Verifies read permissions for the current user, redirecting to the appropriate page if no valid permissions are found. /// </summary> /// <param name="wiki">The wiki.</param> public static void VerifyReadPermissionsForCurrentNamespace(string wiki) { string currentUsername = SessionFacade.GetCurrentUsername(); string[] currentGroups = SessionFacade.GetCurrentGroupNames(wiki); AuthChecker authChecker = new AuthChecker(Collectors.CollectorsBox.GetSettingsProvider(wiki)); bool canViewNamespace = authChecker.CheckActionForNamespace( Tools.DetectCurrentNamespaceInfo(), Actions.ForNamespaces.ReadPages, currentUsername, currentGroups); if (!canViewNamespace) { if (SessionFacade.CurrentUsername == null) { UrlTools.Redirect("Login.aspx?Redirect=" + Tools.UrlEncode(Tools.GetCurrentUrlFixed())); } else { UrlTools.Redirect("AccessDenied.aspx"); } } }
/// <summary> /// Detects the correct <see cref="T:NamespaceInfo" /> object associated to the current namespace using the <b>NS</b> parameter in the query string. /// </summary> /// <returns>The correct <see cref="T:NamespaceInfo" /> object, or <c>null</c>.</returns> protected NamespaceInfo DetectNamespaceInfo() { return(Tools.DetectCurrentNamespaceInfo()); }