- define('__MODULE', sprintf("inc/modules/%s.php", SQL_ESCAPE($GLOBALS['module'])));
-
- // Did we found the module listed in allowed modules and are we successfully connected?
- $check = CHECK_MODULE($GLOBALS['module']);
- switch ($check)
- {
- case "admin_only":
- case "mem_only":
- case "done":
- // Does the module exists on local file system?
- if ((FILE_READABLE(constant('__MODULE'))) && (getTotalFatalErrors() == 0)) {
- // Module is valid, active and located on the local disc...
- $MOD_VALID = true;
- } elseif (!empty($URL)) {
- // An URL was specified so we load the de-referrer module
- LOAD_URL(DEREFERER($URL));
- } elseif (getTotalFatalErrors() == 0) {
- addFatalMessage(sprintf(getMessage('LANG_MOD_REG_404'), $GLOBALS['module']));
- }
- break;
-
- case "404":
- addFatalMessage(sprintf(getMessage('LANG_MOD_REG_404'), $GLOBALS['module']));
- break;
-
- case "locked":
- if (!FILE_READABLE(constant('__MODULE'))) {
- // Module does addionally not exists
- addFatalMessage(sprintf(getMessage('LANG_MOD_REG_404'), $GLOBALS['module']));
- } // END - if
-
- // Add fatal message
- addFatalMessage(sprintf(getMessage('LANG_MOD_REG_LOCKED'), $GLOBALS['module']));
- break;
-
- default:
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown status %s return from module check. Module=%s", $check, $GLOBALS['module']));
- addFatalMessage(sprintf(getMessage('LANG_MOD_REG_UNKNOWN'), $check));
- break;
- }
-} elseif (getTotalFatalErrors() == 0) {
+ $GLOBALS['module_inc'] = sprintf("inc/modules/%s.php", getModule());
+
+ // Check module permission (again)
+ $check = checkModulePermissions();
+ switch ($check) {
+ 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'])) && (getTotalFatalErrors() == '0')) {
+ // Module is valid, active and located on the local disc...
+ $isModuleValid = true;
+ } elseif (getTotalFatalErrors() == '0') {
+ // Module not found!
+ addFatalMessage(__FILE__, __LINE__, getMaskedMessage('LANG_MOD_REG_404', getModule()));
+ }
+ break;
+
+ case '404':
+ addFatalMessage(__FILE__, __LINE__, getMaskedMessage('LANG_MOD_REG_404', getModule()));
+ break;
+
+ case 'locked':
+ if (!isIncludeReadable($GLOBALS['module_inc'])) {
+ // Module does addionally not exists
+ addFatalMessage(__FILE__, __LINE__, getMaskedMessage('LANG_MOD_REG_404', getModule()));
+ } // END - if
+
+ // Add fatal message
+ addFatalMessage(__FILE__, __LINE__, getMaskedMessage('LANG_MOD_REG_LOCKED', getModule()));
+ break;
+
+ default:
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown status %s return from module check. Module=%s", $check, getModule()));
+ addFatalMessage(__FILE__, __LINE__, getMaskedMessage('LANG_MOD_REG_UNKNOWN', $check));
+ break;
+ } // END - switch
+} elseif (getTotalFatalErrors() == '0') {