Ejemplo n.º 1
0
        public override string RenderData()
        {
            StringBuilder sb = new StringBuilder("<ul>");

            Urls urls = new Urls();

            HttpContext context = HttpContext.Current;

            if (context != null)
            {
                TemplatedThemePage ttp = context.Handler as TemplatedThemePage;
                if (ttp != null && ttp.PostId > 0)
                {
                    Post p = new Post(ttp.PostId);
                    if (RolePermissionManager.GetPermissions(p.CategoryId, GraffitiUsers.Current).Edit)
                    {
                        sb.AppendFormat("<li><a href=\"{0}\">{1}</a></li>\n", urls.Edit(ttp.PostId), "Edit this Post");
                    }
                }
            }

            if (RolePermissionManager.CanViewControlPanel(GraffitiUsers.Current))
            {
                sb.AppendFormat("<li><a href=\"{0}\">{1}</a></li>\n", urls.Write, "Write a new Post");
                sb.AppendFormat("<li><a href=\"{0}\">{1}</a></li>\n", urls.Admin, "Control Panel");
            }

            sb.AppendFormat("<li><a href=\"{0}\">{1}</a></li>\n", urls.Logout, "Logout");
            sb.Append("</ul>\n");

            return(sb.ToString());
        }
Ejemplo n.º 2
0
        protected override void Authenticate()
        {
            if (GraffitiUsers.Current == null)
            {
                Response.Redirect("~/login/");
            }

            if (!RolePermissionManager.CanViewControlPanel(GraffitiUsers.Current) && !GraffitiUsers.IsAdmin(GraffitiUsers.Current))
            {
                Response.Redirect("~/");
            }
        }
Ejemplo n.º 3
0
        public void ProcessRequest(HttpContext context)
        {
            if (!RolePermissionManager.CanViewControlPanel(GraffitiUsers.Current))
            {
                context.Response.End();
            }

            string report;

            report = context.Request.QueryString["report"];

            this.context = context;

            switch (report)
            {
            case "ViewsByDate":
                ViewsByDateReport();
                break;

            case "ViewsByDate_Single":
                ViewsByDateReport_Single();
                break;

            case "ViewsByPost":
                ViewsByPostReport();
                break;

            case "MostPopularPosts":
                MostPopularPostReport();
                break;

            case "ViewsByPost_Single":
                ViewsByPostReport_Single();
                break;

            case "CommentsByDate":
                CommentsByDateReport();
                break;

            case "CommentsByDate_Single":
                CommentsByDateReport_Single();
                break;

            case "CommentsByPost":
                CommentsByPostReport();
                break;

            case "CommentsByPost_Single":
                CommentsByPostReport_Single();
                break;
            }
        }