Fixed issues #17188: [reports] change status update task to use the new default From...
authorIngo Renner <ingo.renner@typo3.org>
Fri, 21 Jan 2011 10:23:45 +0000 (10:23 +0000)
committerIngo Renner <ingo.renner@typo3.org>
Fri, 21 Jan 2011 10:23:45 +0000 (10:23 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@10197 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/reports/ChangeLog
typo3/sysext/reports/tasks/class.tx_reports_tasks_systemstatusupdatetask.php

index 4d6e00b..9bbeba7 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,10 @@
        * Fixed bug #17120: Problem with the integration of third-party trees (Thanks to Stefan Galinksi)
        * Follow-up to issue #11103: Cleanup of _.htaccess and references to misc/advanced.htaccess in config_default
 
+2011-01-21  Ingo Renner  <ingo@typo3.org>
+
+       * Fixed issues #17188: [reports] change status update task to use the new default From email address setting from config_default
+
 2011-01-21  Francois Suter  <francois.suter@typo3.org>
 
        * Fixed bug #17024: CSH not rendered properly in select-type fields with renderMode = checkbox
index 1f0bf9d..caaadee 100644 (file)
@@ -1,3 +1,7 @@
+2011-01-21  Ingo Renner  <ingo@typo3.org>
+
+       * Fixed issues #17188: change status update task to use the new default From email address setting from config_default
+
 2011-01-18  Ingo Renner  <ingo@typo3.org>
 
        * Added feature #17101: Warning in reports module for enabled PHP safe_mode, credits Christian Kuhn
index 8a772ed..ae1f12f 100644 (file)
@@ -128,36 +128,55 @@ class tx_reports_tasks_SystemStatusUpdateTask extends tx_scheduler_Task {
        }
 
        /**
-        * Tries to generate an email address to use for the From field.
+        * Tries to find an email address to use for the From email header.
+        *
+        * Uses a fall back chain:
+        *     Install Tool ->
+        *     no-reply@FirstDomainRecordFound ->
+        *     no-reply@php_uname('n')
         *
         * @return      string  email address
         */
        protected function getFromAddress() {
-               $user = 'no-reply';
-               $host = php_uname('n');
-
-                       // just get us a domain record we can use
-               $domainRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
-                       'domainName',
-                       'sys_domain',
-                       'hidden = 0',
-                       '',
-                       'pid ASC, sorting ASC'
-               );
-
-               if (!empty($domainRecord['domainName'])) {
-                       $tempUrl = $domainRecord['domainName'];
+               $email = '';
+               $user  = 'no-reply';
+
+                       // default
+               $email = $GLOBALS['TYPO3_CONF_VARS']['SYS']['defaultMailFromAddress'];
+
+                       // find domain record
+               if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
+                               // just get us a domain record we can use
+                       $domainRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
+                               'domainName',
+                               'sys_domain',
+                               'hidden = 0',
+                               '',
+                               'pid ASC, sorting ASC'
+                       );
+
+                       if (!empty($domainRecord['domainName'])) {
+                               $tempUrl = $domainRecord['domainName'];
+
+                               if (!t3lib_div::isFirstPartOfStr($tempUrl, 'http')) {
+                                               // shouldn't be the case anyways, but you never know
+                                               // ... there're crazy people out there
+                                       $tempUrl = 'http://' .$tempUrl;
+                               }
 
-                       if (!t3lib_div::isFirstPartOfStr($tempUrl, 'http')) {
-                                       // shouldn't be the case anyways, but you never know
-                                       // ... there're crazy people out there
-                               $tempUrl = 'http://' .$tempUrl;
+                               $host = parse_url($tempUrl, PHP_URL_HOST);
                        }
 
-                       $host = parse_url($tempUrl, PHP_URL_HOST);
+                       $email = $user . '@' . $host;
+               }
+
+                       // uname
+               if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
+                       $host  = php_uname('n');
+                       $email = $user . '@' . $host;
                }
 
-               return $user . '@' . $host;
+               return $email;
        }
 }