diff --git a/app/classes/controller.php b/app/classes/controller.php index f458ba1..deb07b9 100644 --- a/app/classes/controller.php +++ b/app/classes/controller.php @@ -28,7 +28,7 @@ abstract class Controller extends \miniMVC\Controller { public function __construct() { parent::__construct(); - $this->load_model('meta\model'); + $this->load_model('meta\Model'); $this->page->build_header(); } diff --git a/app/modules/meta/controllers/welcome.php b/app/modules/meta/controllers/welcome.php index cc5050c..069f9ef 100644 --- a/app/modules/meta/controllers/welcome.php +++ b/app/modules/meta/controllers/welcome.php @@ -18,7 +18,7 @@ * * @package meta */ -class welcome extends miniMVC\Controller { +class welcome extends \miniMVC\Controller { /** * Initialize the constructor diff --git a/app/modules/meta/models/model.php b/app/modules/meta/models/model.php index 5aa913a..8ef9b59 100644 --- a/app/modules/meta/models/model.php +++ b/app/modules/meta/models/model.php @@ -20,7 +20,7 @@ namespace meta; * * @package meta */ -class model extends \miniMVC\Model { +class Model extends \miniMVC\Model { /** * Reference to database connection @@ -43,7 +43,7 @@ class model extends \miniMVC\Model { { parent::__construct(); - $this->session =& \miniMVC\Session::get_instance(); + //$this->session =& \miniMVC\Session::get_instance(); $this->db =& \miniMVC\db::get_instance(); } diff --git a/app/views/errors/error_php_exception.php b/app/views/errors/error_php_exception.php old mode 100755 new mode 100644 index 689c056..1415467 --- a/app/views/errors/error_php_exception.php +++ b/app/views/errors/error_php_exception.php @@ -1,5 +1,5 @@
Message: = $message; ?>
diff --git a/sys/common.php b/sys/common.php index 085990a..4a3a060 100644 --- a/sys/common.php +++ b/sys/common.php @@ -31,7 +31,7 @@ namespace miniMVC; * * @param string */ -function _autoload($name) +function autoload($name) { if ($name == '') return; @@ -60,7 +60,7 @@ function _autoload($name) } // Start the autoloader -spl_autoload_register('miniMVC\_autoload'); +spl_autoload_register('miniMVC\autoload'); // -------------------------------------------------------------------------- // ! Error handling / messages @@ -298,7 +298,10 @@ if ( ! function_exists('do_include')) function init() { // Catch fatal errors, don't show them - register_shutdown_function('miniMVC\shutdown'); + if (function_exists('error_get_last')) + { + register_shutdown_function('miniMVC\shutdown'); + } //Set error handlers set_error_handler('miniMVC\on_error'); @@ -307,9 +310,6 @@ function init() // Load Database classes require_once(MM_SYS_PATH . 'db/autoload.php'); - // Load the page class - $GLOBALS['page'] = new \miniMVC\Page(); - // Map to the appropriate module/controller/function route(); } @@ -367,6 +367,7 @@ function route() $pi = $_SERVER['PATH_INFO']; $ru = $_SERVER['REQUEST_URI']; $sn = $_SERVER['SCRIPT_NAME']; + $qs = $_SERVER['QUERY_STRING']; // Make sure the home page works when in a sub_directory if (strlen($sn) > strlen($ru)) @@ -460,6 +461,7 @@ function route() } run($module, $controller, $func); + return; } @@ -480,21 +482,29 @@ function run($module, $controller, $func, $args = array()) if (is_file($path)) { require_once($path); - + // Get the list of valid methods for that controller $methods = controller_methods($controller); if (in_array($func, $methods)) { + // Define the name of the current module for file loading if ( ! defined('MM_MOD')) { define('MM_MOD', $module); } + + if (class_exists($controller)) + { + $class = new $controller(); + } - $class = new $controller(); - return call_user_func_array(array(&$class, $func), $args); + //show_error(to_string(get_declared_classes())); + return call_user_func_array(array($class, $func), $args); } + + show_404(); } // Function doesn't exist...404 diff --git a/sys/core/Controller.php b/sys/core/Controller.php index f9ca849..bcae718 100644 --- a/sys/core/Controller.php +++ b/sys/core/Controller.php @@ -38,7 +38,10 @@ class Controller { public function __construct() { // Create the page object - $this->page = $GLOBALS['page']; + if (is_null($this->page)) + { + $this->page = new Page(); + } } // -------------------------------------------------------------------------- diff --git a/sys/core/Page.php b/sys/core/Page.php index 0ceba90..7dbaa77 100644 --- a/sys/core/Page.php +++ b/sys/core/Page.php @@ -151,8 +151,7 @@ class Page { if ( ! empty($this->buffer)) { - // @todo Figure out how to adjust content compression for 5.4.4 - ob_start(); + ob_start('ob_gzhandler'); echo $this->buffer; @@ -695,15 +694,15 @@ class Page { public function flush_headers() { // Set headers - foreach ($this->headers as $key => &$val) + foreach ($this->headers as $key => $val) { if ( ! isset($val)) { - @header($key); + header($key); } else { - @header("{$key}: {$val}"); + header("{$key}: {$val}"); } } diff --git a/sys/db b/sys/db index 1e71b22..90c6760 160000 --- a/sys/db +++ b/sys/db @@ -1 +1 @@ -Subproject commit 1e71b225c533bada107f439106c9216982b62daa +Subproject commit 90c676019652341836edd7bf71dfc70979341810 diff --git a/test.php b/test.php new file mode 100644 index 0000000..e974c40 --- /dev/null +++ b/test.php @@ -0,0 +1 @@ +