]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/admins_functions.php
Added more config wrappers
[mailer.git] / inc / libs / admins_functions.php
index 663c0ab399cf58ad406ec3804edd61eb1eecceee..beac76adc46fb8ca33bfba07566cf27db22dba00 100644 (file)
@@ -513,9 +513,12 @@ 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')",
-                       array($template), __FUNCTION__, __LINE__);
+               // Is ext-admins' version at least 0.7.9?
+               if (isExtensionInstalledAndNewer('admins', '0.7.9')) {
+                       // Create new entry (to all admins)
+                       SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admins_mails` (`admin_id`, `mail_template`) VALUES (NULL, '%s')",
+                               array($template), __FUNCTION__, __LINE__);
+               } // END - if
 
                // Select all email adresses (default)
                $result = SQL_QUERY('SELECT `email` FROM `{?_MYSQL_PREFIX?}_admins` ORDER BY `id` ASC',
@@ -551,6 +554,9 @@ function sendAdminsEmails ($subject, $template, $content, $userid) {
                                        $userid
                                ));
                        }
+
+                       // Abort here as below while() loop will cause problems
+                       return;
                } elseif (($adminId == '0') || (empty($adminId))) {
                        // Select all email adresses
                        $result = SQL_QUERY('SELECT `email` FROM `{?_MYSQL_PREFIX?}_admins` ORDER BY `id` ASC',
@@ -568,7 +574,7 @@ function sendAdminsEmails ($subject, $template, $content, $userid) {
        // Is the template a bug report?
        if ($template == 'admin_report_bug') {
                // Then set 'Reply-To:' again
-               $mailHeader = 'Reply-To: webmaster@mxchange.org' . chr(10);
+               $mailHeader = 'Reply-To: webmaster@mxchange.org' . PHP_EOL;
        } // END - if
 
        // Load email addresses and send away