From 037304d866d5f9fab6a84a8d3a5499b44812f191 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sat, 22 Oct 2005 18:40:41 +0000 Subject: MFC 7049 Fix protocol detection for $myurl Stop $myurl from putting : in url when no alternate port is selected --- usr/local/www/wizard.php | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'usr/local') diff --git a/usr/local/www/wizard.php b/usr/local/www/wizard.php index 383f81d..faa980f 100755 --- a/usr/local/www/wizard.php +++ b/usr/local/www/wizard.php @@ -511,15 +511,28 @@ function fixup_string($string) { global $config, $myurl; $newstring = $string; // fixup #1: $myurl -> http[s]://ip_address:port/ - $https = ""; + switch($config['system']['webguiproto']) { + case "http": + $proto = "http"; + break; + case "https": + $proto = "https"; + break; + default: + $proto = "http"; + break; + } $port = $config['system']['webguiport']; - if($port <> "443" and $port <> "80") - $urlport = ":" . $port; - else - $urlport = ""; - if($config['system']['webguiproto'] == "https") - $https = "s"; - $myurl = "http" . $https . "://" . $config['interfaces']['lan']['ipaddr'] . $urlport; + if($port != "") { + if(($port == "443" and $proto != "https") or ($port == "80" and $proto != "http")) { + $urlport = ":" . $port; + } elseif ($port != "80" and $port != "443") { + $urlport = ":" . $port; + } else { + $urlport = ""; + } + } + $myurl = $proto . "://" . $config['interfaces']['lan']['ipaddr'] . $urlport . "/"; $newstring = str_replace("\$myurl", $myurl, $newstring); // fixup #2: $wanip $curwanip = get_current_wan_address(); @@ -535,4 +548,4 @@ function is_timezone($elt) { return !preg_match("/\/$/", $elt); } -?> \ No newline at end of file +?> -- cgit v1.1