tbrehm
2013-04-17 e6a2917b9de293e735df5dbf0b10dce967185f45
Fix in ispconfig url detection function when nginx returns '_' as $_SERVER['SERVER_NAME']
1 files modified
17 ■■■■ changed files
interface/lib/classes/functions.inc.php 17 ●●●● patch | view | raw | blame | history
interface/lib/classes/functions.inc.php
@@ -130,10 +130,21 @@
    }
    
    public function get_ispconfig_url() {
        global $app;
        $url = (stristr($_SERVER['SERVER_PROTOCOL'],'HTTPS') || stristr($_SERVER['HTTPS'],'on'))?'https':'http';
        $url .= '://'.$_SERVER['SERVER_NAME'];
        if($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
            $url .= ':'.$_SERVER['SERVER_PORT'];
        if($_SERVER['SERVER_NAME'] != '_') {
            $url .= '://'.$_SERVER['SERVER_NAME'];
            if($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
                $url .= ':'.$_SERVER['SERVER_PORT'];
            }
        } else {
            $app->uses("getconf");
            $server_config = $app->getconf->get_server_config(1,'server');
            $url .= '://'.$server_config['hostname'];
            if($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
                $url .= ':'.$_SERVER['SERVER_PORT'];
            }
        }
        return $url;
    }