]> git.mxchange.org Git - mailer.git/blobdiff - inc/load_extensions.php
sql_patches/cache must now load
[mailer.git] / inc / load_extensions.php
index c3d2574d795659a6f0b006496f694a9f6f27fce5..726591df3daee00f7e50895b2007fd29a86fd892 100644 (file)
@@ -38,8 +38,7 @@ if (!defined('__SECURITY')) {
 }
 
 // Init variables
-global $EXT_CSS_FILES;
-$EXT_CSS_FILES = array();
+EXT_INIT_CSS_FILES();
 $ADD = "";
 
 // Init cache instance and array
@@ -47,7 +46,13 @@ $GLOBALS['cache_instance'] = null;
 $GLOBALS['cache_array'] = array();
 
 // Skip loading extensions
-if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing'))) return;
+if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isInstalling())) {
+       // Init filter system here
+       INIT_FILTER_SYSTEM();
+
+       // Skip loading
+       return;
+} // END - if
 
 // Initialize array for "always keep active extensions"
 $GLOBALS['cache_array']['active_extensions'] = array();
@@ -56,14 +61,23 @@ $GLOBALS['cache_array']['active_extensions'] = array();
 $GLOBALS['cacheMode'] = "no";
 
 // Load sql_patchrs extension alone
-LOAD_EXTENSION("sql_patches");
+if (!LOAD_EXTENSION("sql_patches")) {
+       // Could not load sql_patches! ARGH!!!
+       trigger_error("Cannot load extension sql_patches.");
+} // END - if
+
+// Init inc pool array
+$INC_POOL = array();
 
 //
 // Load extensions
 //
 if (EXT_IS_ACTIVE("cache")) {
        // Load cache extension alone
-       LOAD_EXTENSION("cache");
+       if (!LOAD_EXTENSION("cache")) {
+               // Extension 'cache' was not loaded
+               trigger_error("Cannot load extension cache.");
+       } // END - if
 
        // Check extension cache
        switch (($GLOBALS['cache_instance']->loadCacheFile("extensions", true)) && ($GLOBALS['cache_instance']->extensionVersionMatches("sql_patches"))) {
@@ -107,7 +121,7 @@ if ($GLOBALS['cacheMode'] == "load") {
        $EXT_NAMES = array();
        foreach ($EXT_DUMMY['ext_name'] as $k => $name) {
                // Load CSS file
-               if ($EXT_DUMMY['ext_css'][$k] == "Y") $EXT_CSS_FILES[] = "".$name.".css";
+               if ($EXT_DUMMY['ext_css'][$k] == "Y") EXT_ADD_CSS_FILE("".$name.".css");
 
                // Load extension file itself
                if ((($EXT_DUMMY['ext_active'][$k] == "Y") || ($EXT_DUMMY['ext_keep'][$k] == "Y") || (IS_ADMIN())) && (!in_array($name, array("sql_patches", "cache")))) {
@@ -195,9 +209,6 @@ $DEL = array();
 
 // At least one found?
 if ((SQL_NUMROWS($res_ext_crt) > 0) && ((($GLOBALS['cacheMode'] == "init") && ($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1")) || ($GLOBALS['cacheMode'] == "no"))) {
-       // Load session management
-       LOAD_INC_ONCE("inc/session.php");
-
        // Extensions are registered so we load them
        while ($content = SQL_FETCHARRAY($res_ext_crt)) {
                // Get menu entry
@@ -229,12 +240,12 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && ((($GLOBALS['cacheMode'] == "init") && ($
                        // CSS file handling:
                        if ((!isset($content['ext_css'])) || ($content['ext_css'] == "Y")) {
                                // Create FQFN for the CSS file
-                               $GLOBALS['output_mode']_FILE = sprintf("%stheme/%s/css/%s.css", constant('PATH'), GET_CURR_THEME(), $content['ext_name']);
+                               $FQFN = sprintf("%stheme/%s/css/%s.css", constant('PATH'), GET_CURR_THEME(), $content['ext_name']);
 
                                // Is the file there?
-                               if (FILE_READABLE($GLOBALS['output_mode']_FILE)) {
+                               if (FILE_READABLE($FQFN)) {
                                        // CSS file for extension was found (use only relative path for now!)
-                                       $EXT_CSS_FILES[] = $content['ext_name'].".css";
+                                       EXT_ADD_CSS_FILE($content['ext_name'].".css");
                                        $content['ext_css'] = "Y";
                                } else {
                                        // Don't load CSS file