diff --git a/README.md b/README.md index 5b16f0f..e26c4b5 100644 --- a/README.md +++ b/README.md @@ -34,20 +34,21 @@ Database connections are set in /app/config/db.php * index.php - framework frontend * app - configuration and app-wide files + * classes - helper classes * config - configuration files * errors - error page templates + * modules - MVC triads + * controllers - controller classes + * models - model classes + * views - module-specific views * views - global page templates + * assets - frontend files * js - javascript files * css - css files * config - minifier configuration files -* modules - MVC triads - * controllers - controller classes - * models - model classes - * views - module-specific views - * sys - core framework classes ### Common Tasks @@ -82,4 +83,11 @@ Database connections are set in /app/config/db.php * Loading a model (From a controller) - `$this->load_model($model)` \ No newline at end of file + `$this->load_model($model)` - creates an instance of that model as a member of the current class. After loading the model, you can call its methods like so + + `$this->[model name]->method()` + +* Loading a class + `$this->load_class($class)` - creates an instance of that class as a member of the current class. After loading the class, you can call its methods like so + + `$this->[class name]->method()` \ No newline at end of file diff --git a/modules/welcome/controllers/welcome.php b/app/modules/welcome/controllers/welcome.php similarity index 100% rename from modules/welcome/controllers/welcome.php rename to app/modules/welcome/controllers/welcome.php diff --git a/modules/welcome/models/welcome_model.php b/app/modules/welcome/models/welcome_model.php similarity index 100% rename from modules/welcome/models/welcome_model.php rename to app/modules/welcome/models/welcome_model.php diff --git a/modules/welcome/views/index.html b/app/modules/welcome/views/index.html similarity index 100% rename from modules/welcome/views/index.html rename to app/modules/welcome/views/index.html diff --git a/docs/classes.svg b/docs/classes.svg index 367318e..8855c7f 100644 --- a/docs/classes.svg +++ b/docs/classes.svg @@ -369,7 +369,7 @@ \\Welcome_Model - + Welcome_Model @@ -381,7 +381,7 @@ \\Welcome - + Welcome diff --git a/docs/classes/DB.html b/docs/classes/DB.html index df3d592..94cb665 100644 --- a/docs/classes/DB.html +++ b/docs/classes/DB.html @@ -1583,7 +1583,7 @@ for complex select queries
+ generated on 2012-05-03T16:07:24-04:00.
diff --git a/docs/classes/DB_PDO.html b/docs/classes/DB_PDO.html index a3914a1..c0d6c79 100644 --- a/docs/classes/DB_PDO.html +++ b/docs/classes/DB_PDO.html @@ -679,7 +679,7 @@ the connection/database
+ generated on 2012-05-03T16:07:23-04:00.
diff --git a/docs/classes/DB_Reg.html b/docs/classes/DB_Reg.html index fbf05e0..a21dc3d 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-03T16:07:23-04:00.
diff --git a/docs/classes/DB_SQL.html b/docs/classes/DB_SQL.html index f3aeb53..2478ef6 100644 --- a/docs/classes/DB_SQL.html +++ b/docs/classes/DB_SQL.html @@ -269,7 +269,7 @@
+ generated on 2012-05-03T16:07:23-04:00.
diff --git a/docs/classes/DB_Util.html b/docs/classes/DB_Util.html index ab1406a..5a12c7a 100644 --- a/docs/classes/DB_Util.html +++ b/docs/classes/DB_Util.html @@ -209,7 +209,7 @@
+ generated on 2012-05-03T16:07:23-04:00.
diff --git a/docs/classes/Firebird.html b/docs/classes/Firebird.html index 6e27472..eadb5bd 100644 --- a/docs/classes/Firebird.html +++ b/docs/classes/Firebird.html @@ -833,7 +833,7 @@ the last query executed
+ generated on 2012-05-03T16:07:23-04:00.
diff --git a/docs/classes/Firebird_Result.html b/docs/classes/Firebird_Result.html index 081197a..74a1a91 100644 --- a/docs/classes/Firebird_Result.html +++ b/docs/classes/Firebird_Result.html @@ -504,7 +504,7 @@ the query
+ generated on 2012-05-03T16:07:23-04:00.
diff --git a/docs/classes/Firebird_SQL.html b/docs/classes/Firebird_SQL.html index 3718f1f..a1f3931 100644 --- a/docs/classes/Firebird_SQL.html +++ b/docs/classes/Firebird_SQL.html @@ -297,7 +297,7 @@
+ generated on 2012-05-03T16:07:23-04:00.
diff --git a/docs/classes/Firebird_Util.html b/docs/classes/Firebird_Util.html index 3487152..1933846 100644 --- a/docs/classes/Firebird_Util.html +++ b/docs/classes/Firebird_Util.html @@ -212,7 +212,7 @@
+ generated on 2012-05-03T16:07:24-04:00.
diff --git a/docs/classes/MM.html b/docs/classes/MM.html index 3c915ac..5ce7c43 100644 --- a/docs/classes/MM.html +++ b/docs/classes/MM.html @@ -434,7 +434,7 @@ dynamic methods
+ generated on 2012-05-03T16:07:24-04:00.
diff --git a/docs/classes/MM_Controller.html b/docs/classes/MM_Controller.html index 3a6e34a..c576b68 100644 --- a/docs/classes/MM_Controller.html +++ b/docs/classes/MM_Controller.html @@ -760,7 +760,7 @@
+ generated on 2012-05-03T16:07:24-04:00.
diff --git a/docs/classes/MM_Model.html b/docs/classes/MM_Model.html index 6ff765f..b898fe2 100644 --- a/docs/classes/MM_Model.html +++ b/docs/classes/MM_Model.html @@ -724,7 +724,7 @@
+ generated on 2012-05-03T16:07:24-04:00.
diff --git a/docs/classes/MM_Output.html b/docs/classes/MM_Output.html index da934ff..0b6bcdb 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-03T16:07:24-04:00.
diff --git a/docs/classes/MM_Page.html b/docs/classes/MM_Page.html index c99a9cc..cc726a1 100644 --- a/docs/classes/MM_Page.html +++ b/docs/classes/MM_Page.html @@ -972,7 +972,7 @@ supports

