************************************************************************/
// Some security stuff...
-if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
-{
+if (!defined('__SECURITY')) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
require($INC);
}
// Do not recreate cache file when it's switched off!
if (($cacheMode == "init") && ($_CONFIG['cache_exts'] == "N")) $cacheMode = "skip";
-
- // Load language
- if ($cacheMode == "load") include(PATH."inc/language/cache_".GET_LANGUAGE().".php");
} else {
// Cache extension not active
$cacheMode = "no";
}
if ($cacheMode == "load") {
+ // Init include array
+ $EXT_POOL = array();
+
// Re-initialize handler
$cacheInstance->cache_file("extensions", true);
// Load Language file
if ($EXT_DUMMY['ext_lang'][$k] == "Y") {
$INC = sprintf("%sinc/language/%s_%s.php", PATH, $name, GET_LANGUAGE());
- if (FILE_READABLE($INC)) require_once($INC);
+ if (FILE_READABLE($INC)) {
+ // Add it
+ $EXT_POOL[] = $INC;
+ }
} // END - if
// Load CSS file
// Load extension file itself
if (($EXT_DUMMY['ext_active'][$k] == "Y") || ($EXT_DUMMY['ext_keep'][$k] == "Y") || (IS_ADMIN())) {
- require_once(PATH."inc/extensions/ext-".$name.".php");
+ $EXT_POOL[] = sprintf("%sinc/extensions/ext-%s.php", PATH, $name);
} // END - if
// Version number
// Load more cache files (like admins)
require_once(PATH."inc/load_cache.php");
+
+ // Load all extension files
+ foreach ($EXT_POOL as $inc) {
+ require_once($inc);
+ } // END - foreach
+
+ // Remove array
+ unset($EXT_POOL);
} else {
// If current user is not admin load only activated extensions
// The admin shall use every available extension for testing purposes
// Load more cache files (like admins)
require_once(PATH."inc/load_cache.php");
} // END - if
-}
-// Free memory
-SQL_FREERESULT($res_ext_crt);
+ // Free memory
+ SQL_FREERESULT($res_ext_crt);
+}
-// Load include files
+// Load include files if found
if (!empty($INC_POOL[0])) {
foreach ($INC_POOL as $inc) {
require_once($inc);
} // END - foreach
+
+ // Remove array
+ unset($INC_POOL);
} // END - if
// Uninstall extensions that are no longer in our system
// Remove extensions from two tables: extension registry and tasks table
foreach ($DEL as $name) {
// First remove entry from extensions table
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1",
- array($name), __FILE__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1",
+ array($name), __FILE__, __LINE__);
// Remove (maybe?) found tasks (main task and possible updates
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_task_system WHERE subject LIKE '[%s:] %' AND (task_type='EXTENSION' OR task_type='EXTENSION_UPDATE')",
- array($name), __FILE__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_task_system WHERE subject LIKE '[%s:] %' AND (task_type='EXTENSION' OR task_type='EXTENSION_UPDATE')",
+ array($name), __FILE__, __LINE__);
} // END - foreach
// I think it's not neccessary to run the optimization function here