function fixup_string($string) { global $config, $g, $myurl, $title; $newstring = $string; // fixup #1: $myurl -> http[s]://ip_address:port/ switch ($config['system']['webgui']['protocol']) { case "http": $proto = "http"; break; case "https": $proto = "https"; break; default: $proto = "http"; break; } $port = $config['system']['webgui']['port']; 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 = ""; } } $http_host = explode(":", $_SERVER['HTTP_HOST']); $http_host = $http_host[0]; $urlhost = $http_host; // If finishing the setup wizard, check if accessing on a LAN or WAN address that changed if ($title == "Reload in progress") { if (is_ipaddr($urlhost)) { $host_if = find_ip_interface($urlhost); if ($host_if) { $host_if = convert_real_interface_to_friendly_interface_name($host_if); if ($host_if && is_ipaddr($config['interfaces'][$host_if]['ipaddr'])) { $urlhost = $config['interfaces'][$host_if]['ipaddr']; } } } else { if ($urlhost == $config['system']['hostname']) { $urlhost = $config['wizardtemp']['system']['hostname']; } else { if ($urlhost == $config['system']['hostname'] . '.' . $config['system']['domain']) { $urlhost = $config['wizardtemp']['system']['hostname'] . '.' . $config['wizardtemp']['system']['domain']; } } } } if ($urlhost != $http_host) { file_put_contents("{$g['tmp_path']}/setupwizard_lastreferrer", $proto . "://" . $http_host . $urlport . $_SERVER['REQUEST_URI']); } $myurl = $proto . "://" . $urlhost . $urlport . "/"; if (strstr($newstring, "\$myurl")) { $newstring = str_replace("\$myurl", $myurl, $newstring); } // fixup #2: $wanip if (strstr($newstring, "\$wanip")) { $curwanip = get_interface_ip(); $newstring = str_replace("\$wanip", $curwanip, $newstring); } // fixup #3: $lanip if (strstr($newstring, "\$lanip")) { $lanip = get_interface_ip("lan"); $newstring = str_replace("\$lanip", $lanip, $newstring); } // fixup #4: fix'r'up here. return $newstring; }
</td> <td class="list"> <?php $source = ""; $ip_interface = null; $ip_alias = null; if ($ph2ent['localid']['type'] == 'lan') { $source = get_interface_ip('lan'); } else { if ($ph2ent['localid']['type'] == 'network') { $ip_interface = find_ip_interface($ph2ent['localid']['address'], $ph2ent['localid']['netbits']); if (!$ip_interface) { $ip_alias = find_virtual_ip_alias($ph2ent['localid']['address'], $ph2ent['localid']['netbits']); } } else { $ip_interface = find_ip_interface($ph2ent['localid']['address']); if (!$ip_interface) { $ip_alias = find_virtual_ip_alias($ph2ent['localid']['address']); } } } if ($ip_interface) { $source = get_interface_ip($ip_interface); } else { if ($ip_alias) { $source = $ip_alias['subnet']; } } ?> <?php if ($ph2ent['remoteid']['type'] != "mobile" && $icon != "pass" && $source != "") {