From 9da461d135b838de7821c8060218638001abfd81 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 17 May 2012 16:22:39 -0400 Subject: [PATCH] Consistency improvements --- app/config/config.php | 5 +++++ index.php | 12 +++--------- sys/core/controller.php | 1 + sys/core/db.php | 1 + sys/core/model.php | 1 + sys/core/output.php | 1 + sys/core/page.php | 1 + sys/core/traits.php | 2 +- sys/libraries/data_store.php | 3 ++- sys/libraries/session.php | 14 +++++--------- 10 files changed, 21 insertions(+), 20 deletions(-) diff --git a/app/config/config.php b/app/config/config.php index 2fe9dd5..b63da9f 100644 --- a/app/config/config.php +++ b/app/config/config.php @@ -41,6 +41,11 @@ define('SHOW_DEBUG_BACKTRACE', TRUE); | slash. | */ +// Determine the default site url +$ri = $_SERVER['REQUEST_URI']; +$ind_pos = stripos($ri, "index.php"); +$default_path = ($ind_pos !== FALSE) ? substr($ri, 0, $ind_pos) : $ri; +$default_baseurl = "//" . str_replace("//", "/", $_SERVER['HTTP_HOST']. $default_path); define('BASE_URL', $default_baseurl); /* diff --git a/index.php b/index.php index 82197ec..82e510e 100644 --- a/index.php +++ b/index.php @@ -42,17 +42,11 @@ define('MM_SYS_PATH', __DIR__.'/sys/'); define('MM_APP_PATH', __DIR__.'/app/'); define('MM_MOD_PATH', MM_APP_PATH.'modules/'); -// Determine the default site url -$ri = $_SERVER['REQUEST_URI']; -$ind_pos = stripos($ri, "index.php"); -$default_path = ($ind_pos !== FALSE) ? substr($ri, 0, $ind_pos) : $ri; -$default_baseurl = "//" . str_replace("//", "/", $_SERVER['HTTP_HOST']. $default_path); - -// Require the basic configuratio file -require(MM_APP_PATH.'config/config.php'); +// Require the basic configuration file +require(MM_APP_PATH .'config/config.php'); // Require the most important files -require(MM_SYS_PATH . "common.php"); +require(MM_SYS_PATH . 'common.php'); // And away we go! init(); diff --git a/sys/core/controller.php b/sys/core/controller.php index 4367bde..63f7f1a 100644 --- a/sys/core/controller.php +++ b/sys/core/controller.php @@ -119,4 +119,5 @@ class MM_Controller extends miniMVC { } } } + // End of controller.php \ No newline at end of file diff --git a/sys/core/db.php b/sys/core/db.php index f663679..03e34e2 100644 --- a/sys/core/db.php +++ b/sys/core/db.php @@ -121,4 +121,5 @@ class DB extends Query_Builder { echo $buffer; } } + // End of db.php \ No newline at end of file diff --git a/sys/core/model.php b/sys/core/model.php index 98639ed..a839af5 100644 --- a/sys/core/model.php +++ b/sys/core/model.php @@ -32,4 +32,5 @@ class MM_Model extends miniMVC { parent::__construct($args); } } + // End of model.php \ No newline at end of file diff --git a/sys/core/output.php b/sys/core/output.php index 79f0c4e..f4e1a46 100644 --- a/sys/core/output.php +++ b/sys/core/output.php @@ -147,4 +147,5 @@ class MM_Output extends MM { $this->headers = []; } } + // End of Output.php \ No newline at end of file diff --git a/sys/core/page.php b/sys/core/page.php index 9238824..da65d7f 100644 --- a/sys/core/page.php +++ b/sys/core/page.php @@ -537,4 +537,5 @@ class MM_Page extends MM_Output { return $string; } } + // End of page.php \ No newline at end of file diff --git a/sys/core/traits.php b/sys/core/traits.php index 4c4ae62..ed5be53 100644 --- a/sys/core/traits.php +++ b/sys/core/traits.php @@ -11,7 +11,7 @@ * @license http://philsturgeon.co.uk/code/dbad-license */ - // -------------------------------------------------------------------------- +// -------------------------------------------------------------------------- // ! JSObject Trait // -------------------------------------------------------------------------- diff --git a/sys/libraries/data_store.php b/sys/libraries/data_store.php index bbd578d..0a96971 100644 --- a/sys/libraries/data_store.php +++ b/sys/libraries/data_store.php @@ -62,7 +62,7 @@ class MM_Data_Store { { $file_string = json_encode($this->current, JSON_PRETTY_PRINT); - file_put_contents(MM_APP_PATH .'config/data_store.json', $file_string); + file_put_contents(MM_APP_PATH . 'config/data_store.json', $file_string); } // -------------------------------------------------------------------------- @@ -147,4 +147,5 @@ class MM_Data_Store { return $this->current; } } + // End of data store.php \ No newline at end of file diff --git a/sys/libraries/session.php b/sys/libraries/session.php index 40c2bad..bdf3ba7 100644 --- a/sys/libraries/session.php +++ b/sys/libraries/session.php @@ -10,12 +10,7 @@ * @link https://github.com/timw4mail/miniMVC * @license http://philsturgeon.co.uk/code/dbad-license */ - -// -------------------------------------------------------------------------- -/** - * Define a session id to namespace sessions - */ -define(SESS_ID, 'MM_SESSION'); + // -------------------------------------------------------------------------- /** @@ -49,8 +44,8 @@ class MM_Session { session_start(); // Save a reference to the session for later access - $_SESSION[SESS_ID] = (isset($_SESSION[SESS_ID]) ?: []; - $this->sess =& $_SESSION[SESS_ID]; + $_SESSION['MM_SESSION'] = (isset($_SESSION['MM_SESSION']) ?: []; + $this->sess =& $_SESSION['MM_SESSION']; } // -------------------------------------------------------------------------- @@ -92,4 +87,5 @@ class MM_Session { sess_destroy(); } } -// End of php_session.php \ No newline at end of file + +// End of session.php \ No newline at end of file