Ticket #114: multiple_port.patch

File multiple_port.patch, 0.8 kB (added by michaeltwofish, 12 months ago)
  • system/classes/site.php

     
    134134                    $port= $_SERVER['SERVER_PORT']; 
    135135                } 
    136136                $portpart= ''; 
    137                 if ( ( $port != 80 ) && ( $port != 443 ) ) { 
     137                $host= $_SERVER['HTTP_HOST']; 
     138                // if the port isn't a standard port, and isn't part of $host already, add it 
     139                if ( ( $port != 80 ) && ( $port != 443 ) && ( substr($host, strlen($host) - strlen($port) ) != $port ) ) { 
    138140                    $portpart= ':' . $port; 
    139141                } 
    140142                if ( isset( $_SERVER['HTTPS'] ) ) { 
    141143                    $protocol= 'https'; 
    142144                } 
    143                 $url= $protocol . '://' . $_SERVER['HTTP_HOST'] . $portpart; 
     145                $url= $protocol . '://' . $host . $portpart; 
    144146                break; 
    145147            case 'habari': 
    146148                $url= Site::get_url( 'host' );