// 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;
// 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) {
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