diff --git a/app/config/config.php b/app/config/config.php index e01f400..6c3eca0 100644 --- a/app/config/config.php +++ b/app/config/config.php @@ -20,6 +20,16 @@ define('SHOW_DEBUG_BACKTRACE', TRUE); */ define('BASE_URL', $default_baseurl); +/* +|-------------------------------------------------------------------------- +| Url index file +|-------------------------------------------------------------------------- +| +| This determines whether "index.php" is in generated urls +| +*/ +define('URL_INDEX_FILE', 'index.php/'); + /* |-------------------------------------------------------------------------- | Content Domain diff --git a/app/config/routes.php b/app/config/routes.php index 7c6ddb6..75675ed 100644 --- a/app/config/routes.php +++ b/app/config/routes.php @@ -1,7 +1,20 @@ 'blog/blog/index' + * + * To route a special 404 page, set '404_route' to the "module/controller/method" you wish to use + * + */ + +return array( // Default Paths - 'default_controller' => 'test', - 'default_module' => 'default', + 'default_controller' => 'welcome', + 'default_module' => 'welcome', + '404_route' => '', ); \ No newline at end of file diff --git a/app/errors/error.php b/app/errors/error_php.php similarity index 100% rename from app/errors/error.php rename to app/errors/error_php.php diff --git a/index.php b/index.php index 0adeb1c..91f3fd9 100644 --- a/index.php +++ b/index.php @@ -8,7 +8,10 @@ define('SYS_PATH', __DIR__.'/sys/'); define('MOD_PATH', __DIR__.'/modules/'); define('APP_PATH', __DIR__.'/app/'); -$default_baseurl = "//".$_SERVER['HTTP_HOST']. str_replace("index.php", "", $_SERVER['REQUEST_URI']); +$ri = $_SERVER['REQUEST_URI']; +$ind_pos = stripos($ri, "index.php/"); +$default_path = ($ind_pos !== FALSE) ? substr($ri, 0, $ind_pos) : $ri; +$default_baseurl = "//".$_SERVER['HTTP_HOST']. $default_path; // Require the basic configuratio file require(APP_PATH.'config/config.php'); diff --git a/modules/welcome/controllers/welcome.php b/modules/welcome/controllers/welcome.php index efd997b..93362af 100644 --- a/modules/welcome/controllers/welcome.php +++ b/modules/welcome/controllers/welcome.php @@ -10,11 +10,17 @@ class Welcome extends MM_Controller { function index() { - $this->page->build_header(); + $this->page->output_string($this->page->set_message('info', "This is just a test message", TRUE)); + } + + function php() + { + ob_start(); + phpinfo(); + $output = ob_get_contents(); + ob_end_clean(); - $this->page->set_message('info', "This is just a test message"); - //$this->output->append_output($this->__toString()); - $this->page->build_footer(); + $this->output->set_output($output); } } \ No newline at end of file diff --git a/sys/common.php b/sys/common.php index 18f7b99..f3231a1 100644 --- a/sys/common.php +++ b/sys/common.php @@ -27,24 +27,6 @@ function load_file($file, $curr_path="") { $path = MOD_PATH."{$curr_path}/{$file}.php"; } - - if( ! is_file($path)) - { - /*if($curr_path !== "") - { - $matches = array(); - if(preg_match("`modules/([a-z 0-9~%.:_\-])/?`i", $curr_path, $matches)) - { - $module = $matches[1]; - - $path = MOD_PATH."{$module}/{$file}.php"; - } - } - else - {*/ - $path = MOD_PATH."welcome/{$file}.php"; - //} - } if(is_file($path)) { @@ -52,33 +34,6 @@ function load_file($file, $curr_path="") } } -function load_class($name, &$self=array()) -{ - - if(is_array($self)) - { - $self =& miniMVC::get_instance(); - } - - $path = SYS_PATH."{$name}.php"; - $class = "{$name}"; - - if(class_exists($class, FALSE)) - { - if( ! isset($self->$name)) - { - $self->$name = new $class; - return; - } - } - - load_file($name, 'sys'); - - if(class_exists($class, FALSE)) - { - $self->$name = new $class; - } -} // -------------------------------------------------------------------------- @@ -107,7 +62,7 @@ function on_error($severity, $message, $filepath, $line, $context) // Contain the content for buffering ob_start(); - include(APP_PATH.'/errors/error.php'); + include(APP_PATH.'/errors/error_php.php'); $buffer = ob_get_contents(); ob_end_clean(); @@ -158,6 +113,17 @@ function on_exception($exception) echo $msg; } +function show_404() +{ + @header('HTTP/1.1 404 Not Found', TRUE, 404); + die('