X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=modules.php;h=e5cad949541f210ba2ea25c279e8d405502c0fda;hp=09fef371356da546aa1a7951a32f55c8a8a42d18;hb=ef93474b89c9e51dd97f4eb79b260630f05216f2;hpb=82cbb1b75e0091b6333fefd045903329b234b9fb diff --git a/modules.php b/modules.php index 09fef37135..e5cad94954 100644 --- a/modules.php +++ b/modules.php @@ -16,8 +16,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 * @@ -42,102 +42,17 @@ require('inc/libs/security_functions.php'); // Init start time -$GLOBALS['startTime'] = microtime(true); +$GLOBALS['__start_time'] = microtime(TRUE); // Init output mode and module -$GLOBALS['output_mode'] = '0'; -$GLOBALS['module'] = 'unknown'; +$GLOBALS['__module'] = 'unknown'; +$GLOBALS['__output_mode'] = '0'; // Needed include files require('inc/config-global.php'); -// Set content type -setContentType('text/html'); - -// The header file -loadIncludeOnce('inc/header.php'); - -// Modules are by default not valid! -$isModuleValid = false; - -// Init module state as 'failed' (always failed first) -$moduleState = 'failed'; - -// Is the maintenance mode active or goes all well? -if ((isExtensionActive('maintenance')) && (isMaintenanceEnabled()) && (!isAdmin()) && (getModule() != 'admin')) { - // Maintain mode is active and you are no admin - addFatalMessage(__FILE__, __LINE__, '{--MAILER_DOWN_FOR_MAINTENANCE--}'); -} elseif ((SQL_IS_LINK_UP()) && (!ifFatalErrorsDetected())) { - // Construct module name - $GLOBALS['module_inc'] = sprintf("inc/modules/%s.php", getModule()); - - // Check module permission (again) - $moduleState = checkModulePermissions(); - - // Which permission/error state do we have? - switch ($moduleState) { - case 'cache_miss': // The cache is gone - case 'admin_only': // Admin-only access - case 'mem_only': // Member-only access - case 'done': // All fine! - // Does the module exists on local file system? - if ((isIncludeReadable($GLOBALS['module_inc'])) && (!ifFatalErrorsDetected())) { - // Module is valid, active and located on the local disc... - $isModuleValid = true; - } elseif (!ifFatalErrorsDetected()) { - // Set HTTP status - setHttpStatus('404'); - - // Module not found - addFatalMessage(__FILE__, __LINE__, '{--MODULE_REGISTRY_404--}'); - - // Set module to error module (non-existent!) - setModule('error'); - } - break; - - case '404': - // Set HTTP status - setHttpStatus('404'); - - // Add fatal message - addFatalMessage(__FILE__, __LINE__, '{--MODULE_REGISTRY_404--}'); - break; - - case 'locked': - // Set HTTP status - setHttpStatus('403 FORBIDDEN'); - - if (!isIncludeReadable($GLOBALS['module_inc'])) { - // Set HTTP status again - setHttpStatus('404 NOT FOUND'); - - // Module does addionally not exists - addFatalMessage(__FILE__, __LINE__, '{--MODULE_REGISTRY_404--}'); - } // END - if - - // Add fatal message - addFatalMessage(__FILE__, __LINE__, '{--MODULE_REGISTRY_IS_LOCKED--}'); - break; - - default: - // Unknown module status - logDebugMessage(__FILE__, __LINE__, sprintf("Unknown status %s return from module check. Module=%s", $moduleState, getModule())); - addFatalMessage(__FILE__, __LINE__, '{%message,UNKNOWN_MODULE_STATUS=' . $moduleState . '%}'); - break; - } // END - switch -} elseif (!ifFatalErrorsDetected()) { - // SQL problems detected - addFatalMessage(__FILE__, __LINE__, '{--MYSQL_ERRORS--}'); -} - -if (($isModuleValid === true) && (isset($GLOBALS['module_inc']))) { - // Everything is okay so we can load the module - loadIncludeOnce($GLOBALS['module_inc']); -} // END - if - -// Add the footer (this will call shutdown()) -loadIncludeOnce('inc/footer.php'); +// Include module +doIncludeModule(); // [EOF] ?>