diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-01-12 17:17:35 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-01-12 17:17:35 +0000 |
commit | d21337019d129a70daec96570f8357017a41a78e (patch) | |
tree | 49c27d11d7ff4f3d97113494b31b6af59dd38b87 /usr | |
parent | d51f86e05d95089c7a7e0ebac305e6b750314cfa (diff) | |
download | pfsense-d21337019d129a70daec96570f8357017a41a78e.zip pfsense-d21337019d129a70daec96570f8357017a41a78e.tar.gz |
Add variable substitutions: $wanip, $lanip to wizard and pkg_edit facilities.
Diffstat (limited to 'usr')
-rwxr-xr-x | usr/local/www/pkg_edit.php | 13 | ||||
-rwxr-xr-x | usr/local/www/wizard.php | 13 |
2 files changed, 24 insertions, 2 deletions
diff --git a/usr/local/www/pkg_edit.php b/usr/local/www/pkg_edit.php index eb88a9d..fe95a3a 100755 --- a/usr/local/www/pkg_edit.php +++ b/usr/local/www/pkg_edit.php @@ -444,6 +444,7 @@ function display_row($trc, $value, $fieldname, $type, $rowhelper) { } function fixup_string($string) { + global $config; // fixup #1: $myurl -> http[s]://ip_address:port/ $https = ""; $port = ""; @@ -453,7 +454,17 @@ function fixup_string($string) { if($config['system']['webguiproto'] == "https") $https = "s"; $myurl = "http" . $https . "://" . getenv("HTTP_HOST") . $urlportport; $newstring = str_replace("\$myurl", $myurl, $string); - // fixup #2: fix'er'up here. + $string = $newstring; + // fixup #2: $wanip + $curwanip = get_current_wan_address(); + $newstring = str_replace("\$wanip", $curwanip, $string); + $string = $newstring; + // fixup #3: $lanip + $lancfg = $config['interfaces']['lan']; + $lanip = $lancfg['ipaddr']; + $newstring = str_replace("\$lanip", $lanip, $string); + $string = $newstring; + // fixup #4: fix'r'up here. return $newstring; } diff --git a/usr/local/www/wizard.php b/usr/local/www/wizard.php index 79febf8..3b375b9 100755 --- a/usr/local/www/wizard.php +++ b/usr/local/www/wizard.php @@ -331,6 +331,7 @@ if($pkg['step'][$stepid]['javascriptafterformdisplay'] <> "") { */ function fixup_string($string) { + global $config; // fixup #1: $myurl -> http[s]://ip_address:port/ $https = ""; $port = ""; @@ -340,7 +341,17 @@ function fixup_string($string) { if($config['system']['webguiproto'] == "https") $https = "s"; $myurl = "http" . $https . "://" . getenv("HTTP_HOST") . $urlportport; $newstring = str_replace("\$myurl", $myurl, $string); - // fixup #2: fix'er'up here. + $string = $newstring; + // fixup #2: $wanip + $curwanip = get_current_wan_address(); + $newstring = str_replace("\$wanip", $curwanip, $string); + $string = $newstring; + // fixup #3: $lanip + $lancfg = $config['interfaces']['lan']; + $lanip = $lancfg['ipaddr']; + $newstring = str_replace("\$lanip", $lanip, $string); + $string = $newstring; + // fixup #4: fix'r'up here. return $newstring; } |