diff options
Diffstat (limited to 'usr/local')
90 files changed, 987 insertions, 730 deletions
diff --git a/usr/local/bin/captiveportal_gather_stats.php b/usr/local/bin/captiveportal_gather_stats.php index 823b28f..63d91a2 100644 --- a/usr/local/bin/captiveportal_gather_stats.php +++ b/usr/local/bin/captiveportal_gather_stats.php @@ -32,6 +32,11 @@ require_once("functions.inc"); require_once("captiveportal.inc"); require_once("util.inc"); +global $cpzone; + +$cpzone = $argv[1]; +$type = $argv[2]; + /* read in captive portal db */ $cpdb = captiveportal_read_db(); @@ -45,8 +50,6 @@ $current_user_count = 0; /* tmp file to use to store old data (per interface)*/ $tmpfile = "{$g['vardb_path']}/captiveportal_online_users"; -$type = $argv[1]; - if(empty($type)) exit; @@ -56,9 +59,9 @@ echo "N:"; if ($type == "loggedin") { /* Find out the previous user timestamp - * so we can determine the difference between the current - * and previous user count. If the file is empty return a 0. - */ + * so we can determine the difference between the current + * and previous user count. If the file is empty return a 0. + */ $fd = @fopen($tmpfile, "r"); if ($fd) { while (!feof($fd)) { @@ -67,21 +70,20 @@ if ($type == "loggedin") { $previous_user_timestamp = $line; else $previous_user_timestamp = 0; - } + } } else { $previous_user_timestamp = 0; } @fclose($fd); - foreach($cpdb as $user) { - $user_ip = $user[2]; + $user_ip = $user[2]; // Record the timestamp $timestamp = $user[0]; if ($timestamp > $previous_user_timestamp) $current_user_count = $current_user_count + 1; } - + // Write out the latest timestamp but not if it is empty if (!empty($timestamp)) { $fd = @fopen($tmpfile, "w"); @@ -90,9 +92,9 @@ if ($type == "loggedin") { } @fclose($fd); } - - /* If $timestamp is less than or equal to previous_user_timestamp return 0, - * as we only want the 'X' number of users logged in since last RRD poll. + + /* If $timestamp is less than or equal to previous_user_timestamp return 0, + * as we only want the 'X' number of users logged in since last RRD poll. */ if($timestamp <= $previous_user_timestamp) $result = 0; @@ -102,7 +104,6 @@ if ($type == "loggedin") { } else $result = $no_users; - echo "$result"; - -?>
\ No newline at end of file + +?> diff --git a/usr/local/captiveportal/index.php b/usr/local/captiveportal/index.php index 7034177..63b4280 100755 --- a/usr/local/captiveportal/index.php +++ b/usr/local/captiveportal/index.php @@ -170,7 +170,7 @@ EOD; } } else if ($_POST['accept'] && $radius_enable) { - if (($_POST['auth_user'] && $_POST['auth_pass']) || ($_POST['auth_user2'] && $_POST['auth_pass2'])) { + if (($_POST['auth_user'] && isset($_POST['auth_pass'])) || ($_POST['auth_user2'] && isset($_POST['auth_pass2']))) { if (!empty($_POST['auth_user'])) { $user = $_POST['auth_user']; $paswd = $_POST['auth_pass']; @@ -207,6 +207,10 @@ EOD; if ($_POST['auth_user'] && $_POST['auth_pass']) { //check against local user manager $loginok = local_backed($_POST['auth_user'], $_POST['auth_pass']); + + if ($loginok && isset($cpcfg['localauth_priv'])) + $loginok = userHasPrivilege(getUserEntry($_POST['auth_user']), "user-services-captiveportal-login"); + if ($loginok){ captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,"LOGIN"); portal_allow($clientip, $clientmac,$_POST['auth_user']); diff --git a/usr/local/captiveportal/radius_accounting.inc b/usr/local/captiveportal/radius_accounting.inc index 2485f06..4a167e7 100644 --- a/usr/local/captiveportal/radius_accounting.inc +++ b/usr/local/captiveportal/radius_accounting.inc @@ -178,6 +178,7 @@ function RADIUS_ACCOUNTING_START($ruleno, $username, $sessionid, $radiusservers, // close OO RADIUS_ACCOUNTING $racct->close(); + unset($racct); return $retvalue ; diff --git a/usr/local/captiveportal/radius_authentication.inc b/usr/local/captiveportal/radius_authentication.inc index 92890b8..8727815 100644 --- a/usr/local/captiveportal/radius_authentication.inc +++ b/usr/local/captiveportal/radius_authentication.inc @@ -205,6 +205,7 @@ function RADIUS_AUTHENTICATION($username,$password,$radiusservers,$clientip,$cli // close OO RADIUS_AUTHENTICATION $rauth->close(); + unset($rauth); return $retvalue; diff --git a/usr/local/sbin/ntpdate_sync_once.sh b/usr/local/sbin/ntpdate_sync_once.sh index e899672..3809b23 100755 --- a/usr/local/sbin/ntpdate_sync_once.sh +++ b/usr/local/sbin/ntpdate_sync_once.sh @@ -29,7 +29,7 @@ fi if [ -f /var/etc/ntpd.conf ]; then echo "Starting NTP Daemon." | /usr/bin/logger -t ntp; - /usr/local/bin/ntpd -g -c /var/etc/ntpd.conf + /usr/local/bin/ntpd -g -c /var/etc/ntpd.conf -p /var/run/ntpd.pid else echo "NTP configuration file missing, not starting daemon." | /usr/bin/logger -t ntp; fi
\ No newline at end of file diff --git a/usr/local/sbin/ovpn-linkdown b/usr/local/sbin/ovpn-linkdown index b300aed..708d507 100755 --- a/usr/local/sbin/ovpn-linkdown +++ b/usr/local/sbin/ovpn-linkdown @@ -1,5 +1,5 @@ #!/bin/sh -# /sbin/pfctl -b $4 -b $5 +/sbin/pfctl -i $1 -Fs # delete the node just in case mpd cannot do that /bin/rm -f /var/etc/nameserver_$1 /bin/rm -f /tmp/$1_router diff --git a/usr/local/sbin/ppp-linkdown b/usr/local/sbin/ppp-linkdown index 87560f7..69f9f88 100755 --- a/usr/local/sbin/ppp-linkdown +++ b/usr/local/sbin/ppp-linkdown @@ -16,14 +16,9 @@ if [ "$3" != "" ]; then pfctl -K ${LOCAL_IP} fi -OLD_ROUTER=`/bin/cat /tmp/${1}_router` -if [ "${OLD_ROUTER}" != "" ]; then - echo "Removing states to ${OLD_ROUTER}" | logger -t ppp-linkdown - /sbin/pfctl -b 0.0.0.0/32 -b ${OLD_ROUTER}/32 - - if [ -f "/tmp/${interface}_defaultgw" ]; then - route delete default ${OLD_ROUTER} - fi +/sbin/pfctl -i $1 -Fs +if [ -f "/tmp/${1}_defaultgw" ]; then + route delete default ${OLD_ROUTER} fi # delete the node just in case mpd cannot do that /usr/sbin/ngctl shutdown $1: diff --git a/usr/local/sbin/ppp-linkup b/usr/local/sbin/ppp-linkup index 3a62fbb..1e9fdaa 100755 --- a/usr/local/sbin/ppp-linkup +++ b/usr/local/sbin/ppp-linkup @@ -5,7 +5,8 @@ if [ "$2" == "inet" ]; then OLD_ROUTER=`/bin/cat /tmp/${1}_router` if [ "${OLD_ROUTER}" != "" ]; then echo "Removing states to old router ${OLD_ROUTER}" | logger -t ppp-linkup - /sbin/pfctl -b 0.0.0.0/32 -b ${OLD_ROUTER}/32 + /sbin/pfctl -i $1 -k 0.0.0.0/0 -k ${OLD_ROUTER}/32 + /sbin/pfctl -i $1 -k ${OLD_ROUTER}/32 -k 0.0.0.0/0 fi # let the configuration system know that the ipv4 has changed. diff --git a/usr/local/sbin/vpn-linkdown b/usr/local/sbin/vpn-linkdown index 0549b1f..b6d033c 100755 --- a/usr/local/sbin/vpn-linkdown +++ b/usr/local/sbin/vpn-linkdown @@ -2,8 +2,5 @@ # record logout /usr/bin/logger -p local3.info "logout,$1,$4,$5" -/sbin/pfctl -i $1 -b 0.0.0.0/32 -b $4/32 -/sbin/pfctl -i $1 -k $4/32 -/sbin/pfctl -i $1 -k 0.0.0.0/32 $4/32 -/sbin/pfctl -i $1 -K $4/32 -/sbin/pfctl -i $1 -K 0.0.0.0/32 -K $4/32 +/sbin/pfctl -i $1 -Fs +/sbin/pfctl -K $4/32 diff --git a/usr/local/www/classes/maintable.inc b/usr/local/www/classes/maintable.inc index 2396a0d..77b29f3 100644 --- a/usr/local/www/classes/maintable.inc +++ b/usr/local/www/classes/maintable.inc @@ -73,7 +73,7 @@ class MainTable { function display() { echo "<!-- begin content table -->\n"; - echo "<table class=\"tabcont\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n"; + echo "<table class=\"tabcont\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" summary=\"display\">\n"; echo " <!-- begin content table header -->\n"; echo $this->display_header(); echo " <!-- end content table header -->\n"; @@ -95,10 +95,10 @@ class MainTable { } echo " <td width=\"{$this->width[$this->columns - 1]}%\" class=\"listhdr\">{$this->headers[$this->columns - 1]}</td>\n"; echo " <td width=\"10%\" class=\"list\">\n"; - echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n"; + echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" summary=\"display header\">\n"; echo " <tr>\n"; echo " <td width=\"17\"></td>\n"; - echo " <td valign=\"middle\"><a href=\"{$this->edit_uri}\"><img src=\"/themes/{$g['theme']}/images/icons/icon_plus.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n"; + echo " <td valign=\"middle\"><a href=\"{$this->edit_uri}\"><img src=\"/themes/{$g['theme']}/images/icons/icon_plus.gif\" width=\"17\" height=\"17\" border=\"0\" alt=\"plus\" /></a></td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; @@ -116,7 +116,7 @@ class MainTable { } else { $cl = 'listr'; } - echo " <td class=\"{$cl}\" onClick=\"fr_toggle({$cur_row})\" id=\"frd{$cur_row}\" ondblclick=\"document.location='{$this->edit_uri}?id={$cur_row}'\">\n"; + echo " <td class=\"{$cl}\" onclick=\"fr_toggle({$cur_row})\" id=\"frd{$cur_row}\" ondblclick=\"document.location='{$this->edit_uri}?id={$cur_row}'\">\n"; if (is_array($row[$this->cname[$col]])) { foreach ($row[$this->cname[$col]] as $data) { echo " {$data}<br/>\n"; @@ -126,10 +126,10 @@ class MainTable { } echo " </td>\n"; } - echo " <td class=\"listbg\" onClick=\"fr_toggle({$cur_row})\" id=\"frd{$cur_row}\" ondblclick=\"document.location=\'{$this->edit_uri}?id={$cur_row}\'\">\n"; + echo " <td class=\"listbg\" onclick=\"fr_toggle({$cur_row})\" id=\"frd{$cur_row}\" ondblclick=\"document.location=\'{$this->edit_uri}?id={$cur_row}\'\">\n"; echo " <font color=\"#FFFFFF\">{$row[$this->cname[$this->columns - 1]]}</font>\n"; echo " </td>\n"; - echo " <td class=\"list\" nowrap>\n"; + echo " <td class=\"list nowrap\">\n"; $this->display_buttons($cur_row); echo " </td>\n"; echo "</tr>\n"; @@ -142,22 +142,23 @@ class MainTable { echo "<tr>\n"; echo " <td class=\"list\" colspan=\"{$this->columns}\"></td>\n"; echo " <td class=\"list\">\n"; - echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n"; + echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" summary=\"display footer\">\n"; echo " <tr>\n"; echo " <td width=\"17\"></td>\n"; - echo " <td valign=\"middle\"><a href=\"{$this->edit_uri}\"><img src=\"/themes/{$g['theme']}/images/icons/icon_plus.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td>\n"; + echo " <td valign=\"middle\"><a href=\"{$this->edit_uri}\"><img src=\"/themes/{$g['theme']}/images/icons/icon_plus.gif\" width=\"17\" height=\"17\" border=\"0\" alt=\"plus\" /></a></td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo "</tr>\n"; } private function display_buttons($row) { - echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n"; + echo " <table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" summary=\"display buttons\">\n"; echo " <tr>\n"; if ($this->buttons['move']) echo $this->display_button('move', $row); if ($this->buttons['edit']) echo $this->display_button('edit', $row); + echo " </tr>\n"; echo " <tr>\n"; if ($this->buttons['del']) echo $this->display_button('del', $row); @@ -171,19 +172,19 @@ class MainTable { echo "<td valign=\"middle\">"; switch ($button) { case "move": { - echo "<input name=\"move_{$row}\" type=\"image\" src=\"./themes/{$g['theme']}/images/icons/icon_left.gif\" width=\"17\" height=\"17\" title=\"Move selected entries before this entry\" onMouseOver=\"fr_insline({$row}, true)\" onMouseOut=\"fr_insline({$row}, false)\">"; + echo "<input name=\"move_{$row}\" type=\"image\" src=\"./themes/{$g['theme']}/images/icons/icon_left.gif\" width=\"17\" height=\"17\" title=\"Move selected entries before this entry\" onmouseover=\"fr_insline({$row}, true)\" onmouseout=\"fr_insline({$row}, false)\" />"; break; } case "edit": { - echo "<a href=\"{$this->edit_uri}?id={$row}\"><img src=\"/themes/{$g['theme']}/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\" title=\"Edit entry\"></a>"; + echo "<a href=\"{$this->edit_uri}?id={$row}\"><img src=\"/themes/{$g['theme']}/images/icons/icon_e.gif\" width=\"17\" height=\"17\" border=\"0\" title=\"Edit entry\" alt=\"edit\" /></a>"; break; } case "del": { - echo "<a href=\"{$this->my_uri}?act=del&id={$row}\" onclick=\"return confirm(\'Do you really want to delete this entry?\')\"><img src=\"/themes/{$g['theme']}/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\" title=\"Delete entry\"></a>"; + echo "<a href=\"{$this->my_uri}?act=del&id={$row}\" onclick=\"return confirm(\'Do you really want to delete this entry?\')\"><img src=\"/themes/{$g['theme']}/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\" title=\"Delete entry\" alt=\"delete\" /></a>"; break; } case "dup": { - echo "<a href=\"{$this->edit_uri}?act=dup&id={$row}\"><img src=\"/themes/{$g['theme']}/images/icons/icon_plus.gif\" width=\"17\" height=\"17\" border=\"0\" title=\"Duplicate entry\"></a>"; + echo "<a href=\"{$this->edit_uri}?act=dup&id={$row}\"><img src=\"/themes/{$g['theme']}/images/icons/icon_plus.gif\" width=\"17\" height=\"17\" border=\"0\" title=\"Duplicate entry\" alt=\"duplicate\" /></a>"; break; } } diff --git a/usr/local/www/crash_reporter.php b/usr/local/www/crash_reporter.php index 3cbc51f..d3146b8 100755 --- a/usr/local/www/crash_reporter.php +++ b/usr/local/www/crash_reporter.php @@ -101,7 +101,9 @@ exec("/usr/bin/grep -vi warning /tmp/PHP_errors.log", $php_errors); <?php if (gettext($_POST['Submit']) == "Yes") { echo gettext("Processing..."); - file_put_contents("/var/crash/crashreport_header.txt", $crash_report_header); + if (!is_dir("/var/crash")) + mwexec("/bin/mkdir -p /var/crash"); + @file_put_contents("/var/crash/crashreport_header.txt", $crash_report_header); if(file_exists("/tmp/PHP_errors.log")) exec("cp /tmp/PHP_errors.log /var/crash/"); exec("/usr/bin/gzip /var/crash/*"); diff --git a/usr/local/www/diag_backup.php b/usr/local/www/diag_backup.php index d84a501..2fe7b60 100755 --- a/usr/local/www/diag_backup.php +++ b/usr/local/www/diag_backup.php @@ -515,9 +515,14 @@ if ($_POST) { $savemsg = gettext("The m0n0wall configuration has been restored and upgraded to pfSense."); mark_subsystem_dirty("restore"); } - if(isset($config['captiveportal']['enable'])) { - /* for some reason ipfw doesn't init correctly except on bootup sequence */ - mark_subsystem_dirty("restore"); + if(is_array($config['captiveportal'])) { + foreach($config['captiveportal'] as $cp) { + if (isset($cp['enable'])) { + /* for some reason ipfw doesn't init correctly except on bootup sequence */ + mark_subsystem_dirty("restore"); + break; + } + } } setup_serial_port(); if(is_interface_mismatch() == true) { @@ -736,7 +741,7 @@ function backuparea_change(obj) { <p><strong><span class="red"><?=gettext("Note:"); ?></span></strong><br /><?=gettext("The firewall will reboot after restoring the configuration."); ?><br /></p> </td> </tr> - <?php if($config['installedpackages']['package'] != "") { ?> + <?php if (($config['installedpackages']['package'] != "") || (is_subsystem_dirty("packagelock"))) { ?> <tr> <td colspan="2" class="list" height="12"> </td> </tr> @@ -746,12 +751,16 @@ function backuparea_change(obj) { <tr> <td width="22%" valign="baseline" class="vncell"> </td> <td width="78%" class="vtable"> - <p><?=gettext("Click this button to reinstall all system packages. This may take a while."); ?> <br /><br /> - <input name="Submit" type="submit" class="formbtn" id="reinstallpackages" value="<?=gettext("Reinstall packages"); ?>"> - <br/> - <br/> - <p><?=gettext("Click this button to clear the package lock if a package fails to reinstall properly after an upgrade."); ?> <br /><br /> - <input name="Submit" type="submit" class="formbtn" id="clearpackagelock" value="<?=gettext("Clear Package Lock"); ?>"> + <?php if ($config['installedpackages']['package'] != "") { ?> + <p><?=gettext("Click this button to reinstall all system packages. This may take a while."); ?> <br /><br /> + <input name="Submit" type="submit" class="formbtn" id="reinstallpackages" value="<?=gettext("Reinstall packages"); ?>"> + <br/> + <br/> + <?php } ?> + <?php if (is_subsystem_dirty("packagelock")) { ?> + <p><?=gettext("Click this button to clear the package lock if a package fails to reinstall properly after an upgrade."); ?> <br /><br /> + <input name="Submit" type="submit" class="formbtn" id="clearpackagelock" value="<?=gettext("Clear Package Lock"); ?>"> + <?php } ?> </td> </tr> <?php } ?> diff --git a/usr/local/www/diag_confbak.php b/usr/local/www/diag_confbak.php index daa036f..08072fc 100755 --- a/usr/local/www/diag_confbak.php +++ b/usr/local/www/diag_confbak.php @@ -145,7 +145,7 @@ include("head.inc"); <tr> <td> <div id="mainarea"> - <form action="diag_confbak.php" method="GET"> + <form action="diag_confbak.php" method="get"> <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> <?php if (is_array($confvers)): ?> <tr> diff --git a/usr/local/www/diag_defaults.php b/usr/local/www/diag_defaults.php index 86ea6f9..d389e9d 100755 --- a/usr/local/www/diag_defaults.php +++ b/usr/local/www/diag_defaults.php @@ -44,15 +44,9 @@ require("guiconfig.inc"); -if ($_POST) { - if ($_POST['Submit'] != " No ") { - reset_factory_defaults(); - system_reboot(); - $rebootmsg = gettext("The system has been reset to factory defaults and is now rebooting. This may take a few minutes, depending on your hardware."); - } else { - header("Location: index.php"); - exit; - } +if ($_POST['Submit'] == " " . gettext("No") . " ") { + header("Location: index.php"); + exit; } $pgtitle = array(gettext("Diagnostics"),gettext("Factory defaults")); @@ -62,26 +56,33 @@ include("head.inc"); <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <?php include("fbegin.inc"); ?> -<?php if ($rebootmsg): echo print_info_box($rebootmsg); else: ?> -<form action="diag_defaults.php" method="post"> - <p><strong> <?=gettext("If you click") . " "" . gettext("Yes") . "", " . gettext("the firewall will:")?> - - <ul> - <li><?=gettext("Reset to factory defaults");?></li> - <li><?=gettext("LAN IP address will be reset to 192.168.1.1");?></li> - <li><?=gettext("System will be configured as a DHCP server on the default LAN interface");?></li> - <li><?=gettext("Reboot after changes are installed");?></li> - <li><?=gettext("WAN interface will be set to obtain an address automatically from a DHCP server");?></li> - <li><?=gettext("webConfigurator admin username will be reset to 'admin'");?></li> - <li><?=gettext("webConfigurator admin password will be reset to");?> '<?=$g['factory_shipped_password']?>'</li> - </ul> - <?=gettext("Are you sure you want to proceed?");?></strong></p> - <p> - <input name="Submit" type="submit" class="formbtn" value=" <?=gettext("Yes");?> "> - <input name="Submit" type="submit" class="formbtn" value=" <?=gettext("No");?> "> - </p> - </form> +<?php if ($_POST['Submit'] == " " . gettext("Yes") . " "): + print_info_box(gettext("The system has been reset to factory defaults and is now rebooting. This may take a few minutes, depending on your hardware.")); ?> +<pre> +<?php + reset_factory_defaults(); + system_reboot(); +?> +</pre> +<?php else: ?> +<form action="diag_defaults.php" method="post"> + <p><strong> <?=gettext("If you click") . " "" . gettext("Yes") . "", " . gettext("the firewall will:")?> + <ul> + <li><?=gettext("Reset to factory defaults");?></li> + <li><?=gettext("LAN IP address will be reset to 192.168.1.1");?></li> + <li><?=gettext("System will be configured as a DHCP server on the default LAN interface");?></li> + <li><?=gettext("Reboot after changes are installed");?></li> + <li><?=gettext("WAN interface will be set to obtain an address automatically from a DHCP server");?></li> + <li><?=gettext("webConfigurator admin username will be reset to 'admin'");?></li> + <li><?=gettext("webConfigurator admin password will be reset to");?> '<?=$g['factory_shipped_password']?>'</li> + </ul> + <?=gettext("Are you sure you want to proceed?");?></strong></p> + <p> + <input name="Submit" type="submit" class="formbtn" value=" <?=gettext("Yes");?> "> + <input name="Submit" type="submit" class="formbtn" value=" <?=gettext("No");?> "> + </p> +</form> <?php endif; ?> <?php include("fend.inc"); ?> </body> diff --git a/usr/local/www/diag_ipsec.php b/usr/local/www/diag_ipsec.php index 7e00e3c..68f7dc8 100644 --- a/usr/local/www/diag_ipsec.php +++ b/usr/local/www/diag_ipsec.php @@ -53,12 +53,14 @@ include("head.inc"); require("ipsec.inc"); if ($_GET['act'] == "connect") { - if (is_ipaddr($_GET['remoteid']) && is_ipaddr($_GET['source'])) { + if (is_ipaddrv4($_GET['remoteid']) && is_ipaddrv4($_GET['source'])) { exec("/sbin/ping -S " . escapeshellarg($_GET['source']) . " -c 1 " . escapeshellarg($_GET['remoteid'])); } + else if (is_ipaddrv6($_GET['remoteid']) && is_ipaddrv6($_GET['source'])) { + exec("/sbin/ping6 -S " . escapeshellarg($_GET['source']) . " -c 1 " . escapeshellarg($_GET['remoteid'])); + } } - if ($_GET['act'] == "disconnect") { if (!empty($_GET['user'])) { ipsec_disconnect_mobile($_GET['user']); @@ -150,28 +152,27 @@ $mobile = ipsec_dump_mobile(); $source = ""; $ip_interface = null; $ip_alias = null; - if ($ph2ent['localid']['type'] == 'lan') { - $source = get_interface_ip('lan'); - } else if ($ph2ent['localid']['type'] == 'network') { - $ip_interface = find_ip_interface($ph2ent['localid']['address'], $ph2ent['localid']['netbits']); - if (!$ip_interface) { - $ip_alias = find_virtual_ip_alias($ph2ent['localid']['address'], $ph2ent['localid']['netbits']); - } - } else { - $ip_interface = find_ip_interface($ph2ent['localid']['address']); - if (!$ip_interface) { - $ip_alias = find_virtual_ip_alias($ph2ent['localid']['address']); - } - } + $localinfo = ipsec_idinfo_to_cidr($ph2ent['localid'], false, $ph2ent['mode']); + list($localip, $localsub) = explode("/", $localinfo); + $ip_interface = find_ip_interface($localip, $localsub); + if (!$ip_interface) + $ip_alias = find_virtual_ip_alias($localip, $localsub); if ($ip_interface) { - $source = get_interface_ip($ip_interface); + if (is_ipaddrv6($localip)) + $source = get_interface_ipv6($ip_interface); + else + $source = get_interface_ip($ip_interface); } else if ($ip_alias) { $source = $ip_alias['subnet']; } + if (!empty($ph2ent['pinghost'])) + $remoteid = $ph2ent['pinghost']; + else + $remoteid = $ph2ent['remoteid']['address']; ?> <?php if (($ph2ent['remoteid']['type'] != "mobile") && ($icon != "pass") && ($source != "")): ?> <center> - <a href="diag_ipsec.php?act=connect&remoteid=<?php echo $ph2ent['remoteid']['address']; ?>&source=<?php echo $source; ?>"> + <a href="diag_ipsec.php?act=connect&remoteid=<?php echo $remoteid; ?>&source=<?php echo $source; ?>"> <img src ="/themes/<?php echo $g['theme']; ?>/images/icons/icon_service_start.gif" alt="Connect VPN" title="Connect VPN" border="0"> </a> </center> diff --git a/usr/local/www/diag_patterns.php b/usr/local/www/diag_patterns.php index d42ef1c..cf548a3 100755 --- a/usr/local/www/diag_patterns.php +++ b/usr/local/www/diag_patterns.php @@ -63,7 +63,7 @@ include("head.inc"); <?php include("fbegin.inc"); ?> <?php if ($ulmsg) echo "<p class=\"red\"><strong>" . $ulmsg . "</strong></p>\n"; ?> <div id="mainarea"> -<form action="diag_patterns.php" method="POST" enctype="multipart/form-data" name="frmPattern"> +<form action="diag_patterns.php" method="post" enctype="multipart/form-data" name="frmPattern"> <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td colspan="4" valign="top" class="listtopic"><?=gettext("Upload layer7 pattern file");?></td> diff --git a/usr/local/www/exec.php b/usr/local/www/exec.php index 4342c1d..eda1321 100755 --- a/usr/local/www/exec.php +++ b/usr/local/www/exec.php @@ -249,7 +249,7 @@ if (!isBlank($_POST['txtPHPCommand'])) { ?> <div id="niftyOutter"> -<form action="exec.php" method="POST" enctype="multipart/form-data" name="frmExecPlus" onSubmit="return frmExecPlus_onSubmit( this );"> +<form action="exec.php" method="post" enctype="multipart/form-data" name="frmExecPlus" onSubmit="return frmExecPlus_onSubmit( this );"> <table> <tr> <td colspan="2" valign="top" class="vnsepcell"><?=gettext("Execute Shell command"); ?></td> diff --git a/usr/local/www/fbegin.inc b/usr/local/www/fbegin.inc index 9a1b12a..1db4fea 100755 --- a/usr/local/www/fbegin.inc +++ b/usr/local/www/fbegin.inc @@ -1,11 +1,3 @@ - -<script src="/javascript/sorttable.js"></script> -<script src="/javascript/ticker.js"></script> -<style id="antiClickjack">body{display:none}</style> <script type="text/JavaScript"> -if (self === top) { var antiClickjack = document.getElementById("antiClickjack"); antiClickjack.parentNode.removeChild(antiClickjack); -} else { top.location = self.location; -} -</script> <?php /* pfSense_MODULE: header @@ -156,13 +148,13 @@ $services_menu[] = array(gettext("IGMP proxy"), "/services_igmpproxy.php"); $services_menu[] = array(gettext("Load Balancer"), "/load_balancer_pool.php"); $services_menu[] = array(gettext("NTP"), "/services_ntpd.php"); $services_menu[] = array(gettext("PPPoE Server"), "/vpn_pppoe.php"); -$services_menu[] = array(gettext("RIP"), "/pkg_edit.php?xml=routed.xml&id=0"); +$services_menu[] = array(gettext("RIP"), "/pkg_edit.php?xml=routed.xml&id=0"); $services_menu[] = array(gettext("SNMP"), "/services_snmp.php"); if(count($config['interfaces']) > 1) { /* no use for UPnP in single-interface deployments remove to reduce user confusion */ - $services_menu[] = array(gettext("UPnP & NAT-PMP"), "/pkg_edit.php?xml=miniupnpd.xml&id=0"); + $services_menu[] = array(gettext("UPnP & NAT-PMP"), "/pkg_edit.php?xml=miniupnpd.xml&id=0"); } $services_menu[] = array(gettext("Wake on LAN"), "/services_wol.php"); $services_menu = msort(array_merge($services_menu, return_ext_menu("Services")),0); @@ -264,12 +256,12 @@ if(! $g['disablehelpmenu']) { <div id="wrapper"> <div id="header"> - <div id="header-left"><a href="/index.php" id="status-link"><img src="/themes/<?= $g['theme']; ?>/images/transparent.gif" border="0"></a></div> + <div id="header-left"><a href="/index.php" id="status-link"><img src="/themes/<?= $g['theme']; ?>/images/transparent.gif" border="0" alt="transparent" /></a></div> <div id="header-right"> <div class="container"> <div class="left">webConfigurator</div> <div class="right" id="menu_messages"> -<? +<?php echo get_menu_messages(); ?> </div> @@ -307,7 +299,7 @@ if(! $g['disablehelpmenu']) { <li class="drop"> <div><?php echo gettext("Services"); ?></div> <ul class="subdrop"> - <? + <?php output_menu($services_menu); ?> </ul> @@ -331,7 +323,7 @@ if(! $g['disablehelpmenu']) { <li class="drop"> <div><?php echo gettext("Diagnostics"); ?></div> <ul id="diag" class="subdrop"> - <? + <?php output_menu($diagnostics_menu); ?> </ul> @@ -340,8 +332,8 @@ if(! $g['disablehelpmenu']) { <li class="lastdrop"> <div><?php echo gettext("Help"); ?></div> <ul id="help" class="subdrop"> - <? - output_menu($help_menu, "_new"); + <?php + output_menu($help_menu, "_blank"); ?> </ul> </li> @@ -365,16 +357,16 @@ echo "\t<script type=\"text/javascript\" src=\"javascript/domTT/fadomatic.js\">< $notices = get_notices(); if(!$notices) { $need_alert_display = true; - $display_text = print_notices($notices) . "<br>"; + $display_text = print_notices($notices) . "<br />"; } } if($need_alert_display == true) { echo "<div style=\"background-color:#000000\" id=\"roundalert\">"; - echo "<table>"; + echo "<table summary=\"round alert\">"; echo "<tr><td><font color=\"#ffffff\">"; - echo " <img align=\"middle\" src=\"/top_notification.gif\"> "; + echo " <img align=\"middle\" src=\"/top_notification.gif\" alt=\"notification\" /> "; echo $display_text; - echo "</td>"; + echo "</font></td>"; echo "</tr>"; echo "</table>"; echo "</div>"; @@ -417,7 +409,7 @@ echo get_shortcut_log_link($shortcut_section, true); ?> <?php if(! $g['disablehelpicon']): ?> -<a href="<?php echo $helpurl; ?>" title="<?php echo gettext("Help for items on this page"); ?>"><img style="vertical-align:middle" src="/themes/<?php echo $g['theme']; ?>/images/icons/icon_help.gif" border="0"></a> +<a href="<?php echo $helpurl; ?>" title="<?php echo gettext("Help for items on this page"); ?>"><img style="vertical-align:middle" src="/themes/<?php echo $g['theme']; ?>/images/icons/icon_help.gif" border="0" alt="help" /></a> <?php endif; ?> </span> </div> @@ -427,7 +419,7 @@ echo get_shortcut_log_link($shortcut_section, true); /* if upgrade in progress, alert user */ if(is_subsystem_dirty('packagelock')) { $pgtitle = array(gettext("System"),gettext("Package Manager")); - print_info_box(gettext("Packages are currently being reinstalled in the background.<p>Do not make changes in the GUI until this is complete.") . "<p><img src='/themes/{$g['theme']}/images/icons/icon_fw-update.gif'>"); + print_info_box(gettext("Packages are currently being reinstalled in the background.<p>Do not make changes in the GUI until this is complete.") . "<p><img src='/themes/{$g['theme']}/images/icons/icon_fw-update.gif' alt='firmware update' />"); } $pgtitle_output = true; ?> diff --git a/usr/local/www/fend.inc b/usr/local/www/fend.inc index dde5955..6ee1028 100755 --- a/usr/local/www/fend.inc +++ b/usr/local/www/fend.inc @@ -18,8 +18,10 @@ /* Disable form autocomplete on all but the login screen. */ if (basename($_SERVER["SCRIPT_FILENAME"] != "index.php") && !$allowautocomplete): ?> <script type="text/javascript"> +//<![CDATA[ (function ($) { $("input").attr("autocomplete","off"); })(jQuery); +//]]> </script> <?php endif; ?> diff --git a/usr/local/www/firewall_virtual_ip_edit.php b/usr/local/www/firewall_virtual_ip_edit.php index d208dd3..4e257ac 100755 --- a/usr/local/www/firewall_virtual_ip_edit.php +++ b/usr/local/www/firewall_virtual_ip_edit.php @@ -110,15 +110,17 @@ if ($_POST) { if ($_POST['subnet']) $_POST['subnet'] = trim($_POST['subnet']); - if (($_POST['subnet'] && !is_ipaddr($_POST['subnet']))) - $input_errors[] = gettext("A valid IP address must be specified."); + if ($_POST['subnet']) { + if (!is_ipaddr($_POST['subnet'])) + $input_errors[] = gettext("A valid IP address must be specified."); + else if (is_ipaddr_configured($_POST['subnet'], "vip_" . $id, true)) + $input_errors[] = gettext("This IPv4 address is being used by another interface or VIP."); + } $natiflist = get_configured_interface_with_descr(); foreach ($natiflist as $natif => $natdescr) { if ($_POST['interface'] == $natif && (empty($config['interfaces'][$natif]['ipaddr']) && empty($config['interfaces'][$natif]['ipaddrv6']))) $input_errors[] = gettext("The interface chosen for the VIP has no IPv4 or IPv6 address configured so it cannot be used as a parent for the VIP."); - if ($_POST['subnet'] == get_interface_ip($natif)) - $input_errors[] = sprintf(gettext("The %s IP address may not be used in a virtual entry."),$natdescr); } if(is_ipaddrv4($_POST['subnet'])) { @@ -129,16 +131,6 @@ if ($_POST) { if(($_POST['subnet_bits'] == "127" or $_POST['subnet_bits'] == "128") and $_POST['mode'] == "carp") $input_errors[] = gettext("The /127 and /128 subnet mask are invalid for CARP IPs."); } - /* check for overlaps with other virtual IP */ - foreach ($a_vip as $vipent) { - if (isset($id) && ($a_vip[$id]) && ($a_vip[$id] === $vipent)) - continue; - - if (isset($_POST['subnet']) && $_POST['subnet'] == $vipent['subnet']) { - $input_errors[] = gettext("There is already a virtual IP entry for the specified IP address."); - break; - } - } /* make sure new ip is within the subnet of a valid ip * on one of our interfaces (wan, lan optX) @@ -167,7 +159,7 @@ if ($_POST) { $parent_ip = get_interface_ipv6($_POST['interface']); $parent_sn = get_interface_subnetv6($_POST['interface']); $subnet = gen_subnetv6($parent_ip, $parent_sn); - if (!ip_in_subnet($_POST['subnet'], gen_subnetv6($parent_ip, $parent_sn) . "/" . $parent_sn) && !ip_in_interface_alias_subnet($_POST['interface'], $_POST['subnet'])) { + if (!ip_in_subnet($_POST['subnet'], "{$subnet}/{$parent_sn}") && !ip_in_interface_alias_subnet($_POST['interface'], $_POST['subnet'])) { $cannot_find = $_POST['subnet'] . "/" . $_POST['subnet_bits'] ; $input_errors[] = sprintf(gettext("Sorry, we could not locate an interface with a matching subnet for %s. Please add an IP alias in this subnet on this interface."),$cannot_find); } diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc index accb439..3de25f0 100755 --- a/usr/local/www/guiconfig.inc +++ b/usr/local/www/guiconfig.inc @@ -60,7 +60,7 @@ require_once("functions.inc"); /* Pull in all the gui related display classes) */ foreach (scandir("/usr/local/www/classes/") as $file) { - if (stristr($file, ".inc") !== false) { + if (substr($file, -4) == ".inc") { require_once("classes/{$file}"); } } @@ -248,12 +248,12 @@ function print_input_errors($input_errors) { global $g; print <<<EOF - <div id='inputerrorsdiv' name='inputerrorsdiv'> + <div id="inputerrorsdiv"> <p> - <table border="0" cellspacing="0" cellpadding="4" width="100%"> + <table border="0" cellspacing="0" cellpadding="4" width="100%" summary="input errors"> <tr> <td class="inputerrorsleft"> - <img src="/themes/{$g['theme']}/images/icons/icon_error.gif"> + <img src="/themes/{$g['theme']}/images/icons/icon_error.gif" alt="errors" /> </td> <td class="inputerrorsright"> <span class="errmsg"><p> @@ -266,13 +266,13 @@ EOF; print <<<EOF2 </ul> - </span> + </p></span> </td></tr> </table> </div> - </p> <br> + </p> <br /> EOF2; - + } function verify_gzip_file($fname) { @@ -296,42 +296,42 @@ function print_info_box_np($msg, $name="apply",$value="", $showapply=false) { $nifty_background = "#FFF"; if(stristr($msg, gettext("apply")) != false || stristr($msg, gettext("save")) != false || stristr($msg, gettext("create")) != false || $showapply) { - $savebutton = "<td class='infoboxsave'>"; - $savebutton .= "<input name=\"{$name}\" type=\"submit\" class=\"formbtn\" id=\"${name}\" value=\"{$value}\">"; + $savebutton = "<td class=\"infoboxsave\">"; + $savebutton .= "<input name=\"{$name}\" type=\"submit\" class=\"formbtn\" id=\"${name}\" value=\"{$value}\" />"; if($_POST['if']) - $savebutton .= "<input type='hidden' name='if' value='" . htmlspecialchars($_POST['if']) . "'>"; + $savebutton .= "<input type=\"hidden\" name=\"if\" value=\"" . htmlspecialchars($_POST['if']) . "\" />"; $savebutton.="</td>"; } $nifty_redbox = "#990000"; $nifty_blackbox = "#000000"; - + $themename = $g['theme']; - + if(file_exists("/usr/local/www/themes/{$themename}/tabcontrols.php")) { $toeval = file_get_contents("/usr/local/www/themes/{$themename}/tabcontrols.php"); eval($toeval); } - + if(file_exists("/usr/local/www/themes/{$themename}/infobox.php")) { $toeval = file_get_contents("/usr/local/www/themes/{$themename}/infobox.php"); eval($toeval); } - + if(!$savebutton) { - $savebutton = '<td class="infoboxsave"><input value="Close" type="button" onClick="jQuery(\'#redboxtable\').hide();"></td>'; + $savebutton = "<td class=\"infoboxsave\"><input value=\"Close\" type=\"button\" onclick=\"jQuery('#redboxtable').hide();\" /></td>"; } echo <<<EOFnp - <table class='infobox' id='redboxtable'> + <table class="infobox" id="redboxtable" summary="red box table"> <tr> <td> - <div class='infoboxnp' id='redbox'> - <table class='infoboxnptable2'> + <div class="infoboxnp" id="redbox"> + <table class="infoboxnptable2" summary="message"> <tr> - <td class='infoboxnptd'> - <img class='infoboxnpimg' src="/themes/{$g['theme']}/images/icons/icon_exclam.gif" > + <td class="infoboxnptd"> + <img class="infoboxnpimg" src="/themes/{$g['theme']}/images/icons/icon_exclam.gif" alt="exclamation" /> </td> - <td class='infoboxnptd2'> + <td class="infoboxnptd2"> <b>{$msg}</b> </td> {$savebutton} @@ -339,15 +339,17 @@ function print_info_box_np($msg, $name="apply",$value="", $showapply=false) { </table> </div> <div> - <p/> + <p> </p> </div> </td> </tr> </table> <script type="text/javascript"> + //<![CDATA[ NiftyCheck(); Rounded("div#redbox","all","{$nifty_background}","{$nifty_redbox}","smooth"); Rounded("td#blackbox","all","{$nifty_background}","{$nifty_blackbox}","smooth"); + //]]> </script> EOFnp; @@ -355,46 +357,46 @@ EOFnp; function print_info_box_np_undo($msg, $name="apply",$value="Apply changes", $undo) { global $g; - + if(stristr($msg, "apply") != false || stristr($msg, "save") != false || stristr($msg, "create") != false) { - $savebutton = "<td class='infoboxsave'><nobr>"; - $savebutton .= " <input type=\"button\" value=\"Undo\" onClick=\"document.location='{$undo}'\">"; - $savebutton .= " <input name=\"{$name}\" type=\"submit\" class=\"formbtn\" id=\"${name}\" value=\"{$value}\">"; - $savebutton.="</nobr></td>"; + $savebutton = "<td class=\"infoboxsave nowrap\">"; + $savebutton .= "<input type=\"button\" value=\"Undo\" onclick=\"document.location='{$undo}'\" />"; + $savebutton .= "<input name=\"{$name}\" type=\"submit\" class=\"formbtn\" id=\"${name}\" value=\"{$value}\" />"; + $savebutton .= "</td>"; if($_POST['if']) - $savebutton .= "<input type='hidden' name='if' value='" . htmlspecialchars($_POST['if']) . "'>"; + $savebutton .= "<input type=\"hidden\" name=\"if\" value=\"" . htmlspecialchars($_POST['if']) . "\" />"; } $nifty_redbox = "#990000"; $nifty_blackbox = "#000000"; - + $themename = $g['theme']; - + if(file_exists("/usr/local/www/themes/{$themename}/tabcontrols.php")) { $toeval = file_get_contents("/usr/local/www/themes/{$themename}/tabcontrols.php"); eval($toeval); } - + if(file_exists("/usr/local/www/themes/{$themename}/infobox.php")) { $toeval = file_get_contents("/usr/local/www/themes/{$themename}/infobox.php"); eval($toeval); } - - + + if(!$savebutton) { - $savebutton = '<td class="infoboxsave"><input value="Close" type="button" onClick="jQuery(\'#redboxtable\').hide();"></td>'; + $savebutton = "<td class=\"infoboxsave\"><input value=\"Close\" type=\"button\" onclick=\"jQuery('#redboxtable').hide();\" /></td>"; } echo <<<EOFnp - <table class='infobox' id='redboxtable'> + <table class="infobox" id="redboxtable" summary="red box table"> <tr> <td> - <div class='infoboxnp' id='redbox'> - <table class='infoboxnptable2'> + <div class="infoboxnp" id="redbox"> + <table class="infoboxnptable2" summary="message"> <tr> - <td class='infoboxnptd'> - <img class='infoboxnpimg' src="/themes/{$g['theme']}/images/icons/icon_exclam.gif" > + <td class="infoboxnptd"> + <img class="infoboxnpimg" src="/themes/{$g['theme']}/images/icons/icon_exclam.gif" alt="exclamation" /> </td> - <td class='infoboxnptd2'> + <td class="infoboxnptd2"> <b>{$msg}</b> </td> {$savebutton} @@ -403,15 +405,17 @@ function print_info_box_np_undo($msg, $name="apply",$value="Apply changes", $und </table> </div> <div> - <p/> + <p> </p> </div> </td> </tr> </table> <script type="text/javascript"> + //<![CDATA[ NiftyCheck(); Rounded("div#redbox","all","#FFF","{$nifty_redbox}","smooth"); Rounded("td#blackbox","all","#FFF","{$nifty_blackbox}","smooth"); + //]]> </script> EOFnp; @@ -430,7 +434,7 @@ function get_std_save_message($ok) { if(stristr($_SERVER['SCRIPT_FILENAME'], $fp)) $filter_related = true; if($filter_related) - $to_return .= "<br/>You can also <a href='status_filter_reload.php'>monitor</a> the filter reload progress."; + $to_return .= "<br/>You can also <a href=\"status_filter_reload.php\">monitor</a> the filter reload progress."; return $to_return; } @@ -586,7 +590,7 @@ function dump_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert $entry_text = ($logent[3] == $config['system']['hostname']) ? "" : $logent[3] . " "; $entry_text .= htmlspecialchars($logent[4] . " " . $logent[5]); } - echo "<td class=\"listlr\" nowrap>{$entry_date_time}</td>\n"; + echo "<td class=\"listlr nowrap\">{$entry_date_time}</td>\n"; echo "<td class=\"listr\">{$entry_text}</td>\n"; } else { @@ -719,7 +723,7 @@ function is_specialnet($net) { //function to create widget tabs when called function display_widget_tabs(& $tab_array) { - echo "<div id='tabs'>"; + echo "<div id=\"tabs\">"; $tabscounter = 0; foreach ($tab_array as $ta) { $dashpos = strpos($ta[2],'-'); @@ -734,21 +738,23 @@ function display_widget_tabs(& $tab_array) { $tabActive = "none"; $tabNonActive = "table-cell"; } - echo "<div id='{$ta[2]}-active' class='{$tabclass}-tabactive' style='display:{$tabActive}; background-color:#EEEEEE; color:black;'>"; - echo "<B> {$ta[0]}"; - echo " </B>"; + echo "<div id=\"{$ta[2]}-active\" class=\"{$tabclass}-tabactive\" style=\"display:{$tabActive}; background-color:#EEEEEE; color:black;\">"; + echo "<b> {$ta[0]}"; + echo " </b>"; echo "</div>"; - - echo "<div id='{$ta[2]}-deactive' class='{$tabclass}-tabdeactive' style='display:{$tabNonActive}; background-color:#777777; color:white; cursor: pointer;' onClick=\"return changeTabDIV('{$ta[2]}')\">"; - echo "<B> {$ta[0]}"; - echo " </B>"; + + echo "<div id=\"{$ta[2]}-deactive\" class=\"{$tabclass}-tabdeactive\" style=\"display:{$tabNonActive}; background-color:#777777; color:white; cursor: pointer;\" onclick=\"return changeTabDIV('{$ta[2]}')\">"; + echo "<b> {$ta[0]}"; + echo " </b>"; echo "</div>"; } - + echo "<script type=\"text/javascript\">"; + echo "\n//<![CDATA[\n"; echo "NiftyCheck();\n"; echo "Rounded(\"div.{$tabclass}-tabactive\",\"top\",\"#CCCCCC\",\"#EEEEEE\",\"smooth\");\n"; echo "Rounded(\"div.{$tabclass}-tabdeactive\",\"top\",\"#CCCCCC\",\"#777777\",\"smooth\");\n"; + echo "//]]>\n"; echo "</script>"; echo "</div>"; } @@ -851,7 +857,7 @@ function print_rfc2616_select($tag, $current){ echo "<select id=\"{$tag}\" name=\"{$tag}\">\n"; foreach($rfc2616 as $code => $message) { if ($code == $current) { - $sel = " selected"; + $sel = " selected=\"selected\""; } else { $sel = ""; } @@ -867,7 +873,7 @@ function echo_array($array,$return_me=false){ foreach($array as $name=>$value){ if(is_array($value)){ $return .= ""; - $return .= "['<b>$name</b>'] {<div style='margin-left:10px;'>\n"; + $return .= "['<b>$name</b>'] {<div style=\"margin-left:10px;\">\n"; $return .= echo_array($value,true); $return .= "</div>}"; $return .= "\n\n"; @@ -901,13 +907,13 @@ function display_top_tabs(& $tab_array, $no_drop_down = false) { global $tab_array_indent; global $tab_array_space; global $tab_array_char_limit; - + /* does the user have access to this tab? * master user has access to everything. * if the user does not have access, simply * unset the tab item. */ - + /* empty string code */ if ($tab_array_indent == '') { $tab_array_indent = 0; @@ -952,19 +958,21 @@ function display_top_tabs(& $tab_array, $no_drop_down = false) { // then show a select item dropdown menubox. if($tabcharcount > $tab_array_char_limit) { echo "Currently viewing: "; - echo "<select name='TabSelect' onchange='tabs_will_go(this)'>\n"; + echo "<select name=\"TabSelect\" onchange=\"tabs_will_go(this)\">\n"; foreach ($tab_array as $ta) { if($ta[1]=="true") - $selected = " SELECTED"; + $selected = " selected=\"selected\""; else $selected = ""; // Onclick in option will not work in some browser - // echo "<option onClick=\"document.location='{$ta[2]}';\"{$selected}>{$ta['0']}</option>\n"; + // echo "<option onclick=\"document.location='{$ta[2]}';\"{$selected}>{$ta['0']}</option>\n"; echo "<option value=\"{$ta[2]}\"{$selected}>{$ta['0']}</option>\n"; } - echo "</select>\n<p/>"; + echo "</select>\n<p> </p>"; echo "<script type=\"text/javascript\">"; - echo " function tabs_will_go(obj){ document.location = obj.value; }"; + echo "\n//<![CDATA[\n"; + echo " function tabs_will_go(obj){ document.location = obj.value; }\n"; + echo "//]]>\n"; echo "</script>"; } else { echo "<div class=\"newtabmenu\" style=\"margin:{$tab_array_space}px {$tab_array_indent}px; width:775px;\">\n"; @@ -1010,37 +1018,37 @@ function alias_info_popup($alias_id){ $close_title="title='".gettext('move mouse out this alias to hide')."'"; if (is_array($config['aliases']['alias'][$alias_id])){ $alias_name=$config['aliases']['alias'][$alias_id]; - $alias_objects_with_details = "<table width='100%' border='0' cellpadding='2' cellspacing='0'>"; + $alias_objects_with_details = "<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\" summary=\"alias info popup\">"; if ($alias_name['url']) { exec("/sbin/pfctl -t {$alias_name['name']} -T show | wc -l", $total_entries); $counter=preg_replace("/\D/","",$total_entries[0]); exec("/sbin/pfctl -t {$alias_name['name']} -T show | head -10002", $alias_addresses); - $alias_objects_with_details .= "<tr><td colspan='3' $close_title class='vncell'>{$alias_name['url']}</td></tr>"; + $alias_objects_with_details .= "<tr><td colspan=\"3\" $close_title class=\"vncell\">{$alias_name['url']}</td></tr>"; $x=0; foreach ($alias_addresses as $alias_ports_address ) { switch ($x) { case 0: $x++; - $alias_objects_with_details .= "<tr><td $close_title class='vncell' width='33%' style='background: #FFFFFF;color: #000000;'>{$alias_ports_address}</td>"; + $alias_objects_with_details .= "<tr><td $close_title class=\"vncell\" width=\"33%\" style=\"background: #FFFFFF;color: #000000;\">{$alias_ports_address}</td>"; break; case 1: $x++; - $alias_objects_with_details .= "<td $close_title class='vncell' width='33%' style='background: #FFFFFF;color: #000000;'>{$alias_ports_address}</td>"; + $alias_objects_with_details .= "<td $close_title class=\"vncell\" width=\"33%\" style=\"background: #FFFFFF;color: #000000;\">{$alias_ports_address}</td>"; break; default: $x=0; - $alias_objects_with_details .= "<td $close_title class='vncell' width='33%' style='background: #FFFFFF;color: #000000;'>{$alias_ports_address}</td><tr>"; + $alias_objects_with_details .= "<td $close_title class=\"vncell\" width=\"33%\" style=\"background: #FFFFFF;color: #000000;\">{$alias_ports_address}</td><tr>"; break; } } for ($y = $x; $y <= $x; $y++) { - $alias_objects_with_details .= "<td $close_title class='vncell' width='33%'> </td>"; + $alias_objects_with_details .= "<td $close_title class=\"vncell\" width=\"33%\"> </td>"; } if ($x > 0) { $alias_objects_with_details .= "</tr>"; } if ($counter > 10002) { - $alias_objects_with_details .= "<tr><td colspan='3'> listing only first 10k items</td><tr>"; + $alias_objects_with_details .= "<tr><td colspan=\"3\"> listing only first 10k items</td><tr>"; } } else{ @@ -1048,12 +1056,12 @@ function alias_info_popup($alias_id){ $alias_details = explode ("||", $alias_name['detail']); $counter = 0; foreach ($alias_addresses as $alias_ports_address) { - $alias_objects_with_details .= "<tr><td $close_title width='5%' class='vncell' style='background: #FFFFFF;color: #000000;'>{$alias_addresses[$counter]}</td>"; + $alias_objects_with_details .= "<tr><td $close_title width=\"5%\" class=\"vncell\" style=\"background: #FFFFFF;color: #000000;\">{$alias_addresses[$counter]}</td>"; $alias_detail_default = strpos ($alias_details[$counter],"Entry added"); if ($alias_details[$counter] != "" && $alias_detail_default === False) - $alias_objects_with_details .="<td $close_title width='95%' class='vncell' style='background: #FFFFFF;color: #000000;'>{$alias_details[$counter]}</td>"; + $alias_objects_with_details .="<td $close_title width=\"95%\" class=\"vncell\" style=\"background: #FFFFFF;color: #000000;\">{$alias_details[$counter]}</td>"; else - $alias_objects_with_details .="<td $close_title width='95%' class='vncell' style='background: #FFFFFF;color: #000000;'> </td>"; + $alias_objects_with_details .="<td $close_title width=\"95%\" class=\"vncell\" style=\"background: #FFFFFF;color: #000000;\"> </td>"; $alias_objects_with_details .= "</tr>"; $counter++; } @@ -1064,7 +1072,7 @@ function alias_info_popup($alias_id){ if ($strlength >= $maxlength) $alias_descr_substr = substr($alias_descr_substr, 0, $maxlength) . "..."; $item_text = ($counter > 1 ? "items" : "item"); - $alias_caption = "{$alias_descr_substr} - {$counter} {$item_text}<a href='/firewall_aliases_edit.php?id={$alias_id}' title='".gettext('edit this alias')."'> edit </a>"; + $alias_caption = "{$alias_descr_substr} - {$counter} {$item_text}<a href=\"/firewall_aliases_edit.php?id={$alias_id}\" title=\"".gettext('edit this alias')."\"> edit </a>"; $strlength = strlen ($alias_caption); print "<h1>{$alias_caption}</h1>" . $alias_objects_with_details; } @@ -1075,7 +1083,7 @@ function rule_popup($src,$srcport,$dst,$dstport){ if ($config['aliases']['alias'] <> "" and is_array($config['aliases']['alias'])) { $descriptions = array (); foreach ($config['aliases']['alias'] as $alias_id=>$alias_name){ - $loading_image="<a><img src=\'/themes/{$g['theme']}/images/misc/loader.gif\'> " .gettext("loading...")."</a>"; + $loading_image="<a><img src=\'/themes/{$g['theme']}/images/misc/loader.gif\' alt=\'loader\' /> " .gettext("loading...")."</a>"; switch ($alias_name['type']){ case "port": $width="250"; @@ -1087,7 +1095,7 @@ function rule_popup($src,$srcport,$dst,$dstport){ $width="350"; break; } - $span_begin = "<span style=\"cursor: help;\" onmouseover=\"var response_html=domTT_activate(this, event, 'id','ttalias_{$alias_id}','content','{$loading_image}', 'trail', true, 'delay', 300, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle','type','velcro','width',{$width});alias_popup('{$alias_id}','{$g["theme"]}','".gettext('loading...')."');\" onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\"><u>"; + $span_begin = "<span style=\"cursor: help;\" onmouseover=\"var response_html=domTT_activate(this, event, 'id','ttalias_{$alias_id}','content','{$loading_image}', 'trail', true, 'delay', 300, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle','type','velcro','width',{$width});alias_popup('{$alias_id}','{$g['theme']}','".gettext('loading...')."');\" onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\"><u>"; $span_end = "</u></span>"; if ($alias_name['name'] == $src) { $descriptions['src'] = $span_begin; diff --git a/usr/local/www/head.inc b/usr/local/www/head.inc index c8454a6..0bc1d00 100755 --- a/usr/local/www/head.inc +++ b/usr/local/www/head.inc @@ -9,37 +9,57 @@ $pagetitle = gentitle( $pgtitle ); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html> + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title><?php echo($config['system']['hostname'] . "." . $config['system']['domain'] . " - " . $pagetitle); ?></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="apple-touch-icon" href="/themes/<?php echo $g['theme']; ?>/apple-touch-icon.png"/> <?php if (file_exists("{$g['www_path']}/themes/{$g['theme']}/table.css")): - echo "<link rel=\"stylesheet\" href=\"/themes/{$g['theme']}/table.css\" />"; + echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"/themes/{$g['theme']}/table.css\" />"; else: - echo "<link rel=\"stylesheet\" href=\"/css/table.css\" media=\"all\" />"; + echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"/css/table.css\" media=\"all\" />"; endif; ?> - + <?php if (strpos($_SERVER["SCRIPT_FILENAME"], "wizard.php") !== false && file_exists("{$g['www_path']}/themes/{$g['theme']}/wizard.css")): ?> - <?php echo "<style type=\"text/css\" src=\"/themes/{$g['theme']}/wizard.css\"></style>"; ?> + <?php echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"/themes/{$g['theme']}/wizard.css\" />"; ?> <?php else: ?> - <link rel="stylesheet" href="/themes/<?php echo $g['theme']; ?>/all.css" media="all" /> + <link type="text/css" rel="stylesheet" href="/themes/<?php echo $g['theme']; ?>/all.css" media="all" /> <?php endif; ?> - <link rel="stylesheet" type="text/css" href="/niftycssCode.css"> - <link rel="stylesheet" type="text/css" href="/niftycssprintCode.css" media="print"> - <link rel="stylesheet" type="text/css" href="/themes/<?=$g['theme']?>/new_tab_menu.css" media="all"> + <link rel="stylesheet" type="text/css" href="/niftycssCode.css" /> + <link rel="stylesheet" type="text/css" href="/niftycssprintCode.css" media="print" /> + <link rel="stylesheet" type="text/css" href="/themes/<?=$g['theme']?>/new_tab_menu.css" media="all" /> <script type="text/javascript" src="/javascript/niftyjsCode.js"></script> <script type="text/javascript" src="/javascript/jquery.js"></script> <script type="text/javascript" src="/javascript/jquery/jquery-ui.custom.min.js"></script> <script type="text/javascript"> + //<![CDATA[ var theme = "<?php echo $g['theme']; ?>"; jQuery.noConflict(); + //]]> </script> + + <script type="text/javascript" src="/javascript/sorttable.js"></script> + <script type="text/javascript" src="/javascript/ticker.js"></script> + <style type="text/css" id="antiClickjack"> + /*<![CDATA[*/ + body{display:none} + /*]]>*/ + </style> + <script type="text/javascript"> + //<![CDATA[ + if (self === top) { + var antiClickjack = document.getElementById("antiClickjack"); antiClickjack.parentNode.removeChild(antiClickjack); + } else { + top.location = self.location; + } + //]]> + </script> + <?php echo "\t<script type=\"text/javascript\" src=\"/themes/{$g['theme']}/loader.js\"></script>\n"; ?> <?php if($_GET['enablefirebuglite']) { diff --git a/usr/local/www/headjs.php b/usr/local/www/headjs.php index 197d806..bfea6e9 100644 --- a/usr/local/www/headjs.php +++ b/usr/local/www/headjs.php @@ -63,7 +63,7 @@ function getHeadJS() { jQuery(\"#submit\").click(submit_form); jQuery('#submit').click(function() {return false;}); - var to_insert = \"<div style='visibility:hidden' id='loading' name='loading'><img src='{$loader_gif}' \/><\/div>\"; + var to_insert = \"<div style='visibility:hidden' id='loading' name='loading'><img src='{$loader_gif}' alt='loader' \/><\/div>\"; jQuery('#submit').before(to_insert); } } @@ -73,7 +73,7 @@ function getHeadJS() { //alert(Form.serialize($('iform'))); if(jQuery('#inputerrors')) - jQuery('#inputerrors').html('<center><b><i>Loading...</i></b></center>'); + jQuery('#inputerrors').html('<center><b><i>Loading...<\/i><\/b><\/center>'); /* dsh: Introduced because pkg_edit tries to set some hidden fields * if executing submit's onclick event. The click gets deleted @@ -134,10 +134,10 @@ function getHeadJS() { return; } - message_html = '<table height=\"32\" width=\"100%\"><tr><td>'; + message_html = '<table height=\"32\" width=\"100%\" summary=\"redbox\"><tr><td>'; message_html += '<div style=\"background-color:#990000\" id=\"redbox\">'; - message_html += '<table width=\"100%\"><tr><td width=\"8%\">'; - message_html += '<img style=\"vertical-align:center\" src=\"/themes/{$g['theme']}/images/icons/icon_exclam.gif\" width=\"28\" height=\"32\" \/>'; + message_html += '<table width=\"100%\" summary=\"message\"><tr><td width=\"8%\">'; + message_html += '<img style=\"vertical-align:center\" src=\"/themes/{$g['theme']}/images/icons/icon_exclam.gif\" width=\"28\" height=\"32\" alt=\"exclamation\" \/>'; message_html += '<\/td><td width=\"70%\"><font color=\"white\">'; message_html += '<b>' + message + '<\/b><\/font><\/td>'; diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index ee45bfb..fcd7b51 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -197,7 +197,7 @@ switch($wancfg['ipaddr']) { $pconfig['type'] = $wancfg['ipaddr']; break; default: - if(is_ipaddr($wancfg['ipaddr'])) { + if(is_ipaddrv4($wancfg['ipaddr'])) { $pconfig['type'] = "staticv4"; $pconfig['ipaddr'] = $wancfg['ipaddr']; $pconfig['subnet'] = $wancfg['subnet']; @@ -213,7 +213,7 @@ switch($wancfg['ipaddrv6']) { break; case "dhcp6": $pconfig['dhcp6-duid'] = $wancfg['dhcp6-duid']; - if($wancfg['dhcp6-ia-pd-len'] == "") + if(!isset($wancfg['dhcp6-ia-pd-len'])) $wancfg['dhcp6-ia-pd-len'] = "none"; $pconfig['dhcp6-ia-pd-len'] = $wancfg['dhcp6-ia-pd-len']; $pconfig['type6'] = "dhcp6"; @@ -240,7 +240,7 @@ switch($wancfg['ipaddrv6']) { $pconfig['gateway-6rd'] = $wancfg['gateway-6rd']; break; default: - if(is_ipaddr($wancfg['ipaddrv6'])) { + if(is_ipaddrv6($wancfg['ipaddrv6'])) { $pconfig['type6'] = "staticv6"; $pconfig['ipaddrv6'] = $wancfg['ipaddrv6']; $pconfig['subnetv6'] = $wancfg['subnetv6']; @@ -355,8 +355,11 @@ if ($_POST['apply']) { if (file_exists("{$g['tmp_path']}/.interfaces.apply")) { $toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.interfaces.apply")); foreach ($toapplylist as $ifapply => $ifcfgo) { - interface_bring_down($ifapply, false, $ifcfgo); - interface_configure($ifapply); + if (isset($config['interfaces'][$ifapply]['enable'])) { + interface_bring_down($ifapply, false, $ifcfgo); + interface_configure($ifapply, true); + } else + interface_bring_down($ifapply, true, $ifcfgo); } } /* restart snmp so that it binds to correct address */ @@ -541,15 +544,19 @@ if ($_POST['apply']) { /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */ $_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac'])); - if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) - $input_errors[] = gettext("A valid IPv4 address must be specified."); - if (($_POST['ipaddrv6'] && !is_ipaddr($_POST['ipaddrv6']))) + if ($_POST['ipaddr']) { + if (!is_ipaddrv4($_POST['ipaddr'])) + $input_errors[] = gettext("A valid IPv4 address must be specified."); + else if (is_ipaddr_configured($_POST['ipaddr'], $if, true, true)) + $input_errors[] = gettext("This IPv4 address is being used by another interface or VIP."); + } + if (($_POST['ipaddrv6'] && !is_ipaddrv6($_POST['ipaddrv6']))) $input_errors[] = gettext("A valid IPv6 address must be specified."); if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) $input_errors[] = gettext("A valid subnet bit count must be specified."); if (($_POST['subnetv6'] && !is_numeric($_POST['subnetv6']))) $input_errors[] = gettext("A valid subnet bit count must be specified."); - if (($_POST['alias-address'] && !is_ipaddr($_POST['alias-address']))) + if (($_POST['alias-address'] && !is_ipaddrv4($_POST['alias-address']))) $input_errors[] = gettext("A valid alias IP address must be specified."); if (($_POST['alias-subnet'] && !is_numeric($_POST['alias-subnet']))) $input_errors[] = gettext("A valid alias subnet bit count must be specified."); @@ -581,11 +588,11 @@ if ($_POST['apply']) { $input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59)."); if ($_POST['pppoe_resetdate'] <> "" && !is_numeric(str_replace("/", "", $_POST['pppoe_resetdate']))) $input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy)."); - if (($_POST['pptp_local'] && !is_ipaddr($_POST['pptp_local']))) + if (($_POST['pptp_local'] && !is_ipaddrv4($_POST['pptp_local']))) $input_errors[] = gettext("A valid PPTP local IP address must be specified."); if (($_POST['pptp_subnet'] && !is_numeric($_POST['pptp_subnet']))) $input_errors[] = gettext("A valid PPTP subnet bit count must be specified."); - if (($_POST['pptp_remote'] && !is_ipaddr($_POST['pptp_remote']) && !is_hostname($_POST['gateway'][$iface]))) + if (($_POST['pptp_remote'] && !is_ipaddrv4($_POST['pptp_remote']) && !is_hostname($_POST['gateway'][$iface]))) $input_errors[] = gettext("A valid PPTP remote IP address must be specified."); if (($_POST['pptp_idletimeout'] != "") && !is_numericint($_POST['pptp_idletimeout'])) $input_errors[] = gettext("The idle timeout value must be an integer."); @@ -1092,7 +1099,6 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), ?> -<script type="text/javascript" src="/javascript/jquery.ipv4v6ify.js"></script> <script type="text/javascript" src="/javascript/numericupdown/js/numericupdown.js"></script> <link href="/javascript/numericupdown/css/numericupdown.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="/javascript/datepicker/js/datepicker.js"></script> @@ -1547,9 +1553,9 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), <tr> <td width="22%" valign="top" class="vncellreq"><?=gettext("IPv6 address"); ?></td> <td width="78%" class="vtable"> - <input name="ipaddrv6" type="text" class="formfld unknown ipv4v6" id="ipaddrv6" size="28" value="<?=htmlspecialchars($pconfig['ipaddrv6']);?>"> + <input name="ipaddrv6" type="text" class="formfld unknown" id="ipaddrv6" size="28" value="<?=htmlspecialchars($pconfig['ipaddrv6']);?>"> / - <select name="subnetv6" class="formselect ipv4v6" id="subnetv6"> + <select name="subnetv6" class="formselect" id="subnetv6"> <?php for ($i = 128; $i > 0; $i--) { if($i <> 127) { @@ -2667,6 +2673,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), document.getElementById("cancel").style.display = ''; document.getElementById("gwsave").style.display = ''; document.getElementById("gwcancel").style.display = ''; + jQuery('#status').html(''); } function hide_add_gateway_v6() { document.getElementById("addgatewayv6").style.display = 'none'; @@ -2676,6 +2683,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), document.getElementById("cancel").style.display = ''; document.getElementById("gwsave").style.display = ''; document.getElementById("gwcancel").style.display = ''; + jQuery('#statusv6').html(''); } function hide_add_gatewaysave() { document.getElementById("addgateway").style.display = 'none'; @@ -2694,7 +2702,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), type: 'post', data: pars, error: report_failure, - complete: save_callback + success: save_callback }); } function hide_add_gatewaysave_v6() { @@ -2713,7 +2721,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), type: 'post', data: pars_v6, error: report_failure_v6, - complete: save_callback_v6 + success: save_callback_v6 }); } function addOption(selectbox,text,value) @@ -2755,7 +2763,6 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), if(response) { document.getElementById("addgateway").style.display = 'none'; hide_add_gateway(); - jQuery('#status').html(''); var gwtext = escape(name) + " - " + gatewayip; addOption(jQuery('#gateway'), gwtext, name); // Auto submit form? @@ -2775,7 +2782,6 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), if(response_v6) { document.getElementById("addgatewayv6").style.display = 'none'; hide_add_gateway_v6(); - jQuery('#statusv6').html(''); var gwtext_v6 = escape(name) + " - " + gatewayip; addOption_v6(jQuery('#gatewayv6'), gwtext_v6, name); // Auto submit form? diff --git a/usr/local/www/interfaces_lagg_edit.php b/usr/local/www/interfaces_lagg_edit.php index 3c6ee5a..4a5a601 100644 --- a/usr/local/www/interfaces_lagg_edit.php +++ b/usr/local/www/interfaces_lagg_edit.php @@ -91,7 +91,7 @@ if ($_POST) { if (is_array($_POST['members'])) { foreach ($_POST['members'] as $member) { - if (!does_interface_exist($_POST['members'])) + if (!does_interface_exist($member)) $input_errors[] = gettext("Interface supplied as member is invalid"); } } else if (!does_interface_exist($_POST['members'])) diff --git a/usr/local/www/pkg_edit.php b/usr/local/www/pkg_edit.php index fe1778d..3123a9a 100755 --- a/usr/local/www/pkg_edit.php +++ b/usr/local/www/pkg_edit.php @@ -106,11 +106,11 @@ if($pkg['custom_php_global_functions'] <> "") eval($pkg['custom_php_global_functions']); // grab the installedpackages->package_name section. -if(!is_array($config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'])) +if($config['installedpackages'] && !is_array($config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'])) $config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'] = array(); // If the first entry in the array is an empty <config/> tag, kill it. -if ((count($config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config']) > 0) +if ($config['installedpackages'] && (count($config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config']) > 0) && ($config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'][0] == "")) array_shift($config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config']); diff --git a/usr/local/www/services_captiveportal.php b/usr/local/www/services_captiveportal.php index 42362d8..8423d45 100755 --- a/usr/local/www/services_captiveportal.php +++ b/usr/local/www/services_captiveportal.php @@ -49,8 +49,8 @@ if (isset($_POST['zone'])) $cpzone = $_POST['zone']; if (empty($cpzone) || empty($config['captiveportal'][$cpzone])) { - header("Location: services_captiveportal_zones.php"); - exit; + header("Location: services_captiveportal_zones.php"); + exit; } if (!is_array($config['captiveportal'])) @@ -97,6 +97,7 @@ if ($a_cp[$cpzone]) { $pconfig['enable'] = isset($a_cp[$cpzone]['enable']); $pconfig['pms_enabled'] = $a_cp[$cpzone]['pms_enabled']; $pconfig['auth_method'] = $a_cp[$cpzone]['auth_method']; + $pconfig['localauth_priv'] = isset($a_cp[$cpzone]['localauth_priv']); $pconfig['radacct_enable'] = isset($a_cp[$cpzone]['radacct_enable']); $pconfig['radmac_enable'] = isset($a_cp[$cpzone]['radmac_enable']); $pconfig['radmac_secret'] = $a_cp[$cpzone]['radmac_secret']; @@ -112,7 +113,7 @@ if ($a_cp[$cpzone]) { $pconfig['bwdefaultup'] = $a_cp[$cpzone]['bwdefaultup']; $pconfig['nomacfilter'] = isset($a_cp[$cpzone]['nomacfilter']); $pconfig['noconcurrentlogins'] = isset($a_cp[$cpzone]['noconcurrentlogins']); - $pconfig['radius_protocol'] = $a_cp[$cpzone]['radius_protocol']; + $pconfig['radius_protocol'] = $a_cp[$cpzone]['radius_protocol']; $pconfig['redirurl'] = $a_cp[$cpzone]['redirurl']; $pconfig['radiusip'] = $a_cp[$cpzone]['radiusip']; $pconfig['radiusip2'] = $a_cp[$cpzone]['radiusip2']; @@ -133,6 +134,7 @@ if ($a_cp[$cpzone]) { $pconfig['passthrumacadd'] = isset($a_cp[$cpzone]['passthrumacadd']); $pconfig['passthrumacaddusername'] = isset($a_cp[$cpzone]['passthrumacaddusername']); $pconfig['radmac_format'] = $a_cp[$cpzone]['radmac_format']; + $pconfig['reverseacct'] = isset($a_cp[$cpzone]['reverseacct']); $pconfig['page'] = array(); if ($a_cp[$cpzone]['page']['htmltext']) $pconfig['page']['htmltext'] = $a_cp[$cpzone]['page']['htmltext']; @@ -169,7 +171,7 @@ if ($_POST) { } if ($_POST['httpslogin_enable']) { - if (!$_POST['certref']) { + if (!$_POST['certref']) { $input_errors[] = gettext("Certificate must be specified for HTTPS login."); } if (!$_POST['httpsname'] || !is_domain($_POST['httpsname'])) { @@ -250,6 +252,7 @@ if ($_POST) { else unset($newcp['pms_enabled']); $newcp['auth_method'] = $_POST['auth_method']; + $newcp['localauth_priv'] = isset($_POST['localauth_priv']); $newcp['radacct_enable'] = $_POST['radacct_enable'] ? true : false; $newcp['reauthenticate'] = $_POST['reauthenticate'] ? true : false; $newcp['radmac_enable'] = $_POST['radmac_enable'] ? true : false; @@ -268,7 +271,7 @@ if ($_POST) { $newcp['logoutwin_enable'] = $_POST['logoutwin_enable'] ? true : false; $newcp['nomacfilter'] = $_POST['nomacfilter'] ? true : false; $newcp['noconcurrentlogins'] = $_POST['noconcurrentlogins'] ? true : false; - $newcp['radius_protocol'] = $_POST['radius_protocol']; + $newcp['radius_protocol'] = $_POST['radius_protocol']; $newcp['redirurl'] = $_POST['redirurl']; if (isset($_POST['radiusip'])) $newcp['radiusip'] = $_POST['radiusip']; @@ -303,6 +306,7 @@ if ($_POST) { $newcp['passthrumacadd'] = $_POST['passthrumacadd'] ? true : false; $newcp['passthrumacaddusername'] = $_POST['passthrumacaddusername'] ? true : false; $newcp['radmac_format'] = $_POST['radmac_format'] ? $_POST['radmac_format'] : false; + $newcp['reverseacct'] = $_POST['reverseacct'] ? true : false; if (!is_array($newcp['page'])) $newcp['page'] = array(); @@ -319,7 +323,7 @@ if ($_POST) { captiveportal_configure_zone($newcp); filter_configure(); header("Location: services_captiveportal_zones.php"); - exit; + exit; } else { if (is_array($_POST['cinterface'])) $pconfig['cinterface'] = implode(",", $_POST['cinterface']); @@ -332,6 +336,7 @@ include("head.inc"); function enable_change(enable_change) { var endis, radius_endis; endis = !(document.iform.enable.checked || enable_change); + localauth_endis = !((!endis && document.iform.auth_method[1].checked) || enable_change); radius_endis = !((!endis && document.iform.auth_method[2].checked) || enable_change); https_endis = !((!endis && document.iform.httpslogin_enable.checked) || enable_change); @@ -345,6 +350,7 @@ function enable_change(enable_change) { document.iform.timeout.disabled = endis; document.iform.preauthurl.disabled = endis; document.iform.redirurl.disabled = endis; + document.iform.localauth_priv.disabled = localauth_endis; document.iform.radiusip.disabled = radius_endis; document.iform.radiusip2.disabled = radius_endis; document.iform.radiusip3.disabled = radius_endis; @@ -392,6 +398,7 @@ function enable_change(enable_change) { document.iform.reauthenticateacct[0].disabled = radacct_dis; document.iform.reauthenticateacct[1].disabled = radacct_dis; document.iform.reauthenticateacct[2].disabled = radacct_dis; + document.iform.reverseacct.disabled = (radius_endis || !document.iform.radacct_enable.checked) && !enable_change; } //--> </script> @@ -407,7 +414,7 @@ function enable_change(enable_change) { $tab_array[] = array(gettext("Captive portal(s)"), true, "services_captiveportal.php?zone={$cpzone}"); $tab_array[] = array(gettext("Pass-through MAC"), false, "services_captiveportal_mac.php?zone={$cpzone}"); $tab_array[] = array(gettext("Allowed IP addresses"), false, "services_captiveportal_ip.php?zone={$cpzone}"); - $tab_array[] = array(gettext("Allowed Hostnames"), false, "services_captiveportal_hostname.php?zone={$cpzone}"); + $tab_array[] = array(gettext("Allowed Hostnames"), false, "services_captiveportal_hostname.php?zone={$cpzone}"); $tab_array[] = array(gettext("Vouchers"), false, "services_captiveportal_vouchers.php?zone={$cpzone}"); $tab_array[] = array(gettext("File Manager"), false, "services_captiveportal_filemanager.php?zone={$cpzone}"); display_top_tabs($tab_array, true); @@ -425,7 +432,7 @@ function enable_change(enable_change) { <td width="22%" valign="top" class="vncellreq"><?=gettext("Interfaces"); ?></td> <td width="78%" class="vtable"> <select name="cinterface[]" multiple="true" size="<?php echo count($config['interfaces']); ?>" class="formselect" id="cinterface"> - <?php + <?php $interfaces = get_configured_interface_with_descr(); $cselected = explode(",", $pconfig['cinterface']); foreach ($interfaces as $iface => $ifacename): ?> @@ -494,7 +501,7 @@ function enable_change(enable_change) { <td valign="top" class="vncell"><?=gettext("Pre-authentication redirect URL"); ?> </td> <td class="vtable"> <input name="preauthurl" type="text" class="formfld url" id="preauthurl" size="60" value="<?=htmlspecialchars($pconfig['preauthurl']);?>"><br> - <?php printf(gettext("Use this field to set \$PORTAL_REDIRURL\$ variable which can be accessed using your custom captive portal index.php page or error pages."));?> + <?php printf(gettext("Use this field to set \$PORTAL_REDIRURL\$ variable which can be accessed using your custom captive portal index.php page or error pages."));?> </td> </tr> <tr> @@ -526,7 +533,7 @@ function enable_change(enable_change) { <td class="vtable"> <input name="passthrumacadd" type="checkbox" class="formfld" id="passthrumacadd" value="yes" <?php if ($pconfig['passthrumacadd']) echo "checked"; ?>> <strong><?=gettext("Enable Pass-through MAC automatic additions"); ?></strong><br> - <?=gettext("If this option is set, a MAC passthrough entry is automatically added after the user has successfully authenticated. Users of that MAC address will never have to authenticate again."); ?> + <?=gettext("If this option is set, a MAC passthrough entry is automatically added after the user has successfully authenticated. Users of that MAC address will never have to authenticate again."); ?> <?=gettext("To remove the passthrough MAC entry you either have to log in and remove it manually from the"); ?> <a href="services_captiveportal_mac.php"><?=gettext("Pass-through MAC tab"); ?></a> <?=gettext("or send a POST from another system to remove it."); ?> <?=gettext("If this is enabled, RADIUS MAC authentication cannot be used. Also, the logout window will not be shown."); ?> <br/><br/> @@ -568,19 +575,26 @@ function enable_change(enable_change) { <tr> <td colspan="2"><input name="auth_method" type="radio" id="auth_method" value="none" onClick="enable_change(false)" <?php if($pconfig['auth_method']!="local" && $pconfig['auth_method']!="radius") echo "checked"; ?>> <?=gettext("No Authentication"); ?></td> - </tr> + </tr> <tr> <td colspan="2"><input name="auth_method" type="radio" id="auth_method" value="local" onClick="enable_change(false)" <?php if($pconfig['auth_method']=="local") echo "checked"; ?>> <?=gettext("Local"); ?> <a href="system_usermanager.php"><?=gettext("User Manager"); ?></a> / <?=gettext("Vouchers"); ?></td> - </tr> + </tr> + </tr><tr> + <td> </td> + <td> </td> + </tr> <tr> + <td> </td> + <td><input name="localauth_priv" type="checkbox" id="localauth_priv" value="yes" onClick="enable_change(false)" <?php if($pconfig['localauth_priv']=="yes") echo "checked"; ?>> + <?=gettext("Allow only users/groups with 'Captive portal login' privilege set"); ?></td> + </tr><tr> <td colspan="2"><input name="auth_method" type="radio" id="auth_method" value="radius" onClick="enable_change(false)" <?php if($pconfig['auth_method']=="radius") echo "checked"; ?>> <?=gettext("RADIUS Authentication"); ?></td> - </tr><tr> + </tr><tr> <td> </td> <td> </td> - </tr> - <tr> + </tr> <td width="22%" valign="top" class="vncell"><?=gettext("Radius Protocol"); ?></td> <td width="78%" class="vtable"> <table cellpadding="0" cellspacing="0"> @@ -753,12 +767,12 @@ function enable_change(enable_change) { <td colspan="2" class="list" height="12"></td> </tr> <tr> - <td colspan="2" valign="top" class="optsect_t2"><?=gettext("RADIUS options"); ?></td> + <td colspan="2" valign="top" class="listtopic"><?=gettext("RADIUS options"); ?></td> </tr> <tr> <td class="vncell" valign="top"><?=gettext("RADIUS NAS IP attribute"); ?></td> - <td> + <td class="vtable"> <select name="radiussrcip_attribute" id="radiussrcip_attribute"> <?php $iflist = get_configured_interface_with_descr(); foreach ($iflist as $ifdesc => $ifdescr) { @@ -771,18 +785,18 @@ function enable_change(enable_change) { } } if (is_array($config['virtualip']['vip'])) { - foreach ($config['virtualip']['vip'] as $sn) { - if ($sn['mode'] == "proxyarp" && $sn['type'] == "network") { - $start = ip2long32(gen_subnet($sn['subnet'], $sn['subnet_bits'])); - $end = ip2long32(gen_subnet_max($sn['subnet'], $sn['subnet_bits'])); - $len = $end - $start; - - for ($i = 0; $i <= $len; $i++) { - $snip = long2ip32($start+$i); - echo "<option value='{$snip}' {$selected}>" . htmlspecialchars("{$sn['descr']} - {$snip}") . "></option>\n"; + foreach ($config['virtualip']['vip'] as $sn) { + if ($sn['mode'] == "proxyarp" && $sn['type'] == "network") { + $start = ip2long32(gen_subnet($sn['subnet'], $sn['subnet_bits'])); + $end = ip2long32(gen_subnet_max($sn['subnet'], $sn['subnet_bits'])); + $len = $end - $start; + + for ($i = 0; $i <= $len; $i++) { + $snip = long2ip32($start+$i); + echo "<option value='{$snip}' {$selected}>" . htmlspecialchars("{$sn['descr']} - {$snip}") . "></option>\n"; } } else - echo "<option value='{$sn['subnet']}' {$selected}>" . htmlspecialchars("{$sn['descr']} - {$sn['subnet']}") . "></option>\n"; + echo "<option value='{$sn['subnet']}' {$selected}>" . htmlspecialchars("{$sn['descr']} - {$sn['subnet']}") . "></option>\n"; } } ?> @@ -814,6 +828,12 @@ function enable_change(enable_change) { "the Called-Station-Id to the client's MAC address. Default behavior is Calling-Station-Id = client's MAC address and Called-Station-Id = %s's WAN IP address."), $g['product_name']);?></td> </tr> + + <tr> + <td class="vncell" valign="top"><?=gettext("Accounting Style"); ?></td> + <td class="vtable"><input name="reverseacct" type="checkbox" id="reverseacct" value="yes" <?php if ($pconfig['reverseacct']) echo "checked"; ?>><strong><?=gettext("Invert Acct-Input-Octets and Acct-Output-Octets"); ?></strong><br> + <?=gettext("When this is enabled, data counts for RADIUS accounting packets will be taken from the client perspective, not the NAS. Acct-Input-Octets will represent download, and Acct-Output-Octets will represent upload."); ?></td> + </tr> </table> </tr> <tr> diff --git a/usr/local/www/services_captiveportal_hostname.php b/usr/local/www/services_captiveportal_hostname.php index 7a7fb87..dbbb688 100755 --- a/usr/local/www/services_captiveportal_hostname.php +++ b/usr/local/www/services_captiveportal_hostname.php @@ -86,6 +86,7 @@ if ($_GET['act'] == "del" && !empty($cpzone)) { unset($a_allowedhostnames[$_GET['id']]); write_config(); + captiveportal_allowedhostname_configure(); header("Location: services_captiveportal_hostname.php?zone={$cpzone}"); exit; } diff --git a/usr/local/www/services_captiveportal_ip.php b/usr/local/www/services_captiveportal_ip.php index e0e39d8..410064d 100755 --- a/usr/local/www/services_captiveportal_ip.php +++ b/usr/local/www/services_captiveportal_ip.php @@ -67,15 +67,12 @@ if ($_GET['act'] == "del") { $ipent = $a_allowedips[$_GET['id']]; if (isset($config['captiveportal'][$cpzone]['enable'])) { - if (!empty($ipent['sn'])) { - $ipfw = pfSense_ipfw_getTablestats($cpzone, 3, $ipent['ip'], $ipent['sn']); - pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_DEL, 3, $ipent['ip'], $ipent['sn']); - pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_DEL, 4, $ipent['ip'], $ipent['sn']); - } else { - $ipfw = pfSense_ipfw_getTablestats($cpzone, 3, $ipent['ip']); - pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_DEL, 3, $ipent['ip']); - pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_DEL, 4, $ipent['ip']); - } + $mask = (!empty($ipent['sn'])) ? $ipent['sn'] : 32; + + $ipfw = pfSense_ipfw_getTablestats($cpzone, 3, $ipent['ip'], $mask); + pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_DEL, 3, $ipent['ip'], $mask); + pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_DEL, 4, $ipent['ip'], $mask); + if (is_array($ipfw)) { captiveportal_free_dn_ruleno($ipfw['dnpipe']); pfSense_pipe_action("pipe delete {$ipfw['dnpipe']}"); diff --git a/usr/local/www/services_captiveportal_ip_edit.php b/usr/local/www/services_captiveportal_ip_edit.php index 8c8c79e..57201e1 100755 --- a/usr/local/www/services_captiveportal_ip_edit.php +++ b/usr/local/www/services_captiveportal_ip_edit.php @@ -95,14 +95,17 @@ if ($_POST) { $pconfig = $_POST; /* input validation */ - $reqdfields = explode(" ", "ip"); - $reqdfieldsn = array(gettext("Allowed IP address")); + $reqdfields = explode(" ", "ip sn"); + $reqdfieldsn = array(gettext("Allowed IP address"), gettext("Subnet mask")); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); - if (($_POST['ip'] && !is_ipaddr($_POST['ip']))) + if ($_POST['ip'] && !is_ipaddr($_POST['ip'])) $input_errors[] = sprintf(gettext("A valid IP address must be specified. [%s]"), $_POST['ip']); + if ($_POST['sn'] && (!is_numeric($_POST['sn']) || ($_POST['sn'] < 1) || ($_POST['sn'] > 32))) + $input_errors[] = gettext("A valid subnet mask must be specified"); + if ($_POST['bw_up'] && !is_numeric($_POST['bw_up'])) $input_errors[] = gettext("Upload speed needs to be an integer"); @@ -128,16 +131,14 @@ if ($_POST) { $ip['bw_up'] = $_POST['bw_up']; if ($_POST['bw_down']) $ip['bw_down'] = $_POST['bw_down']; - $oldmask = ""; if (isset($id) && $a_allowedips[$id]) { $oldip = $a_allowedips[$id]['ip']; if (!empty($a_allowedips[$id]['sn'])) - $oldmask .= "/{$a_allowedips[$id]['sn']}"; + $oldmask = $a_allowedips[$id]['sn']; + else + $oldmask = 32; $a_allowedips[$id] = $ip; } else { - $oldip = $ip['ip']; - if (!empty($ip['sn'])) - $oldmask .= "/{$ip['sn']}"; $a_allowedips[] = $ip; } allowedips_sort(); @@ -145,20 +146,20 @@ if ($_POST) { write_config(); if (isset($a_cp[$cpzone]['enable']) && is_module_loaded("ipfw.ko")) { - if (is_ipaddr($oldip)) { - if (!empty($oldmask)) - $ipfw = pfSense_ipfw_getTablestats($cpzone, 3, $oldip, $oldmask); - else - $ipfw = pfSense_ipfw_getTablestats($cpzone, 3, $oldip); + $rules = ""; + if (isset($oldip) && isset($oldmask)) { + $ipfw = pfSense_ipfw_getTablestats($cpzone, 3, $oldip, $oldmask); + $rules .= "table 3 delete {$oldip}/{$oldmask}\n"; + $rules .= "table 4 delete {$oldip}/{$oldmask}\n"; + if (is_array($ipfw)) { + $rules .= "pipe delete {$ipfw['dnpipe']}\n"; + $rules .= "pipe delete " . ($ipfw['dnpipe']+1 . "\n"); + } } - $rules = "table 3 delete {$oldip}\n"; - $rules .= "table 4 delete {$oldip}\n"; + $rules .= captiveportal_allowedip_configure_entry($ip); if (is_array($ipfw)) { captiveportal_free_dn_ruleno($ipfw['dnpipe']); - $rules .= "pipe delete {$ipfw['dnpipe']}\n"; - $rules .= "pipe delete " . ($ipfw['dnpipe']+1 . "\n"); } - $rules .= captiveportal_allowedip_configure_entry($ip); $uniqid = uniqid("{$cpzone}_allowed"); @file_put_contents("{$g['tmp_path']}/{$uniqid}_tmp", $rules); mwexec("/sbin/ipfw -x {$cpzone} -q {$g['tmp_path']}/{$uniqid}_tmp"); diff --git a/usr/local/www/services_captiveportal_vouchers.php b/usr/local/www/services_captiveportal_vouchers.php index d6919f6..c2f154f 100644 --- a/usr/local/www/services_captiveportal_vouchers.php +++ b/usr/local/www/services_captiveportal_vouchers.php @@ -36,15 +36,6 @@ ##|*MATCH=services_captiveportal_vouchers.php* ##|-PRIV -$cpzone = $_GET['zone']; -if (isset($_POST['zone'])) - $cpzone = $_POST['zone']; - -if (empty($cpzone) || empty($config['captiveportal'][$cpzone])) { - header("Location: services_captiveportal_zones.php"); - exit; -} - if ($_POST['postafterlogin']) $nocsrf= true; @@ -55,6 +46,15 @@ require("shaper.inc"); require("captiveportal.inc"); require_once("voucher.inc"); +$cpzone = $_GET['zone']; +if (isset($_POST['zone'])) + $cpzone = $_POST['zone']; + +if (empty($cpzone)) { + header("Location: services_captiveportal_zones.php"); + exit; +} + if($_REQUEST['generatekey']) { exec("/usr/local/bin/openssl genrsa 64 > /tmp/key64.private"); exec("/usr/local/bin/openssl rsa -pubout < /tmp/key64.private > /tmp/key64.public"); diff --git a/usr/local/www/services_captiveportal_zones_edit.php b/usr/local/www/services_captiveportal_zones_edit.php index c3356e3..1e8b861 100644 --- a/usr/local/www/services_captiveportal_zones_edit.php +++ b/usr/local/www/services_captiveportal_zones_edit.php @@ -1,19 +1,19 @@ -<?php +<?php /* services_captiveportal_mac_edit.php Copyright (C) 2011 Ermal Luci 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 @@ -46,7 +46,7 @@ $pgtitle = array(gettext("Services"),gettext("Captive portal"),gettext("Edit Zon $shortcut_section = "captiveportal"; if (!is_array($config['captiveportal'])) - $config['captiveportal'] = array(); + $config['captiveportal'] = array(); $a_cp =& $config['captiveportal']; if ($_POST) { @@ -57,18 +57,18 @@ if ($_POST) { /* input validation */ $reqdfields = explode(" ", "zone"); $reqdfieldsn = array(gettext("Zone name")); - + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); if (preg_match('/[^A-Za-z0-9_]/', $_POST['zone'])) { $input_errors[] = gettext("The zone name can only contain letters, digits, and underscores (_)."); } - + foreach ($a_cp as $cpkey => $cpent) { - if ($cpent['zone'] == $_POST['zone']){ + if ($cpent['zone'] == $_POST['zone']) { $input_errors[] = sprintf("[%s] %s.", $_POST['zone'], gettext("already exists")); break; - } + } } if (!$input_errors) { @@ -76,6 +76,7 @@ if ($_POST) { $a_cp[$cpzone] = array(); $a_cp[$cpzone]['zone'] = str_replace(" ", "", $_POST['zone']); $a_cp[$cpzone]['descr'] = $_POST['descr']; + $a_cp[$cpzone]['localauth_priv'] = true; write_config(); header("Location: services_captiveportal.php?zone={$cpzone}"); @@ -87,33 +88,35 @@ include("head.inc"); <?php include("fbegin.inc"); ?> <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <?php if ($input_errors) print_input_errors($input_errors); ?> - <form action="services_captiveportal_zones_edit.php" method="post" name="iform" id="iform"> - <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td colspan="2" valign="top" class="listtopic"><?=gettext("Edit Captiveportal Zones");?></td> - </tr> - <tr> - <td width="22%" valign="top" class="vncellreq"><?=gettext("Zone name"); ?></td> - <td width="78%" class="vtable"> - <input name="zone" type="text" class="formfld unknown" id="zone" size="64"> - <br> - <span class="vexpl"><?=gettext("Zone name. Can only contain letters, digits, and underscores (_)."); ?></span></td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td> - <td width="78%" class="vtable"> - <input name="descr" type="text" class="formfld unknown" id="descr" size="40" > - <br> <span class="vexpl"><?=gettext("You may enter a description here " . - "for your reference (not parsed)"); ?>.</span></td> - </tr> - <tr> - <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Continue"); ?>"> - </td> - </tr> - </table> -</form> + <form action="services_captiveportal_zones_edit.php" method="post" name="iform" id="iform"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td colspan="2" valign="top" class="listtopic"><?=gettext("Edit Captiveportal Zones");?></td> + </tr> + <tr> + <td width="22%" valign="top" class="vncellreq"><?=gettext("Zone name"); ?></td> + <td width="78%" class="vtable"> + <input name="zone" type="text" class="formfld unknown" id="zone" size="64"> + <br> + <span class="vexpl"><?=gettext("Zone name. Can only contain letters, digits, and underscores (_)."); ?></span> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td> + <td width="78%" class="vtable"> + <input name="descr" type="text" class="formfld unknown" id="descr" size="40" > + <br> + <span class="vexpl"><?=gettext("You may enter a description here for your reference (not parsed)"); ?>.</span> + </td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Continue"); ?>"> + </td> + </tr> + </table> + </form> <?php include("fend.inc"); ?> </body> </html> diff --git a/usr/local/www/services_dhcp.php b/usr/local/www/services_dhcp.php index 37e25be..fa174f4 100755 --- a/usr/local/www/services_dhcp.php +++ b/usr/local/www/services_dhcp.php @@ -128,6 +128,7 @@ $act = $_GET['act']; if (!empty($_POST['act'])) $act = $_POST['act']; +$a_pools = array(); if (is_array($config['dhcpd'][$if])){ $pool = $_GET['pool']; @@ -1142,6 +1143,10 @@ include("head.inc"); <?php if (!is_numeric($pool) && !($act == "newpool")): ?> <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> + <td colspan="5" valign="top" class="listtopic"><?=gettext("DHCP Static Mappings for this interface.");?></td> + <td> </td> + </tr> + <tr> <td width="7%" class="listhdrr"><?=gettext("Static ARP");?></td> <td width="18%" class="listhdrr"><?=gettext("MAC address");?></td> <td width="15%" class="listhdrr"><?=gettext("IP address");?></td> diff --git a/usr/local/www/services_dhcpv6.php b/usr/local/www/services_dhcpv6.php index 0465edf..6854bae 100644 --- a/usr/local/www/services_dhcpv6.php +++ b/usr/local/www/services_dhcpv6.php @@ -598,7 +598,7 @@ display_top_tabs($tab_array); <td width="78%" class="vtable"> <input name="prefixrange_from" type="text" class="formfld unknown" id="prefixrange_from" size="28" value="<?=htmlspecialchars($pconfig['prefixrange_from']);?>"> <?=gettext("to"); ?> <input name="prefixrange_to" type="text" class="formfld unknown" id="prefixrange_to" size="28" value="<?=htmlspecialchars($pconfig['prefixrange_to']);?>"> - <?=gettext("prefix delegation size"); ?> <select name="prefixrange_length" class="formselect" id="prefixrange_length"> + <br/><?=gettext("Prefix Delegation Size"); ?>: <select name="prefixrange_length" class="formselect" id="prefixrange_length"> <option value="48" <?php if($pconfig['prefixrange_length'] == 48) echo "selected"; ?>>48</option> <option value="52" <?php if($pconfig['prefixrange_length'] == 52) echo "selected"; ?>>52</option> <option value="56" <?php if($pconfig['prefixrange_length'] == 56) echo "selected"; ?>>56</option> @@ -843,6 +843,10 @@ display_top_tabs($tab_array); </table> <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> + <td colspan="4" valign="top" class="listtopic"><?=gettext("DHCPv6 Static Mappings for this interface.");?></td> + <td> </td> + </tr> + <tr> <td width="25%" class="listhdrr"><?=gettext("DUID");?></td> <td width="15%" class="listhdrr"><?=gettext("IPv6 address");?></td> <td width="20%" class="listhdrr"><?=gettext("Hostname");?></td> diff --git a/usr/local/www/services_dnsmasq.php b/usr/local/www/services_dnsmasq.php index 8315b93..2313588 100755 --- a/usr/local/www/services_dnsmasq.php +++ b/usr/local/www/services_dnsmasq.php @@ -48,6 +48,8 @@ $pconfig['enable'] = isset($config['dnsmasq']['enable']); $pconfig['regdhcp'] = isset($config['dnsmasq']['regdhcp']); $pconfig['regdhcpstatic'] = isset($config['dnsmasq']['regdhcpstatic']); $pconfig['dhcpfirst'] = isset($config['dnsmasq']['dhcpfirst']); +$pconfig['strict_order'] = isset($config['dnsmasq']['strict_order']); +$pconfig['domain_needed'] = isset($config['dnsmasq']['domain_needed']); $pconfig['custom_options'] = $config['dnsmasq']['custom_options']; if (!is_array($config['dnsmasq']['hosts'])) @@ -69,6 +71,8 @@ if ($_POST) { $config['dnsmasq']['regdhcp'] = ($_POST['regdhcp']) ? true : false; $config['dnsmasq']['regdhcpstatic'] = ($_POST['regdhcpstatic']) ? true : false; $config['dnsmasq']['dhcpfirst'] = ($_POST['dhcpfirst']) ? true : false; + $config['dnsmasq']['strict_order'] = ($_POST['strict_order']) ? true : false; + $config['dnsmasq']['domain_needed'] = ($_POST['domain_needed']) ? true : false; $config['dnsmasq']['custom_options'] = str_replace("\r\n", "\n", $_POST['custom_options']); if ($config['dnsmasq']['custom_options']) { @@ -192,6 +196,27 @@ function show_advanced_dns() { </td> </tr> <tr> + <td rowspan="2" width="22%" valign="top" class="vncellreq"><?=gettext("DNS Query Forwarding");?></td> + <td width="78%" class="vtable"><p> + <input name="strict_order" type="checkbox" id="strict_order" value="yes" <?php if ($pconfig['strict_order'] == "yes") echo "checked";?>> + <strong><?=gettext("Query DNS servers sequentially");?><br> + </strong><?php printf(gettext("If this option is set, %s DNS Forwarder (dnsmasq) will ". + "query the DNS servers sequentially in the order specified (<i>System - General Setup - DNS Servers</i>), ". + "rather than all at once in parallel. ". + ""), $g['product_name']); ?></p> + </td> + </tr> + <tr> + <td width="78%" class="vtable"><p> + <input name="domain_needed" type="checkbox" id="domain_needed" value="yes" <?php if ($pconfig['domain_needed'] == "yes") echo "checked";?>> + <strong><?=gettext("Require domain");?><br> + </strong><?php printf(gettext("If this option is set, %s DNS Forwarder (dnsmasq) will ". + "not forward A or AAAA queries for plain names, without dots or domain parts, to upstream name servers. ". + "If the name is not known from /etc/hosts or DHCP then a \"not found\" answer is returned. ". + ""), $g['product_name']); ?></p> + </td> + </tr> + <tr> <td width="22%" valign="top" class="vncellreq"><?=gettext("Advanced");?></td> <td width="78%" class="vtable"><p> <div id="showadvbox" <?php if ($pconfig['custom_options']) echo "style='display:none'"; ?>> diff --git a/usr/local/www/services_dyndns.php b/usr/local/www/services_dyndns.php index b4fdc32..4b88178 100755 --- a/usr/local/www/services_dyndns.php +++ b/usr/local/www/services_dyndns.php @@ -45,21 +45,21 @@ if (!is_array($config['dyndnses']['dyndns'])) $a_dyndns = &$config['dyndnses']['dyndns']; if ($_GET['act'] == "del") { - unset($a_dyndns[$_GET['id']]); + unset($a_dyndns[$_GET['id']]); - for($i = 0; $i < count($a_dyndns); $i++) { - $a_dyndns[$i]['id'] = $i; - } + for($i = 0; $i < count($a_dyndns); $i++) { + $a_dyndns[$i]['id'] = $i; + } - //FIXME: Instead of rechecking all interfaces and removing the cache files, gracefully move all cache files to the appropriate ID number. - mwexec("/bin/rm {$g['conf_path']}/dyndns_*.cache"); + //FIXME: Instead of rechecking all interfaces and removing the cache files, gracefully move all cache files to the appropriate ID number. + mwexec("/bin/rm {$g['conf_path']}/dyndns_*.cache"); - write_config(); + write_config(); - services_dyndns_configure(); + services_dyndns_configure(); - header("Location: services_dyndns.php"); - exit; + header("Location: services_dyndns.php"); + exit; } function dyndnsCheckIP($int) { @@ -92,33 +92,38 @@ include("head.inc"); <form action="services_dyndns.php" method="post" name="iform" id="iform"> <?php if ($input_errors) print_input_errors($input_errors); ?> <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr><td> + <tr> + <td> <?php $tab_array = array(); $tab_array[] = array(gettext("DynDns"), true, "services_dyndns.php"); $tab_array[] = array(gettext("RFC 2136"), false, "services_rfc2136.php"); display_top_tabs($tab_array); ?> - </td></tr> + </td> + </tr> <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> + <td> + <div id="mainarea"> + <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> <td width="5%" class="listhdrr"><?=gettext("Interface");?></td> <td width="15%" class="listhdrr"><?=gettext("Service");?></td> - <td width="20%" class="listhdrr"><?=gettext("Hostname");?></td> - <td width="20%" class="listhdrr"><?=gettext("Cached IP");?></td> - <td width="50%" class="listhdr"><?=gettext("Description");?></td> - <td width="10%" class="list"></td> + <td width="20%" class="listhdrr"><?=gettext("Hostname");?></td> + <td width="20%" class="listhdrr"><?=gettext("Cached IP");?></td> + <td width="50%" class="listhdr"><?=gettext("Description");?></td> + <td width="10%" class="list"></td> </tr> - <?php $i = 0; foreach ($a_dyndns as $dyndns): ?> - <tr ondblclick="document.location='services_dyndns_edit.php?id=<?=$i;?>'"> + <?php $i = 0; foreach ($a_dyndns as $dyndns): ?> + <tr ondblclick="document.location='services_dyndns_edit.php?id=<?=$i;?>'"> <td class="listlr"> - <?php $iflist = get_configured_interface_with_descr(); - foreach ($iflist as $if => $ifdesc) { + <?php $iflist = get_configured_interface_with_descr(); + foreach ($iflist as $if => $ifdesc) { if ($dyndns['interface'] == $if) { - echo "{$ifdesc}"; + if (!isset($dyndns['enable'])) + echo "<span class=\"gray\">{$ifdesc}</span>"; + else + echo "{$ifdesc}"; $iface = $if; break; } @@ -126,69 +131,87 @@ include("head.inc"); $groupslist = return_gateway_groups_array(); foreach ($groupslist as $if => $group) { if ($dyndns['interface'] == $if) { - echo "{$if}"; + if (!isset($dyndns['enable'])) + echo "<span class=\"gray\">{$if}</span>"; + else + echo "{$if}"; $iface = $if; break; } } - ?> + ?> </td> - <td class="listr"> - <?php - $types = explode(",", "DNS-O-Matic, DynDNS (dynamic),DynDNS (static),DynDNS (custom),DHS,DyNS,easyDNS,No-IP,ODS.org,ZoneEdit,Loopia,freeDNS, DNSexit, OpenDNS, Namecheap, HE.net, HE.net Tunnelbroker, SelfHost, Route 53, Custom"); - $vals = explode(" ", "dnsomatic dyndns dyndns-static dyndns-custom dhs dyns easydns noip ods zoneedit loopia freedns dnsexit opendns namecheap he-net he-net-tunnelbroker selfhost route53 custom"); - $j = 0; for ($j = 0; $j < count($vals); $j++) - if ($vals[$j] == $dyndns['type']) { - echo htmlspecialchars($types[$j]); - break; - } - ?> - </td> - <td class="listr"> - <?=htmlspecialchars($dyndns['host']);?> - </td> - <td class="listr"> - <?php - $filename = "{$g['conf_path']}/dyndns_{$iface}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}.cache"; - $ipaddr = dyndnsCheckIP($iface); - if(file_exists($filename)) { - $cached_ip_s = explode(":", file_get_contents($filename)); - $cached_ip = $cached_ip_s[0]; - if($ipaddr <> $cached_ip) - echo "<font color='red'>"; - else - echo "<font color='green'>"; - echo htmlspecialchars($cached_ip); - echo "</font>"; - } else { - echo "N/A"; + <td class="listr"> + <?php + $types = explode(",", "DNS-O-Matic, DynDNS (dynamic),DynDNS (static),DynDNS (custom),DHS,DyNS,easyDNS,No-IP,ODS.org,ZoneEdit,Loopia,freeDNS, DNSexit, OpenDNS, Namecheap, HE.net, HE.net Tunnelbroker, SelfHost, Route 53, Custom"); + $vals = explode(" ", "dnsomatic dyndns dyndns-static dyndns-custom dhs dyns easydns noip ods zoneedit loopia freedns dnsexit opendns namecheap he-net he-net-tunnelbroker selfhost route53 custom"); + for ($j = 0; $j < count($vals); $j++) + if ($vals[$j] == $dyndns['type']) { + if (!isset($dyndns['enable'])) + echo "<span class=\"gray\">".htmlspecialchars($types[$j])."</span>"; + else + echo htmlspecialchars($types[$j]); + break; } - ?> + ?> + </td> + <td class="listr"> + <?php + if (!isset($dyndns['enable'])) + echo "<span class=\"gray\">".htmlspecialchars($dyndns['host'])."</span>"; + else + echo htmlspecialchars($dyndns['host']); + ?> + </td> + <td class="listr"> + <?php + $filename = "{$g['conf_path']}/dyndns_{$iface}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}.cache"; + $ipaddr = dyndnsCheckIP($iface); + if (file_exists($filename)) { + $cached_ip_s = explode(":", file_get_contents($filename)); + $cached_ip = $cached_ip_s[0]; + if ($ipaddr <> $cached_ip) + echo "<font color='red'>"; + else + echo "<font color='green'>"; + echo htmlspecialchars($cached_ip); + echo "</font>"; + } else { + echo "N/A"; + } + ?> </td> - <td class="listbg"> - <?=htmlspecialchars($dyndns['descr']);?> - </td> - <td valign="middle" nowrap class="list"> <a href="services_dyndns_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a> - <a href="services_dyndns.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this entry?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> - </tr> - <?php $i++; endforeach; ?> - <tr> - <td class="list" colspan="5"></td> - <td class="list"> <a href="services_dyndns_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - <tr> - <td colspan="3" class="list"><p class="vexpl"><span class="red"><strong> - <?=gettext("Note:");?><br> - </strong></span> - <?=gettext("IP addresses appearing in green are up to date with Dynamic DNS provider.");?><br> - <?=gettext("You can force an update for an IP address on the edit page for that service.");?> - </td> - <td class="list"> </td> - </tr> - </table> - </div> + <td class="listbg"> + <?php + if (!isset($dyndns['enable'])) + echo "<span class=\"gray\">".htmlspecialchars($dyndns['descr'])."</span>"; + else + echo htmlspecialchars($dyndns['descr']); + ?> + </td> + <td valign="middle" nowrap class="list"> + <a href="services_dyndns_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a> + <a href="services_dyndns.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this entry?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a> + </td> + </tr> + <?php $i++; endforeach; ?> + <tr> + <td class="list" colspan="5"></td> + <td class="list"> <a href="services_dyndns_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> + </tr> + <tr> + <td colspan="3" class="list"><p class="vexpl"><span class="red"><strong> + <?=gettext("Note:");?><br> + </strong></span> + <?=gettext("IP addresses appearing in green are up to date with Dynamic DNS provider.");?><br> + <?=gettext("You can force an update for an IP address on the edit page for that service.");?> + </td> + <td class="list"> </td> + </tr> + </table> + </div> </td> - </tr> + </tr> </table> </form> <?php include("fend.inc"); ?> diff --git a/usr/local/www/services_ntpd.php b/usr/local/www/services_ntpd.php index 694235e..c68476b 100644 --- a/usr/local/www/services_ntpd.php +++ b/usr/local/www/services_ntpd.php @@ -40,7 +40,7 @@ require("guiconfig.inc"); if (empty($config['ntpd']['interface'])) - if (empty($config['installedpackages']['openntpd']['config'][0]['interface'])) { + if ($config['installedpackages']['openntpd'] && empty($config['installedpackages']['openntpd']['config'][0]['interface'])) { $pconfig['interface'] = explode(",", $config['installedpackages']['openntpd']['config'][0]['interface']); unset($config['installedpackages']['openntpd']); } else diff --git a/usr/local/www/services_rfc2136.php b/usr/local/www/services_rfc2136.php index 563ee26..3763182 100644 --- a/usr/local/www/services_rfc2136.php +++ b/usr/local/www/services_rfc2136.php @@ -44,17 +44,16 @@ if (!is_array($config['dnsupdates']['dnsupdate'])) $a_rfc2136 = &$config['dnsupdates']['dnsupdate']; if ($_GET['act'] == "del") { - unset($a_rfc2136[$_GET['id']]); + unset($a_rfc2136[$_GET['id']]); - write_config(); + write_config(); - header("Location: services_rfc2136.php"); - exit; + header("Location: services_rfc2136.php"); + exit; } $pgtitle = array(gettext("Services"), gettext("RFC 2136 clients")); include("head.inc"); - ?> <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> @@ -62,61 +61,80 @@ include("head.inc"); <form action="services_rfc2136.php" method="post" name="iform" id="iform"> <?php if ($input_errors) print_input_errors($input_errors); ?> <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr><td> + <tr> + <td> <?php $tab_array = array(); $tab_array[] = array(gettext("DynDns"), false, "services_dyndns.php"); $tab_array[] = array(gettext("RFC 2136"), true, "services_rfc2136.php"); display_top_tabs($tab_array); ?> - </td></tr> + </td> + </tr> <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td width="5%" class="listhdrr"></td> - <td width="25%" class="listhdrr"><?=gettext("Hostname");?></td> - <td width="60%" class="listhdr"><?=gettext("Description");?></td> - <td width="10%" class="list"></td> - </tr> - <?php $i = 0; foreach ($a_rfc2136 as $rfc2136): ?> - <tr> - <td class="listlr"> - <?php $iflist = get_configured_interface_with_descr(); - foreach ($iflist as $if => $ifdesc): - if ($rfc2136['interface'] == $if): ?> - <?=$ifdesc; break;?> - <?php endif; endforeach; ?> - </td> - <td class="listr"> - <?=htmlspecialchars($rfc2136['host']);?> - </td> - <td class="listbg"> - <?=htmlspecialchars($rfc2136['descr']);?> - </td> - <td valign="middle" nowrap class="list"> <a href="services_rfc2136_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a> - <a href="services_rfc2136.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this client?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> - </tr> - <?php $i++; endforeach; ?> - <tr> - <td class="list" colspan="3"> </td> - <td class="list"> <a href="services_rfc2136_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - <tr> - <td colspan="3" class="list"><p class="vexpl"><span class="red"><strong> - <br> - </strong></span> - - </td> - <td class="list"> </td> - </tr> - </table> - </div> + <td> + <div id="mainarea"> + <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="5%" class="listhdrr"></td> + <td width="25%" class="listhdrr"><?=gettext("Hostname");?></td> + <td width="60%" class="listhdr"><?=gettext("Description");?></td> + <td width="10%" class="list"></td> + </tr> + <?php $i = 0; foreach ($a_rfc2136 as $rfc2136): ?> + <tr> + <td class="listlr"> + <?php + $iflist = get_configured_interface_with_descr(); + foreach ($iflist as $if => $ifdesc) { + if ($rfc2136['interface'] == $if) { + if (!isset($rfc2136['enable'])) + echo "<span class=\"gray\">{$ifdesc}</span>"; + else + echo "{$ifdesc}"; + break; + } + } + ?> + </td> + <td class="listr"> + <?php + if (!isset($rfc2136['enable'])) + echo "<span class=\"gray\">".htmlspecialchars($rfc2136['host'])."</span>"; + else + echo htmlspecialchars($rfc2136['host']); + ?> + </td> + <td class="listbg"> + <?php + if (!isset($rfc2136['enable'])) + echo "<span class=\"gray\">".htmlspecialchars($rfc2136['descr'])."</span>"; + else + echo htmlspecialchars($rfc2136['descr']); + ?> + </td> + <td valign="middle" nowrap class="list"> + <a href="services_rfc2136_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a> + <a href="services_rfc2136.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this client?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a> + </td> + </tr> + <?php $i++; endforeach; ?> + <tr> + <td class="list" colspan="3"> </td> + <td class="list"> <a href="services_rfc2136_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> + </tr> + <tr> + <td colspan="3" class="list"> + <p class="vexpl"><span class="red"><strong><br></strong></span></p> + </td> + <td class="list"> </td> + </tr> + </table> + </div> </td> </tr> </table> </form> <?php include("fend.inc"); ?> </body> -</html> +</html>
\ No newline at end of file diff --git a/usr/local/www/status_dhcp_leases.php b/usr/local/www/status_dhcp_leases.php index 45687b8..ab0e45a 100755 --- a/usr/local/www/status_dhcp_leases.php +++ b/usr/local/www/status_dhcp_leases.php @@ -433,7 +433,7 @@ foreach ($leases as $data) { ?> </table> <p> -<form action="status_dhcp_leases.php" method="GET"> +<form action="status_dhcp_leases.php" method="get"> <input type="hidden" name="order" value="<?=htmlspecialchars($_GET['order']);?>"> <?php if ($_GET['all']): ?> <input type="hidden" name="all" value="0"> diff --git a/usr/local/www/status_filter_reload.php b/usr/local/www/status_filter_reload.php index 075deec..dcb4aeb 100644 --- a/usr/local/www/status_filter_reload.php +++ b/usr/local/www/status_filter_reload.php @@ -69,7 +69,7 @@ include("head.inc"); <?php include("fbegin.inc"); ?> <br/> -<form action="status_filter_reload.php" method="POST" name="filter"> +<form action="status_filter_reload.php" method="post" name="filter"> <input type="submit" value="Reload Filter" name="reloadfilter" id="reloadfilter"> <?php if ($config['hasync'] && $config['hasync']["synchronizetoip"] != ""): ?> diff --git a/usr/local/www/status_lb_pool.php b/usr/local/www/status_lb_pool.php index 88ea0ab..ce00625 100755 --- a/usr/local/www/status_lb_pool.php +++ b/usr/local/www/status_lb_pool.php @@ -108,7 +108,7 @@ if ($_POST) { ?> <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <?php include("fbegin.inc"); ?> -<form action="status_lb_pool.php" method="POST"> +<form action="status_lb_pool.php" method="post"> <?php if (is_subsystem_dirty('loadbalancer')): ?><p> <?php print_info_box_np(sprintf(gettext("The load balancer configuration has been changed%sYou must apply the changes in order for them to take effect."), "<br>"));?><br> <?php endif; ?> diff --git a/usr/local/www/status_rrd_graph.php b/usr/local/www/status_rrd_graph.php index ab3fe9c..212b660 100755 --- a/usr/local/www/status_rrd_graph.php +++ b/usr/local/www/status_rrd_graph.php @@ -65,6 +65,11 @@ if ($_GET['cat']) { } } +if ($_GET['zone']) + $curzone = $_GET['zone']; +else + $curzone = ''; + if ($_GET['period']) { $curperiod = $_GET['period']; } else { @@ -198,7 +203,6 @@ $dbheader = array("allgraphs-traffic.rrd", "allgraphs-wireless.rrd", "allgraphs-cellular.rrd", "allgraphs-vpnusers.rrd", - "captiveportal-allgraphs.rrd", "allgraphs-packets.rrd", "system-allgraphs.rrd", "system-throughput.rrd", @@ -222,7 +226,7 @@ foreach($databases as $database) { if(stristr($database, "-vpnusers")) { $vpnusers = true; } - if(stristr($database, "captiveportal-") && isset($config['captiveportal']['enable'])) { + if(stristr($database, "captiveportal-") && is_array($config['captiveportal'])) { $captiveportal = true; } } @@ -244,6 +248,27 @@ $graph_length = array( $pgtitle = array(gettext("Status"),gettext("RRD Graphs")); $closehead = false; + +/* Load all CP zones */ +if ($captiveportal) { + $cp_zones_tab_array = array(); + foreach($config['captiveportal'] as $cpkey => $cp) { + if (!isset($cp['enable'])) + continue; + + if ($curzone == '') { + $tabactive = true; + $curzone = $cpkey; + } elseif ($curzone == $cpkey) { + $tabactive = true; + } else { + $tabactive = false; + } + + $cp_zones_tab_array[] = array($cp['zone'], $tabactive, "status_rrd_graph.php?cat=captiveportal&zone=$cpkey"); + } +} + include("head.inc"); ?> @@ -411,6 +436,13 @@ function get_dates($curperiod, $graph) { ?> </td> </tr> + <?php if ($curcat == "captiveportal") : ?> + <tr> + <td class="tabnavtbl"> + <?php display_top_tabs($cp_zones_tab_array); ?> + </td> + </tr> + <?php endif; ?> <tr> <td> <div id="mainarea"> @@ -438,16 +470,19 @@ function get_dates($curperiod, $graph) { } } foreach ($ui_databases as $db => $database) { - if(! preg_match("/($curcat)/i", $database)) { + if(! preg_match("/($curcat)/i", $database)) continue; - } + + if (!empty($curzone) && !preg_match("/captiveportal-{$curzone}/i", $database)) + continue; + $optionc = explode("-", $database); $search = array("-", ".rrd", $optionc); $replace = array(" :: ", "", $friendly); switch($curcat) { case "captiveportal": - $optionc = str_replace($search, $replace, $optionc[1]); + $optionc = str_replace($search, $replace, $optionc[2]); echo "<option value=\"$optionc\""; $prettyprint = ucwords(str_replace($search, $replace, $optionc)); break; @@ -533,9 +568,12 @@ function get_dates($curperiod, $graph) { foreach($graphs as $graph) { /* check which databases are valid for our category */ foreach($ui_databases as $curdatabase) { - if(! preg_match("/($curcat)/i", $curdatabase)) { + if(! preg_match("/($curcat)/i", $curdatabase)) continue; - } + + if (!empty($curzone) && !preg_match("/captiveportal-{$curzone}/i", $curdatabase)) + continue; + $optionc = explode("-", $curdatabase); $search = array("-", ".rrd", $optionc); $replace = array(" :: ", "", $friendly); diff --git a/usr/local/www/status_rrd_graph_settings.php b/usr/local/www/status_rrd_graph_settings.php index 551fccb..6a30cc4 100755 --- a/usr/local/www/status_rrd_graph_settings.php +++ b/usr/local/www/status_rrd_graph_settings.php @@ -106,7 +106,7 @@ foreach($databases as $database) { if(stristr($database, "-vpnusers")) { $vpnusers = true; } - if(stristr($database, "captiveportal-") && isset($config['captiveportal']['enable'])) { + if(stristr($database, "captiveportal-") && is_array($config['captiveportal'])) { $captiveportal = true; } } diff --git a/usr/local/www/status_services.php b/usr/local/www/status_services.php index 126a67a..608804f 100755 --- a/usr/local/www/status_services.php +++ b/usr/local/www/status_services.php @@ -40,6 +40,7 @@ require_once("guiconfig.inc"); require_once("captiveportal.inc"); require_once("service-utils.inc"); +require_once("openvpn.inc"); require_once("ipsec.inc"); require_once("vpn.inc"); require_once("vslb.inc"); @@ -83,12 +84,8 @@ if($_GET['mode'] == "restartservice" and !empty($_GET['service'])) { if ($vpnmode == "server" || $vpnmode == "client") { $id = $_GET['id']; $configfile = "{$g['varetc_path']}/openvpn/{$vpnmode}{$id}.conf"; - $pidfile = $g['varrun_path'] . "/openvpn_{$vpnmode}{$id}.pid"; - if (file_exists($configfile)) { - killbypid($pidfile); - sleep(1); - mwexec_bg("/usr/local/sbin/openvpn --config {$configfile}"); - } + if (file_exists($configfile)) + openvpn_restart_by_vpnid($vpnmode, $id); } break; case 'relayd': @@ -139,7 +136,7 @@ if($_GET['mode'] == "startservice" and !empty($_GET['service'])) { $id = $_GET['id']; $configfile = "{$g['varetc_path']}/openvpn/{$vpnmode}{$id}.conf"; if (file_exists($configfile)) - mwexec_bg("/usr/local/sbin/openvpn --config {$configfile}"); + openvpn_restart_by_vpnid($vpnmode, $id); } break; case 'relayd': diff --git a/usr/local/www/status_upnp.php b/usr/local/www/status_upnp.php index 50386b1..0f0c66b 100644 --- a/usr/local/www/status_upnp.php +++ b/usr/local/www/status_upnp.php @@ -63,7 +63,7 @@ include("head.inc"); <?php include("fbegin.inc"); ?> <?php if ($savemsg) print_info_box($savemsg); ?> <?php -if(!$config['installedpackages']['miniupnpd']['config'][0]['iface_array'] || +if(!$config['installedpackages'] || !$config['installedpackages']['miniupnpd']['config'][0]['iface_array'] || !$config['installedpackages']['miniupnpd']['config'][0]['enable']) { echo gettext("UPnP is currently disabled."); include("fend.inc"); diff --git a/usr/local/www/system_advanced_misc.php b/usr/local/www/system_advanced_misc.php index d3243bc..c9216d4 100644 --- a/usr/local/www/system_advanced_misc.php +++ b/usr/local/www/system_advanced_misc.php @@ -69,10 +69,13 @@ $pconfig['thermal_hardware'] = $config['system']['thermal_hardware']; $pconfig['schedule_states'] = isset($config['system']['schedule_states']); $pconfig['kill_states'] = isset($config['system']['kill_states']); -if (!empty($config['system']['powerd_mode'])) - $pconfig['powerd_mode'] = $config['system']['powerd_mode']; -else - $pconfig['powerd_mode'] = "hadp"; +$pconfig['powerd_ac_mode'] = "hadp"; +if (!empty($config['system']['powerd_ac_mode'])) + $pconfig['powerd_ac_mode'] = $config['system']['powerd_ac_mode']; + +$pconfig['powerd_battery_mode'] = "hadp"; +if (!empty($config['system']['powerd_battery_mode'])) + $pconfig['powerd_battery_mode'] = $config['system']['powerd_battery_mode']; $crypto_modules = array('glxsb' => gettext("AMD Geode LX Security Block"), 'aesni' => gettext("AES-NI CPU-based Acceleration")); @@ -172,7 +175,8 @@ if ($_POST) { else unset($config['system']['powerd_enable']); - $config['system']['powerd_mode'] = $_POST['powerd_mode']; + $config['system']['powerd_ac_mode'] = $_POST['powerd_ac_mode']; + $config['system']['powerd_battery_mode'] = $_POST['powerd_battery_mode']; if($_POST['crypto_hardware']) $config['system']['crypto_hardware'] = $_POST['crypto_hardware']; @@ -350,12 +354,20 @@ function maxmss_checked(obj) { <input name="powerd_enable" type="checkbox" id="powerd_enable" value="yes" <?php if ($pconfig['powerd_enable']) echo "checked"; ?> /> <strong><?=gettext("Use PowerD"); ?></strong><br/> <br/> - <?=gettext("Mode"); ?> : - <select name="powerd_mode" id="powerd_mode"> - <option value="hadp"<?php if($pconfig['powerd_mode']=="hadp") echo " selected"; ?>><?=gettext("Hiadaptive");?></option> - <option value="adp"<?php if($pconfig['powerd_mode']=="adp") echo " selected"; ?>><?=gettext("Adaptive");?></option> - <option value="min"<?php if($pconfig['powerd_mode']=="min") echo " selected"; ?>><?=gettext("Minimum");?></option> - <option value="max"<?php if($pconfig['powerd_mode']=="max") echo " selected"; ?>><?=gettext("Maximum");?></option> + <?=gettext("On AC Power Mode"); ?> : + <select name="powerd_ac_mode" id="powerd_ac_mode"> + <option value="hadp"<?php if($pconfig['powerd_ac_mode']=="hadp") echo " selected"; ?>><?=gettext("Hiadaptive");?></option> + <option value="adp"<?php if($pconfig['powerd_ac_mode']=="adp") echo " selected"; ?>><?=gettext("Adaptive");?></option> + <option value="min"<?php if($pconfig['powerd_ac_mode']=="min") echo " selected"; ?>><?=gettext("Minimum");?></option> + <option value="max"<?php if($pconfig['powerd_ac_mode']=="max") echo " selected"; ?>><?=gettext("Maximum");?></option> + </select> + + <?=gettext("On Battery Power Mode"); ?> : + <select name="powerd_battery_mode" id="powerd_battery_mode"> + <option value="hadp"<?php if($pconfig['powerd_battery_mode']=="hadp") echo " selected"; ?>><?=gettext("Hiadaptive");?></option> + <option value="adp"<?php if($pconfig['powerd_battery_mode']=="adp") echo " selected"; ?>><?=gettext("Adaptive");?></option> + <option value="min"<?php if($pconfig['powerd_battery_mode']=="min") echo " selected"; ?>><?=gettext("Minimum");?></option> + <option value="max"<?php if($pconfig['powerd_battery_mode']=="max") echo " selected"; ?>><?=gettext("Maximum");?></option> </select> <br/><br/> <?=gettext("The powerd utility monitors the system state and sets various power control " . diff --git a/usr/local/www/system_camanager.php b/usr/local/www/system_camanager.php index 814c4c5..3c97725 100644 --- a/usr/local/www/system_camanager.php +++ b/usr/local/www/system_camanager.php @@ -46,7 +46,7 @@ $ca_methods = array( "intermediate" => gettext("Create an intermediate Certificate Authority")); $ca_keylens = array( "512", "1024", "2048", "4096"); -global $openssl_digest_algs; +$openssl_digest_algs = array("sha1", "sha224", "sha256", "sha384", "sha512"); $pgtitle = array(gettext("System"), gettext("Certificate Authority Manager")); @@ -386,7 +386,7 @@ function method_change() { foreach($ca_methods as $method => $desc): $selected = ""; if ($pconfig['method'] == $method) - $selected = "selected"; + $selected = " selected"; ?> <option value="<?=$method;?>"<?=$selected;?>><?=$desc;?></option> <?php endforeach; ?> @@ -409,7 +409,7 @@ function method_change() { <td width="78%" class="vtable"> <textarea name="cert" id="cert" cols="65" rows="7" class="formfld_cert"><?=htmlspecialchars($pconfig['cert']);?></textarea> <br> - <?=gettext("Paste a certificate in X.509 PEM format here.");?></td> + <?=gettext("Paste a certificate in X.509 PEM format here.");?> </td> </tr> <tr> @@ -417,7 +417,7 @@ function method_change() { <td width="78%" class="vtable"> <textarea name="key" id="key" cols="65" rows="7" class="formfld_cert"><?=htmlspecialchars($pconfig['key']);?></textarea> <br> - <?=gettext("Paste the private key for the above certificate here. This is optional in most cases, but required if you need to generate a Certificate Revocation List (CRL).");?></td> + <?=gettext("Paste the private key for the above certificate here. This is optional in most cases, but required if you need to generate a Certificate Revocation List (CRL).");?> </td> </tr> @@ -449,7 +449,7 @@ function method_change() { continue; $selected = ""; if ($pconfig['caref'] == $ca['refid']) - $selected = "selected"; + $selected = " selected"; ?> <option value="<?=$ca['refid'];?>"<?=$selected;?>><?=$ca['descr'];?></option> <?php endforeach; ?> @@ -464,7 +464,7 @@ function method_change() { foreach( $ca_keylens as $len): $selected = ""; if ($pconfig['keylen'] == $len) - $selected = "selected"; + $selected = " selected"; ?> <option value="<?=$len;?>"<?=$selected;?>><?=$len;?></option> <?php endforeach; ?> @@ -480,7 +480,7 @@ function method_change() { foreach( $openssl_digest_algs as $digest_alg): $selected = ""; if ($pconfig['digest_alg'] == $digest_alg) - $selected = "selected"; + $selected = " selected"; ?> <option value="<?=$digest_alg;?>"<?=$selected;?>><?=strtoupper($digest_alg);?></option> <?php endforeach; ?> @@ -506,8 +506,9 @@ function method_change() { <?php foreach( $dn_cc as $cc){ $selected = ""; - if ($pconfig['dn_country'] == $cc) $selected = "selected"; - print "<option value=\"$cc\" $selected>$cc</option>"; + if ($pconfig['dn_country'] == $cc) + $selected = " selected"; + print "<option value=\"$cc\"$selected>$cc</option>"; } ?> </select> @@ -645,18 +646,18 @@ function method_change() { <td class="listr"><?=$certcount;?> </td> <td class="listr"><?=$subj;?> </td> <td valign="middle" nowrap class="list"> - <a href="system_camanager.php?act=edit&id=<?=$i;?>")"> + <a href="system_camanager.php?act=edit&id=<?=$i;?>"> <img src="/themes/<?= $g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("edit CA");?>" alt="<?=gettext("edit CA");?>" width="17" height="17" border="0" /> </a> - <a href="system_camanager.php?act=exp&id=<?=$i;?>")"> + <a href="system_camanager.php?act=exp&id=<?=$i;?>"> <img src="/themes/<?= $g['theme'];?>/images/icons/icon_down.gif" title="<?=gettext("export CA cert");?>" alt="<?=gettext("export CA cert");?>" width="17" height="17" border="0" /> </a> <?php if ($ca['prv']): ?> - <a href="system_camanager.php?act=expkey&id=<?=$i;?>")"> + <a href="system_camanager.php?act=expkey&id=<?=$i;?>"> <img src="/themes/<?= $g['theme'];?>/images/icons/icon_down.gif" title="<?=gettext("export CA private key");?>" alt="<?=gettext("export CA private key");?>" width="17" height="17" border="0" /> </a> <?php endif; ?> - <a href="system_camanager.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this Certificate Authority and its CRLs, and unreference any associated certificates?");?>')"> + <a href="system_camanager.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this Certificate Authority and its CRLs, and unreference any associated certificates?");?>')"> <img src="/themes/<?= $g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete ca");?>" alt="<?=gettext("delete ca"); ?>" width="17" height="17" border="0" /> </a> </td> @@ -698,3 +699,4 @@ method_change(); </script> </body> +</html> diff --git a/usr/local/www/system_certmanager.php b/usr/local/www/system_certmanager.php index d8ca0b6..b120015 100644 --- a/usr/local/www/system_certmanager.php +++ b/usr/local/www/system_certmanager.php @@ -52,7 +52,7 @@ $cert_types = array( "ca" => "Certificate Authority", "user" => "User Certificate"); $altname_types = array("DNS", "IP", "email", "URI"); -global $openssl_digest_algs; +$openssl_digest_algs = array("sha1", "sha224", "sha256", "sha384", "sha512"); $pgtitle = array(gettext("System"), gettext("Certificate Manager")); @@ -583,7 +583,7 @@ function internalca_change() { foreach($cert_methods as $method => $desc): $selected = ""; if ($pconfig['method'] == $method) - $selected = "selected"; + $selected = " selected"; ?> <option value="<?=$method;?>"<?=$selected;?>><?=$desc;?></option> <?php endforeach; ?> @@ -616,7 +616,7 @@ function internalca_change() { <td width="78%" class="vtable"> <textarea name="cert" id="cert" cols="65" rows="7" class="formfld_cert"><?=htmlspecialchars($pconfig['cert']);?></textarea> <br> - <?=gettext("Paste a certificate in X.509 PEM format here.");?></td> + <?=gettext("Paste a certificate in X.509 PEM format here.");?> </td> </tr> <tr> @@ -624,7 +624,7 @@ function internalca_change() { <td width="78%" class="vtable"> <textarea name="key" id="key" cols="65" rows="7" class="formfld_cert"><?=htmlspecialchars($pconfig['key']);?></textarea> <br> - <?=gettext("Paste a private key in X.509 PEM format here.");?></td> + <?=gettext("Paste a private key in X.509 PEM format here.");?> </td> </tr> </table> @@ -659,7 +659,7 @@ function internalca_change() { continue; $selected = ""; if ($pconfig['caref'] == $ca['refid']) - $selected = "selected"; + $selected = " selected"; ?> <option value="<?=$ca['refid'];?>"<?=$selected;?>><?=$ca['descr'];?></option> <?php endforeach; ?> @@ -674,7 +674,7 @@ function internalca_change() { foreach( $cert_keylens as $len): $selected = ""; if ($pconfig['keylen'] == $len) - $selected = "selected"; + $selected = " selected"; ?> <option value="<?=$len;?>"<?=$selected;?>><?=$len;?></option> <?php endforeach; ?> @@ -690,7 +690,7 @@ function internalca_change() { foreach( $openssl_digest_algs as $digest_alg): $selected = ""; if ($pconfig['digest_alg'] == $digest_alg) - $selected = "selected"; + $selected = " selected"; ?> <option value="<?=$digest_alg;?>"<?=$selected;?>><?=strtoupper($digest_alg);?></option> <?php endforeach; ?> @@ -706,7 +706,7 @@ function internalca_change() { foreach( $cert_types as $ct => $ctdesc ): $selected = ""; if ($pconfig['type'] == $ct) - $selected = "selected"; + $selected = " selected"; ?> <option value="<?=$ct;?>"<?=$selected;?>><?=$ctdesc;?></option> <?php endforeach; ?> @@ -847,7 +847,7 @@ function internalca_change() { foreach( $cert_keylens as $len): $selected = ""; if ($pconfig['keylen'] == $len) - $selected = "selected"; + $selected = " selected"; ?> <option value="<?=$len;?>"<?=$selected;?>><?=$len;?></option> <?php endforeach; ?> @@ -866,8 +866,9 @@ function internalca_change() { <?php foreach( $dn_cc as $cc){ $selected = ""; - if ($pconfig['csr_dn_country'] == $cc) $selected = "selected"; - print "<option value=\"$cc\" $selected>$cc</option>"; + if ($pconfig['csr_dn_country'] == $cc) + $selected = " selected"; + print "<option value=\"$cc\"$selected>$cc</option>"; } ?> </select> @@ -948,19 +949,19 @@ function internalca_change() { $caname = ""; $inuse = ""; $revoked = ""; - if (in_array($cert['refid'], $config['system']['user'][$userid]['cert'])) + if (isset($userid) && in_array($cert['refid'], $config['system']['user'][$userid]['cert'])) continue; $ca = lookup_ca($cert['caref']); if ($ca) $caname = " (CA: {$ca['descr']})"; if ($pconfig['certref'] == $cert['refid']) - $selected = "selected"; + $selected = " selected"; if (cert_in_use($cert['refid'])) $inuse = " *In Use"; if (is_cert_revoked($cert)) $revoked = " *Revoked"; ?> - <option value="<?=$cert['refid'];?>" <?=$selected;?>><?=$cert['descr'] . $caname . $inuse . $revoked;?></option> + <option value="<?=$cert['refid'];?>"<?=$selected;?>><?=$cert['descr'] . $caname . $inuse . $revoked;?></option> <?php endforeach; ?> </select> </td> @@ -1123,23 +1124,23 @@ function internalca_change() { <?php endif; ?> </td> <td valign="middle" nowrap class="list"> - <a href="system_certmanager.php?act=exp&id=<?=$i;?>"> + <a href="system_certmanager.php?act=exp&id=<?=$i;?>"> <img src="/themes/<?= $g['theme'];?>/images/icons/icon_down.gif" title="<?=gettext("export cert");?>" alt="<?=gettext("export ca");?>" width="17" height="17" border="0" /> </a> - <a href="system_certmanager.php?act=key&id=<?=$i;?>"> + <a href="system_certmanager.php?act=key&id=<?=$i;?>"> <img src="/themes/<?= $g['theme'];?>/images/icons/icon_down.gif" title="<?=gettext("export key");?>" alt="<?=gettext("export ca");?>" width="17" height="17" border="0" /> </a> - <a href="system_certmanager.php?act=p12&id=<?=$i;?>"> + <a href="system_certmanager.php?act=p12&id=<?=$i;?>"> <img src="/themes/<?= $g['theme'];?>/images/icons/icon_down.gif" title="<?=gettext("export cert+key in .p12");?>" alt="<?=gettext("export cert+key in .p12");?>" width="17" height="17" border="0" /> </a> <?php if (!cert_in_use($cert['refid'])): ?> - <a href="system_certmanager.php?act=del&id=<?=$i;?>" onClick="return confirm('<?=gettext("Do you really want to delete this Certificate?");?>')"> + <a href="system_certmanager.php?act=del&id=<?=$i;?>" onClick="return confirm('<?=gettext("Do you really want to delete this Certificate?");?>')"> <img src="/themes/<?= $g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete cert");?>" alt="<?=gettext("delete cert");?>" width="17" height="17" border="0" /> </a> <?php endif; ?> <?php if ($cert['csr']): ?> - <a href="system_certmanager.php?act=csr&id=<?=$i;?>"> + <a href="system_certmanager.php?act=csr&id=<?=$i;?>"> <img src="/themes/<?= $g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("update csr");?>" alt="<?=gettext("update csr");?>" width="17" height="17" border="0" /> </a> <?php endif; ?> @@ -1180,3 +1181,4 @@ internalca_change(); </script> </body> +</html> diff --git a/usr/local/www/system_crlmanager.php b/usr/local/www/system_crlmanager.php index c54a283..1168afa 100644 --- a/usr/local/www/system_crlmanager.php +++ b/usr/local/www/system_crlmanager.php @@ -556,11 +556,11 @@ function method_change() { </td> <td class="list"> <?php if ($cainternal == "YES"): ?> - <a href="system_crlmanager.php?act=new&caref=<?php echo $ca['refid']; ?>"> + <a href="system_crlmanager.php?act=new&caref=<?php echo $ca['refid']; ?>"> <img src="/themes/<?= $g['theme'];?>/images/icons/icon_plus.gif" title="<?php printf(gettext("Add or Import CRL for %s"),$ca['descr']);?>" alt="<?=gettext("add crl");?>" width="17" height="17" border="0" /> </a> <?php else: ?> - <a href="system_crlmanager.php?act=new&caref=<?php echo $ca['refid']; ?>&importonly=yes"> + <a href="system_crlmanager.php?act=new&caref=<?php echo $ca['refid']; ?>&importonly=yes"> <img src="/themes/<?= $g['theme'];?>/images/icons/icon_plus.gif" title="<?php printf(gettext("Import CRL for %s"),$ca['descr']);?>" alt="<?=gettext("add crl");?>" width="17" height="17" border="0" /> </a> <?php endif; ?> @@ -581,16 +581,16 @@ function method_change() { <td class="listr"><?php echo ($inuse) ? "YES" : "NO"; ?></td> <td valign="middle" nowrap class="list"> <?php if (!$internal || count($tmpcrl['cert'])): ?> - <a href="system_crlmanager.php?act=exp&id=<?=$tmpcrl['refid'];?>")"> + <a href="system_crlmanager.php?act=exp&id=<?=$tmpcrl['refid'];?>"> <img src="/themes/<?= $g['theme'];?>/images/icons/icon_down.gif" title="<?=gettext("Export CRL") . " " . htmlspecialchars($tmpcrl['descr']);?>" alt="<?=gettext("Export CRL") . " " . htmlspecialchars($tmpcrl['descr']);?>" width="17" height="17" border="0" /> </a> <?php endif; ?> <?php if ($internal): ?> - <a href="system_crlmanager.php?act=edit&id=<?=$tmpcrl['refid'];?>")"> + <a href="system_crlmanager.php?act=edit&id=<?=$tmpcrl['refid'];?>"> <img src="/themes/<?= $g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("Edit CRL") . " " . htmlspecialchars($tmpcrl['descr']);?>" alt="<?=gettext("Edit CRL") . " " . htmlspecialchars($tmpcrl['descr']);?>" width="17" height="17" border="0" /> </a> <?php else: ?> - <a href="system_crlmanager.php?act=editimported&id=<?=$tmpcrl['refid'];?>")"> + <a href="system_crlmanager.php?act=editimported&id=<?=$tmpcrl['refid'];?>"> <img src="/themes/<?= $g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("Edit CRL") . " " . htmlspecialchars($tmpcrl['descr']);?>" alt="<?=gettext("Edit CRL") . " " . htmlspecialchars($tmpcrl['descr']);?>" width="17" height="17" border="0" /> </a> <?php endif; ?> @@ -639,3 +639,4 @@ method_change(); </script> </body> +</html> diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index de11cfc..7fcfb97 100755 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -117,20 +117,20 @@ if ($_POST) { $parent_ip = get_interface_ip($_POST['interface']); $parent_sn = get_interface_subnet($_POST['interface']); if(empty($parent_ip) || empty($parent_sn)) { - $input_errors[] = gettext("You can not use a IPv6 Gateway Address on a IPv4 only interface."); + $input_errors[] = gettext("You can not use a IPv4 Gateway Address on a IPv6 only interface."); } else { $subnet = gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn; if(!ip_in_subnet($_POST['gateway'], $subnet)) $input_errors[] = sprintf(gettext("The gateway address %1\$s does not lie within the chosen interface's subnet '%2\$s'."), $_POST['gateway'],$subnet); } } - if(is_ipaddrv6($_POST['gateway'])) { + else if(is_ipaddrv6($_POST['gateway'])) { /* do not do a subnet match on a link local address, it's valid */ if(! preg_match("/fe80::/", $_POST['gateway'])) { $parent_ip = get_interface_ipv6($_POST['interface']); $parent_sn = get_interface_subnetv6($_POST['interface']); if(empty($parent_ip) || empty($parent_sn)) { - $input_errors[] = gettext("You can not use a IPv4 Gateway Address on a IPv6 only interface."); + $input_errors[] = gettext("You can not use a IPv6 Gateway Address on a IPv4 only interface."); } else { $subnet = gen_subnetv6($parent_ip, $parent_sn) . "/" . $parent_sn; if(!ip_in_subnet($_POST['gateway'], $subnet)) @@ -637,4 +637,4 @@ function monitor_change() { monitor_change(); </script> </body> -</html>
\ No newline at end of file +</html> diff --git a/usr/local/www/system_routes.php b/usr/local/www/system_routes.php index 5b84b1c..d86c009 100755 --- a/usr/local/www/system_routes.php +++ b/usr/local/www/system_routes.php @@ -83,6 +83,7 @@ if ($_GET['act'] == "del") { $changedesc .= gettext("removed route to") . " " . $a_routes[$_GET['id']['route']]; list($ip, $mask) = explode("/", $a_routes[$_GET['id']]['network']); if (is_ipaddr($ip)) { + $family = ""; if(is_ipaddrv6($ip)) $family = "-inet6"; mwexec("/sbin/route delete {$family} " . escapeshellarg($a_routes[$_GET['id']]['network'])); diff --git a/usr/local/www/system_routes_edit.php b/usr/local/www/system_routes_edit.php index 98e264b..1a27e88 100755 --- a/usr/local/www/system_routes_edit.php +++ b/usr/local/www/system_routes_edit.php @@ -110,7 +110,7 @@ if ($_POST) { $current_targets = get_staticroutes(true); $new_targets = array(); if(is_ipaddrv6($_POST['network'])) { - $osn = Net_IPv6::compress(gen_subnetv6($_POST['network'], $_POST['network_subnet'])) . "/" . $_POST['network_subnet']; + $osn = gen_subnetv6($_POST['network'], $_POST['network_subnet']) . "/" . $_POST['network_subnet']; $new_targets[] = $osn; } if (is_ipaddrv4($_POST['network'])) { diff --git a/usr/local/www/system_usermanager_settings.php b/usr/local/www/system_usermanager_settings.php index f8269ad..d3ef3fe 100755 --- a/usr/local/www/system_usermanager_settings.php +++ b/usr/local/www/system_usermanager_settings.php @@ -36,8 +36,8 @@ ##|+PRIV ##|*IDENT=page-system-usermanager-settings -##|*NAME=System: User manager: settings page -##|*DESCR=Allow access to the 'System: User manager: settings' page. +##|*NAME=System: User Manager: settings page +##|*DESCR=Allow access to the 'System: User Manager: settings' page. ##|*MATCH=system_usermanager_settings.php* ##|-PRIV diff --git a/usr/local/www/themes/_corporate/all.css b/usr/local/www/themes/_corporate/all.css index 97cec9d..7307ac4 100644 --- a/usr/local/www/themes/_corporate/all.css +++ b/usr/local/www/themes/_corporate/all.css @@ -9,6 +9,8 @@ html, body, td, th, input, select { font-size: 0.9em; } +.nowrap { white-space: nowrap; } + div.GraphLink { position: relative; } diff --git a/usr/local/www/themes/_corporate/bottom-loader.js b/usr/local/www/themes/_corporate/bottom-loader.js index 238e0b2..a21f775 100644 --- a/usr/local/www/themes/_corporate/bottom-loader.js +++ b/usr/local/www/themes/_corporate/bottom-loader.js @@ -1,4 +1,4 @@ -<!-- +//<![CDATA[ NiftyCheck(); Rounded("div#niftyMenu","top bottom","#FFFFFF","#000000","smooth"); @@ -7,4 +7,4 @@ Rounded("tr#fend","bl br tl tr","#FFF","#990000","smooth"); Rounded("div#topbox","all","#FFF","#990000","smooth"); -//--> +//]]> diff --git a/usr/local/www/themes/_corporate/loader.js b/usr/local/www/themes/_corporate/loader.js index 80fc869..f94be35 100644 --- a/usr/local/www/themes/_corporate/loader.js +++ b/usr/local/www/themes/_corporate/loader.js @@ -1,4 +1,4 @@ -<!-- +//<![CDATA[ var browser = ''; var version = ''; var entrance = ''; @@ -26,4 +26,4 @@ if (version < 7) { document.write('<script type="text/javascript" src="/themes/corporate/javascript/niftyjsCode.js"></scr' + 'ipt>'); -// --> +//]]> diff --git a/usr/local/www/themes/code-red/all.css b/usr/local/www/themes/code-red/all.css index cd8e435..9585a01 100755 --- a/usr/local/www/themes/code-red/all.css +++ b/usr/local/www/themes/code-red/all.css @@ -5,6 +5,8 @@ html, body, td, th, input, select { } +.nowrap { white-space: nowrap; } + .infobox { width:100%; } diff --git a/usr/local/www/themes/code-red/bottom-loader.js b/usr/local/www/themes/code-red/bottom-loader.js index 238e0b2..a21f775 100755 --- a/usr/local/www/themes/code-red/bottom-loader.js +++ b/usr/local/www/themes/code-red/bottom-loader.js @@ -1,4 +1,4 @@ -<!-- +//<![CDATA[ NiftyCheck(); Rounded("div#niftyMenu","top bottom","#FFFFFF","#000000","smooth"); @@ -7,4 +7,4 @@ Rounded("tr#fend","bl br tl tr","#FFF","#990000","smooth"); Rounded("div#topbox","all","#FFF","#990000","smooth"); -//--> +//]]> diff --git a/usr/local/www/themes/code-red/loader.js b/usr/local/www/themes/code-red/loader.js index 5eb41e1..bf4b7f4 100755 --- a/usr/local/www/themes/code-red/loader.js +++ b/usr/local/www/themes/code-red/loader.js @@ -1,4 +1,4 @@ -<!-- +//<![CDATA[ var browser = ''; var version = ''; var entrance = ''; @@ -21,9 +21,9 @@ if (version == '') { } if (browser == 'IE' && version < 7) { - document.write('<script type="text/javascript" src="/themes/nervecenter/javascript/ie7/ie7-standard-p.js"></scr'+'ipt>'); + document.write('<script type="text/javascript" src="/themes/code-red/javascript/ie7/ie7-standard-p.js"></scr'+'ipt>'); } -document.write('<script type="text/javascript" src="/themes/nervecenter/javascript/niftyjsCode.js"></scr'+'ipt>'); +document.write('<script type="text/javascript" src="/themes/code-red/javascript/niftyjsCode.js"></scr'+'ipt>'); -// --> +//]]> diff --git a/usr/local/www/themes/code-red/wizard.css b/usr/local/www/themes/code-red/wizard.css index c0979a8..c0a7546 100755 --- a/usr/local/www/themes/code-red/wizard.css +++ b/usr/local/www/themes/code-red/wizard.css @@ -5,6 +5,8 @@ html, body, td, th, input, select { } +.nowrap { white-space: nowrap; } + /* please adjust the bgcolor to be used together with niftycorners! */ .rtop, .artop { background-color: #5f0406; diff --git a/usr/local/www/themes/metallic/all.css b/usr/local/www/themes/metallic/all.css index 056ae02..59c0a29 100644 --- a/usr/local/www/themes/metallic/all.css +++ b/usr/local/www/themes/metallic/all.css @@ -4,6 +4,8 @@ html, body, td, th, input, select { font-size: 0.9em; } +.nowrap { white-space: nowrap; } + .infobox { width:100%; } diff --git a/usr/local/www/themes/metallic/bottom-loader.js b/usr/local/www/themes/metallic/bottom-loader.js index 238e0b2..a21f775 100644 --- a/usr/local/www/themes/metallic/bottom-loader.js +++ b/usr/local/www/themes/metallic/bottom-loader.js @@ -1,4 +1,4 @@ -<!-- +//<![CDATA[ NiftyCheck(); Rounded("div#niftyMenu","top bottom","#FFFFFF","#000000","smooth"); @@ -7,4 +7,4 @@ Rounded("tr#fend","bl br tl tr","#FFF","#990000","smooth"); Rounded("div#topbox","all","#FFF","#990000","smooth"); -//--> +//]]> diff --git a/usr/local/www/themes/metallic/loader.js b/usr/local/www/themes/metallic/loader.js index 57a5047..f6d44e7 100644 --- a/usr/local/www/themes/metallic/loader.js +++ b/usr/local/www/themes/metallic/loader.js @@ -1,4 +1,4 @@ -<!-- +//<![CDATA[ var browser = ''; var version = ''; var entrance = ''; @@ -26,4 +26,4 @@ if (browser == 'IE' && version < 7) { document.write('<script type="text/javascript" src="/themes/metallic/javascript/niftyjsCode.js"></scr'+'ipt>'); -// -->
\ No newline at end of file +//]]> diff --git a/usr/local/www/themes/nervecenter/all.css b/usr/local/www/themes/nervecenter/all.css index 7a6a75b..4c32d40 100644 --- a/usr/local/www/themes/nervecenter/all.css +++ b/usr/local/www/themes/nervecenter/all.css @@ -5,6 +5,8 @@ html, body, td, th, input, select { } +.nowrap { white-space: nowrap; } + .infobox { width:100%; } diff --git a/usr/local/www/themes/nervecenter/bottom-loader.js b/usr/local/www/themes/nervecenter/bottom-loader.js index 238e0b2..a21f775 100644 --- a/usr/local/www/themes/nervecenter/bottom-loader.js +++ b/usr/local/www/themes/nervecenter/bottom-loader.js @@ -1,4 +1,4 @@ -<!-- +//<![CDATA[ NiftyCheck(); Rounded("div#niftyMenu","top bottom","#FFFFFF","#000000","smooth"); @@ -7,4 +7,4 @@ Rounded("tr#fend","bl br tl tr","#FFF","#990000","smooth"); Rounded("div#topbox","all","#FFF","#990000","smooth"); -//--> +//]]> diff --git a/usr/local/www/themes/nervecenter/loader.js b/usr/local/www/themes/nervecenter/loader.js index 5eb41e1..2f2624c 100644 --- a/usr/local/www/themes/nervecenter/loader.js +++ b/usr/local/www/themes/nervecenter/loader.js @@ -1,4 +1,4 @@ -<!-- +//<![CDATA[ var browser = ''; var version = ''; var entrance = ''; @@ -26,4 +26,4 @@ if (browser == 'IE' && version < 7) { document.write('<script type="text/javascript" src="/themes/nervecenter/javascript/niftyjsCode.js"></scr'+'ipt>'); -// --> +//]]> diff --git a/usr/local/www/themes/nervecenter/wizard.css b/usr/local/www/themes/nervecenter/wizard.css index 4e0d048..a2d31d5 100644 --- a/usr/local/www/themes/nervecenter/wizard.css +++ b/usr/local/www/themes/nervecenter/wizard.css @@ -5,6 +5,8 @@ html, body, td, th, input, select { } +.nowrap { white-space: nowrap; } + /* please adjust the bgcolor to be used together with niftycorners! */ .rtop, .artop { background-color: #999999; diff --git a/usr/local/www/themes/pfsense-dropdown/all.css b/usr/local/www/themes/pfsense-dropdown/all.css index a4811fc..3eee0cf 100644 --- a/usr/local/www/themes/pfsense-dropdown/all.css +++ b/usr/local/www/themes/pfsense-dropdown/all.css @@ -4,6 +4,8 @@ html, body, td, th, input, select { font-size: 0.9em; } +.nowrap { white-space: nowrap; } + .infobox { width:100%; } diff --git a/usr/local/www/themes/pfsense-dropdown/bottom-loader.js b/usr/local/www/themes/pfsense-dropdown/bottom-loader.js index 66f021d..fad206e 100644 --- a/usr/local/www/themes/pfsense-dropdown/bottom-loader.js +++ b/usr/local/www/themes/pfsense-dropdown/bottom-loader.js @@ -1,4 +1,4 @@ -<!-- +//<![CDATA[ NiftyCheck(); Rounded("div#niftyMenu","top bottom","#FFFFFF","#000000","smooth"); @@ -8,4 +8,4 @@ Rounded("tr#fend","bl br tl tr","#FFF","#990000","smooth"); Rounded("div#topbox","all","#FFF","#990000","smooth"); Rounded("div#footer","bl br tl tr","#FFF","#990000","smooth"); -//--> +//]]> diff --git a/usr/local/www/themes/pfsense-dropdown/loader.js b/usr/local/www/themes/pfsense-dropdown/loader.js index 2b34db2..6b771e1 100644 --- a/usr/local/www/themes/pfsense-dropdown/loader.js +++ b/usr/local/www/themes/pfsense-dropdown/loader.js @@ -1,4 +1,4 @@ -<!-- +//<![CDATA[ var browser = ''; var version = ''; var entrance = ''; @@ -26,4 +26,4 @@ if (browser == 'IE' && version < 7) { document.write('<script type="text/javascript" src="/themes/pfsense-dropdown/javascript/niftyjsCode.js"></scr'+'ipt>'); -// -->
\ No newline at end of file +//]]> diff --git a/usr/local/www/themes/pfsense/all.css b/usr/local/www/themes/pfsense/all.css index 73b3324..2a891e9 100644 --- a/usr/local/www/themes/pfsense/all.css +++ b/usr/local/www/themes/pfsense/all.css @@ -4,6 +4,8 @@ html, body, td, th, input, select { font-size: 0.9em; } +.nowrap { white-space: nowrap; } + .infobox { width:100%; } diff --git a/usr/local/www/themes/pfsense/bottom-loader.js b/usr/local/www/themes/pfsense/bottom-loader.js index 836e8b0..8251766 100644 --- a/usr/local/www/themes/pfsense/bottom-loader.js +++ b/usr/local/www/themes/pfsense/bottom-loader.js @@ -1,4 +1,4 @@ -<!-- +//<![CDATA[ NiftyCheck(); Rounded("div#niftyMenu","top bottom","#FFFFFF","#000000","smooth"); @@ -9,4 +9,4 @@ Rounded("div#topbox","all","#FFF","#990000","smooth"); Rounded("div#navigation","top bottom","#FFFFFF","#000000","smooth"); Rounded("div#footer","bl br tl tr]","#FFF","#990000","smooth"); -//--> +//]]> diff --git a/usr/local/www/themes/pfsense/loader.js b/usr/local/www/themes/pfsense/loader.js index cf0fad8..60da999 100644 --- a/usr/local/www/themes/pfsense/loader.js +++ b/usr/local/www/themes/pfsense/loader.js @@ -1,4 +1,4 @@ -<!-- +//<![CDATA[ var browser = ''; var version = ''; var entrance = ''; @@ -25,6 +25,6 @@ if (browser == 'IE' && version < 7) { document.write('<script type="text/javascript" src="/themes/metallic/javascript/ie7/ie7-standard-p.js"></scr'+'ipt>'); } -document.write('<script type="text/javascript" src="/themes/pfsense-dropdown/javascript/niftyjsCode.js"></scr'+'ipt>'); +document.write('<script type="text/javascript" src="/themes/pfsense/javascript/niftyjsCode.js"></scr'+'ipt>'); -// -->
\ No newline at end of file +//]]> diff --git a/usr/local/www/themes/pfsense_ng/all.css b/usr/local/www/themes/pfsense_ng/all.css index 3452c72..97eba0e 100644 --- a/usr/local/www/themes/pfsense_ng/all.css +++ b/usr/local/www/themes/pfsense_ng/all.css @@ -5,6 +5,8 @@ html, body, td, th, input, select { } +.nowrap { white-space: nowrap; } + .infobox { width:100%; } diff --git a/usr/local/www/themes/pfsense_ng/bottom-loader.js b/usr/local/www/themes/pfsense_ng/bottom-loader.js index 238e0b2..a21f775 100644 --- a/usr/local/www/themes/pfsense_ng/bottom-loader.js +++ b/usr/local/www/themes/pfsense_ng/bottom-loader.js @@ -1,4 +1,4 @@ -<!-- +//<![CDATA[ NiftyCheck(); Rounded("div#niftyMenu","top bottom","#FFFFFF","#000000","smooth"); @@ -7,4 +7,4 @@ Rounded("tr#fend","bl br tl tr","#FFF","#990000","smooth"); Rounded("div#topbox","all","#FFF","#990000","smooth"); -//--> +//]]> diff --git a/usr/local/www/themes/pfsense_ng/loader.js b/usr/local/www/themes/pfsense_ng/loader.js index 3c46d3c..a028afe 100644 --- a/usr/local/www/themes/pfsense_ng/loader.js +++ b/usr/local/www/themes/pfsense_ng/loader.js @@ -1,4 +1,4 @@ -<!-- +//<![CDATA[ var browser = ''; var version = ''; var entrance = ''; @@ -21,10 +21,10 @@ if (version == '') { } if (browser == 'IE' && version < 7) { - document.write('<script type="text/javascript" src="/themes/nervecenter/javascript/ie7/ie7-standard-p.js"></scr'+'ipt>'); + document.write('<script type="text/javascript" src="/themes/pfsense_ng/javascript/ie7/ie7-standard-p.js"></scr'+'ipt>'); } -document.write('<script type="text/javascript" src="/themes/nervecenter/javascript/niftyjsCode.js"></scr'+'ipt>'); +document.write('<script type="text/javascript" src="/themes/pfsense_ng/javascript/niftyjsCode.js"></scr'+'ipt>'); // jQuery function to define dropdown menu size jQuery(document).ready(function () { @@ -33,4 +33,4 @@ jQuery(document).ready(function () { // Force the size dropdown menu jQuery('#navigation ul li ul').css('max-height', hwindow); }); -// --> +//]]> diff --git a/usr/local/www/themes/pfsense_ng/wizard.css b/usr/local/www/themes/pfsense_ng/wizard.css index ad5b33d..f2c9f3e 100644 --- a/usr/local/www/themes/pfsense_ng/wizard.css +++ b/usr/local/www/themes/pfsense_ng/wizard.css @@ -5,6 +5,8 @@ html, body, td, th, input, select { } +.nowrap { white-space: nowrap; } + /* please adjust the bgcolor to be used together with niftycorners! */ .rtop, .artop { background-color: #999999; diff --git a/usr/local/www/themes/the_wall/all.css b/usr/local/www/themes/the_wall/all.css index c96a99c..6c52614 100644 --- a/usr/local/www/themes/the_wall/all.css +++ b/usr/local/www/themes/the_wall/all.css @@ -5,6 +5,8 @@ html, body, td, th, input, select { } +.nowrap { white-space: nowrap; } + .infobox { width:100%; } diff --git a/usr/local/www/themes/the_wall/bottom-loader.js b/usr/local/www/themes/the_wall/bottom-loader.js index 238e0b2..a21f775 100644 --- a/usr/local/www/themes/the_wall/bottom-loader.js +++ b/usr/local/www/themes/the_wall/bottom-loader.js @@ -1,4 +1,4 @@ -<!-- +//<![CDATA[ NiftyCheck(); Rounded("div#niftyMenu","top bottom","#FFFFFF","#000000","smooth"); @@ -7,4 +7,4 @@ Rounded("tr#fend","bl br tl tr","#FFF","#990000","smooth"); Rounded("div#topbox","all","#FFF","#990000","smooth"); -//--> +//]]> diff --git a/usr/local/www/themes/the_wall/loader.js b/usr/local/www/themes/the_wall/loader.js index d4137f6..0fd7d68 100644 --- a/usr/local/www/themes/the_wall/loader.js +++ b/usr/local/www/themes/the_wall/loader.js @@ -1,4 +1,4 @@ -<!-- +//<![CDATA[ var browser = ''; var version = ''; @@ -22,9 +22,9 @@ if (version == '') { } if (browser == 'IE' && version < 7) { - document.write('<script type="text/javascript" src="/themes/nervecenter/javascript/ie7/ie7-standard-p.js"></scr'+'ipt>'); + document.write('<script type="text/javascript" src="/themes/the_wall/javascript/ie7/ie7-standard-p.js"></scr'+'ipt>'); } -document.write('<script type="text/javascript" src="/themes/nervecenter/javascript/niftyjsCode.js"></scr'+'ipt>'); +document.write('<script type="text/javascript" src="/themes/the_wall/javascript/niftyjsCode.js"></scr'+'ipt>'); -// --> +//]]> diff --git a/usr/local/www/themes/the_wall/wizard.css b/usr/local/www/themes/the_wall/wizard.css index 4e0d048..a2d31d5 100644 --- a/usr/local/www/themes/the_wall/wizard.css +++ b/usr/local/www/themes/the_wall/wizard.css @@ -5,6 +5,8 @@ html, body, td, th, input, select { } +.nowrap { white-space: nowrap; } + /* please adjust the bgcolor to be used together with niftycorners! */ .rtop, .artop { background-color: #999999; diff --git a/usr/local/www/vpn_ipsec_phase2.php b/usr/local/www/vpn_ipsec_phase2.php index 4e4ac3c..a7eaf91 100644 --- a/usr/local/www/vpn_ipsec_phase2.php +++ b/usr/local/www/vpn_ipsec_phase2.php @@ -194,12 +194,12 @@ if ($_POST) { foreach($a_phase2 as $key => $name){ if (isset($name['mobile'])){ /* check duplicate localids only for mobile clents */ - $localid_data = ipsec_idinfo_to_cidr($name['localid']); + $localid_data = ipsec_idinfo_to_cidr($name['localid'], false, $name['mode']); $entered = array(); $entered['type'] = $pconfig['localid_type']; if (isset($pconfig['localid_address'])) $entered['address'] = $pconfig['localid_address']; if (isset($pconfig['localid_netbits'])) $entered['netbits'] = $pconfig['localid_netbits']; - $entered_localid_data = ipsec_idinfo_to_cidr($entered); + $entered_localid_data = ipsec_idinfo_to_cidr($entered, false, $pconfig['mode']); if ($localid_data == $entered_localid_data){ if (!isset($pconfig['p2index'])){ /* adding new p2 entry */ @@ -219,18 +219,18 @@ if ($_POST) { foreach($a_phase2 as $key => $name){ if (!isset($name['mobile']) && $pconfig['ikeid'] == $name['ikeid']){ /* check duplicate subnets only for given phase1 */ - $localid_data = ipsec_idinfo_to_cidr($name['localid']); - $remoteid_data = ipsec_idinfo_to_cidr($name['remoteid']); + $localid_data = ipsec_idinfo_to_cidr($name['localid'], false, $name['mode']); + $remoteid_data = ipsec_idinfo_to_cidr($name['remoteid'], false, $name['mode']); $entered_local = array(); $entered_local['type'] = $pconfig['localid_type']; if (isset($pconfig['localid_address'])) $entered_local['address'] = $pconfig['localid_address']; if (isset($pconfig['localid_netbits'])) $entered_local['netbits'] = $pconfig['localid_netbits']; - $entered_localid_data = ipsec_idinfo_to_cidr($entered_local); + $entered_localid_data = ipsec_idinfo_to_cidr($entered_local, false, $pconfig['mode']); $entered_remote = array(); $entered_remote['type'] = $pconfig['remoteid_type']; if (isset($pconfig['remoteid_address'])) $entered_remote['address'] = $pconfig['remoteid_address']; if (isset($pconfig['remoteid_netbits'])) $entered_remote['netbits'] = $pconfig['remoteid_netbits']; - $entered_remoteid_data = ipsec_idinfo_to_cidr($entered_remote); + $entered_remoteid_data = ipsec_idinfo_to_cidr($entered_remote, false, $pconfig['mode']); if ($localid_data == $entered_localid_data && $remoteid_data == $entered_remoteid_data) { if (!isset($pconfig['p2index'])){ /* adding new p2 entry */ diff --git a/usr/local/www/vpn_l2tp.php b/usr/local/www/vpn_l2tp.php index 699e468..cedcef5 100644 --- a/usr/local/www/vpn_l2tp.php +++ b/usr/local/www/vpn_l2tp.php @@ -84,6 +84,9 @@ if ($_POST) { if (($_POST['localip'] && !is_ipaddr($_POST['localip']))) { $input_errors[] = gettext("A valid server address must be specified."); } + if (is_ipaddr_configured($_POST['localip'])) { + $input_errors[] = gettext("'Server address' parameter should NOT be set to any IP address currently in use on this firewall."); + } if (($_POST['l2tp_subnet'] && !is_ipaddr($_POST['remoteip']))) { $input_errors[] = gettext("A valid remote start address must be specified."); } diff --git a/usr/local/www/vpn_openvpn_client.php b/usr/local/www/vpn_openvpn_client.php index 4a1cd5d..6452895 100644 --- a/usr/local/www/vpn_openvpn_client.php +++ b/usr/local/www/vpn_openvpn_client.php @@ -177,7 +177,7 @@ if ($_POST) { if ($result = openvpn_validate_port($pconfig['local_port'], 'Local port')) $input_errors[] = $result; - $portused = openvpn_port_used($pconfig['protocol'], $pconfig['local_port']); + $portused = openvpn_port_used($pconfig['protocol'], $pconfig['interface'], $pconfig['local_port'], $vpnid); if (($portused != $vpnid) && ($portused != 0)) $input_errors[] = gettext("The specified 'Local port' is in use. Please select another value"); } @@ -815,30 +815,30 @@ if ($savemsg) </td> </tr> <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("IPv4 Remote Network"); ?></td> + <td width="22%" valign="top" class="vncell"><?=gettext("IPv4 Remote Network/s"); ?></td> <td width="78%" class="vtable"> - <input name="remote_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['remote_network']);?>"> + <input name="remote_network" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['remote_network']);?>"> <br> - <?=gettext("This is a network that will be routed through " . + <?=gettext("These are the IPv4 networks that will be routed through " . "the tunnel, so that a site-to-site VPN can be " . - "established without manually changing the " . - "routing tables. Expressed as a CIDR range. If " . - "this is a site-to-site VPN, enter the " . - "remote LAN here. You may leave this blank to " . + "established without manually changing the routing tables. " . + "Expressed as a comma-separated list of one or more CIDR ranges. " . + "If this is a site-to-site VPN, enter the " . + "remote LAN/s here. You may leave this blank to " . "only communicate with other clients"); ?>. </td> </tr> <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Remote Network"); ?></td> + <td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Remote Network/s"); ?></td> <td width="78%" class="vtable"> - <input name="remote_networkv6" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['remote_networkv6']);?>"> + <input name="remote_networkv6" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['remote_networkv6']);?>"> <br> - <?=gettext("This is an IPv6 network that will be routed through " . + <?=gettext("These are the IPv6 networks that will be routed through " . "the tunnel, so that a site-to-site VPN can be " . - "established without manually changing the " . - "routing tables. Expressed as an IP/PREFIX. If " . - "this is a site-to-site VPN, enter the " . - "remote LAN here. You may leave this blank to " . + "established without manually changing the routing tables. " . + "Expressed as a comma-separated list of one or more IP/PREFIX. " . + "If this is a site-to-site VPN, enter the " . + "remote LAN/s here. You may leave this blank to " . "only communicate with other clients"); ?>. </td> </tr> @@ -906,7 +906,7 @@ if ($savemsg) <td> <textarea rows="6" cols="78" name="custom_options" id="custom_options"><?=htmlspecialchars($pconfig['custom_options']);?></textarea><br/> <?=gettext("Enter any additional options you would like to add to the OpenVPN client configuration here, separated by a semicolon"); ?><br/> - <?=gettext("EXAMPLE: route 10.0.0.0 255.255.255.0;"); ?> + <?=gettext("EXAMPLE:"); ?> <strong>remote server.mysite.com 1194;</strong> or <strong>remote 1.2.3.4 1194;</strong> </td> </tr> </table> diff --git a/usr/local/www/vpn_openvpn_server.php b/usr/local/www/vpn_openvpn_server.php index b9e3efd..78f08a2 100644 --- a/usr/local/www/vpn_openvpn_server.php +++ b/usr/local/www/vpn_openvpn_server.php @@ -249,7 +249,7 @@ if ($_POST) { if ($result = openvpn_validate_cidr($pconfig['local_networkv6'], 'IPv6 Local Network', true, "ipv6")) $input_errors[] = $result; - $portused = openvpn_port_used($pconfig['protocol'], $pconfig['local_port']); + $portused = openvpn_port_used($pconfig['protocol'], $pconfig['interface'], $pconfig['local_port'], $vpnid); if (($portused != $vpnid) && ($portused != 0)) $input_errors[] = gettext("The specified 'Local port' is in use. Please select another value"); @@ -540,7 +540,7 @@ function mode_change() { function autokey_change() { - if (document.iform.autokey_enable.checked) + if ((document.iform.autokey_enable != null) && (document.iform.autokey_enable.checked)) document.getElementById("autokey_opts").style.display="none"; else document.getElementById("autokey_opts").style.display=""; @@ -660,6 +660,7 @@ function tuntap_change() { document.getElementById("serverbridge_dhcp_start").style.display=""; document.getElementById("serverbridge_dhcp_end").style.display=""; document.getElementById("topology_subnet_opt").style.display="none"; + document.iform.serverbridge_dhcp.disabled = false; if (document.iform.serverbridge_dhcp.checked) { document.iform.serverbridge_interface.disabled = false; document.iform.serverbridge_dhcp_start.disabled = false; @@ -1222,56 +1223,56 @@ if ($savemsg) </td> </tr> <tr id="local_optsv4"> - <td width="22%" valign="top" class="vncell"><?=gettext("IPv4 Local Network"); ?></td> + <td width="22%" valign="top" class="vncell"><?=gettext("IPv4 Local Network/s"); ?></td> <td width="78%" class="vtable"> - <input name="local_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['local_network']);?>"> + <input name="local_network" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['local_network']);?>"> <br> - <?=gettext("This is the network that will be accessible " . - "from the remote endpoint. Expressed as a CIDR " . - "range. You may leave this blank if you don't " . + <?=gettext("These are the IPv4 networks that will be accessible " . + "from the remote endpoint. Expressed as a comma-separated list of one or more CIDR ranges. " . + "You may leave this blank if you don't " . "want to add a route to the local network " . "through this tunnel on the remote machine. " . "This is generally set to your LAN network"); ?>. </td> </tr> <tr id="local_optsv6"> - <td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Local Network"); ?></td> + <td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Local Network/s"); ?></td> <td width="78%" class="vtable"> - <input name="local_networkv6" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['local_networkv6']);?>"> + <input name="local_networkv6" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['local_networkv6']);?>"> <br> - <?=gettext("This is the IPv6 network that will be accessible " . - "from the remote endpoint. Expressed as a CIDR " . - "range. You may leave this blank if you don't " . + <?=gettext("These are the IPv6 networks that will be accessible " . + "from the remote endpoint. Expressed as a comma-separated list of one or more IP/PREFIX. " . + "You may leave this blank if you don't " . "want to add a route to the local network " . "through this tunnel on the remote machine. " . "This is generally set to your LAN network"); ?>. </td> </tr> <tr id="remote_optsv4"> - <td width="22%" valign="top" class="vncell"><?=gettext("IPv4 Remote Network"); ?></td> + <td width="22%" valign="top" class="vncell"><?=gettext("IPv4 Remote Network/s"); ?></td> <td width="78%" class="vtable"> - <input name="remote_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['remote_network']);?>"> + <input name="remote_network" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['remote_network']);?>"> <br> - <?=gettext("This is a network that will be routed through " . + <?=gettext("These are the IPv4 networks that will be routed through " . "the tunnel, so that a site-to-site VPN can be " . - "established without manually changing the " . - "routing tables. Expressed as a CIDR range. If " . - "this is a site-to-site VPN, enter the " . - "remote LAN here. You may leave this blank if " . + "established without manually changing the routing tables. " . + "Expressed as a comma-separated list of one or more CIDR ranges. " . + "If this is a site-to-site VPN, enter the " . + "remote LAN/s here. You may leave this blank if " . "you don't want a site-to-site VPN"); ?>. </td> </tr> <tr id="remote_optsv6"> - <td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Remote Network"); ?></td> + <td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Remote Network/s"); ?></td> <td width="78%" class="vtable"> - <input name="remote_networkv6" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['remote_networkv6']);?>"> + <input name="remote_networkv6" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['remote_networkv6']);?>"> <br> - <?=gettext("This is an IPv6 network that will be routed through " . + <?=gettext("These are the IPv6 networks that will be routed through " . "the tunnel, so that a site-to-site VPN can be " . - "established without manually changing the " . - "routing tables. Expressed as an IP/PREFIX. If " . - "this is a site-to-site VPN, enter the " . - "remote LAN here. You may leave this blank if " . + "established without manually changing the routing tables. " . + "Expressed as a comma-separated list of one or more IP/PREFIX. " . + "If this is a site-to-site VPN, enter the " . + "remote LAN/s here. You may leave this blank if " . "you don't want a site-to-site VPN"); ?>. </td> </tr> diff --git a/usr/local/www/vpn_pppoe.php b/usr/local/www/vpn_pppoe.php index 1b67ef2..b91e6d2 100755 --- a/usr/local/www/vpn_pppoe.php +++ b/usr/local/www/vpn_pppoe.php @@ -1,6 +1,6 @@ <?php /* - Copyright (C) 2010 Ermal Luçi + Copyright (C) 2010 Ermal Luci All rights reserved. Redistribution and use in source and binary forms, with or without @@ -75,7 +75,7 @@ if ($_GET['act'] == "del") { if ($a_pppoes[$_GET['id']]) { if ("{$g['varrun_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid'] . "-vpn.pid") killbypid("{$g['varrun_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid'] . "-vpn.pid"); - if (is_dir({$g['varetc_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid'])) + if (is_dir("{$g['varetc_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid'])) mwexec("/bin/rm -r {$g['varetc_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid']); unset($a_pppoes[$_GET['id']]); write_config(); diff --git a/usr/local/www/vpn_pptp.php b/usr/local/www/vpn_pptp.php index 59404c1..a5da316 100755 --- a/usr/local/www/vpn_pptp.php +++ b/usr/local/www/vpn_pptp.php @@ -92,6 +92,9 @@ if ($_POST) { if (($_POST['localip'] && !is_ipaddr($_POST['localip']))) { $input_errors[] = gettext("A valid server address must be specified."); } + if (is_ipaddr_configured($_POST['localip'])) { + $input_errors[] = gettext("'Server address' parameter should NOT be set to any IP address currently in use on this firewall."); + } if (!is_ipaddr($_POST['remoteip'])) { $input_errors[] = gettext("A valid remote start address must be specified."); } diff --git a/usr/local/www/widgets/widgets/gateways.widget.php b/usr/local/www/widgets/widgets/gateways.widget.php index 6b185c7..17efa58 100644 --- a/usr/local/www/widgets/widgets/gateways.widget.php +++ b/usr/local/www/widgets/widgets/gateways.widget.php @@ -40,78 +40,102 @@ $gateways_status = return_gateways_status(true); $counter = 1; ?> - <table bgcolor="#990000" width="100%" border="0" cellspacing="0" cellpadding="0"> - <tr> - <td width="10%" class="listhdrr">Name</td> - <td width="10%" class="listhdrr">Gateway</td> - <td width="10%" class="listhdrr">RTT</td> - <td width="10%" class="listhdrr">Loss</td> - <td width="30%" class="listhdrr">Status</td> - </tr> - <?php foreach ($a_gateways as $gname => $gateway) { ?> - <tr> - <td class="listlr" id="gateway<?= $counter; ?>"> - <?=$gateway['name'];?> - <?php $counter++; ?> - </td> - <td class="listr" align="center" id="gateway<?= $counter; ?>"> - <?php if (is_ipaddr($gateway['gateway'])) - echo $gateway['gateway']; - else { - if($gateway['ipprotocol'] == "inet") - echo get_interface_gateway($gateway['friendlyiface']); - if($gateway['ipprotocol'] == "inet6") - echo get_interface_gateway_v6($gateway['friendlyiface']); - } - ?> - <?php $counter++; ?> - </td> - <td class="listr" align="center" id="gateway<?= $counter; ?>"> - <?php if ($gateways_status[$gname]) - echo $gateways_status[$gname]['delay']; - else - echo gettext("Pending"); - ?> - <?php $counter++; ?> - </td> - <td class="listr" align="center" id="gateway<?= $counter; ?>"> - <?php if ($gateways_status[$gname]) - echo $gateways_status[$gname]['loss']; - else - echo gettext("Pending"); - ?> - <?php $counter++; ?> - </td> - <td class="listr" id="gateway<?=$counter?>" > - <table border="0" cellpadding="0" cellspacing="2"> - <?php if ($gateways_status[$gname]) { - if (stristr($gateways_status[$gname]['status'], "down")) { - $online = "Offline"; - $bgcolor = "#F08080"; // lightcoral - } elseif (stristr($gateways_status[$gname]['status'], "loss")) { - $online = "Packetloss"; - $bgcolor = "#F0E68C"; // khaki - } elseif (stristr($gateways_status[$gname]['status'], "delay")) { - $online = "Latency"; - $bgcolor = "#F0E68C"; // khaki - } elseif ($gateways_status[$gname]['status'] == "none") { - $online = "Online"; - $bgcolor = "#90EE90"; // lightgreen - } elseif ($gateways_status[$gname]['status'] == "") { - $online = "Pending"; - $bgcolor = "#D3D3D3"; // lightgray + +<table bgcolor="#990000" width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td class="vncellt" width="30%" id="gatewayname"> + Name + </td> + <td width="70%" class="listr"> + <table width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td width="25%" class="listhdrr">RTT</td> + <td width="25%" class="listhdrr">Loss</td> + <td width="50%" class="listhdrr">Status</td> + </tr> + </table> + </td> + </tr> + <?php foreach ($a_gateways as $gname => $gateway) { ?> + <tr> + <td class="vncellt" width="30%" id="gateway<?php echo $counter; ?>"> + <strong> + <?php echo htmlspecialchars($gateway['name']); ?> + </strong> + <?php $counter++; ?> + </td> + <td width="70%" class="listr"> + <table width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td class="vncellt" width="100%"> + <div id="gateway<?php echo $counter; ?>" style="display:inline"> + <?php + if (is_ipaddr($gateway['gateway'])) + echo htmlspecialchars($gateway['gateway']); + else { + if($gateway['ipprotocol'] == "inet") + echo htmlspecialchars(get_interface_gateway($gateway['friendlyiface'])); + if($gateway['ipprotocol'] == "inet6") + echo htmlspecialchars(get_interface_gateway_v6($gateway['friendlyiface'])); + } + $counter++; + ?> + </div> + </td> + </tr> + </table> + <table width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td width="25%" class="listlr" align="center" id="gateway<?php echo $counter; ?>"> + <?php + if ($gateways_status[$gname]) + echo htmlspecialchars($gateways_status[$gname]['delay']); + else + echo gettext("Pending"); + ?> + <?php $counter++; ?> + </td> + <td width="25%" class="listr" align="center" id="gateway<?php echo $counter; ?>"> + <?php + if ($gateways_status[$gname]) + echo htmlspecialchars($gateways_status[$gname]['loss']); + else + echo gettext("Pending"); + ?> + <?php $counter++; ?> + </td> + <td width="50%" class="listr" id="gateway<?php echo $counter ?>" > + <table border="0" cellpadding="0" cellspacing="2"> + <?php + if ($gateways_status[$gname]) { + if (stristr($gateways_status[$gname]['status'], "down")) { + $online = "Offline"; + $bgcolor = "#F08080"; // lightcoral + } elseif (stristr($gateways_status[$gname]['status'], "loss")) { + $online = "Packetloss"; + $bgcolor = "#F0E68C"; // khaki + } elseif (stristr($gateways_status[$gname]['status'], "delay")) { + $online = "Latency"; + $bgcolor = "#F0E68C"; // khaki + } elseif ($gateways_status[$gname]['status'] == "none") { + $online = "Online"; + $bgcolor = "#90EE90"; // lightgreen + } elseif ($gateways_status[$gname]['status'] == "") { + $online = "Pending"; + $bgcolor = "#D3D3D3"; // lightgray + } + } else { + $online = gettext("Unknown"); + $bgcolor = "#ADD8E6"; // lightblue } - } else { - $online = gettext("Unknown"); - $bgcolor = "#ADD8E6"; // lightblue - } - echo "<tr><td bgcolor=\"$bgcolor\"> $online </td></tr>\n"; - $counter++; - ?> - </table> - </td> - </tr> - <?php - } - ?> - </table> + echo "<tr><td bgcolor=\"$bgcolor\"> $online </td></tr>\n"; + $counter++; + ?> + </table> + </td> + </tr> + </table> + </td> + </tr> + <?php } // foreach ?> +</table> diff --git a/usr/local/www/wizards/openvpn_wizard.inc b/usr/local/www/wizards/openvpn_wizard.inc index 006ee32..86dec52 100644 --- a/usr/local/www/wizards/openvpn_wizard.inc +++ b/usr/local/www/wizards/openvpn_wizard.inc @@ -366,7 +366,7 @@ function step10_submitphpaction() { if ($result = openvpn_validate_cidr($_POST['localnet'], 'Local Network', true, "ipv4")) $input_errors[] = $result; - $portused = openvpn_port_used($_POST['protocol'], $_POST['localport']); + $portused = openvpn_port_used($_POST['protocol'], $_POST['interface'], $_POST['localport']); if ($portused != 0) $input_errors[] = "The specified 'Local port' is in use. Please select another value"; diff --git a/usr/local/www/xmlrpc.php b/usr/local/www/xmlrpc.php index 1dda1ad..af58f67 100755 --- a/usr/local/www/xmlrpc.php +++ b/usr/local/www/xmlrpc.php @@ -44,16 +44,18 @@ require("xmlrpc_server.inc"); require("xmlrpc.inc"); require("array_intersect_key.inc"); -/* grab sync to ip if enabled */ -if ($config['hasync']) { - $synchronizetoip = $hasync['synchronizetoip']; -} - -if($synchronizetoip) { - if($synchronizetoip == $_SERVER['REMOTE_ADDR']) { - log_error(gettext("Disallowing CARP sync loop.")); - die; +function xmlrpc_loop_detect() { + global $config; + + /* grab sync to ip if enabled */ + if ($config['hasync']) + $synchronizetoip = $config['hasync']['synchronizetoip']; + if($synchronizetoip) { + if($synchronizetoip == $_SERVER['REMOTE_ADDR']) + return true; } + + return false; } $xmlrpc_g = array( @@ -138,6 +140,9 @@ $backup_config_section_sig = array( function backup_config_section_xmlrpc($raw_params) { global $config, $xmlrpc_g; + if (xmlrpc_loop_detect()) + log_error("Disallowing CARP sync loop"); + $params = xmlrpc_params_to_php($raw_params); if(!xmlrpc_auth($params)) { xmlrpc_authfail(); @@ -161,6 +166,9 @@ $restore_config_section_sig = array( function restore_config_section_xmlrpc($raw_params) { global $config, $xmlrpc_g; + if (xmlrpc_loop_detect()) + log_error("Disallowing CARP sync loop"); + $params = xmlrpc_params_to_php($raw_params); if(!xmlrpc_auth($params)) { xmlrpc_authfail(); @@ -278,6 +286,9 @@ $merge_config_section_sig = array( function merge_installedpackages_section_xmlrpc($raw_params) { global $config, $xmlrpc_g; + if (xmlrpc_loop_detect()) + log_error("Disallowing CARP sync loop"); + $params = xmlrpc_params_to_php($raw_params); if(!xmlrpc_auth($params)) { xmlrpc_authfail(); @@ -302,6 +313,10 @@ $merge_config_section_sig = array( function merge_config_section_xmlrpc($raw_params) { global $config, $xmlrpc_g; + + if (xmlrpc_loop_detect()) + log_error("Disallowing CARP sync loop"); + $params = xmlrpc_params_to_php($raw_params); if(!xmlrpc_auth($params)) { xmlrpc_authfail(); @@ -356,6 +371,9 @@ $carp_configure_sig = array( function interfaces_carp_configure_xmlrpc($raw_params) { global $xmlrpc_g; + if (xmlrpc_loop_detect()) + log_error("Disallowing CARP sync loop"); + $params = xmlrpc_params_to_php($raw_params); if(!xmlrpc_auth($params)) { xmlrpc_authfail(); |