X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=modules.php;h=2b1b2acf75497a78a4f8f9fa8c6bd4d1e2d6cf35;hp=f89ea6c6e345a2fdc67997911f1658dd4c35bcc8;hb=3b7adf43576db24e516716bb13a2bd0bac677c8c;hpb=0f8b6618aeb5d92a372be12066c611c60ff86917 diff --git a/modules.php b/modules.php index f89ea6c6e3..2b1b2acf75 100644 --- a/modules.php +++ b/modules.php @@ -14,11 +14,9 @@ * $Date:: $ * * $Tag:: 0.2.1-FINAL $ * * $Author:: $ * - * Needs to be in all Files and every File needs "svn propset * - * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009, 2010 by Mailer Developer Team * + * Copyright (c) 2009 - 2011 by Mailer Developer Team * * For more information visit: http://www.mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -62,10 +60,12 @@ loadIncludeOnce('inc/header.php'); // Modules are by default not valid! $isModuleValid = false; $URL = ''; -$check = 'failed'; + +// Init module state as 'failed' (always failed first) +$moduleState = 'failed'; // Is the maintenance mode active or goes all well? -if ((isExtensionActive('maintenance')) && (getConfig('maintenance') == 'Y') && (!isAdmin()) && (getModule() != 'admin')) { +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())) { @@ -73,8 +73,10 @@ if ((isExtensionActive('maintenance')) && (getConfig('maintenance') == 'Y') && ( $GLOBALS['module_inc'] = sprintf("inc/modules/%s.php", getModule()); // Check module permission (again) - $check = checkModulePermissions(); - switch ($check) { + $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 @@ -87,8 +89,8 @@ if ((isExtensionActive('maintenance')) && (getConfig('maintenance') == 'Y') && ( // Set HTTP status setHttpStatus('404'); - // Module not found! - addFatalMessage(__FILE__, __LINE__, getMaskedMessage('MODULE_REGISTRY_404', getModule())); + // Module not found + addFatalMessage(__FILE__, __LINE__, '{--MODULE_REGISTRY_404--}'); // Set module to error module (non-existent!) setModule('error'); @@ -100,33 +102,33 @@ if ((isExtensionActive('maintenance')) && (getConfig('maintenance') == 'Y') && ( setHttpStatus('404'); // Add fatal message - addFatalMessage(__FILE__, __LINE__, getMaskedMessage('MODULE_REGISTRY_404', getModule())); + addFatalMessage(__FILE__, __LINE__, '{--MODULE_REGISTRY_404--}'); break; case 'locked': // Set HTTP status - setHttpStatus('403'); + setHttpStatus('403 FORBIDDEN'); if (!isIncludeReadable($GLOBALS['module_inc'])) { - // Set HTTP status - setHttpStatus('404'); + // Set HTTP status again + setHttpStatus('404 NOT FOUND'); // Module does addionally not exists - addFatalMessage(__FILE__, __LINE__, getMaskedMessage('MODULE_REGISTRY_404', getModule())); + addFatalMessage(__FILE__, __LINE__, '{--MODULE_REGISTRY_404--}'); } // END - if // Add fatal message - addFatalMessage(__FILE__, __LINE__, getMaskedMessage('MODULE_IS_LOCKED', getModule())); + 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", $check, getModule())); - addFatalMessage(__FILE__, __LINE__, getMaskedMessage('UNKNOWN_MODULE_STATUS', $check)); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown status %s return from module check. Module=%s", $moduleState, getModule())); + addFatalMessage(__FILE__, __LINE__, getMaskedMessage('UNKNOWN_MODULE_STATUS', $moduleState)); break; } // END - switch } elseif (!ifFatalErrorsDetected()) { - // MySQL problems detected + // SQL problems detected addFatalMessage(__FILE__, __LINE__, '{--MYSQL_ERRORS--}'); }