Commit b13fe7de authored by Ad Schellevis's avatar Ad Schellevis

(legacy) refactor load_balancer_monitor_edit.php

parent 1c69108b
<?php <?php
/* /*
Copyright (C) 2014-2015 Deciso B.V. Copyright (C) 2014-2016 Deciso B.V.
Copyright (C) 2008 Bill Marquette <bill.marquette@gmail.com>. Copyright (C) 2008 Bill Marquette <bill.marquette@gmail.com>.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met: modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, 1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer. this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright 2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution. documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 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 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
require_once("guiconfig.inc"); require_once("guiconfig.inc");
...@@ -32,405 +32,308 @@ require_once("services.inc"); ...@@ -32,405 +32,308 @@ require_once("services.inc");
require_once("interfaces.inc"); require_once("interfaces.inc");
$rfc2616 = array( $rfc2616 = array(
100 => "100 Continue", 100 => "100 Continue",
101 => "101 Switching Protocols", 101 => "101 Switching Protocols",
200 => "200 OK", 200 => "200 OK",
201 => "201 Created", 201 => "201 Created",
202 => "202 Accepted", 202 => "202 Accepted",
203 => "203 Non-Authoritative Information", 203 => "203 Non-Authoritative Information",
204 => "204 No Content", 204 => "204 No Content",
205 => "205 Reset Content", 205 => "205 Reset Content",
206 => "206 Partial Content", 206 => "206 Partial Content",
300 => "300 Multiple Choices", 300 => "300 Multiple Choices",
301 => "301 Moved Permanently", 301 => "301 Moved Permanently",
302 => "302 Found", 302 => "302 Found",
303 => "303 See Other", 303 => "303 See Other",
304 => "304 Not Modified", 304 => "304 Not Modified",
305 => "305 Use Proxy", 305 => "305 Use Proxy",
306 => "306 (Unused)", 306 => "306 (Unused)",
307 => "307 Temporary Redirect", 307 => "307 Temporary Redirect",
400 => "400 Bad Request", 400 => "400 Bad Request",
401 => "401 Unauthorized", 401 => "401 Unauthorized",
402 => "402 Payment Required", 402 => "402 Payment Required",
403 => "403 Forbidden", 403 => "403 Forbidden",
404 => "404 Not Found", 404 => "404 Not Found",
405 => "405 Method Not Allowed", 405 => "405 Method Not Allowed",
406 => "406 Not Acceptable", 406 => "406 Not Acceptable",
407 => "407 Proxy Authentication Required", 407 => "407 Proxy Authentication Required",
408 => "408 Request Timeout", 408 => "408 Request Timeout",
409 => "409 Conflict", 409 => "409 Conflict",
410 => "410 Gone", 410 => "410 Gone",
411 => "411 Length Required", 411 => "411 Length Required",
412 => "412 Precondition Failed", 412 => "412 Precondition Failed",
413 => "413 Request Entity Too Large", 413 => "413 Request Entity Too Large",
414 => "414 Request-URI Too Long", 414 => "414 Request-URI Too Long",
415 => "415 Unsupported Media Type", 415 => "415 Unsupported Media Type",
416 => "416 Requested Range Not Satisfiable", 416 => "416 Requested Range Not Satisfiable",
417 => "417 Expectation Failed", 417 => "417 Expectation Failed",
500 => "500 Internal Server Error", 500 => "500 Internal Server Error",
501 => "501 Not Implemented", 501 => "501 Not Implemented",
502 => "502 Bad Gateway", 502 => "502 Bad Gateway",
503 => "503 Service Unavailable", 503 => "503 Service Unavailable",
504 => "504 Gateway Timeout", 504 => "504 Gateway Timeout",
505 => "505 HTTP Version Not Supported" 505 => "505 HTTP Version Not Supported"
); );
function is_rfc2616_code($code) { if (empty($config['load_balancer']['monitor_type']) || !is_array($config['load_balancer']['monitor_type'])) {
global $rfc2616; $config['load_balancer']['monitor_type'] = array();
if (isset($rfc2616[$code]))
return true;
else
return false;
}
function print_rfc2616_select($tag, $current){
global $rfc2616;
/* Default to 200 OK if not set */
if ($current == "")
$current = 200;
echo "<select id=\"{$tag}\" name=\"{$tag}\">\n";
foreach($rfc2616 as $code => $message) {
if ($code == $current) {
$sel = " selected=\"selected\"";
} else {
$sel = "";
}
echo "<option value=\"{$code}\"{$sel}>{$message}</option>\n";
}
echo "</select>\n";
}
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/load_balancer_monitor.php');
if (!is_array($config['load_balancer']['monitor_type'])) {
$config['load_balancer']['monitor_type'] = array();
} }
$a_monitor = &$config['load_balancer']['monitor_type']; $a_monitor = &$config['load_balancer']['monitor_type'];
if (is_numericint($_GET['id']))
$id = $_GET['id'];
if (isset($_POST['id']) && is_numericint($_POST['id']))
$id = $_POST['id'];
if (isset($id) && $a_monitor[$id]) { if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig['name'] = $a_monitor[$id]['name']; if (isset($_GET['id']) && !empty($a_monitor[$_GET['id']])) {
$pconfig['type'] = $a_monitor[$id]['type']; $id = $_GET['id'];
$pconfig['descr'] = $a_monitor[$id]['descr']; }
$pconfig['options'] = array(); $pconfig = array();
$pconfig['options'] = $a_monitor[$id]['options']; foreach (array('name', 'type', 'descr') as $fieldname) {
} else { if (isset($id) && isset($a_monitor[$id][$fieldname])) {
/* Some sane page defaults */ $pconfig[$fieldname] = $a_monitor[$id][$fieldname];
$pconfig['options']['path'] = '/'; } else {
$pconfig['options']['code'] = 200; $pconfig[$fieldname] = null;
} }
}
if ($_POST) { if (isset($id)) {
unset($input_errors); $pconfig['options_send'] = isset($a_monitor[$id]['options']['send']) ? $a_monitor[$id]['options']['send'] : null;
$pconfig = $_POST; $pconfig['options_expect'] = isset($a_monitor[$id]['options']['expect']) ? $a_monitor[$id]['options']['expect'] : null;
$pconfig['options_path'] = isset($a_monitor[$id]['options']['path']) ? $a_monitor[$id]['options']['path'] : null;
/* turn $_POST['http_options_*'] into $pconfig['options'][*] */ $pconfig['options_host'] = isset($a_monitor[$id]['options']['host']) ? $a_monitor[$id]['options']['host'] : null;
foreach($_POST as $key => $val) { $pconfig['options_code'] = isset($a_monitor[$id]['options']['code']) ? $a_monitor[$id]['options']['code'] : null;
if (stristr($key, 'options') !== false) { } else {
if (stristr($key, $pconfig['type'].'_') !== false) { /* option defaults */
$opt = explode('_',$key); $pconfig['options_send'] = null;
$pconfig['options'][$opt[2]] = $val; $pconfig['options_expect'] = null;
} $pconfig['options_path'] = '/';
unset($pconfig[$key]); $pconfig['options_code'] = 200;
} $pconfig['options_host'] = null;
} }
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
/* input validation */ if (isset($_POST['id']) && !empty($a_monitor[$_POST['id']])) {
$reqdfields = explode(" ", "name type descr"); $id = $_POST['id'];
$reqdfieldsn = array(gettext("Name"),gettext("Type"),gettext("Description")); }
$pconfig = $_POST;
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); $input_errors = array();
/* Ensure that our monitor names are unique */ /* input validation */
for ($i=0; isset($config['load_balancer']['monitor_type'][$i]); $i++) $reqdfields = explode(" ", "name type descr");
if (($_POST['name'] == $config['load_balancer']['monitor_type'][$i]['name']) && ($i != $id)) $reqdfieldsn = array(gettext("Name"),gettext("Type"),gettext("Description"));
$input_errors[] = gettext("This monitor name has already been used. Monitor names must be unique.");
do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors);
if (strpos($_POST['name'], " ") !== false) /* Ensure that our monitor names are unique */
$input_errors[] = gettext("You cannot use spaces in the 'name' field."); for ($i=0; isset($config['load_balancer']['monitor_type'][$i]); $i++) {
if ($pconfig['name'] == $config['load_balancer']['monitor_type'][$i]['name'] && $i != $id) {
switch($_POST['type']) { $input_errors[] = gettext("This monitor name has already been used. Monitor names must be unique.");
case 'icmp': { }
break; }
}
case 'tcp': { if (strpos($pconfig['name'], " ") !== false) {
break; $input_errors[] = gettext("You cannot use spaces in the 'name' field.");
} }
case 'http': switch($pconfig['type']) {
case 'https': { case 'icmp':
if (is_array($pconfig['options'])) { case 'tcp':
if (isset($pconfig['options']['host']) && $pconfig['options']['host'] != "") { break;
if (!is_hostname($pconfig['options']['host'])) { case 'http':
$input_errors[] = gettext("The hostname can only contain the characters A-Z, 0-9 and '-'."); case 'https':
} if (!empty($pconfig['options_host']) && !is_hostname($pconfig['options_host'])) {
} $input_errors[] = gettext("The hostname can only contain the characters A-Z, 0-9 and '-'.");
if (isset($pconfig['options']['code']) && $pconfig['options']['code'] != "") { }
// Check code if (!empty($pconfig['options_code']) && !isset($rfc2616[$pconfig['options_code']])) {
if(!is_rfc2616_code($pconfig['options']['code'])) { $input_errors[] = gettext("HTTP(s) codes must be from RFC2616.");
$input_errors[] = gettext("HTTP(s) codes must be from RFC2616."); }
} if (empty($pconfig['options_path'])) {
} $input_errors[] = gettext("The path to monitor must be set.");
if (!isset($pconfig['options']['path']) || $pconfig['options']['path'] == "") { }
$input_errors[] = gettext("The path to monitor must be set."); break;
} case 'send':
} break;
break; }
}
case 'send': { if (count($input_errors) == 0) {
if (is_array($pconfig['options'])) { $monent = array();
if (isset($pconfig['options']['send']) && $pconfig['options']['send'] != "") { $monent['name'] = $pconfig['name'];
// Check send $monent['type'] = $pconfig['type'];
} $monent['descr'] = $pconfig['descr'];
if (isset($pconfig['options']['expect']) && $pconfig['options']['expect'] != "") { $monent['options'] = array();
// Check expect if($pconfig['type'] == "http" || $pconfig['type'] == "https") {
} $monent['options']['path'] = $pconfig['options_path'];
} $monent['options']['host'] = $pconfig['options_host'];
break; $monent['options']['code'] = $pconfig['options_code'];
} } elseif ($pconfig['type'] == "send") {
} $monent['options']['send'] = $pconfig['options_send'];
$monent['options']['expect'] = $pconfig['options_expect'];
if (!$input_errors) { }
$monent = array();
if (isset($id)) {
if (isset($id) && $a_monitor[$id]) { /* modify all pools with this name */
$monent = $a_monitor[$id]; for ($i = 0; isset($config['load_balancer']['lbpool'][$i]); $i++) {
} if ($config['load_balancer']['lbpool'][$i]['monitor'] == $a_monitor[$id]['name']) {
$config['load_balancer']['lbpool'][$i]['monitor'] = $monent['name'];
$monent['name'] = $pconfig['name']; }
$monent['type'] = $pconfig['type']; }
$monent['descr'] = $pconfig['descr']; $a_monitor[$id] = $monent;
if($pconfig['type'] == "http" || $pconfig['type'] == "https" ) { } else {
/* log updates, then clear array and reassign - dumb, but easiest way to have a clear array */ $a_monitor[] = $monent;
$monent['options'] = array(); }
$monent['options']['path'] = $pconfig['options']['path'];
$monent['options']['host'] = $pconfig['options']['host']; mark_subsystem_dirty('loadbalancer');
$monent['options']['code'] = $pconfig['options']['code']; write_config();
} header("Location: load_balancer_monitor.php");
if($pconfig['type'] == "send" ) { exit;
/* log updates, then clear array and reassign - dumb, but easiest way to have a clear array */ }
$monent['options'] = array();
$monent['options']['send'] = $pconfig['options']['send'];
$monent['options']['expect'] = $pconfig['options']['expect'];
}
if($pconfig['type'] == "tcp" || $pconfig['type'] == "icmp") {
$monent['options'] = array();
}
if (isset($id) && $a_monitor[$id]) {
/* modify all pools with this name */
for ($i = 0; isset($config['load_balancer']['lbpool'][$i]); $i++) {
if ($config['load_balancer']['lbpool'][$i]['monitor'] == $a_monitor[$id]['name'])
$config['load_balancer']['lbpool'][$i]['monitor'] = $monent['name'];
}
$a_monitor[$id] = $monent;
} else {
$a_monitor[] = $monent;
}
mark_subsystem_dirty('loadbalancer');
write_config();
header("Location: load_balancer_monitor.php");
exit;
}
} }
$service_hook = 'relayd'; $service_hook = 'relayd';
include("head.inc"); include("head.inc");
legacy_html_escape_form_data($pconfig);
$types = array("icmp" => gettext("ICMP"), "tcp" => gettext("TCP"), "http" => gettext("HTTP"), "https" => gettext("HTTPS"), "send" => gettext("Send/Expect")); $types = array("icmp" => gettext("ICMP"), "tcp" => gettext("TCP"), "http" => gettext("HTTP"), "https" => gettext("HTTPS"), "send" => gettext("Send/Expect"));
?> ?>
<body> <body>
<?php include("fbegin.inc"); ?> <?php include("fbegin.inc"); ?>
<script type="text/javascript">
<script type="text/javascript"> $( document ).ready(function() {
//<![CDATA[ $("#monitor_type").change(function(){
function updateType(t){ switch ($(this).val()) {
switch(t) { case 'http':
<?php case 'https':
/* OK, so this is sick using php to generate javascript, but it needed to be done */ $("#type_details_send").hide();
foreach ($types as $key => $val) { $("#type_details_http").show();
echo " case \"{$key}\": {\n"; $("#type_details").show();
$t = $types; break;
foreach ($t as $k => $v) { case 'send':
if ($k != $key) { $("#type_details_send").show();
echo " jQuery('#{$k}').hide();\n"; $("#type_details_http").hide();
} $("#type_details").show();
} break;
echo " }\n"; default:
} $("#type_details").hide();
?> break;
} }
jQuery('#' + t).show(); });
} $("#monitor_type").change();
//]]> });
</script> </script>
<section class="page-content-main"> <section class="page-content-main">
<div class="container-fluid">
<div class="container-fluid"> <div class="row">
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<div class="row"> <section class="col-xs-12">
<div class="content-box">
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?> <form name="iform" method="post" id="iform">
<div class="table-responsive">
<section class="col-xs-12"> <table class="table table-striped">
<tr>
<div class="content-box"> <td width="22%"><strong><?=gettext("Edit Monitor entry"); ?></strong></td>
<td width="78%" align="right">
<form action="load_balancer_monitor_edit.php" method="post" name="iform" id="iform"> <small><?=gettext("full help"); ?> </small>
<i class="fa fa-toggle-off text-danger" style="cursor: pointer;" id="show_all_help_page" type="button"></i></a>
<div class="table-responsive"> </td>
<table class="table table-striped table-sort"> </tr>
<tr> <tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Edit Load Balancer - Monitor entry"); ?></td> <td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Name"); ?></td>
</tr> <td>
<tr align="left"> <input name="name" type="text" value="<?=$pconfig['name'];?>" />
<td width="22%" valign="top" class="vncellreq"><?=gettext("Name"); ?></td> </td>
<td width="78%" class="vtable" colspan="2"> </tr>
<input name="name" type="text" <?php if(isset($pconfig['name'])) echo "value=\"" . htmlspecialchars($pconfig['name']) . "\"";?> size="16" maxlength="16" /> <tr>
</td> <td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Description"); ?></td>
</tr> <td>
<tr align="left"> <input name="descr" type="text" value="<?=$pconfig['descr'];?>"/>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Description"); ?></td> </td>
<td width="78%" class="vtable" colspan="2"> </tr>
<input name="descr" type="text" <?php if(isset($pconfig['descr'])) echo "value=\"" . htmlspecialchars($pconfig['descr']) . "\"";?> size="64" /> <tr>
</td> <td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Type"); ?></td>
</tr> <td>
<tr align="left"> <select id="monitor_type" name="type" class="selectpicker">
<td width="22%" valign="top" class="vncellreq"><?=gettext("Type"); ?></td> <option value="icmp" <?=$pconfig['type'] == "icmp" ? " selected=\"selected\"" : "";?> >
<td width="78%" class="vtable" colspan="2"> <?=gettext("ICMP");?>
<select id="type" name="type"> </option>
<? <option value="tcp" <?=$pconfig['type'] == "tcp" ? " selected=\"selected\"" : "";?> >
foreach ($types as $key => $val) { <?=gettext("TCP");?>
if(isset($pconfig['type']) && $pconfig['type'] == $key) { </option>
$selected = " selected=\"selected\""; <option value="http" <?=$pconfig['type'] == "http" ? " selected=\"selected\"" : "";?> >
} else { <?=gettext("HTTP");?>
$selected = ""; </option>
} <option value="https" <?=$pconfig['type'] == "https" ? " selected=\"selected\"" : "";?> >
echo "<option value=\"{$key}\" onclick=\"updateType('{$key}');\"{$selected}>{$val}</option>\n"; <?=gettext("HTTPS");?>
} </option>
?> <option value="send" <?=$pconfig['type'] == "send" ? " selected=\"selected\"" : "";?> >
</select> <?=gettext("Send/Expect");?>
</td> </option>
</tr> </select>
<tr align="left" id="icmp"<?= $pconfig['type'] == "icmp" ? "" : " style=\"display:none;\""?>><td></td> </td>
</tr> </tr>
<tr align="left" id="tcp"<?= $pconfig['type'] == "tcp" ? "" : " style=\"display:none;\""?>><td></td> <tr id="type_details" style="display:none;">
</tr> <td></td>
<tr align="left" id="http"<?= $pconfig['type'] == "http" ? "" : " style=\"display:none;\""?>> <td>
<td width="22%" valign="top" class="vncellreq"><?=gettext("HTTP"); ?></td> <div id="type_details_send">
<td width="78%" class="vtable" colspan="2"> <table class="table table-condensed">
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="http"> <tr>
<tr align="left"> <td><?=gettext("Send string"); ?></td>
<td valign="top" align="right" class="vtable"><?=gettext("Path"); ?></td> <td>
<td class="vtable" colspan="2"> <input name="options_send" type="text" value="<?=$pconfig['options_send'];?>"/>
<input name="http_options_path" type="text" <?php if(isset($pconfig['options']['path'])) echo "value=\"" . htmlspecialchars($pconfig['options']['path']) . "\"";?> size="64" /> </td>
</td> </tr>
</tr> <tr>
<tr align="left"> <td><?=gettext("Expect string"); ?></td>
<td valign="top" align="right" class="vtable"><?=gettext("Host"); ?></td> <td>
<td class="vtable" colspan="2"> <input name="options_expect" type="text" value="<?=$pconfig['options_expect'];?>"/>
<input name="http_options_host" type="text" <?php if(isset($pconfig['options']['host'])) echo "value=\"" . htmlspecialchars($pconfig['options']['host']) . "\"";?> size="64" /><br /><?=gettext("Hostname for Host: header if needed."); ?> </td>
</td> </tr>
</tr> </table>
<tr align="left"> </div>
<td valign="top" align="right" class="vtable"><?=gettext("HTTP Code"); ?></td> <div id="type_details_http">
<td class="vtable" colspan="2"> <table class="table table-condensed">
<?= print_rfc2616_select("http_options_code", isset($pconfig['options']['code'])?$pconfig['options']['code']:""); ?> <tr>
</td> <td><?=gettext("Path"); ?></td>
</tr> <td>
<!-- BILLM: XXX not supported digest checking just yet <input name="options_path" type="text" value="<?=$pconfig['options_path'];?>"/>
<tr align="left"> </td>
<td width="22%" valign="top" class="vncell">MD5 Page Digest</td> </tr>
<td width="78%" class="vtable" colspan="2"> <tr>
<input name="digest" type="text" <?php if(isset($pconfig['digest'])) echo "value=\"" . htmlspecialchars($pconfig['digest']) . "\"";?>size="32"><br /><b>TODO: add fetch functionality here</b> <td><?=gettext("Host"); ?></td>
</td> <td>
</tr> <input name="options_host" type="text" value="<?=$pconfig['options_host'];?>" />
--> <small><?=gettext("Hostname for Host: header if needed."); ?></small>
</table> </td>
</td> </tr>
</tr> <tr>
<tr align="left" id="https"<?= $pconfig['type'] == "https" ? "" : " style=\"display:none;\""?>> <td><?=gettext("HTTP Code"); ?></td>
<td width="22%" valign="top" class="vncellreq"><?=gettext("HTTPS"); ?></td> <td>
<td width="78%" class="vtable" colspan="2"> <select name="options_code">
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="https"> <?php
<tr align="left"> foreach($rfc2616 as $code => $message):?>
<td valign="top" align="right" class="vtable"><?=gettext("Path"); ?></td> <option value="<?=$code;?>" <?=$pconfig['options_code'] == $code ? " selected=\"selected\"" :"" ;?>>
<td class="vtable" colspan="2"> <?=$message;?>
<input name="https_options_path" type="text" <?php if(isset($pconfig['options']['path'])) echo "value=\"" . htmlspecialchars($pconfig['options']['path']) ."\"";?> size="64" /> </option>
</td> <?php
</tr> endforeach;?>
<tr align="left"> </select>
<td valign="top" align="right" class="vtable"><?=gettext("Host"); ?></td> </td>
<td class="vtable" colspan="2"> </tr>
<input name="https_options_host" type="text" <?php if(isset($pconfig['options']['host'])) echo "value=\"" . htmlspecialchars($pconfig['options']['host']) . "\"";?> size="64" /><br /><?=gettext("Hostname for Host: header if needed."); ?> </table>
</td> </div>
</tr> </td>
<tr align="left"> </tr>
<td valign="top" align="right" class="vtable"><?=gettext("HTTP Code"); ?></td> <tr>
<td class="vtable" colspan="2"> <td valign="top">&nbsp;</td>
<?= print_rfc2616_select("https_options_code", isset($pconfig['options']['code'])?$pconfig['options']['code']:""); ?> <td width="78%">
</td> <input name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save"); ?>" />
</tr> <input type="button" class="btn btn-default" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/load_balancer_monitor.php');?>'" />
<!-- BILLM: XXX not supported digest checking just yet <?php if (isset($id)): ?>
<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
<tr align="left"> <?php endif; ?>
<td width="22%" valign="top" class="vncellreq">MD5 Page Digest</td> </td>
<td width="78%" class="vtable" colspan="2"> </tr>
<input name="digest" type="text" <?php if(isset($pconfig['digest'])) echo "value=\"" . htmlspecialchars($pconfig['digest']) . "\"";?>size="32"><br /><b>TODO: add fetch functionality here</b> </table>
</td> </div>
</tr> </form>
--> </div>
</table> </section>
</td> </div>
</tr> </div>
<tr align="left" id="send"<?= $pconfig['type'] == "send" ? "" : " style=\"display:none;\""?>> </section>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Send/Expect"); ?></td>
<td width="78%" class="vtable" colspan="2">
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="send expect">
<tr align="left">
<td valign="top" align="right" class="vtable"><?=gettext("Send string"); ?></td>
<td class="vtable" colspan="2">
<input name="send_options_send" type="text" <?php if(isset($pconfig['options']['send'])) echo "value=\"" . htmlspecialchars($pconfig['options']['send']) . "\"";?> size="64" />
</td>
</tr>
<tr align="left">
<td valign="top" align="right" class="vtable"><?=gettext("Expect string"); ?></td>
<td class="vtable" colspan="2">
<input name="send_options_expect" type="text" <?php if(isset($pconfig['options']['expect'])) echo "value=\"" . htmlspecialchars($pconfig['options']['expect']) . "\"";?> size="64" />
</td>
</tr>
</table>
</td>
</tr>
<tr align="left">
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
<input name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save"); ?>" />
<input type="button" class="btn btn-default" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" />
<?php if (isset($id) && $a_monitor[$id]): ?>
<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
<?php endif; ?>
</td>
</tr>
</table>
</div>
</form>
</div>
</section>
</div>
</div>
</section>
<?php include("foot.inc"); ?> <?php include("foot.inc"); ?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment