From 4be2e0ee5742517ed29b7ecd89a4cb73a7ec6bc4 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Tue, 1 May 2012 09:29:45 -0400 Subject: [PATCH] Switch routing from using PATH_INFO, to use REQUEST_URI --- README.md | 2 +- app/errors/error_404.php | 19 +++++++ app/errors/error_general.php | 2 +- docs/classes/DB.html | 2 +- docs/classes/DB_PDO.html | 2 +- docs/classes/DB_Reg.html | 2 +- docs/classes/DB_SQL.html | 2 +- docs/classes/DB_Util.html | 2 +- docs/classes/Firebird.html | 2 +- docs/classes/Firebird_Result.html | 2 +- docs/classes/Firebird_SQL.html | 2 +- docs/classes/Firebird_Util.html | 2 +- docs/classes/MM.html | 2 +- docs/classes/MM_Controller.html | 2 +- docs/classes/MM_Model.html | 2 +- docs/classes/MM_Output.html | 2 +- docs/classes/MM_Page.html | 2 +- docs/classes/MySQL.html | 2 +- docs/classes/MySQL_SQL.html | 2 +- docs/classes/MySQL_Util.html | 2 +- docs/classes/ODBC.html | 2 +- docs/classes/ODBC_SQL.html | 2 +- docs/classes/ODBC_Util.html | 2 +- docs/classes/PgSQL.html | 2 +- docs/classes/PgSQL_SQL.html | 2 +- docs/classes/PgSQL_Util.html | 2 +- docs/classes/Query_Builder.html | 2 +- docs/classes/SQLite.html | 2 +- docs/classes/SQLite_SQL.html | 2 +- docs/classes/SQLite_Util.html | 2 +- docs/classes/Settings.html | 2 +- docs/classes/Welcome.html | 2 +- docs/classes/Welcome_Model.html | 2 +- docs/classes/miniMVC.html | 2 +- docs/deprecated.html | 2 +- docs/errors.html | 2 +- docs/graph_class.html | 2 +- docs/index.html | 2 +- docs/markers.html | 2 +- docs/namespaces/default.html | 2 +- docs/packages/.html | 2 +- docs/packages/Default.html | 2 +- docs/packages/Query.Drivers.html | 2 +- docs/packages/Query.Helper Classes.html | 2 +- docs/packages/Query.Query.html | 2 +- docs/packages/Query.html | 2 +- docs/packages/miniMVC.App.html | 2 +- docs/packages/miniMVC.System.html | 2 +- docs/packages/miniMVC.html | 2 +- docs/structure.xml | 66 ++++++++++++------------- sys/common.php | 21 +++++++- 51 files changed, 119 insertions(+), 83 deletions(-) create mode 100644 app/errors/error_404.php diff --git a/README.md b/README.md index 7410dec..a7ab5af 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ miniMVC is a minimalistic Modular MVC framework, with built-in minifier, and pur ### Requirements * PHP 5.4+ * PDO extensions for databases you wish to use -* Webserver that correctly handles PATH_INFO, such as: +* Webserver that correctly handles REQUEST_URI, such as: * Apache * IIS * Lighttpd diff --git a/app/errors/error_404.php b/app/errors/error_404.php new file mode 100644 index 0000000..ef260f3 --- /dev/null +++ b/app/errors/error_404.php @@ -0,0 +1,19 @@ + + + + 404 Not Found + + + +
+ +

+ + + + +
+ + \ No newline at end of file diff --git a/app/errors/error_general.php b/app/errors/error_general.php index 3036a85..ef260f3 100644 --- a/app/errors/error_general.php +++ b/app/errors/error_general.php @@ -1,7 +1,7 @@ - Error + 404 Not Found diff --git a/docs/classes/DB.html b/docs/classes/DB.html index a869bff..2add494 100644 --- a/docs/classes/DB.html +++ b/docs/classes/DB.html @@ -1520,7 +1520,7 @@ for complex select queries
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/DB_PDO.html b/docs/classes/DB_PDO.html index 84cf866..69d11e6 100644 --- a/docs/classes/DB_PDO.html +++ b/docs/classes/DB_PDO.html @@ -663,7 +663,7 @@ the connection/database
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/DB_Reg.html b/docs/classes/DB_Reg.html index 583ed89..5630c2e 100644 --- a/docs/classes/DB_Reg.html +++ b/docs/classes/DB_Reg.html @@ -152,7 +152,7 @@ and organizes database connections

