NobGit
public nobgit read

NobMail

Based on mailcow: dockerized

Languages

Repository composition by tracked source files.

PHP
PHP 49% JavaScript 35% HTML 9% CSS 4% Shell 2% Python 1% Lua 0% Perl 0% Ruby 0% SCSS 0%
Create file Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git

Commit

[Web] Replace rtrim by preg_replace to fix transport checks

4ea843f0
andryyy <[email protected]> 6 years ago
data/web/inc/ajax/transport_check.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Diff

diff --git a/data/web/inc/ajax/transport_check.php b/data/web/inc/ajax/transport_check.php
index da8c8e6c..5183f67a 100644
--- a/data/web/inc/ajax/transport_check.php
+++ b/data/web/inc/ajax/transport_check.php
@@ -31,7 +31,7 @@ if (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == "admi
     // Explode to hostname and port
     if ($has_bracket_and_port) {
       $port = substr($hostname_w_port, strrpos($hostname_w_port, ':') + 1);
-      $hostname = rtrim($hostname_w_port, ':' . $port);
+      $hostname = preg_replace('/'. preg_quote(':' . $port, '/') . '$/', '', $hostname_w_port);
       if (filter_var($hostname, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
         $hostname = '[' . $hostname . ']:';
       }
@@ -39,7 +39,7 @@ if (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == "admi
     else {
       if ($is_ipv4_and_has_port) {
         $port = substr($hostname_w_port, strrpos($hostname_w_port, ':') + 1);
-        $hostname = rtrim($hostname_w_port, ':' . $port);
+        $hostname = preg_replace('/'. preg_quote(':' . $port, '/') . '$/', '', $hostname_w_port);
       }
       if (filter_var($hostname_w_port, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
         $hostname = $hostname_w_port;
@@ -51,7 +51,7 @@ if (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == "admi
       }
       else {
         $port = substr($hostname_w_port, strrpos($hostname_w_port, ':') + 1);
-        $hostname = rtrim($hostname_w_port, ':' . $port);
+        $hostname = preg_replace('/'. preg_quote(':' . $port, '/') . '$/', '', $hostname_w_port);
       }
     }
     // Try to get MX if host is not [host]