Mailer fixed, ext-admins improved:
authorRoland Häder <roland@mxchange.org>
Sat, 3 Nov 2012 14:18:33 +0000 (14:18 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 3 Nov 2012 14:18:33 +0000 (14:18 +0000)
- In Table 'mailer_admins_mails' the column 'admin_id' is now default NULL, not 0
- Purged old admin mail template names from same table
- Possible fix for bug #237 (please test it)
- Other minor improvement: column names always in back-ticks (`)

inc/extensions/ext-admins.php
inc/libs/admins_functions.php
inc/modules/admin/what-admins_mails.php
inc/purge/purge-inact.php

index 186f37aef148983b3d4b300183ec605ddbafd77e..298bd4ec84a1fdfb7f225eac1a3b9ec973e78166 100644 (file)
@@ -41,10 +41,10 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Version of this extension
-setThisExtensionVersion('0.7.8');
+setThisExtensionVersion('0.7.9');
 
 // Version history array (add more with , '0.0.1' and so on)
-setExtensionVersionHistory(array('0.0.0', '0.1.0', '0.2.0', '0.3.0', '0.3.1', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1', '0.6.2', '0.6.3', '0.6.4', '0.6.5', '0.6.6', '0.6.7', '0.6.8', '0.6.9', '0.7.0', '0.7.1', '0.7.2', '0.7.3', '0.7.4', '0.7.5', '0.7.6', '0.7.7', '0.7.8'));
+setExtensionVersionHistory(array('0.0.0', '0.1.0', '0.2.0', '0.3.0', '0.3.1', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1', '0.6.2', '0.6.3', '0.6.4', '0.6.5', '0.6.6', '0.6.7', '0.6.8', '0.6.9', '0.7.0', '0.7.1', '0.7.2', '0.7.3', '0.7.4', '0.7.5', '0.7.6', '0.7.7', '0.7.8', '0.7.9'));
 
 // Keep this extension always active!
 setExtensionAlwaysActive('Y');
@@ -125,7 +125,7 @@ INDEX (`admin_id`)",
                                addDropTableSql('admins_mails');
                                addCreateTableSql('admins_mails', "
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-`admin_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`admin_id` BIGINT(20) UNSIGNED NULL DEFAULT NULL,
 `mail_template` VARCHAR(255) NOT NULL,
 PRIMARY KEY (`id`),
 INDEX (`admin_id`)",
@@ -354,6 +354,15 @@ INDEX (`admin_id`)",
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Abgek&uuml;rzte Bezeichnungen k&ouml;nnen f&uuml;r Missverst&auml;ndnisse am Code sorgen. Daher wurde der Spaltenalias <strong>def_acl</strong> entfernt.");
                                break;
+
+                       case '0.7.9': // SQL queries for v0.7.9
+                               addExtensionChangeTableColumnSql('admins_mails', 'admin_id', 'admin_id', 'BIGINT(20) UNSIGNED NULL DEFAULT NULL');
+                               addExtensionSql('UPDATE `{?_MYSQL_PREFIX?}_admins_mails` SET `admin_id` = NULL WHERE `admin_id`=0');
+                               addExtensionSql("DELETE `{?_MYSQL_PREFIX?}_admins_mails` WHERE `mail_template` IN ('admin-del_links', 'back-admin', 'done-admin', 'order-admin', 'register-admin')");
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Spalte <strong>admin_id</strong> ist jetzt Ausgangswert NULL, alte Mail-Templates bereinigt.");
+                               break;
                } // END - switch
                break;
 
index 663c0ab399cf58ad406ec3804edd61eb1eecceee..955748eb9ae454f78e48e5a91bf0343edbfcc6a6 100644 (file)
@@ -514,7 +514,7 @@ function sendAdminsEmails ($subject, $template, $content, $userid) {
        // No entries found?
        if (SQL_HASZERONUMS($result)) {
                // Create new entry (to all admins)
-               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admins_mails` (`admin_id`, `mail_template`) VALUES (0, '%s')",
+               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admins_mails` (`admin_id`, `mail_template`) VALUES (NULL, '%s')",
                        array($template), __FUNCTION__, __LINE__);
 
                // Select all email adresses (default)
index 4644c76cf81b7ad33bd6ad7289e27695eb6a4ce5..c0314f3313cdfd2059be97a0ada72550c53fe54a 100644 (file)
@@ -108,18 +108,21 @@ if (isFormSent('edit')) {
 } else {
        // Load all assigned mails
        $result = SQL_QUERY("SELECT
-       m.id, m.admin_id, a.login, m.mail_template
+       m.`id`,
+       m.`admin_id`,
+       a.`login`,
+       m.`mail_template`
 FROM
-       `{?_MYSQL_PREFIX?}_admins_mails` AS m
+       `{?_MYSQL_PREFIX?}_admins_mails` AS `m`
 LEFT JOIN
-       `{?_MYSQL_PREFIX?}_admins` AS a
+       `{?_MYSQL_PREFIX?}_admins` AS `a`
 ON
-       m.admin_id=a.id
+       m.`admin_id`=a.`id`
 WHERE
-       (m.admin_id=a.id OR m.admin_id < 1) AND m.mail_template != ''
+       (m.`admin_id`=a.`id` OR m.`admin_id` < 1) AND m.`mail_template` != ''
 ORDER BY
-       m.admin_id ASC,
-       m.mail_template ASC", __FILE__, __LINE__);
+       m.`admin_id` ASC,
+       m.`mail_template` ASC", __FILE__, __LINE__);
 
        if (!SQL_HASZERONUMS($result)) {
                // Shall I change entries?
index 5cf054fc1053aae204348ceddd63fe6f4ee3029d..cd66947b06077a5fd4950bb17f8380dec482c806 100644 (file)
@@ -111,10 +111,10 @@ ORDER BY
                } // END - while
 
                // Remove last comma
-               $useridsContent = implode(chr(10), $userids);
+               $content['userids'] = implode(chr(10), $userids);
 
                // Send mail notification to admin
-               sendAdminNotification('{--ADMIN_AUTOPURGE_INACTIVE_SUBJECT--}', 'admin_autopurge_inactive', $useridsContent);
+               sendAdminNotification('{--ADMIN_AUTOPURGE_INACTIVE_SUBJECT--}', 'admin_autopurge_inactive', $content);
        } // END - if
 
        // Free memory