+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/DB_SQL.html b/docs/classes/DB_SQL.html index bc2447c..8c2a09b 100644 --- a/docs/classes/DB_SQL.html +++ b/docs/classes/DB_SQL.html @@ -269,7 +269,7 @@
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/DB_Util.html b/docs/classes/DB_Util.html index 76e6957..59a9627 100644 --- a/docs/classes/DB_Util.html +++ b/docs/classes/DB_Util.html @@ -209,7 +209,7 @@
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/Firebird.html b/docs/classes/Firebird.html index bd39b4b..3eea771 100644 --- a/docs/classes/Firebird.html +++ b/docs/classes/Firebird.html @@ -813,7 +813,7 @@ the last query executed
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/Firebird_Result.html b/docs/classes/Firebird_Result.html index 4aa492a..627f3f6 100644 --- a/docs/classes/Firebird_Result.html +++ b/docs/classes/Firebird_Result.html @@ -504,7 +504,7 @@ the query
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/Firebird_SQL.html b/docs/classes/Firebird_SQL.html index 39256b9..34faa94 100644 --- a/docs/classes/Firebird_SQL.html +++ b/docs/classes/Firebird_SQL.html @@ -297,7 +297,7 @@
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/Firebird_Util.html b/docs/classes/Firebird_Util.html index b4e2c84..b9bc7f3 100644 --- a/docs/classes/Firebird_Util.html +++ b/docs/classes/Firebird_Util.html @@ -212,7 +212,7 @@
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/MM.html b/docs/classes/MM.html index 8fd193b..673e308 100644 --- a/docs/classes/MM.html +++ b/docs/classes/MM.html @@ -434,7 +434,7 @@ dynamic methods
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/MM_Controller.html b/docs/classes/MM_Controller.html index 221f4f2..c3cff15 100644 --- a/docs/classes/MM_Controller.html +++ b/docs/classes/MM_Controller.html @@ -763,7 +763,7 @@
+ generated on 2012-05-01T09:29:07-04:00.
diff --git a/docs/classes/MM_Model.html b/docs/classes/MM_Model.html index 69b6d21..31146be 100644 --- a/docs/classes/MM_Model.html +++ b/docs/classes/MM_Model.html @@ -728,7 +728,7 @@
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/MM_Output.html b/docs/classes/MM_Output.html index 69d87ef..f18b19b 100644 --- a/docs/classes/MM_Output.html +++ b/docs/classes/MM_Output.html @@ -640,7 +640,7 @@ Used for outputing HTML
+ generated on 2012-05-01T09:29:07-04:00.
diff --git a/docs/classes/MM_Page.html b/docs/classes/MM_Page.html index 85201fa..03d931e 100644 --- a/docs/classes/MM_Page.html +++ b/docs/classes/MM_Page.html @@ -972,7 +972,7 @@ supports

