コード例 #1
0
$a_pools =& $config['installedpackages']['haproxy']['ha_pools']['item'];
if (!is_array($a_pools)) {
    $a_pools = array();
}
$fields_files = array();
$fields_files[0]['name'] = "name";
$fields_files[0]['columnheader'] = "Name";
$fields_files[0]['colwidth'] = "30%";
$fields_files[0]['type'] = "textbox";
$fields_files[0]['size'] = "20";
$fields_files[1]['name'] = "content";
$fields_files[1]['columnheader'] = "content";
$fields_files[1]['colwidth'] = "70%";
$fields_files[1]['type'] = "textarea";
$fields_files[1]['size'] = "70";
$fileslist = new HaproxyHtmlList("table_files", $fields_files);
$fileslist->keyfield = "name";
if ($_POST) {
    $pconfig = $_POST;
    if ($_POST['apply']) {
        $result = haproxy_check_and_run($savemsg, true);
        if ($result) {
            unlink_if_exists($d_haproxyconfdirty_path);
        }
    } else {
        $a_files = $fileslist->haproxy_htmllist_get_values($fields_files);
        $filedupcheck = array();
        foreach ($a_files as $key => $file) {
            $name = $file['name'];
            if (!preg_match("/^[a-zA-Z][a-zA-Z0-9\\.\\-_]*\$/", $file['name'])) {
                $input_errors[] = "The field 'Name' (" . htmlspecialchars($file['name']) . ") contains invalid characters. Use only: a-zA-Z0-9.-_ and start with a letter";
コード例 #2
0
        }
    }
}
function customdrawcell_actions($object, $item, $itemvalue, $editable, $itemname, $counter)
{
    if ($editable) {
        $object->haproxy_htmllist_drawcell($item, $itemvalue, $editable, $itemname, $counter);
    } else {
        //TODO hide fields not applicable.?.
        echo $itemvalue;
    }
}
$htmllist_acls = new HaproxyHtmlList("table_acls", $fields_aclSelectionList);
$htmllist_acls->fields_details = $fields_acl_details;
$htmllist_acls->editmode = true;
$htmllist_actions = new HaproxyHtmlList("table_actions", $fields_actions);
$htmllist_actions->fields_details = $fields_actions_details;
$htmllist_actions->keyfield = "name";
if (isset($id) && $a_pools[$id]) {
    $pconfig['a_acl'] =& $a_pools[$id]['a_acl']['item'];
    if (!is_array($pconfig['a_acl'])) {
        $pconfig['a_acl'] = array();
    }
    $pconfig['a_actionitems'] =& $a_pools[$id]['a_actionitems']['item'];
    if (!is_array($pconfig['a_actionitems'])) {
        $pconfig['a_actionitems'] = array();
    }
    $pconfig['advanced'] = base64_decode($a_pools[$id]['advanced']);
    $pconfig['advanced_backend'] = base64_decode($a_pools[$id]['advanced_backend']);
    $a_servers =& $a_pools[$id]['ha_servers']['item'];
    foreach ($simplefields as $stat) {
コード例 #3
0
$fields_files[0]['columnheader'] = "Name";
$fields_files[0]['colwidth'] = "20%";
$fields_files[0]['type'] = "textbox";
$fields_files[0]['size'] = "20";
$fields_files[1]['name'] = "type";
$fields_files[1]['columnheader'] = "Type";
$fields_files[1]['colwidth'] = "10%";
$fields_files[1]['type'] = "select";
$fields_files[1]['size'] = "10";
$fields_files[1]['items'] = $a_filestype;
$fields_files[2]['name'] = "content";
$fields_files[2]['columnheader'] = "content";
$fields_files[2]['colwidth'] = "70%";
$fields_files[2]['type'] = "textarea";
$fields_files[2]['size'] = "70";
$fileslist = new HaproxyHtmlList("table_files", $fields_files);
$fileslist->keyfield = "name";
if ($_POST) {
    $pconfig = $_POST;
    if ($_POST['apply']) {
        $result = haproxy_check_and_run($savemsg, true);
        if ($result) {
            unlink_if_exists($d_haproxyconfdirty_path);
        }
    } else {
        $a_files = $fileslist->haproxy_htmllist_get_values();
        $filedupcheck = array();
        foreach ($a_files as $key => $file) {
            $name = $file['name'];
            if (!preg_match("/^[a-zA-Z][a-zA-Z0-9\\.\\-_]*\$/", $file['name'])) {
                $input_errors[] = "The field 'Name' (" . htmlspecialchars($file['name']) . ") contains invalid characters. Use only: a-zA-Z0-9.-_ and start with a letter";
コード例 #4
0
$fields_mailers[0]['name'] = "name";
$fields_mailers[0]['columnheader'] = "Name";
$fields_mailers[0]['colwidth'] = "30%";
$fields_mailers[0]['type'] = "textbox";
$fields_mailers[0]['size'] = "20";
$fields_mailers[1]['name'] = "mailserver";
$fields_mailers[1]['columnheader'] = "Mailserver";
$fields_mailers[1]['colwidth'] = "60%";
$fields_mailers[1]['type'] = "textbox";
$fields_mailers[1]['size'] = "60";
$fields_mailers[2]['name'] = "mailserverport";
$fields_mailers[2]['columnheader'] = "Mailserverport";
$fields_mailers[2]['colwidth'] = "10%";
$fields_mailers[2]['type'] = "textbox";
$fields_mailers[2]['size'] = "10";
$mailerslist = new HaproxyHtmlList("table_mailers", $fields_mailers);
$mailerslist->keyfield = "name";
if (!is_array($config['installedpackages']['haproxy'])) {
    $config['installedpackages']['haproxy'] = array();
}
if ($_POST) {
    unset($input_errors);
    $pconfig = $_POST;
    if ($_POST['calculate_certificate_chain']) {
        $changed = haproxy_recalculate_certifcate_chain();
        if ($changed > 0) {
            touch($d_haproxyconfdirty_path);
        }
    } else {
        if ($_POST['apply']) {
            $result = haproxy_check_and_run($savemsg, true);
コード例 #5
0
$fields_resolvers[0]['colwidth'] = "30%";
$fields_resolvers[0]['type'] = "textbox";
$fields_resolvers[0]['size'] = "20";
$fields_resolvers[1]['name'] = "server";
$fields_resolvers[1]['columnheader'] = "DNSserver";
$fields_resolvers[1]['colwidth'] = "60%";
$fields_resolvers[1]['type'] = "textbox";
$fields_resolvers[1]['size'] = "60";
$fields_resolvers[2]['name'] = "port";
$fields_resolvers[2]['columnheader'] = "DNSport";
$fields_resolvers[2]['colwidth'] = "10%";
$fields_resolvers[2]['type'] = "textbox";
$fields_resolvers[2]['size'] = "10";
$mailerslist = new HaproxyHtmlList("table_mailers", $fields_mailers);
$mailerslist->keyfield = "name";
$resolverslist = new HaproxyHtmlList("table_resolvers", $fields_resolvers);
$resolverslist->keyfield = "name";
if (!is_array($config['installedpackages']['haproxy'])) {
    $config['installedpackages']['haproxy'] = array();
}
if ($_POST) {
    unset($input_errors);
    $pconfig = $_POST;
    if ($_POST['calculate_certificate_chain']) {
        $changed = haproxy_recalculate_certifcate_chain();
        if ($changed > 0) {
            touch($d_haproxyconfdirty_path);
        }
    } else {
        if ($_POST['apply']) {
            $result = haproxy_check_and_run($savemsg, true);
コード例 #6
0
		</tr>
		<tr class="haproxy_secondary" align="left">
			<td width="22%" valign="top" class="vncellreq">Primary frontend</td>
			<td width="78%" class="vtable" colspan="2">
				<?php 
echo_html_select('primary_frontend', $primaryfrontends, $pconfig['primary_frontend'], "You must first create a 'primary' frontend.", "updatevisibility();");
?>
			</td>
		</tr>
		<tr class="haproxy_primary">
			  <td width="22%" valign="top" class="vncellreq">External address</td>
			  <td width="78%" class="vtable">
			<?php 
$counter = 0;
$a_extaddr = $pconfig['a_extaddr'];
$htmllist_extadd = new HaproxyHtmlList("table_extaddr", $fields_externalAddress);
$htmllist_extadd->editmode = true;
$htmllist_extadd->Draw($a_extaddr);
?>
			<script type="text/javascript">
			function table_extaddr_row_added(tableid, rowid){
				new AutoSuggestControl(document.getElementById("extaddr_custom"+rowid), new StateSuggestions(address_array));
				new AutoSuggestControl(document.getElementById("extaddr_port"+rowid), new StateSuggestions(port_array));
				table_extaddr_listitem_change(tableid,"",rowid, null);//disables address when not set to custom.
			}
			
			function table_extaddr_listitem_change(tableId, fieldId, rowNr, field) {
				if (fieldId == "extaddr" || fieldId == "") {
					field = field || document.getElementById("extaddr"+rowNr);
					customEdit = document.getElementById("extaddr_custom"+rowNr);
					customdisabled = field.value == "custom" ? 0 : 1;