Project

General

Profile

Todo #765 ยป pfsense-2.0-BETA3-add-custom-dhcp-configuration.patch

Chris Buechler, 07/28/2010 01:37 PM

View differences:

custom/etc/inc/services.inc 2010-07-12 16:17:42.112987836 +0300
315 315
      		}
316 316
		}
317 317
		
318
		/* Custom dhcp data goes here */
319
		$dhcpdconf .= $dhcpifconf['custom_cdata'];
320

  
318 321
		$dhcpdconf .= <<<EOD
319 322
}
320 323

  
321 324
EOD;
322

  
323 325
		/* add static mappings */
324 326
		if (is_array($dhcpifconf['staticmap'])) {
325 327

  
custom/etc/inc/xmlparse.inc 2010-07-12 15:20:23.244665781 +0300
261 261
						$xmlconfig .= str_repeat("\t", $indent);
262 262
						if((is_bool($cval) && $cval == true) || ($cval === "")) {
263 263
							$xmlconfig .= "<$ent/>\n";
264
						} else if (substr($ent, 0, 5) == "descr") {
264
						} else if (substr($ent, 0, 5) == "descr" or substr($ent, -6) == "_cdata") {
265 265
							$xmlconfig .= "<$ent><![CDATA[" . htmlentities($cval) . "]]></$ent>\n";
266 266
						} else {
267 267
							$xmlconfig .= "<$ent>" . htmlentities($cval) . "</$ent>\n";
......
285 285
				$xmlconfig .= "<$ent/>\n";
286 286
			} else if (!is_bool($val)) {
287 287
				$xmlconfig .= str_repeat("\t", $indent);
288
				if (substr($ent, 0, 5) == "descr")
288
				if (substr($ent, 0, 5) == "descr" or substr($ent, -6) == "_cdata")
289 289
					$xmlconfig .= "<$ent><![CDATA[" . htmlentities($val) . "]]></$ent>\n";
290 290
				else
291 291
					$xmlconfig .= "<$ent>" . htmlentities($val) . "</$ent>\n";
custom/usr/local/www/services_dhcp.php 2010-07-12 16:21:51.004988888 +0300
155 155
	$pconfig['rootpath'] = $config['dhcpd'][$if]['rootpath'];
156 156
	$pconfig['failover_peerip'] = $config['dhcpd'][$if]['failover_peerip'];
157 157
	$pconfig['netmask'] = $config['dhcpd'][$if]['netmask'];
158
	$pconfig['custom_cdata'] = $config['dhcpd'][$if]['custom_cdata'];
158 159
	$pconfig['numberoptions'] = $config['dhcpd'][$if]['numberoptions'];
159 160
	if (!is_array($config['dhcpd'][$if]['staticmap']))
160 161
		$config['dhcpd'][$if]['staticmap'] = array();
......
321 322
		$config['dhcpd'][$if]['next-server'] = $_POST['nextserver'];
322 323
		$config['dhcpd'][$if]['filename'] = $_POST['filename'];
323 324
		$config['dhcpd'][$if]['rootpath'] = $_POST['rootpath'];
325
		$config['dhcpd'][$if]['custom_cdata'] = $_POST['custom_cdata'];
324 326

  
325 327
		// Handle the custom options rowhelper
326 328
		if(isset($config['dhcpd'][$if]['numberoptions']['item']))
......
457 459
		aodiv = document.getElementById('shownetboot');
458 460
		aodiv.style.display = "block";
459 461
	}
462

  
463
	function show_custom_config() {
464
		document.getElementById("showcustombox").innerHTML='';
465
		aodiv = document.getElementById('showcustom');
466
		aodiv.style.display = "block";
467
	}
460 468
</script>
461 469

  
462 470
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
......
793 801
				</td>
794 802
			</tr>
795 803
			<tr>
804
			<td width="22%" valign="top" class="vncell">Custom DHCP configuration</td>
805
			<td width="78%" class="vtable">
806
                                <div id="showcustombox">
807
                                        <input type="button" onClick="show_custom_config()" value="Advanced"></input> - Show custom DHCP configuration</a>
808
                                </div>
809
                                <div id="showcustom" style="display:none">
810
                                        <textarea name="custom_cdata" cols="65" rows="4" class="formpre" id="custom_cdata"><?=htmlspecialchars($pconfig['custom_cdata']);?></textarea><br>
811
                                        Use this to input any ISC DHCP settings that don't fit in the above settings.  If you don't know what this means, don't use this.  Settings here are not checked for validity, so you may break your DHCP setup.  The contents of this box will be inserted into dhcpd.conf as part of the subnet.
812
                                </div>
813
                        </td>
814
			</tr>
815
			<tr>
796 816
			<td width="22%" valign="top">&nbsp;</td>
797 817
			<td width="78%">
798 818
				<input name="if" type="hidden" value="<?=$if;?>">
    (1-1/1)