- $OUT .= "</NOBR></td>
-</tr>\n";
- $result_what = SQL_QUERY_ESC("SELECT what, title, descr FROM `{!_MYSQL_PREFIX!}_admin_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`, id DESC",
- array($menu), __FILE__, __LINE__);
- if ((SQL_NUMROWS($result_what) > 0) && ($act == $menu))
- {
- $menuDesription = array();
- $menuTitle = array(); $SUB = true;
- $OUT .= "<tr>
- <td width=\"10\" class=\"seperator\"> </td>
- <td class=\"admin_menu\">
- <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"admin_menu_sub\">\n";
- while (list($wht_sub, $title_what, $desc_what) = SQL_FETCHROW($result_what)) {
- // Filename
- $INC = sprintf("%sinc/modules/admin/what-%s.php", constant('PATH'), $wht_sub);
- if ((EXT_IS_ACTIVE("admins")) && (GET_EXT_VERSION("admins") > "0.2")) {
- $ACL = ADMINS_CHECK_ACL("", $wht_sub);
+
+ $OUT .= "</div>
+</li>\n";
+
+ // Check for menu entries
+ $result_what = SQL_QUERY_ESC("SELECT
+ `what`, `title`, `descr`
+FROM
+ `{?_MYSQL_PREFIX?}_admin_menu`
+WHERE
+ `action`='%s' AND
+ `what` != '' AND
+ `what` IS NOT NULL
+ORDER BY
+ `sort` ASC,
+ `id` DESC",
+ array($menu), __FUNCTION__, __LINE__);
+
+ // Remember the count for later checks
+ setAdminMenuHasEntries($menu, ((SQL_NUMROWS($result_what) > 0) && ($action == $menu)));
+
+ // Do we have entries?
+ if ((ifAdminMenuHasEntries($menu)) && (SQL_NUMROWS($result_what) > 0)) {
+ $GLOBALS['menu']['description'] = array();
+ $GLOBALS['menu']['title'] = array(); $SUB = true;
+ $OUT .= "<li class=\"admin_menu_sub\"><ul class=\"admin_menu_sub\">\n";
+ // @TODO Rewrite this to $content = SQL_FETCHARRAY()
+ while (list($what_sub, $title_what, $desc_what) = SQL_FETCHROW($result_what)) {
+ // Check for access level
+ if ((isExtensionActive('admins')) && (getExtensionVersion('admins') > '0.2.0')) {
+ $ACL = adminsCheckAdminAcl('', $what_sub);