diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-01-12 04:47:39 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-01-12 04:47:39 +0000 |
commit | d51f86e05d95089c7a7e0ebac305e6b750314cfa (patch) | |
tree | 6f60447892470cc3ecee99ac95f3a9bdd0c60877 /usr/local/www/pkg_edit.php | |
parent | a6e4adb3f9b2be6b3416a4e3ea1855af2655e2b2 (diff) | |
download | pfsense-d51f86e05d95089c7a7e0ebac305e6b750314cfa.zip pfsense-d51f86e05d95089c7a7e0ebac305e6b750314cfa.tar.gz |
Expand the usage of $myurl in wizard fields and pkg_edit
Diffstat (limited to 'usr/local/www/pkg_edit.php')
-rwxr-xr-x | usr/local/www/pkg_edit.php | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/usr/local/www/pkg_edit.php b/usr/local/www/pkg_edit.php index 37b0aa7..eb88a9d 100755 --- a/usr/local/www/pkg_edit.php +++ b/usr/local/www/pkg_edit.php @@ -210,7 +210,7 @@ $config = $config_tmp; <?php if(!$pkga['dontdisplayname']) { echo "<td width=\"22%\" class=\"vncellreq\">"; - echo $pkga['fielddescr']; + echo fixup_string($pkga['fielddescr']); echo "</td>"; } @@ -228,10 +228,10 @@ $config = $config_tmp; if($pkga['type'] == "input") { if($pkga['size']) $size = " size='" . $pkga['size'] . "' "; echo "<input " . $size . " name='" . $pkga['fieldname'] . "' value='" . $value . "'>\n"; - echo "<br>" . $pkga['description'] . "\n"; + echo "<br>" . fixup_string($pkga['description']) . "\n"; } else if($pkga['type'] == "password") { echo "<input type='password' " . $size . " name='" . $pkga['fieldname'] . "' value='" . $value . "'>\n"; - echo "<br>" . $pkga['description'] . "\n"; + echo "<br>" . fixup_string($pkga['description']) . "\n"; } else if($pkga['type'] == "select") { // XXX: TODO: set $selected $selected = ""; @@ -243,15 +243,15 @@ $config = $config_tmp; echo "\t<option name='" . $opt['name'] . "' value='" . $opt['value'] . "'" . $selected . ">" . $opt['name'] . "</option>\n"; } echo "</select>\n"; - echo "<br>" . $pkga['description'] . "\n"; + echo "<br>" . fixup_string($pkga['description']) . "\n"; } else if($pkga['type'] == "checkbox") { echo "<input type='checkbox' name='" . $pkga['fieldname'] . "' value='" . $value . "'>\n"; - echo "<br>" . $pkga['description'] . "\n"; + echo "<br>" . fixup_string($pkga['description']) . "\n"; } else if($pkga['type'] == "textarea") { if($pkga['rows']) $rows = " rows='" . $pkga['rows'] . "' "; if($pkga['cols']) $cols = " cols='" . $pkga['cols'] . "' "; echo "<textarea " . $rows . $cols . " name='" . $pkga['fieldname'] . "'>" . $value . "</textarea>\n"; - echo "<br>" . $pkga['description'] . "\n"; + echo "<br>" . fixup_string($pkga['description']) . "\n"; } else if($pkga['type'] == "interfaces_selection") { $size = ""; $multiple = ""; @@ -295,7 +295,7 @@ $config = $config_tmp; <tr> <?php foreach($pkga['rowhelper']['rowhelperfield'] as $rowhelper) { - echo "<td><b>" . $rowhelper['fielddescr'] . "</td>\n"; + echo "<td><b>" . fixup_string($rowhelper['fielddescr']) . "</td>\n"; } echo "</tr>"; echo "<tbody>"; @@ -443,4 +443,18 @@ function display_row($trc, $value, $fieldname, $type, $rowhelper) { } } +function fixup_string($string) { + // fixup #1: $myurl -> http[s]://ip_address:port/ + $https = ""; + $port = ""; + $urlport = ""; + $port = $config['system']['webguiport']; + if($port <> "443" and $port <> "80") $urlport = ":" . $port; + 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. + return $newstring; +} + ?>
\ No newline at end of file |