+ generated on 2012-05-03T16:07:24-04:00.
diff --git a/docs/classes/MM_Session.html b/docs/classes/MM_Session.html index 35942eb..6b9d41d 100644 --- a/docs/classes/MM_Session.html +++ b/docs/classes/MM_Session.html @@ -62,6 +62,10 @@
  • Destroy a session
    destroy()
  • Start a session
    __construct()
  • + + +
  • Reference to session superglobal
    $sess
  • @@ -125,6 +129,14 @@

    +

    + Properties

    + 
    +

    Reference to session superglobal

    +
    $sess : array
    +
    +

    +
    @@ -132,7 +144,7 @@
    + generated on 2012-05-03T16:07:24-04:00.
    diff --git a/docs/classes/MySQL.html b/docs/classes/MySQL.html index 1cdd58b..f4e3b38 100644 --- a/docs/classes/MySQL.html +++ b/docs/classes/MySQL.html @@ -869,7 +869,7 @@ the connection/database
    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/classes/MySQL_SQL.html b/docs/classes/MySQL_SQL.html index 4aac606..54b1f5f 100644 --- a/docs/classes/MySQL_SQL.html +++ b/docs/classes/MySQL_SQL.html @@ -281,7 +281,7 @@
    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/classes/MySQL_Util.html b/docs/classes/MySQL_Util.html index 4515f37..188d7ec 100644 --- a/docs/classes/MySQL_Util.html +++ b/docs/classes/MySQL_Util.html @@ -208,7 +208,7 @@
    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/classes/ODBC.html b/docs/classes/ODBC.html index 57e30eb..b8835dc 100644 --- a/docs/classes/ODBC.html +++ b/docs/classes/ODBC.html @@ -871,7 +871,7 @@ the connection/database
    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/classes/ODBC_SQL.html b/docs/classes/ODBC_SQL.html index b7debfd..7c3ac8c 100644 --- a/docs/classes/ODBC_SQL.html +++ b/docs/classes/ODBC_SQL.html @@ -281,7 +281,7 @@
    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/classes/ODBC_Util.html b/docs/classes/ODBC_Util.html index 093717b..349c147 100644 --- a/docs/classes/ODBC_Util.html +++ b/docs/classes/ODBC_Util.html @@ -203,7 +203,7 @@
    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/classes/PgSQL.html b/docs/classes/PgSQL.html index ae367b4..69507c9 100644 --- a/docs/classes/PgSQL.html +++ b/docs/classes/PgSQL.html @@ -871,7 +871,7 @@ the connection/database
    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/classes/PgSQL_SQL.html b/docs/classes/PgSQL_SQL.html index 080132f..314e931 100644 --- a/docs/classes/PgSQL_SQL.html +++ b/docs/classes/PgSQL_SQL.html @@ -297,7 +297,7 @@
    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/classes/PgSQL_Util.html b/docs/classes/PgSQL_Util.html index 1e0ef05..04e36b4 100644 --- a/docs/classes/PgSQL_Util.html +++ b/docs/classes/PgSQL_Util.html @@ -208,7 +208,7 @@
    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/classes/Query_Builder.html b/docs/classes/Query_Builder.html index d53d747..34e562a 100644 --- a/docs/classes/Query_Builder.html +++ b/docs/classes/Query_Builder.html @@ -1222,7 +1222,7 @@ for complex select queries
    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/classes/SQLite.html b/docs/classes/SQLite.html index a05fd3b..965574d 100644 --- a/docs/classes/SQLite.html +++ b/docs/classes/SQLite.html @@ -886,7 +886,7 @@ method if the database does not support 'TRUNCATE';
    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/classes/SQLite_SQL.html b/docs/classes/SQLite_SQL.html index 364f387..c9f28c8 100644 --- a/docs/classes/SQLite_SQL.html +++ b/docs/classes/SQLite_SQL.html @@ -281,7 +281,7 @@
    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/classes/SQLite_Util.html b/docs/classes/SQLite_Util.html index 61beaf5..3479397 100644 --- a/docs/classes/SQLite_Util.html +++ b/docs/classes/SQLite_Util.html @@ -208,7 +208,7 @@
    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/classes/Settings.html b/docs/classes/Settings.html index 3491b77..7c891c7 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-03T16:07:23-04:00.
    diff --git a/docs/classes/Welcome.html b/docs/classes/Welcome.html index 9fda5e7..b101111 100644 --- a/docs/classes/Welcome.html +++ b/docs/classes/Welcome.html @@ -902,7 +902,7 @@
    + generated on 2012-05-03T16:07:24-04:00.
    diff --git a/docs/classes/Welcome_Model.html b/docs/classes/Welcome_Model.html index c366627..cfc4d27 100644 --- a/docs/classes/Welcome_Model.html +++ b/docs/classes/Welcome_Model.html @@ -842,7 +842,7 @@
    + generated on 2012-05-03T16:07:24-04:00.
    diff --git a/docs/classes/miniMVC.html b/docs/classes/miniMVC.html index 716cc30..1795506 100644 --- a/docs/classes/miniMVC.html +++ b/docs/classes/miniMVC.html @@ -611,7 +611,7 @@
    + generated on 2012-05-03T16:07:24-04:00.
    diff --git a/docs/deprecated.html b/docs/deprecated.html index 6fb601a..cbf68ee 100644 --- a/docs/deprecated.html +++ b/docs/deprecated.html @@ -67,7 +67,7 @@
    + generated on 2012-05-03T16:07:24-04:00.
    diff --git a/docs/errors.html b/docs/errors.html index 787720b..07eb11b 100644 --- a/docs/errors.html +++ b/docs/errors.html @@ -107,7 +107,7 @@
    + generated on 2012-05-03T16:07:24-04:00.
    diff --git a/docs/graph_class.html b/docs/graph_class.html index 4c4efd0..406bd50 100644 --- a/docs/graph_class.html +++ b/docs/graph_class.html @@ -64,7 +64,7 @@
    + generated on 2012-05-03T16:07:24-04:00.
    diff --git a/docs/index.html b/docs/index.html index b852c47..210e736 100644 --- a/docs/index.html +++ b/docs/index.html @@ -80,7 +80,7 @@
    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/markers.html b/docs/markers.html index 2600af2..ed44f2d 100644 --- a/docs/markers.html +++ b/docs/markers.html @@ -69,7 +69,7 @@
    + generated on 2012-05-03T16:07:24-04:00.
    diff --git a/docs/namespaces/default.html b/docs/namespaces/default.html index 40dbf97..24f893e 100644 --- a/docs/namespaces/default.html +++ b/docs/namespaces/default.html @@ -709,7 +709,7 @@ instantiates the specific db driver

    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/packages/.html b/docs/packages/.html index f4a1418..3a6d26e 100644 --- a/docs/packages/.html +++ b/docs/packages/.html @@ -67,7 +67,7 @@
    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/packages/Default.html b/docs/packages/Default.html index 19723f9..0e0c0e4 100644 --- a/docs/packages/Default.html +++ b/docs/packages/Default.html @@ -185,7 +185,7 @@
    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/packages/Query.Drivers.html b/docs/packages/Query.Drivers.html index 13caf2b..fed4f07 100644 --- a/docs/packages/Query.Drivers.html +++ b/docs/packages/Query.Drivers.html @@ -211,7 +211,7 @@ data-fetching methods

    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/packages/Query.Helper Classes.html b/docs/packages/Query.Helper Classes.html index 3eb22ce..6a7d225 100644 --- a/docs/packages/Query.Helper Classes.html +++ b/docs/packages/Query.Helper Classes.html @@ -97,7 +97,7 @@
    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/packages/Query.Query.html b/docs/packages/Query.Query.html index dcdd974..296c1d7 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-03T16:07:23-04:00.
    diff --git a/docs/packages/Query.html b/docs/packages/Query.html index 46b7c6d..6a4951a 100644 --- a/docs/packages/Query.html +++ b/docs/packages/Query.html @@ -316,7 +316,7 @@ instantiates the specific db driver

    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/packages/miniMVC.App.html b/docs/packages/miniMVC.App.html index fa9c0ec..9507dd5 100644 --- a/docs/packages/miniMVC.App.html +++ b/docs/packages/miniMVC.App.html @@ -139,7 +139,7 @@
    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/packages/miniMVC.Libraries.html b/docs/packages/miniMVC.Libraries.html index 8c9cedb..4f34130 100644 --- a/docs/packages/miniMVC.Libraries.html +++ b/docs/packages/miniMVC.Libraries.html @@ -89,7 +89,7 @@
    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/packages/miniMVC.System.html b/docs/packages/miniMVC.System.html index 0fb9334..bdbbd33 100644 --- a/docs/packages/miniMVC.System.html +++ b/docs/packages/miniMVC.System.html @@ -137,7 +137,7 @@
    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/packages/miniMVC.html b/docs/packages/miniMVC.html index 3119931..f7bab80 100644 --- a/docs/packages/miniMVC.html +++ b/docs/packages/miniMVC.html @@ -495,7 +495,7 @@ display them cleanly
    + generated on 2012-05-03T16:07:23-04:00.
    diff --git a/docs/structure.xml b/docs/structure.xml index 6521c1d..6b3f6ce 100644 --- a/docs/structure.xml +++ b/docs/structure.xml @@ -95,7 +95,7 @@ and organizes database connections

    ]]> - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -510,7 +510,7 @@ directly - the settings should be safe!]]>
    - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -2494,7 +2494,7 @@ in place of the get() method]]>
    - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -2568,7 +2568,7 @@ with array_map and glob]]>
    - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -2742,7 +2742,7 @@ with array_map and glob]]>
    - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -3369,7 +3369,7 @@ with array_map and glob]]>
    - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -3763,7 +3763,7 @@ with array_map and glob]]>
    - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -4762,7 +4762,7 @@ the query]]>
    - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -5078,7 +5078,7 @@ the last query executed]]>
    - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -6457,7 +6457,7 @@ Used for outputing HTML]]>
    - + Convention-based micro-framework for PHP

    ]]>
    @@ -6477,67 +6477,78 @@ Used for outputing HTML]]>
    - + + $sess + + + + + + array + + + + __construct function - + - + __set function - + - + string - + mixed - + void - + $key - + $val - + __get function - + - + string - + mixed - + $key - + destroy function - + - + void @@ -6812,7 +6823,7 @@ display them cleanly]]>
    - + Convention-based micro-framework for PHP

    ]]>
    @@ -6822,10 +6833,10 @@ display them cleanly]]>
    - + config/config.php - + common.php @@ -6847,13 +6858,13 @@ display them cleanly]]> - MM_MOD_PATH - - - MM_APP_PATH + + MM_MOD_PATH + +
    @@ -6934,7 +6945,7 @@ display them cleanly]]> - + Convention-based micro-framework for PHP

    ]]>
    @@ -6967,7 +6978,7 @@ display them cleanly]]>
    - + Convention-based micro-framework for PHP

    ]]>
    diff --git a/index.php b/index.php index 6a37758..1f3f195 100644 --- a/index.php +++ b/index.php @@ -27,11 +27,11 @@ // PRODUCTION disables error reporting define('ENVIRONMENT', 'DEVELOPMENT'); -if (ENVIRONMENT == 'DEVELOPMENT') +if(ENVIRONMENT == 'DEVELOPMENT') { error_reporting(-1); } -else if (EVIRONMENT == 'PRODUCTION') +else if(EVIRONMENT == 'PRODUCTION') { error_reporting(0); } @@ -39,8 +39,9 @@ else if (EVIRONMENT == 'PRODUCTION') // Set the default paths define('MM_BASE_PATH', __DIR__); define('MM_SYS_PATH', __DIR__.'/sys/'); -define('MM_MOD_PATH', __DIR__.'/modules/'); define('MM_APP_PATH', __DIR__.'/app/'); +define('MM_MOD_PATH', MM_APP_PATH.'modules/'); + $ri = $_SERVER['REQUEST_URI']; $ind_pos = stripos($ri, "index.php"); diff --git a/sys/libraries/session.php b/sys/libraries/session.php index 0e40210..920f793 100644 --- a/sys/libraries/session.php +++ b/sys/libraries/session.php @@ -21,11 +21,21 @@ */ class MM_Session{ + // Combine traits for more dynamic behavior + // but use Singleton for __invoke, so calling + // that method does not create a new instance use JSObject, Singleton { Singleton::__invoke insteadof JSObject; } + /** + * Reference to session superglobal + * + * @var array + */ + protected $sess = []; + /** * Start a session */ @@ -33,12 +43,12 @@ class MM_Session{ { session_start(); - /** - * Define a unique id for this session - */ - define('SESS_ID', uniqid(uniqid(), TRUE)); - - $_SESSION[SESS_ID] = array(); + // Create a unique session id to prevent collisions + $sess_id = uniqid(uniqid(), TRUE); + + // Save a reference to the session for later access + $_SESSION[$sess_id] = []; + $this->sess =& $_SESSION[$sess_id]; } // -------------------------------------------------------------------------- @@ -52,7 +62,7 @@ class MM_Session{ */ public function __set($key, $val) { - $_SESSION[SESS_ID][$key] = $val; + $this->sess[$key] = $val; } // -------------------------------------------------------------------------- @@ -65,7 +75,7 @@ class MM_Session{ */ public function __get($key) { - return $_SESSION[SESS_ID][$key]; + return $this->sess[$key]; } // --------------------------------------------------------------------------