]> git.mxchange.org Git - mailer.git/blobdiff - inc/mysql-manager.php
detectExtraTemplatePath() cached, ext-network continued:
[mailer.git] / inc / mysql-manager.php
index 9503fff2fa96259510081d2eaa9c8c41743f6447..e691d6cf7cc8a5ea6e4fe1da19b04f9cdf7a4d65 100644 (file)
@@ -299,40 +299,27 @@ function addMenuDescription ($accessLevel, $FQFN, $return = false, $output = tru
                // This is an action file!
                $type = 'action';
                $search = substr($file, 7);
-               switch ($accessLevel) {
-                       case 'admin':
-                               $modCheck = 'admin';
-                               break;
-
-                       case 'sponsor':
-                       case 'guest':
-                       case 'member':
-                               $modCheck = getModule();
-                               break;
-               }
+
+               // Get access level from it
+               $modCheck = getModuleFromFileName($file, $accessLevel);
+
+               // Add what
                $AND = " AND (`what`='' OR `what` IS NULL)";
        } elseif (substr($file, 0, 5) == 'what-') {
                // This is an admin what file!
                $type = 'what';
                $search = substr($file, 5);
-               $AND = '';
-               switch ($accessLevel) {
-                       case 'admin':
-                               $modCheck = 'admin';
-                               break;
-
-                       case 'guest':
-                       case 'member':
-                               $modCheck = getModule();
-                               if (!isAdmin()) {
-                                       $AND = " AND `visible`='Y' AND `locked`='N'";
-                               }
-                               break;
-               }
+               $AND = " AND `visible`='Y' AND `locked`='N'";
+
+               // Get access level from it
+               $modCheck = getModuleFromFileName($file, $accessLevel);
+
+               // Do we have admin? Then display all
+               if (isAdmin()) $AND = '';
 
                $dummy = substr($search, 0, -4);
                $AND .= " AND `action`='".getModeAction($accessLevel, $dummy)."'";
-       } elseif (($accessLevel == 'sponsor') || ($accessLevel == "engine")) {
+       } elseif (($accessLevel == 'sponsor') || ($accessLevel == 'engine')) {
                // Sponsor / engine menu
                $type     = 'what';
                $search   = $file;
@@ -1556,7 +1543,12 @@ function generateOptionList ($table, $id, $name, $default='', $special='', $wher
 
                // Query the database
                $result = SQL_QUERY_ESC("SELECT `%s`, `%s`".$SPEC." FROM `{?_MYSQL_PREFIX?}_%s` ".$where." ORDER BY `%s` ASC",
-                       array($id, $name, $table, $name), __FUNCTION__, __LINE__);
+                       array(
+                               $id,
+                               $name,
+                               $table,
+                               $name
+                       ), __FUNCTION__, __LINE__);
 
                // Do we have rows?
                if (SQL_NUMROWS($result) > 0) {
@@ -1569,13 +1561,13 @@ function generateOptionList ($table, $id, $name, $default='', $special='', $wher
                                if (!empty($add)) $add = ' ('.$add.')';
                                $ret .= '>' . $title . $add . '</option>';
                        } // END - while
-
-                       // Free memory
-                       SQL_FREERESULT($result);
                } else {
                        // No data found
                        $ret = '<option value="x">{--SELECT_NONE--}</option>';
                }
+
+               // Free memory
+               SQL_FREERESULT($result);
        }
 
        // Return - hopefully - the requested data