+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/MySQL.html b/docs/classes/MySQL.html index e6f7d49..346ef91 100644 --- a/docs/classes/MySQL.html +++ b/docs/classes/MySQL.html @@ -849,7 +849,7 @@ the connection/database
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/MySQL_SQL.html b/docs/classes/MySQL_SQL.html index c4d6cbe..277b76f 100644 --- a/docs/classes/MySQL_SQL.html +++ b/docs/classes/MySQL_SQL.html @@ -281,7 +281,7 @@
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/MySQL_Util.html b/docs/classes/MySQL_Util.html index a1bd80f..da8cc4c 100644 --- a/docs/classes/MySQL_Util.html +++ b/docs/classes/MySQL_Util.html @@ -208,7 +208,7 @@
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/ODBC.html b/docs/classes/ODBC.html index 1dfb9e4..7e68505 100644 --- a/docs/classes/ODBC.html +++ b/docs/classes/ODBC.html @@ -851,7 +851,7 @@ the connection/database
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/ODBC_SQL.html b/docs/classes/ODBC_SQL.html index 6ab5777..624fd56 100644 --- a/docs/classes/ODBC_SQL.html +++ b/docs/classes/ODBC_SQL.html @@ -281,7 +281,7 @@
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/ODBC_Util.html b/docs/classes/ODBC_Util.html index 7a04754..eace60b 100644 --- a/docs/classes/ODBC_Util.html +++ b/docs/classes/ODBC_Util.html @@ -203,7 +203,7 @@
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/PgSQL.html b/docs/classes/PgSQL.html index 63ab856..f4e6ee9 100644 --- a/docs/classes/PgSQL.html +++ b/docs/classes/PgSQL.html @@ -851,7 +851,7 @@ the connection/database
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/PgSQL_SQL.html b/docs/classes/PgSQL_SQL.html index 5f7df6c..208c75d 100644 --- a/docs/classes/PgSQL_SQL.html +++ b/docs/classes/PgSQL_SQL.html @@ -297,7 +297,7 @@
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/PgSQL_Util.html b/docs/classes/PgSQL_Util.html index b971910..6dfbb58 100644 --- a/docs/classes/PgSQL_Util.html +++ b/docs/classes/PgSQL_Util.html @@ -208,7 +208,7 @@
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/Query_Builder.html b/docs/classes/Query_Builder.html index 8b88427..d1e17a0 100644 --- a/docs/classes/Query_Builder.html +++ b/docs/classes/Query_Builder.html @@ -1154,7 +1154,7 @@ for complex select queries
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/SQLite.html b/docs/classes/SQLite.html index e5c0dcb..391c4b4 100644 --- a/docs/classes/SQLite.html +++ b/docs/classes/SQLite.html @@ -866,7 +866,7 @@ method if the database does not support 'TRUNCATE';
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/SQLite_SQL.html b/docs/classes/SQLite_SQL.html index 6732966..d10de8f 100644 --- a/docs/classes/SQLite_SQL.html +++ b/docs/classes/SQLite_SQL.html @@ -281,7 +281,7 @@
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/SQLite_Util.html b/docs/classes/SQLite_Util.html index aeb32f2..17ff11f 100644 --- a/docs/classes/SQLite_Util.html +++ b/docs/classes/SQLite_Util.html @@ -208,7 +208,7 @@
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/Settings.html b/docs/classes/Settings.html index 57f17f3..d7bf84b 100644 --- a/docs/classes/Settings.html +++ b/docs/classes/Settings.html @@ -244,7 +244,7 @@ directly - the settings should be safe!
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/classes/Welcome.html b/docs/classes/Welcome.html index f4a96af..052a817 100644 --- a/docs/classes/Welcome.html +++ b/docs/classes/Welcome.html @@ -905,7 +905,7 @@
+ generated on 2012-05-01T09:29:07-04:00.
diff --git a/docs/classes/Welcome_Model.html b/docs/classes/Welcome_Model.html index 5f9e1b8..ed5fc61 100644 --- a/docs/classes/Welcome_Model.html +++ b/docs/classes/Welcome_Model.html @@ -846,7 +846,7 @@
+ generated on 2012-05-01T09:29:07-04:00.
diff --git a/docs/classes/miniMVC.html b/docs/classes/miniMVC.html index 0e41fc7..cb52553 100644 --- a/docs/classes/miniMVC.html +++ b/docs/classes/miniMVC.html @@ -615,7 +615,7 @@
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/deprecated.html b/docs/deprecated.html index 2932e0e..a376717 100644 --- a/docs/deprecated.html +++ b/docs/deprecated.html @@ -67,7 +67,7 @@
+ generated on 2012-05-01T09:29:07-04:00.
diff --git a/docs/errors.html b/docs/errors.html index 03ca40c..1c42f82 100644 --- a/docs/errors.html +++ b/docs/errors.html @@ -106,7 +106,7 @@
+ generated on 2012-05-01T09:29:07-04:00.
diff --git a/docs/graph_class.html b/docs/graph_class.html index 5f78d6a..2349ef0 100644 --- a/docs/graph_class.html +++ b/docs/graph_class.html @@ -64,7 +64,7 @@
+ generated on 2012-05-01T09:29:07-04:00.
diff --git a/docs/index.html b/docs/index.html index 294946d..246203e 100644 --- a/docs/index.html +++ b/docs/index.html @@ -80,7 +80,7 @@
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/markers.html b/docs/markers.html index e18686a..70d14a1 100644 --- a/docs/markers.html +++ b/docs/markers.html @@ -69,7 +69,7 @@
+ generated on 2012-05-01T09:29:07-04:00.
diff --git a/docs/namespaces/default.html b/docs/namespaces/default.html index 090a785..0031517 100644 --- a/docs/namespaces/default.html +++ b/docs/namespaces/default.html @@ -719,7 +719,7 @@ instantiates the specific db driver

