- // By default list menus
- if (!empty($SUB))
- {
- // Sub menus of a main menu
- $result = SQL_QUERY_ESC("SELECT id, action, what, title, sort FROM "._MYSQL_PREFIX."_admin_menu WHERE action='%s' AND what != '' ORDER BY sort ASC",
- array($SUB), __FILE__, __LINE__);
- }
- else
- {
- // Main menus
- $result = SQL_QUERY("SELECT id, action, what, title, sort FROM "._MYSQL_PREFIX."_admin_menu WHERE what='' ORDER BY sort ASC", __FILE__, __LINE__);
- }
- $max = SQL_NUMROWS($result);
- if ($max > 0)
- {
- define('__SUB_VALUE', $SUB);
- $SW = 2; $cnt = 0; $OUT = "";
- while (list($id, $act, $wht, $title, $sort) = SQL_FETCHROW($result))
- {
+ // Run SQL
+ $result = SQL_QUERY("SELECT id, action, what, title, sort FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$AND." ORDER BY `sort` ASC", __FILE__, __LINE__);
+
+ // Do we have entries?
+ if (SQL_NUMROWS($result) > 0) {
+ // Remember sub value
+ $content['sub'] = $SUB;
+
+ // Init variables
+ $OUT = ''; $cnt = '0';
+
+ // Process all entries
+ while ($data = SQL_FETCHARRAY($result)) {
+ // Count this entry