Skip to content

Instantly share code, notes, and snippets.

@rbgarga
Created August 26, 2015 15:22
Show Gist options
  • Save rbgarga/ae4199472fd9a63bd5a9 to your computer and use it in GitHub Desktop.
Save rbgarga/ae4199472fd9a63bd5a9 to your computer and use it in GitHub Desktop.
diff --exclude=.git --exclude=conf -ruNw ../bootstrap/usr/local/www/bandwidth_by_ip.php ./usr/local/www/bandwidth_by_ip.php
--- ../bootstrap/usr/local/www/bandwidth_by_ip.php 2015-08-26 10:03:32.000000000 -0300
+++ ./usr/local/www/bandwidth_by_ip.php 2015-08-26 12:14:09.000000000 -0300
@@ -1,8 +1,6 @@
<?php
/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- *
+ bandwidth_by_ip.php
*/
/*
@@ -146,7 +144,7 @@
unset($listedIPs);
//no bandwidth usage found
-if ($someinfo == false)
+if ($someinfo == false) {
echo gettext("no info");
-
+}
?>
\ No newline at end of file
diff --exclude=.git --exclude=conf -ruNw ../bootstrap/usr/local/www/carp_status.php ./usr/local/www/carp_status.php
--- ../bootstrap/usr/local/www/carp_status.php 2015-08-26 11:06:17.000000000 -0300
+++ ./usr/local/www/carp_status.php 2015-08-26 12:14:09.000000000 -0300
@@ -176,8 +176,9 @@
</tr>
<?php
foreach($config['virtualip']['vip'] as $carp) {
- if ($carp['mode'] != "carp")
+ if ($carp['mode'] != "carp") {
continue;
+ }
$ipaddress = $carp['subnet'];
$vhid = $carp['vhid'];
$status = get_carp_interface_status("{$carp['interface']}_vip{$carp['vhid']}");
diff --exclude=.git --exclude=conf -ruNw ../bootstrap/usr/local/www/diag_defaults.php ./usr/local/www/diag_defaults.php
--- ../bootstrap/usr/local/www/diag_defaults.php 2015-08-26 11:06:17.000000000 -0300
+++ ./usr/local/www/diag_defaults.php 2015-08-26 12:14:09.000000000 -0300
@@ -76,8 +76,8 @@
</ul>
<p><strong><?=gettext("Are you sure you want to proceed?")?></strong></p>
<p>
- <input name="Submit" type="submit" class="btn btn-sm btn-success" value=" <?=gettext("Yes")?> " />
- <input name="Submit" type="submit" class="btn btn-sm btn-default" value=" <?=gettext("No")?> " />
+ <input name="Submit" type="submit" class="formbtn" value=" <?=gettext("Yes")?> " />
+ <input name="Submit" type="submit" class="formbtn" value=" <?=gettext("No")?> " />
</p>
</form>
<?php endif?>
diff --exclude=.git --exclude=conf -ruNw ../bootstrap/usr/local/www/firewall_schedule_edit.php ./usr/local/www/firewall_schedule_edit.php
--- ../bootstrap/usr/local/www/firewall_schedule_edit.php 2015-08-26 11:06:17.000000000 -0300
+++ ./usr/local/www/firewall_schedule_edit.php 2015-08-26 12:20:11.000000000 -0300
@@ -48,8 +48,9 @@
function schedule_sort(){
global $g, $config;
- if (!is_array($config['schedules']['schedule']))
+ if (!is_array($config['schedules']['schedule'])) {
return;
+ }
usort($config['schedules']['schedule'], "schedulecmp");
}
@@ -61,20 +62,27 @@
$pgtitle = array(gettext("Firewall"),gettext("Schedules"),gettext("Edit"));
+if (isset($_POST['referer'])) {
+ $referer = $_POST['referer'];
+} else {
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_schedule.php');
+}
$dayArray = array (gettext('Mon'),gettext('Tues'),gettext('Wed'),gettext('Thur'),gettext('Fri'),gettext('Sat'),gettext('Sun'));
$monthArray = array (gettext('January'),gettext('February'),gettext('March'),gettext('April'),gettext('May'),gettext('June'),gettext('July'),gettext('August'),gettext('September'),gettext('October'),gettext('November'),gettext('December'));
-if (!is_array($config['schedules']['schedule']))
+if (!is_array($config['schedules']['schedule'])) {
$config['schedules']['schedule'] = array();
+}
$a_schedules = &$config['schedules']['schedule'];
-if (is_numericint($_GET['id']))
+if (is_numericint($_GET['id'])) {
$id = $_GET['id'];
-if (isset($_POST['id']) && is_numericint($_POST['id']))
+}
+if (isset($_POST['id']) && is_numericint($_POST['id'])) {
$id = $_POST['id'];
+}
if (isset($id) && $a_schedules[$id]) {
$pconfig['name'] = $a_schedules[$id]['name'];
@@ -86,25 +94,30 @@
if ($_POST) {
- if(strtolower($_POST['name']) == "lan")
+ if (strtolower($_POST['name']) == "lan") {
$input_errors[] = gettext("Schedule may not be named LAN.");
- if(strtolower($_POST['name']) == "wan")
+ }
+ if (strtolower($_POST['name']) == "wan") {
$input_errors[] = gettext("Schedule may not be named WAN.");
- if(strtolower($_POST['name']) == "")
+ }
+ if (strtolower($_POST['name']) == "") {
$input_errors[] = gettext("Schedule name cannot be blank.");
+ }
$x = is_validaliasname($_POST['name']);
if (!isset($x)) {
$input_errors[] = gettext("Reserved word used for schedule name.");
} else {
- if (is_validaliasname($_POST['name']) == false)
+ if (is_validaliasname($_POST['name']) == false) {
$input_errors[] = gettext("The schedule name may only consist of the characters a-z, A-Z, 0-9");
}
+ }
/* check for name conflicts */
foreach ($a_schedules as $schedule) {
- if (isset($id) && ($a_schedules[$id]) && ($a_schedules[$id] === $schedule))
+ if (isset($id) && ($a_schedules[$id]) && ($a_schedules[$id] === $schedule)) {
continue;
+ }
if ($schedule['name'] == $_POST['name']) {
$input_errors[] = gettext("A Schedule with this name already exists.");
@@ -118,7 +131,6 @@
$schedule['descr'] = htmlentities($_POST['descr'], ENT_QUOTES, 'UTF-8');
$timerangeFound = false;
-
for ($x=0; $x<99; $x++){
if($_POST['schedule' . $x]) {
if (!preg_match('/^[0-9]+:[0-9]+$/', $_POST['starttime' . $x])) {
@@ -140,22 +152,16 @@
$timehourstr .= $_POST['stoptime' . $x];
$timedescrstr = htmlentities($_POST['timedescr' . $x], ENT_QUOTES, 'UTF-8');
$dashpos = strpos($timestr, '-');
-
- if ($dashpos === false)
- {
+ if ($dashpos === false) {
$timeparts['position'] = $timestr;
- }
- else
- {
+ } else {
$tempindarray = array();
$monthstr = "";
$daystr = "";
$tempindarray = explode(",", $timestr);
- foreach ($tempindarray as $currentselection)
- {
+ foreach ($tempindarray as $currentselection) {
if ($currentselection){
- if ($firstprint)
- {
+ if ($firstprint) {
$monthstr .= ",";
$daystr .= ",";
}
@@ -171,47 +177,44 @@
$timeparts['month'] = $monthstr;
$timeparts['day'] = $daystr;
}
-
$timeparts['hour'] = $timehourstr;
$timeparts['rangedescr'] = $timedescrstr;
$schedule['timerange'][$x] = $timeparts;
}
}
- if (!$timerangeFound)
+ if (!$timerangeFound) {
$input_errors[] = gettext("The schedule must have at least one time range configured.");
+ }
if (!$input_errors) {
- if (!empty($pconfig['schedlabel']))
+ if (!empty($pconfig['schedlabel'])) {
$schedule['schedlabel'] = $pconfig['schedlabel'];
- else
+ } else {
$schedule['schedlabel'] = uniqid();
+ }
if (isset($id) && $a_schedules[$id]){
$a_schedules[$id] = $schedule;
- }
- else{
+ } else {
$a_schedules[] = $schedule;
}
schedule_sort();
-
- if (write_config())
+ if (write_config()) {
filter_configure();
+ }
header("Location: firewall_schedule.php");
exit;
-
- }
+ } else {
//we received input errors, copy data to prevent retype
- else
- {
- if (!$_POST['schedule0'])
+ if (!$_POST['schedule0']) {
$getSchedule = false;
- else
+ } else {
$getSchedule = true;
-
+ }
$pconfig['name'] = $schedule['name'];
$pconfig['descr'] = $schedule['descr'];
$pconfig['timerange'] = $schedule['timerange'];
@@ -220,7 +223,6 @@
}
include("head.inc");
-
// Returns a string containg the HTML to display a calendar table
function build_date_table() {
$tblstr = "";
diff --exclude=.git --exclude=conf -ruNw ../bootstrap/usr/local/www/halt.php ./usr/local/www/halt.php
--- ../bootstrap/usr/local/www/halt.php 2015-08-26 11:06:17.000000000 -0300
+++ ./usr/local/www/halt.php 2015-08-26 12:14:09.000000000 -0300
@@ -44,7 +44,7 @@
##|-PRIV
// Set DEBUG to true to prevent the system_halt() function from being called
-define("DEBUG", false);
+define("DEBUG", true);
require("guiconfig.inc");
require("functions.inc");
diff --exclude=.git --exclude=conf -ruNw ../bootstrap/usr/local/www/jquery/pfSense.js ./usr/local/www/jquery/pfSense.js
--- ../bootstrap/usr/local/www/jquery/pfSense.js 2015-08-26 11:06:17.000000000 -0300
+++ ./usr/local/www/jquery/pfSense.js 2015-08-26 12:14:09.000000000 -0300
@@ -41,7 +41,7 @@
var groups = $('div.form-group.user-duplication-horiz');
var controlsContainer = $('<div class="col-sm-2"></div>');
var plus = $('<a class="btn btn-sm btn-success">Duplicate</a>');
- var minus = $('<a class="btn btn-sm btn-warning">Delete</a>');
+ var minus = $('<a class="btn btn-sm btn-danger">Delete</a>');
minus.on('click', function(){
$(this).parents('div.form-group').remove();
diff --exclude=.git --exclude=conf -ruNw ../bootstrap/usr/local/www/load_balancer_pool.php ./usr/local/www/load_balancer_pool.php
--- ../bootstrap/usr/local/www/load_balancer_pool.php 2015-08-26 10:03:32.000000000 -0300
+++ ./usr/local/www/load_balancer_pool.php 2015-08-26 12:14:09.000000000 -0300
@@ -48,7 +48,6 @@
if (!is_array($config['load_balancer']['lbpool'])) {
$config['load_balancer']['lbpool'] = array();
}
-
$a_pool = &$config['load_balancer']['lbpool'];
@@ -92,7 +91,6 @@
for ($i = 0; isset($config['load_balancer']['monitor_type'][$i]); $i++) {
$mondex[$config['load_balancer']['monitor_type'][$i]['name']] = $i;
}
-
for ($i = 0; isset($config['load_balancer']['lbpool'][$i]); $i++) {
$a_pool[$i]['monitor'] = "<a href=\"/load_balancer_monitor_edit.php?id={$mondex[$a_pool[$i]['monitor']]}\">" . htmlspecialchars($a_pool[$i]['monitor']) . "</a>";
}
@@ -102,15 +100,18 @@
include("head.inc");
-if ($input_errors)
- print_input_errors($input_errors);
-
-if ($savemsg)
- print_info_box($savemsg);
-
-if (is_subsystem_dirty('loadbalancer'))
- print_info_box_np(sprintf(gettext("The load balancer configuration has been changed%sYou must apply the changes in order for them to take effect."), "<br />"));
-
+?>
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<form action="load_balancer_pool.php" method="post">
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<?php if (is_subsystem_dirty('loadbalancer')): ?><br/>
+<?php print_info_box_np(sprintf(gettext("The load balancer configuration has been changed%sYou must apply the changes in order for them to take effect."), "<br />"));?><br />
+<?php endif; ?>
+<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="load balancer pools">
+ <tr><td class="tabnavtbl">
+ <?php
/* active tabs */
$tab_array = array();
$tab_array[] = array(gettext("Pools"), true, "load_balancer_pool.php");
@@ -118,76 +119,41 @@
$tab_array[] = array(gettext("Monitors"), false, "load_balancer_monitor.php");
$tab_array[] = array(gettext("Settings"), false, "load_balancer_setting.php");
display_top_tabs($tab_array);
-
-?>
-<form action="load_balancer_pool.php" method="post">
- <div class="panel panel-default">
- <div class="panel-heading"><h2 class="panel-title"><?=gettext('Pool')?></h2></div>
- <div class="panel-body table-responsive">
- <table class="table table-striped table-hover table-condensed">
- <thead>
- <tr>
- <th><?=gettext('Name')?></th>
- <th><?=gettext('Mode')?></th>
- <th><?=gettext('Servers')?></th>
- <th><?=gettext('Port')?></th>
- <th><?=gettext('Monitor')?></th>
- <th><?=gettext('Description')?></th>
- <th></th>
- </tr>
- </thead>
- <tbody>
-<?php
-
-$idx = 0;
-foreach($a_pool as $pool) {
?>
+ </td></tr>
<tr>
<td>
- <?=$pool['name']?>
- </td>
- <td>
- <?=$pool['mode']?>
- </td>
- <td>
+ <div id="mainarea">
<?php
- $numsvrs = count($pool['servers']) - 1;
-
- foreach ($pool['servers'] as $server => $ip) {
- print($ip);
- print(($server < $numsvrs) ? '<br />':'');
- }
-
+ $t = new MainTable();
+ $t->edit_uri('load_balancer_pool_edit.php');
+ $t->my_uri('load_balancer_pool.php');
+ $t->add_column(gettext('Name'), 'name', 10);
+ $t->add_column(gettext('Mode'), 'mode', 10);
+ $t->add_column(gettext('Servers'), 'servers', 15);
+ $t->add_column(gettext('Port'), 'port', 10);
+ $t->add_column(gettext('Monitor'), 'monitor', 10);
+ $t->add_column(gettext('Description'), 'descr', 25);
+ $t->add_button('edit');
+ $t->add_button('dup');
+ $t->add_button('del');
+ $t->add_content_array($a_pool);
+ $t->display();
?>
+ </div>
</td>
+ </tr>
+ <tr>
<td>
- <?=$pool['port']?>
- </td>
- <td>
- <?=$pool['monitor']?>
- </td>
- <td>
- <?=$pool['descr']?>
- </td>
- <td>
- <a href="load_balancer_pool_edit.php?id=<?=$idx?>" class="btn btn-xs btn-info"><?=gettext('Edit')?></a>
- <a href="load_balancer_pool.php?act=del&id=<?=$idx?>" class="btn btn-xs btn-danger"><?=gettext('Delete')?></a>
- <a href="load_balancer_pool_edit.php?act=dup&id=<?=$idx?>" class="btn btn-xs btn-default"><?=gettext('Duplicate')?></a>
+ <br />
+ <span class="red"><strong><?=gettext("Hint:");?></strong></span>
+ <br />
+ <?= sprintf(gettext("The Load Balancer in %s 2.0 is for server load balancing, not Multi-WAN. For load balancing or failover for multiple WANs, use "), $g['product_name']);?>
+ <a href="/system_gateway_groups.php"><?= gettext("Gateway Groups"); ?></a>
</td>
</tr>
-<?php
- $idx++;
-}
-?>
- </tbody>
</table>
- </div>
-
- <nav class="action-buttons">
- <a href="load_balancer_pool_edit.php" class="btn btn-success"><?=gettext('Add')?></a>
- </nav>
-
- </div>
</form>
-
-<?php include("foot.inc");
\ No newline at end of file
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --exclude=.git --exclude=conf -ruNw ../bootstrap/usr/local/www/load_balancer_pool_edit.php ./usr/local/www/load_balancer_pool_edit.php
--- ../bootstrap/usr/local/www/load_balancer_pool_edit.php 2015-08-26 10:03:32.000000000 -0300
+++ ./usr/local/www/load_balancer_pool_edit.php 2015-08-26 12:14:09.000000000 -0300
@@ -44,18 +44,23 @@
require_once("filter.inc");
require_once("util.inc");
+if (isset($_POST['referer'])) {
+ $referer = $_POST['referer'];
+} else {
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/load_balancer_pool.php');
+}
if (!is_array($config['load_balancer']['lbpool'])) {
$config['load_balancer']['lbpool'] = array();
}
-
$a_pool = &$config['load_balancer']['lbpool'];
-if (is_numericint($_GET['id']))
+if (is_numericint($_GET['id'])) {
$id = $_GET['id'];
-if (isset($_POST['id']) && is_numericint($_POST['id']))
+}
+if (isset($_POST['id']) && is_numericint($_POST['id'])) {
$id = $_POST['id'];
+}
if (isset($id) && $a_pool[$id]) {
$pconfig['name'] = $a_pool[$id]['name'];
@@ -84,66 +89,72 @@
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
/* Ensure that our pool names are unique */
- for ($i=0; isset($config['load_balancer']['lbpool'][$i]); $i++)
- if (($_POST['name'] == $config['load_balancer']['lbpool'][$i]['name']) && ($i != $id))
+ for ($i = 0; isset($config['load_balancer']['lbpool'][$i]); $i++) {
+ if (($_POST['name'] == $config['load_balancer']['lbpool'][$i]['name']) && ($i != $id)) {
$input_errors[] = gettext("This pool name has already been used. Pool names must be unique.");
+ }
+ }
- if (preg_match('/[ \/]/', $_POST['name']))
+ if (preg_match('/[ \/]/', $_POST['name'])) {
$input_errors[] = gettext("You cannot use spaces or slashes in the 'name' field.");
+ }
- if (strlen($_POST['name']) > 16)
+ if (strlen($_POST['name']) > 16) {
$input_errors[] = gettext("The 'name' field must be 16 characters or less.");
+ }
- if (in_array($_POST['name'], $reserved_table_names))
+ if (in_array($_POST['name'], $reserved_table_names)) {
$input_errors[] = sprintf(gettext("The name '%s' is a reserved word and cannot be used."), $_POST['name']);
+ }
- if (is_alias($_POST['name']))
+ if (is_alias($_POST['name'])) {
$input_errors[] = sprintf(gettext("Sorry, an alias is already named %s."), $_POST['name']);
+ }
- if (!is_portoralias($_POST['port']))
+ if (!is_portoralias($_POST['port'])) {
$input_errors[] = gettext("The port must be an integer between 1 and 65535, or a port alias.");
+ }
// May as well use is_port as we want a positive integer and such.
- if (!empty($_POST['retry']) && !is_port($_POST['retry']))
+ if (!empty($_POST['retry']) && !is_port($_POST['retry'])) {
$input_errors[] = gettext("The retry value must be an integer between 1 and 65535.");
+ }
if (is_array($_POST['servers'])) {
foreach($pconfig['servers'] as $svrent) {
if (!is_ipaddr($svrent) && !is_subnetv4($svrent)) {
$input_errors[] = sprintf(gettext("%s is not a valid IP address or IPv4 subnet (in \"enabled\" list)."), $svrent);
- }
- else if (is_subnetv4($svrent) && subnet_size($svrent) > 64) {
+ } else if (is_subnetv4($svrent) && subnet_size($svrent) > 64) {
$input_errors[] = sprintf(gettext("%s is a subnet containing more than 64 IP addresses (in \"enabled\" list)."), $svrent);
}
}
}
-
if (is_array($_POST['serversdisabled'])) {
foreach($pconfig['serversdisabled'] as $svrent) {
if (!is_ipaddr($svrent) && !is_subnetv4($svrent)) {
$input_errors[] = sprintf(gettext("%s is not a valid IP address or IPv4 subnet (in \"disabled\" list)."), $svrent);
- }
- else if (is_subnetv4($svrent) && subnet_size($svrent) > 64) {
+ } else if (is_subnetv4($svrent) && subnet_size($svrent) > 64) {
$input_errors[] = sprintf(gettext("%s is a subnet containing more than 64 IP addresses (in \"disabled\" list)."), $svrent);
}
}
}
-
$m = array();
-
- for ($i=0; isset($config['load_balancer']['monitor_type'][$i]); $i++)
+ for ($i = 0; isset($config['load_balancer']['monitor_type'][$i]); $i++) {
$m[$config['load_balancer']['monitor_type'][$i]['name']] = $config['load_balancer']['monitor_type'][$i];
+ }
- if (!isset($m[$_POST['monitor']]))
+ if (!isset($m[$_POST['monitor']])) {
$input_errors[] = gettext("Invalid monitor chosen.");
+ }
if (!$input_errors) {
$poolent = array();
- if(isset($id) && $a_pool[$id])
+ if (isset($id) && $a_pool[$id]) {
$poolent = $a_pool[$id];
-
- if($poolent['name'] != "")
+ }
+ if ($poolent['name'] != "") {
$changedesc .= sprintf(gettext(" modified '%s' pool:"), $poolent['name']);
+ }
update_if_changed("name", $poolent['name'], $_POST['name']);
update_if_changed("mode", $poolent['mode'], $_POST['mode']);
@@ -157,12 +168,14 @@
if (isset($id) && $a_pool[$id]) {
/* modify all virtual servers with this name */
for ($i = 0; isset($config['load_balancer']['virtual_server'][$i]); $i++) {
- if ($config['load_balancer']['virtual_server'][$i]['lbpool'] == $a_pool[$id]['name'])
+ if ($config['load_balancer']['virtual_server'][$i]['lbpool'] == $a_pool[$id]['name']) {
$config['load_balancer']['virtual_server'][$i]['lbpool'] = $poolent['name'];
}
+ }
$a_pool[$id] = $poolent;
- } else
+ } else {
$a_pool[] = $poolent;
+ }
if ($changecount > 0) {
/* Mark pool dirty */
@@ -179,268 +192,177 @@
$shortcut_section = "relayd";
include("head.inc");
+
?>
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
-
- // Disables the specified input element
- function disableInput(id, disable) {
- $('#' + id).prop("disabled", disable);
- }
-
- // Select every option in the specified multiselect
- function AllServers(id, selectAll) {
- for (i = 0; i < id.length; i++) {
- id.eq(i).prop('selected', selectAll);
+function clearcombo() {
+ for (var i = document.iform.serversSelect.options.length - 1; i >= 0; i--) {
+ document.iform.serversSelect.options[i] = null;
}
+ document.iform.serversSelect.selectedIndex = -1;
}
+//]]>
+</script>
- // Move all selected options from one multiselect to another
- function moveOptions(From, To) {
- var len = From.length;
- var option;
+<script type="text/javascript" src="/javascript/autosuggest.js?rev=1"></script>
+<script type="text/javascript" src="/javascript/suggestions.js"></script>
- if(len > 1) {
- for(i=0; i<len; i++) {
- if(From.eq(i).is(':selected')) {
- option = From.eq(i).val();
- To.append(new Option(option, option));
- From.eq(i).remove();
- }
- }
- }
- }
-
- function checkPoolControls() {
+<?php if ($input_errors) print_input_errors($input_errors); ?>
- if ($("#mode").val() == "failover") {
- disableInput('movetoenabled', $('[name="servers[]"] option').length > 0);
+<form action="load_balancer_pool_edit.php" method="post" name="iform" id="iform">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="load balancer pool entry">
+ <tr>
+ <td colspan="2" valign="top" class="listtopic"><?=gettext("Add/edit Load Balancer - Pool entry"); ?></td>
+ </tr>
+ <tr align="left">
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Name"); ?></td>
+ <td width="78%" class="vtable" colspan="2">
+ <input name="name" type="text" <?if (isset($pconfig['name'])) echo "value=\"" . htmlspecialchars($pconfig['name']) . "\"";?> size="16" maxlength="16" />
+ </td>
+ </tr>
+ <tr align="left">
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Mode"); ?></td>
+ <td width="78%" class="vtable" colspan="2">
+ <select id="mode" name="mode" onchange="enforceFailover(); checkPoolControls();">
+ <option value="loadbalance" <?if (!isset($pconfig['mode']) || ($pconfig['mode'] == "loadbalance")) echo "selected=\"selected\"";?>><?=gettext("Load Balance");?></option>
+ <option value="failover" <?if ($pconfig['mode'] == "failover") echo "selected=\"selected\"";?>><?=gettext("Manual Failover");?></option>
+ </select>
+ </td>
+ </tr>
+ <tr align="left">
+ <td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
+ <td width="78%" class="vtable" colspan="2">
+ <input name="descr" type="text" <?if (isset($pconfig['descr'])) echo "value=\"" . htmlspecialchars($pconfig['descr']) . "\"";?> size="64" />
+ </td>
+ </tr>
+
+ <tr align="left">
+ <td width="22%" valign="top" id="monitorport_text" class="vncellreq"><?=gettext("Port"); ?></td>
+ <td width="78%" class="vtable" colspan="2">
+ <input class="formfldalias" id="port" name="port" type="text" <?if (isset($pconfig['port'])) echo "value=\"" . htmlspecialchars($pconfig['port']) . "\"";?> size="16" maxlength="16" /><br />
+ <div id="monitorport_desc">
+ <?=gettext("This is the port your servers are listening on."); ?><br />
+ <?=gettext("You may also specify a port alias listed in Firewall -&gt; Aliases here."); ?>
+ </div>
+ <script type="text/javascript">
+ //<![CDATA[
+ var addressarray = <?= json_encode(get_alias_list(array("port", "url_ports", "urltable_ports"))) ?>;
+ var oTextbox1 = new AutoSuggestControl(document.getElementById("port"), new StateSuggestions(addressarray));
+ //]]>
+ </script>
+ </td>
+ </tr>
+ <tr align="left">
+ <td width="22%" valign="top" id="retry_text" class="vncell"><?=gettext("Retry"); ?></td>
+ <td width="78%" class="vtable" colspan="2">
+ <input name="retry" type="text" <?if (isset($pconfig['retry'])) echo "value=\"" . htmlspecialchars($pconfig['retry']) . "\"";?> size="16" maxlength="16" /><br />
+ <div id="retry_desc"><?=gettext("Optionally specify how many times to retry checking a server before declaring it down."); ?></div>
+ </td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic"><?=gettext("Add item to pool"); ?></td>
+ </tr>
+ <tr align="left">
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Monitor"); ?></td>
+ <td width="78%" class="vtable" colspan="2">
+ <?php if (count($config['load_balancer']['monitor_type'])): ?>
+ <select id="monitor" name="monitor">
+ <?php
+ foreach ($config['load_balancer']['monitor_type'] as $monitor) {
+ if ($monitor['name'] == $pconfig['monitor']) {
+ $selected=" selected=\"selected\"";
} else {
- disableInput('movetoenabled',false);
- }
- }
-
- // Move (copy/delete) all but one of the items in the Enabled (server) list to the Disabled list
- function enforceFailover() {
- if ($('#mode').val() != 'failover') {
- return;
+ $selected = "";
}
-
- var len = $('[name="servers[]"] option').length;
- var option;
-
- if(len > 1) {
- for(i=len-1; i>0; i--) {
- option = $('[name="servers[]"] option').eq(i).val();
- $('[name="serversdisabled[]"]').append(new Option(option, option));
- $('[name="servers[]"] option').eq(i).remove();
+ echo "<option value=\"{$monitor['name']}\"{$selected}>{$monitor['name']}</option>";
}
+ ?>
+ </select>
+ <?php else: ?>
+ <b><?=gettext("NOTE"); ?>:</b> <?=gettext("Please add a monitor IP address on the monitors tab if you wish to use this feature."); ?>
+ <?php endif; ?>
+ </td>
+ </tr>
+ <tr align="left">
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Server IP Address"); ?></td>
+ <td width="78%" class="vtable" colspan="2">
+ <input name="ipaddr" type="text" size="16" style="float: left;" />
+ <input class="formbtn" type="button" name="button1" value="<?=gettext("Add to pool"); ?>" onclick="AddServerToPool(document.iform); enforceFailover(); checkPoolControls();" /><br />
+ </td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td colspan="2" valign="top" class="listtopic"><?=gettext("Current Pool Members"); ?></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Members"); ?></td>
+ <td width="78%" class="vtable" colspan="2" valign="top">
+ <table summary="members">
+ <tbody>
+ <tr>
+ <td align="center">
+ <b><?=gettext("Pool Disabled"); ?></b>
+ <br/>
+ <select id="serversDisabledSelect" name="serversdisabled[]" multiple="multiple" size="5">
+<?php
+ if (is_array($pconfig['serversdisabled'])) {
+ foreach ($pconfig['serversdisabled'] as $svrent) {
+ if ($svrent != '') echo " <option value=\"{$svrent}\">{$svrent}</option>\n";
}
}
-
- // Make buttons plain buttons, not a submit
- $("#btnaddtopool").prop('type','button');
- $("#removeenabled").prop('type','button');
- $("#removedisabled").prop('type','button');
- $("#movetodisabled").prop('type','button');
- $("#movetoenabled").prop('type','button');
-
- // On click . .
- $("#btnaddtopool").click(function() {
- $('[name="servers[]"]').append(new Option($('#ipaddr').val(), $('#ipaddr').val()));
- enforceFailover();
- checkPoolControls();
- });
-
- $('#mode').on('change', function() {
- enforceFailover();
- checkPoolControls();
- });
-
- $("#removeenabled").click(function() {
- $('[name="servers[]"] option:selected').remove();
- });
-
- $("#removedisabled").click(function() {
- $('[name="serversdisabled[]"] option:selected').remove();
- });
-
- $("#movetodisabled").click(function() {
- moveOptions($('[name="servers[]"] option'), $('[name="serversdisabled[]"]'));
- });
-
- $("#movetoenabled").click(function() {
- moveOptions($('[name="serversdisabled[]"] option'), $('[name="servers[]"]'));
- });
-
- // On initial page load
- checkPoolControls();
-
- // On submit
- $('form').submit(function(){
- AllServers($('[name="servers[]"] option'), true);
- AllServers($('[name="serversdisabled[]"] option'), true);
- });
-
-});
-//]]>
-</script>
-
+?>
+ </select>
+ <input class="formbtn" type="button" name="removeDisabled" value="<?=gettext("Remove"); ?>" onclick="RemoveServerFromPool(document.iform, 'serversdisabled[]');" />
+ </td>
+
+ <td valign="middle">
+ <input class="formbtn" type="button" id="moveToEnabled" name="moveToEnabled" value=">" onclick="moveOptions(document.iform.serversDisabledSelect, document.iform.serversSelect); checkPoolControls();" /><br />
+ <input class="formbtn" type="button" id="moveToDisabled" name="moveToDisabled" value="<" onclick="moveOptions(document.iform.serversSelect, document.iform.serversDisabledSelect); checkPoolControls();" />
+ </td>
+
+ <td align="center">
+ <b><?=gettext("Enabled (default)"); ?></b>
+ <br/>
+ <select id="serversSelect" name="servers[]" multiple="multiple" size="5">
<?php
-if ($input_errors)
- print_input_errors($input_errors);
-
-require('classes/Form.class.php');
-
-$form = new Form(new Form_Button(
- 'Submit',
- gettext("Save")
-));
-
-$section = new Form_Section('Add/edit Load Balancer - Pool entry');
-
-$section->addInput(new Form_Input(
- 'name',
- 'Name',
- 'text',
- $pconfig['name']
-));
-
-$section->addInput(new Form_Select(
- 'mode',
- 'Mode',
- $pconfig['mode'],
- array(
- 'loadbalance' => 'Load Balance',
- 'failover' => 'Manual Failover'
- )
-));
-
-$section->addInput(new Form_Input(
- 'descr',
- 'Description',
- 'text',
- $pconfig['descr']
-));
-
-$section->addInput(new Form_Input(
- 'port',
- 'Port',
- 'text',
- $pconfig['port']
-))->setHelp('This is the port your servers are listening on. You may also specify a port alias listed in Firewall -> Aliases here.');
-
-$section->addInput(new Form_Input(
- 'retry',
- 'Retry',
- 'number',
- $pconfig['retry'],
- ['min' => '1', 'max' => '65536']
-))->setHelp('Optionally specify how many times to retry checking a server before declaring it down.');
-
-$form->add($section);
-
-$section = new Form_Section('Add item to the pool');
-
-$monitorlist = array();
-
-foreach ($config['load_balancer']['monitor_type'] as $monitor)
- $monitorlist[$monitor['name']] = $monitor['name'];
-
-if(count($config['load_balancer']['monitor_type'])) {
- $section->addInput(new Form_Select(
- 'monitor',
- 'Monitor',
- $pconfig['monitor'],
- $monitorlist
- ));
-} else {
- $section->addInput(new Form_StaticText(
- 'Monitor',
- 'Please add a monitor IP address on the monitors tab if you wish to use this feature."'
- ));
+ if (is_array($pconfig['servers'])) {
+ foreach ($pconfig['servers'] as $svrent) {
+ echo " <option value=\"{$svrent}\">{$svrent}</option>\n";
}
-
-$group = new Form_Group('Server IP Address');
-
-$group->add(new Form_IpAddress(
- 'ipaddr',
- 'IP Address',
- $pconfig['ipaddr']
-));
-
-$group->add(new Form_Button(
- 'btnaddtopool',
- 'Add to pool'
-))->removeClass('btn-primary')->addClass('btn-default');
-
-$section->add($group);
-
-$form->add($section);
-
-$section = new Form_Section('Current pool members');
-
-$group = new Form_Group('Members');
-
-$group->add(new Form_Select(
- 'serversdisabled',
- null,
- $pconfig['serversdisabled'],
- is_array($pconfig['serversdisabled']) ? array_combine($pconfig['serversdisabled'], $pconfig['serversdisabled']) : array(),
- true
-))->setHelp('Disabled');
-
-$group->add(new Form_Select(
- 'servers',
- null,
- $pconfig['servers'],
- is_array($pconfig['servers']) ? array_combine($pconfig['servers'], $pconfig['servers']) : array(),
- true
-))->setHelp('Enabled (Default)');
-
-$section->add($group);
-
-$group = new Form_Group('');
-
-$group->add(new Form_Button(
- 'removedisabled',
- 'Remove'
-))->removeClass('btn-primary')->addClass('btn-default btn-sm');
-
-$group->add(new Form_Button(
- 'removeenabled',
- 'Remove'
-))->removeClass('btn-primary')->addClass('btn-default btn-sm');
-
-$section->add($group);
-
-$group = new Form_Group('');
-
-$group->add(new Form_Button(
- 'movetoenabled',
- 'Move to enabled list >'
-))->removeClass('btn-primary')->addClass('btn-default btn-sm');
-
-$group->add(new Form_Button(
- 'movetodisabled',
- '< Move to disabled list'
-))->removeClass('btn-primary')->addClass('btn-default btn-sm');
-
-$section->add($group);
-
-if (isset($id) && $a_pool[$id] && $_GET['act'] != 'dup') {
- $section->addInput(new Form_Input(
- 'id',
- null,
- 'hidden',
- $id
- ));
}
-
-$form->add($section);
-
-print($form);
-
-include("foot.inc");
\ No newline at end of file
+?>
+ </select>
+ <input class="formbtn" type="button" name="removeEnabled" value="<?=gettext("Remove"); ?>" onclick="RemoveServerFromPool(document.iform, 'servers[]');" />
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </td>
+ </tr>
+ <tr align="left">
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <br />
+ <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" onclick="AllServers('serversSelect', true); AllServers('serversDisabledSelect', true);" />
+ <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" />
+ <input name="referer" type="hidden" value="<?=$referer;?>" />
+ <?php if (isset($id) && $a_pool[$id] && $_GET['act'] != 'dup'): ?>
+ <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
+ <?php endif; ?>
+ </td>
+ </tr>
+ </table>
+</form>
+<br />
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --exclude=.git --exclude=conf -ruNw ../bootstrap/usr/local/www/reboot.php ./usr/local/www/reboot.php
--- ../bootstrap/usr/local/www/reboot.php 2015-08-26 10:03:32.000000000 -0300
+++ ./usr/local/www/reboot.php 2015-08-26 12:14:09.000000000 -0300
@@ -38,7 +38,7 @@
##|-PRIV
// Set DEBUG to true to prevent the system_reboot() function from being called
-define("DEBUG", false);
+define("DEBUG", true);
require("guiconfig.inc");
require("functions.inc");
diff --exclude=.git --exclude=conf -ruNw ../bootstrap/usr/local/www/system_usermanager_settings_test.php ./usr/local/www/system_usermanager_settings_test.php
--- ../bootstrap/usr/local/www/system_usermanager_settings_test.php 2015-08-26 10:03:32.000000000 -0300
+++ ./usr/local/www/system_usermanager_settings_test.php 2015-08-26 12:14:09.000000000 -0300
@@ -85,9 +85,9 @@
if (is_array($ous)) {
echo "<br/>";
echo "<b>" . gettext("Organization units found") . "</b>";
- echo "<table width='100%'>";
+ echo "<table>";
foreach ($ous as $ou) {
- echo "<tr><td onmouseover=\"this.style.backgroundColor='#ffffff';\" onmouseout=\"this.style.backgroundColor='#dddddd';\">" . $ou . "</td></tr>";
+ echo "<tr><td>" . $ou . "</td></tr>";
}
}
} else {
diff --exclude=.git --exclude=conf -ruNw ../bootstrap/usr/local/www/vpn_pptp.php ./usr/local/www/vpn_pptp.php
--- ../bootstrap/usr/local/www/vpn_pptp.php 1969-12-31 21:00:00.000000000 -0300
+++ ./usr/local/www/vpn_pptp.php 2015-08-26 12:14:09.000000000 -0300
@@ -0,0 +1,509 @@
+<?php
+
+/*
+ WARNING: DEPRICATED! SHOULD NOT BE CONVERTED. SEE https://github.com/SjonHortensius/pfsense/issues/229
+*/
+
+/*
+ vpn_pptp.php
+ part of m0n0wall (http://m0n0.ch/wall)
+
+ Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
+ Copyright (C) 2013-2015 Electric Sheep Fencing, LP
+ 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
+##|*IDENT=page-vpn-vpnpptp
+##|*NAME=VPN: VPN PPTP page
+##|*DESCR=Allow access to the 'VPN: VPN PPTP' page.
+##|*MATCH=vpn_pptp.php*
+##|-PRIV
+
+require("guiconfig.inc");
+require_once("functions.inc");
+require_once("filter.inc");
+require_once("shaper.inc");
+require_once("vpn.inc");
+
+if (!is_array($config['pptpd']['radius'])) {
+ $config['pptpd']['radius'] = array();
+}
+$pptpcfg = &$config['pptpd'];
+
+$pconfig['remoteip'] = $pptpcfg['remoteip'];
+$pconfig['localip'] = $pptpcfg['localip'];
+$pconfig['redir'] = $pptpcfg['redir'];
+$pconfig['mode'] = $pptpcfg['mode'];
+$pconfig['wins'] = $pptpcfg['wins'];
+$pconfig['req128'] = isset($pptpcfg['req128']);
+$pconfig['n_pptp_units'] = $pptpcfg['n_pptp_units'];
+$pconfig['pptp_dns1'] = $pptpcfg['dns1'];
+$pconfig['pptp_dns2'] = $pptpcfg['dns2'];
+$pconfig['radiusenable'] = isset($pptpcfg['radius']['server']['enable']);
+$pconfig['radiusissueips'] = isset($pptpcfg['radius']['radiusissueips']);
+$pconfig['radiussecenable'] = isset($pptpcfg['radius']['server2']['enable']);
+$pconfig['radacct_enable'] = isset($pptpcfg['radius']['accounting']);
+$pconfig['radiusserver'] = $pptpcfg['radius']['server']['ip'];
+$pconfig['radiusserverport'] = $pptpcfg['radius']['server']['port'];
+$pconfig['radiusserveracctport'] = $pptpcfg['radius']['server']['acctport'];
+$pconfig['radiussecret'] = $pptpcfg['radius']['server']['secret'];
+$pconfig['radiusserver2'] = $pptpcfg['radius']['server2']['ip'];
+$pconfig['radiusserver2port'] = $pptpcfg['radius']['server2']['port'];
+$pconfig['radiusserver2acctport'] = $pptpcfg['radius']['server2']['acctport'];
+$pconfig['radiussecret2'] = $pptpcfg['radius']['server2']['secret2'];
+$pconfig['radius_acct_update'] = $pptpcfg['radius']['acct_update'];
+$pconfig['radius_nasip'] = $pptpcfg['radius']['nasip'];
+
+if ($_POST) {
+
+ if (isset($input_errors))
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ /* input validation */
+ if ($_POST['mode'] == "server") {
+ $reqdfields = explode(" ", "localip remoteip");
+ $reqdfieldsn = array(gettext("Server address"),gettext("Remote start address"));
+
+ if ($_POST['radiusenable']) {
+ $reqdfields = array_merge($reqdfields, explode(" ", "radiusserver radiussecret"));
+ $reqdfieldsn = array_merge($reqdfieldsn,
+ array(gettext("RADIUS server address"),gettext("RADIUS shared secret")));
+ }
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
+
+ if (($_POST['localip'] && !is_ipaddr($_POST['localip']))) {
+ $input_errors[] = gettext("A valid server address must be specified.");
+ }
+ if (is_ipaddr_configured($_POST['localip'])) {
+ $input_errors[] = gettext("'Server address' parameter should NOT be set to any IP address currently in use on this firewall.");
+ }
+ if (!is_ipaddr($_POST['remoteip'])) {
+ $input_errors[] = gettext("A valid remote start address must be specified.");
+ }
+ if (($_POST['radiusserver'] && !is_ipaddr($_POST['radiusserver']))) {
+ $input_errors[] = gettext("A valid RADIUS server address must be specified.");
+ }
+
+ if (!$input_errors) {
+ $subnet_start = ip2ulong($_POST['remoteip']);
+ $subnet_end = ip2ulong($_POST['remoteip']) + $_POST['n_pptp_units'] - 1;
+
+ if ((ip2ulong($_POST['localip']) >= $subnet_start) &&
+ (ip2ulong($_POST['localip']) <= $subnet_end)) {
+ $input_errors[] = gettext("The specified server address lies in the remote subnet.");
+ }
+ // TODO: Should this check be for any local IP address?
+ if ($_POST['localip'] == $config['interfaces']['lan']['ipaddr']) {
+ $input_errors[] = gettext("The specified server address is equal to the LAN interface address.");
+ }
+ }
+ } else if ($_POST['mode'] == "redir") {
+ $reqdfields = explode(" ", "redir");
+ $reqdfieldsn = array(gettext("PPTP redirection target address"));
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
+
+ if (($_POST['redir'] && !is_ipaddr($_POST['redir']))) {
+ $input_errors[] = gettext("A valid target address must be specified.");
+ }
+ } else if (isset($config['pptpd']['mode'])) {
+ unset($config['pptpd']['mode']);
+ }
+
+ if (!$input_errors) {
+ $pptpcfg['remoteip'] = $_POST['remoteip'];
+ $pptpcfg['redir'] = $_POST['redir'];
+ $pptpcfg['localip'] = $_POST['localip'];
+ $pptpcfg['mode'] = $_POST['mode'];
+ $pptpcfg['wins'] = $_POST['wins'];
+ $pptpcfg['n_pptp_units'] = $_POST['n_pptp_units'];
+ $pptpcfg['radius']['server']['ip'] = $_POST['radiusserver'];
+ $pptpcfg['radius']['server']['port'] = $_POST['radiusserverport'];
+ $pptpcfg['radius']['server']['acctport'] = $_POST['radiusserveracctport'];
+ $pptpcfg['radius']['server']['secret'] = $_POST['radiussecret'];
+ $pptpcfg['radius']['server2']['ip'] = $_POST['radiusserver2'];
+ $pptpcfg['radius']['server2']['port'] = $_POST['radiusserver2port'];
+ $pptpcfg['radius']['server2']['acctport'] = $_POST['radiusserver2acctport'];
+ $pptpcfg['radius']['server2']['secret2'] = $_POST['radiussecret2'];
+ $pptpcfg['radius']['nasip'] = $_POST['radius_nasip'];
+ $pptpcfg['radius']['acct_update'] = $_POST['radius_acct_update'];
+
+ if ($_POST['pptp_dns1'] == "") {
+ if (isset($pptpcfg['dns1']))
+ unset($pptpcfg['dns1']);
+ } else
+ $pptpcfg['dns1'] = $_POST['pptp_dns1'];
+
+ if ($_POST['pptp_dns2'] == "") {
+ if (isset($pptpcfg['dns2']))
+ unset($pptpcfg['dns2']);
+ } else
+ $pptpcfg['dns2'] = $_POST['pptp_dns2'];
+
+ if($_POST['req128'] == "yes")
+ $pptpcfg['req128'] = true;
+ else if (isset($pptpcfg['req128']))
+ unset($pptpcfg['req128']);
+
+ if($_POST['radiusenable'] == "yes")
+ $pptpcfg['radius']['server']['enable'] = true;
+ else if (isset($pptpcfg['radius']['server']['enable']))
+ unset($pptpcfg['radius']['server']['enable']);
+
+ if($_POST['radiussecenable'] == "yes")
+ $pptpcfg['radius']['server2']['enable'] = true;
+ else if (isset($pptpcfg['radius']['server2']['enable']))
+ unset($pptpcfg['radius']['server2']['enable']);
+
+ if($_POST['radacct_enable'] == "yes")
+ $pptpcfg['radius']['accounting'] = true;
+ else if (isset($pptpcfg['radius']['accounting']))
+ unset($pptpcfg['radius']['accounting']);
+
+ if($_POST['radiusissueips'] == "yes") {
+ $pptpcfg['radius']['radiusissueips'] = true;
+ } else if (isset($pptpcfg['radius']['radiusissueips']))
+ unset($pptpcfg['radius']['radiusissueips']);
+
+ write_config();
+
+ $retval = 0;
+ $retval = vpn_pptpd_configure();
+ $savemsg = get_std_save_message($retval);
+
+ filter_configure();
+ }
+}
+
+$pgtitle = array(gettext("VPN"),gettext("VPN PPTP"));
+$shortcut_section = "pptps";
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<script type="text/javascript">
+//<![CDATA[
+function get_radio_value(obj)
+{
+ for (i = 0; i < obj.length; i++) {
+ if (obj[i].checked)
+ return obj[i].value;
+ }
+ return null;
+}
+
+function enable_change(enable_over) {
+ if ((get_radio_value(document.iform.mode) == "server") || enable_over) {
+ document.iform.remoteip.disabled = 0;
+ document.iform.localip.disabled = 0;
+ document.iform.req128.disabled = 0;
+ document.iform.radiusenable.disabled = 0;
+ document.iform.radiusissueips.disabled = 0;
+ document.iform.wins.disabled = 0;
+ document.iform.n_pptp_units.disabled = 0;
+ document.iform.pptp_dns1.disabled = 0;
+ document.iform.pptp_dns2.disabled = 0;
+
+ if (document.iform.radiusenable.checked || enable_over) {
+ document.iform.radiussecenable.disabled = 0;
+ document.iform.radacct_enable.disabled = 0;
+ document.iform.radiusserver.disabled = 0;
+ document.iform.radiusserverport.disabled = 0;
+ document.iform.radiusserveracctport.disabled = 0;
+ document.iform.radiussecret.disabled = 0;
+ document.iform.radius_nasip.disabled = 0;
+ document.iform.radius_acct_update.disabled = 0;
+ document.iform.radiusissueips.disabled = 0;
+ if (document.iform.radiussecenable.checked || enable_over) {
+ document.iform.radiusserver2.disabled = 0;
+ document.iform.radiussecret2.disabled = 0;
+ document.iform.radiusserver2port.disabled = 0;
+ document.iform.radiusserver2acctport.disabled = 0;
+ } else {
+
+ document.iform.radiusserver2.disabled = 1;
+ document.iform.radiussecret2.disabled = 1;
+ document.iform.radiusserver2port.disabled = 1;
+ document.iform.radiusserver2acctport.disabled = 1;
+ }
+ } else {
+ document.iform.radacct_enable.disabled = 1;
+ document.iform.radiusserver.disabled = 1;
+ document.iform.radiusserverport.disabled = 1;
+ document.iform.radiusissueips.disabled = 1;
+ document.iform.radiusserveracctport.disabled = 1;
+ document.iform.radiussecret.disabled = 1;
+ document.iform.radius_nasip.disabled = 1;
+ document.iform.radius_acct_update.disabled = 1;
+ document.iform.radiusissueips.disabled = 1;
+ document.iform.radiusserver2.disabled = 1;
+ document.iform.radiussecret2.disabled = 1;
+ document.iform.radiusserver2port.disabled = 1;
+ document.iform.radiusserver2acctport.disabled = 1;
+ }
+
+ } else {
+ document.iform.remoteip.disabled = 1;
+ document.iform.localip.disabled = 1;
+ document.iform.req128.disabled = 1;
+ document.iform.n_pptp_units.disabled = 1;
+ document.iform.pptp_dns1.disabled = 1;
+ document.iform.pptp_dns2.disabled = 1;
+ document.iform.radiusenable.disabled = 1;
+ document.iform.radacct_enable.disabled = 1;
+ document.iform.radiusserver.disabled = 1;
+ document.iform.radiusserverport.disabled = 1;
+ document.iform.radiusissueips.disabled = 1;
+ document.iform.radiusserveracctport.disabled = 1;
+ document.iform.radiussecret.disabled = 1;
+ document.iform.radius_nasip.disabled = 1;
+ document.iform.radius_acct_update.disabled = 1;
+ document.iform.radiussecenable.disabled = 1;
+ document.iform.radiusserver2.disabled = 1;
+ document.iform.radiusserver2port.disabled = 1;
+ document.iform.radiusserver2acctport.disabled = 1;
+ document.iform.radiussecret2.disabled = 1;
+ document.iform.wins.disabled = 1;
+ document.iform.radiusissueips.disabled = 1;
+ }
+ if ((get_radio_value(document.iform.mode) == "redir") || enable_over) {
+ document.iform.redir.disabled = 0;
+ } else {
+ document.iform.redir.disabled = 1;
+ }
+}
+//]]>
+</script>
+<form action="vpn_pptp.php" method="post" name="iform" id="iform">
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<?php print_info_box(gettext("PPTP is no longer considered a secure VPN technology because it relies upon MS-CHAPv2 which has been compromised. If you continue to use PPTP be aware that intercepted traffic can be decrypted by a third party, so it should be considered unencrypted. We advise migrating to another VPN type such as OpenVPN or IPsec.<br /><br /><a href=\"https://isc.sans.edu/diary/End+of+Days+for+MS-CHAPv2/13807\">Read More</a>")); ?>
+<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="vpn pptp">
+ <tr><td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Configuration"), true, "vpn_pptp.php");
+ $tab_array[1] = array(gettext("Users"), false, "vpn_pptp_users.php");
+ display_top_tabs($tab_array);
+?>
+ </td></tr>
+ <tr>
+ <td>
+<div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
+ <tr>
+ <td width="22%" valign="top" class="vtable">&nbsp;</td>
+ <td width="78%" class="vtable">
+ <input name="mode" type="radio" onclick="enable_change(false)" value="off"
+ <?php if (($pconfig['mode'] != "server") && ($pconfig['mode'] != "redir")) echo "checked=\"checked\"";?> />
+ <?=gettext("Off"); ?></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vtable">&nbsp;</td>
+ <td width="78%" class="vtable">
+
+ <input type="radio" name="mode" value="redir" onclick="enable_change(false)" <?php if ($pconfig['mode'] == "redir") echo "checked=\"checked\"" ?> />
+ <?=gettext("Redirect incoming PPTP connections to");?>:</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("PPTP redirection");?></td>
+ <td width="78%" class="vtable">
+ <?=$mandfldhtml;?><input name="redir" type="text" class="formfld unknown" id="redir" size="20" value="<?=htmlspecialchars($pconfig['redir']);?>" />
+ <br />
+ <?=gettext("Enter the IP address of a host which will accept incoming " .
+ "PPTP connections"); ?>.</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vtable">&nbsp;</td>
+ <td width="78%" class="vtable">
+ <input type="radio" name="mode" value="server" onclick="enable_change(false)" <?php if ($pconfig['mode'] == "server") echo "checked=\"checked\""; ?> />
+ <?=gettext("Enable PPTP server"); ?></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("No. PPTP users"); ?></td>
+ <td width="78%" class="vtable">
+ <select id="n_pptp_units" name="n_pptp_units">
+ <?php
+ $toselect = ($pconfig['n_pptp_units'] > 0) ? $pconfig['n_pptp_units'] : 16;
+ for($x=1; $x<255; $x++) {
+ if($x == $toselect)
+ $SELECTED = " selected=\"selected\"";
+ else
+ $SELECTED = "";
+ echo "<option value=\"{$x}\"{$SELECTED}>{$x}</option>\n";
+ }
+ ?>
+ </select>
+ <br /><?=gettext("Hint: 10 is ten PPTP clients"); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Server address"); ?></td>
+ <td width="78%" class="vtable">
+ <?=$mandfldhtml;?><input name="localip" type="text" class="formfld unknown" id="localip" size="20" value="<?=htmlspecialchars($pconfig['localip']);?>" />
+ <br />
+ <?=gettext("Enter the IP address the PPTP server should give to clients for use as their \"gateway\""); ?>.
+ <br />
+ <?=gettext("Typically this is set to an unused IP just outside of the client range"); ?>.
+ <br />
+ <br />
+ <?=gettext("NOTE: This should NOT be set to any IP address currently in use on this firewall"); ?>.</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Remote address " .
+ "range"); ?></td>
+ <td width="78%" class="vtable">
+ <?=$mandfldhtml;?><input name="remoteip" type="text" class="formfld unknown" id="remoteip" size="20" value="<?=htmlspecialchars($pconfig['remoteip']);?>" />
+ <br />
+ <?=gettext("Specify the starting address for the client IP subnet"); ?>.<br />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("PPTP DNS Servers"); ?></td>
+ <td width="78%" class="vtable">
+ <?=$mandfldhtml;?><input name="pptp_dns1" type="text" class="formfld unknown" id="pptp_dns1" size="20" value="<?=htmlspecialchars($pconfig['pptp_dns1']);?>" />
+ <br />
+ <input name="pptp_dns2" type="text" class="formfld unknown" id="pptp_dns2" size="20" value="<?=htmlspecialchars($pconfig['pptp_dns2']);?>" />
+ <br />
+ <?=gettext("primary and secondary DNS servers assigned to PPTP clients"); ?><br />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("WINS Server"); ?></td>
+ <td width="78%" valign="top" class="vtable">
+ <input name="wins" class="formfld unknown" id="wins" size="20" value="<?=htmlspecialchars($pconfig['wins']);?>" />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("RADIUS"); ?></td>
+ <td width="78%" class="vtable">
+ <input name="radiusenable" type="checkbox" id="radiusenable" onclick="enable_change(false)" value="yes" <?php if ($pconfig['radiusenable']) echo "checked=\"checked\""; ?> />
+ <strong><?=gettext("Use a RADIUS server for authentication"); ?></strong><br />
+ <?=gettext("When set, all users will be authenticated using " .
+ "the RADIUS server specified below. The local user database " .
+ "will not be used"); ?>.<br />
+ <br />
+ <input name="radacct_enable" type="checkbox" id="radacct_enable" onclick="enable_change(false)" value="yes" <?php if ($pconfig['radacct_enable']) echo "checked=\"checked\""; ?> />
+ <strong><?=gettext("Enable RADIUS accounting"); ?> <br />
+ </strong><?=gettext("Sends accounting packets to the RADIUS server"); ?>.<br />
+ <br />
+ <input name="radiussecenable" type="checkbox" id="radiussecenable" onclick="enable_change(false)" value="yes" <?php if ($pconfig['radiussecenable']) echo "checked=\"checked\""; ?> />
+ <strong><?=gettext("Secondary RADIUS server for failover authentication"); ?></strong><br />
+ <?=gettext("When set, all requests will go to the secondary server when primary fails"); ?><br />
+ <br />
+ <input name="radiusissueips" value="yes" type="checkbox" class="formfld" id="radiusissueips"<?php if($pconfig['radiusissueips']) echo " checked=\"checked\""; ?> />
+ <strong><?=gettext("RADIUS issued IPs"); ?></strong>
+ <br /><?=gettext("Issue IP addresses via RADIUS server"); ?>.
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("RADIUS NAS IP"); ?></td>
+ <td width="78%" valign="top" class="vtable">
+ <input name="radius_nasip" class="formfld unknown" id="radius_nasip" size="20" value="<?=htmlspecialchars($pconfig['radius_nasip']);?>" />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("RADIUS Accounting Update"); ?></td>
+ <td width="78%" valign="top" class="vtable">
+ <input name="radius_acct_update" class="formfld unknown" id="radius_acct_update" size="20" value="<?=htmlspecialchars($pconfig['radius_acct_update']);?>" />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("RADIUS Server"); ?> </td>
+ <td width="78%" class="vtable">
+ <input name="radiusserver" type="text" class="formfld unknown" id="radiusserver" size="20" value="<?=htmlspecialchars($pconfig['radiusserver']);?>" />
+ <input name="radiusserverport" type="text" class="formfld unknown" id="radiusserverport" size="4" value="<?=htmlspecialchars($pconfig['radiusserverport']);?>" />
+ <input name="radiusserveracctport" type="text" class="formfld unknown" id="radiusserveracctport" size="4" value="<?=htmlspecialchars($pconfig['radiusserveracctport']);?>" />
+ <br />
+ <?=gettext("Enter the IP address, RADIUS port, and RADIUS accounting port of the RADIUS server"); ?>.</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("RADIUS shared secret"); ?></td>
+ <td width="78%" valign="top" class="vtable">
+ <input name="radiussecret" type="password" class="formfld pwd" id="radiussecret" size="20" value="<?=htmlspecialchars($pconfig['radiussecret']);?>" />
+ <br />
+ <?=gettext("Enter the shared secret that will be used to authenticate " .
+ "to the RADIUS server"); ?>.</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Secondary RADIUS server"); ?> </td>
+ <td width="78%" class="vtable">
+ <input name="radiusserver2" type="text" class="formfld unknown" id="radiusserver2" size="20" value="<?=htmlspecialchars($pconfig['radiusserver2']);?>" />
+ <input name="radiusserver2port" type="text" class="formfld unknown" id="radiusserver2port" size="4" value="<?=htmlspecialchars($pconfig['radiusserver2port']);?>" />
+ <input name="radiusserver2acctport" type="text" class="formfld unknown" id="radiusserver2acctport" size="4" value="<?=htmlspecialchars($pconfig['radiusserver2acctport']);?>" />
+ <br />
+ <?=gettext("Enter the IP address, RADIUS port, and RADIUS accounting port of the RADIUS server"); ?>.</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Secondary RADIUS shared secret"); ?></td>
+ <td width="78%" valign="top" class="vtable">
+ <input name="radiussecret2" type="password" class="formfld pwd" id="radiussecret2" size="20" value="<?=htmlspecialchars($pconfig['radiussecret2']);?>" />
+ <br />
+ <?=gettext("Enter the shared secret that will be used to authenticate " .
+ "to the secondary RADIUS server"); ?>.</td>
+ </tr>
+ <tr>
+ <td height="16" colspan="2" valign="top"></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="middle">&nbsp;</td>
+ <td width="78%" class="vtable">
+ <input name="req128" type="checkbox" id="req128" value="yes" <?php if ($pconfig['req128']) echo "checked=\"checked\""; ?> />
+ <strong><?=gettext("Require 128-bit encryption"); ?></strong><br />
+ <?=gettext("When set, only 128-bit encryption will be accepted. Otherwise " .
+ "40-bit and 56-bit encryption will be accepted as well. Note that " .
+ "encryption will always be forced on PPTP connections (i.e. " .
+ "unencrypted connections will not be accepted)"); ?>.</td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" onclick="enable_change(true)" />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%"><span class="vexpl"><span class="red"><strong><?=gettext("Note");?>:<br />
+ </strong></span><?=gettext("don't forget to ");?><a href="firewall_rules.php?if=pptp"><?=gettext("add a firewall rule"); ?></a> <?=gettext("to permit ".
+ "traffic from PPTP clients");?>!</span></td>
+ </tr>
+ </table>
+</div>
+ </td>
+ </tr>
+</table>
+</form>
+<script type="text/javascript">
+//<![CDATA[
+enable_change(false);
+//]]>
+</script>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --exclude=.git --exclude=conf -ruNw ../bootstrap/usr/local/www/vpn_pptp_users.php ./usr/local/www/vpn_pptp_users.php
--- ../bootstrap/usr/local/www/vpn_pptp_users.php 1969-12-31 21:00:00.000000000 -0300
+++ ./usr/local/www/vpn_pptp_users.php 2015-08-26 12:14:09.000000000 -0300
@@ -0,0 +1,147 @@
+<?php
+
+/*
+ WARNING: DEPRICATED! SHOULD NOT BE CONVERTED. SEE https://github.com/SjonHortensius/pfsense/issues/229
+*/
+
+/*
+ vpn_pptp_users.php
+ part of m0n0wall (http://m0n0.ch/wall)
+
+ Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
+ Copyright (C) 2013-2015 Electric Sheep Fencing, LP
+ 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
+##|*IDENT=page-vpn-vpnpptp-users
+##|*NAME=VPN: VPN PPTP: Users page
+##|*DESCR=Allow access to the 'VPN: VPN PPTP: Users' page.
+##|*MATCH=vpn_pptp_users.php*
+##|-PRIV
+
+require("guiconfig.inc");
+require_once("vpn.inc");
+
+if (!is_array($config['pptpd']['user'])) {
+ $config['pptpd']['user'] = array();
+}
+$a_secret = &$config['pptpd']['user'];
+
+if ($_POST) {
+
+ $pconfig = $_POST;
+
+ if ($_POST['apply']) {
+ $retval = 0;
+ $retval = vpn_setup();
+ $savemsg = get_std_save_message($retval);
+ if ($retval == 0) {
+ if (is_subsystem_dirty('pptpusers'))
+ clear_subsystem_dirty('pptpusers');
+ }
+ }
+}
+
+if ($_GET['act'] == "del") {
+ if ($a_secret[$_GET['id']]) {
+ unset($a_secret[$_GET['id']]);
+ write_config();
+ mark_subsystem_dirty('pptpusers');
+ header("Location: vpn_pptp_users.php");
+ exit;
+ }
+}
+
+$pgtitle = array(gettext("VPN"),gettext("VPN PPTP"),gettext("Users"));
+$shortcut_section = "pptps";
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<form action="vpn_pptp_users.php" method="post">
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<?php if (isset($config['pptpd']['radius']['enable']))
+ print_info_box(gettext("Warning: RADIUS is enabled. The local user database will not be used.")); ?>
+<?php if (is_subsystem_dirty('pptpusers')): ?><br/>
+<?php print_info_box_np(gettext("The PPTP user list has been modified").".<br />".gettext("You must apply the changes in order for them to take effect").".<br /></b><b>".gettext("Warning: this will terminate all current PPTP sessions")."!");?><br />
+<?php endif; ?>
+<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="vpn pptp users">
+ <tr><td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Configuration"), false, "vpn_pptp.php");
+ $tab_array[1] = array(gettext("Users"), true, "vpn_pptp_users.php");
+ display_top_tabs($tab_array);
+?> </td></tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
+ <tr>
+ <td class="listhdrr"><?=gettext("Username");?></td>
+ <td class="listhdr"><?=gettext("IP address");?></td>
+ <td class="list">
+ <table border="0" cellspacing="0" cellpadding="1" summary="add">
+ <tr>
+ <td width="17"></td>
+ <td><a href="vpn_pptp_users_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add user");?>" width="17" height="17" border="0" alt="add" /></a></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <?php $i = 0; foreach ($a_secret as $secretent): ?>
+ <tr>
+ <td class="listlr">
+ <?=htmlspecialchars($secretent['name']);?>
+ </td>
+ <td class="listr">
+ <?=htmlspecialchars($secretent['ip']);?>&nbsp;
+ </td>
+ <td class="list nowrap"><a href="vpn_pptp_users_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit user");?>" width="17" height="17" border="0" alt="edit" /></a>
+ &nbsp;<a href="vpn_pptp_users.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this user?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete user");?>" width="17" height="17" border="0" alt="delete" /></a></td>
+ </tr>
+ <?php $i++; endforeach; ?>
+ <tr>
+ <td class="list" colspan="2"></td>
+ <td class="list">
+ <table border="0" cellspacing="0" cellpadding="1" summary="add">
+ <tr>
+ <td width="17"></td>
+ <td><a href="vpn_pptp_users_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add user");?>" width="17" height="17" border="0" alt="add" /></a></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+</div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --exclude=.git --exclude=conf -ruNw ../bootstrap/usr/local/www/vpn_pptp_users_edit.php ./usr/local/www/vpn_pptp_users_edit.php
--- ../bootstrap/usr/local/www/vpn_pptp_users_edit.php 1969-12-31 21:00:00.000000000 -0300
+++ ./usr/local/www/vpn_pptp_users_edit.php 2015-08-26 12:14:09.000000000 -0300
@@ -0,0 +1,189 @@
+<?php
+
+/*
+ WARNING: DEPRICATED! SHOULD NOT BE CONVERTED. SEE https://github.com/SjonHortensius/pfsense/issues/229
+*/
+
+/*
+ vpn_pptp_users_edit.php
+ part of m0n0wall (http://m0n0.ch/wall)
+ part of pfSense
+
+ Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
+ Copyright (C) 2013-2015 Electric Sheep Fencing, LP
+ 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
+##|*IDENT=page-vpn-vpnpptp-user-edit
+##|*NAME=VPN: VPN PPTP: User: Edit page
+##|*DESCR=Allow access to the 'VPN: VPN PPTP: User: Edit' page.
+##|*MATCH=vpn_pptp_users_edit.php*
+##|-PRIV
+
+function pptpusercmp($a, $b) {
+ return strcasecmp($a['name'], $b['name']);
+}
+
+function pptpd_users_sort() {
+ global $config;
+
+ if (!is_array($config['ppptpd']['user']))
+ return;
+
+ usort($config['pptpd']['user'], "pptpusercmp");
+}
+
+require("guiconfig.inc");
+require_once("vpn.inc");
+
+if (!is_array($config['pptpd']['user'])) {
+ $config['pptpd']['user'] = array();
+}
+$a_secret = &$config['pptpd']['user'];
+
+if (is_numericint($_GET['id']))
+ $id = $_GET['id'];
+if (isset($_POST['id']) && is_numericint($_POST['id']))
+ $id = $_POST['id'];
+
+if (isset($id) && $a_secret[$id]) {
+ $pconfig['username'] = $a_secret[$id]['name'];
+ $pconfig['ip'] = $a_secret[$id]['ip'];
+}
+
+if ($_POST) {
+
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ /* input validation */
+ if (isset($id) && ($a_secret[$id])) {
+ $reqdfields = explode(" ", "username");
+ $reqdfieldsn = array(gettext("Username"));
+ } else {
+ $reqdfields = explode(" ", "username passwordfld1");
+ $reqdfieldsn = array(gettext("Username"),gettext("Password"));
+ }
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
+
+ if (preg_match("/[^a-zA-Z0-9\.\-_]/", $_POST['username']))
+ $input_errors[] = gettext("The username contains invalid characters.");
+
+ if (preg_match("/^!/", $_POST['passwordfld1']))
+ $input_errors[] = gettext("The password cannot start with '!'.");
+
+ if (!preg_match("/^[\x20-\x7E]*$/", $_POST['passwordfld1']))
+ $input_errors[] = gettext("The password contains invalid characters.");
+
+ if (($_POST['passwordfld1']) && ($_POST['passwordfld1'] != $_POST['passwordfld2'])) {
+ $input_errors[] = gettext("The passwords do not match.");
+ }
+ if (($_POST['ip'] && !is_ipaddr($_POST['ip']))) {
+ $input_errors[] = gettext("The IP address entered is not valid.");
+ }
+
+ if (!$input_errors && !(isset($id) && $a_secret[$id])) {
+ /* make sure there are no dupes */
+ foreach ($a_secret as $secretent) {
+ if ($secretent['name'] == $_POST['username']) {
+ $input_errors[] = gettext("Another entry with the same username already exists.");
+ break;
+ }
+ }
+ }
+
+ if (!$input_errors) {
+
+ if (isset($id) && $a_secret[$id])
+ $secretent = $a_secret[$id];
+
+ $secretent['name'] = $_POST['username'];
+ $secretent['ip'] = $_POST['ip'];
+
+ if ($_POST['passwordfld1'])
+ $secretent['password'] = $_POST['passwordfld1'];
+
+ if (isset($id) && $a_secret[$id])
+ $a_secret[$id] = $secretent;
+ else
+ $a_secret[] = $secretent;
+ pptpd_users_sort();
+
+ write_config();
+ mark_subsystem_dirty('pptpusers');
+
+ header("Location: vpn_pptp_users.php");
+ exit;
+ }
+}
+
+$pgtitle = array(gettext("VPN"),gettext("VPN PPTP"),gettext("User"),gettext("Edit"));
+$shortcut_section = "pptps";
+include("head.inc");
+
+?>
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+ <form action="vpn_pptp_users_edit.php" method="post" name="iform" id="iform">
+ <div id="mainarea">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="vpn pptp users edit">
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Username");?></td>
+ <td width="78%" class="vtable">
+ <?=$mandfldhtml;?><input name="username" type="text" class="formfld user" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>" />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Password");?></td>
+ <td width="78%" class="vtable">
+ <?=$mandfldhtml;?><input name="passwordfld1" type="password" class="formfld pwd" id="passwordfld1" size="20" />
+ <br /><?=$mandfldhtml;?><input name="passwordfld2" type="password" class="formfld pwd" id="passwordfld2" size="20" />
+ &nbsp;(<?=gettext("confirmation");?>)<?php if (isset($id) && $a_secret[$id]): ?><br />
+ <span class="vexpl"><?=gettext("If you want to change the users' password, ".
+ "enter it here twice.");?></span><?php endif; ?></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("IP address");?></td>
+ <td width="78%" class="vtable">
+ <input name="ip" type="text" class="formfld unknown" id="ip" size="20" value="<?=htmlspecialchars($pconfig['ip']);?>" />
+ <br /><span class="vexpl"><?=gettext("If you want the user to be assigned a specific IP address, enter it here.");?></span></td>
+ </tr>
+ <tr>
+ <td class="vncell" width="22%" valign="top">&nbsp;</td>
+ <td class="vncell" width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
+ <?php if (isset($id) && $a_secret[$id]): ?>
+ <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
+ <?php endif; ?>
+ </td>
+ </tr>
+ </table>
+ </div>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --exclude=.git --exclude=conf -ruNw ../bootstrap/usr/local/www/widgets/widgets/carp_status.widget.php ./usr/local/www/widgets/widgets/carp_status.widget.php
--- ../bootstrap/usr/local/www/widgets/widgets/carp_status.widget.php 2015-08-26 10:02:59.000000000 -0300
+++ ./usr/local/www/widgets/widgets/carp_status.widget.php 2015-08-26 12:14:09.000000000 -0300
@@ -66,18 +66,18 @@
<?php
if ($carp_enabled == false) {
$status = "DISABLED";
- echo "<img src='/themes/".$g['theme']."/images/icons/icon_block.gif' title=\"$status\" alt=\"$status\" />";
+ echo '<i class="icon icon-ban-circle" title="disabled"></i>';
} else {
if($status == "MASTER") {
- echo "<img src='/themes/".$g['theme']."/images/icons/icon_pass.gif' title=\"$status\" alt=\"$status\" />";
+ echo '<i class="icon icon-random" title="master"></i>';
} else if($status == "BACKUP") {
- echo "<img src='/themes/".$g['theme']."/images/icons/icon_pass_d.gif' title=\"$status\" alt=\"$status\" />";
+ echo '<i class="icon icon-retweet" title="backup"></i>';
} else if($status == "INIT") {
- echo "<img src='/themes/".$g['theme']."/images/icons/icon_log.gif' title=\"$status\" alt=\"$status\" />";
+ echo '<i class="icon icon-refresh" title="initializing"></i>';
}
}
- if ($ipaddress){ ?> &nbsp;
- <?=htmlspecialchars($status);?> &nbsp;
+ if ($ipaddress){ ?>
+ <?=htmlspecialchars($status);?>
<?=htmlspecialchars($ipaddress);}?>
</td></tr><?php }
} else { ?>
diff --exclude=.git --exclude=conf -ruNw ../bootstrap/usr/local/www/widgets/widgets/openvpn.widget.php ./usr/local/www/widgets/widgets/openvpn.widget.php
--- ../bootstrap/usr/local/www/widgets/widgets/openvpn.widget.php 2015-08-26 10:03:32.000000000 -0300
+++ ./usr/local/www/widgets/widgets/openvpn.widget.php 2015-08-26 12:14:09.000000000 -0300
@@ -138,7 +138,8 @@
<th>Name/Time</td>
<th>Real/Virtual IP</td>
</tr>
- <?php $rowIndex = 0;
+ <?php
+ $rowIndex = 0;
foreach ($server['conns'] as $conn):
$evenRowClass = $rowIndex % 2 ? " listMReven" : " listMRodd";
$rowIndex++;
diff --exclude=.git --exclude=conf -ruNw ../bootstrap/usr/local/www/widgets/widgets/smart_status.widget.php ./usr/local/www/widgets/widgets/smart_status.widget.php
--- ../bootstrap/usr/local/www/widgets/widgets/smart_status.widget.php 2015-08-26 11:06:17.000000000 -0300
+++ ./usr/local/www/widgets/widgets/smart_status.widget.php 2015-08-26 12:14:09.000000000 -0300
@@ -49,22 +49,21 @@
## Get all adX, daX, and adaX (IDE, SCSI, and AHCI) devices currently installed
$devs = get_smart_drive_list();
-if (count($devs) > 0) {
- foreach ($devs as $dev) { ## for each found drive do
+foreach($devs as $dev):
$dev_ident = exec("diskinfo -v /dev/$dev | grep ident | awk '{print $1}'"); ## get identifier from drive
$dev_state = trim(exec("smartctl -H /dev/$dev | awk -F: '/^SMART overall-health self-assessment test result/ {print $2;exit}
/^SMART Health Status/ {print $2;exit}'")); ## get SMART state from drive
switch ($dev_state) {
case "PASSED":
case "OK":
- $color = "#90EE90";
+ $icon = 'ok';
break;
case "":
$dev_state = "Unknown";
- $color = "#C0B788";
+ $icon = 'question';
break;
default:
- $color = "#F08080";
+ $icon = 'remove';
break;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment