+
+ // Add it to the queue
+ addExtensionSql($sql);
+ } elseif (isDebugModeEnabled()) {
+ // Double menus should be located and fixed!
+ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Double guest menu action=%s,what=%s,title=%s,locked=%s,visible=%s detected.", $action, $what, $title, $locked, $visible));
+ }
+}
+
+// Adds a member menu to the SQL queue if the menu entry is not found
+function addMemberMenuSql ($action, $what, $title, $sort) {
+ // Now check if this menu is there
+ if (!isMenuActionValid('member', $action, $what)) {
+ // Is what null?
+ if (is_null($what)) {
+ // Add main menu
+ $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES('%s',NULL,'%s','N','Y',%s)",
+ $action,
+ $title,
+ bigintval($sort)
+ );
+ } else {
+ // Add sub menu
+ $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES('%s','%s','%s','N','Y',%s)",
+ $action,
+ $what,
+ $title,
+ bigintval($sort)
+ );
+ }
+
+ // Add it to the queue
+ addExtensionSql($sql);
+ } elseif (isDebugModeEnabled()) {
+ // Double menus should be located and fixed!
+ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Double member menu action=%s,what=%s,title=%s,visivle=%s,locked=%s detected.", $action, $what, $title, $visible, $locked));
+ }
+}
+
+// Adds a sponsor menu to the SQL queue if the menu entry is not found
+function addSponsorMenuSql ($action, $what, $title, $active, $sort) {
+ // Now check if this menu is there, if no ext-sponsor is installed all is not yet added
+ if ((!isExtensionInstalled('sponsor')) || (!isMenuActionValid('sponsor', $action, $what))) {
+ // Is what null?
+ if (is_null($what)) {
+ // Add main menu
+ $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_sponsor_menu` (`action`,`what`,`title`,`active`,`sort`) VALUES('%s',NULL,'%s','%s',%s)",
+ $action,
+ $title,
+ $active,
+ bigintval($sort)
+ );
+ } else {
+ // Add sub menu
+ $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_sponsor_menu` (`action`,`what`,`title`,`active`,`sort`) VALUES('%s','%s','%s','%s',%s)",
+ $action,
+ $what,
+ $title,
+ $active,
+ bigintval($sort)
+ );
+ }
+
+ // Add it to the queue
+ addExtensionSql($sql);
+ } elseif (isDebugModeEnabled()) {
+ // Double menus should be located and fixed!
+ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Double sponsor menu action=%s,what=%s,title=%s,active=%s detected.", $action, $what, $title, $active));
+ }
+}
+
+// Add configuration entry if not found for actual extension
+function addConfigAddSql ($columnName, $columnSql) {
+ // Is the column there?
+ if (!isSqlTableColumnFound('{?_MYSQL_PREFIX?}_config', $columnName)) {
+ // Not found, so add it
+ addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `' . $columnName . '` ' . $columnSql);
+ } elseif (isDebugModeEnabled()) {
+ // Add debug line
+ logDebugMessage(__FUNCTION__, __LINE__, 'Configuration entry ' . $columnName . ' already created. columnSql=' . $columnSql);
+ }
+}
+
+// Drop configuration entry if found for actual extension
+function addConfigDropSql ($columnName) {
+ // Is the column there?
+ if (isSqlTableColumnFound('{?_MYSQL_PREFIX?}_config', $columnName)) {
+ // Found, so add it
+ addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `' . $columnName . '`');
+ } elseif (isDebugModeEnabled()) {
+ // Add debug line, debug_report_bug() would cause some extenion updates fail
+ logDebugMessage(__FUNCTION__, __LINE__, 'Configuration entry ' . $columnName . ' not found.');