Function renamed and dublicate code removed
authorRoland Häder <roland@mxchange.org>
Sun, 15 Nov 2009 20:20:35 +0000 (20:20 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 15 Nov 2009 20:20:35 +0000 (20:20 +0000)
inc/functions.php
inc/modules/member/what-welcome.php
inc/mysql-manager.php

index 521a3fa7ba782f2ba231f30385f1186abcda4ba2..4127ee62a1bc74e37180e99a8660756155418e0c 100644 (file)
@@ -3617,10 +3617,10 @@ function determinePageTitle () {
                $mode = '';
                if (getModule() == 'login') $mode = 'member';
                elseif (getModule() == 'index') $mode = 'guest';
                $mode = '';
                if (getModule() == 'login') $mode = 'member';
                elseif (getModule() == 'index') $mode = 'guest';
-               if ((!empty($mode)) && (getConfig('enable_what_title') == 'Y')) $TITLE .= " ".trim(getConfig('title_middle'))." ".getModuleDescription($mode, getWhat());
+               if ((!empty($mode)) && (getConfig('enable_what_title') == 'Y')) $TITLE .= ' ' . trim(getConfig('title_middle')) . ' ' . getTitleFromMenu($mode, getWhat());
 
                // Add title decorations? (right)
 
                // Add title decorations? (right)
-               if ((getConfig('enable_title_deco') == 'Y') && (getConfig('title_right') != '')) $TITLE .= " ".trim(getConfig('title_right'));
+               if ((getConfig('enable_title_deco') == 'Y') && (getConfig('title_right') != '')) $TITLE .= ' ' . trim(getConfig('title_right'));
 
                // Remember title in constant for the template
                $pageTitle = $TITLE;
 
                // Remember title in constant for the template
                $pageTitle = $TITLE;
index 1737ea753ffa3e8332079e0f92f4f10d133cb11e..3ccbb927aa00052af2b2ab317e037e032015af16 100644 (file)
@@ -49,7 +49,7 @@ addMenuDescription('member', basename(__FILE__));
 // Export data for template
 $content = array(
        'last_online' => generateDateTime($GLOBALS['last_online']['online']),
 // Export data for template
 $content = array(
        'last_online' => generateDateTime($GLOBALS['last_online']['online']),
-       'last_module' => getModuleDescription('member', $GLOBALS['last_online']['module'])
+       'last_module' => getTitleFromMenu('member', $GLOBALS['last_online']['module'])
 );
 
 // Load header template
 );
 
 // Load header template
index e691d6cf7cc8a5ea6e4fe1da19b04f9cdf7a4d65..c9c73e5718505fb6c716136322221c4c54f7b48f 100644 (file)
@@ -91,7 +91,7 @@ function getModuleTitle ($mod) {
 
 // "Getter" for module description
 // @TODO Can we cache this?
 
 // "Getter" for module description
 // @TODO Can we cache this?
-function getModuleDescription ($mode, $what, $column = 'what') {
+function getTitleFromMenu ($mode, $what, $column = 'what', $ADD='') {
        // Fix empty 'what'
        if (empty($what)) {
                $what = getConfig('index_home');
        // Fix empty 'what'
        if (empty($what)) {
                $what = getConfig('index_home');
@@ -101,8 +101,12 @@ function getModuleDescription ($mode, $what, $column = 'what') {
        $ret = '??? (' . $what . ')';
 
        // Look for title
        $ret = '??? (' . $what . ')';
 
        // Look for title
-       $result = SQL_QUERY_ESC("SELECT `title` FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE %s='%s' LIMIT 1",
-               array($mode, $column, $what), __FUNCTION__, __LINE__);
+       $result = SQL_QUERY_ESC("SELECT `title` FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `%s`='%s'" . $ADD . " LIMIT 1",
+               array(
+                       $mode,
+                       $column,
+                       $what
+               ), __FUNCTION__, __LINE__);
 
        // Is there an entry?
        if (SQL_NUMROWS($result) == 1) {
 
        // Is there an entry?
        if (SQL_NUMROWS($result) == 1) {
@@ -351,42 +355,32 @@ function addMenuDescription ($accessLevel, $FQFN, $return = false, $output = tru
        } // END - i
 
        // Get the title from menu
        } // END - i
 
        // Get the title from menu
-       $result = SQL_QUERY_ESC("SELECT title FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE %s='%s' ".$AND." LIMIT 1",
-       array($accessLevel, $type, $search), __FUNCTION__, __LINE__);
-
-       // Menu found?
-       if (SQL_NUMROWS($result) == 1) {
-               // Load title
-               list($ret) = SQL_FETCHROW($result);
-
-               // Shall we return it?
-               if ($return === true) {
-                       // Return title
-                       return $ret;
-               } elseif (((isExtensionInstalledAndNewer('sql_patches', '0.2.3')) && (getConfig('youre_here') == 'Y')) || ((isAdmin()) && ($modCheck == 'admin'))) {
-                       // Output HTML code
-                       $OUT = $prefix . "<strong><a class=\"you_are_here\" href=\"{?URL?}/modules.php?module=" . $modCheck . '&amp;' . $type . '=' . $search.$LINK_ADD . "\">" . $ret . "</a></strong>\n";
-
-                       // Can we close the you-are-here navigation?
-                       //* DEBUG: */ print(__LINE__."*".$type.'/'.getWhat()."*<br />");
-                       if (($type == 'what') || (($type == 'action') && ((!isWhatSet()) || (getWhat() == 'overview')))) {
-                               //* DEBUG: */ print(__LINE__.'+'.$type."+<br />");
-                               // Add closing div and br-tag
-                               $OUT .= "</div><br />\n";
-                               $GLOBALS['nav_depth'] = '0';
-
-                               // Run the filter chain
-                               $ret = runFilterChain('post_youhere_line', array('access_level' => $accessLevel, 'type' => $type, 'content' => ""));
-                               $OUT .= $ret['content'];
-                       } // END - if
-               }
-       } // END - if
+       $ret = getTitleFromMenu($accessLevel, $search, $type, $AND);
 
 
-       // Free result
-       SQL_FREERESULT($result);
+       // Shall we return it?
+       if ($return === true) {
+               // Return title
+               return $ret;
+       } elseif (((isExtensionInstalledAndNewer('sql_patches', '0.2.3')) && (getConfig('youre_here') == 'Y')) || ((isAdmin()) && ($modCheck == 'admin'))) {
+               // Output HTML code
+               $OUT = $prefix . "<strong><a class=\"you_are_here\" href=\"{?URL?}/modules.php?module=" . $modCheck . '&amp;' . $type . '=' . $search.$LINK_ADD . "\">" . $ret . "</a></strong>\n";
+
+               // Can we close the you-are-here navigation?
+               //* DEBUG: */ print(__LINE__."*".$type.'/'.getWhat()."*<br />");
+               if (($type == 'what') || (($type == 'action') && ((!isWhatSet()) || (getWhat() == 'overview')))) {
+                       //* DEBUG: */ print(__LINE__.'+'.$type."+<br />");
+                       // Add closing div and br-tag
+                       $OUT .= "</div><br />\n";
+                       $GLOBALS['nav_depth'] = '0';
+
+                       // Run the filter chain
+                       $ret = runFilterChain('post_youhere_line', array('access_level' => $accessLevel, 'type' => $type, 'content' => ""));
+                       $OUT .= $ret['content'];
+               } // END - if
+       }
 
        // Return or output HTML code?
 
        // Return or output HTML code?
-       if ($output) {
+       if ($output === true) {
                // Output HTML code here
                outputHtml($OUT);
        } else {
                // Output HTML code here
                outputHtml($OUT);
        } else {