Improve Email::getHost()
authorTim Düsterhus <duesterhus@woltlab.com>
Sun, 8 Jan 2017 16:33:10 +0000 (17:33 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Sun, 8 Jan 2017 16:33:10 +0000 (17:33 +0100)
Previously varying hostnames would be used in a multi domain setup.
Now the hostname of WoltLab Suite Core is used.

wcfsetup/install/files/lib/system/email/Email.class.php

index 230c7bc6139d2680babddbc208b4cc0187be1280..3cdda481349c754193af949795b28c34b3ed19d9 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\system\email;
+use wcf\system\application\ApplicationHandler;
 use wcf\system\background\job\AbstractBackgroundJob;
 use wcf\system\background\job\EmailDeliveryBackgroundJob;
 use wcf\system\background\BackgroundQueueHandler;
@@ -92,13 +93,7 @@ class Email {
         */
        public static function getHost() {
                if (self::$host === null) {
-                       self::$host = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : '';
-                       if (empty(self::$host)) {
-                               self::$host = gethostname();
-                               if (self::$host === false) {
-                                       self::$host = 'localhost';
-                               }
-                       }
+                       self::$host = ApplicationHandler::getInstance()->getApplication('wcf')->domainName;
                }
                
                return self::$host;