]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions-functions.php
Several code cleanups:
[mailer.git] / inc / extensions-functions.php
index 430fd659b7eddd25d4a460f6fe03ce7873352d65..d1c46faf4268dd058cbff96565b9b3b3cff96954 100644 (file)
@@ -1020,7 +1020,7 @@ function createNewExtensionTask ($ext_name) {
        // Not installed and do we have created a task for the admin?
        if (($taskId == '0') && (!isExtensionInstalled($ext_name))) {
                // Set default message if ext-foo is missing
-               $message = getMaskedMessage('ADMIN_EXTENSION_TEXT_FILE_MISSING', $ext_name);
+               $message = '{%message,ADMIN_EXTENSION_TEXT_FILE_MISSING=' . $ext_name . '%}';
 
                // Template file
                $FQFN = sprintf("%stemplates/%s/html/ext/ext_%s.tpl",
@@ -1349,19 +1349,19 @@ function initExtensionRuningUpdates () {
 
 // Getter for EXT_UPDATE_DEPENDS flag
 function getExtensionUpdateDependencies () {
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "currName=".getCurrentExtensionName());
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName());
        return $GLOBALS['ext_update_depends'][getCurrentExtensionName()];
 }
 
 // Getter for next iterator depency
 function getExtensionUpdateDependenciesIterator () {
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "currName=".getCurrentExtensionName());
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName());
        return ($GLOBALS['ext_update_depends'][getCurrentExtensionName()][getExtensionUpdateIterator()]);
 }
 
 // Counter for extension update depencies
 function countExtensionUpdateDependencies () {
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "currName=".getCurrentExtensionName());
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName());
        return count($GLOBALS['ext_update_depends'][getCurrentExtensionName()]);
 }
 
@@ -1382,7 +1382,7 @@ function removeExtensionDependency ($ext_name) {
 
 // Init iterator for update depencies
 function initExtensionUpdateIterator () {
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "currName=".getCurrentExtensionName());
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName());
        $GLOBALS['ext_depend_iterator'][getCurrentExtensionName()] = '0';
 }
 
@@ -1392,13 +1392,13 @@ function getExtensionUpdateIterator () {
        if (!isset($GLOBALS['ext_depend_iterator'][getCurrentExtensionName()])) initExtensionUpdateIterator();
 
        // Return it
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "currName=".getCurrentExtensionName().'/'.$GLOBALS['ext_depend_iterator'][getCurrentExtensionName()]);
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName().'/'.$GLOBALS['ext_depend_iterator'][getCurrentExtensionName()]);
        return $GLOBALS['ext_depend_iterator'][getCurrentExtensionName()];
 }
 
 // Increments the update iterator
 function incrementExtensionUpdateIterator () {
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "currName=".getCurrentExtensionName());
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName());
        $GLOBALS['ext_depend_iterator'][getCurrentExtensionName()]++;
 }
 
@@ -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)
                        );
                }