X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodule-functions.php;h=3bc6dadb4d2fdefbe2732b051fe8cc0bd7562ed8;hb=880c2fff756fdf79387a8905f55f765ce48c6144;hp=a87301c9377c070a3d73481ccd4cf2ef9ba23004;hpb=74a607e3879faefdc2ca152605cb533806b98e83;p=mailer.git diff --git a/inc/module-functions.php b/inc/module-functions.php index a87301c937..3bc6dadb4d 100644 --- a/inc/module-functions.php +++ b/inc/module-functions.php @@ -116,7 +116,7 @@ function getModuleStatus ($module) { // Is the module_status entry there? if (!isModuleStatusSet($module)) { // Abort - reportBug('Module status not set. module=' . $module); + reportBug(__FUNCTION__, __LINE__, 'Module status not set. module=' . $module); } // END - if // Return it @@ -388,9 +388,9 @@ function ifModuleHasMenu ($module, $forceDb = FALSE) { } elseif (!isExtensionInstalled('sql_patches')) { // No ext-sql_patches installed, so maybe in admin/guest/member/sponsor area or no admin registered? $ret = in_array($module, array('admin', 'index', 'login', 'sponsor')); // Then there is a menu! - } else { - // Unsupported state! - logDebugMessage(__FUNCTION__, __LINE__, 'This should never be reached.'); + } elseif (!isInstallationPhase()) { + // Unsupported state, but ignored in installation phase + logDebugMessage(__FUNCTION__, __LINE__, 'This should never be reached, module[' . gettype($module) . ']=' . $module . ',forceDb=' . intval($forceDb)); } // Return status @@ -402,7 +402,7 @@ function addModuleSql ($module, $title, $locked, $hidden, $adminOnly, $memOnly) // Is the module already registered? if (!isModuleRegistered($module)) { // Add it - addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_mod_reg` (`module`, `title`, `locked`, `hidden`, `admin_only`, `mem_only`) VALUES ('" . $module . "','" . $title . "','" . $locked . "','" . $hidden . "','" . $adminOnly . "','" . $memOnly . "')"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_mod_reg` (`module`, `title`, `locked`, `hidden`, `admin_only`, `mem_only`) VALUES ('" . $module . "', '" . $title . "', '" . $locked . "', '" . $hidden . "', '" . $adminOnly . "', '" . $memOnly . "')"); } else { // Already registered logDebugMessage(__FUNCTION__, __LINE__, sprintf("Already registered: module=%s,locked=%s,hidden=%s,admin=%s,mem=%s", @@ -421,7 +421,7 @@ function loadModule () { $isModuleValid = FALSE; // Construct module name - $GLOBALS['module_inc'] = sprintf("inc/modules/%s.php", getModule()); + $GLOBALS['module_inc'] = sprintf("inc/modules/%s.php", getModule()); // Check module permission (again) $moduleState = checkModulePermissions(); @@ -525,5 +525,35 @@ function doIncludeModule () { loadIncludeOnce('inc/footer.php'); } +// "Getter" for menu mode from given module +function getMenuModeFromModule () { + // Is cache set? + if (!isset($GLOBALS[__FUNCTION__])) { + // Default is 'noindex' which is invalid for SQL tables but okay for meta data template + $GLOBALS[__FUNCTION__] = 'noindex'; + + // Determine it hard-coded + if (getModule() == 'login') { + // Is member area + $GLOBALS[__FUNCTION__] = 'member'; + } elseif (getModule() == 'index') { + // Is guest area + $GLOBALS[__FUNCTION__] = 'guest'; + } elseif (getModule() == 'admin') { + // Is admin area + $GLOBALS[__FUNCTION__] = 'admin'; + } elseif (isInstallationPhase()) { + // Is installation phase + $GLOBALS[__FUNCTION__] = 'install'; + } else { + // Get it from filter + $GLOBALS[__FUNCTION__] = runFilterChain('determine_menu_mode'); + } + } // END - if + + // Return it + return $GLOBALS[__FUNCTION__]; +} + // [EOF] ?>