diff options
author | yehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664> | 2018-04-17 05:33:53 +0000 |
---|---|---|
committer | yehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664> | 2018-04-17 05:33:53 +0000 |
commit | a09ee0623a67f6e8596929cb008e6c91e31a713f (patch) | |
tree | 355ab4b11a9f637e441bc17a59c35be497c0613a /Postman/PostmanUtils.php | |
parent | 62b95f35576ea9b9178b900f9480fed0466211a2 (diff) | |
download | Post-SMTP-a09ee0623a67f6e8596929cb008e6c91e31a713f.zip |
* Gmail attahments
* Server name loginc (phpmailer)
* Slack notification field bug
Diffstat (limited to 'Postman/PostmanUtils.php')
-rw-r--r-- | Postman/PostmanUtils.php | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/Postman/PostmanUtils.php b/Postman/PostmanUtils.php index ed5864e..b70b2b8 100644 --- a/Postman/PostmanUtils.php +++ b/Postman/PostmanUtils.php @@ -439,25 +439,17 @@ class PostmanUtils { } public static function getServerName() { - $ip = ''; - - if ( strpos( $_SERVER['SERVER_SOFTWARE'], 'iis' ) !== false ) { - $ip = $_SERVER['LOCAL_ADDR']; - } - - if ( empty( $ip ) ) { - $ip = $_SERVER['SERVER_ADDR']; - } - - if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) ) { - $host = gethostbyaddr( $ip ); - } - - if ( $host == $ip || $host == false ) { - $host = filter_var( $_SERVER['HTTP_HOST'], FILTER_SANITIZE_STRING ); - } - - return $host ? $host : 'localhost'; + $result = 'localhost.localdomain'; + + if (isset($_SERVER) and array_key_exists('SERVER_NAME', $_SERVER)) { + $result = $_SERVER['SERVER_NAME']; + } elseif (function_exists('gethostname') and gethostname() !== false) { + $result = gethostname(); + } elseif (php_uname('n') !== false) { + $result = php_uname('n'); + } + + return $result; } public static function getHost( $url ) { |