Rewrites to handle non-existent modules:
authorRoland Häder <roland@mxchange.org>
Thu, 8 Jul 2010 22:17:38 +0000 (22:17 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 8 Jul 2010 22:17:38 +0000 (22:17 +0000)
- Getting module' title is now done while compilation phase (and not when the
  filter runs). This allows us to modify it even after the page header has been
  loaded.
- TODOs.txt updated

DOCS/TODOs.txt
inc/language/de.php
inc/module-functions.php
inc/template-functions.php
modules.php

index 5bc1084cf4f6b184f5b4ab97236543757b46e9c3..095875b9fb62775bab1528256d5130cc2ef4bf10 100644 (file)
 ./inc/functions.php:2245:      // @TODO This is still very static, rewrite it somehow
 ./inc/gen_sql_patches.php:96:// @TODO Rewrite this to a filter
 ./inc/install-functions.php:63:        // @TODO DEACTIVATED: changeDataInFile(getCachePath() . 'config-local.php', 'OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0);
-./inc/language/de.php:1135:// @TODO Rewrite these two constants
-./inc/language/de.php:1150:// @TODO Rewrite these three constants
-./inc/language/de.php:301:     // @TODO Following two are unused?
-./inc/language/de.php:828:// @TODO Are these constants longer used?
+./inc/language/de.php:1136:// @TODO Rewrite these two constants
+./inc/language/de.php:1151:// @TODO Rewrite these three constants
+./inc/language/de.php:302:     // @TODO Following two are unused?
+./inc/language/de.php:829:// @TODO Are these constants longer used?
 ./inc/language-functions.php:234:      // @TODO These are all valid languages, again hard-coded
 ./inc/language-functions.php:46:// @TODO Rewrite all language constants to this function.
 ./inc/language/rallye_de.php:13: * @TODO Naming convention not applied for language strings             *
@@ -87,8 +87,8 @@
 ./inc/libs/yoomedia_functions.php:116: $response = YOOMEDIA_QUERY_API('out_textmail.php', true); // @TODO Ask Yoo!Media for test script
 ./inc/load_config.php:77:      // @TODO Rewrite them to avoid this else block
 ./inc/loader/load_cache-extension.php:13: * @TODO Rewrite this whole file to load_cache-extensions.php           *
-./inc/module-functions.php:197:                        // @TODO Nothing helped???
-./inc/module-functions.php:232:                        // @TODO Rewrite this to a filter
+./inc/module-functions.php:203:                        // @TODO Nothing helped???
+./inc/module-functions.php:238:                        // @TODO Rewrite this to a filter
 ./inc/modules/admin/admin-inc.php:261:         // @TODO Rewrite this to $content = SQL_FETCHARRAY()
 ./inc/modules/admin/admin-inc.php:266:                         // @TODO ACL is 'allow'... hmmm
 ./inc/modules/admin/admin-inc.php:332:                                 // @TODO Rewrite this to $content = SQL_FETCHARRAY()
index 2284942c836422be6cf4b51154a558a5bc0daefd..f77017472afe2e970001e01f6c9d436f3ea61459 100644 (file)
@@ -58,6 +58,7 @@ addMessages(array(
        '_OKOPT' => "Optimiert.",
        'MAILER_DOWN_FOR_MAINTENANCE' => "System wegen Wartungsarbeiten geschlossen.",
        'MODULE_REGISTRY_404' => "Modul <span class=\"data\">%s</span> existiert nicht.",
+       'MODULE_ERROR_404' => "Fehler: Modul nicht gefunden",
        'UNKNOWN_MODULE_DETECTED' => "Unbekanntes Modul %s",
        'MAILER_WARNING' => "Warnung",
        'DIE_CONFIG_CHANGED_YOU' => "Sie haben Ihre Config-Datei editiert! Auf Wiedersehen...",
index 7918a233e8533e8237ce3c398a873fc1b1025b68..beb8929522dfe78fb7b87a7fe046bde6ff8673ba 100644 (file)
@@ -49,7 +49,7 @@ function getModuleTitle ($module) {
        $result = false;
 
        // Is the script installed?
-       if (isInstalled()) {
+       if ((isInstalled()) && ($module != 'error')) {
                // Check if cache is valid
                if ((isExtensionInstalledAndNewer('cache', '0.1.2')) && (isset($GLOBALS['cache_array']['modules']['module'])) && (in_array($module, $GLOBALS['cache_array']['modules']['module']))) {
                        // Load from cache
@@ -78,12 +78,18 @@ function getModuleTitle ($module) {
 
        // Still no luck or empty title?
        if (empty($data['title'])) {
-               // No name found
-               $data['title'] = getMaskedMessage('UNKNOWN_MODULE_DETECTED', $module);
-               if ((is_resource($result)) && (SQL_HASZERONUMS($result))) {
-                       // Add module to database
-                       $dummy = checkModulePermissions($module);
-               } // END - if
+               // Is it 'error'?
+               if ($module == 'error') {
+                       // Error (real module was not found)
+                       $data['title'] = getMessage('MODULE_ERROR_404');
+               }  else {
+                       // No name found
+                       $data['title'] = getMaskedMessage('UNKNOWN_MODULE_DETECTED', $module);
+                       if ((is_resource($result)) && (SQL_HASZERONUMS($result))) {
+                               // Add module to database
+                               $dummy = checkModulePermissions($module);
+                       } // END - if
+               }
        } // END - if
 
        // Return name
index cec52e7ccbf2f0632e89f4af891ec8daf5e47013..81c6d2f5e15b77992957f31e172574f03d32aa23 100644 (file)
@@ -1360,7 +1360,7 @@ function determinePageTitle () {
 
                // Add title of module? (middle decoration will also be added!)
                if ((isModuleTitleEnabled()) || ((!isWhatSet()) && (!isActionSet())) || (getModule() == 'admin')) {
-                       $TITLE .= ' ' . trim(getConfig('title_middle')) . ' ' . getModuleTitle(getModule());
+                       $TITLE .= ' ' . trim(getConfig('title_middle')) . ' {DQUOTE} . getModuleTitle(getModule()) . {DQUOTE}';
                } // END - if
 
                // Add title from what file
index 5dcf9f06cf57dc65778c118b2fa20462f340a609..446ffe9cd360f67285f0ccf7e273599ca3ade983 100644 (file)
@@ -98,6 +98,9 @@ if ((isExtensionActive('maintenance')) && (getConfig('maintenance') == 'Y') && (
 
                                // Module not found!
                                addFatalMessage(__FILE__, __LINE__, getMaskedMessage('MODULE_REGISTRY_404', getModule()));
+
+                               // Set module to error module (non-existent!)
+                               setModule('error');
                        }
                        break;