X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Floader%2Fload-extension.php;h=746957a8ccc473e9f646bba855c42b3e33ec04e8;hb=a36ec5d82756cd4db92ce27b6acc42b8a01920ce;hp=420b5d4bd393f3eadd36e3166383d2df950f0100;hpb=0a37fc5afcd828646d4e62e68fea07c3d2c54a87;p=mailer.git diff --git a/inc/loader/load-extension.php b/inc/loader/load-extension.php index 420b5d4bd3..746957a8cc 100644 --- a/inc/loader/load-extension.php +++ b/inc/loader/load-extension.php @@ -18,7 +18,7 @@ * $Author:: $ * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2011 by Mailer Developer Team * + * Copyright (c) 2009 - 2012 by Mailer Developer Team * * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -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 @@ -139,14 +139,38 @@ if (($GLOBALS['cache_instance']->loadCacheFile('extension')) && ($GLOBALS['cache // Add more if sql_patches is recent enougth $add = ''; if (isExtensionInstalledAndNewer('sql_patches', '0.0.6')) { - $add = ', `ext_has_css` AS `ext_css`'; - } // END - if + $add = ',`ext_has_css` AS `ext_css`'; + } // 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__); + // Query for all extensions + $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__); + + // Load all entries while ($content = SQL_FETCHARRAY($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) + SQL_QUERY_ESC("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));