X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=inc%2Floader%2Fload-extension.php;h=0d35dd45019d89ee2d186455ffb9bb5a0f573585;hb=971c31241c59b933d563f712a893b0c54ad33557;hp=5d6b0cbe7d4ac6a5ecc5e2c4834119f011040e21;hpb=0f3a135204757cc8750262871c8e62c42300acb4;p=mailer.git diff --git a/inc/loader/load-extension.php b/inc/loader/load-extension.php index 5d6b0cbe7d..0d35dd4501 100644 --- a/inc/loader/load-extension.php +++ b/inc/loader/load-extension.php @@ -18,8 +18,8 @@ * $Author:: $ * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2011 by Mailer Developer Team * - * For more information visit: http://www.mxchange.org * + * Copyright (c) 2009 - 2013 by Mailer Developer Team * + * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -41,8 +41,8 @@ if (!defined('__SECURITY')) { die(); } elseif (isInstallationPhase()) { - // Use this code if you don't want to run this cache loader on installation phase - return; + // Do not run in installation phase + return FALSE; } // Next cached table is the extension @@ -53,7 +53,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('extension')) && ($GLOBALS['cache // Init extension inc-pool $EXT_POOL = array(); - // Do we have entries? + // Are there entries? if (count($EXT_DUMMY) > 0) { // Init arrays $EXT_NAMES = array(); @@ -67,7 +67,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('extension')) && ($GLOBALS['cache // Load extension file itself if (($EXT_DUMMY['ext_active'][$k] == 'Y') || ($EXT_DUMMY['ext_keep'][$k] == 'Y')) { - $EXT_POOL[] = $ext_name; + array_push($EXT_POOL, $ext_name); } // END - if // Version number @@ -123,7 +123,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('extension')) && ($GLOBALS['cache unset($EXT_DUMMY); // No database load needed - $res_ext_crt = false; + $res_ext_crt = FALSE; // Load all extension files in test-mode (we initialize them later) foreach ($EXT_POOL as $ext) { @@ -132,24 +132,49 @@ if (($GLOBALS['cache_instance']->loadCacheFile('extension')) && ($GLOBALS['cache // Remove array and mark cache as loaded unset($EXT_POOL); -} elseif (isHtmlOutputMode()) { +} elseif ((isHtmlOutputMode()) || (isRawOutputMode())) { // Create cache file here $GLOBALS['cache_instance']->init(); - // Add more if sql_patches is recent enougth + // Add more if ext-sql_patches is recent enougth $add = ''; if (isExtensionInstalledAndNewer('sql_patches', '0.0.6')) { + // Old naming $add = ', `ext_has_css` AS `ext_css`'; - } // END - if + } // END - if - // Load all modules and their data - $result = SQL_QUERY('SELECT `id` AS `ext_id`,`ext_name`,`ext_active`,`ext_version`' . $add . ' FROM `{?_MYSQL_PREFIX?}_extensions` ORDER BY `ext_name` ASC', __FILE__, __LINE__); - while ($content = SQL_FETCHARRAY($result)) { + // Query for all extensions + $result = sqlQuery('SELECT + `id` AS `ext_id`, + `ext_name`, + `ext_active`, + `ext_version` +' . $add . ' +FROM + `{?_MYSQL_PREFIX?}_extensions` +ORDER BY + `ext_name` ASC', __FILE__, __LINE__); + + // Load all entries + while ($content = sqlFetchArray($result)) { // Load extension - loadExtension($content['ext_name'], 'test'); + if (!loadExtension($content['ext_name'], 'test')) { + // Is the name valid? + if (!isExtensionNameValid($content['ext_name'])) { + // Is not valid name (empty ext-foo.php script) + sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1", + array($content['ext_name']), __FILE__, __LINE__); + } else { + // Didn't load so deactivate it + doDeactivateExtension($content['ext_name'], TRUE); + } + + // ... and skip it + continue; + } // END - if // Get menu entry - $content['ext_menu'] = convertBooleanToYesNo(ifModuleHasMenu($content['ext_name'], true)); + $content['ext_menu'] = convertBooleanToYesNo(ifModuleHasMenu($content['ext_name'], TRUE)); // Get language entry $content['ext_lang'] = convertBooleanToYesNo(isLanguageIncludeReadable($content['ext_name'])); @@ -170,7 +195,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('extension')) && ($GLOBALS['cache } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Close the cache $GLOBALS['cache_instance']->storeExtensionVersion('sql_patches');