summaryrefslogtreecommitdiff
path: root/Postman/PostmanUtils.php
diff options
context:
space:
mode:
authoryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2018-03-04 22:43:20 +0000
committeryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2018-03-04 22:43:20 +0000
commit4d764b4df29b9031e6e21036c8880703804b7e58 (patch)
tree194e4d3ee68d587caec49a4c4672d4c57c2303a0 /Postman/PostmanUtils.php
parent437ff5566028c456b39fd96ff988a649edd46063 (diff)
downloadPost-SMTP-4d764b4df29b9031e6e21036c8880703804b7e58.zip
* sendgrid 6
* mail params * email log send to column * hostname insted of ip in emails * remove mailgun test folder ( virustotal issue) * added filters to from_name and from_email filters (local connection) * change hostname extrect loginc
Diffstat (limited to 'Postman/PostmanUtils.php')
-rw-r--r--Postman/PostmanUtils.php18
1 files changed, 13 insertions, 5 deletions
diff --git a/Postman/PostmanUtils.php b/Postman/PostmanUtils.php
index fe7cbf4..059c9e0 100644
--- a/Postman/PostmanUtils.php
+++ b/Postman/PostmanUtils.php
@@ -431,7 +431,7 @@ class PostmanUtils {
}
}
- public static function getServerIp() {
+ public static function getServerName() {
$ip = '';
if ( strpos( $_SERVER['SERVER_SOFTWARE'], 'iis' ) !== false ) {
@@ -442,13 +442,21 @@ class PostmanUtils {
$ip = $_SERVER['SERVER_ADDR'];
}
- $serverIp = filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 );
+ if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) ) {
+ $host = gethostbyaddr( $ip );
+ }
- if ( ! $serverIp ) {
- $serverIp = filter_var( gethostbyname( $_SERVER['SERVER_NAME'] ), FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 );
+ if ( $host == $ip || $host == false ) {
+ $host = filter_var( $_SERVER['HTTP_HOST'], FILTER_SANITIZE_STRING );
}
- return $serverIp ? $serverIp : 'localhost';
+ return $host ? $host : 'localhost';
+ }
+
+ public static function getHost( $url ) {
+ $host = parse_url( trim( $url ), PHP_URL_HOST );
+
+ return str_replace('www.', '', $host );
}
}
PostmanUtils::staticInit();