+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/packages/.html b/docs/packages/.html index bebc417..fc88f66 100644 --- a/docs/packages/.html +++ b/docs/packages/.html @@ -67,7 +67,7 @@
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/packages/Default.html b/docs/packages/Default.html index b468c91..bf4a4ba 100644 --- a/docs/packages/Default.html +++ b/docs/packages/Default.html @@ -185,7 +185,7 @@
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/packages/Query.Drivers.html b/docs/packages/Query.Drivers.html index ddb81e5..4b0dfb5 100644 --- a/docs/packages/Query.Drivers.html +++ b/docs/packages/Query.Drivers.html @@ -211,7 +211,7 @@ data-fetching methods

+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/packages/Query.Helper Classes.html b/docs/packages/Query.Helper Classes.html index a61c2f4..ba20165 100644 --- a/docs/packages/Query.Helper Classes.html +++ b/docs/packages/Query.Helper Classes.html @@ -97,7 +97,7 @@
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/packages/Query.Query.html b/docs/packages/Query.Query.html index 6b3771e..ef905af 100644 --- a/docs/packages/Query.Query.html +++ b/docs/packages/Query.Query.html @@ -115,7 +115,7 @@ instantiates the specific db driver

+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/packages/Query.html b/docs/packages/Query.html index 47d643c..e54afac 100644 --- a/docs/packages/Query.html +++ b/docs/packages/Query.html @@ -316,7 +316,7 @@ instantiates the specific db driver

+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/packages/miniMVC.App.html b/docs/packages/miniMVC.App.html index 6c8e7c6..c283c92 100644 --- a/docs/packages/miniMVC.App.html +++ b/docs/packages/miniMVC.App.html @@ -139,7 +139,7 @@
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/packages/miniMVC.System.html b/docs/packages/miniMVC.System.html index 7a81861..896ea24 100644 --- a/docs/packages/miniMVC.System.html +++ b/docs/packages/miniMVC.System.html @@ -137,7 +137,7 @@
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/packages/miniMVC.html b/docs/packages/miniMVC.html index 529ffeb..b9e3554 100644 --- a/docs/packages/miniMVC.html +++ b/docs/packages/miniMVC.html @@ -492,7 +492,7 @@ display them cleanly
+ generated on 2012-05-01T09:29:06-04:00.
diff --git a/docs/structure.xml b/docs/structure.xml index 0b3af3d..7f43b76 100644 --- a/docs/structure.xml +++ b/docs/structure.xml @@ -5176,7 +5176,7 @@ the last query executed]]> - + Convention-based micro-framework for PHP

]]>
@@ -5186,10 +5186,10 @@ the last query executed]]>
- + Query/autoload.php - + miniMVC.php @@ -5318,117 +5318,117 @@ display them cleanly]]> - + show_error function - + - + string - + int - + $message - + $status_code - + controller_methods function - + - + string - + array - + $controller - + route function - + - + site_url function - + - + string - + string - + $segment - + to_string function - + - + \object/array - + string - + string - + $data - + $method - + do_include function - + - + string - + void - + $path diff --git a/sys/common.php b/sys/common.php index ba5fd57..ae074db 100644 --- a/sys/common.php +++ b/sys/common.php @@ -147,7 +147,17 @@ function is_like_array(&$var) function show_404() { @header('HTTP/1.1 404 Not Found', TRUE, 404); - die('

404 Not Found

'); + + // Contain the content for buffering + ob_start(); + + $message = '404 Not Found'; + + include(MM_APP_PATH.'/errors/error_404.php'); + + $buffer = ob_get_contents(); + ob_end_clean(); + die($buffer); } // -------------------------------------------------------------------------- @@ -221,7 +231,14 @@ function controller_methods($controller) */ function route() { - $pi = (isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : null; + // Get the equivalent to path info + $pi = (isset($_SERVER['PATH_INFO'])) ? str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['REQUEST_URI']) : NULL; + + // Handle default case, without index.php + if(empty($_SERVER['PATH_INFO'])) + { + $pi = '/'; + } // Load the routes config file $routes = require_once(MM_APP_PATH.'config/routes.php');