Fix for 'you are here' top navigation
authorRoland Häder <roland@mxchange.org>
Tue, 2 Oct 2012 21:00:34 +0000 (21:00 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 2 Oct 2012 21:00:34 +0000 (21:00 +0000)
inc/mysql-manager.php

index e9d5c40fcdeef682d87e01f66bb7b9d2a536fb94..85591a9fc2c329912cd369c8cb803ba7946eba4f 100644 (file)
@@ -87,7 +87,7 @@ function addYouAreHereLink ($accessLevel, $FQFN, $return = false) {
        $file = basename($FQFN);
 
        // Init variables
-       $LINK_ADD = '';
+       $linkAdd = '';
        $OUT = '';
        $ADD = '';
        $prefix = '';
@@ -125,13 +125,11 @@ function addYouAreHereLink ($accessLevel, $FQFN, $return = false) {
                $type     = 'what';
                $search   = $file;
                $modCheck = getModule();
-               $ADD      = '';
        } else {
                // Other
                $type     = 'menu';
                $search   = $file;
                $modCheck = getModule();
-               $ADD      = '';
        }
 
        // Begin the navigation line
@@ -140,18 +138,19 @@ function addYouAreHereLink ($accessLevel, $FQFN, $return = false) {
                $GLOBALS['nav_depth'] = '0';
 
                // Run the pre-filter chain
-               $ret = runFilterChain('pre_youhere_line', array('access_level' => $accessLevel, 'type' => $type, 'search' => $search, 'prefix' => $prefix, 'link_add' => $LINK_ADD, 'content' => '', 'add' => $ADD));
+               $ret = runFilterChain('pre_youhere_line', array('access_level' => $accessLevel, 'type' => $type, 'search' => $search, 'prefix' => $prefix, 'link_add' => $linkAdd, 'content' => '', 'add' => $ADD));
 
                // Add pre-content
                $prefix = $ret['content'];
 
                // Add default content
-               $prefix .= '<div class="you_are_here">{--YOU_ARE_HERE--}&nbsp;<strong><a class="you_are_here" href="{%url=modules.php?module=' . getModule() . $LINK_ADD . '%}">Home</a></strong>';
+               $prefix .= '<div class="you_are_here">{--YOU_ARE_HERE--}&nbsp;<strong><a class="you_are_here" href="{%url=modules.php?module=' . getModule() . $linkAdd . '%}">Home</a></strong>';
        } elseif ($return === false) {
                // Count depth
                $GLOBALS['nav_depth']++;
        }
 
+       // Add arrow
        $prefix .= '&nbsp;-&gt;&nbsp;';
 
        // We need to remove .php and the end
@@ -164,17 +163,17 @@ function addYouAreHereLink ($accessLevel, $FQFN, $return = false) {
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isExtensionInstalledAndNewer()=' . intval(isExtensionInstalledAndNewer('sql_patches', '0.2.3')) . ',youre_here=' . getConfig('youre_here') . ',isAdmin()=' . intval(isAdmin()) . ',modCheck=' . $modCheck);
        if (((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 . '%}">' . getTitleFromMenu($accessLevel, $search, $type, $ADD) . '</a></strong>';
+               $OUT = $prefix . '<strong><a class="you_are_here" href="{%url=modules.php?module=' . $modCheck . '&amp;' . $type . '=' . $search . $linkAdd . '%}">' . getTitleFromMenu($accessLevel, $search, $type, $ADD) . '</a></strong>';
 
                // Can we close the you-are-here navigation?
-               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'type=' . $type . ',getWhat()=' . getWhat() . ',isWhatSet()=' . intval(isWhatSet()));
-               if (($type == 'what') || (($type == 'action') && (!isWhatSet()))) {
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'type=' . $type . ',getWhat()=' . getWhat() . ',accessLevel=' . $accessLevel . ',isWhatSet()=' . intval(isWhatSet()));
+               if (($type == 'what') || (($type == 'action') && ((!isWhatSet()) || ($accessLevel == 'admin')))) {
                        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'type=' . $type);
                        // Add closing div and br-tag
                        $GLOBALS['nav_depth'] = '0';
 
                        // Run the post-filter chain
-                       $ret = runFilterChain('post_youhere_line', array('access_level' => $accessLevel, 'type' => $type, 'search' => $search, 'prefix' => $prefix, 'link_add' => $LINK_ADD, 'content' => $OUT, 'add' => $ADD));
+                       $ret = runFilterChain('post_youhere_line', array('access_level' => $accessLevel, 'type' => $type, 'search' => $search, 'prefix' => $prefix, 'link_add' => $linkAdd, 'content' => $OUT, 'add' => $ADD));
 
                        // Get content from filter back
                        $OUT = $ret['content'];
@@ -213,7 +212,11 @@ function addMenu ($mode, $action, $what) {
 
        // Load SQL data and add the menu to the output stream...
        $result_main = SQL_QUERY_ESC("SELECT
-       `title`,`what`,`action`,`visible`,`locked`
+       `title`,
+       `what`,
+       `action`,
+       `visible`,
+       `locked`
 FROM
        `{?_MYSQL_PREFIX?}_%s_menu`
 WHERE
@@ -247,10 +250,13 @@ WHERE
        `action`='%s' AND
        `what` != '' AND
        `what` IS NOT NULL
-       ".$ADD."
+       " . $ADD . "
 ORDER BY
        `sort` ASC",
-                               array($mode, $content['action']), __FUNCTION__, __LINE__);
+                               array(
+                                       $mode,
+                                       $content['action']
+                               ), __FUNCTION__, __LINE__);
 
                        // Do we have some entries?
                        if (!SQL_HASZERONUMS($result_sub)) {