Esempio n. 1
0
            /// <summary>
            /// Returns the class-path for the 404 pages in their invoke order ascending.
            /// </summary>
            /// <param name="conn"></param>
            /// <returns></returns>
            public static RequestHandlers getRequest404s(Connector conn)
            {
                RequestHandlers handlers = new RequestHandlers();

                foreach (ResultRow handler in conn.Query_Read("SELECT pluginid, classpath FROM plugins WHERE state='" + (int)UberCMS.Plugins.Base.State.Enabled + "' AND handles_404='1' ORDER BY invoke_order ASC"))
                {
                    handlers.add(new RequestHandler(handler["pluginid"], handler["classpath"]));
                }
                return(handlers);
            }
Esempio n. 2
0
            /// <summary>
            /// Returns the classpath of the plugin responsible for the passed request.
            ///
            /// If a 404 occurs, this method will return a method able to handle the error;
            /// if no plugin is able to handle a 404, the returned collection will be empty.
            /// </summary>
            /// <param name="request"></param>
            /// <returns></returns>
            public static RequestHandlers getRequestPlugin(Connector conn, HttpRequest request)
            {
                // If no page is provided, we'll check for a default page in the setting, else we'll just use home
                string          page     = request.QueryString["page"] ?? (Core.settings.contains("core", "default_page") ? Core.settings["core"]["default_page"] : "home");
                RequestHandlers handlers = new RequestHandlers();

                foreach (ResultRow handler in conn.Query_Read("SELECT p.pluginid, p.classpath FROM urlrewriting AS u LEFT OUTER JOIN plugins AS p ON p.pluginid=u.pluginid WHERE u.parent IS NULL AND u.title LIKE '" + Utils.Escape(page.Replace("%", "")) + "' AND p.state='" + (int)UberCMS.Plugins.Base.State.Enabled + "' ORDER BY p.invoke_order ASC LIMIT 1"))
                {
                    handlers.add(new RequestHandler(handler["pluginid"], handler["classpath"]));
                }
                return(handlers);
            }
Esempio n. 3
0
 /// <summary>
 /// Returns the classpath of the plugin responsible for the passed request.
 /// 
 /// If a 404 occurs, this method will return a method able to handle the error;
 /// if no plugin is able to handle a 404, the returned collection will be empty.
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public static RequestHandlers getRequestPlugin(Connector conn, HttpRequest request)
 {
     // If no page is provided, we'll check for a default page in the setting, else we'll just use home
     string page = request.QueryString["page"] ?? (Core.settings.contains("core", "default_page") ? Core.settings["core"]["default_page"] : "home");
     RequestHandlers handlers = new RequestHandlers();
     foreach (ResultRow handler in conn.Query_Read("SELECT p.pluginid, p.classpath FROM urlrewriting AS u LEFT OUTER JOIN plugins AS p ON p.pluginid=u.pluginid WHERE u.parent IS NULL AND u.title LIKE '" + Utils.Escape(page.Replace("%", "")) + "' AND p.state='" + (int)UberCMS.Plugins.Base.State.Enabled + "' ORDER BY p.invoke_order ASC LIMIT 1"))
         handlers.add(new RequestHandler(handler["pluginid"], handler["classpath"]));
     return handlers;
 }
Esempio n. 4
0
 /// <summary>
 /// Returns the class-path for the 404 pages in their invoke order ascending.
 /// </summary>
 /// <param name="conn"></param>
 /// <returns></returns>
 public static RequestHandlers getRequest404s(Connector conn)
 {
     RequestHandlers handlers = new RequestHandlers();
     foreach (ResultRow handler in conn.Query_Read("SELECT pluginid, classpath FROM plugins WHERE state='" + (int)UberCMS.Plugins.Base.State.Enabled + "' AND handles_404='1' ORDER BY invoke_order ASC"))
         handlers.add(new RequestHandler(handler["pluginid"], handler["classpath"]));
     return handlers;
 }