Example #1
0
        /// <summary>
        /// Outputs information about PHP's configuration
        /// </summary>
        /// <param name="ctx">The php context.</param>
        /// <param name="what">
        /// The output may be customized by passing one or more of the following constants bitwise values summed together in the optional <paramref name="what"/> parameter.
        /// One can also combine the respective constants or bitwise values together with the or operator.</param>
        public static bool phpinfo(Context ctx, PhpInfoWhat what = PhpInfoWhat.INFO_ALL)
        {
            using (var writer = CreateInfoWriter(ctx))
            {
                if ((what & PhpInfoWhat.INFO_GENERAL) != 0)
                {
                    writer.Table(General(ctx));
                }
                if ((what & PhpInfoWhat.INFO_CONFIGURATION) != 0)
                {
                    Configuration(ctx, writer);
                }
                if ((what & PhpInfoWhat.INFO_ENVIRONMENT) != 0)
                {
                    Env(ctx, writer);
                }
                if ((what & PhpInfoWhat.INFO_VARIABLES) != 0)
                {
                    Variables(ctx, writer);
                }
                if ((what & PhpInfoWhat.INFO_CREDITS) != 0)
                {
                    Credits(writer);
                }
            }

            //
            return(true);
        }
Example #2
0
        /// <summary>
        /// Outputs information about PHP's configuration
        /// </summary>
        /// <param name="ctx">The php context.</param>
        /// <param name="what">
        /// The output may be customized by passing one or more of the following constants bitwise values summed together in the optional <paramref name="what"/> parameter.
        /// One can also combine the respective constants or bitwise values together with the or operator.</param>
        public static bool phpinfo(Context ctx, PhpInfoWhat what = PhpInfoWhat.INFO_ALL)
        {
            // TODO: ctx.IsWebApplication == false => text output
            // TODO: 'HtmlTagWriter' -> 'PhpInfoWriter', two implementations of PhpInfoWriter: "HtmlInfoWriter", "TextInfoWriter"

            // TODO: Localize

            ctx.Echo(@"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""DTD/xhtml1-transitional.dtd"">");
            using (var html = ctx.Tag("html", new { xmlns = "http://www.w3.org/1999/xhtml" }))
            {
                using (var head = html.Tag("head"))
                {
                    using (var style = head.Tag("style", new { type = "text/css" }))
                    {
                        style.EchoRaw(Resources.InfoResources.Style);
                    }
                    head.EchoTag("title", "phpinfo()");
                    head.EchoTagSelf("meta", new { name = "ROBOTS", content = "NOINDEX,NOFOLLOW,NOARCHIVE" });
                }
                using (var body = html.Tag("body"))
                    using (var center = body.Tag("div", new { @class = "center" }))
                    {
                        PageTitle(center);

                        if ((what & PhpInfoWhat.INFO_GENERAL) != 0)
                        {
                            General(center);
                        }
                        if ((what & PhpInfoWhat.INFO_CONFIGURATION) != 0)
                        {
                            Configuration(center, ctx);
                        }
                        if ((what & PhpInfoWhat.INFO_ENVIRONMENT) != 0)
                        {
                            Env(center);
                        }
                        if ((what & PhpInfoWhat.INFO_VARIABLES) != 0)
                        {
                            Variables(center);
                        }
                        if ((what & PhpInfoWhat.INFO_CREDITS) != 0)
                        {
                            Credits(center);
                        }
                    }
            }

            //
            return(true);
        }