From d70a5ac6d7d0d64d45e6ca56f9bfcf623867a8a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ermal=20Lu=E7i?= Date: Fri, 26 Feb 2010 18:27:55 +0000 Subject: Ticket #313. Search if the string to be replaced really exists instead of doing a blind replace. --- usr/local/www/wizard.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'usr/local/www') diff --git a/usr/local/www/wizard.php b/usr/local/www/wizard.php index 45302b3..f50d469 100755 --- a/usr/local/www/wizard.php +++ b/usr/local/www/wizard.php @@ -654,13 +654,19 @@ function fixup_string($string) { } } $myurl = $proto . "://" . $_SERVER['HTTP_HOST'] . $urlport . "/"; - $newstring = str_replace("\$myurl", $myurl, $newstring); + + if (strstr($newstring, "\$myurl")) + $newstring = str_replace("\$myurl", $myurl, $newstring); // fixup #2: $wanip - $curwanip = get_interface_ip(); - $newstring = str_replace("\$wanip", $curwanip, $newstring); + if (strstr($newstring, "\$wanip")) { + $curwanip = get_interface_ip(); + $newstring = str_replace("\$wanip", $curwanip, $newstring); + } // fixup #3: $lanip - $lanip = get_interface_ip("lan"); - $newstring = str_replace("\$lanip", $lanip, $newstring); + if (strstr($newstring, "\$lanip")) { + $lanip = get_interface_ip("lan"); + $newstring = str_replace("\$lanip", $lanip, $newstring); + } // fixup #4: fix'r'up here. return $newstring; } -- cgit v1.1