includes/common.php
changeset 544 81b4499a963e
parent 541 acb7e23b6ffa
child 590 03a60844c7c5
--- a/includes/common.php	Mon May 05 20:08:44 2008 -0400
+++ b/includes/common.php	Mon May 05 20:28:13 2008 -0400
@@ -32,6 +32,13 @@
   exit;
 }
 
+// only do this if it hasn't been done yet
+if ( !defined('ENANO_COMMON_ROOT_LOADED') )
+{
+
+// log this
+define('ENANO_COMMON_ROOT_LOADED', 1);
+
 // Our version number
 // This needs to match the version number in the database. This number should
 // be the expected output of enano_version(), which will always be in the
@@ -104,6 +111,24 @@
 // List of scheduled tasks (don't change this manually, use register_cron_task())
 $cron_tasks = array();
 
+} // check for ENANO_COMMON_ROOT_LOADED
+else
+{
+  // loading a second time
+  if ( !defined('ENANO_COMMON_ROOT_LOADED_MULTI') )
+  {
+    define('ENANO_COMMON_ROOT_LOADED_MULTI', 1);
+  }
+}
+
+// If all we really need is the root directory, just leave now
+// checking for ENANO_COMMON_ROOT_LOADED_MULTI here means that if common
+// is included a second time, the rest of Enano will load.
+if ( defined('ENANO_COMMON_ROOTONLY') && !defined('ENANO_COMMON_ROOT_LOADED_MULTI') )
+{
+  return true;
+}
+
 // Start including files. LOTS of files. Yeah!
 require_once(ENANO_ROOT.'/includes/constants.php');
 require_once(ENANO_ROOT.'/includes/functions.php');