]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions-functions.php
addCreateTableSql() is now more encapsulated
[mailer.git] / inc / extensions-functions.php
index 87744d1744668cd13d2b7babaa79f6e906299b23..acd902dd788a096aca1f2cfdc8e4696518934133 100644 (file)
@@ -1756,11 +1756,16 @@ function isExtensionFunctionFileReadable ($ext_name) {
 }
 
 // Adds a CREATE TABLE statement if the requested table is not there
-function addCreateTableSql ($tableName, $sql) {
+function addCreateTableSql ($tableName, $sql, $comment) {
        // Is the table not there?
        if (!isSqlTableCreated($tableName)) {
                // Is not found, so add it
-               addExtensionSql('CREATE TABLE `{?_MYSQL_PREFIX?}_' . $tableName . '` ' . $sql);
+               addExtensionSql('CREATE TABLE
+       `{?_MYSQL_PREFIX?}_' . $tableName . '` (' . $sql . ')
+ENGINE = {?_TABLE_TYPE?}
+CHARACTER SET utf8
+COLLATE utf8_general_ci
+COMMENT ' . "'" . $comment . "'");
        } else {
                // Is already there, which should not happen
                debug_report_bug(__FUNCTION__, __LINE__, 'The table ' . $tableName . ' is already created which should not happen.');
@@ -1813,27 +1818,23 @@ function addAdminMenuSql ($action, $what, $title, $descr, $sort) {
 }
 
 // Adds a guest menu to the SQL queue if the menu entry is not found
-function addGuestMenuSql ($action, $what, $title, $visible, $locked, $sort) {
+function addGuestMenuSql ($action, $what, $title, $sort) {
        // Now check if this menu is there
        if (!isMenuActionValid('guest', $action, $what)) {
                // Is what null?
                if (is_null($what)) {
                        // Add main menu
-                       $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES('%s',NULL,'%s','%s','%s',%s)",
+                       $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES('%s',NULL,'%s','N','Y',%s)",
                                $action,
                                $title,
-                               $visible,
-                               $locked,
                                bigintval($sort)
                        );
                } else {
                        // Add sub menu
-                       $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES('%s','%s','%s','%s','%s',%s)",
+                       $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES('%s','%s','%s','N','Y',%s)",
                                $action,
                                $what,
                                $title,
-                               $visible,
-                               $locked,
                                bigintval($sort)
                        );
                }
@@ -1847,27 +1848,23 @@ function addGuestMenuSql ($action, $what, $title, $visible, $locked, $sort) {
 }
 
 // Adds a member menu to the SQL queue if the menu entry is not found
-function addMemberMenuSql ($action, $what, $title, $visible, $locked, $sort) {
+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','%s','%s',%s)",
+                       $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES('%s',NULL,'%s','N','Y',%s)",
                                $action,
                                $title,
-                               $visible,
-                               $locked,
                                bigintval($sort)
                        );
                } else {
                        // Add sub menu
-                       $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES('%s','%s','%s','%s','%s',%s)",
+                       $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES('%s','%s','%s','N','Y',%s)",
                                $action,
                                $what,
                                $title,
-                               $visible,
-                               $locked,
                                bigintval($sort)
                        );
                }