From: Roland Häder Date: Sat, 3 Nov 2012 14:18:33 +0000 (+0000) Subject: Mailer fixed, ext-admins improved: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=cecff3745a0f1176f28af9ffd539651b496655c8;p=mailer.git Mailer fixed, ext-admins improved: - 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 (`) --- diff --git a/inc/extensions/ext-admins.php b/inc/extensions/ext-admins.php index 186f37aef1..298bd4ec84 100644 --- a/inc/extensions/ext-admins.php +++ b/inc/extensions/ext-admins.php @@ -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ürzte Bezeichnungen können für Missverständnisse am Code sorgen. Daher wurde der Spaltenalias def_acl 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 admin_id ist jetzt Ausgangswert NULL, alte Mail-Templates bereinigt."); + break; } // END - switch break; diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index 663c0ab399..955748eb9a 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -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) diff --git a/inc/modules/admin/what-admins_mails.php b/inc/modules/admin/what-admins_mails.php index 4644c76cf8..c0314f3313 100644 --- a/inc/modules/admin/what-admins_mails.php +++ b/inc/modules/admin/what-admins_mails.php @@ -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? diff --git a/inc/purge/purge-inact.php b/inc/purge/purge-inact.php index 5cf054fc10..cd66947b06 100644 --- a/inc/purge/purge-inact.php +++ b/inc/purge/purge-inact.php @@ -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