Full rewrite of extension updates (multiple updates are supported)
[mailer.git] / inc / modules / admin / admin-inc.php
index 024b3f2e5d390cf3dcdf4ec7f03a9cd7526200a2..5cdf0371c1d472de0ce2b4ed16758cbd35ca6410 100644 (file)
@@ -379,7 +379,12 @@ function ADD_ADMIN_MENU ($act, $wht, $return=false) {
                                // 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`, id DESC",
                                        array($menu), __FUNCTION__, __LINE__);
-                               if ((SQL_NUMROWS($result_what) > 0) && ($act == $menu)) {
+
+                               // Remember the count for later checks
+                               setAdminMenuHasEntries($menu, ((SQL_NUMROWS($result_what) > 0) && ($act == $menu)));
+
+                               // Do we have entries?
+                               if (ifAdminMenuHasEntries($menu)) {
                                        $GLOBALS['menu']['description'] = array();
                                        $GLOBALS['menu']['title'] = array(); $SUB = true;
                                        $OUT .= "<tr>
@@ -1274,5 +1279,24 @@ function ADMIN_UPDATE_TASK_DATA ($id, $row, $data) {
        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_task_system` SET %s='%s' WHERE id=%s LIMIT 1",
                array($row, $data, bigintval($id)), __FUNCTION__, __LINE__);
 }
+
+// Checks wether if the admin menu has entries
+function ifAdminMenuHasEntries ($action) {
+       return (
+               ((
+                       isset($GLOBALS['admin_menu_has_entries'][$action])
+               ) && (
+                       $GLOBALS['admin_menu_has_entries'][$action] === true
+               )) || (
+                       $action == "login"
+               )
+       );
+}
+
+// Setter for 'admin_menu_has_entries'
+function setAdminMenuHasEntries ($action, $hasEntries) {
+       $GLOBALS['admin_menu_has_entries'][$action] = (bool) $hasEntries;
+}
+
 //
 ?>