diff options
author | SjonHortensius <sjon@hortensius.net> | 2015-04-25 10:42:34 +0200 |
---|---|---|
committer | SjonHortensius <sjon@hortensius.net> | 2015-04-25 10:42:34 +0200 |
commit | 5bd406696ae634b3993d79a8b9aef03eeab42488 (patch) | |
tree | cb8fc63ec71e6a8aa91affd1b63b912f997b0bdc /usr | |
parent | b9bd62735f2afb818d9ff3afd399c6c7d3b904c5 (diff) | |
parent | 6e69ebef76ba8130d0c6bf4c47dd8fc0455ee311 (diff) | |
download | pfsense-5bd406696ae634b3993d79a8b9aef03eeab42488.zip pfsense-5bd406696ae634b3993d79a8b9aef03eeab42488.tar.gz |
Merge pull request #100 from sbeaver-netgate/halt
Updated halt.php for consistency with reboot.php
Diffstat (limited to 'usr')
27 files changed, 1185 insertions, 956 deletions
diff --git a/usr/local/www/bootstrap/css/pfSense.css b/usr/local/www/bootstrap/css/pfSense.css index 1cfc905..22f3bba 100644 --- a/usr/local/www/bootstrap/css/pfSense.css +++ b/usr/local/www/bootstrap/css/pfSense.css @@ -54,7 +54,6 @@ tr.disabled th { /** Content structure */ .table-responsive { clear: both; - margin-bottom: 0px; } .form-horizontal { diff --git a/usr/local/www/carp_status.php b/usr/local/www/carp_status.php index 1052115..7c157ee 100644 --- a/usr/local/www/carp_status.php +++ b/usr/local/www/carp_status.php @@ -196,7 +196,7 @@ if ($carpcount > 0): <td> <td><?=convert_friendly_interface_to_friendly_descr($carp['interface'])?>@<?=$vhid?></td> <td><?=$ipaddress?></td> - <td><i class="icon icon-<?=$icon?>">$status</i></td> + <td><i class="icon icon-<?=$icon?>">$status</td> </tr> <?php }?> </table> diff --git a/usr/local/www/classes/Form.class.php b/usr/local/www/classes/Form.class.php index efc4d20..c656140 100644 --- a/usr/local/www/classes/Form.class.php +++ b/usr/local/www/classes/Form.class.php @@ -45,7 +45,7 @@ class Form extends Form_Element protected $_global = array(); protected $_labelWidth = 2; - public function __construct($submit = null) + public function __construct(Form_Button $submit = null) { if (!isset($submit)) $submit = new Form_Button( @@ -53,8 +53,7 @@ class Form extends Form_Element 'Save' ); - if (false !== $submit) - $this->addGlobal($submit); + $this->addGlobal($submit); } public function add(Form_Section $section) @@ -119,4 +118,4 @@ class Form extends Form_Element </form> EOT; } -} +}
\ No newline at end of file diff --git a/usr/local/www/diag_authentication.php b/usr/local/www/diag_authentication.php index ddd5345..58b7d08 100644 --- a/usr/local/www/diag_authentication.php +++ b/usr/local/www/diag_authentication.php @@ -1,7 +1,7 @@ <?php /* diag_authentication.php - part of the pfSense project (https://www.pfsense.org) + part of the pfSense project (https://www.pfsense.org) Copyright (C) 2010 Ermal Luçi Copyright (C) 2013-2015 Electric Sheep Fencing, LP All rights reserved. @@ -29,7 +29,7 @@ */ /* - pfSense_MODULE: auth + pfSense_MODULE: auth */ ##|+PRIV @@ -51,19 +51,16 @@ if ($_POST) { if (!$authcfg) $input_errors[] = $_POST['authmode'] . " " . gettext("is not a valid authentication server"); - if (empty($_POST['username']) || empty($_POST['password'])) + if (empty($_POST['username']) || empty($_POST['passwordfld'])) $input_errors[] = gettext("A username and password must be specified."); if (!$input_errors) { - if (authenticate_user($_POST['username'], $_POST['password'], $authcfg)) { + if (authenticate_user($_POST['username'], $_POST['passwordfld'], $authcfg)) { $savemsg = gettext("User") . ": " . $_POST['username'] . " " . gettext("authenticated successfully."); $groups = getUserGroups($_POST['username'], $authcfg); - $savemsg .= " " . gettext("This user is a member of groups") . ": <br />"; - $savemsg .= "<ul>"; + $savemsg .= "<br />" . gettext("This user is a member of these groups") . ": <br />"; foreach ($groups as $group) - $savemsg .= "<li>" . "{$group} " . "</li>"; - $savemsg .= "</ul>"; - + $savemsg .= "{$group} "; } else { $input_errors[] = gettext("Authentication failed."); } @@ -74,49 +71,42 @@ $shortcut_section = "authentication"; include("head.inc"); ?> -<?php -if ($input_errors) - print_input_errors($input_errors); - -if ($savemsg) - print('<div class="alert alert-success" role="alert">'. $savemsg.'</div>'); - -require('classes/Form.class.php'); - -$form = new Form(new Form_Button( - 'Submit', - gettext('Test') -)); - -$section = new Form_Section('Authentication Test'); - -foreach (auth_get_authserver_list() as $auth_server) - $serverlist[$auth_server['name']] = $auth_server['name']; - -$section->addInput(new Form_Select( - 'authmode', - 'Authentication Server', - $pconfig['authmode'], - $serverlist -))->setHelp('Select the authentication server to test against'); - -$section->addInput(new Form_Input( - 'username', - 'Username', - 'text', - $pconfig['username'], - ['placeholder' => 'Username'] -)); - -$section->addInput(new Form_Input( - 'password', - 'Password', - 'password', - $pconfig['password'], - ['placeholder' => 'Password'] -)); - -$form->add($section); -print $form; - -include("foot.inc");
\ No newline at end of file +<?php if ($input_errors) print_input_errors($input_errors)?> +<?php if ($savemsg) print_info_box($savemsg)?> + <div id="container"> + <form class="form-horizontal" action="diag_authentication.php" method="post"> + <div class="form-group"> + <label for="authmode" class="col-sm-2 control-label"><?=gettext("Authentication Server")?></label> + <div class="col-sm-10"> + <select name="authmode" id="authmode" class="formselect" > + <?php + foreach (auth_get_authserver_list() as $auth_server): + $selected = ($auth_server['name'] == $pconfig['authmode']) + ?> + <option value="<?=$auth_server['name']?>" <?=($selected?'selected="selected"':'')?>> + <?=$auth_server['name']?> + </option> + <?php endforeach?> + </select> + </div> + </div> + + <div class="form-group"> + <label for="authmode" class="col-sm-2 control-label"><?=gettext("Username")?></label> + <div class="col-sm-10"> + <input name="username" value="<?=htmlspecialchars($pconfig['username'])?>" /> + </div> + </div> + + <div class="form-group"> + <label for="authmode" class="col-sm-2 control-label"><?=gettext("Password")?></label> + <div class="col-sm-10"> + <input name="password" type="password" value="<?=htmlspecialchars($pconfig['password'])?>" /> + </div> + </div> + + <button type="submit" class="btn btn-primary"><?=gettext("Test");?></button> + </form> + </div> +</div> +<?php include("foot.inc")?> diff --git a/usr/local/www/diag_limiter_info.php b/usr/local/www/diag_limiter_info.php index b2aa4a1..c3f8045 100644 --- a/usr/local/www/diag_limiter_info.php +++ b/usr/local/www/diag_limiter_info.php @@ -1,36 +1,36 @@ <?php /* $Id$ */ /* - diag_limiter_info.php - Copyright (C) 2010 Scott Ullrich - Copyright (C) 2013-2015 Electric Sheep Fencing, LP - All rights reserved. + diag_limiter_info.php + Copyright (C) 2010 Scott Ullrich + 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: + 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. + 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. + 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. + 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. */ /* pfSense_BUILDER_BINARIES: /usr/bin/top - pfSense_MODULE: system + pfSense_MODULE: system */ ##|+PRIV @@ -47,8 +47,8 @@ $shortcut_section = "trafficshaper-limiters"; if($_REQUEST['getactivity']) { $text = `/sbin/ipfw pipe show`; - if($text == "") - $text = "Unable to find any limiters on this system."; + if($text == "") + $text = "We could not find any limiters on this system."; echo "Limiters:\n"; echo $text; $text = `/sbin/ipfw queue show`; @@ -61,36 +61,59 @@ if($_REQUEST['getactivity']) { include("head.inc"); -if ($input_errors) - print_input_errors($input_errors); - ?> -<script> +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<script type="text/javascript"> +//<![CDATA[ function getlimiteractivity() { - $.ajax( - '/diag_limiter_info.php', + var url = "/diag_limiter_info.php"; + var pars = 'getactivity=yes'; + jQuery.ajax( + url, { type: 'post', - data: { - getactivity: 'yes' - }, - success: function (data) { - $('#xhrOutput').html(data); - }, - }); + data: pars, + complete: activitycallback + }); } - - events.push(function(){ - setInterval('getlimiteractivity()', 2500); - getlimiteractivity(); - }); + function activitycallback(transport) { + jQuery('#limiteractivitydiv').html('<font face="Courier" size="2"><pre style="text-align:left;">' + transport.responseText + '<\/pre><\/font>'); + setTimeout('getlimiteractivity()', 2000); + } + setTimeout('getlimiteractivity()', 5000); +//]]> </script> - -<div class="panel panel-default"> - <div class="panel-heading">Limiter Information</div> - <div class="panel-body"> - <pre id="xhrOutput"><?=gettext("Gathering Limiter information, please wait...")?></pre> - </div> +<div id="maincontent"> +<?php + if($savemsg) { + echo "<div id=\"savemsg\">"; + print_info_box($savemsg); + echo "</div>"; + } + if ($input_errors) + print_input_errors($input_errors); +?> +<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="diag limiter info"> + <tr> + <td> + <table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabcont"> + <tr> + <td align="center"> + <table summary="results"> + <tr><td> + <div id="limiteractivitydiv"> + <?=gettext("Gathering Limiter information, please wait...");?> + </div> + </td></tr> + </table> + </td> + </tr> + </table> + </td> + </tr> +</table> </div> - -<?php include("foot.inc");
\ No newline at end of file +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/usr/local/www/diag_ndp.php b/usr/local/www/diag_ndp.php index 1e34d98..03f80be 100644 --- a/usr/local/www/diag_ndp.php +++ b/usr/local/www/diag_ndp.php @@ -1,7 +1,7 @@ <?php /* diag_ndp.php - part of the pfSense project (https://www.pfsense.org) + part of the pfSense project (https://www.pfsense.org) Copyright (C) 2004-2010 Scott Ullrich <sullrich@gmail.com> Copyright (C) 2011 Seth Mos <seth.mos@dds.nl> All rights reserved. @@ -34,7 +34,7 @@ /* pfSense_BUILDER_BINARIES: /bin/cat /usr/sbin/arp - pfSense_MODULE: arp + pfSense_MODULE: arp */ ##|+PRIV @@ -60,8 +60,8 @@ foreach ($ifdescrs as $key =>$interface) { $hwif[$config['interfaces'][$key]['if']] = $interface; } -/* Array ( [0] => Neighbor [1] => Linklayer [2] => Address -[3] => Netif [4] => Expire [5] => S +/* Array ( [0] => Neighbor [1] => Linklayer [2] => Address +[3] => Netif [4] => Expire [5] => S [6] => Flags ) */ $data = array(); array_shift($rawdata); @@ -77,10 +77,10 @@ foreach ($rawdata as $line) { /* FIXME: Not ipv6 compatible dns resolving. PHP needs fixing */ function _getHostName($mac,$ip) -{ +{ if(is_ipaddr($ip)) { list($ip, $scope) = explode("%", $ip); - if(gethostbyaddr($ip) != "" and gethostbyaddr($ip) != $ip) + if(gethostbyaddr($ip) <> "" and gethostbyaddr($ip) <> $ip) return gethostbyaddr($ip); else return ""; @@ -97,7 +97,7 @@ foreach ($data as &$entry) { else $entry['dnsresolve'] = "Z_ "; } - + // Sort the data alpha first $data = msort($data, "dnsresolve"); @@ -106,49 +106,73 @@ $mac_man = load_mac_manufacturer_table(); $pgtitle = array(gettext("Diagnostics"),gettext("NDP Table")); include("head.inc"); + ?> -<div class="table-responsive"> - <table class="table table-striped table-hover"> - <thead> - <tr> - <th><?= gettext("IPv6 address"); ?></th> - <th><?= gettext("MAC address"); ?></th> - <th><?= gettext("Hostname"); ?></th> - <th><?= gettext("Interface"); ?></th> - </tr> - </thead> - <tbody> - <?php foreach ($data as $entry): ?> - <tr> - <td><?=$entry['ipv6']?></td> - <td> - <?php - $mac=trim($entry['mac']); - $mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]); - ?> - <?=$mac?> - - <? if(isset($mac_man[$mac_hi])):?> - (<?=$mac_man[$mac_hi]?>) - <?endif?> - - </td> - <td> - <?=htmlspecialchars(str_replace("Z_ ", "", $entry['dnsresolve']))?> - </td> - <td> - <?php - if(isset($hwif[$entry['interface']])) - echo $hwif[$entry['interface']]; - else - echo $entry['interface']; - ?> - </td> - </tr> - <?php endforeach; ?> - </tbody> - </table> +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> + +<?php include("fbegin.inc"); ?> + +<div id="loading"> + <img src="/themes/<?=$g['theme'];?>/images/misc/loader.gif" alt="loader" /><?= gettext("Loading, please wait..."); ?> + <p> </p> </div> -<?php include("foot.inc");
\ No newline at end of file +<?php + +// Flush buffers out to client so that they see Loading, please wait.... +for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); } +ob_implicit_flush(1); + +?> +<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="diag ndp"> + <tr> + <td> + <table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="tabcont"> + <tr> + <td class="listhdrr"><?= gettext("IPv6 address"); ?></td> + <td class="listhdrr"><?= gettext("MAC address"); ?></td> + <td class="listhdrr"><?= gettext("Hostname"); ?></td> + <td class="listhdr"><?= gettext("Interface"); ?></td> + <td class="list"></td> + </tr> + <?php foreach ($data as $entry): ?> + <tr> + <td class="listlr"><?=$entry['ipv6'];?></td> + <td class="listr"> + <?php + $mac=trim($entry['mac']); + $mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]); + print $mac; + if(isset($mac_man[$mac_hi])){ print "<br /><font size=\"-2\"><i>{$mac_man[$mac_hi]}</i></font>"; } + ?> + </td> + <td class="listr"> + <?php + echo " ". str_replace("Z_ ", "", $entry['dnsresolve']); + ?> + </td> + <td class="listr"> + <?php + if(isset($hwif[$entry['interface']])) + echo $hwif[$entry['interface']]; + else + echo $entry['interface']; + ?> + </td> + </tr> + <?php endforeach; ?> + </table> + </td> + </tr> +</table> + +<?php include("fend.inc"); ?> + +<script type="text/javascript"> +//<![CDATA[ + jQuery('#loading').html(''); +//]]> +</script> +</body> +</html> diff --git a/usr/local/www/diag_pf_info.php b/usr/local/www/diag_pf_info.php index 6e3920d..560ed7c 100644 --- a/usr/local/www/diag_pf_info.php +++ b/usr/local/www/diag_pf_info.php @@ -1,36 +1,36 @@ <?php /* $Id$ */ /* - diag_pf_info.php - Copyright (C) 2010 Scott Ullrich - 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. + diag_pf_info.php + Copyright (C) 2010 Scott Ullrich + 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. */ /* pfSense_BUILDER_BINARIES: /usr/bin/top - pfSense_MODULE: system + pfSense_MODULE: system */ ##|+PRIV @@ -44,11 +44,6 @@ require("guiconfig.inc"); $pgtitle = gettext("Diagnostics: pfInfo"); -if (stristr($_POST['Submit'], gettext("No"))) { - header("Location: index.php"); - exit; -} - if($_REQUEST['getactivity']) { $text = `/sbin/pfctl -vvsi`; $text .= "<p/>"; @@ -63,57 +58,57 @@ if($_REQUEST['getactivity']) { include("head.inc"); -if ($input_errors) - print_input_errors($input_errors); - -require('classes/Form.class.php'); -$form = new Form(false); -$form->addGlobal(new Form_Input( - 'getactivity', - null, - 'hidden', - 'yes' -)); -$section = new Form_Section('Auto update page'); - -$section->addInput(new Form_Checkbox( - 'refresh', - 'Refresh', - 'Automatically refresh the output below', - true -)); - -$form->add($section); -print $form; - ?> -<script> +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<script type="text/javascript"> +jQuery(document).ready(function() {setTimeout('getpfinfo()', 5000);}); +//<![CDATA[ function getpfinfo() { - if (!$('#refresh').is(':checked')) - return; - - $.ajax( - '/diag_pf_info.php', - { - type: 'post', - data: $(document.forms[0]).serialize(), - success: function (data) { - $('#xhrOutput').html(data); - }, + jQuery.ajax({ + type: "POST", + url: "/diag_pf_info.php", + data: 'getactivity=yes', + async: false, + complete: activitycallback }); } - - events.push(function(){ - setInterval('getpfinfo()', 2500); - getpfinfo(); - }); + function activitycallback(transport) { + jQuery('#pfactivitydiv').html('<font face="Courier" size="2"><pre style="text-align:left;">' + transport.responseText + '<\/pre><\/font>'); + setTimeout('getpfinfo()', 2000); + } +//]]> </script> - -<div class="panel panel-default"> - <div class="panel-heading"><?=gettext('Output')?></div> - <div class="panel panel-body"> - <pre id="xhrOutput"><?=gettext("Gathering PF information, please wait...")?></pre> - </div> +<div id="maincontent"> +<?php + if($savemsg) { + echo "<div id=\"savemsg\">"; + print_info_box($savemsg); + echo "</div>"; + } + if ($input_errors) + print_input_errors($input_errors); +?> +<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="diag pf info"> + <tr> + <td> + <table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabcont"> + <tr> + <td align="center"> + <table summary="results"> + <tr><td> + <div id="pfactivitydiv"> + <?=gettext("Gathering PF information, please wait...");?> + </div> + </td></tr> + </table> + </td> + </tr> + </table> + </td> + </tr> +</table> </div> - -<?php include("foot.inc");
\ No newline at end of file +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/usr/local/www/diag_ping.php b/usr/local/www/diag_ping.php index d4db925..0c289cf 100644 --- a/usr/local/www/diag_ping.php +++ b/usr/local/www/diag_ping.php @@ -33,7 +33,7 @@ /* pfSense_BUILDER_BINARIES: /sbin/ping /sbin/ping6 - pfSense_MODULE: routing + pfSense_MODULE: routing */ ##|+PRIV @@ -47,18 +47,10 @@ $allowautocomplete = true; $pgtitle = array(gettext("Diagnostics"), gettext("Ping")); require_once("guiconfig.inc"); + define('MAX_COUNT', 10); define('DEFAULT_COUNT', 3); -function create_sourceaddresslist() { - $list = array('any' => 'Any'); - - foreach (get_possible_traffic_source_addresses(true) as $sipname) - $list[$sipname['value']] = $sipname['name']; - - return $list; -} - if ($_POST || $_REQUEST['host']) { unset($input_errors); unset($do_ping); @@ -87,118 +79,118 @@ if ($_POST || $_REQUEST['host']) { $count = DEFAULT_COUNT; } } - if (!isset($do_ping)) { $do_ping = false; $host = ''; $count = DEFAULT_COUNT; } -if($do_ping) { +include("head.inc"); ?> +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="ping"> +<tr><td> +<?php if ($input_errors) print_input_errors($input_errors); ?> +<form action="diag_ping.php" method="post" name="iform" id="iform"> +<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabcont"> +<tr> + <td colspan="2" valign="top" class="listtopic"><?=gettext("Ping"); ?></td> +</tr> +<tr> + <td width="22%" valign="top" class="vncellreq"><?=gettext("Host"); ?></td> + <td width="78%" class="vtable"> + <?=$mandfldhtml;?><input name="host" type="text" class="formfld unknown" id="host" size="20" value="<?=htmlspecialchars($host);?>" /></td> +</tr> +<tr> + <td width="22%" valign="top" class="vncellreq"><?=gettext("IP Protocol"); ?></td> + <td width="78%" class="vtable"> + <select name="ipproto" class="formselect"> + <option value="ipv4" <?php if ($ipproto == "ipv4") echo "selected=\"selected\"" ?>>IPv4</option> + <option value="ipv6" <?php if ($ipproto == "ipv6") echo "selected=\"selected\"" ?>>IPv6</option> + </select> + </td> +</tr> +<tr> + <td width="22%" valign="top" class="vncell"><?=gettext("Source Address"); ?></td> + <td width="78%" class="vtable"> + <select name="sourceip" class="formselect"> + <option value="">Default</option> + <?php $sourceips = get_possible_traffic_source_addresses(true); + foreach ($sourceips as $sipvalue => $sipname): + $selected = ""; + if (!link_interface_to_bridge($sipvalue) && ($sipvalue == $sourceip)) + $selected = "selected=\"selected\""; + ?> + <option value="<?=$sipvalue;?>" <?=$selected;?>> + <?=htmlspecialchars($sipname);?> + </option> + <?php endforeach; ?> + </select> + </td> +</tr> +<tr> + <td width="22%" valign="top" class="vncellreq"><?= gettext("Count"); ?></td> + <td width="78%" class="vtable"> + <select name="count" class="formfld" id="count"> + <?php for ($i = 1; $i <= MAX_COUNT; $i++): ?> + <option value="<?=$i;?>" <?php if ($i == $count) echo "selected=\"selected\""; ?>><?=$i;?></option> + <?php endfor; ?> + </select> + </td> +</tr> +<tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Ping"); ?>" /> + </td> +</tr> +<tr> + <td valign="top" colspan="2"> + <?php if ($do_ping) { + echo "<font face=\"terminal\" size=\"2\">"; + echo "<strong>" . gettext("Ping output") . ":</strong><br />"; ?> - <script type="text/javascript"> - //<![CDATA[ - window.onload=function(){ - document.getElementById("pingCaptured").wrap='off'; - } - //]]> - </script> + <script type="text/javascript"> + //<![CDATA[ + window.onload=function(){ + document.getElementById("pingCaptured").wrap='off'; + } + //]]> + </script> <?php - $ifscope = ''; - $command = "/sbin/ping"; - if ($ipproto == "ipv6") { - $command .= "6"; - $ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ipv6($sourceip); - if (is_linklocal($ifaddr)) - $ifscope = get_ll_scope($ifaddr); - } else { - $ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ip($sourceip); - } - - if ($ifaddr && (is_ipaddr($host) || is_hostname($host))) { - $srcip = "-S" . escapeshellarg($ifaddr); - if (is_linklocal($host) && !strstr($host, "%") && !empty($ifscope)) - $host .= "%{$ifscope}"; + echo "<textarea id=\"pingCaptured\" style=\"width:98%\" name=\"code\" rows=\"15\" cols=\"66\" readonly=\"readonly\">"; + $ifscope = ''; + $command = "/sbin/ping"; + if ($ipproto == "ipv6") { + $command .= "6"; + $ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ipv6($sourceip); + if (is_linklocal($ifaddr)) + $ifscope = get_ll_scope($ifaddr); + } else { + $ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ip($sourceip); + } + if ($ifaddr && (is_ipaddr($host) || is_hostname($host))) { + $srcip = "-S" . escapeshellarg($ifaddr); + if (is_linklocal($host) && !strstr($host, "%") && !empty($ifscope)) + $host .= "%{$ifscope}"; + } + + $cmd = "{$command} {$srcip} -c" . escapeshellarg($count) . " " . escapeshellarg($host); + //echo "Ping command: {$cmd}\n"; + system($cmd); + echo('</textarea> </font>'); } - - $cmd = "{$command} {$srcip} -c" . escapeshellarg($count) . " " . escapeshellarg($host); - //echo "Ping command: {$cmd}\n"; - $result = shell_exec($cmd); - - if(empty($result)) - $input_errors[] = "Host \"" . $host . "\" did not respond or could not be resolved."; - -} - -include('head.inc'); - -if ($input_errors) - print_input_errors($input_errors); - -require('classes/Form.class.php'); - -$form = new Form(new Form_Button( - 'submit', - 'Ping' -)); - -$section = new Form_Section('Ping'); - -$section->addInput(new Form_Input( - 'host', - 'Hostname', - 'text', - $host, - ['placeholder' => 'Hostname to ping'] -)); - -$group = new Form_Group('IP Protocol'); -$group->add(new Form_Checkbox( - 'ipproto', - null, - 'IPv4', - ('ipv6' != $ipproto), # negative check, so this would be checked by default - 'ipv4' -))->displayAsRadio(); -$group->add(new Form_Checkbox( - 'ipproto', - null, - 'IPv6', - ('ipv6' == $ipproto), - 'ipv6' -))->displayAsRadio(); -$group->setHelp('Select the protocol to use'); -$section->add($group); - -$section->addInput(new Form_Select( - 'sourceip', - 'Source address', - $pconfig['source'], - create_sourceaddresslist() -))->setHelp('Select source address for the ping'); - -$section->addInput(new Form_Select( - 'count', - 'Maximum number of pings', - $count, - array_combine(range(1, MAX_COUNT), range(1, MAX_COUNT)) -))->setHelp('Select the maximum number pings'); - -$form->add($section); -print $form; - -if($do_ping && !empty($result) && !$input_errors) { -?> - <div class="panel panel-default"> - <div class="panel-heading"> - <h2 class="panel-title">Results</h2> - </div> - - <div class="panel-body"> - <pre><?= $result ?></pre> - </div> - </div> -<?php -} - -include('foot.inc'); + ?> + </td> +</tr> +<tr> + <td width="22%" valign="top"> </td> + <td width="78%"> </td> +</tr> +</table> +</form> +</td></tr> +</table> +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/usr/local/www/diag_routes.php b/usr/local/www/diag_routes.php index 031eb3b..14196f4 100644 --- a/usr/local/www/diag_routes.php +++ b/usr/local/www/diag_routes.php @@ -31,7 +31,7 @@ */ /* - pfSense_BUILDER_BINARIES: /usr/bin/netstat + pfSense_BUILDER_BINARIES: /usr/bin/netstat pfSense_MODULE: routing */ ##|+PRIV @@ -43,9 +43,6 @@ include('guiconfig.inc'); -$limit='100'; -$filter=''; - if (isset($_REQUEST['isAjax'])) { $netstat = "/usr/bin/netstat -rW"; if (isset($_REQUEST['IPv6'])) { @@ -54,7 +51,6 @@ if (isset($_REQUEST['isAjax'])) { } else { $netstat .= " -f inet"; echo "IPv4\n"; - } if (!isset($_REQUEST['resolve'])) $netstat .= " -n"; @@ -77,141 +73,166 @@ $shortcut_section = "routing"; include('head.inc'); -require('classes/Form.class.php'); - -$form = new Form(new Form_Button( - 'update', - 'Update' -)); -$form->addGlobal(new Form_Input( - 'isAjax', - null, - 'hidden', - 1 -)); -$section = new Form_Section('Traceroute'); - -$section->addInput(new Form_Checkbox( - 'resolve', - 'Resolve names', - 'Enable', - $resolve -))->setHelp('Enabling name resolution may cause the query should take longer.'. - ' You can stop it at any time by clicking the Stop button in your browser.'); - -$validLimits = array('10', '50', '100', '200', '500', '1000', 'all'); -$section->addInput(new Form_Select( - 'limit', - 'Rows to display', - $limit, - array_combine($validLimits, $validLimits) -)); - -$section->addInput(new Form_Input( - 'filter', - 'Filter', - 'text', - $host -))->setHelp('Use a regular expression to filter IP address or hostnames'); - -$form->add($section); -print $form; ?> -<script> -function update_routes(section) { - $.ajax( - '/diag_routes.php', - { - type: 'post', - data: $(document.forms[0]).serialize() +'&'+ section +'=true', - success: update_routes_callback, - }); -} +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> + +<?php include("fbegin.inc"); ?> + +<script type="text/javascript"> +//<![CDATA[ + + function update_routes(section) { + var url = "diag_routes.php"; + var limit = jQuery('#limit option:selected').text(); + var filter = jQuery('#filter').val(); + var params = "isAjax=true&limit=" + limit + "&filter=" + filter; + if (jQuery('#resolve').is(':checked')) + params += "&resolve=true"; + if (section == "IPv6") + params += "&IPv6=true"; + var myAjax = new Ajax.Request( + url, + { + method: 'post', + parameters: params, + onComplete: update_routes_callback + }); + } -function update_routes_callback(html) { - // First line contains section - var responseTextArr = html.split("\n"); - var section = responseTextArr.shift(); - var tbody = ''; - var field = ''; - var tr_class = ''; - var thead = '<tr>'; - - for (var i = 0; i < responseTextArr.length; i++) { - if (responseTextArr[i] == "") - continue; - var tmp = '<tr>'; - var j = 0; - var entry = responseTextArr[i].split(" "); - for (var k = 0; k < entry.length; k++) { - if (entry[k] == "") + function update_routes_callback(transport) { + // First line contains section + var responseTextArr = transport.responseText.split("\n"); + var section = responseTextArr.shift(); + var tbody = ''; + var field = ''; + var elements = 8; + var tr_class = ''; + + var thead = '<tr><td class="listtopic" colspan="' + elements + '"><strong>' + section + '<\/strong><\/td><\/tr>' + "\n"; + for (var i = 0; i < responseTextArr.length; i++) { + if (responseTextArr[i] == "") continue; + var tmp = ''; + if (i == 0) { + tr_class = 'listhdrr'; + tmp += '<tr class="sortableHeaderRowIdentifier">' + "\n"; + } else { + tr_class = 'listlr'; + tmp += '<tr>' + "\n"; + } + var j = 0; + var entry = responseTextArr[i].split(" "); + for (var k = 0; k < entry.length; k++) { + if (entry[k] == "") + continue; + if (i == 0 && j == (elements - 1)) + tr_class = 'listhdr'; + tmp += '<td class="' + tr_class + '">' + entry[k] + '<\/td>' + "\n"; + if (i > 0) + tr_class = 'listr'; + j++; + } + // The 'Expire' field might be blank + if (j == (elements - 1)) + tmp += '<td class="listr"> <\/td>' + "\n"; + tmp += '<\/tr>' + "\n"; if (i == 0) - tmp += '<th>' + entry[k] + '<\/th>'; + thead += tmp; else - tmp += '<td>' + entry[k] + '<\/td>'; - j++; + tbody += tmp; } - - tmp += '<td><\/td>'; - - if (i == 0) - thead += tmp; - else - tbody += tmp; + jQuery('#' + section + ' > thead').html(thead); + jQuery('#' + section + ' > tbody').html(tbody); } - $('#' + section + ' > thead').html(thead); - $('#' + section + ' > tbody').html(tbody); -} +//]]> +</script> -function update_all_routes() { - update_routes("IPv4"); - update_routes("IPv6"); -} +<script type="text/javascript"> +//<![CDATA[ -events.push(function(){ - setInterval('update_all_routes()', 5000); - update_all_routes(); + function update_all_routes() { + update_routes("IPv4"); + update_routes("IPv6"); + } - $(document.forms[0]).on('submit', function(e){ - update_all_routes(); + jQuery(document).ready(function(){setTimeout('update_all_routes()', 5000);}); - e.preventDefault(); - }); -}); +//]]> </script> -<div class="panel panel-default"> - <div class="panel-heading">IPv4 Routes</div> - <div class="panel panel-body"> - <table class="table table-striped table-compact" id="IPv4"> - <thead> - <!-- filled by xhr --> - </thead> - <tbody> - <tr> - <td><?=gettext("Gathering data, please wait...")?></td> - </tr> - </tbody> - </table> - </div> -</div> +<div id="mainarea"> +<form action="diag_routes.php" method="post"> +<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6" summary="diag routes"> + +<tr> +<td class="vncellreq" width="22%"><?=gettext("Name resolution");?></td> +<td class="vtable" width="78%"> +<input type="checkbox" class="formfld" id="resolve" name="resolve" value="yes" <?php if ($_POST['resolve'] == 'yes') echo "checked=\"checked\""; ?> /><?=gettext("Enable");?> +<br /> +<span class="expl"><?=gettext("Enable this to attempt to resolve names when displaying the tables.");?></span> +</td> +</tr> + +<tr> +<td class="vncellreq" width="22%"><?=gettext("Number of rows");?></td> +<td class="vtable" width="78%"> +<select id="limit" name="limit"> +<?php + foreach (array("10", "50", "100", "200", "500", "1000", gettext("all")) as $item) { + echo "<option value=\"{$item}\" " . ($item == "100" ? "selected=\"selected\"" : "") . ">{$item}</option>\n"; + } +?> +</select> +<br /> +<span class="expl"><?=gettext("Select how many rows to display.");?></span> +</td> +</tr> + +<tr> +<td class="vncellreq" width="22%"><?=gettext("Filter expression");?></td> +<td class="vtable" width="78%"> +<input type="text" class="formfld search" name="filter" id="filter" /> +<br /> +<span class="expl"><?=gettext("Use a regular expression to filter IP address or hostnames.");?></span> +</td> +</tr> + +<tr> +<td class="vncellreq" width="22%"> </td> +<td class="vtable" width="78%"> +<input type="button" class="formbtn" name="update" onclick="update_all_routes();" value="<?=gettext("Update"); ?>" /> +<br /> +<br /> +<span class="vexpl"><span class="red"><strong><?=gettext("Note:")?></strong></span> <?=gettext("By enabling name resolution, the query should take a bit longer. You can stop it at any time by clicking the Stop button in your browser.");?></span> +</td> +</tr> + +</table> +</form> + +<table class="tabcont sortable" width="100%" cellspacing="0" cellpadding="6" border="0" id="IPv4" summary="ipv4 routes"> + <thead> + <tr><td class="listtopic"><strong>IPv4</strong></td></tr> + </thead> + <tbody> + <tr><td class="listhdrr"><?=gettext("Gathering data, please wait...");?></td></tr> + </tbody> +</table> +<table class="tabcont sortable" width="100%" cellspacing="0" cellpadding="6" border="0" id="IPv6" summary="ipv6 routes"> + <thead> + <tr><td class="listtopic"><strong>IPv6</strong></td></tr> + </thead> + <tbody> + <tr><td class="listhdrr"><?=gettext("Gathering data, please wait...");?></td></tr> + </tbody> +</table> -<div class="panel panel-default"> - <div class="panel-heading">IPv6 Routes</div> - <div class="panel panel-body"> - <table class="table table-striped table-compact" id="IPv6"> - <thead> - <!-- filled by xhr --> - </thead> - <tbody> - <tr> - <td><?=gettext("Gathering data, please wait...")?></td> - </tr> - </tbody> - </table> - </div> </div> -<?php include("foot.inc");
\ No newline at end of file +<?php +include('fend.inc'); +?> + +</body> +</html> diff --git a/usr/local/www/diag_states_summary.php b/usr/local/www/diag_states_summary.php index c882bc1..e54061b 100644 --- a/usr/local/www/diag_states_summary.php +++ b/usr/local/www/diag_states_summary.php @@ -33,7 +33,7 @@ /* pfSense_BUILDER_BINARIES: /sbin/pfctl - pfSense_MODULE: filter + pfSense_MODULE: filter */ ##|+PRIV @@ -120,6 +120,7 @@ if(count($states) > 0) { addipinfo($allipinfo, $srcip, $proto, $srcport, $dstport); addipinfo($allipinfo, $dstip, $proto, $srcport, $dstport); + } } @@ -133,6 +134,7 @@ function build_port_info($portarr, $proto) { $ports = array(); asort($portarr); foreach (array_reverse($portarr, TRUE) as $port => $count) { + $str = ""; $service = getservbyport($port, strtolower($proto)); $port = "{$proto}/{$port}"; if ($service) @@ -142,68 +144,59 @@ function build_port_info($portarr, $proto) { return implode($ports, ', '); } -function print_summary_table($label, $iparr, $sort = TRUE) -{ - if ($sort) +function print_summary_table($label, $iparr, $sort = TRUE) { ?> + +<h3><?php echo $label; ?></h3> +<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="states summary"> + <tr> + <td class="listhdrr"><?=gettext("IP");?></td> + <td class="listhdrr"># <?=gettext("States");?></td> + <td class="listhdrr"><?=gettext("Proto");?></td> + <td class="listhdrr"># <?=gettext("States");?></td> + <td class="listhdrr"><?=gettext("Src Ports");?></td> + <td class="listhdrr"><?=gettext("Dst Ports");?></td> + </tr> +<?php if ($sort) uksort($iparr, "sort_by_ip"); + foreach($iparr as $ip => $ipinfo) { ?> + <tr> + <td class="vncell"><?php echo $ip; ?></td> + <td class="vncell"><?php echo $ipinfo['seen']; ?></td> + <td class="vncell"> </td> + <td class="vncell"> </td> + <td class="vncell"> </td> + <td class="vncell"> </td> + </tr> + <?php foreach($ipinfo['protos'] as $proto => $protoinfo) { ?> + <tr> + <td class="list"> </td> + <td class="list"> </td> + <td class="listlr"><?php echo $proto; ?></td> + <td class="listr" align="center"><?php echo $protoinfo['seen']; ?></td> + <td class="listr" align="center"><span title="<?php echo build_port_info($protoinfo['srcports'], $proto); ?>"><?php echo count($protoinfo['srcports']); ?></span></td> + <td class="listr" align="center"><span title="<?php echo build_port_info($protoinfo['dstports'], $proto); ?>"><?php echo count($protoinfo['dstports']); ?></span></td> + </tr> + <?php } ?> +<?php } ?> + +</table> -?> - <div class="panel panel-default"> - <div class="panel-heading"> - <h2 class="panel-title"><?=$label?></h2> - </div> - <div class="panel-body"> - <div class="table-responsive"> - <table class="table table-hover table-condensed table-striped"> - <thead> - <tr> - <th ><?=gettext("IP");?></th> - <th class="text-center"># <?=gettext("States");?></th> - <th ><?=gettext("Proto");?></th> - <th class="text-center"># <?=gettext("States");?></th> - <th class="text-center"><?=gettext("Src Ports");?></th> - <th class="text-center"><?=gettext("Dst Ports");?></th> - </tr> - </thead> - <tbody> -<?php foreach($iparr as $ip => $ipinfo): - $protocolCount = count($ipinfo['protos']); - $rowSpan = ''; - $i = 0; - - if ($protocolCount > 1) - $rowSpan = ' rowspan="' . $protocolCount . '"'; -?> - <tr> - <td<?= $rowSpan ?>><?php echo $ip; ?></td> - <td<?= $rowSpan ?> class="text-center"><?php echo $ipinfo['seen']; ?></td> - -<?php foreach($ipinfo['protos'] as $proto => $protoinfo): ?> -<?php if ($protocolCount > 1 && $i > 0): ?> - </tr><tr> -<?php endif; ?> - <td><?php echo $proto; ?></td> - <td class="text-center" ><?php echo $protoinfo['seen']; ?></td> - <td class="text-center" ><span title="<?php echo build_port_info($protoinfo['srcports'], $proto); ?>"><?php echo count($protoinfo['srcports']); ?></span></td> - <td class="text-center" ><span title="<?php echo build_port_info($protoinfo['dstports'], $proto); ?>"><?php echo count($protoinfo['dstports']); ?></span></td> -<?php $i++; endforeach; ?> - </tr> -<?php endforeach; ?> - </tbody> - </table> - </div> - </div> - </div> <?php } $pgtitle = array(gettext("Diagnostics"),gettext("State Table Summary")); require_once("guiconfig.inc"); include("head.inc"); +echo "<body>"; +include("fbegin.inc"); + print_summary_table(gettext("By Source IP"), $srcipinfo); print_summary_table(gettext("By Destination IP"), $dstipinfo); print_summary_table(gettext("Total per IP"), $allipinfo); print_summary_table(gettext("By IP Pair"), $pairipinfo, FALSE); +?> -include("foot.inc");
\ No newline at end of file +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/usr/local/www/diag_system_activity.php b/usr/local/www/diag_system_activity.php index 9843a3e..cc2c41e 100644 --- a/usr/local/www/diag_system_activity.php +++ b/usr/local/www/diag_system_activity.php @@ -1,37 +1,37 @@ <?php /* $Id$ */ /* - diag_system_activity.php - Copyright (C) 2013-2015 Electric Sheep Fencing, LP - - Copyright (C) 2008-2009 Scott Ullrich - 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. + diag_system_activity.php + Copyright (C) 2013-2015 Electric Sheep Fencing, LP + + Copyright (C) 2008-2009 Scott Ullrich + 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. */ /* pfSense_BUILDER_BINARIES: /usr/bin/top - pfSense_MODULE: system + pfSense_MODULE: system */ ##|+PRIV @@ -43,7 +43,7 @@ require("guiconfig.inc"); -$pgtitle = array(gettext("Diagnostics"),gettext("System Activity")); +$pgtitle = gettext("Diagnostics: System Activity"); if($_REQUEST['getactivity']) { $text = `/usr/bin/top -aHS | /usr/bin/cut -c1-105`; @@ -53,38 +53,60 @@ if($_REQUEST['getactivity']) { include("head.inc"); -if ($input_errors) - print_input_errors($input_errors); - ?> -<script> -function getcpuactivity() { - $.ajax( - '/diag_system_activity.php', - { - method: 'post', - data: { - getactivity: 'yes' - }, - dataType: "html", - success: function (data) { - $('#xhrOutput').html(data); - }, - } - ); -} - -events.push(function(){ - setInterval('getcpuactivity()', 2500); - getcpuactivity(); -}); +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<script type="text/javascript"> +//<![CDATA[ + function getcpuactivity() { + scroll(0,0); + var url = "/diag_system_activity.php"; + var pars = 'getactivity=yes'; + jQuery.ajax( + url, + { + type: 'post', + data: pars, + complete: activitycallback + }); + } + function activitycallback(transport) { + jQuery('#cpuactivitydiv').html('<font face="Courier" size="2"><pre style="text-align:left;">' + transport.responseText + '<\/pre><\/font>'); + setTimeout('getcpuactivity()', 2500); + } + setTimeout('getcpuactivity()', 1000); +//]]> </script> - -<div class="panel panel-default"> - <div class="panel-heading"><?=gettext('CPU Activity')?></div> - <div class="panel panel-body"> - <pre id="xhrOutput"><?=gettext("Gathering CPU activity, please wait...")?></pre> - </div> +<div id="maincontent"> +<?php + if($savemsg) { + echo "<div id=\"savemsg\">"; + print_info_box($savemsg); + echo "</div>"; + } + if ($input_errors) + print_input_errors($input_errors); +?> +<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="diag system activity"> + <tr> + <td> + <table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabcont"> + <tr> + <td align="center"> + <table summary="results"> + <tr><td> + <div id="cpuactivitydiv"> + <?=gettext("Gathering CPU activity, please wait...");?> + </div> + </td></tr> + </table> + </td> + </tr> + </table> + </td> + </tr> +</table> </div> - -<?php include("foot.inc");
\ No newline at end of file +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/usr/local/www/diag_system_pftop.php b/usr/local/www/diag_system_pftop.php index f80107a..f5cc443 100644 --- a/usr/local/www/diag_system_pftop.php +++ b/usr/local/www/diag_system_pftop.php @@ -1,31 +1,31 @@ <?php /* $Id$ */ /* - diag_system_pftop.php - Copyright (C) 2008-2009 Scott Ullrich - 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. + diag_system_pftop.php + Copyright (C) 2008-2009 Scott Ullrich + 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. */ /* @@ -67,7 +67,7 @@ if($_REQUEST['getactivity']) { } $text = `pftop -b {$sorttype} -v {$viewtype} {$numstate}`; - echo trim($text); + echo $text; exit; } @@ -90,100 +90,126 @@ if($_REQUEST['sorttype'] && in_array($_REQUEST['sorttype'], $sorttypes) $numstate = "100"; } -if ($input_errors) - print_input_errors($input_errors); - -require('classes/Form.class.php'); -$form = new Form(false); -$form->addGlobal(new Form_Input( - 'getactivity', - null, - 'hidden', - 'yes' -)); -$section = new Form_Section('pfTop Configuration'); - -$validViews = array( - 'default', 'label', 'long', - 'queue', 'rules', 'size', - 'speed', 'state', 'time', -); -$section->addInput(new Form_Select( - 'viewtype', - 'View', - $viewtype, - array_combine($validViews, $validViews) -)); - -$section->addInput(new Form_Select( - 'sorttype', - 'Sort by', - $sorttype, - array( - 'none' => 'None', - 'age' => 'Age', - 'bytes' => 'Bytes', - 'dest' => 'Destination Address', - 'dport' => 'Destination Port', - 'exp' => 'Expiry', - 'peak' => 'Peak', - 'pkt' => 'Packet', - 'rate' => 'Rate', - 'size' => 'Size', - 'sport' => 'Source Port', - 'src' => 'Source Address', - ) -)); - -$validStates = array(50, 100, 200, 500, 100, 'all'); -$section->addInput(new Form_Select( - 'states', - 'Maximum # of States', - $numstate, - array_combine($validStates, $validStates) -)); - -$form->add($section); -print $form; ?> - -<script> +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<form method="post" action="diag_system_pftop.php"> +<script type="text/javascript"> +//<![CDATA[ function getpftopactivity() { - $.ajax( - '/diag_system_pftop.php', + var url = "/diag_system_pftop.php"; + var pars = 'getactivity=yes&sorttype=' + jQuery('#sorttype').val() + '&viewtype=' + jQuery('#viewtype').val() + '&states=' + jQuery('#states').val(); + jQuery.ajax( + url, { - method: 'post', - data: $(document.forms[0]).serialize(), - dataType: "html", - success: function (data) { - $('#xhrOutput').html(data); - }, - } - ); + type: 'post', + data: pars, + complete: activitycallback + }); } - - events.push(function(){ - setInterval('getpftopactivity()', 2500); - getpftopactivity(); - }); + function activitycallback(transport) { + jQuery('#pftopactivitydiv').html('<font face="Courier" size="2"><pre style="text-align:left;">' + transport.responseText + '<\/pre><\/font>'); + setTimeout('getpftopactivity()', 2500); + } + setTimeout('getpftopactivity()', 1000); +//]]> </script> +<div id="maincontent"> <?php + if($savemsg) { + echo "<div id=\"savemsg\">"; + print_info_box($savemsg); + echo "</div>"; + } + if ($input_errors) + print_input_errors($input_errors); ?> -<div class="panel panel-default"> - <div class="panel-heading"><?=gettext('Output')?></div> - <div class="panel panel-body"> - <pre id="xhrOutput"><?=gettext("Gathering pfTOP activity, please wait...")?></pre> + <div id="mainarea" style="padding-bottom: 0px;"> + <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="diag system pftop"> + <tr> + <td class="list"> + <div id='viewtypediv'><?=gettext("View type:"); ?> + <select name='viewtype' id='viewtype'> + <option value='default' <?php echo ($viewtype == "default") ? "selected=\"selected\"" : ""; ?>><?=gettext("Default");?></option> + <option value='label' <?php echo ($viewtype == "label") ? "selected=\"selected\"" : ""; ?>><?=gettext("Label");?></option> + <option value='long' <?php echo ($viewtype == "long") ? "selected=\"selected\"" : ""; ?>><?=gettext("Long");?></option> + <option value='queue' <?php echo ($viewtype == "queue") ? "selected=\"selected\"" : ""; ?>><?=gettext("Queue");?></option> + <option value='rules' <?php echo ($viewtype == "rules") ? "selected=\"selected\"" : ""; ?>><?=gettext("Rules");?></option> + <option value='size' <?php echo ($viewtype == "size") ? "selected=\"selected\"" : ""; ?>><?=gettext("Size");?></option> + <option value='speed' <?php echo ($viewtype == "speed") ? "selected=\"selected\"" : ""; ?>><?=gettext("Speed");?></option> + <option value='state' <?php echo ($viewtype == "state") ? "selected=\"selected\"" : ""; ?>><?=gettext("State");?></option> + <option value='time' <?php echo ($viewtype == "time") ? "selected=\"selected\"" : ""; ?>><?=gettext("Time");?></option> + </select> + </div> + </td> + <td class="list"> + <div id='sorttypediv'><?=gettext("Sort type:"); ?> + <select name='sorttype' id='sorttype'> + <option value='age' <?php echo ($sorttype == "age") ? "selected=\"selected\"" : ""; ?>><?=gettext("Age");?></option> + <option value='bytes' <?php echo ($sorttype == "bytes") ? "selected=\"selected\"" : ""; ?>><?=gettext("Bytes");?></option> + <option value='dest' <?php echo ($sorttype == "dest") ? "selected=\"selected\"" : ""; ?>><?=gettext("Destination Address");?></option> + <option value='dport' <?php echo ($sorttype == "dport") ? "selected=\"selected\"" : ""; ?>><?=gettext("Destination Port");?></option> + <option value='exp' <?php echo ($sorttype == "exp") ? "selected=\"selected\"" : ""; ?>><?=gettext("Expiry");?></option> + <option value='none' <?php echo ($sorttype == "none") ? "selected=\"selected\"" : ""; ?>><?=gettext("None");?></option> + <option value='peak' <?php echo ($sorttype == "peak") ? "selected=\"selected\"" : ""; ?>><?=gettext("Peak");?></option> + <option value='pkt' <?php echo ($sorttype == "pkt") ? "selected=\"selected\"" : ""; ?>><?=gettext("Packet");?></option> + <option value='rate' <?php echo ($sorttype == "rate") ? "selected=\"selected\"" : ""; ?>><?=gettext("Rate");?></option> + <option value='size' <?php echo ($sorttype == "size") ? "selected=\"selected\"" : ""; ?>><?=gettext("Size");?></option> + <option value='sport' <?php echo ($sorttype == "sport") ? "selected=\"selected\"" : ""; ?>><?=gettext("Source Port");?></option> + <option value='src' <?php echo ($sorttype == "src") ? "selected=\"selected\"" : ""; ?>><?=gettext("Source Address");?></option> + </select> + </div> + </td> + <td class="list"> + <div id='statesdiv'><?=gettext("Number of States:"); ?> + <select name='states' id='states'> + <option value='50' <?php echo ($numstate == "50") ? "selected=\"selected\"" : ""; ?>>50</option> + <option value='100' <?php echo ($numstate == "100") ? "selected=\"selected\"" : ""; ?>>100</option> + <option value='200' <?php echo ($numstate == "200") ? "selected=\"selected\"" : ""; ?>>200</option> + <option value='500' <?php echo ($numstate == "500") ? "selected=\"selected\"" : ""; ?>>500</option> + <option value='1000' <?php echo ($numstate == "1000") ? "selected=\"selected\"" : ""; ?>>1000</option> + <option value='all' <?php echo ($numstate == "all") ? "selected=\"selected\"" : ""; ?>>all</option> + </select> + </div> + </td> + </tr> + <tr> + <td colspan="3" align="center"> + <table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabcont"> + <tr> + <td align="center"> + <table summary="results"> + <tr> + <td> + <div id="pftopactivitydiv"><?=gettext("Gathering pfTOP activity, please wait...");?></div> + </td> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + </table> </div> </div> - -<script> -events.push(function(){ - $('#viewtype').on('change', function(){ - if (['queue', 'label', 'rules'].indexOf($(this).val()) > -1) - $("#sorttype, #sorttypediv, #statesdiv, #states").parents('.form-group').hide(); - else - $("#sorttype, #sorttypediv, #statesdiv, #states").parents('.form-group').show(); - }); +</form> +<?php include("fend.inc"); ?> +<script type="text/javascript"> +//<![CDATA[ +jQuery("#viewtype").change(function() { + var selected = jQuery("#viewtype option:selected"); + switch(selected.val()) { + case "queue": + case "label": + case "rules": + jQuery("#sorttype, #sorttypediv, #statesdiv, #states").hide(); + break; + default: + jQuery("#sorttype, #sorttypediv, #statesdiv, #states").show(); + } }); +//]]> </script> -<?php include("foot.inc");
\ No newline at end of file +</body> +</html> diff --git a/usr/local/www/edit.php b/usr/local/www/edit.php index f18a72d..4d2c34f 100644 --- a/usr/local/www/edit.php +++ b/usr/local/www/edit.php @@ -46,25 +46,24 @@ if($_POST['action']) { switch($_POST['action']) { case 'load': if(strlen($_POST['file']) < 1) { - print('|5|' . '<div class="alert alert-danger" role="alert">'.gettext("No file name specified").'</div>' . '|'); + echo "|5|" . gettext("No file name specified") . ".|"; } elseif(is_dir($_POST['file'])) { - print('|4|' . '<div class="alert alert-danger" role="alert">' . gettext("Loading a directory is not supported") .'</div>' . '|'); + echo "|4|" . gettext("Loading a directory is not supported") . ".|"; } elseif(! is_file($_POST['file'])) { - print('|3|' . '<div class="alert alert-danger" role="alert">' . gettext("File does not exist or is not a regular file") . '</div>' . '|'); + echo "|3|" . gettext("File does not exist or is not a regular file") . ".|"; } else { $data = file_get_contents(urldecode($_POST['file'])); if($data === false) { - print('|1|' . '<div class="alert alert-danger" role="alert">' . gettext("Failed to read file") . '</div>' . '|'); + echo "|1|" . gettext("Failed to read file") . ".|"; } else { $data = base64_encode($data); - print("|0|{$_POST['file']}|{$data}|"); + echo "|0|{$_POST['file']}|{$data}|"; } } exit; - case 'save': if(strlen($_POST['file']) < 1) { - print('|' . '<div class="alert alert-danger" role="alert">'.gettext("No file name specified").'</div>' . '|'); + echo "|" . gettext("No file name specified") . ".|"; } else { conf_mount_rw(); $_POST['data'] = str_replace("\r", "", base64_decode($_POST['data'])); @@ -76,11 +75,11 @@ if($_POST['action']) { disable_security_checks(); } if($ret === false) { - print('|' . '<div class="alert alert-danger" role="alert">' . gettext("Failed to write file") . '</div>' . '|'); - } elseif($ret != strlen($_POST['data'])) { - print('|' . '<div class="alert alert-danger" role="alert">' . gettext("Error while writing file") . '</div>' . '|'); + echo "|" . gettext("Failed to write file") . ".|"; + } elseif($ret <> strlen($_POST['data'])) { + echo "|" . gettext("Error while writing file") . ".|"; } else { - print('|' . '<div class="alert alert-success" role="alert">' . gettext("File saved successfully") . '</div>' . '|'); + echo "|" . gettext("File successfully saved") . ".|"; } } exit; @@ -88,45 +87,25 @@ if($_POST['action']) { exit; } +$closehead = false; require("head.inc"); -?> -<!-- file status box --> -<div style="display:none; background:#eeeeee;" id="fileStatusBox"> - <strong id="fileStatus"></strong> -</div> - -<div class="panel panel-default"> - <div class="panel-heading"><?=gettext("Save / Load a file from the filesystem")?></div> - <div class="panel-body"> - <form> - <input type="text" class="form-control" id="fbTarget"/> - <input type="button" class="btn btn-default btn-sm" onclick="loadFile();" value="<?=gettext('Load')?>" /> - <input type="button" class="btn btn-default btn-sm" id="fbOpen" value="<?=gettext('Browse')?>" /> - <input type="button" class="btn btn-default btn-sm" onclick="saveFile();" value="<?=gettext('Save')?>" /> - </form> - - <div id="fbBrowser" style="display:none; border:1px dashed gray; width:98%;"></div> - - <div style="background:#eeeeee;" id="fileOutput"> - <script type="text/javascript"> - //<![CDATA[ - window.onload=function(){ - document.getElementById("fileContent").wrap='off'; - } - //]]> - </script> - <textarea id="fileContent" name="fileContent" class="form-control" rows="30" cols=""></textarea> - </div> +outputCSSFileInline("code-syntax-highlighter/SyntaxHighlighter.css"); +outputJavaScriptFileInline("filebrowser/browser.js"); +outputJavaScriptFileInline("javascript/base64.js"); - </div> -</div> +?> +</head> +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> -<script> +<script type="text/javascript"> +//<![CDATA[ function loadFile() { - jQuery("#fileStatus").html(""); + jQuery("#fileStatus").html("<?=gettext("Loading file"); ?> ..."); jQuery("#fileStatusBox").show(500); + jQuery.ajax( - "<?=$_SERVER['SCRIPT_NAME']?>", { + "<?=$_SERVER['SCRIPT_NAME'];?>", { type: "post", data: "action=load&file=" + jQuery("#fbTarget").val(), complete: loadComplete @@ -141,26 +120,38 @@ require("head.inc"); if(values.shift() == "0") { var file = values.shift(); - var fileContent = window.atob(values.join("|")); - + var fileContent = Base64.decode(values.join("|")); + jQuery("#fileStatus").html("<?=gettext("File successfully loaded"); ?>."); jQuery("#fileContent").val(fileContent); + + var lang = "none"; + if(file.indexOf(".php") > 0) lang = "php"; + else if(file.indexOf(".inc") > 0) lang = "php"; + else if(file.indexOf(".xml") > 0) lang = "xml"; + else if(file.indexOf(".js" ) > 0) lang = "js"; + else if(file.indexOf(".css") > 0) lang = "css"; + + if(jQuery("#highlight").checked && lang != "none") { + jQuery("fileContent").prop("className",lang + ":showcolumns"); + dp.SyntaxHighlighter.HighlightAll("fileContent", true, false); + } } else { jQuery("#fileStatus").html(values[0]); jQuery("#fileContent").val(""); } - jQuery("#fileContent").show(1000); } function saveFile(file) { - jQuery("#fileStatus").html(""); + jQuery("#fileStatus").html("<?=gettext("Saving file"); ?> ..."); jQuery("#fileStatusBox").show(500); + var fileContent = Base64.encode(jQuery("#fileContent").val()); fileContent = fileContent.replace(/\+/g,"%2B"); - + jQuery.ajax( - "<?=$_SERVER['SCRIPT_NAME']?>", { + "<?=$_SERVER['SCRIPT_NAME'];?>", { type: "post", data: "action=save&file=" + jQuery("#fbTarget").val() + "&data=" + fileContent, @@ -171,15 +162,93 @@ require("head.inc"); } ); } +//]]> +</script> + +<!-- file status box --> +<div style="display:none; background:#eeeeee;" id="fileStatusBox"> + <div class="vexpl" style="padding-left:15px;"> + <strong id="fileStatus"></strong> + </div> +</div> + +<br /> + +<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="file editor"> + <tr> + <td class="tabcont" align="center"> + +<!-- controls --> +<table width="100%" cellpadding="9" cellspacing="9" summary="controls"> + <tr> + <td align="center" class="list"> + <?=gettext("Save / Load from path"); ?>: + <input type="text" class="formfld file" id="fbTarget" size="45" /> + <input type="button" class="formbtn" onclick="loadFile();" value="<?=gettext('Load');?>" /> + <input type="button" class="formbtn" id="fbOpen" value="<?=gettext('Browse');?>" /> + <input type="button" class="formbtn" onclick="saveFile();" value="<?=gettext('Save');?>" /> + <br /> + <?php + /* + <input type="checkbox" id="highlight" /><?=gettext("Enable syntax highlighting"); + */ + ?> + </td> + </tr> +</table> + +<!-- filebrowser --> +<div id="fbBrowser" style="display:none; border:1px dashed gray; width:98%;"></div> + +<!-- file viewer/editor --> +<table width="100%" summary="file editor"> + <tr> + <td valign="top"> + <div style="background:#eeeeee;" id="fileOutput"> + <script type="text/javascript"> + //<![CDATA[ + window.onload=function(){ + document.getElementById("fileContent").wrap='off'; + } + //]]> + </script> + <textarea id="fileContent" name="fileContent" style="width:100%;" rows="30" cols=""></textarea> + </div> + </td> + </tr> +</table> + + </td> + </tr> +</table> + +<script type="text/javascript" src="/code-syntax-highlighter/shCore.js"></script> +<script type="text/javascript" src="/code-syntax-highlighter/shBrushCss.js"></script> +<script type="text/javascript" src="/code-syntax-highlighter/shBrushJScript.js"></script> +<script type="text/javascript" src="/code-syntax-highlighter/shBrushPhp.js"></script> +<script type="text/javascript" src="/code-syntax-highlighter/shBrushXml.js"></script> +<script type="text/javascript"> +//<![CDATA[ + jQuery(window).load( + function() { + jQuery("#fbTarget").focus(); + + NiftyCheck(); + Rounded("div#fileStatusBox", "all", "#ffffff", "#eeeeee", "smooth"); + } + ); <?php if($_GET['action'] == "load"): ?> - events.push(function() { - jQuery("#fbTarget").val("<?=htmlspecialchars($_GET['path'])?>"); - loadFile(); - }); + jQuery(window).load( + function() { + jQuery("#fbTarget").val("<?=htmlspecialchars($_GET['path']);?>"); + loadFile(); + } + ); <?php endif; ?> +//]]> </script> -<?php include("foot.inc"); - -outputJavaScriptFileInline("filebrowser/browser.js");
\ No newline at end of file +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/usr/local/www/exec.php b/usr/local/www/exec.php index d263621..61fbcc5 100644 --- a/usr/local/www/exec.php +++ b/usr/local/www/exec.php @@ -8,29 +8,29 @@ Copyright (C) 2013-2015 Electric Sheep Fencing, LP - 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. + 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. */ /* - pfSense_MODULE: shell + pfSense_MODULE: shell */ ##|+PRIV @@ -84,183 +84,262 @@ function puts( $arg ) { echo "$arg\n"; } // "Constants". -$Version = ''; +$Version = ''; $ScriptName = $REQUEST['SCRIPT_NAME']; // Get year. -$arrDT = localtime(); +$arrDT = localtime(); $intYear = $arrDT[5] + 1900; $closehead = false; $pgtitle = array(gettext("Diagnostics"),gettext("Execute command")); include("head.inc"); ?> -<script> - // Create recall buffer array (of encoded strings). + +<script type="text/javascript"> +//<![CDATA[ + + // Create recall buffer array (of encoded strings). + <?php if (isBlank( $_POST['txtRecallBuffer'] )) { - puts( " var arrRecallBuffer = new Array;" ); + puts( " var arrRecallBuffer = new Array;" ); } else { - puts( " var arrRecallBuffer = new Array(" ); + puts( " var arrRecallBuffer = new Array(" ); $arrBuffer = explode( "&", $_POST['txtRecallBuffer'] ); for ($i=0; $i < (count( $arrBuffer ) - 1); $i++) - puts( " '" . htmlspecialchars($arrBuffer[$i], ENT_QUOTES | ENT_HTML401) . "'," ); - puts( " '" . htmlspecialchars($arrBuffer[count( $arrBuffer ) - 1], ENT_QUOTES | ENT_HTML401) . "'" ); - puts( " );" ); + puts( " '" . htmlspecialchars($arrBuffer[$i], ENT_QUOTES | ENT_HTML401) . "'," ); + puts( " '" . htmlspecialchars($arrBuffer[count( $arrBuffer ) - 1], ENT_QUOTES | ENT_HTML401) . "'" ); + puts( " );" ); } + ?> - // Set pointer to end of recall buffer. - var intRecallPtr = arrRecallBuffer.length-1; - - // Functions to extend String class. - function str_encode() { return escape( this ) } - function str_decode() { return unescape( this ) } - - // Extend string class to include encode() and decode() functions. - String.prototype.encode = str_encode - String.prototype.decode = str_decode - - // Function: is Blank - // Returns boolean true or false if argument is blank. - function isBlank( strArg ) { return strArg.match( /^\s*$/ ) } - - // Function: frmExecPlus onSubmit (event handler) - // Builds the recall buffer from the command string on submit. - function frmExecPlus_onSubmit( form ) { - if (!isBlank(form.txtCommand.value)) { - // If this command is repeat of last command, then do not store command. - if (form.txtCommand.value.encode() == arrRecallBuffer[arrRecallBuffer.length-1]) { return true } - - // Stuff encoded command string into the recall buffer. - if (isBlank(form.txtRecallBuffer.value)) - form.txtRecallBuffer.value = form.txtCommand.value.encode(); - else - form.txtRecallBuffer.value += '&' + form.txtCommand.value.encode(); - } - - return true; - } - // Function: btnRecall onClick (event handler) - // Recalls command buffer going either up or down. - function btnRecall_onClick( form, n ) { + // Set pointer to end of recall buffer. + var intRecallPtr = arrRecallBuffer.length-1; - // If nothing in recall buffer, then error. - if (!arrRecallBuffer.length) { - alert( '<?=gettext("Nothing to recall"); ?>!' ); - form.txtCommand.focus(); - return; - } + // Functions to extend String class. + function str_encode() { return escape( this ) } + function str_decode() { return unescape( this ) } - // Increment recall buffer pointer in positive or negative direction - // according to <n>. - intRecallPtr += n; + // Extend string class to include encode() and decode() functions. + String.prototype.encode = str_encode + String.prototype.decode = str_decode - // Make sure the buffer stays circular. - if (intRecallPtr < 0) { intRecallPtr = arrRecallBuffer.length - 1 } - if (intRecallPtr > (arrRecallBuffer.length - 1)) { intRecallPtr = 0 } + // Function: is Blank + // Returns boolean true or false if argument is blank. + function isBlank( strArg ) { return strArg.match( /^\s*$/ ) } - // Recall the command. - form.txtCommand.value = arrRecallBuffer[intRecallPtr].decode(); - } + // Function: frmExecPlus onSubmit (event handler) + // Builds the recall buffer from the command string on submit. + function frmExecPlus_onSubmit( form ) { - // Function: Reset onClick (event handler) - // Resets form on reset button click event. - function Reset_onClick( form ) { + if (!isBlank(form.txtCommand.value)) { + // If this command is repeat of last command, then do not store command. + if (form.txtCommand.value.encode() == arrRecallBuffer[arrRecallBuffer.length-1]) { return true } - // Reset recall buffer pointer. - intRecallPtr = arrRecallBuffer.length; + // Stuff encoded command string into the recall buffer. + if (isBlank(form.txtRecallBuffer.value)) + form.txtRecallBuffer.value = form.txtCommand.value.encode(); + else + form.txtRecallBuffer.value += '&' + form.txtCommand.value.encode(); + } - // Clear form (could have spaces in it) and return focus ready for cmd. - form.txtCommand.value = ''; - form.txtCommand.focus(); + return true; + } - return true; - } + // Function: btnRecall onClick (event handler) + // Recalls command buffer going either up or down. + function btnRecall_onClick( form, n ) { + + // If nothing in recall buffer, then error. + if (!arrRecallBuffer.length) { + alert( '<?=gettext("Nothing to recall"); ?>!' ); + form.txtCommand.focus(); + return; + } + + // Increment recall buffer pointer in positive or negative direction + // according to <n>. + intRecallPtr += n; + + // Make sure the buffer stays circular. + if (intRecallPtr < 0) { intRecallPtr = arrRecallBuffer.length - 1 } + if (intRecallPtr > (arrRecallBuffer.length - 1)) { intRecallPtr = 0 } + + // Recall the command. + form.txtCommand.value = arrRecallBuffer[intRecallPtr].decode(); + } + + // Function: Reset onClick (event handler) + // Resets form on reset button click event. + function Reset_onClick( form ) { + + // Reset recall buffer pointer. + intRecallPtr = arrRecallBuffer.length; + + // Clear form (could have spaces in it) and return focus ready for cmd. + form.txtCommand.value = ''; + form.txtCommand.focus(); + + return true; + } //]]> </script> -<?php +<style type="text/css"> +/*<![CDATA[*/ -if (isBlank($_POST['txtCommand']) && isBlank($_POST['txtPHPCommand']) && isBlank($ulmsg)) - print('<div class="alert alert-warning" role="alert">'.gettext("The capabilities offered here can be dangerous. No support is available. Use them at your own risk!").'</div>'); +input { + font-family: courier new, courier; + font-weight: normal; + font-size: 9pt; +} -if (!isBlank($_POST['txtCommand'])):?> - <div class="panel panel-success responsive"> - <div class="panel-heading">Shell Output - <?=htmlspecialchars($_POST['txtCommand'])?></div> - <div class="panel-body"> - <pre> -<?php - putenv("PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"); - putenv("SCRIPT_FILENAME=" . strtok($_POST['txtCommand'], " ")); - print htmlspecialchars(system($_POST['txtCommand'].' 2>&1')); -?> - </pre> - </div> - </div> -<? endif ?> +pre { + border: 2px solid #435370; + background: #F0F0F0; + padding: 1em; + font-family: courier new, courier; + white-space: pre; + line-height: 10pt; + font-size: 10pt; +} -<form action="exec.php" method="post" enctype="multipart/form-data" name="frmExecPlus" onsubmit="return frmExecPlus_onSubmit( this );"> - <div class="panel panel-default"> - <div class="panel-heading"><?=gettext('Execute Shell Command')?></div> - <div class="panel-body"> - <input id="txtCommand" name="txtCommand" placeholder="Command" type="text" class="col-sm-4" value="<?=htmlspecialchars($_POST['txtCommand'])?>" /> - <br /><br /> - <input type="hidden" name="txtRecallBuffer" value="<?=htmlspecialchars($_POST['txtRecallBuffer']) ?>" /> - <input type="button" class="btn btn-default btn-sm" name="btnRecallPrev" value="<" onclick="btnRecall_onClick( this.form, -1 );" /> - <input type="submit" class="btn btn-default btn-sm" value="<?=gettext("Execute"); ?>" /> - <input type="button" class="btn btn-default btn-sm" name="btnRecallNext" value=">" onclick="btnRecall_onClick( this.form, 1 );" /> - <input type="button" class="btn btn-default btn-sm" value="<?=gettext("Clear"); ?>" onclick="return Reset_onClick( this.form );" /> - </div> - </div> - - <div class="panel panel-default"> - <div class="panel-heading"><?=gettext('Download file')?></div> - <div class="panel-body"> - <input name="dlPath" type="text" id="dlPath" placeholder="File to download" class="col-sm-4"/> - <br /><br /> - <input name="submit" type="submit" class="btn btn-default btn-sm" id="download" value="<?=gettext("Download"); ?>" /> - </div> - </div> +.label { + font-family: tahoma, verdana, arial, helvetica; + font-size: 11px; + font-weight: bold; +} +.button { + font-family: tahoma, verdana, arial, helvetica; + font-weight: bold; + font-size: 11px; +} + +/*]]>*/ +</style> +</head> +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<?php if (isBlank($_POST['txtCommand'])): ?> +<p class="red"><strong><?=gettext("Note: this function is unsupported. Use it " . +"on your own risk"); ?>!</strong></p> +<?php endif; ?> +<?php if ($ulmsg) echo "<p><strong>" . $ulmsg . "</strong></p>\n"; ?> <?php - if ($ulmsg) - print('<div class="alert alert-success" role="alert">' . $ulmsg .'</div>'); -?> - <div class="panel panel-default"> - <div class="panel-heading"><?=gettext('Upload a file')?></div> - <div class="panel-body"> - <input name="ulfile" type="file" class="btn btn-default btn-sm btn-file" id="ulfile" /> - <br /> - <input name="submit" type="submit" class="btn btn-default btn-sm pull-left" id="upload" value="<?=gettext("Upload"); ?>" /> - - </div> - </div> -<?php - if (!isBlank($_POST['txtPHPCommand'])) { - puts("<div class=\"panel panel-success responsive\"><div class=\"panel-heading\">PHP response</div>"); - puts("<pre>"); - require_once("config.inc"); - require_once("functions.inc"); - echo eval($_POST['txtPHPCommand']); - puts(" </pre>"); - puts("</div>"); + +if (!isBlank($_POST['txtCommand'])) { + puts("<pre>"); + puts("\$ " . htmlspecialchars($_POST['txtCommand'])); + putenv("PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"); + putenv("SCRIPT_FILENAME=" . strtok($_POST['txtCommand'], " ")); /* PHP scripts */ + $ph = popen($_POST['txtCommand'] . ' 2>&1', "r" ); + while ($line = fgets($ph)) echo htmlspecialchars($line); + pclose($ph); + puts(" </pre>"); } + + +if (!isBlank($_POST['txtPHPCommand'])) { + puts("<pre>"); + require_once("config.inc"); + require_once("functions.inc"); + echo eval($_POST['txtPHPCommand']); + puts(" </pre>"); +} + ?> - <div class="panel panel-default responsive"> - <div class="panel-heading"><?=gettext('Execute PHP Commands')?></div> - <div class="panel-body"> - <textarea id="txtPHPCommand" placeholder="Command" name="txtPHPCommand" rows="9" cols="80"><?=htmlspecialchars($_POST['txtPHPCommand'])?></textarea> - <br /> - <input type="submit" class="btn btn-default btn-sm" value="<?=gettext("Execute")?>" /> - <?=gettext("Example"); ?>: <code>print("Hello World!");</code> - </div> - </div> +<div id="niftyOutter"> +<form action="exec.php" method="post" enctype="multipart/form-data" name="frmExecPlus" onsubmit="return frmExecPlus_onSubmit( this );"> + <table summary="exec"> + <tr> + <td colspan="2" valign="top" class="vnsepcell"><?=gettext("Execute Shell command"); ?></td> + </tr> + <tr> + <td class="label" align="right"><?=gettext("Command"); ?>:</td> + <td class="type"><input id="txtCommand" name="txtCommand" type="text" class="formfld unknown" size="80" value="<?=htmlspecialchars($_POST['txtCommand']);?>" /></td> + </tr> + <tr> + <td valign="top"> </td> + <td valign="top" class="label"> + <input type="hidden" name="txtRecallBuffer" value="<?=htmlspecialchars($_POST['txtRecallBuffer']) ?>" /> + <input type="button" class="button" name="btnRecallPrev" value="<" onclick="btnRecall_onClick( this.form, -1 );" /> + <input type="submit" class="button" value="<?=gettext("Execute"); ?>" /> + <input type="button" class="button" name="btnRecallNext" value=">" onclick="btnRecall_onClick( this.form, 1 );" /> + <input type="button" class="button" value="<?=gettext("Clear"); ?>" onclick="return Reset_onClick( this.form );" /> + </td> + </tr> + <tr> + <td colspan="2" valign="top" height="16"></td> + </tr> + <tr> + <td colspan="2" valign="top" class="vnsepcell"><?=gettext("Download"); ?></td> + </tr> + <tr> + <td align="right"><?=gettext("File to download"); ?>:</td> + <td> + <input name="dlPath" type="text" class="formfld file" id="dlPath" size="50" /> + </td></tr> + <tr> + <td valign="top"> </td> + <td valign="top" class="label"> + <input name="submit" type="submit" class="button" id="download" value="<?=gettext("Download"); ?>" /> + </td> + </tr> + <tr> + <td colspan="2" valign="top" height="16"></td> + </tr> + <tr> + <td colspan="2" valign="top" class="vnsepcell"><?=gettext("Upload"); ?></td> + </tr> + <tr> + <td align="right"><?=gettext("File to upload"); ?>:</td> + <td valign="top" class="label"> + <input name="ulfile" type="file" class="formfld file" id="ulfile" /> + </td></tr> + <tr> + <td valign="top"> </td> + <td valign="top" class="label"> + <input name="submit" type="submit" class="button" id="upload" value="<?=gettext("Upload"); ?>" /></td> + </tr> + <tr> + <td colspan="2" valign="top" height="16"></td> + </tr> + <tr> + <td colspan="2" valign="top" class="vnsepcell"><?=gettext("PHP Execute"); ?></td> + </tr> + <tr> + <td align="right"><?=gettext("Command"); ?>:</td> + <td class="type"><textarea id="txtPHPCommand" name="txtPHPCommand" rows="9" cols="80"><?=htmlspecialchars($_POST['txtPHPCommand']);?></textarea></td> + </tr> + <tr> + <td valign="top"> </td> + <td valign="top" class="label"> + <input type="submit" class="button" value="<?=gettext("Execute"); ?>" /> + <p> + <strong><?=gettext("Example"); ?>:</strong> interfaces_sync_setup(); + </p> + </td> + </tr> + + </table> </form> +</div> +<?php include("fend.inc"); ?> +<script type="text/javascript"> +//<![CDATA[ +document.forms[0].txtCommand.focus(); +//]]> +</script> +</body> +</html> <?php -include("foot.inc"); if($_POST) - conf_mount_ro();
\ No newline at end of file + conf_mount_ro(); + +?> diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php index cea0a5b..7186870 100644 --- a/usr/local/www/firewall_rules.php +++ b/usr/local/www/firewall_rules.php @@ -227,6 +227,8 @@ include("head.inc"); $nrules = 0; ?> +<form action="firewall_rules.php" method="post"> + <?php if ($savemsg) print_info_box($savemsg);?> <?php if (is_subsystem_dirty('filter')): ?><p> <?php print_info_box_np(gettext("The firewall rule configuration has been changed.") . "<br />" . gettext("You must apply the changes in order for them to take effect."), "apply", "", true); ?> @@ -654,6 +656,7 @@ display_top_tabs($tab_array); <a href="#" role="button" class="btn btn-danger"> <?=gettext("delete selected");?> </a> + <!-- onclick="return confirm('<?=gettext('Do you really want to delete the selected rules?');?>')" />--> <?php endif;?> </nav> @@ -683,4 +686,5 @@ display_top_tabs($tab_array); <?php endif;?> </p> <input type="hidden" name="if" value="<?=htmlspecialchars($if);?>" /> +</form> <?php include("foot.inc");?>
\ No newline at end of file diff --git a/usr/local/www/halt.php b/usr/local/www/halt.php index 49e99c5..322fbd4 100755 --- a/usr/local/www/halt.php +++ b/usr/local/www/halt.php @@ -50,7 +50,7 @@ require("guiconfig.inc"); require("functions.inc"); require("captiveportal.inc"); -if ($_POST['save'] == 'No') { +if (stristr($_POST['Submit'], gettext("No"))) { header("Location: index.php"); exit; } @@ -58,28 +58,28 @@ if ($_POST['save'] == 'No') { $pgtitle = array(gettext("Diagnostics"),gettext("Halt system")); include('head.inc'); -if ($_POST['save'] == 'Yes') { - print('<meta http-equiv="refresh" content="70;url=/">'); - print('<div class="alert alert-success" role="alert">'.gettext("The system is halting now. This may take one minute or so.").'</div>'); +if ($_SERVER['REQUEST_METHOD'] == 'POST') { +?> + <meta http-equiv="refresh" content="70;url=/"> + <div class="alert alert-success" role="alert"> + <?=gettext("The system is halting now. This may take one minute or so.")?> + </div> +<?php if(DEBUG) print("Not actually halting (DEBUG is set true)<br>"); else system_halt(); } else { - ?> -<!-- Simple HTML version --> + <div class="panel panel-default"> - <div class="panel-heading"> - <h2 class="panel-title">Are you sure you want to halt the system?</h2> - </div> - <div class="panel-body"> - <p>Click "Yes" to halt the system immediately, or "No" to go to the system dashboard. (There will be a brief delay before the dashboard appears.)</p> + <div class="panel-heading">Are you sure you want to halt the system?</div> + <div class="panel-body">Click "Yes" to halt the system immediately, or "No" to go to the system dashboard. (There will be a brief delay before the dashboard appears.)<br /><br /> <form action="halt.php" method="post"> - <input type="submit" class="btn btn-danger pull-center" name="save" value="Yes"> - <input type="submit" class="btn btn-default" name="save" value="No"> + <input type="submit" class="btn btn-danger pull-center" name="Submit" value="Yes"> + <a href="/" class="btn btn-default">No</a> </form> </div> </div> diff --git a/usr/local/www/interfaces_assign.php b/usr/local/www/interfaces_assign.php index 1a6030d..7fa8071 100644 --- a/usr/local/www/interfaces_assign.php +++ b/usr/local/www/interfaces_assign.php @@ -492,7 +492,7 @@ display_top_tabs($tab_array); </td> <td> <?php if ($ifname != 'wan'):?> - <input type="submit" name="del[<?=$ifname?>]" class="btn btn-danger" value="<?=gettext("delete interface")?>"/> + <input type="submit" name="del[<?=$ifname?>]" class="btn btn-danger" value="<?=gettext("delete interface")?>" onclick="return confirm('<?=gettext("Do you really want to delete this interface?"); ?>')"/> <?php endif;?> </td> </tr> diff --git a/usr/local/www/interfaces_groups.php b/usr/local/www/interfaces_groups.php index b2a7bae..0d7b0b0 100644 --- a/usr/local/www/interfaces_groups.php +++ b/usr/local/www/interfaces_groups.php @@ -115,7 +115,7 @@ display_top_tabs($tab_array); <td><?=htmlspecialchars($ifgroupentry['descr']);?></td> <td> <a class="btn btn-primary btn-sm" role="button" href="interfaces_groups_edit.php?id=<?=$i; ?>"><?=gettext('Edit'); ?></a> - <a class="btn btn-danger btn-sm" role="button" href="interfaces_groups.php?act=del&id=<?=$i; ?>"><?=gettext("Delete"); ?></a> + <a class="btn btn-danger btn-sm" role="button" href="interfaces_groups.php?act=del&id=<?=$i; ?>" onclick="return confirm('<?=gettext("Do you really want to delete this group? All elements that still use it will become invalid (e.g. filter rules)!"); ?>')"><?=gettext("Delete"); ?></a> </td> </tr> <?php $i++; endforeach; endif; ?> diff --git a/usr/local/www/interfaces_vlan.php b/usr/local/www/interfaces_vlan.php index 9c9da84..3e02b1a 100644 --- a/usr/local/www/interfaces_vlan.php +++ b/usr/local/www/interfaces_vlan.php @@ -117,7 +117,7 @@ display_top_tabs($tab_array); <td><?=htmlspecialchars($vlan['descr']);?></td> <td> <a class="btn btn-primary btn-sm" role="button" href="interfaces_vlan_edit.php?id=<?=$i?>"><?=gettext('Edit')?></a> - <a class="btn btn-danger btn-sm" role="button" href="interfaces_vlan.php?act=del&id=<?=$i?>"><?=gettext('Delete')?></a></td> + <a class="btn btn-danger btn-sm" role="button" href="interfaces_vlan.php?act=del&id=<?=$i?>" onclick="return confirm('<?=gettext("Do you really want to delete this VLAN?")?>')"><?=gettext('Delete')?></a></td> </td> </tr> <?php diff --git a/usr/local/www/jquery/pfSense.js b/usr/local/www/jquery/pfSense.js index 852e482..8382d77 100644 --- a/usr/local/www/jquery/pfSense.js +++ b/usr/local/www/jquery/pfSense.js @@ -97,18 +97,9 @@ $(function() { }); }; - // Add confirm to all btn-danger buttons - $('.btn-danger').on('click', function(e){ - if (!confirm('Are you sure you wish to '+ $.trim(this.textContent) +'?')) - e.preventDefault(); - }); - // Enable popovers globally $('[data-toggle="popover"]').popover() - // Focus first input - $(':input:enabled:visible:first').focus(); - runEvents(); bindCollapseToOptions(); allowUserGroupDuplication(); diff --git a/usr/local/www/system_advanced_sysctl.php b/usr/local/www/system_advanced_sysctl.php index d228c34..42a35a8 100644 --- a/usr/local/www/system_advanced_sysctl.php +++ b/usr/local/www/system_advanced_sysctl.php @@ -181,7 +181,7 @@ if ($act != "edit" ): ?> <td> <a class="btn btn-xs btn-primary" href="system_advanced_sysctl.php?act=edit&id=<?=$i;?>"><?=gettext('Edit'); ?></a> <?php if (isset($tunable['modified'])): ?> - <a class="btn btn-xs btn-danger" href="system_advanced_sysctl.php?act=del&id=<?=$i;?>"><?=gettext('Delete/Reset'); ?></a> + <a class="btn btn-xs btn-danger" href="system_advanced_sysctl.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this entry?"); ?>')"><?=gettext('Delete/Reset'); ?></a> <?php endif; ?> </td> </tr> diff --git a/usr/local/www/system_authservers.php b/usr/local/www/system_authservers.php index 38521e0..eea6085 100644 --- a/usr/local/www/system_authservers.php +++ b/usr/local/www/system_authservers.php @@ -345,7 +345,7 @@ if (!($act == "new" || $act == "edit" || $input_errors)) <td> <?php if ($i < (count($a_server) - 1)): ?> <a href="system_authservers.php?act=edit&id=<?=$i?>" class="btn btn-xs btn-primary">edit</a> - <a href="system_authservers.php?act=del&id=<?=$i?>" class="btn btn-xs btn-danger">delete</a> + <a href="system_authservers.php?act=del&id=<?=$i?>" class="btn btn-xs btn-danger" onclick="return confirm('<?=gettext("Do you really want to delete this Server?")?>')">delete</a> <?php endif?> </td> </tr> diff --git a/usr/local/www/system_gateways.php b/usr/local/www/system_gateways.php index c80dfd8..228d541 100644 --- a/usr/local/www/system_gateways.php +++ b/usr/local/www/system_gateways.php @@ -254,7 +254,7 @@ foreach ($a_gateways as $i => $gateway): copy </a> <? if (is_numeric($gateway['attribute'])): ?> - <a class="btn btn-xs btn-danger" href="system_gateways.php?act=del&id=<?=$i?>"> + <a class="btn btn-xs btn-danger" href="system_gateways.php?act=del&id=<?=$i?>" onclick="return confirm('<?=gettext("Do you really want to delete this gateway?")?>')"> delete </a> <a class="btn btn-xs btn-default" href="?act=toggle&id=<?=$i?>"> diff --git a/usr/local/www/vpn_ipsec.php b/usr/local/www/vpn_ipsec.php index dd0abc8..fb20474 100644 --- a/usr/local/www/vpn_ipsec.php +++ b/usr/local/www/vpn_ipsec.php @@ -360,7 +360,8 @@ include("head.inc"); <?php // TODO: add mouseover behaviour which indicates insert position when moving ?> <button class="btn btn-xs btn-default" type="submit" name="move_<?=$i?>" value="move_<?=$i?>"><?=gettext("move selected entries before this")?></button> <a class="btn btn-xs btn-primary" href="vpn_ipsec_phase1.php?p1index=<?=$i?>" title="<?=gettext("edit phase1 entry"); ?>">edit</a> - <button class="btn btn-xs btn-danger" type="submit" name="del_<?=$i?>" value="del_<?=$i?>" title="<?=gettext('delete phase1 entry'); ?>">delete</button> + <button class="btn btn-xs btn-danger" type="submit" name="del_<?=$i?>" value="del_<?=$i?>" title="<?=gettext('delete phase1 entry'); ?>" + onclick="return confirm('<?=gettext("Do you really want to delete this phase1 and all associated phase2 entries?"); ?>')">delete</button> <?php if (!isset($ph1ent['mobile'])): ?> <a class="btn btn-xs btn-success" href="vpn_ipsec_phase1.php?dup=<?=$i?>" title="<?=gettext("copy phase1 entry"); ?>">copy</a> <?php endif; ?> @@ -473,7 +474,8 @@ include("head.inc"); <?php // TODO: add mouseover behaviour which indicates insert position when moving ?> <button class="btn btn-xs btn-default" type="submit" name="movep2_<?=$j?>" value="movep2_<?=$j?>"><?=gettext("move selected entries before this")?></button> <a class="btn btn-xs btn-primary" href="vpn_ipsec_phase2.php?p2index=<?=$ph2ent['uniqid']?>" title="<?=gettext("edit phase2 entry"); ?>">edit</a> - <button class="btn btn-xs btn-danger" type="submit" name="delp2_<?=$ph2index?>" value="delp2_<?=$ph2index?>" title="<?=gettext('delete phase2 entry'); ?>">delete</button> + <button class="btn btn-xs btn-danger" type="submit" name="delp2_<?=$ph2index?>" value="delp2_<?=$ph2index?>" title="<?=gettext('delete phase2 entry'); ?>" + onclick="return confirm('<?=gettext("Do you really want to delete this phase2 entry?"); ?>')">delete</button> <a class="btn btn-xs btn-success" href="vpn_ipsec_phase2.php?dup=<?=$ph2ent['uniqid']?>" title="<?=gettext("add a new Phase 2 based on this one"); ?>">copy</a> </td> </tr> diff --git a/usr/local/www/vpn_ipsec_keys.php b/usr/local/www/vpn_ipsec_keys.php index db931b0..1ed5731 100644 --- a/usr/local/www/vpn_ipsec_keys.php +++ b/usr/local/www/vpn_ipsec_keys.php @@ -156,7 +156,7 @@ if (is_subsystem_dirty('ipsec')) </td> <td> <a class="btn btn-primary btn-xs" href="vpn_ipsec_keys_edit.php?id=<?=$i?>">edit key</a> - <a class="btn btn-danger btn-xs" href="vpn_ipsec_keys.php?act=del&id=<?=$i?>">delete key</a> + <a class="btn btn-danger btn-xs" href="vpn_ipsec_keys.php?act=del&id=<?=$i?>" onclick="return confirm('<?=gettext("Do you really want to delete this Pre-Shared Key?"); ?>')">delete key</a> </td> </tr> <?php $i++; endforeach; ?> diff --git a/usr/local/www/vpn_l2tp_users.php b/usr/local/www/vpn_l2tp_users.php index d03a7a6..b97fb7d 100644 --- a/usr/local/www/vpn_l2tp_users.php +++ b/usr/local/www/vpn_l2tp_users.php @@ -111,7 +111,7 @@ include("head.inc"); </td> <td> <a class="btn btn-xs btn-primary" href="vpn_l2tp_users_edit.php?id=<?=$i?>"><?= gettext('edit') ?></a> - <a class="btn btn-xs btn-danger" href="vpn_l2tp_users.php?act=del&id=<?=$i?>"><?=gettext("delete")?></a> + <a class="btn btn-xs btn-danger" href="vpn_l2tp_users.php?act=del&id=<?=$i?>" onclick="return confirm('<?=gettext("Do you really want to delete this user?")?>')"><?=gettext("delete")?></a> </td> </tr> <?php $i++; endforeach?> diff --git a/usr/local/www/widgets/widgets/captive_portal_status.widget.php b/usr/local/www/widgets/widgets/captive_portal_status.widget.php index 9b4f67b..faba5c5 100644 --- a/usr/local/www/widgets/widgets/captive_portal_status.widget.php +++ b/usr/local/www/widgets/widgets/captive_portal_status.widget.php @@ -123,8 +123,8 @@ if ($_GET['order']) { <td><?php if ($cpent[11] && ($cpent[11] > 0)) echo date("m/d/Y H:i:s", $cpent[11]);?></td> <?php endif; ?> <td> - <a href="?order=<?=htmlspecialchars($_GET['order']);?>&showact=<?=$showact;?>&act=del&zone=<?=$cpent[10];?>&id=<?=$cpent[5];?>" class="btn btn-xs btn-danger"> - delete + <a href="?order=<?=htmlspecialchars($_GET['order']);?>&showact=<?=$showact;?>&act=del&zone=<?=$cpent[10];?>&id=<?=$cpent[5];?>" onclick="return confirm('Do you really want to disconnect this client?')"> + <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" alt="x" /> </a> </td> </tr> |