diff options
author | Renato Botelho <garga@FreeBSD.org> | 2013-04-23 12:16:58 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2013-04-23 12:16:58 -0300 |
commit | 1e2d831c177d440554e22d659a3b34558219ecab (patch) | |
tree | c6c5c63d6d6a836858526f2ee3f04b764141dfc1 /usr/local/www | |
parent | be57a6974a2c130be5f5ce03514b27ebfb678703 (diff) | |
download | pfsense-1e2d831c177d440554e22d659a3b34558219ecab.zip pfsense-1e2d831c177d440554e22d659a3b34558219ecab.tar.gz |
Fix whitespace and indent
Diffstat (limited to 'usr/local/www')
-rwxr-xr-x | usr/local/www/wizard.php | 1063 |
1 files changed, 532 insertions, 531 deletions
diff --git a/usr/local/www/wizard.php b/usr/local/www/wizard.php index 29612a3..7076888 100755 --- a/usr/local/www/wizard.php +++ b/usr/local/www/wizard.php @@ -1,31 +1,31 @@ <?php /* $Id$ */ /* - wizard.php - Copyright (C) 2004 Scott Ullrich - Copyright (C) 2010 Ermal Luçi - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. + wizard.php + Copyright (C) 2004 Scott Ullrich + Copyright (C) 2010 Ermal Luçi + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ ##|+PRIV @@ -52,7 +52,7 @@ global $g; $stepid = htmlspecialchars($_GET['stepid']); if (isset($_POST['stepid'])) - $stepid = htmlspecialchars($_POST['stepid']); + $stepid = htmlspecialchars($_POST['stepid']); if (!$stepid) $stepid = "0"; @@ -83,7 +83,7 @@ $description = preg_replace("/pfSense/i", $g['product_name'], $pkg['step'][$step $totalsteps = $pkg['totalsteps']; if ($pkg['includefile']) - require_once($pkg['includefile']); + require_once($pkg['includefile']); if ($pkg['step'][$stepid]['includefile']) require_once($pkg['step'][$stepid]['includefile']); @@ -93,34 +93,34 @@ if($pkg['step'][$stepid]['stepsubmitbeforesave']) { } if ($_POST && !$input_errors) { - foreach ($pkg['step'][$stepid]['fields']['field'] as $field) { - if(!empty($field['bindstofield']) and $field['type'] <> "submit") { - $fieldname = $field['name']; - $fieldname = str_replace(" ", "", $fieldname); - $fieldname = strtolower($fieldname); - // update field with posted values. - if($field['unsetfield'] <> "") - $unset_fields = "yes"; - else - $unset_fields = ""; - if($field['arraynum'] <> "") - $arraynum = $field['arraynum']; - else - $arraynum = ""; - - update_config_field( $field['bindstofield'], $_POST[$fieldname], $unset_fields, $arraynum, $field['type']); - } - - } - // run custom php code embedded in xml config. - if($pkg['step'][$stepid]['stepsubmitphpaction'] <> "") { + foreach ($pkg['step'][$stepid]['fields']['field'] as $field) { + if(!empty($field['bindstofield']) and $field['type'] <> "submit") { + $fieldname = $field['name']; + $fieldname = str_replace(" ", "", $fieldname); + $fieldname = strtolower($fieldname); + // update field with posted values. + if($field['unsetfield'] <> "") + $unset_fields = "yes"; + else + $unset_fields = ""; + if($field['arraynum'] <> "") + $arraynum = $field['arraynum']; + else + $arraynum = ""; + + update_config_field( $field['bindstofield'], $_POST[$fieldname], $unset_fields, $arraynum, $field['type']); + } + + } + // run custom php code embedded in xml config. + if($pkg['step'][$stepid]['stepsubmitphpaction'] <> "") { eval($pkg['step'][$stepid]['stepsubmitphpaction']); - } + } if (!$input_errors) write_config(); - $stepid++; - if($stepid > $totalsteps) - $stepid = $totalsteps; + $stepid++; + if($stepid > $totalsteps) + $stepid = $totalsteps; } function update_config_field($field, $updatetext, $unset, $arraynum, $field_type) { @@ -136,7 +136,7 @@ function update_config_field($field, $updatetext, $unset, $arraynum, $field_type /* * item is a checkbox, it should have the value "on" * if it was checked - */ + */ $var = "\$config{$field_conv}"; $text = "if (isset({$var})) unset({$var});"; eval($text); @@ -173,9 +173,9 @@ $closehead = false; $pgtitle = array($title); include("head.inc"); -if(file_exists("/usr/local/www/themes/{$g['theme']}/wizard.css")) +if(file_exists("/usr/local/www/themes/{$g['theme']}/wizard.css")) echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"/themes/{$g['theme']}/wizard.css\" media=\"all\" />\n"; -else +else echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"/themes/{$g['theme']}/all.css\" media=\"all\" />"; ?> </head> @@ -193,108 +193,108 @@ function FieldValidate(userinput, regexp, message) function enablechange() { <?php - foreach($pkg['step'][$stepid]['fields']['field'] as $field) { - if(isset($field['enablefields']) or isset($field['checkenablefields'])) { - print "\t" . 'if (document.iform.' . strtolower($field['name']) . '.checked) {' . "\n"; - if(isset($field['enablefields'])) { - $enablefields = explode(',', $field['enablefields']); - foreach($enablefields as $enablefield) { - $enablefield = strtolower($enablefield); - print "\t\t" . 'document.iform.' . $enablefield . '.disabled = 0;' . "\n"; - } - } - if(isset($field['checkenablefields'])) { - $checkenablefields = explode(',', $field['checkenablefields']); - foreach($checkenablefields as $checkenablefield) { - $checkenablefield = strtolower($checkenablefield); - print "\t\t" . 'document.iform.' . $checkenablefield . '.checked = 0;' . "\n"; - } - } - print "\t" . '} else {' . "\n"; - if(isset($field['enablefields'])) { - $enablefields = explode(',', $field['enablefields']); - foreach($enablefields as $enablefield) { - $enablefield = strtolower($enablefield); - print "\t\t" . 'document.iform.' . $enablefield . '.disabled = 1;' . "\n"; - } - } - if(isset($field['checkenablefields'])) { - $checkenablefields = explode(',', $field['checkenablefields']); - foreach($checkenablefields as $checkenablefield) { - $checkenablefield = strtolower($checkenablefield); - print "\t\t" . 'document.iform.' . $checkenablefield . '.checked = 1;' . "\n"; - } - } - print "\t" . '}' . "\n"; - } - } + foreach($pkg['step'][$stepid]['fields']['field'] as $field) { + if(isset($field['enablefields']) or isset($field['checkenablefields'])) { + print "\t" . 'if (document.iform.' . strtolower($field['name']) . '.checked) {' . "\n"; + if(isset($field['enablefields'])) { + $enablefields = explode(',', $field['enablefields']); + foreach($enablefields as $enablefield) { + $enablefield = strtolower($enablefield); + print "\t\t" . 'document.iform.' . $enablefield . '.disabled = 0;' . "\n"; + } + } + if(isset($field['checkenablefields'])) { + $checkenablefields = explode(',', $field['checkenablefields']); + foreach($checkenablefields as $checkenablefield) { + $checkenablefield = strtolower($checkenablefield); + print "\t\t" . 'document.iform.' . $checkenablefield . '.checked = 0;' . "\n"; + } + } + print "\t" . '} else {' . "\n"; + if(isset($field['enablefields'])) { + $enablefields = explode(',', $field['enablefields']); + foreach($enablefields as $enablefield) { + $enablefield = strtolower($enablefield); + print "\t\t" . 'document.iform.' . $enablefield . '.disabled = 1;' . "\n"; + } + } + if(isset($field['checkenablefields'])) { + $checkenablefields = explode(',', $field['checkenablefields']); + foreach($checkenablefields as $checkenablefield) { + $checkenablefield = strtolower($checkenablefield); + print "\t\t" . 'document.iform.' . $checkenablefield . '.checked = 1;' . "\n"; + } + } + print "\t" . '}' . "\n"; + } + } ?> } function disablechange() { <?php - foreach($pkg['step'][$stepid]['fields']['field'] as $field) { - if(isset($field['disablefields']) or isset($field['checkdisablefields'])) { - print "\t" . 'if (document.iform.' . strtolower($field['name']) . '.checked) {' . "\n"; - if(isset($field['disablefields'])) { - $enablefields = explode(',', $field['disablefields']); - foreach($enablefields as $enablefield) { - $enablefield = strtolower($enablefield); - print "\t\t" . 'document.iform.' . $enablefield . '.disabled = 1;' . "\n"; - } - } - if(isset($field['checkdisablefields'])) { - $checkenablefields = explode(',', $field['checkdisablefields']); - foreach($checkenablefields as $checkenablefield) { - $checkenablefield = strtolower($checkenablefield); - print "\t\t" . 'document.iform.' . $checkenablefield . '.checked = 1;' . "\n"; - } - } - print "\t" . '} else {' . "\n"; - if(isset($field['disablefields'])) { - $enablefields = explode(',', $field['disablefields']); - foreach($enablefields as $enablefield) { - $enablefield = strtolower($enablefield); - print "\t\t" . 'document.iform.' . $enablefield . '.disabled = 0;' . "\n"; - } - } - if(isset($field['checkdisablefields'])) { - $checkenablefields = explode(',', $field['checkdisablefields']); - foreach($checkenablefields as $checkenablefield) { - $checkenablefield = strtolower($checkenablefield); - print "\t\t" . 'document.iform.' . $checkenablefield . '.checked = 0;' . "\n"; - } - } - print "\t" . '}' . "\n"; - } - } + foreach($pkg['step'][$stepid]['fields']['field'] as $field) { + if(isset($field['disablefields']) or isset($field['checkdisablefields'])) { + print "\t" . 'if (document.iform.' . strtolower($field['name']) . '.checked) {' . "\n"; + if(isset($field['disablefields'])) { + $enablefields = explode(',', $field['disablefields']); + foreach($enablefields as $enablefield) { + $enablefield = strtolower($enablefield); + print "\t\t" . 'document.iform.' . $enablefield . '.disabled = 1;' . "\n"; + } + } + if(isset($field['checkdisablefields'])) { + $checkenablefields = explode(',', $field['checkdisablefields']); + foreach($checkenablefields as $checkenablefield) { + $checkenablefield = strtolower($checkenablefield); + print "\t\t" . 'document.iform.' . $checkenablefield . '.checked = 1;' . "\n"; + } + } + print "\t" . '} else {' . "\n"; + if(isset($field['disablefields'])) { + $enablefields = explode(',', $field['disablefields']); + foreach($enablefields as $enablefield) { + $enablefield = strtolower($enablefield); + print "\t\t" . 'document.iform.' . $enablefield . '.disabled = 0;' . "\n"; + } + } + if(isset($field['checkdisablefields'])) { + $checkenablefields = explode(',', $field['checkdisablefields']); + foreach($checkenablefields as $checkenablefield) { + $checkenablefield = strtolower($checkenablefield); + print "\t\t" . 'document.iform.' . $checkenablefield . '.checked = 0;' . "\n"; + } + } + print "\t" . '}' . "\n"; + } + } ?> } function showchange() { <?php - foreach($pkg['step'][$stepid]['fields']['field'] as $field) { - if(isset($field['showfields'])) { - print "\t" . 'if (document.iform.' . strtolower($field['name']) . '.checked == false) {' . "\n"; - if(isset($field['showfields'])) { - $showfields = explode(',', $field['showfields']); - foreach($showfields as $showfield) { - $showfield = strtolower($showfield); - //print "\t\t" . 'document.iform.' . $showfield . ".display =\"none\";\n"; + foreach($pkg['step'][$stepid]['fields']['field'] as $field) { + if(isset($field['showfields'])) { + print "\t" . 'if (document.iform.' . strtolower($field['name']) . '.checked == false) {' . "\n"; + if(isset($field['showfields'])) { + $showfields = explode(',', $field['showfields']); + foreach($showfields as $showfield) { + $showfield = strtolower($showfield); + //print "\t\t" . 'document.iform.' . $showfield . ".display =\"none\";\n"; print "\t\t jQuery('#". $showfield . "').hide();"; - } - } - print "\t" . '} else {' . "\n"; - if(isset($field['showfields'])) { - $showfields = explode(',', $field['showfields']); - foreach($showfields as $showfield) { - $showfield = strtolower($showfield); - #print "\t\t" . 'document.iform.' . $showfield . ".display =\"\";\n"; + } + } + print "\t" . '} else {' . "\n"; + if(isset($field['showfields'])) { + $showfields = explode(',', $field['showfields']); + foreach($showfields as $showfield) { + $showfield = strtolower($showfield); + #print "\t\t" . 'document.iform.' . $showfield . ".display =\"\";\n"; print "\t\t jQuery('#". $showfield . "').show();"; - } - } - print "\t" . '}' . "\n"; - } + } + } + print "\t" . '}' . "\n"; + } } ?> } @@ -332,30 +332,30 @@ function showchange() { print_info_box(htmlspecialchars($_POST['message'])); ?> <table bgcolor="#ffffff" width="95%" border="0" cellspacing="0" cellpadding="2" summary="wizard"> - <!-- wizard goes here --> - <tr><td> </td></tr> - <tr> - <td class="tabcont"> - <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area"> - - <tr><td colspan="2" align="center"><font size="2"><b><?= fixup_string($description) ?></b></font></td></tr><tr><td> </td></tr> - <?php + <!-- wizard goes here --> + <tr><td> </td></tr> + <tr> + <td class="tabcont"> + <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area"> + + <tr><td colspan="2" align="center"><font size="2"><b><?= fixup_string($description) ?></b></font></td></tr><tr><td> </td></tr> +<?php if(!$pkg['step'][$stepid]['disableheader']) echo "<tr><td colspan=\"2\" class=\"listtopic\">" . fixup_string($title) . "</td></tr>"; - ?> +?> - <?php +<?php $inputaliases = array(); if($pkg['step'][$stepid]['fields']['field'] <> "") { foreach ($pkg['step'][$stepid]['fields']['field'] as $field) { - $value = $field['value']; - $name = $field['name']; + $value = $field['value']; + $name = $field['name']; - $name = preg_replace("/\s+/", "", $name); - $name = strtolower($name); + $name = preg_replace("/\s+/", "", $name); + $name = strtolower($name); - if($field['bindstofield'] <> "") { + if($field['bindstofield'] <> "") { $arraynum = ""; $field_conv = ""; $field_split = explode("->", $field['bindstofield']); @@ -370,406 +370,407 @@ function showchange() { else $toeval = "if (isset(\$config" . $field_conv . $arraynum . ")) \$value = \$config" . $field_conv . $arraynum . ";"; eval($toeval); - } - - if(!$field['combinefieldsend']) - echo "<tr>"; + } - switch ($field['type']) { - case "input": - if ($field['displayname']) { - echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; - echo $field['displayname']; - echo ":</td>\n"; - } else if(!$field['dontdisplayname']) { + if(!$field['combinefieldsend']) + echo "<tr>"; + + switch ($field['type']) { + case "input": + if ($field['displayname']) { + echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; + echo $field['displayname']; + echo ":</td>\n"; + } else if(!$field['dontdisplayname']) { + echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; + echo fixup_string($field['name']); + echo ":</td>\n"; + } + if(!$field['dontcombinecells']) + echo "<td class=\"vtable\">\n"; + + echo "<input class='formfld unknown' id='" . $name . "' name='" . $name . "' value='" . htmlspecialchars($value) . "'"; + if($field['size']) + echo " size='" . $field['size'] . "' "; + if($field['validate']) + echo " onchange='FieldValidate(this.value, \"{$field['validate']}\", \"{$field['message']}\");'"; + echo " />\n"; + + if($field['description'] <> "") { + echo "<br /> " . $field['description']; + } + break; + case "text": + echo "<td colspan=\"2\" align=\"center\" class=\"vncell\">\n"; + if($field['description'] <> "") { + echo "<center><br /> " . $field['description'] . "</center>"; + } + break; + case "inputalias": + if ($field['displayname']) { + echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; + echo $field['displayname']; + echo ":</td>\n"; + } else if(!$field['dontdisplayname']) { + echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; + echo fixup_string($field['name']); + echo ":</td>\n"; + } + if(!$field['dontcombinecells']) + echo "<td class=\"vtable\">\n"; + + $inputaliases[] = $name; + echo "<input class='formfldalias' autocomplete='off' id='" . $name . "' name='" . $name . "' value='" . htmlspecialchars($value) . "'"; + if($field['size']) + echo " size='" . $field['size'] . "' "; + if($field['validate']) + echo " onchange='FieldValidate(this.value, \"{$field['validate']}\", \"{$field['message']}\");'"; + echo " />\n"; + + if($field['description'] <> "") { + echo "<br /> " . $field['description']; + } + break; + case "interfaces_selection": + case "interface_select": + $size = ""; + $multiple = ""; + $name = strtolower($name); echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; - echo fixup_string($field['name']); - echo ":</td>\n"; - } - if(!$field['dontcombinecells']) + echo fixup_string($field['displayname'] ? $field['displayname'] : $field['name']) . ":\n"; + echo "</td>"; echo "<td class=\"vtable\">\n"; + if($field['size'] <> "") $size = "size=\"{$field['size']}\""; + if($field['multiple'] <> "" and $field['multiple'] <> "0") { + $multiple = "multiple=\"multiple\""; + $name .= "[]"; + } + echo "<select class='formselect' id='{$name}' name='{$name}' {$size} {$multiple}>\n"; + if($field['add_to_interfaces_selection'] <> "") { + $SELECTED = ""; + if($field['add_to_interfaces_selection'] == $value) $SELECTED = " selected=\"selected\""; + echo "<option value='" . $field['add_to_interfaces_selection'] . "'" . $SELECTED . ">" . $field['add_to_interfaces_selection'] . "</option>\n"; + } + if($field['type'] == "interface_select") + $interfaces = get_interface_list(); + else + $interfaces = get_configured_interface_with_descr(); + foreach ($interfaces as $ifname => $iface) { + if ($field['type'] == "interface_select") { + $iface = $ifname; + if ($iface['mac']) + $iface .= " ({$iface['mac']})"; + } + $SELECTED = ""; + if ($value == $ifname) $SELECTED = " selected=\"selected\""; + $to_echo = "<option value='" . $ifname . "'" . $SELECTED . ">" . $iface . "</option>\n"; + $to_echo .= "<!-- {$value} -->"; + $canecho = 0; + if($field['interface_filter'] <> "") { + if(stristr($ifname, $field['interface_filter']) == true) + $canecho = 1; + } else + $canecho = 1; + if($canecho == 1) + echo $to_echo; + } + echo "</select>\n"; - echo "<input class='formfld unknown' id='" . $name . "' name='" . $name . "' value='" . htmlspecialchars($value) . "'"; - if($field['size']) - echo " size='" . $field['size'] . "' "; - if($field['validate']) - echo " onchange='FieldValidate(this.value, \"{$field['validate']}\", \"{$field['message']}\");'"; - echo " />\n"; + if($field['description'] <> "") { + echo "<br /> " . $field['description']; + } - if($field['description'] <> "") { - echo "<br /> " . $field['description']; - } - break; - case "text": - echo "<td colspan=\"2\" align=\"center\" class=\"vncell\">\n"; - if($field['description'] <> "") { - echo "<center><br /> " . $field['description'] . "</center>"; - } - break; - case "inputalias": - if ($field['displayname']) { - echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; - echo $field['displayname']; - echo ":</td>\n"; - } else if(!$field['dontdisplayname']) { + break; + case "password": + if ($field['displayname']) { + echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; + echo $field['displayname']; + echo ":</td>\n"; + } else if(!$field['dontdisplayname']) { + echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; + echo fixup_string($field['name']); + echo ":</td>\n"; + } + if(!$field['dontcombinecells']) + echo "<td class=\"vtable\">"; + echo "<input class='formfld pwd' id='" . $name . "' name='" . $name . "' value='" . htmlspecialchars($value) . "' type='password' "; + if($field['size']) + echo " size='" . $field['size'] . "' "; + echo " />\n"; + + if($field['description'] <> "") { + echo "<br /> " . $field['description']; + } + + break; + case "certca_selection": + $size = ""; + $multiple = ""; + $name = strtolower($name); echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; - echo fixup_string($field['name']); - echo ":</td>\n"; - } - if(!$field['dontcombinecells']) + echo fixup_string($field['displayname'] ? $field['displayname'] : $field['name']) . ":\n"; + echo "</td>"; echo "<td class=\"vtable\">\n"; + if($field['size'] <> "") $size = "size=\"{$field['size']}\""; + echo "<select id='{$name}' name='{$name}' {$size}>\n"; + if($field['add_to_certca_selection'] <> "") { + $SELECTED = ""; + if($field['add_to_certca_selection'] == $value) $SELECTED = " selected=\"selected\""; + echo "<option value='" . $field['add_to_certca_selection'] . "'" . $SELECTED . ">" . $field['add_to_certca_selection'] . "</option>\n"; + } + foreach($config['ca'] as $ca) { + $name = htmlspecialchars($ca['descr']); + $SELECTED = ""; + if ($value == $name) $SELECTED = " selected=\"selected\""; + $to_echo = "<option value='" . $ca['refid'] . "'" . $SELECTED . ">" . $name . "</option>\n"; + $to_echo .= "<!-- {$value} -->"; + $canecho = 0; + if($field['certca_filter'] <> "") { + if(stristr($name, $field['certca_filter']) == true) + $canecho = 1; + } else { + $canecho = 1; + } + if($canecho == 1) + echo $to_echo; + } + echo "</select>\n"; - $inputaliases[] = $name; - echo "<input class='formfldalias' autocomplete='off' id='" . $name . "' name='" . $name . "' value='" . htmlspecialchars($value) . "'"; - if($field['size']) - echo " size='" . $field['size'] . "' "; - if($field['validate']) - echo " onchange='FieldValidate(this.value, \"{$field['validate']}\", \"{$field['message']}\");'"; - echo " />\n"; - - if($field['description'] <> "") { - echo "<br /> " . $field['description']; - } - break; - case "interfaces_selection": - case "interface_select": - $size = ""; - $multiple = ""; - $name = strtolower($name); - echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; - echo fixup_string($field['displayname'] ? $field['displayname'] : $field['name']) . ":\n"; - echo "</td>"; - echo "<td class=\"vtable\">\n"; - if($field['size'] <> "") $size = "size=\"{$field['size']}\""; - if($field['multiple'] <> "" and $field['multiple'] <> "0") { - $multiple = "multiple=\"multiple\""; - $name .= "[]"; - } - echo "<select class='formselect' id='{$name}' name='{$name}' {$size} {$multiple}>\n"; - if($field['add_to_interfaces_selection'] <> "") { - $SELECTED = ""; - if($field['add_to_interfaces_selection'] == $value) $SELECTED = " selected=\"selected\""; - echo "<option value='" . $field['add_to_interfaces_selection'] . "'" . $SELECTED . ">" . $field['add_to_interfaces_selection'] . "</option>\n"; - } - if($field['type'] == "interface_select") - $interfaces = get_interface_list(); - else - $interfaces = get_configured_interface_with_descr(); - foreach ($interfaces as $ifname => $iface) { - if ($field['type'] == "interface_select") { - $iface = $ifname; - if ($iface['mac']) - $iface .= " ({$iface['mac']})"; - } - $SELECTED = ""; - if ($value == $ifname) $SELECTED = " selected=\"selected\""; - $to_echo = "<option value='" . $ifname . "'" . $SELECTED . ">" . $iface . "</option>\n"; - $to_echo .= "<!-- {$value} -->"; - $canecho = 0; - if($field['interface_filter'] <> "") { - if(stristr($ifname, $field['interface_filter']) == true) - $canecho = 1; - } else - $canecho = 1; - if($canecho == 1) - echo $to_echo; - } - echo "</select>\n"; - - if($field['description'] <> "") { - echo "<br /> " . $field['description']; - } + if($field['description'] <> "") { + echo "<br /> " . $field['description']; + } - break; - case "password": - if ($field['displayname']) { + break; + case "cert_selection": + $size = ""; + $multiple = ""; + $name = strtolower($name); echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; - echo $field['displayname']; - echo ":</td>\n"; - } else if(!$field['dontdisplayname']) { - echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; - echo fixup_string($field['name']); - echo ":</td>\n"; - } - if(!$field['dontcombinecells']) - echo "<td class=\"vtable\">"; - echo "<input class='formfld pwd' id='" . $name . "' name='" . $name . "' value='" . htmlspecialchars($value) . "' type='password' "; - if($field['size']) - echo " size='" . $field['size'] . "' "; - echo " />\n"; + echo fixup_string($field['displayname'] ? $field['displayname'] : $field['name']) . ":\n"; + echo "</td>"; + echo "<td class=\"vtable\">\n"; + if($field['size'] <> "") $size = "size=\"{$field['size']}\""; + echo "<select id='{$name}' name='{$name}' {$size}>\n"; + if($field['add_to_cert_selection'] <> "") { + $SELECTED = ""; + if($field['add_to_cert_selection'] == $value) $SELECTED = " selected=\"selected\""; + echo "<option value='" . $field['add_to_cert_selection'] . "'" . $SELECTED . ">" . $field['add_to_cert_selection'] . "</option>\n"; + } + foreach($config['cert'] as $ca) { + if (stristr($ca['descr'], "webconf")) + continue; + $name = htmlspecialchars($ca['descr']); + $SELECTED = ""; + if ($value == $name) $SELECTED = " selected=\"selected\""; + $to_echo = "<option value='" . $ca['refid'] . "'" . $SELECTED . ">" . $name . "</option>\n"; + $to_echo .= "<!-- {$value} -->"; + $canecho = 0; + if($field['cert_filter'] <> "") { + if(stristr($name, $field['cert_filter']) == true) + $canecho = 1; + } else { + $canecho = 1; + } + if($canecho == 1) + echo $to_echo; + } + echo "</select>\n"; - if($field['description'] <> "") { - echo "<br /> " . $field['description']; - } + if($field['description'] <> "") { + echo "<br /> " . $field['description']; + } - break; - case "certca_selection": - $size = ""; - $multiple = ""; - $name = strtolower($name); - echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; - echo fixup_string($field['displayname'] ? $field['displayname'] : $field['name']) . ":\n"; - echo "</td>"; - echo "<td class=\"vtable\">\n"; - if($field['size'] <> "") $size = "size=\"{$field['size']}\""; - echo "<select id='{$name}' name='{$name}' {$size}>\n"; - if($field['add_to_certca_selection'] <> "") { - $SELECTED = ""; - if($field['add_to_certca_selection'] == $value) $SELECTED = " selected=\"selected\""; - echo "<option value='" . $field['add_to_certca_selection'] . "'" . $SELECTED . ">" . $field['add_to_certca_selection'] . "</option>\n"; - } - foreach($config['ca'] as $ca) { - $name = htmlspecialchars($ca['descr']); - $SELECTED = ""; - if ($value == $name) $SELECTED = " selected=\"selected\""; - $to_echo = "<option value='" . $ca['refid'] . "'" . $SELECTED . ">" . $name . "</option>\n"; - $to_echo .= "<!-- {$value} -->"; - $canecho = 0; - if($field['certca_filter'] <> "") { - if(stristr($name, $field['certca_filter']) == true) - $canecho = 1; - } else { - $canecho = 1; - } - if($canecho == 1) - echo $to_echo; - } - echo "</select>\n"; - - if($field['description'] <> "") { - echo "<br /> " . $field['description']; - } + break; + case "select": + if ($field['displayname']) { + echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; + echo $field['displayname']; + echo ":</td>\n"; + } else if(!$field['dontdisplayname']) { + echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; + echo fixup_string($field['name']); + echo ":</td>\n"; + } + if($field['size']) $size = " size='" . $field['size'] . "' "; + if($field['multiple'] == "yes") $multiple = "MULTIPLE "; + if(!$field['dontcombinecells']) + echo "<td class=\"vtable\">\n"; + $onchange = ""; + foreach ($field['options']['option'] as $opt) { + if($opt['enablefields'] <> "") { + $onchange = "onchange=\"enableitems(this.selectedIndex);\" "; + } + } + echo "<select class='formselect' " . $onchange . $multiple . $size . "id='" . $name . "' name='" . $name . "'>\n"; + foreach ($field['options']['option'] as $opt) { + $selected = ""; + if($value == $opt['value']) + $selected = " selected=\"selected\""; + echo "\t<option value='" . $opt['value'] . "'" . $selected . ">"; + if ($opt['displayname']) + echo $opt['displayname']; + else + echo $opt['name']; + echo "</option>\n"; + } + echo "</select>\n"; + echo "<!-- {$value} -->\n"; - break; - case "cert_selection": - $size = ""; - $multiple = ""; - $name = strtolower($name); - echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; - echo fixup_string($field['displayname'] ? $field['displayname'] : $field['name']) . ":\n"; - echo "</td>"; - echo "<td class=\"vtable\">\n"; - if($field['size'] <> "") $size = "size=\"{$field['size']}\""; - echo "<select id='{$name}' name='{$name}' {$size}>\n"; - if($field['add_to_cert_selection'] <> "") { - $SELECTED = ""; - if($field['add_to_cert_selection'] == $value) $SELECTED = " selected=\"selected\""; - echo "<option value='" . $field['add_to_cert_selection'] . "'" . $SELECTED . ">" . $field['add_to_cert_selection'] . "</option>\n"; - } - foreach($config['cert'] as $ca) { - if (stristr($ca['descr'], "webconf")) - continue; - $name = htmlspecialchars($ca['descr']); - $SELECTED = ""; - if ($value == $name) $SELECTED = " selected=\"selected\""; - $to_echo = "<option value='" . $ca['refid'] . "'" . $SELECTED . ">" . $name . "</option>\n"; - $to_echo .= "<!-- {$value} -->"; - $canecho = 0; - if($field['cert_filter'] <> "") { - if(stristr($name, $field['cert_filter']) == true) - $canecho = 1; - } else { - $canecho = 1; - } - if($canecho == 1) - echo $to_echo; - } - echo "</select>\n"; - - if($field['description'] <> "") { - echo "<br /> " . $field['description']; - } + if($field['description'] <> "") { + echo $field['description']; + } - break; - case "select": - if ($field['displayname']) { - echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; - echo $field['displayname']; - echo ":</td>\n"; - } else if(!$field['dontdisplayname']) { - echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; - echo fixup_string($field['name']); - echo ":</td>\n"; - } - if($field['size']) $size = " size='" . $field['size'] . "' "; - if($field['multiple'] == "yes") $multiple = "MULTIPLE "; - if(!$field['dontcombinecells']) - echo "<td class=\"vtable\">\n"; - $onchange = ""; - foreach ($field['options']['option'] as $opt) { - if($opt['enablefields'] <> "") { - $onchange = "onchange=\"enableitems(this.selectedIndex);\" "; + break; + case "textarea": + if ($field['displayname']) { + echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; + echo $field['displayname']; + echo ":</td>\n"; + } else if(!$field['dontdisplayname']) { + echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; + echo fixup_string($field['name']); + echo ":</td>"; + } + if(!$field['dontcombinecells']) + echo "<td class=\"vtable\">"; + echo "<textarea class='formpre' id='" . $name . "' name='" . $name . "'"; + if ($field['rows']) + echo " rows='" . $field['rows'] . "' "; + if ($field['cols']) + echo " cols='" . $field['cols'] . "' "; + echo ">" . $value . "</textarea>\n"; + + + if($field['description'] <> "") { + echo "<br /> " . $field['description']; } - } - echo "<select class='formselect' " . $onchange . $multiple . $size . "id='" . $name . "' name='" . $name . "'>\n"; - foreach ($field['options']['option'] as $opt) { - $selected = ""; - if($value == $opt['value']) - $selected = " selected=\"selected\""; - echo "\t<option value='" . $opt['value'] . "'" . $selected . ">"; - if ($opt['displayname']) - echo $opt['displayname']; - else - echo $opt['name']; - echo "</option>\n"; - } - echo "</select>\n"; - echo "<!-- {$value} -->\n"; - if($field['description'] <> "") { - echo $field['description']; - } + break; + case "submit": + echo "<td> <br/></td></tr>"; + echo "<tr><td colspan=\"2\" align=\"center\">"; + echo "<input type='submit' name='" . $name . "' value='" . htmlspecialchars($field['name']) . "' />\n"; - break; - case "textarea": - if ($field['displayname']) { - echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; - echo $field['displayname']; - echo ":</td>\n"; - } else if(!$field['dontdisplayname']) { - echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; - echo fixup_string($field['name']); - echo ":</td>"; - } - if(!$field['dontcombinecells']) - echo "<td class=\"vtable\">"; - echo "<textarea class='formpre' id='" . $name . "' name='" . $name . "'"; - if ($field['rows']) - echo " rows='" . $field['rows'] . "' "; - if ($field['cols']) - echo " cols='" . $field['cols'] . "' "; - echo ">" . $value . "</textarea>\n"; - - - if($field['description'] <> "") { - echo "<br /> " . $field['description']; - } + if($field['description'] <> "") { + echo "<br /> " . $field['description']; + } - break; - case "submit": - echo "<td> <br/></td></tr>"; - echo "<tr><td colspan=\"2\" align=\"center\">"; - echo "<input type='submit' name='" . $name . "' value='" . htmlspecialchars($field['name']) . "' />\n"; + break; + case "listtopic": + echo "<td> </td></tr>"; + echo "<tr><td colspan=\"2\" class=\"listtopic\">" . $field['name'] . "<br /></td>\n"; + + break; + case "subnet_select": + if ($field['displayname']) { + echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; + echo $field['displayname']; + echo ":</td>\n"; + } else if(!$field['dontdisplayname']) { + echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; + echo fixup_string($field['name']); + echo ":</td>"; + } + if(!$field['dontcombinecells']) + echo "<td class=\"vtable\">"; + echo "<select class='formselect' name='{$name}'>\n"; + for($x=1; $x<33; $x++) { + $CHECKED = ""; + if($value == $x) $CHECKED = " selected=\"selected\""; + if($x <> 31) + echo "<option value='{$x}' {$CHECKED}>{$x}</option>\n"; + } + echo "</select>\n"; - if($field['description'] <> "") { - echo "<br /> " . $field['description']; - } + if($field['description'] <> "") { + echo "<br /> " . $field['description']; + } - break; - case "listtopic": - echo "<td> </td></tr>"; - echo "<tr><td colspan=\"2\" class=\"listtopic\">" . $field['name'] . "<br /></td>\n"; + break; + case "timezone_select": + exec('/usr/bin/tar -tzf /usr/share/zoneinfo.tgz', $timezonelist); + $timezonelist = array_filter($timezonelist, 'is_timezone'); + sort($timezonelist); + + /* kill carriage returns */ + for($x=0; $x<count($timezonelist); $x++) + $timezonelist[$x] = str_replace("\n", "", $timezonelist[$x]); + + if ($field['displayname']) { + echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; + echo $field['displayname']; + echo ":</td>\n"; + } else if(!$field['dontdisplayname']) { + echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; + echo fixup_string($field['name']); + echo ":</td>"; + } + if(!$field['dontcombinecells']) + echo "<td class=\"vtable\">"; + echo "<select class='formselect' name='{$name}'>\n"; + foreach ($timezonelist as $tz) { + if(strstr($tz, "GMT")) + continue; + $SELECTED = ""; + if ($value == $tz) $SELECTED = " selected=\"selected\""; + echo "<option value='" . htmlspecialchars($tz) . "' {$SELECTED}>"; + echo htmlspecialchars($tz); + echo "</option>\n"; + } + echo "</select>\n"; - break; - case "subnet_select": - if ($field['displayname']) { - echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; - echo $field['displayname']; - echo ":</td>\n"; - } else if(!$field['dontdisplayname']) { - echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; - echo fixup_string($field['name']); - echo ":</td>"; - } - if(!$field['dontcombinecells']) - echo "<td class=\"vtable\">"; - echo "<select class='formselect' name='{$name}'>\n"; - for($x=1; $x<33; $x++) { - $CHECKED = ""; - if($value == $x) $CHECKED = " selected=\"selected\""; - if($x <> 31) - echo "<option value='{$x}' {$CHECKED}>{$x}</option>\n"; - } - echo "</select>\n"; + if($field['description'] <> "") { + echo "<br /> " . $field['description']; + } - if($field['description'] <> "") { - echo "<br /> " . $field['description']; - } + break; + case "checkbox": + if ($field['displayname']) { + echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; + echo $field['displayname']; + echo ":</td>\n"; + } else if(!$field['dontdisplayname']) { + echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; + echo $field['name']; + echo ":</td>"; + } + $checked = ""; + if($value <> "") + $checked = " checked=\"checked\""; + echo "<td class=\"vtable\"><input value=\"on\" type='checkbox' id='" . $name . "' name='" . $name . "' " . $checked; + if(isset($field['enablefields']) or isset($field['checkenablefields'])) + echo " onclick=\"enablechange()\""; + else if(isset($field['disablefields']) or isset($field['checkdisablefields'])) + echo " onclick=\"disablechange()\""; + echo " />\n"; + + if($field['description'] <> "") { + echo $field['description']; + } - break; - case "timezone_select": - exec('/usr/bin/tar -tzf /usr/share/zoneinfo.tgz', $timezonelist); - $timezonelist = array_filter($timezonelist, 'is_timezone'); - sort($timezonelist); - - /* kill carriage returns */ - for($x=0; $x<count($timezonelist); $x++) - $timezonelist[$x] = str_replace("\n", "", $timezonelist[$x]); - - if ($field['displayname']) { - echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; - echo $field['displayname']; - echo ":</td>\n"; - } else if(!$field['dontdisplayname']) { - echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; - echo fixup_string($field['name']); - echo ":</td>"; - } - if(!$field['dontcombinecells']) - echo "<td class=\"vtable\">"; - echo "<select class='formselect' name='{$name}'>\n"; - foreach ($timezonelist as $tz) { - if(strstr($tz, "GMT")) - continue; - $SELECTED = ""; - if ($value == $tz) $SELECTED = " selected=\"selected\""; - echo "<option value='" . htmlspecialchars($tz) . "' {$SELECTED}>"; - echo htmlspecialchars($tz); - echo "</option>\n"; + break; } - echo "</select>\n"; - if($field['description'] <> "") { - echo "<br /> " . $field['description']; - } - - break; - case "checkbox": - if ($field['displayname']) { - echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; - echo $field['displayname']; - echo ":</td>\n"; - } else if(!$field['dontdisplayname']) { - echo "<td width=\"22%\" align=\"right\" class=\"vncellreq\">\n"; - echo $field['name']; - echo ":</td>"; + if($field['typehint'] <> "") { + echo $field['typehint']; + } + if($field['warning'] <> "") { + echo "<br /><b><font color=\"red\">" . $field['warning'] . "</font></b>"; } - $checked = ""; - if($value <> "") - $checked = " checked=\"checked\""; - echo "<td class=\"vtable\"><input value=\"on\" type='checkbox' id='" . $name . "' name='" . $name . "' " . $checked; - if(isset($field['enablefields']) or isset($field['checkenablefields'])) - echo " onclick=\"enablechange()\""; - else if(isset($field['disablefields']) or isset($field['checkdisablefields'])) - echo " onclick=\"disablechange()\""; - echo " />\n"; - - if($field['description'] <> "") { - echo $field['description']; - } - - break; - } - - if($field['typehint'] <> "") { - echo $field['typehint']; - } - if($field['warning'] <> "") { - echo "<br /><b><font color=\"red\">" . $field['warning'] . "</font></b>"; - } - if(!$field['combinefieldsbegin']) { - if (!$field['dontcombinecells']) - echo "</td>"; + if(!$field['combinefieldsbegin']) { + if (!$field['dontcombinecells']) + echo "</td>"; - echo "</tr>\n"; - } + echo "</tr>\n"; + } } } - ?> - </table> - </td></tr> +?> + </table> + </td> + </tr> </table> <br/> </div> @@ -888,7 +889,7 @@ if($pkg['step'][$stepid]['stepafterformdisplay'] <> "") { if($pkg['step'][$stepid]['javascriptafterformdisplay'] <> "") { // handle after form display event. - echo "\n<script type=\"text/javascript\">\n"; + echo "\n<script type=\"text/javascript\">\n"; echo $pkg['step'][$stepid]['javascriptafterformdisplay'] . "\n"; echo "</script>\n\n"; } @@ -966,4 +967,4 @@ function is_timezone($elt) { ?> </body> -</html>
\ No newline at end of file +</html> |