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 | |
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')
-rwxr-xr-x | usr/local/www/pkg_edit.php | 28 | ||||
-rwxr-xr-x | usr/local/www/wizard.php | 34 | ||||
-rw-r--r-- | usr/local/www/wizards/setup_wizard.xml | 2 |
3 files changed, 49 insertions, 15 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 diff --git a/usr/local/www/wizard.php b/usr/local/www/wizard.php index 86306b5..79febf8 100755 --- a/usr/local/www/wizard.php +++ b/usr/local/www/wizard.php @@ -132,15 +132,16 @@ if($pkg['step'][$stepid]['stepbeforeformdisplay'] <> "") { <br> -<img src="/logo.gif"><p> +<a href="http://<?= getenv("HTTP_HOST") ?>"><img border="0" src="/logo.gif"></a> +<p> <table width="600" cellspacing="0" cellpadding="3"> <!-- wizard goes here --> <tr><td> </td></tr> - <tr><td colspan='2'><center><b><?= $description ?></b></center></td></tr><tr><td> </td></tr> + <tr><td colspan='2'><center><b><?= fixup_string($description) ?></b></center></td></tr><tr><td> </td></tr> <?php if(!$pkg['step'][$stepid]['disableheader']) - echo "<tr><td colspan=\"2\" class=\"listtopic\">" . $title . "</td></tr>"; + echo "<tr><td colspan=\"2\" class=\"listtopic\">" . fixup_string($title) . "</td></tr>"; ?> <?php @@ -175,7 +176,7 @@ if($pkg['step'][$stepid]['stepbeforeformdisplay'] <> "") { if ($field['type'] == "input") { if(!$field['dontdisplayname']) { echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; - echo $field['name']; + echo fixup_string($field['name']); echo ":</td>\n"; } if(!$field['dontcombinecells']) @@ -184,7 +185,7 @@ if($pkg['step'][$stepid]['stepbeforeformdisplay'] <> "") { } else if ($field['type'] == "password") { if(!$field['dontdisplayname']) { echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; - echo $field['name']; + echo fixup_string($field['name']); echo ":</td>\n"; } if(!$field['dontcombinecells']) @@ -193,7 +194,7 @@ if($pkg['step'][$stepid]['stepbeforeformdisplay'] <> "") { } else if ($field['type'] == "select") { if(!$field['dontdisplayname']) { echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; - echo $field['name']; + echo fixup_string($field['name']); echo ":</td>\n"; } // XXX: TODO: set $selected @@ -217,7 +218,7 @@ if($pkg['step'][$stepid]['stepbeforeformdisplay'] <> "") { } else if ($field['type'] == "textarea") { if(!$field['dontdisplayname']) { echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; - echo $field['name']; + echo fixup_string($field['name']); echo ":</td>"; } if(!$field['dontcombinecells']) @@ -325,4 +326,23 @@ if($pkg['step'][$stepid]['javascriptafterformdisplay'] <> "") { echo "</script>\n\n"; } +/* + * HELPER FUNCTIONS + */ + +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; +} + ?> + diff --git a/usr/local/www/wizards/setup_wizard.xml b/usr/local/www/wizards/setup_wizard.xml index 3148d80..1030dc8 100644 --- a/usr/local/www/wizards/setup_wizard.xml +++ b/usr/local/www/wizards/setup_wizard.xml @@ -2463,7 +2463,7 @@ <step> <id>8</id> <title>Reboot in progress</title> - <description>A reboot is now in progress. Please wait.</description> + <description>A reboot is now in progress. Please wait. <p> The system will automatically try to access $myurl in 120 seconds. <p> You can click on the icon above to access the site quicker. <meta http-equiv="refresh" content="120; url=$myurl" ></description> <stepafterformdisplay> system("/sbin/shutdown -r now"); </stepafterformdisplay> |