]> git.gsnw.org Git - m0n0chwall.git/commitdiff
Import m0n0wall 1.2b8 files.
authormkasper <mkasper@e36fee2c-cc09-0410-a7cc-ebac5c6737de>
Sun, 8 Jan 2006 10:31:12 +0000 (10:31 +0000)
committermkasper <mkasper@e36fee2c-cc09-0410-a7cc-ebac5c6737de>
Sun, 8 Jan 2006 10:31:12 +0000 (10:31 +0000)
git-svn-id: https://svn.m0n0.ch/wall/trunk@19 e36fee2c-cc09-0410-a7cc-ebac5c6737de

120 files changed:
captiveportal/index.php
captiveportal/radius_accounting.inc
etc/rc
etc/rc.firmware
etc/rc.initial
phpconf/inc/captiveportal.inc
phpconf/inc/config.inc
phpconf/inc/filter.inc
phpconf/inc/functions.inc
phpconf/inc/globals.inc
phpconf/inc/interfaces.inc
phpconf/inc/services.inc
phpconf/inc/shaper.inc
phpconf/inc/system.inc
phpconf/inc/util.inc
phpconf/inc/vpn.inc
phpconf/inc/xmlparse.inc
phpconf/rc.banner
phpconf/rc.bootup
phpconf/rc.initial.defaults
phpconf/rc.initial.password
phpconf/rc.initial.ping
phpconf/rc.initial.reboot
phpconf/rc.initial.setlanip
phpconf/rc.initial.setports
phpconf/rc.newwanip
phpconf/rc.prunecaptiveportal
webgui/cal.gif [new file with mode: 0644]
webgui/datetimepicker.js [new file with mode: 0644]
webgui/diag_backup.php
webgui/diag_defaults.php
webgui/diag_dhcp_leases.php
webgui/diag_ipsec_sad.php
webgui/diag_ipsec_spd.php
webgui/diag_logs.php
webgui/diag_logs_dhcp.php
webgui/diag_logs_filter.php
webgui/diag_logs_portal.php [new file with mode: 0644]
webgui/diag_logs_settings.php
webgui/diag_logs_vpn.php
webgui/diag_ping.php
webgui/diag_resetstate.php
webgui/exec.php
webgui/exec_raw.php
webgui/fbegin.inc
webgui/fend.inc
webgui/firewall_aliases.php
webgui/firewall_aliases_edit.php
webgui/firewall_nat.php
webgui/firewall_nat_1to1.php
webgui/firewall_nat_1to1_edit.php
webgui/firewall_nat_edit.php
webgui/firewall_nat_out.php
webgui/firewall_nat_out_edit.php
webgui/firewall_nat_server.php
webgui/firewall_nat_server_edit.php
webgui/firewall_rules.php
webgui/firewall_rules_edit.php
webgui/firewall_shaper.php
webgui/firewall_shaper_edit.php
webgui/firewall_shaper_magic.php
webgui/firewall_shaper_pipes.php
webgui/firewall_shaper_pipes_edit.php
webgui/firewall_shaper_queues.php
webgui/firewall_shaper_queues_edit.php
webgui/graph.php
webgui/graph_cpu.php [new file with mode: 0644]
webgui/gui.css
webgui/guiconfig.inc
webgui/ifstats.cgi [deleted file]
webgui/index.php
webgui/interfaces_assign.php
webgui/interfaces_lan.php
webgui/interfaces_opt.php
webgui/interfaces_vlan.php
webgui/interfaces_vlan_edit.php
webgui/interfaces_wan.php
webgui/interfaces_wlan.inc
webgui/license.php
webgui/reboot.php
webgui/services_captiveportal.php
webgui/services_captiveportal_ip.php
webgui/services_captiveportal_ip_edit.php
webgui/services_captiveportal_mac.php
webgui/services_captiveportal_mac_edit.php
webgui/services_captiveportal_users.php [new file with mode: 0644]
webgui/services_dhcp.php
webgui/services_dhcp_edit.php
webgui/services_dhcp_relay.php
webgui/services_dnsmasq.php
webgui/services_dnsmasq_edit.php
webgui/services_dyndns.php
webgui/services_proxyarp.php
webgui/services_proxyarp_edit.php
webgui/services_snmp.php
webgui/services_wol.php
webgui/services_wol_edit.php
webgui/stats.cgi [new file with mode: 0644]
webgui/status_captiveportal.php
webgui/status_graph.php
webgui/status_graph_cpu.php [new file with mode: 0644]
webgui/status_interfaces.php
webgui/status_wireless.php
webgui/system.php
webgui/system_advanced.php
webgui/system_firmware.php
webgui/system_routes.php
webgui/system_routes_edit.php
webgui/uploadconfig.php [new file with mode: 0644]
webgui/vpn_ipsec.php
webgui/vpn_ipsec_edit.php
webgui/vpn_ipsec_keys.php
webgui/vpn_ipsec_keys_edit.php
webgui/vpn_ipsec_mobile.php
webgui/vpn_openvpn.php
webgui/vpn_openvpn_cli.php
webgui/vpn_openvpn_cli_edit.php
webgui/vpn_pptp.php
webgui/vpn_pptp_users.php
webgui/vpn_pptp_users_edit.php

index 497e5069d625fd240243e9264b240f19e4170c49..28cecd3e3e31d6714a8576ca0dbb7c5d2d0c34a4 100644 (file)
@@ -4,7 +4,7 @@
        index.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -32,8 +32,8 @@
 require("globals.inc");
 require("util.inc");
 require("config.inc");
-require("radius_authentication.inc") ;
-require("radius_accounting.inc") ;
+require("radius_authentication.inc");
+require("radius_accounting.inc");
 
 header("Expires: 0");
 header("Cache-Control: no-store, no-cache, must-revalidate");
@@ -73,21 +73,41 @@ if ($clientmac && portal_mac_fixed($clientmac)) {
                                                                                  $radiusservers[0]['port'],
                                                                                  $radiusservers[0]['key']);
                if ($auth_val == 2) {
+                       captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,"LOGIN");
                        $sessionid = portal_allow($clientip, $clientmac, $_POST['auth_user']);
                        if (isset($config['captiveportal']['radacct_enable']) && isset($radiusservers[0])) {
                                $auth_val = RADIUS_ACCOUNTING_START($_POST['auth_user'],
                                                                                                        $sessionid,
                                                                                                        $radiusservers[0]['ipaddr'],
                                                                                                        $radiusservers[0]['acctport'],
-                                                                                                       $radiusservers[0]['key']);
+                                                                                                       $radiusservers[0]['key'],
+                                                                                                       $clientip);
                        }
                } else {
+                       captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,"FAILURE");
                        readfile("{$g['varetc_path']}/captiveportal-error.html");
                }
        } else {
                readfile("{$g['varetc_path']}/captiveportal-error.html");
        }
+       
+} else if ($_POST['accept'] && $config['captiveportal']['auth_method'] == "local") {
+
+       //check against local usermanager
 
+       //erase expired accounts
+       if(trim($config['users'][$_POST['auth_user']]['expirationdate'])!="" && strtotime("-1 day")>strtotime($config['users'][$_POST['auth_user']]['expirationdate'])){
+               unset($config['users'][$_POST['auth_user']]);
+               write_config();
+       }
+
+       if($config['users'][$_POST['auth_user']]['password']==md5($_POST['auth_pass'])){
+               captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,"LOGIN");
+               portal_allow($clientip, $clientmac,$_POST['auth_user'],0,0);
+       } else {
+               captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,"FAILURE");
+               readfile("{$g['varetc_path']}/captiveportal-error.html");
+       }
 } else if ($_POST['accept'] && $clientip) {
        portal_allow($clientip, $clientmac, "unauthenticated");
 } else if ($_POST['logout_id']) {
@@ -209,7 +229,8 @@ function portal_allow($clientip,$clientmac,$clientuser) {
                                                                           $cpdb[$i][0], // start time
                                                                           $radiusservers[0]['ipaddr'],
                                                                           $radiusservers[0]['acctport'],
-                                                                          $radiusservers[0]['key']);
+                                                                          $radiusservers[0]['key'],
+                                                                          $clientip);
                        }
                        mwexec("/sbin/ipfw delete " . $cpdb[$i][1] . " " . ($cpdb[$i][1]+10000));
                        unset($cpdb[$i]);
@@ -385,9 +406,11 @@ function disconnect_client($sessionid) {
                                                                           $cpdb[$i][0], // start time
                                                                           $radiusservers[0]['ipaddr'],
                                                                           $radiusservers[0]['acctport'],
-                                                                          $radiusservers[0]['key']);
+                                                                          $radiusservers[0]['key'],
+                                                                          $cpdb[$i][2]);
                        }
                        mwexec("/sbin/ipfw delete " . $cpdb[$i][1] . " " . ($cpdb[$i][1]+10000));
+                       captiveportal_logportalauth($cpdb[$i][4],$cpdb[$i][3],$cpdb[$i][2],"LOGOUT");
                        unset($cpdb[$i]);
                        break;
                }
@@ -404,4 +427,15 @@ function disconnect_client($sessionid) {
        
        portal_unlock();
 }
+
+/* log successful captive portal authentication to syslog */
+/* part of this code from php.net */
+function captiveportal_logportalauth($user,$mac,$ip,$status) {
+       define_syslog_variables();
+       openlog("logportalauth", LOG_PID, LOG_LOCAL4);
+       // Log it
+       syslog(LOG_INFO, "$status: $user, $mac, $ip");
+       closelog();
+}
+
 ?>
index 7004971ab0db07b4bb1bbdd987e89665840f862d..4000fcc7d5d60b606a245bf1b2fe279196b07213 100644 (file)
        CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
        ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
        POSSIBILITY OF SUCH DAMAGE.
-*/
 
+       // This version of radius_accounting.inc has been modified by
+       // Rob Parker <rob.parker@keycom.co.uk>. Changes made include:
+       // * now sends Framed-IP-Address (client IP)
+       // * now sends Called-Station-ID (NAS IP)
+       // * now sends Calling-Station-ID (client IP)
+*/
 
-function RADIUS_ACCOUNTING_START($username,$sessionid,$radiusip,$radiusport,$radiuskey) {
+function RADIUS_ACCOUNTING_START($username,$sessionid,$radiusip,$radiusport,$radiuskey,$clientip) {
        $sharedsecret=$radiuskey ;
        # $debug = 1 ;
 
@@ -44,6 +49,14 @@ function RADIUS_ACCOUNTING_START($username,$sessionid,$radiusip,$radiusport,$rad
        /* set 5 second timeout on socket i/o */
        stream_set_timeout($fd, 5) ;
 
+       $nas_ip_address = get_nas_ip();
+
+       if(!isset($clientip)) {
+               //if there's no client ip, we'll need to use the NAS ip
+               $clientip=$nas_ip_address;
+       }
+       $ip_exp=explode(".",$clientip);
+
        if ($debug)
            echo "<br>radius-port: $radiusport<br>radius-host: $radiusip<br>username: $username<hr>\n";
 
@@ -58,11 +71,12 @@ function RADIUS_ACCOUNTING_START($username,$sessionid,$radiusip,$radiusport,$rad
                6+                              // nasPortType
                6+                              // Acct Status Type
                6+                              // Acct RADIUS Authenticated
-               2+strlen($sessionid);   // Acct SessionID
+               2+strlen($sessionid)+   // Acct SessionID
+               6;                              // Framed-IP-Address
 
        //          v   v   v     v   v   v     v     v     v     1   v
        // Line #   1   2   3     4   5   6     7     8     9     0   E
-       $data=pack("CCCCNNNNCCCCCCCCa*CCa*CCCCCCCCCCCCCCCCCCCCCCCCCCa*",
+       $data=pack("CCCCNNNNCCCCCCCCa*CCa*CCCCCCCCCCCCCCCCCCCCCCCCCCa*CCCCCC",
            4,$thisidentifier,$length/256,$length%256,          // header
            0,0,0,0,                                            // authcode
            6,6,0,0,0,1,                                        // service type
@@ -72,7 +86,8 @@ function RADIUS_ACCOUNTING_START($username,$sessionid,$radiusip,$radiusport,$rad
            61,6,0,0,0,15,                                              // nasPortType = Ethernet
                40,6,0,0,0,1,                                           // Acct Status Type = Start
                45,6,0,0,0,1,                                           // Acct RADIUS Authenticated
-               44,2+strlen($sessionid),$sessionid      // Acct Session ID
+               44,2+strlen($sessionid),$sessionid,     // Acct Session ID
+               8,6,$ip_exp[0],$ip_exp[1],$ip_exp[2],$ip_exp[3] //Framed-IP-Address
            );
 
        /* Generate Accounting Request Authenticator */
@@ -80,7 +95,7 @@ function RADIUS_ACCOUNTING_START($username,$sessionid,$radiusip,$radiusport,$rad
 
        //          v   v v     v   v   v     v     v     v     1   v
        // Line #   1   2 3     4   5   6     7     8     9     0   E
-       $data=pack("CCCCH*CCCCCCCCa*CCa*CCCCCCCCCCCCCCCCCCCCCCCCCCa*",
+       $data=pack("CCCCH*CCCCCCCCa*CCa*CCCCCCCCCCCCCCCCCCCCCCCCCCa*CCCCCC",
            4,$thisidentifier,$length/256,$length%256,          // header
            $RA,                                                // authcode
            6,6,0,0,0,1,                                        // service type
@@ -90,7 +105,8 @@ function RADIUS_ACCOUNTING_START($username,$sessionid,$radiusip,$radiusport,$rad
            61,6,0,0,0,15,                                              // nasPortType = Ethernet
                40,6,0,0,0,1,                                           // Acct Status Type = Start
                45,6,0,0,0,1,                                           // Acct RADIUS Authenticated
-               44,2+strlen($sessionid),$sessionid      // Acct Session ID
+               44,2+strlen($sessionid),$sessionid,     // Acct Session ID
+               8,6,$ip_exp[0],$ip_exp[1],$ip_exp[2],$ip_exp[3] //Framed-IP-Address
            );
 
        if($debug) {
@@ -119,7 +135,7 @@ function RADIUS_ACCOUNTING_START($username,$sessionid,$radiusip,$radiusport,$rad
        // See RFC2866 for this.
 }
 
-function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radiusip,$radiusport,$radiuskey) {
+function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radiusip,$radiusport,$radiuskey,$clientip) {
        $sharedsecret=$radiuskey ;
        # $debug = 1 ;
 
@@ -146,6 +162,14 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius
        /* set 5 second timeout on socket i/o */
        stream_set_timeout($fd, 5) ;
 
+       $nas_ip_address = get_nas_ip();
+
+       if(!isset($clientip)) {
+               //if there's no client ip, we'll need to use the NAS ip
+               $clientip=$nas_ip_address;
+       }
+       $ip_exp=explode(".",$clientip);
+
        if ($debug)
            echo "<br>radius-port: $radiusport<br>radius-host: $radiusip<br>username: $username<hr>\n";
 
@@ -166,11 +190,15 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius
                6+                              // input bytes
                6+                              // input packets
                6+                              // output bytes
-               6;                              // output packets
+               6+                              // output packets
+               2+strlen($nas_ip_address)+              //Called-Station-ID
+               2+strlen($clientip)+    //Calling-Station-ID
+
+               6;                      //Framed-IP-Address
 
        //          v   v   v     v   v   v     v     v     v     1   1  1  1  1  1  1  v
        // Line #   1   2   3     4   5   6     7     8     9     0   1  2  3  4  5  6  E
-       $data=pack("CCCCNNNNCCCCCCCCa*CCa*CCCCCCCCCCCCCCCCCCCCCCCCCCa*CCNCCNCCNCCNCCNCCN",
+       $data=pack("CCCCNNNNCCCCCCCCa*CCa*CCCCCCCCCCCCCCCCCCCCCCCCCCa*CCNCCNCCNCCNCCNCCNCCa*CCa*CCCCCC",
            4,$thisidentifier,$length/256,$length%256,          // header
            0,0,0,0,                                            // authcode
            6,6,0,0,0,1,                                        // service type
@@ -186,7 +214,11 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius
                42,6,$input_bytes,      // Input Octets
                47,6,$input_pkts,       // Input Packets
                43,6,$output_bytes, // Output Octets
-               48,6,$output_pkts       // Output Packets
+               48,6,$output_pkts,      // Output Packets
+               30,2+strlen($nas_ip_address),$nas_ip_address,   //Called-Station-ID
+               31,2+strlen($clientip),$clientip,                               //Calling-Station-ID
+
+               8,6,$ip_exp[0],$ip_exp[1],$ip_exp[2],$ip_exp[3] //Framed-IP-Address
            );
 
        /* Generate Accounting Request Authenticator */
@@ -194,7 +226,7 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius
 
        //          v   v v     v   v   v     v     v     v     1   1  1  1  1  1  1  v
        // Line #   1   2 3     4   5   6     7     8     9     0   1  2  3  4  5  6  E
-       $data=pack("CCCCH*CCCCCCCCa*CCa*CCCCCCCCCCCCCCCCCCCCCCCCCCa*CCNCCNCCNCCNCCNCCN",
+       $data=pack("CCCCH*CCCCCCCCa*CCa*CCCCCCCCCCCCCCCCCCCCCCCCCCa*CCNCCNCCNCCNCCNCCNCCa*CCa*CCCCCC",
            4,$thisidentifier,$length/256,$length%256,          // header
            $RA,                                                // authcode
            6,6,0,0,0,1,                                        // service type
@@ -210,7 +242,11 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius
                42,6,$input_bytes,      // Input Octets
                47,6,$input_pkts,       // Input Packets
                43,6,$output_bytes, // Output Octets
-               48,6,$output_pkts       // Output Packets
+               48,6,$output_pkts,      // Output Packets
+               30,2+strlen($nas_ip_address),$nas_ip_address,   //Called-Station-ID
+               31,2+strlen($clientip),$clientip,                               //Calling-Station-ID
+
+               8,6,$ip_exp[0],$ip_exp[1],$ip_exp[2],$ip_exp[3] //Framed-IP-Address
            );
 
        if($debug) {
@@ -238,4 +274,12 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius
        // 5 -> Accounting-Response
        // See RFC2866 for this.
 }
+
+function get_nas_ip() {
+       global $config;
+       
+       /* static WAN IP address */
+       return $config['interfaces']['wan']['ipaddr'];
+}
+
 ?>
diff --git a/etc/rc b/etc/rc
index ddae7c56b0ee3249695eb9c8d30903f7c51d9ee6..eed4c3554141697e047209dd432c0b32282cdc9e 100644 (file)
--- a/etc/rc
+++ b/etc/rc
@@ -1,9 +1,9 @@
 #!/bin/sh
 
 # /etc/rc
-# part of m0n0wall (http://neon1.net/m0n0wall)
+# part of m0n0wall (http://m0n0.ch/wall)
 #
-# Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+# Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
 # All rights reserved.
 
 stty status '^T'
@@ -25,6 +25,7 @@ mkdir /var/run /var/log /var/etc /var/db
 clog -i -s 262144 /var/log/system.log
 clog -i -s 262144 /var/log/filter.log
 clog -i -s 65536 /var/log/vpn.log
+clog -i -s 32768 /var/log/portalauth.log
 clog -i -s 32768 /var/log/dhcpd.log
 chmod 0600 /var/log/*.log
 
@@ -37,7 +38,7 @@ cd /var/run && cp /dev/null utmp && chmod 644 utmp
 dev_mkdb
 
 # Run ldconfig
-/sbin/ldconfig -elf /usr/lib
+/sbin/ldconfig -elf /usr/lib /usr/local/lib
 
 # let the PHP-based configuration subsystem set up the system now
 /etc/rc.bootup
index 56fc7a43cf16b308b7a48b8b107835cf1bdf6e3c..2b28070c890f7866af866d1f141381690baed407 100644 (file)
@@ -1,9 +1,9 @@
 #!/bin/sh
 
 # /etc/rc.firmware
-# part of m0n0wall (http://neon1.net/m0n0wall)
+# part of m0n0wall (http://m0n0.ch/wall)
 #
-# Copyright (C) 2003 Manuel Kasper <mk@neon1.net>.
+# Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
 # All rights reserved.
 
 CFDEVICE=`cat /var/etc/cfdevice`
@@ -14,7 +14,7 @@ fi
 
 case $1 in
 enable)
-       /sbin/mount_mfs -s 15360 -T qp120at -b 8192 -f 1024 dummy /ftmp \
+       /sbin/mount_mfs -s 16384 -T qp120at -b 8192 -f 1024 dummy /ftmp \
                > /dev/null 2>&1
        ;;
 upgrade)
index d311fea24aac5add51d2f84a5c6e7384e9e72bdb..8b6c306fd0d86352ba82328a338ec2e9b52b4d3e 100644 (file)
@@ -1,9 +1,9 @@
 #!/bin/sh
 
 # /etc/rc.initial
-# part of m0n0wall (http://neon1.net/m0n0wall)
+# part of m0n0wall (http://m0n0.ch/wall)
 #
-# Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+# Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
 # All rights reserved.
 
 # make sure the user can't kill us by pressing Ctrl-C
index f12f1daa009fa262de8df839306da482ac2e885a..d02363c29eea8c37aa2f08fde443a2465ed7af74 100644 (file)
@@ -3,7 +3,7 @@
        captiveportal.inc
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
        ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
        POSSIBILITY OF SUCH DAMAGE.
+
+       This version of captiveportal.inc has been modified by Rob Parker
+       <rob.parker@keycom.co.uk> to include changes for per-user bandwidth management
+       via returned RADIUS attributes. This page has been modified to delete any
+       added rules which may have been created by other per-user code (index.php, etc).
+       These changes are (c) 2004 Keycom PLC.
 */
        
 /* include all configuration functions */
@@ -56,7 +62,7 @@ function captiveportal_configure() {
                mwexec("/sbin/kldload ipfw");
                
                /* stop accounting on all clients */
-               captiveportal_radius_stop_all() ;
+               captiveportal_radius_stop_all();
 
                /* remove old information */
                unlink_if_exists("{$g['vardb_path']}/captiveportal.nextrule");
@@ -180,21 +186,22 @@ EOD;
                        "/etc/rc.prunecaptiveportal");
                
                /* generate passthru mac database */
-               captiveportal_passthrumac_configure() ;
+               captiveportal_passthrumac_configure();
                /* create allowed ip database and insert ipfw rules to make it so */
-               captiveportal_allowedip_configure() ;
+               captiveportal_allowedip_configure();
 
                /* generate radius server database */
-               if($config['captiveportal']['radiusip']) {
-                       $radiusip = $config['captiveportal']['radiusip'] ;
+               if ($config['captiveportal']['radiusip'] && (!isset($config['captiveportal']['auth_method']) ||
+                               ($config['captiveportal']['auth_method'] == "radius"))) {
+                       $radiusip = $config['captiveportal']['radiusip'];
 
-                       if($config['captiveportal']['radiusport'])
-                               $radiusport = $config['captiveportal']['radiusport'] ;
+                       if ($config['captiveportal']['radiusport'])
+                               $radiusport = $config['captiveportal']['radiusport'];
                        else
                                $radiusport = 1812;
 
-                       if($config['captiveportal']['radiusacctport'])
-                               $radiusacctport = $config['captiveportal']['radiusacctport'] ;
+                       if ($config['captiveportal']['radiusacctport'])
+                               $radiusacctport = $config['captiveportal']['radiusacctport'];
                        else
                                $radiusacctport = 1813;
 
@@ -205,20 +212,22 @@ EOD;
                                printf("Error: cannot open radius DB file in captiveportal_configure().\n");
                                return 1;
                        } else {
-                               fwrite($fd,$radiusip . "," . $radiusport . "," . $radiusacctport . "," . $radiuskey) ;
+                               fwrite($fd,$radiusip . "," . $radiusport . "," . $radiusacctport . "," . $radiuskey);
                        }
-                       fclose($fd) ;
+                       fclose($fd);
                }
 
-
                if ($g['booting'])
                        echo "done\n";
                
        } else {
                killbypid("{$g['varrun_path']}/mini_httpd.cp.pid");
                killbypid("{$g['varrun_path']}/minicron.pid");
-               captiveportal_radius_stop_all() ;
+
+               captiveportal_radius_stop_all();
+
                mwexec("/sbin/sysctl net.link.ether.ipfw=0");
+
                if (!isset($config['shaper']['enable'])) {
                        /* unload ipfw */
                        mwexec("/sbin/kldunload ipfw");
@@ -359,17 +368,8 @@ function captiveportal_prune_old() {
                }
                
                if ($timedout) {
-                       /* this client needs to be deleted - remove ipfw rules */
-                       if (isset($config['captiveportal']['radacct_enable']) && isset($radiusservers[0])) {
-                               RADIUS_ACCOUNTING_STOP($cpdb[$i][1], // ruleno
-                                                                          $cpdb[$i][4], // username
-                                                                          $cpdb[$i][5], // sessionid
-                                                                          $cpdb[$i][0], // start time
-                                                                          $radiusservers[0]['ipaddr'],
-                                                                          $radiusservers[0]['acctport'],
-                                                                          $radiusservers[0]['key']);
-                       }
-                       mwexec("/sbin/ipfw delete " . $cpdb[$i][1] . " " . ($cpdb[$i][1]+10000));
+                       captiveportal_disconnect($cpdb[$i], $radiusservers);
+                       captiveportal_logportalauth($cpdb[$i][4], $cpdb[$i][3], $cpdb[$i][2], "TIMEOUT");
                        unset($cpdb[$i]);
                }
        }
@@ -380,6 +380,34 @@ function captiveportal_prune_old() {
        captiveportal_unlock();
 }
 
+/* remove a single client according to the DB entry */
+function captiveportal_disconnect($dbent, $radiusservers) {
+       
+       global $g, $config;
+       
+       /* this client needs to be deleted - remove ipfw rules */
+       if (isset($config['captiveportal']['radacct_enable']) && isset($radiusservers[0])) {
+               RADIUS_ACCOUNTING_STOP($dbent[1], // ruleno
+                                                          $dbent[4], // username
+                                                          $dbent[5], // sessionid
+                                                          $dbent[0], // start time
+                                                          $radiusservers[0]['ipaddr'],
+                                                          $radiusservers[0]['acctport'],
+                                                          $radiusservers[0]['key'],
+                                                          $dbent[2]); //clientip
+       }
+       
+       mwexec("/sbin/ipfw delete " . $dbent[1] . " " . ($dbent[1]+10000));
+       
+       //KEYCOM: we need to delete +40500 and +45500 as well...
+       //these are the rule numbers we use to control traffic shaping for each logged in user via captive portal
+       //we only need to remove our rules if peruserbw is turned on.
+       if (isset($config['captiveportal']['peruserbw'])) {
+               mwexec("/sbin/ipfw delete " . ($dbent[1]+40500));
+               mwexec("/sbin/ipfw delete " . ($dbent[1]+45500));
+       }
+}
+
 /* remove a single client by ipfw rule number */
 function captiveportal_disconnect_client($id) {
        
@@ -394,17 +422,8 @@ function captiveportal_disconnect_client($id) {
        /* find entry */        
        for ($i = 0; $i < count($cpdb); $i++) {
                if ($cpdb[$i][1] == $id) {
-                       /* this client needs to be deleted - remove ipfw rules */
-                       if (isset($config['captiveportal']['radacct_enable']) && isset($radiusservers[0])) {
-                               RADIUS_ACCOUNTING_STOP($cpdb[$i][1], // ruleno
-                                                                          $cpdb[$i][4], // username
-                                                                          $cpdb[$i][5], // sessionid
-                                                                          $cpdb[$i][0], // start time
-                                                                          $radiusservers[0]['ipaddr'],
-                                                                          $radiusservers[0]['acctport'],
-                                                                          $radiusservers[0]['key']);
-                       }
-                       mwexec("/sbin/ipfw delete " . $cpdb[$i][1] . " " . ($cpdb[$i][1]+10000));
+                       captiveportal_disconnect($cpdb[$i], $radiusservers);
+                       captiveportal_logportalauth($cpdb[$i][4], $cpdb[$i][3], $cpdb[$i][2], "DISCONNECT");
                        unset($cpdb[$i]);
                        break;
                }
@@ -420,8 +439,8 @@ function captiveportal_disconnect_client($id) {
 function captiveportal_radius_stop_all() {
        global $g, $config;
 
-       captiveportal_lock() ;
-       $cpdb = captiveportal_read_db() ;
+       captiveportal_lock();
+       $cpdb = captiveportal_read_db();
        
        $radiusservers = captiveportal_get_radius_servers();
        
@@ -433,25 +452,27 @@ function captiveportal_radius_stop_all() {
                                                                   $cpdb[$i][0], // start time
                                                                   $radiusservers[0]['ipaddr'],
                                                                   $radiusservers[0]['acctport'],
-                                                                  $radiusservers[0]['key']);
+                                                                  $radiusservers[0]['key'],
+                                                                  $cpdb[$i][2]); //clientip
                }
        }
-       captiveportal_unlock() ;
+       captiveportal_unlock();
 }
 
 function captiveportal_passthrumac_configure() {
        global $config, $g;
        
+       captiveportal_lock();
+       
        /* clear out passthru macs, if necessary */
-       if (file_exists("{$g['vardb_path']}/captiveportal_mac.db")) {
-               unlink("{$g['vardb_path']}/captiveportal_mac.db");
-       }
+       unlink_if_exists("{$g['vardb_path']}/captiveportal_mac.db");
        
        if (is_array($config['captiveportal']['passthrumac'])) {
                
                $fd = @fopen("{$g['vardb_path']}/captiveportal_mac.db", "w");
                if (!$fd) {
                        printf("Error: cannot open passthru mac DB file in captiveportal_passthrumac_configure().\n");
+                       captiveportal_unlock();
                        return 1;               
                }
                
@@ -463,13 +484,15 @@ function captiveportal_passthrumac_configure() {
                fclose($fd); 
        }
        
+       captiveportal_unlock();
+       
        return 0;
 }
 
 function captiveportal_allowedip_configure() {
        global $config, $g;
        
-       captiveportal_lock() ;
+       captiveportal_lock();
 
        /* clear out existing allowed ips, if necessary */
        if (file_exists("{$g['vardb_path']}/captiveportal_ip.db")) {
@@ -477,13 +500,13 @@ function captiveportal_allowedip_configure() {
                if ($fd) {
                        while (!feof($fd)) {
                                $line = trim(fgets($fd));
-                               if($line) {
+                               if ($line) {
                                        list($ip,$rule) = explode(",",$line);
-                                       mwexec("/sbin/ipfw delete $rule") ;
+                                       mwexec("/sbin/ipfw delete $rule");
                                }       
                        }
                }
-               fclose($fd) ;
+               fclose($fd);
                unlink("{$g['vardb_path']}/captiveportal_ip.db");
        }
 
@@ -498,22 +521,25 @@ function captiveportal_allowedip_configure() {
                $fd = @fopen("{$g['vardb_path']}/captiveportal_ip.db", "w");
                if (!$fd) {
                        printf("Error: cannot open allowed ip DB file in captiveportal_allowedip_configure().\n");
-                       captiveportal_unlock() ;
+                       captiveportal_unlock();
                        return 1;               
                }
                
                foreach ($config['captiveportal']['allowedip'] as $ipent) {
+               
                        /* record allowed ip so it can be recognized and removed later */
                        fwrite($fd, $ipent['ip'] . "," . $ruleno ."\n");
+                       
                        /* insert ipfw rule to allow ip thru */
-                       if($ipent['dir'] == "from") {
-                               mwexec("/sbin/ipfw add $ruleno set 2 skipto 50000 ip from ".$ipent['ip']." to any in") ;
-                               mwexec("/sbin/ipfw add $ruleno set 2 skipto 50000 ip from any to ".$ipent['ip']." out") ;
+                       if ($ipent['dir'] == "from") {
+                               mwexec("/sbin/ipfw add $ruleno set 2 skipto 50000 ip from " . $ipent['ip'] . " to any in");
+                               mwexec("/sbin/ipfw add $ruleno set 2 skipto 50000 ip from any to " . $ipent['ip'] . " out");
                        } else {
-                               mwexec("/sbin/ipfw add $ruleno set 2 skipto 50000 ip from any to ".$ipent['ip']." in") ;
-                               mwexec("/sbin/ipfw add $ruleno set 2 skipto 50000 ip from ".$ipent['ip']." to any out") ;
+                               mwexec("/sbin/ipfw add $ruleno set 2 skipto 50000 ip from any to " . $ipent['ip'] . " in");
+                               mwexec("/sbin/ipfw add $ruleno set 2 skipto 50000 ip from " . $ipent['ip'] . " to any out");
                        }
-                       $ruleno++ ;
+                       
+                       $ruleno++;
                        if ($ruleno > 19899)
                                $ruleno = 10000;
                }
@@ -528,7 +554,7 @@ function captiveportal_allowedip_configure() {
                }
        }
        
-       captiveportal_unlock() ;
+       captiveportal_unlock();
        return 0;
 }
 
@@ -640,4 +666,14 @@ function captiveportal_unlock() {
                unlink($lockfile);
 }
 
+/* log successful captive portal authentication to syslog */
+/* part of this code from php.net */
+function captiveportal_logportalauth($user,$mac,$ip,$status) {
+       define_syslog_variables();
+       openlog("logportalauth", LOG_PID, LOG_LOCAL4);
+       // Log it
+       syslog(LOG_INFO, "$status: $user, $mac, $ip");
+       closelog();
+}
+
 ?>
index 18d443a411a6471dd10fa8151ef171454352a735..5925ac787ffeeac5a00ade9d33b69fc2c0c2a8be 100644 (file)
@@ -3,7 +3,7 @@
        config.inc
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -35,9 +35,11 @@ require_once("xmlparse.inc");
 
 /* read platform */
 if (file_exists("{$g['etc_path']}/platform")) {
-       $g['platform'] = chop(file_get_contents("{$g['etc_path']}/platform"));
+       $g['fullplatform'] = chop(file_get_contents("{$g['etc_path']}/platform"));
+       $pla = explode("_", $g['fullplatform']);
+       $g['platform'] = $pla[0];
 } else {
-       $g['platform'] = "unknown";
+       $g['platform'] = $g['fullplatform'] = "unknown";
 }
 
 if ($g['booting']) {
index 9b41729dcdd069ab3a452c29cb5d8e0d693b49cc..8c26e547576b2965819f5414cac201a6f28b7bbf 100644 (file)
@@ -3,7 +3,7 @@
        filter.inc
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -50,12 +50,12 @@ function filter_configure() {
                echo "Configuring firewall... ";
        
        /* set TCP timeouts */
-       $tcpidletimeout = 9000;
+       $tcpidletimeout = 9000*2;
        if ($config['filter']['tcpidletimeout'])
-               $tcpidletimeout = $config['filter']['tcpidletimeout'];
+               $tcpidletimeout = $config['filter']['tcpidletimeout']*2;
        mwexec("/sbin/sysctl net.inet.ipf.fr_tcpidletimeout={$tcpidletimeout}");
        mwexec("/sbin/sysctl net.inet.ipf.fr_tcphalfclosed=480");
-       mwexec("/sbin/sysctl net.inet.ipf.fr_udpacktimeout=240");       /* SIP... */
+       mwexec("/sbin/sysctl net.inet.ipf.fr_udpacktimeout=480");       /* SIP... */
        
        /* generate ipnat rules */
        $ipnatrules = filter_nat_rules_generate();
@@ -258,23 +258,15 @@ function filter_nat_rules_generate() {
                }
        }
        
-       if ($pptpdcfg['mode'] && $pptpdcfg['mode'] != "off") {
-       
-               if ($pptpdcfg['mode'] == "server")
-                       $pptpdtarget = "127.0.0.1";
-               else if ($pptpdcfg['mode'] == "redir")
-                       $pptpdtarget = $pptpdcfg['redir'];
-       
-               if ($pptpdtarget) {
+       if ($pptpdcfg['mode'] == "redir" && $pptpdcfg['redir']) {
        
                $natrules .= <<<EOD
 
 # PPTP
-rdr $wanif 0/0 port 0 -> $pptpdtarget port 0 gre
-rdr $wanif 0/0 port 1723 -> $pptpdtarget port 1723 tcp
+rdr $wanif 0/0 port 0 -> {$pptpdcfg['redir']} port 0 gre
+rdr $wanif 0/0 port 1723 -> {$pptpdcfg['redir']} port 1723 tcp
 
 EOD;
-               }
        }
        
        return $natrules;
@@ -290,6 +282,8 @@ function filter_rules_generate() {
        $lanif = $lancfg['if'];
        $wanif = get_real_wan_interface();
        
+       $curwanip = get_current_wan_address();
+       
        /* rule groups (optional interfaces: see below) */
        $ifgroups = array("lan" => 100, "wan" => 200);
        
@@ -317,6 +311,7 @@ function filter_rules_generate() {
                                        }
                                }
                                $oic['bridge'] = 1;
+                               $oic['bridge_if'] = $oc['bridge'];
                        } else {
                                $oic['ip'] = $oc['ipaddr'];
                                $oic['sn'] = $oc['subnet'];
@@ -375,7 +370,7 @@ EOD;
        /* pass traffic between statically routed subnets and the subnet on the
           interface in question to avoid problems with complicated routing
           topologies */
-       if (is_array($config['staticroutes']['route']) && count($config['staticroutes']['route'])) {
+       if (isset($config['filter']['bypassstaticroutes']) && is_array($config['staticroutes']['route']) && count($config['staticroutes']['route'])) {
                foreach ($config['staticroutes']['route'] as $route) {
                        unset($sa);
                        
@@ -445,12 +440,22 @@ pass in quick on $wanif proto udp from any port = 67 to any port = 68
 
 EOD;
 
-       /* LAN spoof check */   
-       $ipfrules .= filter_rules_spoofcheck_generate('lan', $lanif, $lansa, $lansn, $log);
+       /* LAN spoof check */
+       /* omit if any interface is bridged to LAN and the filtering bridge is on */
+       $lanbridge = false;
+       foreach ($optcfg as $on => $oc) {
+               if ($oc['bridge'] && $oc['bridge_if'] == "lan") {
+                       $lanbridge = true;
+                       break;
+               }
+       }
+       if (!$lanbridge || !isset($config['bridge']['filteringbridge']))
+               $ipfrules .= filter_rules_spoofcheck_generate('lan', $lanif, $lansa, $lansn, $log);
 
        /* OPT spoof check */
        foreach ($optcfg as $on => $oc) {
-               if ($oc['ip'])
+               /* omit for bridged interfaces when the filtering bridge is on */
+               if ($oc['ip'] && (!$oc['bridge'] || !isset($config['bridge']['filteringbridge'])))
                        $ipfrules .= filter_rules_spoofcheck_generate($on, $oc['if'], $oc['sa'], $oc['sn'], $log);
        }
        
@@ -473,8 +478,6 @@ EOD;
                count($config['ipsec']['tunnel'])) ||
                        isset($config['ipsec']['mobileclients']['enable']))) {
                
-               $curwanip = get_current_wan_address();
-               
                if ($curwanip)
                        $ipfrules .= filter_rules_ipsec_generate($wanif, $curwanip);
                
@@ -548,17 +551,19 @@ EOD;
        if ($pptpdcfg['mode'] && ($pptpdcfg['mode'] != "off")) {
        
                if ($pptpdcfg['mode'] == "server")
-                       $pptpdtarget = "127.0.0.1";
+                       $pptpdtarget = $curwanip;
                else
                        $pptpdtarget = $pptpdcfg['redir'];
-                       
-               $ipfrules .= <<<EOD
+               
+               if ($pptpdtarget) {
+                       $ipfrules .= <<<EOD
 
 # PPTP rules
 pass in quick proto gre from any to $pptpdtarget keep state group 200
 pass in quick proto tcp from any to $pptpdtarget port = 1723 keep state group 200
 
 EOD;
+               }
        }
        
        /* BigPond client enabled? */
@@ -662,7 +667,7 @@ EOD;
                                if ($rule['protocol'] == "tcp") {
                                        $line = "block return-rst";
                                } else if ($rule['protocol'] == "udp") {
-                                       $line = "block return-icmp";
+                                       $line = "block return-icmp(port-unr)";
                                } else {
                                        $line = "block";
                                }
@@ -673,7 +678,7 @@ EOD;
                        $line .= " in ";
 
                        if (isset($rule['log']))
-                               $line .= "log ";
+                               $line .= "log first ";
 
                        $line .= "quick ";
                        
@@ -695,6 +700,9 @@ EOD;
                                                $optcfg[$rule['source']['network']]['sn'];
                                } else {
                                        switch ($rule['source']['network']) {
+                                               case 'wanip':
+                                                       $src = $curwanip;
+                                                       break;
                                                case 'lan':
                                                        $src = "$lansa/$lansn";
                                                        break;
@@ -749,6 +757,9 @@ EOD;
                                                $optcfg[$rule['destination']['network']]['sn'];
                                } else {
                                        switch ($rule['destination']['network']) {
+                                               case 'wanip':
+                                                       $dst = $curwanip;
+                                                       break;
                                                case 'lan':
                                                        $dst = "$lansa/$lansn";
                                                        break;
index eab4b8216a478774cd93683fd218b2dce5dac812..8435ea1b2534109638f931e589a7308f8f696649 100644 (file)
@@ -3,7 +3,7 @@
     functions.inc
     part of m0n0wall (http://m0n0.ch/wall)
     
-    Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+    Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
     All rights reserved.
     
     Redistribution and use in source and binary forms, with or without
index eef6cff8aed7a37bbef1c03b7b58ecc86823d23d..bee57697951d5e090d39796166049adedc421cd2 100644 (file)
@@ -3,7 +3,7 @@
     globals.inc
     part of m0n0wall (http://m0n0.ch/wall)
     
-    Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+    Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
     All rights reserved.
     
     Redistribution and use in source and binary forms, with or without
@@ -48,7 +48,8 @@ $g = array(
     "pptp_subnet" => 28,
     "debug" => false,
     "latest_config" => "1.4",
-    "nopccard_platforms" => array("wrap", "net48xx")
+    "nopccard_platforms" => array("wrap", "net48xx"),
+    "wireless_regex" => "/^(wi|ath|an)/"
 );
 
 ?>
index 6decac1e7eead40059565ec41dd8b2483006aa38..80d823de2f8be905705d21758beb8925df43348e 100644 (file)
@@ -3,7 +3,7 @@
        interfaces.inc
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -112,8 +112,12 @@ function interfaces_lan_configure() {
                mwexec($cmd);
        }
        
+       $addflags = "";
+       if (strpos($lancfg['if'], "fxp") !== false)
+               $addflags .= " link0";
+       
        mwexec("/sbin/ifconfig " . escapeshellarg($lancfg['if']) . " " . 
-               escapeshellarg($lancfg['ipaddr'] . "/" . $lancfg['subnet']));
+               escapeshellarg($lancfg['ipaddr'] . "/" . $lancfg['subnet']) . $addflags);
        
        if (!$g['booting']) {
                /* make new hosts file */
@@ -167,6 +171,8 @@ function interfaces_optional_configure() {
                
                if (isset($config['bridge']['filteringbridge']))
                        mwexec("/sbin/sysctl net.link.ether.bridge_ipf=1");
+               else
+                       mwexec("/sbin/sysctl net.link.ether.bridge_ipf=0");
                
                mwexec("/sbin/sysctl net.link.ether.bridge=1");
        } else {
@@ -235,6 +241,10 @@ function interfaces_optional_configure_if($opti) {
                        if (strstr($if, "tap"))
                                ovpn_link_tap();
                }
+       
+               $addflags = "";
+               if (strpos($optcfg['if'], "fxp") !== false)
+                       $addflags .= " link0";
                
                /* bridged? */
                if ($optcfg['bridge']) {
@@ -249,7 +259,7 @@ function interfaces_optional_configure_if($opti) {
                                ":" . $opti;
                } else {
                        mwexec("/sbin/ifconfig " . escapeshellarg($optcfg['if']) . " " . 
-                               escapeshellarg($optcfg['ipaddr'] . "/" . $optcfg['subnet']));
+                               escapeshellarg($optcfg['ipaddr'] . "/" . $optcfg['subnet']) . $addflags);
                }
        } else {
                mwexec("/sbin/ifconfig " . escapeshellarg($optcfg['if']) . 
@@ -288,21 +298,32 @@ function interfaces_wireless_configure($if, $wlcfg) {
                $ifcargs .= "wepmode off ";
        }
        
+       if (strstr($if, "ath")) {
+               if ($wlcfg['standard'])
+                       $ifcargs .= "mode {$wlcfg['standard']} ";
+       }
+       
        switch ($wlcfg['mode']) {
                case 'hostap':
-                       if (strstr($if, "wi"))
+                       if (strstr($if, "ath"))
+                               $ifcargs .= "-mediaopt adhoc mediaopt hostap ";
+                       else if (strstr($if, "wi"))
                                $ifcargs .= "-mediaopt ibss mediaopt hostap ";
                        break;
                case 'ibss':
                case 'IBSS':
-                       if (strstr($if, "wi"))
+                       if (strstr($if, "ath"))
+                               $ifcargs .= "-mediaopt hostap mediaopt adhoc ";
+                       else if (strstr($if, "wi"))
                                $ifcargs .= "-mediaopt hostap mediaopt ibss ";
                        else if (strstr($if, "an"))
                                $ifcargs .= "mediaopt adhoc ";
                        break;
                case 'bss':
                case 'BSS':
-                       if (strstr($if, "wi"))
+                       if (strstr($if, "ath"))
+                               $ifcargs .= "-mediaopt hostap -mediaopt adhoc ";
+                       else if (strstr($if, "wi"))
                                $ifcargs .= "-mediaopt hostap -mediaopt ibss ";
                        else if (strstr($if, "an"))
                                $ifcargs .= "-mediaopt adhoc ";
@@ -362,6 +383,10 @@ function interfaces_wan_configure() {
                mwexec($cmd);
        }
        
+       $addflags = "";
+       if (strpos($wancfg['if'], "fxp") !== false)
+               $addflags .= " link0";
+       
        switch ($wancfg['ipaddr']) {
        
                case 'dhcp':
@@ -385,10 +410,10 @@ function interfaces_wan_configure() {
                        if (isset($wancfg['ispointtopoint']) && $wancfg['pointtopoint']) {
                                mwexec("/sbin/ifconfig " . escapeshellarg($wancfg['if']) . " " . 
                                        escapeshellarg($wancfg['ipaddr'] . "/" . $wancfg['subnet']) . 
-                                       " " . escapeshellarg($wancfg['pointtopoint']) . " up");
+                                       " " . escapeshellarg($wancfg['pointtopoint']) . $addflags . " up");
                        } else {
                                mwexec("/sbin/ifconfig " . escapeshellarg($wancfg['if']) . " " . 
-                                       escapeshellarg($wancfg['ipaddr'] . "/" . $wancfg['subnet']));
+                                       escapeshellarg($wancfg['ipaddr'] . "/" . $wancfg['subnet']) . $addflags);
                        }
                        
                        /* install default route */
@@ -463,12 +488,14 @@ EOD;
 }
 
 function interfaces_wan_dhcp_down() {
-       mwexec("/sbin/dhclient -r");\r
+       mwexec("/sbin/dhclient -r");
+
        sleep(3);
 }
 
 function interfaces_wan_dhcp_up() {
-       interfaces_wan_dhcp_configure();\r
+       interfaces_wan_dhcp_configure();
+
        sleep(3);
 }
 
@@ -571,13 +598,15 @@ EOD;
 
 function interfaces_wan_pppoe_down() {
        global $g;
-       sigkillbypid("{$g['varrun_path']}/mpd.pid", "SIGUSR2");\r
+       sigkillbypid("{$g['varrun_path']}/mpd.pid", "SIGUSR2");
+
        sleep(3);
 }
 
 function interfaces_wan_pppoe_up() {
        global $g;
-       sigkillbypid("{$g['varrun_path']}/mpd.pid", "SIGUSR1");\r
+       sigkillbypid("{$g['varrun_path']}/mpd.pid", "SIGUSR1");
+
        sleep(3);
 }
 
@@ -683,13 +712,15 @@ EOD;
 
 function interfaces_wan_pptp_down() {
        global $g;
-       sigkillbypid("{$g['varrun_path']}/mpd.pid", "SIGUSR2");\r
+       sigkillbypid("{$g['varrun_path']}/mpd.pid", "SIGUSR2");
+
        sleep(3);
 }
 
 function interfaces_wan_pptp_up() {
        global $g;
-       sigkillbypid("{$g['varrun_path']}/mpd.pid", "SIGUSR1");\r
+       sigkillbypid("{$g['varrun_path']}/mpd.pid", "SIGUSR1");
+
        sleep(3);
 }
 
index df5f499cf41edfdf74d2e189e352143aba683ec5..5151eca76d2b717015582a613713dcb9b1fd8ed5 100644 (file)
@@ -3,7 +3,7 @@
        services.inc
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -189,12 +189,18 @@ function services_dhcrelay_configure() {
        
        /* DHCPRelay enabled on any interfaces? */
        $dhcrelayenable = false;
-       foreach ($dhcrelaycfg as $dhcrelayif => $dhcrelayifconf) {
-               if (isset($dhcrelayifconf['enable']) &&
-                       (($dhcrelayif == "lan") ||
-                       (isset($config['interfaces'][$dhcrelayif]['enable']) &&
-                       $config['interfaces'][$dhcrelayif]['if'] && (!$config['interfaces'][$dhcrelayif]['bridge']))))
-                       $dhcrelayenable = true;
+       
+       if (is_array($dhcrelaycfg)) {
+               foreach ($dhcrelaycfg as $dhcrelayif => $dhcrelayifconf) {
+                       if (isset($dhcrelayifconf['enable']) &&
+                               (($dhcrelayif == "lan") ||
+                               (isset($config['interfaces'][$dhcrelayif]['enable']) &&
+                               $config['interfaces'][$dhcrelayif]['if'] && (!$config['interfaces'][$dhcrelayif]['bridge'])))) {
+                               
+                               $dhcrelayenable = true;
+                               break;
+                       }
+               }
        }
        
        if (!$dhcrelayenable)
@@ -463,8 +469,9 @@ function services_dnsupdate_process() {
        if (isset($config['dnsupdate']['enable'])) {
                
                $wanip = get_current_wan_address();
+               
                if ($wanip) {
-                       
+                               
                        $keyname = $config['dnsupdate']['keyname'];
                        /* trailing dot */
                        if (substr($keyname, -1) != ".")
@@ -480,7 +487,7 @@ function services_dnsupdate_process() {
                           but nsupdate insists on having both */
                        $fd = fopen("{$g['varetc_path']}/K{$keyname}+157+00000.private", "w");
                        $privkey .= <<<EOD
-Private-key-format: v1.2\r
+Private-key-format: v1.2
 Algorithm: 157 (HMAC)
 Key: {$config['dnsupdate']['keydata']}
 
@@ -489,15 +496,15 @@ EOD;
                        fclose($fd);
                        
                        /* write public key file */
-                       if ($config['dnsupdate']['keytype'] == "zone") {
-                               $flags = 257;
-                               $proto = 3;
-                       } else if ($config['dnsupdate']['keytype'] == "host") {
+                       if ($config['dnsupdate']['keytype'] == "host") {
                                $flags = 513;
                                $proto = 3;
                        } else if ($config['dnsupdate']['keytype'] == "user") {
                                $flags = 0;
                                $proto = 2;
+                       } else {
+                               $flags = 257;
+                               $proto = 3;
                        }
                        
                        $fd = fopen("{$g['varetc_path']}/K{$keyname}+157+00000.key", "w");
@@ -505,8 +512,8 @@ EOD;
                        fclose($fd);
                        
                        /* generate update instructions */
-                       $upinst =  "update delete {$config['dnsupdate']['host']} A\n";
-                       $upinst .= "update add {$config['dnsupdate']['host']} {$config['dnsupdate']['ttl']} A {$wanip}\n";
+                       $upinst =  "update delete {$hostname} A\n";
+                       $upinst .= "update add {$hostname} {$config['dnsupdate']['ttl']} A {$wanip}\n";
                        $upinst .= "\n";        /* mind that trailing newline! */
                        
                        $fd = fopen("{$g['varetc_path']}/nsupdatecmds", "w");
index ce4a5c532de4a9862ef043527b2af189d336a67c..9a75edf043f0b588870582d18c54ee57db00a794 100644 (file)
@@ -3,7 +3,7 @@
        shaper.inc
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -353,6 +353,14 @@ function shaper_rules_generate() {
                                $line .= "delay {$pipe['delay']} ";
                        }
                        
+                       if ($pipe['plr']) {
+                               $line .= "plr {$pipe['plr']} ";
+                       }
+                       
+                       if ($pipe['qsize']) {
+                               $line .= "queue {$pipe['qsize']} ";
+                       }
+                       
                        switch ($pipe['mask']) {
                                case 'source':
                                        $line .= "mask src-ip 0xffffffff ";
index 2333f231d3bb6cb0f0a8576d236b10e0b3d5601a..700e03936203ed9fab9f2867a9273e2df165414b 100644 (file)
@@ -3,7 +3,7 @@
        system.inc
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -195,8 +195,9 @@ function system_syslogd_start() {
                $syslogconf = <<<EOD
 local0.*                                       %/var/log/filter.log
 local3.*                                       %/var/log/vpn.log
+local4.*                                       %/var/log/portalauth.log
 local7.*                                       %/var/log/dhcpd.log
-*.notice;kern.debug;lpr.info;mail.crit;news.err;local0.none;local3.none;local7.none %/var/log/system.log
+*.notice;kern.debug;lpr.info;mail.crit;news.err;local0.none;local3.none;local4.none;local7.none %/var/log/system.log
 security.*                                     %/var/log/system.log
 auth.info;authpriv.info;daemon.info            %/var/log/system.log
 *.emerg                                                *
@@ -214,6 +215,13 @@ EOD;
                        $syslogconf .= <<<EOD
 local3.*                                       @{$syslogcfg['remoteserver']}
 
+EOD;
+               }
+               
+               if (isset($syslogcfg['portalauth'])) {
+                       $syslogconf .= <<<EOD
+local4.*                                       @{$syslogcfg['remoteserver']}
+
 EOD;
                }
 
@@ -226,7 +234,7 @@ EOD;
 
                if (isset($syslogcfg['system'])) {
                        $syslogconf .= <<<EOD
-*.notice;kern.debug;lpr.info;mail.crit;news.err;local0.none;local3.none;local7.none @{$syslogcfg['remoteserver']}
+*.notice;kern.debug;lpr.info;mail.crit;news.err;local0.none;local3.none;local4.none;local7.none @{$syslogcfg['remoteserver']}
 security.*                                     @{$syslogcfg['remoteserver']}
 auth.info;authpriv.info;daemon.info            @{$syslogcfg['remoteserver']}
 *.emerg                                                @{$syslogcfg['remoteserver']}
@@ -301,14 +309,14 @@ function system_webgui_start() {
                        $cert = <<<EOD
 -----BEGIN CERTIFICATE-----
 MIIBlDCB/gIBADANBgkqhkiG9w0BAQQFADATMREwDwYDVQQKEwhtMG4wd2FsbDAe
-Fw0wMzA5MDgxNzAzNDZaFw0wNDA5MDcxNzAzNDZaMBMxETAPBgNVBAoTCG0wbjB3
+Fw0wNTA1MTAxMjI0NDRaFw0wNzA1MTAxMjI0NDRaMBMxETAPBgNVBAoTCG0wbjB3
 YWxsMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDAShszhFz+o8lsMWTGgTxs
 TMPR+v4+qL5jXDyY97MLTGFK7aqQOtpIQc+TcTc4jklgOVlHoR7oBXrsi8YrbCd+
 83LPQmQoSPC0VqhfU3uYf3NzxiK8r97aPCsmWgwT2pQ6TcESTm6sF7nLprOf/zFP
-C4jE2fvjkbzyVolPywBuewIDAQABMA0GCSqGSIb3DQEBBAUAA4GBAK2D8NqQSlUs
-pFCe5J9ue1LrjfGHHy4HE9zA9avgrz3Qju+1JOshEwy/1BJjZ93tQUbiRS7RwvDO
-4crGG4IejjhFczzA2CIX3rd2rYM2oGpojKgm5YuuhV5lYPwAHUOLbBaLOVqlLhzw
-VqjD7R2DkXUIfhJ5ZekqK5ZwzqJXta8U
+C4jE2fvjkbzyVolPywBuewIDAQABMA0GCSqGSIb3DQEBBAUAA4GBAFR962c4R5tV
+cTn0OQcszYoW6WC+ini9tQQh5ku5jYDAiC+00atawJEVLnL3lwAcpSKTIWlTkD20
+tl3lz5br1qFgYky+Rd0kwS2nk9jRbkxSXxd6KJVnNRCKre28aw3ENzZfCSurPQsX
+UPp5er+NtwMT1g7s/JDmKTC4w1rGr5/c
 -----END CERTIFICATE-----
 
 EOD;
@@ -545,7 +553,7 @@ function system_set_harddisk_standby() {
                if (is_numeric($standby)) {
                        // Sync the disk(s)
                        mwexec('/bin/sync');
-                       if (!mwexec('/sbin/sysctl hw.ata.standby=' . ((int)$standby))) {
+                       if (!mwexec('/sbin/sysctl hw.ata.suspend=' . ((int)$standby))) {
                                // Reinitialize ATA-drives
                                mwexec('/usr/local/sbin/atareinit');
                                if ($g['booting']) {
index 2b3fa67784e39483bce505e0db18e2fa79d15d10..53d14de54fb76c3868a095ed26fabbe709a72414 100644 (file)
@@ -3,7 +3,7 @@
        util.inc
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
index b73af46cb1f7765b3ea13aa8446900187053ec91..8ce9373a2d5cf6ab99787af80e91e16922a91b77 100644 (file)
@@ -3,7 +3,7 @@
        vpn.inc
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -64,7 +64,10 @@ function vpn_ipsec_configure($ipchg = false) {
        mwexec("/usr/sbin/setkey -F");
        
        /* prefer old SAs only for 30 seconds, then use the new one */
-       mwexec("/sbin/sysctl -w net.key.preferred_oldsa=-30");
+       if (!isset($config['ipsec']['preferoldsa']))
+               mwexec("/sbin/sysctl -w net.key.preferred_oldsa=-30");
+       else
+               mwexec("/sbin/sysctl -w net.key.preferred_oldsa=1");
        
        if (isset($ipseccfg['enable'])) {
                
@@ -302,12 +305,14 @@ EOD;
                        /* start racoon */
                        mwexec("/usr/local/sbin/racoon -d -f {$g['varetc_path']}/racoon.conf");
                        
-                       foreach ($ipseccfg['tunnel'] as $tunnel) {
-                               if (isset($tunnel['auto'])) {
-                                       $remotehost = substr($tunnel['remote-subnet'],0,strpos($tunnel['remote-subnet'],"/"));
-                                       $srchost = vpn_endpoint_determine($tunnel, $curwanip);
-                                       if ($srchost)
-                                               mwexec_bg("/sbin/ping -c 1 -S {$srchost} {$remotehost}");
+                       if (is_array($ipseccfg['tunnel'])) {
+                               foreach ($ipseccfg['tunnel'] as $tunnel) {
+                                       if (isset($tunnel['auto'])) {
+                                               $remotehost = substr($tunnel['remote-subnet'],0,strpos($tunnel['remote-subnet'],"/"));
+                                               $srchost = vpn_endpoint_determine($tunnel, $curwanip);
+                                               if ($srchost)
+                                                       mwexec_bg("/sbin/ping -c 1 -S {$srchost} {$remotehost}");
+                                       }
                                }
                        }
                }
@@ -419,7 +424,9 @@ EOD;
 EOD;
                        }
                        
-                       if (isset($config['dnsmasq']['enable'])) {
+                       if (is_array($pptpdcfg['dnsserver']) && ($pptpdcfg['dnsserver'][0])) {
+                               $mpdconf .= "   set ipcp dns " . join(" ", $pptpdcfg['dnsserver']) . "\n";
+                       } else if (isset($config['dnsmasq']['enable'])) {
                                $mpdconf .= "   set ipcp dns " . $config['interfaces']['lan']['ipaddr'];
                                if ($syscfg['dnsserver'][0])
                                        $mpdconf .= " " . $syscfg['dnsserver'][0];
index 2684d49fa2118c6ce4e237a6a578f91654de3ddc..cd85866926c9fac927f7b64f924014a3dca1c7af 100644 (file)
@@ -4,7 +4,7 @@
        functions to parse/dump configuration files in XML format
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
index bb0804f2fa34c593e2dd08e6932fa1781caecdd6..6fc23f5f7b4b100b6f6f234d2e124c5c068e789e 100644 (file)
@@ -4,7 +4,7 @@
        rc.banner
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -40,8 +40,8 @@
 
 
 *** This is m0n0wall, version {$version}
-    built on {$buildtime} for {$g['platform']}
-    Copyright (C) 2002-2004 by Manuel Kasper. All rights reserved.
+    built on {$buildtime} for {$g['fullplatform']}
+    Copyright (C) 2002-2005 by Manuel Kasper. All rights reserved.
     Visit http://m0n0.ch/wall for updates.
     
     
index 2530362a89956a512bb057c9198f503c262a6a00..10f2e632983dd8e1c5dcc0717e31b3faa5c61325 100644 (file)
@@ -4,7 +4,7 @@
        rc.bootup
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        /* start DHCP service */
        services_dhcpd_configure();
        
+       /* start DHCP relay */
+       services_dhcrelay_configure();
+       
        /* start SNMP service */
        services_snmpd_configure();
        
index 8e33fd267f644c7d76d017d2e2d71ae284cbeabb..c3c30c716fe13f81517587fe16fefaf8407f75b5 100644 (file)
@@ -4,7 +4,7 @@
        rc.initial.defaults
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
index 7859e2ce4dbab992775c18c162c24228ea23f10f..9d7981155bac04e78e2965ffb95cb2eea4b1d3a9 100644 (file)
@@ -4,7 +4,7 @@
        rc.initial.password
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
index d0695661ccec634f44f250a01c828eacee237e3a..760a16c48bfcbcad1c22a89311df2323ce2d7bb8 100644 (file)
@@ -4,7 +4,7 @@
        rc.initial.ping
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
index 053d492ccad6c4c1aa1a39be92afb6b627f8150d..5c3b9ef10c51c74313df7c2d44db92eff29e2897 100644 (file)
@@ -4,7 +4,7 @@
        rc.initial.reboot
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
index 99fd92230b508247487132e88e7ba10b4b838d24..a5196ee8cab56ad91b66a52620efac72a8cf6f95 100644 (file)
@@ -4,7 +4,7 @@
        rc.initial.setlanip
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
                unset($config['dhcpd']['lan']['enable']);
        }
        
+       $proto = "http";
        if ($config['system']['webgui']['protocol'] == "https") {
        
                echo "\nDo you want to revert to HTTP as the webGUI protocol? (y/n) ";
                
                if (strcasecmp(chop(fgets($fp)), "y") == 0)
                        $config['system']['webgui']['protocol'] = "http";
+               else
+                       $proto = "https";
        }
        
        if (isset($config['system']['webgui']['noantilockout'])) {
@@ -107,7 +110,7 @@ The LAN IP address has been set to $lanip/$lanbits.
 You can now access the webGUI by opening the following URL
 in your browser:
 
-http://$lanip/
+$proto://$lanip/
 
 Press ENTER to continue.
 
index 049879a0805c879909ff041a6f4c8301a0ea1044..e08b5746d7878512fb248eab4bac1bd7b7d43bad 100644 (file)
@@ -4,7 +4,7 @@
        rc.initial.setports
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -184,7 +184,7 @@ EOD;
        if (strcasecmp(chop(fgets($fp)), "y") == 0) {
        
                $config['interfaces']['lan']['if'] = $lanif;
-               if (preg_match("/^(wi|awi|an)/", $lanif)) {
+               if (preg_match($g['wireless_regex'], $lanif)) {
                        if (!is_array($config['interfaces']['lan']['wireless']))
                                $config['interfaces']['lan']['wireless'] = array();
                } else {
@@ -192,7 +192,7 @@ EOD;
                }
                
                $config['interfaces']['wan']['if'] = $wanif;
-               if (preg_match("/^(wi|awi|an)/", $wanif)) {
+               if (preg_match($g['wireless_regex'], $wanif)) {
                        if (!is_array($config['interfaces']['wan']['wireless']))
                                $config['interfaces']['wan']['wireless'] = array();
                } else {
@@ -206,7 +206,7 @@ EOD;
                        $config['interfaces']['opt' . ($i+1)]['if'] = $optif[$i];
                        
                        /* wireless interface? */
-                       if (preg_match("/^(wi|awi|an)/", $optif[$i])) {
+                       if (preg_match($g['wireless_regex'], $optif[$i])) {
                                if (!is_array($config['interfaces']['opt' . ($i+1)]['wireless']))
                                        $config['interfaces']['opt' . ($i+1)]['wireless'] = array();
                        } else {
index d61069e6241a758e3d41954c886f3392d6195801..6868cfdc171cdb4928664d0be758eee26ba607e7 100644 (file)
@@ -4,7 +4,7 @@
        rc.newwanip
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -54,8 +54,8 @@
                        return 0;       /* nothing to do */
        }
        
-       /* resync ipfilter */
-       filter_resync();
+       /* reload firewall rules */
+       filter_rules_generate();
        
        /* flush NAT table */
        filter_flush_nat_table();
index 108b029d9e057145ea7ef9aae9319a276e2c4edf..39e7b7e86a3034a775b6b6a52121a8736a8dd0cb 100644 (file)
@@ -4,7 +4,7 @@
        rc.prunecaptiveportal
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
diff --git a/webgui/cal.gif b/webgui/cal.gif
new file mode 100644 (file)
index 0000000..8526cf5
Binary files /dev/null and b/webgui/cal.gif differ
diff --git a/webgui/datetimepicker.js b/webgui/datetimepicker.js
new file mode 100644 (file)
index 0000000..68d9cd5
--- /dev/null
@@ -0,0 +1,487 @@
+//Javascript name: My Date Time Picker\r
+//Date created: 16-Nov-2003 23:19\r
+//Scripter: TengYong Ng\r
+//Website: http://www.rainforestnet.com\r
+//Copyright (c) 2003 TengYong Ng\r
+//FileName: DateTimePicker.js\r
+//Version: 0.8\r
+//Contact: contact@rainforestnet.com\r
+// Note: Permission given to use this script in ANY kind of applications if\r
+//       header lines are left unchanged.
+\r
+//Global variables\r
+var winCal;\r
+var dtToday=new Date();\r
+var Cal;\r
+var docCal;\r
+var MonthName=["January", "February", "March", "April", "May", "June","July", \r
+       "August", "September", "October", "November", "December"];\r
+var WeekDayName=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];      \r
+var exDateTime;//Existing Date and Time\r
+\r
+//Configurable parameters\r
+var cnTop="200";//top coordinate of calendar window.\r
+var cnLeft="500";//left coordinate of calendar window\r
+var WindowTitle ="DateTime Picker";//Date Time Picker title.\r
+var WeekChar=2;//number of character for week day. if 2 then Mo,Tu,We. if 3 then Mon,Tue,Wed.\r
+var CellWidth=20;//Width of day cell.\r
+var DateSeparator="/";//Date Separator, you can change it to "/" if you want.\r
+var TimeMode=24;//default TimeMode value. 12 or 24\r
+\r
+var ShowLongMonth=true;//Show long month name in Calendar header. example: "January".\r
+var ShowMonthYear=true;//Show Month and Year in Calendar header.\r
+var MonthYearColor="#435370";//Font Color of Month and Year in Calendar header.\r
+var WeekHeadColor="#777777";//Background Color in Week header.\r
+var SundayColor="#D9DEE8";//Background color of Sunday.\r
+var SaturdayColor="#D9DEE8";//Background color of Saturday.\r
+var WeekDayColor="white";//Background color of weekdays.\r
+var FontColor="black";//color of font in Calendar day cell.\r
+var TodayColor="#FFFF33";//Background color of today.\r
+var SelDateColor="red";//Backgrond color of selected date in textbox.\r
+var YrSelColor="black";//color of font of Year selector.\r
+var ThemeBg="";//Background image of Calendar window.\r
+//end Configurable parameters\r
+//end Global variable\r
+\r
+function NewCal(pCtrl,pFormat,pShowTime,pTimeMode)\r
+{\r
+       Cal=new Calendar(dtToday);\r
+       if ((pShowTime!=null) && (pShowTime))\r
+       {\r
+               Cal.ShowTime=true;\r
+               if ((pTimeMode!=null) &&((pTimeMode=='12')||(pTimeMode=='24')))\r
+               {\r
+                       TimeMode=pTimeMode;\r
+               }               \r
+       }       \r
+       if (pCtrl!=null)\r
+               Cal.Ctrl=pCtrl;\r
+       if (pFormat!=null)\r
+               Cal.Format=pFormat.toUpperCase();\r
+       \r
+       exDateTime=document.getElementById(pCtrl).value;\r
+       if (exDateTime!="")//Parse Date String\r
+       {\r
+               var Sp1;//Index of Date Separator 1\r
+               var Sp2;//Index of Date Separator 2 \r
+               var tSp1;//Index of Time Separator 1\r
+               var tSp1;//Index of Time Separator 2\r
+               var strMonth;\r
+               var strDate;\r
+               var strYear;\r
+               var intMonth;\r
+               var YearPattern;\r
+               var strHour;\r
+               var strMinute;\r
+               var strSecond;\r
+               //parse month\r
+               Sp1=exDateTime.indexOf(DateSeparator,0)\r
+               Sp2=exDateTime.indexOf(DateSeparator,(parseInt(Sp1)+1));\r
+               \r
+               if ((Cal.Format.toUpperCase()=="DDMMYYYY") || (Cal.Format.toUpperCase()=="DDMMMYYYY"))\r
+               {\r
+                       strMonth=exDateTime.substring(Sp1+1,Sp2);\r
+                       strDate=exDateTime.substring(0,Sp1);\r
+               }\r
+               else if ((Cal.Format.toUpperCase()=="MMDDYYYY") || (Cal.Format.toUpperCase()=="MMMDDYYYY"))\r
+               {\r
+                       strMonth=exDateTime.substring(0,Sp1);\r
+                       strDate=exDateTime.substring(Sp1+1,Sp2);\r
+               }\r
+               if (isNaN(strMonth))\r
+                       intMonth=Cal.GetMonthIndex(strMonth);\r
+               else\r
+                       intMonth=parseInt(strMonth,10)-1;       \r
+               if ((parseInt(intMonth,10)>=0) && (parseInt(intMonth,10)<12))\r
+                       Cal.Month=intMonth;\r
+               //end parse month\r
+               //parse Date\r
+               if ((parseInt(strDate,10)<=Cal.GetMonDays()) && (parseInt(strDate,10)>=1))\r
+                       Cal.Date=strDate;\r
+               //end parse Date\r
+               //parse year\r
+               strYear=exDateTime.substring(Sp2+1,Sp2+5);\r
+               YearPattern=/^\d{4}$/;\r
+               if (YearPattern.test(strYear))\r
+                       Cal.Year=parseInt(strYear,10);\r
+               //end parse year\r
+               //parse time\r
+               if (Cal.ShowTime==true)\r
+               {\r
+                       tSp1=exDateTime.indexOf(":",0)\r
+                       tSp2=exDateTime.indexOf(":",(parseInt(tSp1)+1));\r
+                       strHour=exDateTime.substring(tSp1,(tSp1)-2);\r
+                       Cal.SetHour(strHour);\r
+                       strMinute=exDateTime.substring(tSp1+1,tSp2);\r
+                       Cal.SetMinute(strMinute);\r
+                       strSecond=exDateTime.substring(tSp2+1,tSp2+3);\r
+                       Cal.SetSecond(strSecond);\r
+               }       \r
+       }\r
+       winCal=window.open("","DateTimePicker","toolbar=0,status=0,menubar=0,fullscreen=no,width=195,height=200,resizable=0,top="+cnTop+",left="+cnLeft);\r
+       docCal=winCal.document;\r
+       RenderCal();\r
+}\r
+\r
+function RenderCal()\r
+{\r
+       var vCalHeader;\r
+       var vCalData;\r
+       var vCalTime;\r
+       var i;\r
+       var j;\r
+       var SelectStr;\r
+       var vDayCount=0;\r
+       var vFirstDay;\r
+\r
+       docCal.open();\r
+       docCal.writeln("<html><head><title>"+WindowTitle+"</title>");\r
+       docCal.writeln("<script>var winMain=window.opener;</script>");\r
+       docCal.writeln("<style>");\r
+       docCal.writeln("body,td,th,input,select {font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;font-size: 11px;}");\r
+       docCal.writeln("a {text-decoration: none;}");\r
+       docCal.writeln("</style>");\r
+       docCal.writeln("</head><body background='"+ThemeBg+"' link="+FontColor+" vlink="+FontColor+"><form name='Calendar'>");\r
+\r
+       vCalHeader="<table border=1 cellpadding=1 cellspacing=1 align=\"center\" valign=\"top\" bgcolor='#EEEEEE' style=\"border-color:#999999; border-style:solid; border-collapse:collapse\">\n";\r
+       //Month Selector\r
+       vCalHeader+="<tr>\n<td colspan='7'><table border=0 width='100%' cellpadding=0 cellspacing=0><tr><td align='left'>\n";\r
+       vCalHeader+="<select name=\"MonthSelector\" onChange=\"javascript:winMain.Cal.SwitchMth(this.selectedIndex);winMain.RenderCal();\">\n";\r
+       for (i=0;i<12;i++)\r
+       {\r
+               if (i==Cal.Month)\r
+                       SelectStr="Selected";\r
+               else\r
+                       SelectStr="";   \r
+               vCalHeader+="<option "+SelectStr+" value >"+MonthName[i]+"\n";\r
+       }\r
+       vCalHeader+="</select></td>";\r
+       //Year selector\r
+       vCalHeader+="\n<td align='right'><a href=\"javascript:winMain.Cal.DecYear();winMain.RenderCal()\"><b><font color=\""+YrSelColor+"\"><</font></b></a><font face=\"Verdana\" color=\""+YrSelColor+"\" size=2><b> "+Cal.Year+" </b></font><a href=\"javascript:winMain.Cal.IncYear();winMain.RenderCal()\"><b><font color=\""+YrSelColor+"\">></font></b></a></td></tr></table></td>\n";   \r
+       vCalHeader+="</tr>";\r
+       //Calendar header shows Month and Year\r
+       if (ShowMonthYear)\r
+               vCalHeader+="<tr><td colspan='7'><font face='Verdana' size='2' align='center' color='"+MonthYearColor+"'><b>"+Cal.GetMonthName(ShowLongMonth)+" "+Cal.Year+"</b></font></td></tr>\n";\r
+       //Week day header\r
+       vCalHeader+="<tr bgcolor="+WeekHeadColor+">";\r
+       for (i=0;i<7;i++)\r
+       {\r
+               vCalHeader+="<td align='center'><font face='Verdana' size='2'>"+WeekDayName[i].substr(0,WeekChar)+"</font></td>";\r
+       }\r
+       vCalHeader+="</tr>";    \r
+       docCal.write(vCalHeader);\r
+       \r
+       //Calendar detail\r
+       CalDate=new Date(Cal.Year,Cal.Month);\r
+       CalDate.setDate(1);\r
+       vFirstDay=CalDate.getDay();\r
+       vCalData="<tr>";\r
+       for (i=0;i<vFirstDay;i++)\r
+       {\r
+               vCalData=vCalData+GenCell();\r
+               vDayCount=vDayCount+1;\r
+       }\r
+       for (j=1;j<=Cal.GetMonDays();j++)\r
+       {\r
+               var strCell;\r
+               vDayCount=vDayCount+1;\r
+               if ((j==dtToday.getDate())&&(Cal.Month==dtToday.getMonth())&&(Cal.Year==dtToday.getFullYear()))\r
+                       strCell=GenCell(j,true,TodayColor);//Highlight today's date\r
+               else\r
+               {\r
+                       if (j==Cal.Date)\r
+                       {\r
+                               strCell=GenCell(j,true,SelDateColor);\r
+                       }\r
+                       else\r
+                       {        \r
+                               if (vDayCount%7==0)\r
+                                       strCell=GenCell(j,false,SaturdayColor);\r
+                               else if ((vDayCount+6)%7==0)\r
+                                       strCell=GenCell(j,false,SundayColor);\r
+                               else\r
+                                       strCell=GenCell(j,null,WeekDayColor);\r
+                       }               \r
+               }                                               \r
+               vCalData=vCalData+strCell;\r
+\r
+               if((vDayCount%7==0)&&(j<Cal.GetMonDays()))\r
+               {\r
+                       vCalData=vCalData+"</tr>\n<tr>";\r
+               }\r
+       }\r
+       docCal.writeln(vCalData);       \r
+       //Time picker\r
+       if (Cal.ShowTime)\r
+       {\r
+               var showHour;\r
+               showHour=Cal.getShowHour();             \r
+               vCalTime="<tr>\n<td colspan='7' align='center'>";\r
+               vCalTime+="<input type='text' name='hour' maxlength=2 size=1 style=\"WIDTH: 22px\" value="+showHour+" onchange=\"javascript:winMain.Cal.SetHour(this.value)\">";\r
+               vCalTime+=" : ";\r
+               vCalTime+="<input type='text' name='minute' maxlength=2 size=1 style=\"WIDTH: 22px\" value="+Cal.Minutes+" onchange=\"javascript:winMain.Cal.SetMinute(this.value)\">";\r
+               vCalTime+=" : ";\r
+               vCalTime+="<input type='text' name='second' maxlength=2 size=1 style=\"WIDTH: 22px\" value="+Cal.Seconds+" onchange=\"javascript:winMain.Cal.SetSecond(this.value)\">";\r
+               if (TimeMode==12)\r
+               {\r
+                       var SelectAm =(parseInt(Cal.Hours,10)<12)? "Selected":"";\r
+                       var SelectPm =(parseInt(Cal.Hours,10)>=12)? "Selected":"";\r
+\r
+                       vCalTime+="<select name=\"ampm\" onchange=\"javascript:winMain.Cal.SetAmPm(this.options[this.selectedIndex].value);\">";\r
+                       vCalTime+="<option "+SelectAm+" value=\"AM\">AM</option>";\r
+                       vCalTime+="<option "+SelectPm+" value=\"PM\">PM<option>";\r
+                       vCalTime+="</select>";\r
+               }       \r
+               vCalTime+="\n</td>\n</tr>";\r
+               docCal.write(vCalTime);\r
+       }       \r
+       //end time picker\r
+       docCal.writeln("\n</table>");\r
+       docCal.writeln("</form></body></html>");\r
+       docCal.close();\r
+}\r
+\r
+function GenCell(pValue,pHighLight,pColor)//Generate table cell with value\r
+{\r
+       var PValue;\r
+       var PCellStr;\r
+       var vColor;\r
+       var vHLstr1;//HighLight string\r
+       var vHlstr2;\r
+       var vTimeStr;\r
+       \r
+       if (pValue==null)\r
+               PValue="";\r
+       else\r
+               PValue=pValue;\r
+       \r
+       if (pColor!=null)\r
+               vColor="bgcolor=\""+pColor+"\"";\r
+       else\r
+               vColor="";      \r
+       if ((pHighLight!=null)&&(pHighLight))\r
+               {vHLstr1="color='red'><b>";vHLstr2="</b>";}\r
+       else\r
+               {vHLstr1=">";vHLstr2="";}       \r
+       \r
+       if (Cal.ShowTime)\r
+       {\r
+               vTimeStr="winMain.document.getElementById('"+Cal.Ctrl+"').value+=' '+"+"winMain.Cal.getShowHour()"+"+':'+"+"winMain.Cal.Minutes"+"+':'+"+"winMain.Cal.Seconds";\r
+               if (TimeMode==12)\r
+                       vTimeStr+="+' '+winMain.Cal.AMorPM";\r
+       }       \r
+       else\r
+               vTimeStr="";            \r
+       PCellStr="<td "+vColor+" width="+CellWidth+" align='center'><font face='verdana' size='2'"+vHLstr1+"<a href=\"javascript:winMain.document.getElementById('"+Cal.Ctrl+"').value='"+Cal.FormatDate(PValue)+"';"+vTimeStr+";window.close();\">"+PValue+"</a>"+vHLstr2+"</font></td>";\r
+       return PCellStr;\r
+}\r
+\r
+function Calendar(pDate,pCtrl)\r
+{\r
+       //Properties\r
+       this.Date=pDate.getDate();//selected date\r
+       this.Month=pDate.getMonth();//selected month number\r
+       this.Year=pDate.getFullYear();//selected year in 4 digits\r
+       this.Hours=pDate.getHours();    \r
+       \r
+       if (pDate.getMinutes()<10)\r
+               this.Minutes="0"+pDate.getMinutes();\r
+       else\r
+               this.Minutes=pDate.getMinutes();\r
+       \r
+       if (pDate.getSeconds()<10)\r
+               this.Seconds="0"+pDate.getSeconds();\r
+       else            \r
+               this.Seconds=pDate.getSeconds();\r
+               \r
+       this.MyWindow=winCal;\r
+       this.Ctrl=pCtrl;\r
+       this.Format="ddMMyyyy";\r
+       this.Separator=DateSeparator;\r
+       this.ShowTime=false;\r
+       if (pDate.getHours()<12)\r
+               this.AMorPM="AM";\r
+       else\r
+               this.AMorPM="PM";       \r
+}\r
+\r
+function GetMonthIndex(shortMonthName)\r
+{\r
+       for (i=0;i<12;i++)\r
+       {\r
+               if (MonthName[i].substring(0,3).toUpperCase()==shortMonthName.toUpperCase())\r
+               {       return i;}\r
+       }\r
+}\r
+Calendar.prototype.GetMonthIndex=GetMonthIndex;\r
+\r
+function IncYear()\r
+{      Cal.Year++;}\r
+Calendar.prototype.IncYear=IncYear;\r
+\r
+function DecYear()\r
+{      Cal.Year--;}\r
+Calendar.prototype.DecYear=DecYear;\r
+       \r
+function SwitchMth(intMth)\r
+{      Cal.Month=intMth;}\r
+Calendar.prototype.SwitchMth=SwitchMth;\r
+\r
+function SetHour(intHour)\r
+{      \r
+       var MaxHour;\r
+       var MinHour;\r
+       if (TimeMode==24)\r
+       {       MaxHour=23;MinHour=0}\r
+       else if (TimeMode==12)\r
+       {       MaxHour=12;MinHour=1}\r
+       else\r
+               alert("TimeMode can only be 12 or 24");         \r
+       var HourExp=new RegExp("^\\d\\d$");\r
+       if (HourExp.test(intHour) && (parseInt(intHour,10)<=MaxHour) && (parseInt(intHour,10)>=MinHour))\r
+       {       \r
+               if ((TimeMode==12) && (Cal.AMorPM=="PM"))\r
+               {\r
+                       if (parseInt(intHour,10)==12)\r
+                               Cal.Hours=12;\r
+                       else    \r
+                               Cal.Hours=parseInt(intHour,10)+12;\r
+               }       \r
+               else if ((TimeMode==12) && (Cal.AMorPM=="AM"))\r
+               {\r
+                       if (intHour==12)\r
+                               intHour-=12;\r
+                       Cal.Hours=parseInt(intHour,10);\r
+               }\r
+               else if (TimeMode==24)\r
+                       Cal.Hours=parseInt(intHour,10); \r
+       }\r
+}\r
+Calendar.prototype.SetHour=SetHour;\r
+\r
+function SetMinute(intMin)\r
+{\r
+       var MinExp=new RegExp("^\\d\\d$");\r
+       if (MinExp.test(intMin) && (intMin<60))\r
+               Cal.Minutes=intMin;\r
+}\r
+Calendar.prototype.SetMinute=SetMinute;\r
+\r
+function SetSecond(intSec)\r
+{      \r
+       var SecExp=new RegExp("^\\d\\d$");\r
+       if (SecExp.test(intSec) && (intSec<60))\r
+               Cal.Seconds=intSec;\r
+}\r
+Calendar.prototype.SetSecond=SetSecond;\r
+\r
+function SetAmPm(pvalue)\r
+{\r
+       this.AMorPM=pvalue;\r
+       if (pvalue=="PM")\r
+       {\r
+               this.Hours=(parseInt(this.Hours,10))+12;\r
+               if (this.Hours==24)\r
+                       this.Hours=12;\r
+       }       \r
+       else if (pvalue=="AM")\r
+               this.Hours-=12; \r
+}\r
+Calendar.prototype.SetAmPm=SetAmPm;\r
+\r
+function getShowHour()\r
+{\r
+       var finalHour;\r
+    if (TimeMode==12)\r
+    {\r
+       if (parseInt(this.Hours,10)==0)\r
+               {\r
+                       this.AMorPM="AM";\r
+                       finalHour=parseInt(this.Hours,10)+12;   \r
+               }\r
+               else if (parseInt(this.Hours,10)==12)\r
+               {\r
+                       this.AMorPM="PM";\r
+                       finalHour=12;\r
+               }               \r
+               else if (this.Hours>12)\r
+               {\r
+                       this.AMorPM="PM";\r
+                       if ((this.Hours-12)<10)\r
+                               finalHour="0"+((parseInt(this.Hours,10))-12);\r
+                       else\r
+                               finalHour=parseInt(this.Hours,10)-12;   \r
+               }\r
+               else\r
+               {\r
+                       this.AMorPM="AM";\r
+                       if (this.Hours<10)\r
+                               finalHour="0"+parseInt(this.Hours,10);\r
+                       else\r
+                               finalHour=this.Hours;   \r
+               }\r
+       }\r
+       else if (TimeMode==24)\r
+       {\r
+               if (this.Hours<10)\r
+                       finalHour="0"+parseInt(this.Hours,10);\r
+               else    \r
+                       finalHour=this.Hours;\r
+       }       \r
+       return finalHour;       \r
+}                              \r
+Calendar.prototype.getShowHour=getShowHour;            \r
+\r
+function GetMonthName(IsLong)\r
+{\r
+       var Month=MonthName[this.Month];\r
+       if (IsLong)\r
+               return Month;\r
+       else\r
+               return Month.substr(0,3);\r
+}\r
+Calendar.prototype.GetMonthName=GetMonthName;\r
+\r
+function GetMonDays()//Get number of days in a month\r
+{\r
+       var DaysInMonth=[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\r
+       if (this.IsLeapYear())\r
+       {\r
+               DaysInMonth[1]=29;\r
+       }       \r
+       return DaysInMonth[this.Month]; \r
+}\r
+Calendar.prototype.GetMonDays=GetMonDays;\r
+\r
+function IsLeapYear()\r
+{\r
+       if ((this.Year%4)==0)\r
+       {\r
+               if ((this.Year%100==0) && (this.Year%400)!=0)\r
+               {\r
+                       return false;\r
+               }\r
+               else\r
+               {\r
+                       return true;\r
+               }\r
+       }\r
+       else\r
+       {\r
+               return false;\r
+       }\r
+}\r
+Calendar.prototype.IsLeapYear=IsLeapYear;\r
+\r
+function FormatDate(pDate)\r
+{\r
+       if (this.Format.toUpperCase()=="DDMMYYYY")\r
+               return (pDate+DateSeparator+(this.Month+1)+DateSeparator+this.Year);\r
+       else if (this.Format.toUpperCase()=="DDMMMYYYY")\r
+               return (pDate+DateSeparator+this.GetMonthName(false)+DateSeparator+this.Year);\r
+       else if (this.Format.toUpperCase()=="MMDDYYYY")\r
+               return ((this.Month+1)+DateSeparator+pDate+DateSeparator+this.Year);\r
+       else if (this.Format.toUpperCase()=="MMMDDYYYY")\r
+               return (this.GetMonthName(false)+DateSeparator+pDate+DateSeparator+this.Year);                  \r
+}\r
+Calendar.prototype.FormatDate=FormatDate;      
\ No newline at end of file
index bc4d9d4754b3e6070625dc1cac6ce3f28811df04..0ebe1207d82eabb779290c183d9dfdba171cb3e8 100644 (file)
@@ -4,7 +4,7 @@
        diag_backup.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,8 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Diagnostics", "Backup/restore");
+
 /* omit no-cache headers because it confuses IE with file downloads */
 $omit_nocacheheaders = true;
 require("guiconfig.inc"); 
@@ -71,17 +73,7 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Diagnostics: Backup/restore");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-      <p class="pgtitle">Diagnostics: Backup/restore</p>
             <form action="diag_backup.php" method="post" enctype="multipart/form-data">
             <?php if ($input_errors) print_input_errors($input_errors); ?>
             <?php if ($savemsg) print_info_box($savemsg); ?>
@@ -92,7 +84,7 @@ if ($_POST) {
                 <tr> 
                   <td width="22%" valign="baseline" class="vncell">&nbsp;</td>
                   <td width="78%" class="vtable"> 
-                    <p> Click this button to download the system configuration 
+                    Click this button to download the system configuration 
                       in XML format.<br>
                       <br>
                       <input name="Submit" type="submit" class="formbtn" id="download" value="Download configuration"></td>
@@ -121,5 +113,3 @@ if ($_POST) {
               </table>
             </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 3ba3ea012ad9181e6f4120a952b881a13845978e..cd923021f16a9aa0e6cc5805296ce356a6da2b76 100644 (file)
@@ -4,7 +4,7 @@
        diag_defaults.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,8 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Diagnostics", "Factory defaults");
+
 require("guiconfig.inc");
 
 if ($_POST) {
@@ -42,17 +44,7 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Diagnostics: Factory defaults");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Diagnostics: Factory defaults</p>
 <?php if ($rebootmsg): echo print_info_box($rebootmsg); else: ?>
 <form action="diag_defaults.php" method="post">
               <p><strong>If you click &quot;Yes&quot;, the firewall will be reset 
@@ -69,5 +61,3 @@ if ($_POST) {
       </form>
 <?php endif; ?>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 4b730fac3ce07d6bc077d0c08c013beac3bd4d4a..931098d80779150833af00e593619595b7d01de3 100644 (file)
@@ -4,7 +4,7 @@
        diag_dhcp_leases.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Björn Pålsson <bjorn@networksab.com> and Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Björn Pålsson <bjorn@networksab.com> and Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Diagnostics", "DHCP leases");
+
 require("guiconfig.inc");
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Diagnostics: DHCP leases");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Diagnostics: DHCP leases</p>
 <?php
 
 flush();
@@ -50,6 +42,11 @@ function leasecmp($a, $b) {
        return strcmp($a[$_GET['order']], $b[$_GET['order']]);
 }
 
+function adjust_gmt($dt) {
+       $ts = strtotime($dt . " GMT");
+       return strftime("%Y/%m/%d %H:%M:%S", $ts);
+}
+
 $fp = @fopen("{$g['vardb_path']}/dhcpd.leases","r");
 
 if ($fp):
@@ -149,6 +146,7 @@ if ($_GET['order'])
     <td class="listhdrr"><a href="?all=<?=$_GET['all'];?>&order=hostname">Hostname</a></td>
     <td class="listhdrr"><a href="?all=<?=$_GET['all'];?>&order=start">Start</a></td>
     <td class="listhdr"><a href="?all=<?=$_GET['all'];?>&order=end">End</a></td>
+    <td class="list"></td>
        </tr>
 <?php
 foreach ($leases as $data) {
@@ -159,18 +157,26 @@ foreach ($leases as $data) {
                } else {
                        $fspans = $fspane = "";
                }
+               $lip = ip2long($data['ip']);
+               foreach ($config['dhcpd'] as $dhcpif => $dhcpifconf) {
+                       if (($lip >= ip2long($dhcpifconf['range']['from'])) && ($lip <= ip2long($dhcpifconf['range']['to']))) {
+                               $data['if'] = $dhcpif;
+                               break;
+                       }
+               }
                echo "<tr>\n";
                echo "<td class=\"listlr\">{$fspans}{$data['ip']}{$fspane}&nbsp;</td>\n";
                echo "<td class=\"listr\">{$fspans}{$data['mac']}{$fspane}&nbsp;</td>\n";
                echo "<td class=\"listr\">{$fspans}{$data['hostname']}{$fspane}&nbsp;</td>\n";
-               echo "<td class=\"listr\">{$fspans}{$data['start']}{$fspane}&nbsp;</td>\n";
-               echo "<td class=\"listr\">{$fspans}{$data['end']}{$fspane}&nbsp;</td>\n";
+               echo "<td class=\"listr\">{$fspans}" . adjust_gmt($data['start']) . "{$fspane}&nbsp;</td>\n";
+               echo "<td class=\"listr\">{$fspans}" . adjust_gmt($data['end']) . "{$fspane}&nbsp;</td>\n";
+               echo "<td class=\"list\" valign=\"middle\"><a href=\"services_dhcp_edit.php?if={$data['if']}&mac={$data['mac']}\"><img src=\"plus.gif\" width=\"17\" height=\"17\" border=\"0\" title=\"add a static mapping for this MAC address\"></a></td>\n";
                echo "</tr>\n";
        }
 }
 ?>
 </table>
-<p>
+<br>
 <form action="diag_dhcp_leases.php" method="GET">
 <input type="hidden" name="order" value="<?=$_GET['order'];?>">
 <?php if ($_GET['all']): ?>
@@ -182,8 +188,6 @@ foreach ($leases as $data) {
 <?php endif; ?>
 </form>
 <?php else: ?>
-<p><strong>No leases file found. Is the DHCP server active?</strong></p>
+<strong>No leases file found. Is the DHCP server active?</strong>
 <?php endif; ?>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index caba9d16e1125d90d22dbc4676014b30aa242516..2b2b649b582ad4af6fbd43c41d1db62f903ccc97 100644 (file)
@@ -4,7 +4,7 @@
        diag_ipsec_sad.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Diagnostics", "IPsec");
+
 require("guiconfig.inc");
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Diagnostics: IPsec");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Diagnostics: IPsec</p>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
        <li class="tabact">SAD</li>
        <li class="tabinact"><a href="diag_ipsec_spd.php">SPD</a></li>
@@ -135,5 +127,3 @@ foreach ($sad as $sa): ?>
 <?php endif; ?>
 </td></tr></table>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 80cd066d771adaf2edf495c54001c1ed1cc878ff..48b2f34296a2fc3cff0317afd235bebcc32fd667 100644 (file)
@@ -4,7 +4,7 @@
        diag_ipsec_spd.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Diagnostics", "IPsec");
+
 require("guiconfig.inc");
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Diagnostics: IPsec");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Diagnostics: IPsec</p>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
-       <li class="tabinact"><a href="diag_ipsec_sad.php">SAD</a></li>
+       <li class="tabinact1"><a href="diag_ipsec_sad.php">SAD</a></li>
        <li class="tabact">SPD</li>
   </ul>
   </td></tr>
@@ -151,5 +143,3 @@ foreach ($spd as $sp): ?>
 <?php endif; ?>
 </td></tr></table>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index e28c36d616fd4ae5558705f9a62b895de19cc696..a06cbab13be1b5be10391cf43c8543c303609eff 100644 (file)
@@ -4,7 +4,7 @@
        diag_logs.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Diagnostics", "Logs");
 require("guiconfig.inc");
 
 $nentries = $config['syslog']['nentries'];
@@ -61,23 +62,14 @@ function dump_clog($logfile, $tail, $withorig = true) {
 }
 
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Diagnostics: Logs");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Diagnostics: Logs</p>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
        <li class="tabact">System</li>
     <li class="tabinact"><a href="diag_logs_filter.php">Firewall</a></li>
     <li class="tabinact"><a href="diag_logs_dhcp.php">DHCP</a></li>
+    <li class="tabinact"><a href="diag_logs_portal.php">Captive portal</a></li>
     <li class="tabinact"><a href="diag_logs_vpn.php">PPTP VPN</a></li>
     <li class="tabinact"><a href="diag_logs_settings.php">Settings</a></li>
   </ul>
@@ -98,5 +90,3 @@ function dump_clog($logfile, $tail, $withorig = true) {
   </tr>
 </table>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 6a65360dea74439258485da2d55785cef18547f2..b08591524775df9378e85550db7e9214b27de41d 100644 (file)
@@ -4,7 +4,7 @@
        diag_logs_dhcp.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Diagnostics", "Logs");
 require("guiconfig.inc");
 
 $nentries = $config['syslog']['nentries'];
@@ -61,23 +62,14 @@ function dump_clog($logfile, $tail, $withorig = true) {
 }
 
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Diagnostics: Logs");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Diagnostics: Logs</p>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
-    <li class="tabinact"><a href="diag_logs.php">System</a></li>
+    <li class="tabinact1"><a href="diag_logs.php">System</a></li>
     <li class="tabinact"><a href="diag_logs_filter.php">Firewall</a></li>
     <li class="tabact">DHCP</li>
+    <li class="tabinact"><a href="diag_logs_portal.php">Captive portal</a></li>
     <li class="tabinact"><a href="diag_logs_vpn.php">PPTP VPN</a></li>
     <li class="tabinact"><a href="diag_logs_settings.php">Settings</a></li>
   </ul>
@@ -98,6 +90,3 @@ function dump_clog($logfile, $tail, $withorig = true) {
   </tr>
 </table>
 <?php include("fend.inc"); ?>
-</body>
-</html>
-
index 990089a620aa25b3ff44136303a9447fab4f0497..2e827acdcf92bd4e42112e0d40a7413b4def3c69 100644 (file)
@@ -4,7 +4,7 @@
        diag_logs_filter.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Diagnostics", "Logs");
 require("guiconfig.inc");
 
 $nentries = $config['syslog']['nentries'];
@@ -116,23 +117,14 @@ function format_ipf_ip($ipfip) {
 }
 
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Diagnostics: Logs");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Diagnostics: Logs</p>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
-    <li class="tabinact"><a href="diag_logs.php">System</a></li>
+    <li class="tabinact1"><a href="diag_logs.php">System</a></li>
     <li class="tabact">Firewall</li>
     <li class="tabinact"><a href="diag_logs_dhcp.php">DHCP</a></li>
+    <li class="tabinact"><a href="diag_logs_portal.php">Captive portal</a></li>
     <li class="tabinact"><a href="diag_logs_vpn.php">PPTP VPN</a></li>
     <li class="tabinact"><a href="diag_logs_settings.php">Settings</a></li>
   </ul>
@@ -186,5 +178,3 @@ function format_ipf_ip($ipfip) {
   </tr>
 </table>
 <?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/webgui/diag_logs_portal.php b/webgui/diag_logs_portal.php
new file mode 100644 (file)
index 0000000..fce4b32
--- /dev/null
@@ -0,0 +1,87 @@
+#!/usr/local/bin/php
+<?php 
+/*
+       diag_logs_portal.php
+       part of m0n0wall (http://m0n0.ch/wall)
+       
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
+       All rights reserved.
+       
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions are met:
+       
+       1. Redistributions of source code must retain the above copyright notice,
+          this list of conditions and the following disclaimer.
+       
+       2. Redistributions in binary form must reproduce the above copyright
+          notice, this list of conditions and the following disclaimer in the
+          documentation and/or other materials provided with the distribution.
+       
+       THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+       INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+       AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+       AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+       OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+       INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+       CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+       ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+       POSSIBILITY OF SUCH DAMAGE.
+*/
+
+$pgtitle = array("Diagnostics", "Logs");
+require("guiconfig.inc");
+
+$nentries = $config['syslog']['nentries'];
+if (!$nentries)
+       $nentries = 50;
+
+if ($_POST['clear']) {
+       exec("/usr/sbin/clog -i -s 32768 /var/log/portalauth.log");
+}
+
+function dump_clog($logfile, $tail) {
+       global $g, $config;
+
+       $sor = isset($config['syslog']['reverse']) ? "-r" : "";
+
+       exec("/usr/sbin/clog " . $logfile . " | tail {$sor} -n " . $tail, $logarr);
+       
+       foreach ($logarr as $logent) {
+               $logent = preg_split("/\s+/", $logent, 6);
+               echo "<tr valign=\"top\">\n";
+               echo "<td class=\"listlr\" nowrap>" . htmlspecialchars(join(" ", array_slice($logent, 0, 3))) . "</td>\n";
+               echo "<td class=\"listr\">" . htmlspecialchars($logent[5]) . "</td>\n";
+               echo "</tr>\n";
+       }
+}
+
+?>
+<?php include("fbegin.inc"); ?>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+  <tr><td class="tabnavtbl">
+  <ul id="tabnav">
+    <li class="tabinact1"><a href="diag_logs.php">System</a></li>
+    <li class="tabinact"><a href="diag_logs_filter.php">Firewall</a></li>
+    <li class="tabinact"><a href="diag_logs_dhcp.php">DHCP</a></li>
+    <li class="tabact">Captive portal</li>
+    <li class="tabinact"><a href="diag_logs_vpn.php">PPTP VPN</a></li>
+    <li class="tabinact"><a href="diag_logs_settings.php">Settings</a></li>
+  </ul>
+  </td></tr>
+  <tr> 
+    <td class="tabcont">
+               <table width="100%" border="0" cellspacing="0" cellpadding="0">
+                 <tr> 
+                       <td colspan="2" class="listtopic"> 
+                         Last <?=$nentries;?> captive portal log entries</td>
+                 </tr>
+                 <?php dump_clog("/var/log/portalauth.log", $nentries); ?>
+               </table>
+               <br><form action="diag_logs_portal.php" method="post">
+<input name="clear" type="submit" class="formbtn" value="Clear log">
+</form>
+       </td>
+  </tr>
+</table>
+<?php include("fend.inc"); ?>
index a0036b9b93d1e40ed0cb22235f650ee02e402171..69b724f3296d66b6e5f93f3fee11627bd6ee6d06 100644 (file)
@@ -4,7 +4,7 @@
        diag_logs_settings.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Diagnostics", "Logs");
 require("guiconfig.inc");
 
 $pconfig['reverse'] = isset($config['syslog']['reverse']);
@@ -36,6 +37,7 @@ $pconfig['nentries'] = $config['syslog']['nentries'];
 $pconfig['remoteserver'] = $config['syslog']['remoteserver'];
 $pconfig['filter'] = isset($config['syslog']['filter']);
 $pconfig['dhcp'] = isset($config['syslog']['dhcp']);
+$pconfig['portalauth'] = isset($config['syslog']['portalauth']);
 $pconfig['vpn'] = isset($config['syslog']['vpn']);
 $pconfig['system'] = isset($config['syslog']['system']);
 $pconfig['enable'] = isset($config['syslog']['enable']);
@@ -64,6 +66,7 @@ if ($_POST) {
                $config['syslog']['remoteserver'] = $_POST['remoteserver'];
                $config['syslog']['filter'] = $_POST['filter'] ? true : false;
                $config['syslog']['dhcp'] = $_POST['dhcp'] ? true : false;
+               $config['syslog']['portalauth'] = $_POST['portalauth'] ? true : false;
                $config['syslog']['vpn'] = $_POST['vpn'] ? true : false;
                $config['syslog']['system'] = $_POST['system'] ? true : false;
                $config['syslog']['enable'] = $_POST['enable'] ? true : false;
@@ -86,12 +89,7 @@ if ($_POST) {
 }
 
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Diagnostics: Logs");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
+<?php include("fbegin.inc"); ?>
 <script language="JavaScript">
 <!--
 function enable_change(enable_over) {
@@ -99,32 +97,30 @@ function enable_change(enable_over) {
                document.iform.remoteserver.disabled = 0;
                document.iform.filter.disabled = 0;
                document.iform.dhcp.disabled = 0;
+               document.iform.portalauth.disabled = 0;
                document.iform.vpn.disabled = 0;
                document.iform.system.disabled = 0;
        } else {
                document.iform.remoteserver.disabled = 1;
                document.iform.filter.disabled = 1;
                document.iform.dhcp.disabled = 1;
+               document.iform.portalauth.disabled = 1;
                document.iform.vpn.disabled = 1;
                document.iform.system.disabled = 1;
        }
 }
 // -->
 </script>
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">Diagnostics: Logs</p>
 <form action="diag_logs_settings.php" method="post" name="iform" id="iform">
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if ($savemsg) print_info_box($savemsg); ?>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
-    <li class="tabinact"><a href="diag_logs.php">System</a></li>
+    <li class="tabinact1"><a href="diag_logs.php">System</a></li>
     <li class="tabinact"><a href="diag_logs_filter.php">Firewall</a></li>
     <li class="tabinact"><a href="diag_logs_dhcp.php">DHCP</a></li>
+    <li class="tabinact"><a href="diag_logs_portal.php">Captive portal</a></li>
     <li class="tabinact"><a href="diag_logs_vpn.php">PPTP VPN</a></li>
     <li class="tabact">Settings</li>
   </ul>
@@ -168,10 +164,16 @@ function enable_change(enable_over) {
                           server</td>
                         <td width="78%" class="vtable"> <input name="remoteserver" id="remoteserver" type="text" class="formfld" size="20" value="<?=htmlspecialchars($pconfig['remoteserver']);?>"> 
                           <br>
-                          IP address of remote syslog server<br> <br> <input name="system" id="system" type="checkbox" value="yes" onclick="enable_change(false)" <?php if ($pconfig['system']) echo "checked"; ?>>
-                          system events <br> <input name="filter" id="filter" type="checkbox" value="yes" <?php if ($pconfig['filter']) echo "checked"; ?>>
-                          firewall events<br> <input name="dhcp" id="dhcp" type="checkbox" value="yes" <?php if ($pconfig['dhcp']) echo "checked"; ?>>
-                          DHCP service events<br> <input name="vpn" id="vpn" type="checkbox" value="yes" <?php if ($pconfig['vpn']) echo "checked"; ?>>
+                          IP address of remote syslog server<br> <br>
+                                                 <input name="system" id="system" type="checkbox" value="yes" onclick="enable_change(false)" <?php if ($pconfig['system']) echo "checked"; ?>>
+                          system events <br>
+                                                 <input name="filter" id="filter" type="checkbox" value="yes" <?php if ($pconfig['filter']) echo "checked"; ?>>
+                          firewall events<br>
+                                                 <input name="dhcp" id="dhcp" type="checkbox" value="yes" <?php if ($pconfig['dhcp']) echo "checked"; ?>>
+                          DHCP service events<br>
+                                                 <input name="portalauth" id="portalauth" type="checkbox" value="yes" <?php if ($pconfig['portalauth']) echo "checked"; ?>>
+                          Captive portal<br> 
+                                                 <input name="vpn" id="vpn" type="checkbox" value="yes" <?php if ($pconfig['vpn']) echo "checked"; ?>>
                           PPTP VPN events</td>
                       </tr>
                       <tr> 
@@ -180,7 +182,7 @@ function enable_change(enable_over) {
                         </td>
                       </tr>
                       <tr> 
-                        <td width="22%" height="53" valign="top">&nbsp;</td>
+                        <td width="22%" valign="top">&nbsp;</td>
                         <td width="78%"><strong><span class="red">Note:</span></strong><br>
                           syslog sends UDP datagrams to port 514 on the specified 
                           remote syslog server. Be sure to set syslogd on the 
@@ -198,5 +200,3 @@ enable_change(false);
 //-->
 </script>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 76c0ff16889dbb80c3e59647bb14379df237a5e3..52d5bf1798fd6bb60cdc2620f8369cf853ccc512 100644 (file)
@@ -4,7 +4,7 @@
        diag_logs_vpn.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Diagnostics", "Logs");
 require("guiconfig.inc");
 
 $nentries = $config['syslog']['nentries'];
@@ -65,23 +66,14 @@ function dump_clog($logfile, $tail) {
 }
 
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Diagnostics: Logs");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Diagnostics: Logs</p>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
-    <li class="tabinact"><a href="diag_logs.php">System</a></li>
+    <li class="tabinact1"><a href="diag_logs.php">System</a></li>
     <li class="tabinact"><a href="diag_logs_filter.php">Firewall</a></li>
     <li class="tabinact"><a href="diag_logs_dhcp.php">DHCP</a></li>
+    <li class="tabinact"><a href="diag_logs_portal.php">Captive portal</a></li>
     <li class="tabact">PPTP VPN</li>
     <li class="tabinact"><a href="diag_logs_settings.php">Settings</a></li>
   </ul>
@@ -107,5 +99,3 @@ function dump_clog($logfile, $tail) {
   </tr>
 </table>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 33ad4acb5c7fd3a0ed3cd9ff74ea50eeba50179c..cbc5f27a841f9f9b54d6aad9fdbc86b5fbdf2ded 100644 (file)
@@ -4,7 +4,7 @@
        diag_ping.php
        part of m0n0wall (http://m0n0.ch/wall)
 
-       Copyright (C) 2003-2004 Bob Zoller (bob@kludgebox.com) and Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Bob Zoller (bob@kludgebox.com) and Manuel Kasper <mk@neon1.net>.
        All rights reserved.
 
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Diagnostics", "Ping");
 require("guiconfig.inc");
 
 define('MAX_COUNT', 10);
@@ -49,7 +50,7 @@ if ($_POST) {
 
        if (!$input_errors) {
                $do_ping = true;
-               $host = preg_replace ("/[^A-Za-z0-9.]/","",$_POST['host']);
+               $host = $_POST['host'];
                $count = $_POST['count'];
 
        }
@@ -60,29 +61,19 @@ if (!isset($do_ping)) {
        $count = DEFAULT_COUNT;
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Diagnostics: Ping");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Diagnostics: Ping</font></p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
                        <form action="diag_ping.php" method="post" name="iform" id="iform">
                          <table width="100%" border="0" cellpadding="6" cellspacing="0">
                 <tr>
                                  <td width="22%" valign="top" class="vncellreq">Host</td>
                                  <td width="78%" class="vtable"> 
-                    <input name="host" type="text" class="formfld" id="host" size="20" value="<?=htmlspecialchars($host);?>"></td>
+                    <?=$mandfldhtml;?><input name="host" type="text" class="formfld" id="host" size="20" value="<?=htmlspecialchars($host);?>"></td>
                                </tr>
                                <tr>
                                  <td width="22%" valign="top" class="vncellreq">Count</td>
                                  <td width="78%" class="vtable">
-<select name="count" class="formfld" id="count">
+                                       <select name="count" class="formfld" id="count">
                                        <?php for ($i = 1; $i <= MAX_COUNT; $i++): ?>
                                        <option value="<?=$i;?>" <?php if ($i == $count) echo "selected"; ?>><?=$i;?></option>
                                        <?php endfor; ?>
@@ -109,5 +100,3 @@ if (!isset($do_ping)) {
                        </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 3a7f0287ab99e21fd163414794543bbd8410ae38..f55b0afe9f9beb079d4cd27863d34cb832c9acf3 100644 (file)
@@ -4,7 +4,7 @@
        diag_resetstate.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Diagnostics", "Reset state");
 require("guiconfig.inc");
 
 if ($_POST) {
@@ -46,24 +47,14 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Diagnostics: Reset state");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-      <p class="pgtitle">Diagnostics: Reset state</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if ($savemsg) print_info_box($savemsg); ?>
             <form action="diag_resetstate.php" method="post" name="iform" id="iform">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
                 <tr> 
                   <td width="22%" valign="top" class="vtable">&nbsp;</td>
-                  <td width="78%" class="vtable"> <p> 
+                  <td width="78%" class="vtable">
                       <input name="nattable" type="checkbox" id="nattable" value="yes" checked>
                       <strong>NAT table</strong><br>
                       <input name="statetable" type="checkbox" id="statetable" value="yes" checked>
@@ -81,7 +72,7 @@ if ($_POST) {
                       <br>
                       NOTE: If you reset the firewall state table, the browser 
                       session may appear to be hung after clicking &quot;Reset&quot;. 
-                      Simply refresh the page to continue.</span></p>
+                      Simply refresh the page to continue.</span>
                     </td>
                                </tr>
                 <tr> 
@@ -93,5 +84,3 @@ if ($_POST) {
               </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 8f47fc597420a084ed1a6250b9133c575b4c06b5..af73d23de92731ee6436d1064ae2c3409ba43495 100644 (file)
@@ -74,7 +74,7 @@ if (isBlank( $_POST['txtRecallBuffer'] )) {
 ?>
 
    // Set pointer to end of recall buffer.
-   var intRecallPtr = arrRecallBuffer.length-1;
+   var intRecallPtr = arrRecallBuffer.length;
 
    // Functions to extend String class.
    function str_encode() { return escape( this ) }
@@ -142,6 +142,23 @@ if (isBlank( $_POST['txtRecallBuffer'] )) {
 
       return true;
    }
+
+   // hansmi, 2005-01-13
+   function txtCommand_onKey(e) {
+       if(!e) var e = window.event; // IE-Fix
+       var code = (e.keyCode?e.keyCode:(e.which?e.which:0));
+       if(!code) return;
+       var f = document.getElementsByName('frmExecPlus')[0];
+       if(!f) return;
+       switch(code) {
+       case 38: // up
+           btnRecall_onClick(f, -1);
+           break;
+       case 40: // down
+           btnRecall_onClick(f, 1);
+           break;
+       }
+   }
 //-->
 </script>
 <link href="gui.css" rel="stylesheet" type="text/css">
@@ -179,7 +196,11 @@ pre {
 -->
 </style>
 </head>
-<body>
+<body<?php
+if(!isBlank($_POST['txtCommand'])) {
+    echo ' onload="document.forms[\'frmExecPlus\'].txtCommand.focus();"';
+}
+?>>
 <p><span class="pgtitle"><?=$Title ?></span>
 <?php if (isBlank($_POST['txtCommand'])): ?>
 <p class="red"><strong>Note: this function is unsupported. Use it
@@ -205,10 +226,10 @@ if (!isBlank($_POST['txtCommand'])) {
   <table>
     <tr>
       <td class="label" align="right">Command:</td>
-      <td class="type"><input name="txtCommand" type="text" size="80" value="<?=htmlspecialchars($_POST['txtCommand']);?>"></td>
+      <td class="type"><input name="txtCommand" type="text" size="80" value="" onkeypress="txtCommand_onKey(event);"></td>
     </tr>
     <tr>
-      <td valign="top">&nbsp;&nbsp;&nbsp;</td>
+      <td valign="top">&nbsp;</td>
       <td valign="top" class="label">
          <input type="hidden" name="txtRecallBuffer" value="<?=$_POST['txtRecallBuffer'] ?>">
          <input type="button" class="button" name="btnRecallPrev" value="<" onClick="btnRecall_onClick( this.form, -1 );">
index 6d1ca34a2a70f518a5d7d70ffa011f697b183737..bccdc23e9de131b9d86e6e9c4e32e7d6b2df1756 100644 (file)
@@ -4,7 +4,7 @@
        exec_raw.php
        part of m0n0wall (http://m0n0.ch/wall)
 
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
 
        Redistribution and use in source and binary forms, with or without
index cdcb085970953e767e5b848cb692d32757e7cfd6..039e50a3966f42ab2e8146a20f042a642cbf2a69 100644 (file)
@@ -1,3 +1,27 @@
+<?php
+$navlevelsep = ": ";   /* navigation level separator string */
+$mandfldhtml = "";             /* display this before mandatory input fields */
+$mandfldhtmlspc = "";  /* same as above, but with spacing */
+
+function gentitle($title) {
+       global $navlevelsep;
+       return join($navlevelsep, $title);
+}
+
+function genhtmltitle($title) {
+       global $config;
+       return $config['system']['hostname'] . "." . $config['system']['domain'] . " - " . gentitle($title);
+}
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title><?=genhtmltitle($pgtitle);?></title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<link href="gui.css" rel="stylesheet" type="text/css">
+</head>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <script language="javascript">
 <!--
 var tri_open = "";
@@ -129,3 +153,6 @@ endif;
         </tr></table></td>
     <td width="600"><table width="100%" border="0" cellpadding="10" cellspacing="0">
         <tr><td>
+<?php if (!$pgtitle_omit): ?>
+      <p class="pgtitle"><?=gentitle($pgtitle);?></p>
+<?php endif; ?>
index eb5f601352246b1751a10dd81dd568d83b9d9296..c88a50ccb6de4d0d50bf14115fdd4d62953c8b1c 100644 (file)
@@ -1,7 +1,9 @@
 </td></tr></table></td>
   </tr>
   <tr align="center" valign="top" bgcolor="#435370"> 
-    <td colspan="2" class="cpline">m0n0wall is &copy; 2002-2004 by Manuel Kasper. 
+    <td colspan="2" class="cpline">m0n0wall is &copy; 2002-2005 by Manuel Kasper. 
       All rights reserved.&nbsp; [<a href="/license.php" class="tblnk">view license</a>]</td>
   </tr>
-</table>
\ No newline at end of file
+</table>
+</body>
+</html>
index cb94725dbd619f13142d93e2f6e409fd68088f29..1cda7c1f84126b41f570779a01e7bbc646c9ad8b 100644 (file)
@@ -4,7 +4,7 @@
        firewall_aliases.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Firewall", "Aliases");
 require("guiconfig.inc");
 
 if (!is_array($config['aliases']['alias']))
@@ -68,17 +69,7 @@ if ($_GET['act'] == "del") {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Firewall: Aliases");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Firewall: Aliases</p>
 <form action="firewall_aliases.php" method="post">
 <?php if ($savemsg) print_info_box($savemsg); ?>
 <?php if (file_exists($d_aliasesdirty_path)): ?><p>
@@ -123,5 +114,3 @@ if ($_GET['act'] == "del") {
                 be resolved (e.g. because you deleted it), the corresponding element 
                 (e.g. filter/NAT/shaper rule) will be considered invalid and skipped.</span></p>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 89551975c506f19308da98e7b413f53108bd89ef..81c27a3478323d357de819d862f0ef157c0c308b 100644 (file)
@@ -4,7 +4,7 @@
        firewall_aliases_edit.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Firewall", "Aliases", "Edit alias");
 require("guiconfig.inc");
 
 if (!is_array($config['aliases']['alias']))
@@ -112,12 +113,7 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("System: Firewall: Aliases: Edit alias");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
+<?php include("fbegin.inc"); ?>
 <script language="JavaScript">
 <!--
 function typesel_change() {
@@ -133,17 +129,12 @@ function typesel_change() {
 }
 //-->
 </script>
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">Firewall: Aliases: Edit alias</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
             <form action="firewall_aliases_edit.php" method="post" name="iform" id="iform">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
                 <tr> 
                   <td valign="top" class="vncellreq">Name</td>
-                  <td class="vtable"> <input name="name" type="text" class="formfld" id="name" size="40" value="<?=htmlspecialchars($pconfig['name']);?>"> 
+                  <td class="vtable"><?=$mandfldhtml;?><input name="name" type="text" class="formfld" id="name" size="40" value="<?=htmlspecialchars($pconfig['name']);?>"> 
                     <br> <span class="vexpl">The name of the alias may only consist 
                     of the characters a-z, A-Z and 0-9.</span></td>
                 </tr>
@@ -158,7 +149,7 @@ function typesel_change() {
                 </tr>
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Address</td>
-                  <td width="78%" class="vtable"> <input name="address" type="text" class="formfld" id="address" size="20" value="<?=htmlspecialchars($pconfig['address']);?>">
+                  <td width="78%" class="vtable"><?=$mandfldhtml;?><input name="address" type="text" class="formfld" id="address" size="20" value="<?=htmlspecialchars($pconfig['address']);?>">
                     / 
                     <select name="address_subnet" class="formfld" id="address_subnet">
                       <?php for ($i = 32; $i >= 1; $i--): ?>
@@ -191,5 +182,3 @@ typesel_change();
 //-->
 </script>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 1708ef8730480e095f772838a8e02196bc3650ea..cb5845ee3b4ae2ed831e3a2337f933278c67832c 100644 (file)
@@ -4,7 +4,7 @@
        firewall_nat.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Firewall", "NAT");
 require("guiconfig.inc");
 
 if (!is_array($config['nat']['rule'])) {
@@ -69,17 +70,7 @@ if ($_GET['act'] == "del") {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Firewall: NAT");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Firewall: NAT</font></p>
 <form action="firewall_nat.php" method="post">
 <?php if ($savemsg) print_info_box($savemsg); ?>
 <?php if (file_exists($d_natconfdirty_path)): ?><p>
@@ -87,7 +78,7 @@ if ($_GET['act'] == "del") {
 <input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
 <?php endif; ?>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
     <li class="tabact">Inbound</li>
     <li class="tabinact"><a href="firewall_nat_server.php">Server NAT</a></li>
@@ -158,14 +149,12 @@ if ($_GET['act'] == "del") {
                   <td class="list" colspan="6"></td>
                   <td class="list"> <a href="firewall_nat_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
                                </tr>
-              </table>
-                    <p><span class="vexpl"><span class="red"><strong>Note:<br>
+              </table><br>
+                    <span class="vexpl"><span class="red"><strong>Note:<br>
                       </strong></span>It is not possible to access NATed services 
                       using the WAN IP address from within LAN (or an optional 
-                      network).</span></p></td>
+                      network).</span></td>
   </tr>
 </table>
             </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index f4d2e20f6a55194e5a6ebff87460946392b018c2..a2dfde9765bc274dc996a064052329ef2bc2b504 100644 (file)
@@ -4,7 +4,7 @@
        firewall_nat_1to1.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Firewall", "NAT");
 require("guiconfig.inc");
 
 if (!is_array($config['nat']['onetoone'])) {
@@ -46,6 +47,7 @@ if ($_POST) {
                if (!file_exists($d_sysrebootreqd_path)) {
                        config_lock();
                        $retval |= filter_configure();
+                       $retval |= services_proxyarp_configure();
                        config_unlock();
                }
                $savemsg = get_std_save_message($retval);
@@ -55,6 +57,8 @@ if ($_POST) {
                                unlink($d_natconfdirty_path);
                        if (file_exists($d_filterconfdirty_path))
                                unlink($d_filterconfdirty_path);
+                       if (file_exists($d_proxyarpdirty_path))
+                               unlink($d_proxyarpdirty_path);
                }
        }
 }
@@ -69,26 +73,17 @@ if ($_GET['act'] == "del") {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Firewall: NAT");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Firewall: NAT</p>
 <form action="firewall_nat_1to1.php" method="post">
 <?php if ($savemsg) print_info_box($savemsg); ?>
 <?php if (file_exists($d_natconfdirty_path)): ?><p>
 <?php print_info_box_np("The NAT configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br>
 <input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
 <?php endif; ?>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">  <tr><td>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+<tr><td class="tabnavtbl">
   <ul id="tabnav">
-    <li class="tabinact"><a href="firewall_nat.php">Inbound</a></li>
+    <li class="tabinact1"><a href="firewall_nat.php">Inbound</a></li>
     <li class="tabinact"><a href="firewall_nat_server.php">Server NAT</a></li>
     <li class="tabact">1:1</li>
     <li class="tabinact"><a href="firewall_nat_out.php">Outbound</a></li>
@@ -133,13 +128,11 @@ if ($_GET['act'] == "del") {
                   <td class="list" colspan="4"></td>
                   <td class="list"> <a href="firewall_nat_1to1_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
                                </tr>
-              </table>
-                                                       <p><span class="vexpl"><span class="red"><strong>Note:<br>
-                      </strong></span>Depending on the way your WAN connection is setup, you may also need <a href="services_proxyarp.php">proxy ARP</a>.</span></p>
+              </table><br>
+                               <span class="vexpl"><span class="red"><strong>Note:<br>
+                </strong></span>Depending on the way your WAN connection is setup, you may also need <a href="services_proxyarp.php">proxy ARP</a>.</span>
 </td>
 </tr>
 </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 7361c925df562d0b81c06f57b4ee7f1aaa7a6f17..87758763e355bb831f40a44ddf905425744a5a8b 100644 (file)
@@ -4,7 +4,7 @@
        firewall_nat_1to1_edit.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Firewall", "NAT", "Edit 1:1");
 require("guiconfig.inc");
 
 if (!is_array($config['nat']['onetoone'])) {
@@ -75,12 +76,26 @@ if ($_POST) {
                $input_errors[] = "A valid internal subnet must be specified.";
        }
        
+       /*  return the subnet address given a host address and a subnet bit count */
+       if ($extsubnetip = gen_subnet($_POST['external'], $_POST['subnet'])) {
+               $_POST['external'] = $extsubnetip;
+       } else {
+               $input_errors[] = "Can't convert external ip to valid subnet address.";
+       }
+
+       if ($intsubnetip = gen_subnet($_POST['internal'], $_POST['subnet'])) {
+               $_POST['internal'] = $intsubnetip;
+       } else {
+               $input_errors[] = "Can't convert internal ip to valid subnet address.";
+       }
+
        if (is_ipaddr($config['interfaces']['wan']['ipaddr'])) {
                if (check_subnets_overlap($_POST['external'], $_POST['subnet'], 
                                $config['interfaces']['wan']['ipaddr'], 32))
                        $input_errors[] = "The WAN IP address may not be used in a 1:1 rule.";
        }
        
+
        /* check for overlaps with other 1:1 */
        foreach ($a_1to1 as $natent) {
                if (isset($id) && ($a_1to1[$id]) && ($a_1to1[$id] === $natent))
@@ -131,6 +146,18 @@ if ($_POST) {
                        $a_1to1[] = $natent;
                
                touch($d_natconfdirty_path);
+
+                if ($_POST['autoaddproxy']) {
+                        /* auto-generate a matching proxy arp entry */
+                        $arpent = array();           
+                        $arpent['interface'] = $_POST['interface'];
+                        $arpent['network'] = $_POST['external'] . "/" . $_POST['subnet'];
+                        $arpent['descr'] = "NAT " . $_POST['descr'];
+                        
+                        $config['proxyarp']['proxyarpnet'][] = $arpent;
+                        
+                        touch($d_proxyarpdirty_path);
+                }
                
                write_config();
                
@@ -139,17 +166,7 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Firewall: NAT: Edit 1:1");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Firewall: NAT: Edit 1:1</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
             <form action="firewall_nat_1to1_edit.php" method="post" name="iform" id="iform">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
@@ -174,7 +191,7 @@ if ($_POST) {
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">External subnet</td>
                   <td width="78%" class="vtable"> 
-                    <input name="external" type="text" class="formfld" id="external" size="20" value="<?=htmlspecialchars($pconfig['external']);?>">
+                    <?=$mandfldhtml;?><input name="external" type="text" class="formfld" id="external" size="20" value="<?=htmlspecialchars($pconfig['external']);?>">
                     / 
                     <select name="subnet" class="formfld" id="subnet">
                       <?php for ($i = 32; $i >= 0; $i--): ?>
@@ -189,7 +206,7 @@ if ($_POST) {
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Internal subnet</td>
                   <td width="78%" class="vtable"> 
-                    <input name="internal" type="text" class="formfld" id="internal" size="20" value="<?=htmlspecialchars($pconfig['internal']);?>"> 
+                    <?=$mandfldhtml;?><input name="internal" type="text" class="formfld" id="internal" size="20" value="<?=htmlspecialchars($pconfig['internal']);?>"> 
                     <br>
                      <span class="vexpl">Enter the internal (LAN) subnet for the 1:1 mapping. The subnet size specified for the external subnet also applies to the internal subnet (they  have to be the same).</span></td>
                 </tr>
@@ -199,7 +216,14 @@ if ($_POST) {
                     <input name="descr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>"> 
                     <br> <span class="vexpl">You may enter a description here 
                     for your reference (not parsed).</span></td>
-                </tr>
+                </tr><?php if (!(isset($id) && $a_1to1[$id])): ?>
+               <tr> 
+                 <td width="22%" valign="top">&nbsp;</td>
+                 <td width="78%"> 
+                   <input name="autoaddproxy" type="checkbox" id="autoaddproxy" value="yes" checked="checked">
+                   <strong>Auto-add a <a href="services_proxyarp.php">proxy ARP</a> entry to this interface
+                   </strong></td>
+               </tr><?php endif; ?>
                 <tr> 
                   <td width="22%" valign="top">&nbsp;</td>
                   <td width="78%"> 
@@ -212,5 +236,3 @@ if ($_POST) {
               </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index d80865f0eeae25485701a9433019bc8d8a890287..a5731db82f40de3fbef0f6d6aa1e42eab0dde235 100644 (file)
@@ -4,7 +4,7 @@
        firewall_nat_edit.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Firewall", "NAT", "Edit");
 require("guiconfig.inc");
 
 if (!is_array($config['nat']['rule'])) {
@@ -109,6 +110,8 @@ if ($_POST) {
                        continue;
                if ($natent['external-address'] != $_POST['extaddr'])
                        continue;
+               if (($natent['proto'] != $_POST['proto']) && ($natent['proto'] != "tcp/udp") && ($_POST['proto'] != "tcp/udp"))
+                       continue;
                
                list($begp,$endp) = explode("-", $natent['external-port']);
                if (!$endp)
@@ -175,12 +178,7 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Firewall: NAT: Edit");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
+<?php include("fbegin.inc"); ?>
 <script language="JavaScript">
 <!--
 function ext_change() {
@@ -209,11 +207,6 @@ function ext_rep_change() {
 }
 //-->
 </script>
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">Firewall: NAT: Edit</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
             <form action="firewall_nat_edit.php" method="post" name="iform" id="iform">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
@@ -304,7 +297,7 @@ function ext_rep_change() {
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">NAT IP</td>
                   <td width="78%" class="vtable"> 
-                    <input name="localip" type="text" class="formfldalias" id="localip" size="20" value="<?=htmlspecialchars($pconfig['localip']);?>"> 
+                    <?=$mandfldhtml;?><input name="localip" type="text" class="formfldalias" id="localip" size="20" value="<?=htmlspecialchars($pconfig['localip']);?>"> 
                     <br> <span class="vexpl">Enter the internal IP address of 
                     the server on which you want to map the ports.<br>
                     e.g. <em>192.168.1.12</em></span></td>
@@ -361,5 +354,3 @@ ext_change();
 //-->
 </script>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 978f3b3083d42d9abb36262f125301daed8c9720..ce38a59f99d8d1180323d62eb06d0660942f3d30 100644 (file)
@@ -4,7 +4,7 @@
     firewall_nat_out.php
     part of m0n0wall (http://m0n0.ch/wall)
     
-    Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+    Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
     All rights reserved.
     
     Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
     POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Firewall", "NAT");
 require("guiconfig.inc");
 
 if (!is_array($config['nat']['advancedoutbound']['rule']))
@@ -71,26 +72,17 @@ if ($_GET['act'] == "del") {
     }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Firewall: NAT");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Firewall: NAT</p>
 <form action="firewall_nat_out.php" method="post">
 <?php if ($savemsg) print_info_box($savemsg); ?>
 <?php if (file_exists($d_natconfdirty_path)): ?><p>
 <?php print_info_box_np("The NAT configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br>
 <input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
 <?php endif; ?>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">  <tr><td>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+<tr><td class="tabnavtbl">
   <ul id="tabnav">
-    <li class="tabinact"><a href="firewall_nat.php">Inbound</a></li>
+    <li class="tabinact1"><a href="firewall_nat.php">Inbound</a></li>
     <li class="tabinact"><a href="firewall_nat_server.php">Server NAT</a></li>
     <li class="tabinact"><a href="firewall_nat_1to1.php">1:1</a></li>
     <li class="tabact">Outbound</li>
@@ -100,10 +92,9 @@ if ($_GET['act'] == "del") {
     <td class="tabcont">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
                 <tr> 
-                  <td class="vtable"><p>
+                  <td class="vtable">
                       <input name="enable" type="checkbox" id="enable" value="yes" <?php if (isset($config['nat']['advancedoutbound']['enable'])) echo "checked";?>>
-                      <strong>Enable advanced outbound NAT<br>
-                      </strong></p></td>
+                      <strong>Enable advanced outbound NAT</strong></td>
                 </tr>
                 <tr> 
                   <td> <input name="submit" type="submit" class="formbtn" value="Save"> 
@@ -121,7 +112,6 @@ if ($_GET['act'] == "del") {
                     </td>
                 </tr>
               </table>
-              &nbsp;<br>
               <table width="100%" border="0" cellpadding="0" cellspacing="0">
                 <tr> 
                   <td width="10%" class="listhdrr">Interface</td>
@@ -180,5 +170,3 @@ if ($_GET['act'] == "del") {
 </table>
             </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 723de78eeeac86784dfaa6aa208f061aa5bba6d5..d4468221d68a7eca9bbd9ae2288d18115b260368 100644 (file)
@@ -4,7 +4,7 @@
     firewall_nat_out_edit.php
     part of m0n0wall (http://m0n0.ch/wall)
     
-    Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+    Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
     All rights reserved.
     
     Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
     POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Firewall", "NAT", "Edit outbound mapping");
 require("guiconfig.inc");
 
 if (!is_array($config['nat']['advancedoutbound']['rule']))
@@ -174,12 +175,7 @@ if ($_POST) {
     }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Firewall: NAT: Edit outbound mapping");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
+<?php include("fbegin.inc"); ?>
 <script language="JavaScript">
 <!--
 function typesel_change() {
@@ -198,11 +194,6 @@ function typesel_change() {
 }
 //-->
 </script>
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">Firewall: NAT: Edit outbound mapping</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
             <form action="firewall_nat_out_edit.php" method="post" name="iform" id="iform">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
@@ -227,7 +218,7 @@ function typesel_change() {
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Source</td>
                   <td width="78%" class="vtable">
-<input name="source" type="text" class="formfld" id="source" size="20" value="<?=htmlspecialchars($pconfig['source']);?>">
+                                       <?=$mandfldhtml;?><input name="source" type="text" class="formfld" id="source" size="20" value="<?=htmlspecialchars($pconfig['source']);?>">
                      
                   / 
                     <select name="source_subnet" class="formfld" id="source_subnet">
@@ -243,13 +234,14 @@ function typesel_change() {
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Destination</td>
                   <td width="78%" class="vtable">
-<input name="destination_not" type="checkbox" id="destination_not" value="yes" <?php if ($pconfig['destination_not']) echo "checked"; ?>>
+                               <input name="destination_not" type="checkbox" id="destination_not" value="yes" <?php if ($pconfig['destination_not']) echo "checked"; ?>>
                     <strong>not</strong><br>
                     Use this option to invert the sense of the match.<br>
                     <br>
                     <table border="0" cellspacing="0" cellpadding="0">
                       <tr> 
                         <td>Type:&nbsp;&nbsp;</td>
+                                               <td></td>
                         <td><select name="destination_type" class="formfld" onChange="typesel_change()">
                             <option value="any" <?php if ($pconfig['destination'] == "any") echo "selected"; ?>> 
                             any</option>
@@ -259,6 +251,7 @@ function typesel_change() {
                       </tr>
                       <tr> 
                         <td>Address:&nbsp;&nbsp;</td>
+                                               <td><?=$mandfldhtmlspc;?></td>
                         <td><input name="destination" type="text" class="formfld" id="destination" size="20" value="<?=htmlspecialchars($pconfig['destination']);?>">
                           / 
                           <select name="destination_subnet" class="formfld" id="destination_subnet">
@@ -271,6 +264,7 @@ function typesel_change() {
                       </tr>
                       <tr>
                         <td>&nbsp;</td>
+                                               <td></td>
                         <td><span class="vexpl">Enter the destination network for 
                           the outbound NAT mapping.</span></td>
                       </tr>
@@ -307,5 +301,3 @@ typesel_change();
 //-->
 </script>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 11f44b6a3ca751ba566c14ccc1fb20539226213a..e4d33c91f4d50e1a7d9159c9d2b0c711ef2685b9 100644 (file)
@@ -4,7 +4,7 @@
        firewall_nat_server.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Firewall", "NAT");
 require("guiconfig.inc");
 
 if (!is_array($config['nat']['servernat'])) {
@@ -81,17 +82,7 @@ if ($_GET['act'] == "del") {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Firewall: NAT");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Firewall: NAT</p>
 <form action="firewall_nat_server.php" method="post">
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if ($savemsg) print_info_box($savemsg); ?>
@@ -99,9 +90,10 @@ if ($_GET['act'] == "del") {
 <?php print_info_box_np("The NAT configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br>
 <input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
 <?php endif; ?>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">  <tr><td>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+<tr><td class="tabnavtbl">
   <ul id="tabnav">
-    <li class="tabinact"><a href="firewall_nat.php">Inbound</a></li>
+    <li class="tabinact1"><a href="firewall_nat.php">Inbound</a></li>
     <li class="tabact">Server NAT</li>
     <li class="tabinact"><a href="firewall_nat_1to1.php">1:1</a></li>
     <li class="tabinact"><a href="firewall_nat_out.php">Outbound</a></li>
@@ -131,13 +123,11 @@ if ($_GET['act'] == "del") {
                   <td class="list" colspan="2"></td>
                   <td class="list"> <a href="firewall_nat_server_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
                                </tr>
-              </table>
-                               <p><span class="vexpl"><span class="red"><strong>Note:<br>
-                      </strong></span>The external IP addresses defined on this page may be used in <a href="firewall_nat.php">inbound NAT</a> mappings. Depending on the way your WAN connection is setup, you may also need <a href="services_proxyarp.php">proxy ARP</a>.</span></p>
+              </table><br>
+                               <span class="vexpl"><span class="red"><strong>Note:<br>
+                      </strong></span>The external IP addresses defined on this page may be used in <a href="firewall_nat.php">inbound NAT</a> mappings. Depending on the way your WAN connection is setup, you may also need <a href="services_proxyarp.php">proxy ARP</a>.</span>
 </td>
   </tr>
 </table>
             </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 4ed1f2db943c91196f2a193f834828fcd7410018..67e4c05ba8cd188c2c408ae5ad3ff8300ab00ece 100644 (file)
@@ -4,7 +4,7 @@
        firewall_nat_server_edit.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Firewall", "NAT", "Edit Server NAT");
 require("guiconfig.inc");
 
 if (!is_array($config['nat']['servernat'])) {
@@ -109,25 +110,14 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Firewall: NAT: Edit Server NAT");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Firewall: NAT: Edit Server NAT</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
             <form action="firewall_nat_server_edit.php" method="post" name="iform" id="iform">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">External IP address</td>
                   <td width="78%" class="vtable"> 
-                    <input name="ipaddr" type="text" class="formfld" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>">
-                     
+                    <?=$mandfldhtml;?><input name="ipaddr" type="text" class="formfld" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>">
                     </td>
                 </tr>
                 <tr> 
@@ -149,5 +139,3 @@ if ($_POST) {
               </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 9e78e72ee4c16ac47c3771a33b36c4c090f90068..9686a01a8fe5bea7db6d0b73aad5bb1d7a8f5fea 100644 (file)
@@ -4,7 +4,7 @@
        firewall_rules.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Firewall", "Rules");
 require("guiconfig.inc");
 
 if (!is_array($config['filter']['rule'])) {
@@ -51,7 +52,7 @@ for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
 }
 
 if (!$if || !isset($iflist[$if]))
-       $if = "lan";
+       $if = "wan";
 
 if ($_POST) {
 
@@ -140,17 +141,57 @@ if (isset($_POST['del_x'])) {
 }
 
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Firewall: Rules");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Firewall: Rules</p>
+<script language="JavaScript">
+<!--
+function fr_toggle(id) {
+       var checkbox = document.getElementById('frc' + id);
+       checkbox.checked = !checkbox.checked;
+       fr_bgcolor(id);
+}
+function fr_bgcolor(id) {
+       var row = document.getElementById('fr' + id);
+       var checkbox = document.getElementById('frc' + id);
+       var cells = row.getElementsByTagName("td");
+       
+       for (i = 2; i <= 6; i++) {
+               cells[i].style.backgroundColor = checkbox.checked ? "#FFFFBB" : "#FFFFFF";
+       }
+       cells[7].style.backgroundColor = checkbox.checked ? "#FFFFBB" : "#D9DEE8";
+}
+function fr_insline(id, on) {
+       var row = document.getElementById('fr' + id);
+       if (id != 0) {
+               var prevrow = document.getElementById('fr' + (id-1));
+       } else {
+               var prevrow = document.getElementById('frheader');
+       }
+       
+       var cells = row.getElementsByTagName("td");
+       var prevcells = prevrow.getElementsByTagName("td");
+       
+       for (i = 2; i <= 7; i++) {
+               if (on) {
+                       prevcells[i].style.borderBottom = "3px solid #999999";
+                       prevcells[i].style.paddingBottom = (id != 0) ? 2 : 3;
+               } else {
+                       prevcells[i].style.borderBottomWidth = "1px";
+                       prevcells[i].style.paddingBottom = (id != 0) ? 4 : 5;
+               }
+       }
+       
+       for (i = 2; i <= 7; i++) {
+               if (on) {
+                       cells[i].style.borderTop = "2px solid #999999";
+                       cells[i].style.paddingTop = 2;
+               } else {
+                       cells[i].style.borderTopWidth = 0;
+                       cells[i].style.paddingTop = 4;
+               }
+       }
+}
+// -->
+</script>
 <form action="firewall_rules.php" method="post">
 <?php if ($savemsg) print_info_box($savemsg); ?>
 <?php if (file_exists($d_filterconfdirty_path)): ?><p>
@@ -158,28 +199,29 @@ if (isset($_POST['del_x'])) {
 <input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
 <?php endif; ?>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
-<?php foreach ($iflist as $ifent => $ifname):
+<?php $i = 0; foreach ($iflist as $ifent => $ifname):
        if ($ifent == $if): ?>
     <li class="tabact"><?=htmlspecialchars($ifname);?></li>
 <?php else: ?>
-    <li class="tabinact"><a href="firewall_rules.php?if=<?=$ifent;?>"><?=htmlspecialchars($ifname);?></a></li>
+    <li class="<?php if ($i == 0) echo "tabinact1"; else echo "tabinact";?>"><a href="firewall_rules.php?if=<?=$ifent;?>"><?=htmlspecialchars($ifname);?></a></li>
 <?php endif; ?>
-<?php endforeach; ?>
+<?php $i++; endforeach; ?>
   </ul>
   </td></tr>
   <tr> 
     <td class="tabcont">
               <table width="100%" border="0" cellpadding="0" cellspacing="0">
-                <tr>
+                <tr id="frheader">
+                  <td width="3%" class="list">&nbsp;</td>
                   <td width="5%" class="list">&nbsp;</td>
                   <td width="10%" class="listhdrr">Proto</td>
                   <td width="15%" class="listhdrr">Source</td>
                   <td width="10%" class="listhdrr">Port</td>
                   <td width="15%" class="listhdrr">Destination</td>
                   <td width="10%" class="listhdrr">Port</td>
-                  <td width="25%" class="listhdr">Description</td>
+                  <td width="22%" class="listhdr">Description</td>
                   <td width="10%" class="list"></td>
                                </tr>
                                <?php $nrules = 0; for ($i = 0; isset($a_filter[$i]); $i++):
@@ -187,8 +229,9 @@ if (isset($_POST['del_x'])) {
                                        if ($filterent['interface'] != $if)
                                                continue;
                                ?>
-                <tr valign="top">
-                  <td class="listt">
+                <tr valign="top" id="fr<?=$nrules;?>">
+                  <td class="listt"><input type="checkbox" id="frc<?=$nrules;?>" name="rule[]" value="<?=$i;?>" onClick="fr_bgcolor('<?=$nrules;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;"></td>
+                  <td class="listt" align="center">
                                  <?php if ($filterent['type'] == "block")
                                                        $iconfn = "block";
                                                else if ($filterent['type'] == "reject") {
@@ -215,32 +258,32 @@ if (isset($_POST['del_x'])) {
                                  <br><img src="<?=$iconfn;?>.gif" width="11" height="15" border="0">
                                  <?php endif; ?>
                                  </td>
-                  <td class="listlr"> 
+                  <td class="listlr" onClick="fr_toggle(<?=$nrules;?>)"
                     <?=$textss;?><?php if (isset($filterent['protocol'])) echo strtoupper($filterent['protocol']); else echo "*"; ?><?=$textse;?>
                   </td>
-                  <td class="listr">
+                  <td class="listr" onClick="fr_toggle(<?=$nrules;?>)">
                                    <?=$textss;?><?php echo htmlspecialchars(pprint_address($filterent['source'])); ?><?=$textse;?>
                   </td>
-                  <td class="listr">
+                  <td class="listr" onClick="fr_toggle(<?=$nrules;?>)">
                     <?=$textss;?><?php echo htmlspecialchars(pprint_port($filterent['source']['port'])); ?><?=$textse;?>
                   </td>
-                  <td class="listr"> 
+                  <td class="listr" onClick="fr_toggle(<?=$nrules;?>)"
                                    <?=$textss;?><?php echo htmlspecialchars(pprint_address($filterent['destination'])); ?><?=$textse;?>
                   </td>
-                  <td class="listr"> 
+                  <td class="listr" onClick="fr_toggle(<?=$nrules;?>)"
                     <?=$textss;?><?php echo htmlspecialchars(pprint_port($filterent['destination']['port'])); ?><?=$textse;?>
                   </td>
-                  <td class="listbg"> 
+                  <td class="listbg" onClick="fr_toggle(<?=$nrules;?>)"
                     <?=$textss;?><?=htmlspecialchars($filterent['descr']);?>&nbsp;<?=$textse;?>
                   </td>
                   <td valign="middle" nowrap class="list">
                                    <table border="0" cellspacing="0" cellpadding="1">
                                        <tr>
+                                         <td><input name="move_<?=$i;?>" type="image" src="left.gif" width="17" height="17" title="move selected rules before this rule" onMouseOver="fr_insline(<?=$nrules;?>, true)" onMouseOut="fr_insline(<?=$nrules;?>, false)"></td>
                                          <td><a href="firewall_rules_edit.php?id=<?=$i;?>"><img src="e.gif" title="edit rule" width="17" height="17" border="0"></a></td>
-                                         <td align="center" valign="middle"><input type="checkbox" name="rule[]" value="<?=$i;?>" style="margin: 0; padding: 0; width: 15px; height: 15px;"></td>
                                        </tr>
                                        <tr>
-                                         <td><input name="move_<?=$i;?>" type="image" src="left.gif" width="17" height="17" title="move selected rules before this rule"></td>
+                                         <td align="center" valign="middle"></td>
                                          <td><a href="firewall_rules_edit.php?dup=<?=$i;?>"><img src="plus.gif" title="add a new rule based on this one" width="17" height="17" border="0"></a></td>
                                        </tr>
                                        </table>
@@ -248,6 +291,7 @@ if (isset($_POST['del_x'])) {
                                </tr>
                          <?php $nrules++; endfor; ?>
                          <?php if ($nrules == 0): ?>
+              <td class="listt"></td>
                          <td class="listt"></td>
                          <td class="listlr" colspan="6" align="center" valign="middle">
                          <span class="gray">
@@ -256,18 +300,25 @@ if (isset($_POST['del_x'])) {
                          Click the <a href="firewall_rules_edit.php?if=<?=$if;?>"><img src="plus.gif" title="add new rule" border="0" width="17" height="17" align="absmiddle"></a> button to add a new rule.</span>
                          </td>
                          <?php endif; ?>
-                <tr> 
-                  <td class="list" colspan="7"></td>
+                <tr id="fr<?=$nrules;?>"> 
+                  <td class="list"></td>
+                  <td class="list"></td>
+                  <td class="list">&nbsp;</td>
+                  <td class="list">&nbsp;</td>
+                  <td class="list">&nbsp;</td>
+                  <td class="list">&nbsp;</td>
+                  <td class="list">&nbsp;</td>
+                  <td class="list">&nbsp;</td>
                   <td class="list">
                                    <table border="0" cellspacing="0" cellpadding="1">
                                        <tr>
                                      <td>
-                                         <?php if ($nrules == 0): ?><img src="left_d.gif" width="17" height="17" title="move selected rules to end" border="0"><?php else: ?><input name="move_<?=$i;?>" type="image" src="left.gif" width="17" height="17" title="move selected rules to end"><?php endif; ?></td>
-                                         <td><a href="firewall_rules_edit.php?if=<?=$if;?>"><img src="plus.gif" title="add new rule" width="17" height="17" border="0"></a></td>
+                                         <?php if ($nrules == 0): ?><img src="left_d.gif" width="17" height="17" title="move selected rules to end" border="0"><?php else: ?><input name="move_<?=$i;?>" type="image" src="left.gif" width="17" height="17" title="move selected rules to end" onMouseOver="fr_insline(<?=$nrules;?>, true)" onMouseOut="fr_insline(<?=$nrules;?>, false)"><?php endif; ?></td>
+                                         <td></td>
                                    </tr>
                                        <tr>
                                          <td><?php if ($nrules == 0): ?><img src="x_d.gif" width="17" height="17" title="delete selected rules" border="0"><?php else: ?><input name="del" type="image" src="x.gif" width="17" height="17" title="delete selected rules" onclick="return confirm('Do you really want to delete the selected rules?')"><?php endif; ?></td>
-                                         <td></td>
+                                         <td><a href="firewall_rules_edit.php?if=<?=$if;?>"><img src="plus.gif" title="add new rule" width="17" height="17" border="0"></a></td>
                                        </tr>
                                    </table>
                                  </td>
@@ -306,16 +357,13 @@ if (isset($_POST['del_x'])) {
               </table>
     </td>
   </tr>
-</table>
-  <p>
+</table><br>
   <strong><span class="red">Hint:<br>
-  </span></strong>rules are evaluated on a first-match basis (i.e. 
+  </span></strong>Rules are evaluated on a first-match basis (i.e. 
   the action of the first rule to match a packet will be executed). 
   This means that if you use block rules, you'll have to pay attention 
   to the rule order. Everything that isn't explicitly passed is blocked 
-  by default.</p>
-<input type="hidden" name="if" value="<?=$if;?>">
+  by default.
+  <input type="hidden" name="if" value="<?=$if;?>">
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 023ddb81dbb5c9e8d009a63e5b966579ef034f97..43139af786d65def51d6b3f830418bd175069aa8 100644 (file)
@@ -4,7 +4,7 @@
        firewall_rules_edit.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Firewall", "Rules", "Edit");
 require("guiconfig.inc");
 
-$specialsrcdst = explode(" ", "any lan pptp");
+$specialsrcdst = explode(" ", "any wanip lan pptp");
 
 if (!is_array($config['filter']['rule'])) {
        $config['filter']['rule'] = array();
@@ -234,6 +235,10 @@ if ($_POST) {
                $_POST['dstendport'] = 0;
        }
        
+       if (($_POST['type'] == "reject") && ($_POST['proto'] != "tcp") && ($_POST['proto'] != "udp")) {
+               $input_errors[] = "Reject only works when the protocol is set to either TCP or UDP.";
+       }
+       
        if (($_POST['srcbeginport'] && !is_port($_POST['srcbeginport']))) {
                $input_errors[] = "The start source port must be an integer between 1 and 65535.";
        }
@@ -322,12 +327,7 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Firewall: Rules: Edit");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
+<?php include("fbegin.inc"); ?>
 <script language="JavaScript">
 <!--
 var portsenabled = 1;
@@ -432,18 +432,13 @@ function dst_rep_change() {
 }
 //-->
 </script>
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">Firewall: Rules: Edit</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
             <form action="firewall_rules_edit.php" method="post" name="iform" id="iform">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Action</td>
                   <td width="78%" class="vtable">
-<select name="type" class="formfld">
+                                       <select name="type" class="formfld">
                       <?php $types = explode(" ", "Pass Block Reject"); foreach ($types as $type): ?>
                       <option value="<?=strtolower($type);?>" <?php if (strtolower($type) == strtolower($pconfig['type'])) echo "selected"; ?>>
                       <?=htmlspecialchars($type);?>
@@ -465,7 +460,7 @@ Hint: the difference between block and reject is that with reject, a packet (TCP
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Interface</td>
                   <td width="78%" class="vtable">
-<select name="interface" class="formfld">
+                                       <select name="interface" class="formfld">
                       <?php $interfaces = array('wan' => 'WAN', 'lan' => 'LAN', 'pptp' => 'PPTP');
                                          for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
                                                $interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
@@ -482,7 +477,7 @@ Hint: the difference between block and reject is that with reject, a packet (TCP
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Protocol</td>
                   <td width="78%" class="vtable">
-<select name="proto" class="formfld" onchange="proto_change()">
+                                       <select name="proto" class="formfld" onchange="proto_change()">
                       <?php $protocols = explode(" ", "TCP UDP TCP/UDP ICMP ESP AH GRE IPv6 IGMP any"); foreach ($protocols as $proto): ?>
                       <option value="<?=strtolower($proto);?>" <?php if (strtolower($proto) == $pconfig['proto']) echo "selected"; ?>>
                       <?=htmlspecialchars($proto);?>
@@ -535,6 +530,7 @@ Hint: the difference between block and reject is that with reject, a packet (TCP
                     <table border="0" cellspacing="0" cellpadding="0">
                       <tr> 
                         <td>Type:&nbsp;&nbsp;</td>
+                                               <td></td>
                         <td><select name="srctype" class="formfld" onChange="typesel_change()">
                                                        <?php $sel = is_specialnet($pconfig['src']); ?>
                             <option value="any" <?php if ($pconfig['src'] == "any") { echo "selected"; } ?>>
@@ -543,6 +539,8 @@ Hint: the difference between block and reject is that with reject, a packet (TCP
                             Single host or alias</option>
                             <option value="network" <?php if (!$sel) echo "selected"; ?>>
                             Network</option>
+                            <option value="wanip" <?php if ($pconfig['src'] == "wanip") { echo "selected"; } ?>>
+                            WAN address</option>
                             <option value="lan" <?php if ($pconfig['src'] == "lan") { echo "selected"; } ?>>
                             LAN subnet</option>
                             <option value="pptp" <?php if ($pconfig['src'] == "pptp") { echo "selected"; } ?>>
@@ -555,6 +553,7 @@ Hint: the difference between block and reject is that with reject, a packet (TCP
                       </tr>
                       <tr> 
                         <td>Address:&nbsp;&nbsp;</td>
+                                               <td><?=$mandfldhtmlspc;?></td>
                         <td><input name="src" type="text" class="formfldalias" id="src" size="20" value="<?php if (!is_specialnet($pconfig['src'])) echo htmlspecialchars($pconfig['src']);?>">
                         /
                                                <select name="srcmask" class="formfld" id="srcmask">
@@ -617,6 +616,7 @@ Hint: the difference between block and reject is that with reject, a packet (TCP
                     <table border="0" cellspacing="0" cellpadding="0">
                       <tr> 
                         <td>Type:&nbsp;&nbsp;</td>
+                                               <td></td>
                         <td><select name="dsttype" class="formfld" onChange="typesel_change()">
                             <?php $sel = is_specialnet($pconfig['dst']); ?>
                             <option value="any" <?php if ($pconfig['dst'] == "any") { echo "selected"; } ?>>
@@ -625,6 +625,8 @@ Hint: the difference between block and reject is that with reject, a packet (TCP
                             Single host or alias</option>
                             <option value="network" <?php if (!$sel) echo "selected"; ?>>
                             Network</option>
+                            <option value="wanip" <?php if ($pconfig['dst'] == "wanip") { echo "selected"; } ?>>
+                            WAN address</option>
                             <option value="lan" <?php if ($pconfig['dst'] == "lan") { echo "selected"; } ?>>
                             LAN subnet</option>
                             <option value="pptp" <?php if ($pconfig['dst'] == "pptp") { echo "selected"; } ?>>
@@ -637,6 +639,7 @@ Hint: the difference between block and reject is that with reject, a packet (TCP
                       </tr>
                       <tr> 
                         <td>Address:&nbsp;&nbsp;</td>
+                                               <td><?=$mandfldhtmlspc;?></td>
                         <td><input name="dst" type="text" class="formfldalias" id="dst" size="20" value="<?php if (!is_specialnet($pconfig['dst'])) echo htmlspecialchars($pconfig['dst']);?>">
                           / 
                           <select name="dstmask" class="formfld" id="dstmask">
@@ -736,5 +739,3 @@ proto_change();
 //-->
 </script>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index cf9b0e1c81ffb2208b9b3c9deb1ac7b8cfcd1843..765d60b94ec75ed42158ece1ac1566448bc019ed 100644 (file)
@@ -4,7 +4,7 @@
        firewall_shaper.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Firewall", "Traffic shaper");
 require("guiconfig.inc");
 
 if (!is_array($config['shaper']['rule'])) {
@@ -107,17 +108,7 @@ if ($_GET['act'] == "del") {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Firewall: Traffic shaper");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Firewall: Traffic shaper</p>
 <form action="firewall_shaper.php" method="post">
 <?php if ($savemsg) print_info_box($savemsg); ?>
 <?php if (file_exists($d_shaperconfdirty_path)): ?><p>
@@ -125,7 +116,7 @@ if ($_GET['act'] == "del") {
 <input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
 <?php endif; ?>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
     <li class="tabact">Rules</li>
     <li class="tabinact"><a href="firewall_shaper_pipes.php">Pipes</a></li>
@@ -137,10 +128,9 @@ if ($_GET['act'] == "del") {
     <td class="tabcont">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
                 <tr> 
-                  <td class="vtable"><p>
+                  <td class="vtable">
                       <input name="enable" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable']) echo "checked";?>>
-                      <strong>Enable traffic shaper<br>
-                      </strong></p></td>
+                      <strong>Enable traffic shaper</strong></td>
                 </tr>
                 <tr> 
                   <td> <input name="submit" type="submit" class="formbtn" value="Save"> 
@@ -256,8 +246,8 @@ if ($_GET['act'] == "del") {
                         <td><img src="out_d.gif" width="11" height="11"></td>
                         <td>outgoing (disabled)</td>
                       </tr>
-                    </table>
-                               <p><span class="red"><strong>Note:</strong></span><strong><br>
+                    </table><br>
+                               <span class="red"><strong>Note:</strong></span><strong><br>
                     </strong>the first rule that matches a packet will be executed.<br>
                     The following match patterns are not shown in the list above: 
                     IP packet length, TCP flags.</td>
@@ -265,5 +255,3 @@ if ($_GET['act'] == "del") {
 </table>
             </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 5b0e249e1152f60549c609ea75c24ad1d8e81c4a..305ca9c3a85d6ac9c04094bc08aeb04c1b7e597b 100644 (file)
@@ -4,7 +4,7 @@
        firewall_shaper_edit.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Firewall", "Traffic shaper", "Edit rule");
 require("guiconfig.inc");
 
 if (!is_array($config['shaper']['rule'])) {
@@ -347,12 +348,7 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Firewall: Traffic shaper: Edit rule");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
+<?php include("fbegin.inc"); ?>
 <script language="JavaScript">
 <!--
 var portsenabled = 1;
@@ -451,18 +447,13 @@ function dst_rep_change() {
 }
 //-->
 </script>
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">Firewall: Traffic shaper: Edit rule</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if (is_array($config['shaper']['pipe']) && (count($config['shaper']['pipe']) > 0)): ?>
             <form action="firewall_shaper_edit.php" method="post" name="iform" id="iform">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
                 <tr> 
                   <td valign="top" class="vncellreq">Target</td>
-                  <td class="vtable"> <select name="target" class="formfld">
+                  <td class="vtable"><select name="target" class="formfld">
                       <?php 
                                          foreach ($config['shaper']['pipe'] as $pipei => $pipe): ?>
                       <option value="<?="targetpipe:$pipei";?>" <?php if ("targetpipe:$pipei" == $pconfig['target']) echo "selected"; ?>> 
@@ -495,7 +486,7 @@ function dst_rep_change() {
                 </tr>
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Interface</td>
-                  <td width="78%" class="vtable"> <select name="interface" class="formfld">
+                  <td width="78%" class="vtable"><select name="interface" class="formfld">
                       <?php $interfaces = array('lan' => 'LAN', 'wan' => 'WAN', 'pptp' => 'PPTP');
                                          for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
                                                $interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
@@ -511,7 +502,7 @@ function dst_rep_change() {
                 </tr>
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Protocol</td>
-                  <td width="78%" class="vtable"> <select name="proto" class="formfld" onchange="proto_change()">
+                  <td width="78%" class="vtable"><select name="proto" class="formfld" onchange="proto_change()">
                       <?php $protocols = explode(" ", "TCP UDP ICMP ESP AH GRE IPv6 IGMP any"); foreach ($protocols as $proto): ?>
                       <option value="<?=strtolower($proto);?>" <?php if (strtolower($proto) == $pconfig['proto']) echo "selected"; ?>> 
                       <?=htmlspecialchars($proto);?>
@@ -529,6 +520,7 @@ function dst_rep_change() {
                     <table border="0" cellspacing="0" cellpadding="0">
                       <tr> 
                         <td>Type:&nbsp;&nbsp;</td>
+                                               <td></td>
                         <td><select name="srctype" class="formfld" onChange="typesel_change()">
                             <?php $sel = is_specialnet($pconfig['src']); ?>
                             <option value="any" <?php if ($pconfig['src'] == "any") { echo "selected"; } ?>> 
@@ -550,6 +542,7 @@ function dst_rep_change() {
                       </tr>
                       <tr> 
                         <td>Address:&nbsp;&nbsp;</td>
+                                               <td><?=$mandfldhtmlspc;?></td>
                         <td><input name="src" type="text" class="formfldalias" id="src" size="20" value="<?php if (!is_specialnet($pconfig['src'])) echo htmlspecialchars($pconfig['src']);?>">
                           / 
                           <select name="srcmask" class="formfld" id="srcmask">
@@ -609,6 +602,7 @@ function dst_rep_change() {
                     <table border="0" cellspacing="0" cellpadding="0">
                       <tr> 
                         <td>Type:&nbsp;&nbsp;</td>
+                                               <td></td>
                         <td><select name="dsttype" class="formfld" onChange="typesel_change()">
                             <?php $sel = is_specialnet($pconfig['dst']); ?>
                             <option value="any" <?php if ($pconfig['dst'] == "any") { echo "selected"; } ?>> 
@@ -630,6 +624,7 @@ function dst_rep_change() {
                       </tr>
                       <tr> 
                         <td>Address:&nbsp;&nbsp;</td>
+                                               <td><?=$mandfldhtmlspc;?></td>
                         <td><input name="dst" type="text" class="formfldalias" id="dst" size="20" value="<?php if (!is_specialnet($pconfig['dst'])) echo htmlspecialchars($pconfig['dst']);?>">
                           / 
                           <select name="dstmask" class="formfld" id="dstmask">
@@ -772,5 +767,3 @@ proto_change();
 <p><strong>You need to create a pipe or queue before you can add a new rule.</strong></p>
 <?php endif; ?>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index ff01c8749a644dbbd0a7b8c2e8258b2ce4010530..59035ee575cd282b2b60242d7bf51d20ad4a2298 100644 (file)
@@ -31,6 +31,9 @@
     POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Firewall", "Traffic shaper");
+require("guiconfig.inc");
+
 function wipe_magic () {
   global $config;
 
@@ -274,8 +277,6 @@ function create_magic ($maxup, $maxdown, $p2plow,$maskq) {
   $rulei++;
 }
 
-require("guiconfig.inc");
-
 if (!is_array($config['shaper']['rule'])) {
     $config['shaper']['rule'] = array();
 }
@@ -344,17 +345,7 @@ if ($_POST) {
 }
 
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Firewall: Traffic shaper");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Firewall: Traffic shaper</p>
 <form action="firewall_shaper_magic.php" method="post">
 <?php if ($savemsg) print_info_box($savemsg); ?>
 <?php if (file_exists($d_shaperconfdirty_path)): ?><p>
@@ -362,9 +353,9 @@ if ($_POST) {
 <input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
 <?php endif; ?>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
-    <li class="tabinact"><a href="firewall_shaper.php">Rules</a></li>
+    <li class="tabinact1"><a href="firewall_shaper.php">Rules</a></li>
     <li class="tabinact"><a href="firewall_shaper_pipes.php">Pipes</a></li>
     <li class="tabinact"><a href="firewall_shaper_queues.php">Queues</a></li>
     <li class="tabact">Magic shaper wizard</li>
@@ -375,49 +366,45 @@ if ($_POST) {
      <table width="100%" border="0" cellpadding="6" cellspacing="0">
                <tr> 
                  <td width="22%" valign="top" class="vtable">&nbsp;</td>
-                 <td width="78%" class="vtable"><p>
+                 <td width="78%" class="vtable">
                          <input name="p2plow" type="checkbox" id="p2plow" value="yes" <?php if ($pconfig['p2plow']) echo "checked";?>>
-                         Set P2P traffic to lowest priority<br>
-                         </p></td>
+                         Set P2P traffic to lowest priority</td>
                </tr>
                <tr> 
                  <td width="22%" valign="top" class="vtable">&nbsp;</td>
-                 <td width="78%" class="vtable"><p>
+                 <td width="78%" class="vtable">
                          <input name="maskq" type="checkbox" id="maskq" value="yes" <?php if ($pconfig['maskq']) echo "checked";?>>
-                         Share bandwidth evenly on LAN<br>
-                         </p></td>
+                         Share bandwidth evenly on LAN</td>
                </tr>
         <tr valign="top">
           <td width="22%" class="vncellreq">Downstream<br>
             speed </td>
           <td width="78%" class="vtable">
-              <input name="maxdown" type="text" size="10" value="<?php if ($pconfig['maxdown']) echo $pconfig['maxdown']; ?>"> 
+              <?=$mandfldhtml;?><input name="maxdown" type="text" size="10" value="<?php if ($pconfig['maxdown']) echo $pconfig['maxdown']; ?>"> 
               kbps<br>
               Enter the speed of your WAN downstream link here.</td>
                </tr>
         <tr valign="top">
           <td width="22%" class="vncellreq">Upstream<br>
             speed</td>
-          <td width="78%" class="vtable"><input name="maxup" type="text" size="10" value="<?php if ($pconfig['maxup']) echo $pconfig['maxup']; ?>">
+          <td width="78%" class="vtable"><?=$mandfldhtml;?><input name="maxup" type="text" size="10" value="<?php if ($pconfig['maxup']) echo $pconfig['maxup']; ?>">
               kbps<br>
               Enter the speed of your WAN upstream link here.</td>
                </tr>
                <tr> 
                  <td width="22%">&nbsp;</td>
-                 <td width="78%"><p>
+                 <td width="78%">
                        <input name="install" type="submit" class="formbtn" id="install" value="Install/Update"> 
                      &nbsp;
                            <input name="remove" type="submit" class="formbtn" id="remove" value="Remove">
-                 </p>
-                   <p><span class="red"><strong>All existing traffic shaper <strong>rules</strong>/pipes/queues will be deleted once "Install/Update" has been pressed! Backup your configuration before proceeding! </strong></span></p></td>
+                 <br><br>
+                   <span class="red"><strong>All existing traffic shaper <strong>rules</strong>/pipes/queues will be deleted once "Install/Update" has been pressed! Backup your configuration before proceeding! </strong></span></td>
                </tr>
-         </table>
-               <p><span class="vexpl"><span class="red"><strong>Note:</strong></span><strong><br>
-               </strong>By entering your maximum upload and download values and pressing the "Install/Update" button, the magic shaper will do its best to create the optimum shaping rules, queues, and pipes for you.  These rules will help ensure that interactive traffic remains acceptable while the upstream bandwidth is being consumed by heavy traffic.</span></p>
+         </table><br>
+               <span class="vexpl"><span class="red"><strong>Note:</strong></span><strong><br>
+               </strong>By entering your maximum upload and download values and pressing the "Install/Update" button, the magic shaper will do its best to create the optimum shaping rules, queues, and pipes for you.  These rules will help ensure that interactive traffic remains acceptable while the upstream bandwidth is being consumed by heavy traffic.</span>
        </td>
     </tr>
 </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 67ef8bbf38cd2fdf58ac644fdf759ee97c308cc5..322484e18fb727f19e96e50a1ffdbae974091abd 100644 (file)
@@ -4,7 +4,7 @@
        firewall_shaper_pipes.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Firewall", "Traffic shaper");
 require("guiconfig.inc");
 
 if (!is_array($config['shaper']['pipe'])) {
@@ -88,17 +89,7 @@ if ($_GET['act'] == "del") {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Firewall: Traffic shaper");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Firewall: Traffic shaper</p>
 <form action="firewall_shaper.php" method="post">
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if ($savemsg) print_info_box($savemsg); ?>
@@ -107,9 +98,9 @@ if ($_GET['act'] == "del") {
 <input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
 <?php endif; ?>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
-    <li class="tabinact"><a href="firewall_shaper.php">Rules</a></li>
+    <li class="tabinact1"><a href="firewall_shaper.php">Rules</a></li>
     <li class="tabact">Pipes</li>
     <li class="tabinact"><a href="firewall_shaper_queues.php">Queues</a></li>
     <li class="tabinact"><a href="firewall_shaper_magic.php">Magic shaper wizard</a></li>
@@ -120,10 +111,12 @@ if ($_GET['act'] == "del") {
               <table width="100%" border="0" cellpadding="0" cellspacing="0">
                       <tr> 
                         <td width="10%" class="listhdrr">No.</td>
-                        <td width="20%" class="listhdrr">Bandwidth</td>
-                        <td width="15%" class="listhdrr">Delay</td>
+                        <td width="15%" class="listhdrr">Bandwidth</td>
+                        <td width="10%" class="listhdrr">Delay</td>
+                        <td width="10%" class="listhdrr">PLR</td>
+                        <td width="10%" class="listhdrr">Queue</td>
                         <td width="15%" class="listhdrr">Mask</td>
-                        <td width="30%" class="listhdr">Description</td>
+                        <td width="20%" class="listhdr">Description</td>
                         <td width="10%" class="list"></td>
                       </tr>
                       <?php $i = 0; foreach ($a_pipes as $pipe): ?>
@@ -139,6 +132,16 @@ if ($_GET['act'] == "del") {
                           ms 
                           <?php endif; ?>
                           &nbsp; </td>
+                        <td class="listr"> 
+                          <?php if ($pipe['plr']): ?>
+                          <?=$pipe['plr'];?>
+                          <?php endif; ?>
+                          &nbsp; </td>
+                        <td class="listr"> 
+                          <?php if ($pipe['qsize']): ?>
+                          <?=htmlspecialchars($pipe['qsize']);?>
+                          <?php endif; ?>
+                          &nbsp; </td>
                         <td class="listr"> 
                           <?php if ($pipe['mask']): ?>
                           <?=$pipe['mask'];?>
@@ -152,16 +155,13 @@ if ($_GET['act'] == "del") {
                       </tr>
                       <?php $i++; endforeach; ?>
                       <tr> 
-                        <td class="list" colspan="5"></td>
+                        <td class="list" colspan="7"></td>
                         <td class="list"> <a href="firewall_shaper_pipes_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
                       </tr>
-                    </table>
-                               <p>
+                    </table><br>
                     <strong><span class="red">Note:</span></strong> a pipe can 
-                    only be deleted if it is not referenced by any rules or queues.</td></p>
+                    only be deleted if it is not referenced by any rules or queues.</td>
        </tr>
 </table>
             </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 52186902a15ffd59d70c72e9d0a8469b5bbd0d66..4248de03c4c8348f53867d495424e5ad7192a258 100644 (file)
@@ -4,7 +4,7 @@
        firewall_shaper_pipes_edit.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Firewall", "Traffic shaper", "Edit pipe");
 require("guiconfig.inc");
 
 $a_pipes = &$config['shaper']['pipe'];
@@ -40,6 +41,8 @@ if (isset($_POST['id']))
 if (isset($id) && $a_pipes[$id]) {
        $pconfig['bandwidth'] = $a_pipes[$id]['bandwidth'];
        $pconfig['delay'] = $a_pipes[$id]['delay'];
+       $pconfig['plr'] = $a_pipes[$id]['plr'];
+       $pconfig['qsize'] = $a_pipes[$id]['qsize'];
        $pconfig['mask'] = $a_pipes[$id]['mask'];
        $pconfig['descr'] = $a_pipes[$id]['descr'];
 }
@@ -61,6 +64,12 @@ if ($_POST) {
        if (($_POST['delay'] && !is_numericint($_POST['delay']))) {
                $input_errors[] = "The delay must be an integer.";
        }
+       if ($_POST['plr'] && (!is_numeric($_POST['plr']) || $_POST['plr'] < 0 || $_POST['plr'] > 1)) {
+               $input_errors[] = "The packet loss rate must be a number between 0 and 1.";
+       }
+       if ($_POST['qsize'] && (!is_numericint($_POST['qsize']) || $_POST['qsize'] < 2 || $_POST['qsize'] > 100)) {
+               $input_errors[] = "The queue size must be an integer between 2 and 100.";
+       }
 
        if (!$input_errors) {
                $pipe = array();
@@ -68,6 +77,10 @@ if ($_POST) {
                $pipe['bandwidth'] = $_POST['bandwidth'];
                if ($_POST['delay'])
                        $pipe['delay'] = $_POST['delay'];
+               if ($_POST['plr'])
+                       $pipe['plr'] = $_POST['plr'];
+               if ($_POST['qsize'])
+                       $pipe['qsize'] = $_POST['qsize'];
                if ($_POST['mask'])
                        $pipe['mask'] = $_POST['mask'];
                $pipe['descr'] = $_POST['descr'];
@@ -85,23 +98,13 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Firewall: Traffic shaper: Edit pipe");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Firewall: Traffic shaper: Edit pipe</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
             <form action="firewall_shaper_pipes_edit.php" method="post" name="iform" id="iform">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Bandwidth</td>
-                  <td width="78%" class="vtable"> <input name="bandwidth" type="text" id="bandwidth" size="5" value="<?=htmlspecialchars($pconfig['bandwidth']);?>"> 
+                  <td width="78%" class="vtable"><?=$mandfldhtml;?><input name="bandwidth" type="text" id="bandwidth" size="5" value="<?=htmlspecialchars($pconfig['bandwidth']);?>"> 
                     &nbsp;Kbit/s</td>
                 </tr>
                 <tr> 
@@ -110,6 +113,20 @@ if ($_POST) {
                     &nbsp;ms<br> <span class="vexpl">Hint: in most cases, you 
                     should specify 0 here (or leave the field empty)</span></td>
                 </tr>
+                <tr> 
+                  <td width="22%" valign="top" class="vncell">Packet loss rate</td>
+                  <td width="78%" class="vtable"> <input name="plr" type="text" id="plr" size="5" value="<?=htmlspecialchars($pconfig['plr']);?>"> 
+                    <br> <span class="vexpl">Hint: in most cases, you 
+                    should specify 0 here (or leave the field empty). A value of 0.001 means one packet in 1000 gets dropped.</span></td>
+                </tr>
+                <tr> 
+                  <td width="22%" valign="top" class="vncell">Queue size</td>
+                  <td width="78%" class="vtable"> <input name="qsize" type="text" id="qsize" size="8" value="<?=htmlspecialchars($pconfig['qsize']);?>"> 
+                    &nbsp;slots<br> 
+                    <span class="vexpl">Hint: in most cases, you 
+                    should leave the field empty. All packets in this pipe are placed into a fixed-size queue first,
+                    then they are delayed by value specified in the Delay field, and then they are delivered to their destination.</span></td>
+                </tr>
                 <tr> 
                   <td width="22%" valign="top" class="vncell">Mask</td>
                   <td width="78%" class="vtable"> <select name="mask" class="formfld">
@@ -118,7 +135,7 @@ if ($_POST) {
                       <option value="destination" <?php if ($pconfig['mask'] == "destination") echo "selected"; ?>>destination</option>
                     </select> <br>
                     <span class="vexpl">If 'source' or 'destination' is chosen, 
-                    a dynamic pipe with the bandwidth and delay given above will 
+                    a dynamic pipe with the bandwidth, delay, packet loss and queue size given above will 
                     be created for each source/destination IP address encountered, 
                     respectively. This makes it possible to easily specify bandwidth 
                     limits per host.</span></td>
@@ -140,5 +157,3 @@ if ($_POST) {
               </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 507571113361e9797a67a1240e36a1f588c6968f..c1ded3b5a0674a494b0241d43d7579596a86942b 100644 (file)
@@ -4,7 +4,7 @@
        firewall_shaper_queues.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Firewall", "Traffic shaper");
 require("guiconfig.inc");
 
 if (!is_array($config['shaper']['pipe'])) {
@@ -72,17 +73,7 @@ if ($_GET['act'] == "del") {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Firewall: Traffic shaper");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Firewall: Traffic shaper</p>
 <form action="firewall_shaper.php" method="post">
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if ($savemsg) print_info_box($savemsg); ?>
@@ -91,9 +82,9 @@ if ($_GET['act'] == "del") {
 <input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
 <?php endif; ?>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
-    <li class="tabinact"><a href="firewall_shaper.php">Rules</a></li>
+    <li class="tabinact1"><a href="firewall_shaper.php">Rules</a></li>
     <li class="tabinact"><a href="firewall_shaper_pipes.php">Pipes</a></li>
     <li class="tabact">Queues</li>
     <li class="tabinact"><a href="firewall_shaper_magic.php">Magic shaper wizard</a></li>
@@ -140,13 +131,10 @@ if ($_GET['act'] == "del") {
                         <td class="list" colspan="5"></td>
                         <td class="list"> <a href="firewall_shaper_queues_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
                       </tr>
-                    </table>
-                               <p>
+                    </table><br>
                     <strong><span class="red">Note:</span></strong> a queue can 
-                    only be deleted if it is not referenced by any rules.</td></p>
+                    only be deleted if it is not referenced by any rules.</td>
        </tr>
 </table>
             </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 599c5e40fc5bd2a7cf87885c10cf65b40e7c9f15..94503b8ab7adfe1d4138c6e4395f5f4c6bdbfffd 100644 (file)
@@ -4,7 +4,7 @@
        firewall_shaper_queues_edit.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Firewall", "Traffic shaper", "Edit queue");
 require("guiconfig.inc");
 
 $a_queues = &$config['shaper']['queue'];
@@ -82,24 +83,14 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Firewall: Traffic shaper: Edit queue");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Firewall: Traffic shaper: Edit queue</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if (is_array($config['shaper']['pipe']) && (count($config['shaper']['pipe']) > 0)): ?>
             <form action="firewall_shaper_queues_edit.php" method="post" name="iform" id="iform">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
                 <tr> 
                   <td valign="top" class="vncellreq">Pipe</td>
-                  <td class="vtable"> <select name="targetpipe" class="formfld">
+                  <td class="vtable"><select name="targetpipe" class="formfld">
                       <?php 
                                          foreach ($config['shaper']['pipe'] as $pipei => $pipe): ?>
                       <option value="<?=$pipei;?>" <?php if ($pipei == $pconfig['targetpipe']) echo "selected"; ?>> 
@@ -116,7 +107,7 @@ if ($_POST) {
                 </tr>
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Weight</td>
-                  <td width="78%" class="vtable"> <input name="weight" type="text" id="weight" size="5" value="<?=htmlspecialchars($pconfig['weight']);?>"> 
+                  <td width="78%" class="vtable"><?=$mandfldhtml;?><input name="weight" type="text" id="weight" size="5" value="<?=htmlspecialchars($pconfig['weight']);?>"> 
                     <br> <span class="vexpl">Valid range: 1..100.<br>
                     All backlogged (i.e., with packets queued) queues linked to 
                     the same pipe share the pipe's bandwidth proportionally to 
@@ -157,5 +148,3 @@ if ($_POST) {
 <p><strong>You need to create a pipe before you can add a new queue.</strong></p>
 <?php endif; ?>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 7fac8f320d8146d7093133bf53d7800b3d2b531c..2703a69db8680e69008e07521cc050f534d8e69e 100644 (file)
@@ -4,7 +4,7 @@
        graph.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2004 T. Lechat <dev@lechat.org> and Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2004-2005 T. Lechat <dev@lechat.org> and Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,7 @@ $time_interval=1;             //Refresh time Interval
 $first_stage_time_interval=2;  //First stage time Intervall
 
 $urldata=@$_SERVER["SCRIPT_NAME"];
-$fetch_link = "ifstats.cgi?$ifnum";
+$fetch_link = "stats.cgi?$ifnum";
 
 //Style
 $style['bg']="fill:white;stroke:none;stroke-width:0;opacity:1;";
diff --git a/webgui/graph_cpu.php b/webgui/graph_cpu.php
new file mode 100644 (file)
index 0000000..b87504d
--- /dev/null
@@ -0,0 +1,174 @@
+#!/usr/local/bin/php -f
+<?php
+/*
+       graph_cpu.php
+       part of m0n0wall (http://m0n0.ch/wall)
+       
+       Copyright (C) 2004-2005 T. Lechat <dev@lechat.org> and Manuel Kasper <mk@neon1.net>.
+       All rights reserved.
+       
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions are met:
+       
+       1. Redistributions of source code must retain the above copyright notice,
+          this list of conditions and the following disclaimer.
+       
+       2. Redistributions in binary form must reproduce the above copyright
+          notice, this list of conditions and the following disclaimer in the
+          documentation and/or other materials provided with the distribution.
+       
+       THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+       INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+       AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+       AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+       OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+       INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+       CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+       ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+       POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/********* Other conf *******/
+$nb_plot=120;                  //NB plot in graph
+
+$fetch_link = "stats.cgi?cpu";
+
+//Style
+$style['bg']="fill:white;stroke:none;stroke-width:0;opacity:1;";
+$style['axis']="fill:black;stroke:black;stroke-width:1;";
+$style['cpu']="fill:#435370; font-family:Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size:7;";
+$style['graph_cpu']="fill:none;stroke:#435370;stroke-width:1;opacity:0.8;";
+$style['legend']="fill:black; font-family:Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size:4;";
+$style['grid_txt']="fill:gray; font-family:Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size:6;";
+$style['grid']="stroke:gray;stroke-width:1;opacity:0.5;";
+$style['error']="fill:blue; font-family:Arial; font-size:4;";
+$style['collect_initial']="fill:gray; font-family:Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size:4;";
+
+$error_text = "Cannot get CPU load";
+
+$height=100;           //SVG internal height : do not modify
+$width=200;            //SVG internal width : do not modify
+
+/********* Graph DATA **************/
+header("Content-type: image/svg+xml");
+print('<?xml version="1.0" encoding="iso-8859-1"?>' . "\n");?><svg width="100%" height="100%" viewBox="0 0 <?=$width?> <?=$height?>" preserveAspectRatio="none" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="init(evt)">
+<g id="graph" style="visibility:visible">
+       <rect id="bg" x1="0" y1="0" x2="<?=$width?>" y2="<?=$height?>" style="<?=$style['bg']?>"/>
+       <line id="axis_x" x1="0" y1="0" x2="0" y2="<?=$height?>" style="<?=$style['axis']?>"/>
+       <line id="axis_y" x1="0" y1="<?=$height?>" x2="<?=$width?>" y2="<?=$height?>" style="<?=$style['axis']?>"/>
+       <path id="graph_cpu"  d="M0 <?=$height?> L 0 <?=$height?>" style="<?=$style['graph_cpu']?>"/>
+       <path id="grid"  d="M0 <?=$height/4*1?> L <?=$width?> <?=$height/4*1?> M0 <?=$height/4*2?> L <?=$width?> <?=$height/4*2?> M0 <?=$height/4*3?> L <?=$width?> <?=$height/4*3?>" style="<?=$style[grid]?>"/>
+       <text id="grid_txt1" x="<?=$width?>" y="<?=$height/4*1?>" style="<?=$style['grid_txt']?> text-anchor:end">75%</text>
+       <text id="grid_txt2" x="<?=$width?>" y="<?=$height/4*2?>" style="<?=$style['grid_txt']?> text-anchor:end">50%</text>
+       <text id="grid_txt3" x="<?=$width?>" y="<?=$height/4*3?>" style="<?=$style['grid_txt']?> text-anchor:end">25%</text>
+       <text id="graph_cpu_txt" x="4" y="8" style="<?=$style['cpu']?>"> </text>
+       <polygon id="axis_arrow_x" style="<?=$style['axis']?>" points="<?=($width) . "," . ($height)?> <?=($width-2) . "," . ($height-2)?> <?=($width-2) . "," . $height?>"/>
+       <text id="error" x="<?=$width*0.5?>" y="<?=$height*0.5?>"  style="visibility:hidden;<?=$style['error']?> text-anchor:middle"><?=$error_text?></text>
+       <text id="collect_initial" x="<?=$width*0.5?>" y="<?=$height*0.5?>"  style="visibility:hidden;<?=$style['collect_initial']?> text-anchor:middle">Collecting initial data, please wait...</text>
+</g>
+
+<script type="text/ecmascript"><![CDATA[
+var SVGDoc;
+var last_cpu_total=0;
+var last_cpu_idle=0;
+var diff_cpu_total=0;
+var diff_cpu_idle=0;
+plot_cpu = new Array();
+
+var isfirst=1;
+var index_plot=0;
+var step = <?=$width?> / <?=$nb_plot?> ;
+
+function init(evt) {
+       SVGDoc = evt.getTarget().getOwnerDocument();
+       go();
+}
+
+function go() {
+       getURL('<?=$fetch_link?>',urlcallback);
+}
+
+function urlcallback(obj) {
+       var error = 0;
+
+       //shift plot to left if nb_plot is already completed
+       var i=0;
+       if(index_plot > <?=$nb_plot?>)
+       {
+               while (i <= <?=$nb_plot?>)
+               {
+                       var a=i+1;
+                       plot_cpu[i]=plot_cpu[a];
+                       i=i+1;
+               }
+               index_plot = <?=$nb_plot?>;
+               plot_cpu[index_plot]=0;
+       }
+
+       //if Geturl returns something
+       if (obj.success){
+               var cpu = parseInt(obj.content);
+               var scale;
+
+               if(!isNumber(cpu)) {
+                       goerror();
+                       return;
+               } else {
+                       SVGDoc.getElementById("error").getStyle().setProperty ('visibility', 'hidden');
+               }
+
+               if(isfirst) {
+                       SVGDoc.getElementById("collect_initial").getStyle().setProperty ('visibility', 'visible');
+                       go();
+                       isfirst=0;
+                       return;
+               } else SVGDoc.getElementById("collect_initial").getStyle().setProperty ('visibility', 'hidden');
+
+               plot_cpu[index_plot] = cpu;
+
+               SVGDoc.getElementById('graph_cpu_txt').getFirstChild().setData(plot_cpu[index_plot] + '%');
+               
+               scale = <?=$height?> / 100;
+               
+               i = 0;
+               
+               while (i <= index_plot)
+               {
+                       var x = step * i;
+                       var y_cpu= <?=$height?> - (plot_cpu[i] * scale);
+                       if(i==0) {
+                               var path_cpu = "M" + x + " " + y_cpu;
+                       }
+                       else
+                       {
+                               var path_cpu = path_cpu + " L" + x + " " + y_cpu;
+                       }
+                       i = i + 1;
+               }
+
+               index_plot = index_plot+1;
+               SVGDoc.getElementById('graph_cpu').setAttribute("d", path_cpu);
+
+               go();
+       }
+       else
+       { //In case of Geturl fails
+               goerror();
+       }
+}
+
+function goerror() {
+       SVGDoc.getElementById("error").getStyle().setProperty ('visibility', 'visible');
+       go();
+}
+
+function isNumber(a) {
+    return typeof a == 'number' && isFinite(a);
+}
+
+function LZ(x) {
+       return (x < 0 || x > 9 ? "" : "0") + x
+}
+]]></script>
+</svg>
\ No newline at end of file
index aab333a3f931e0c6a476997d261a3d0c4a01bf91..e18b205ae27f6fa9332b0a54fb64b31dd5d1e280 100644 (file)
@@ -5,6 +5,9 @@ body,td,th,input,select {
 form {
        margin: 0px;
 }
+p {
+       margin: 0 0 10px 0;
+}
 .pgtitle {
        font-size: 18px;
        color: #777777;
@@ -164,6 +167,9 @@ a {
        padding-top: 5px;
        padding-bottom: 5px;
 }
+.listhdr a {
+       color: #000000;
+}
 .listhdrr {
        background-color: #BBBBBB;
        padding-right: 16px;
@@ -175,6 +181,9 @@ a {
        padding-top: 5px;
        padding-bottom: 5px;
 }
+.listhdrr a {
+       color: #000000;
+}
 .listlr {
        background-color: #FFFFFF;
        border-right: 1px solid #999999;
@@ -250,6 +259,8 @@ a {
        color: #FFFFFF;
        font-weight: bold;
 }
+.tabnavtbl {
+}
 ul#tabnav {
        font-size: 11px;
        font-weight: bold;
@@ -257,6 +268,13 @@ ul#tabnav {
        margin: 0;
        padding: 0;
 }
+ul#tabnav li.tabinact1 {
+       float: left;
+       background-color: #777777;
+       color: #FFFFFF;
+       padding: 0;
+       white-space: nowrap;
+}
 ul#tabnav li.tabinact {
        float: left;
        border-left: 1px solid #999999;
@@ -272,6 +290,13 @@ ul#tabnav li.tabinact a {
        padding: 5px 8px 5px 8px;
        color: #FFFFFF;
 }
+ul#tabnav li.tabinact1 a {
+       float: left;
+       display: block;
+       text-decoration: none;
+       padding: 5px 8px 5px 8px;
+       color: #FFFFFF;
+}
 ul#tabnav li.tabact {
        float: left;
        background-color: #EEEEEE;
index 8efccfbd47965124666089155bea3172b968b0f8..c46fea04829590654bb648cb9b270e19bc1b78f4 100644 (file)
@@ -3,7 +3,7 @@
        guiconfig.inc
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -75,7 +75,7 @@ $iptos = array("lowdelay", "throughput", "reliability", "mincost", "congestion")
 /* TCP flags */
 $tcpflags = array("fin", "syn", "rst", "psh", "ack", "urg");
 
-$specialnets = array("lan" => "LAN net", "pptp" => "PPTP clients");
+$specialnets = array("wanip" => "WAN address", "lan" => "LAN net", "pptp" => "PPTP clients");
 
 for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
        $specialnets['opt' . $i] = $config['interfaces']['opt' . $i]['descr'] . " net";
@@ -113,7 +113,7 @@ function do_input_validation($postdata, $reqdfields, $reqdfieldsn, $input_errors
        }
        
        for ($i = 0; $i < count($reqdfields); $i++) {
-               if (!$_POST[$reqdfields[$i]]) {
+               if (!isset($_POST[$reqdfields[$i]]) || ($_POST[$reqdfields[$i]] === "")) {
                        $input_errors[] = "The field '" . $reqdfieldsn[$i] . "' is required.";
                }
        }       
@@ -434,9 +434,4 @@ function wol_sort() {
        usort($config['wol']['wolentry'], "wolcmp");
 }
 
-function gentitle($pgname) {
-       global $config;
-       return $config['system']['hostname'] . "." . $config['system']['domain'] . " - " . $pgname;
-}
-
 ?>
diff --git a/webgui/ifstats.cgi b/webgui/ifstats.cgi
deleted file mode 100644 (file)
index 944e95e..0000000
Binary files a/webgui/ifstats.cgi and /dev/null differ
index ecaef0cdc75b73830c3b2c1fba219068782e9bb8..21b9b97612586ebeeb9c23e837305b78a43fbc91 100644 (file)
@@ -4,7 +4,7 @@
        index.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,8 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("m0n0wall webGUI");
+$pgtitle_omit = true;
 require("guiconfig.inc");
 
 /* find out whether there's hardware encryption (hifn) */
@@ -46,15 +48,6 @@ if ($fd) {
 }
 
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("m0n0wall webGUI");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
             <table width="100%" border="0" cellspacing="0" cellpadding="0">
               <tr align="center" valign="top"> 
@@ -84,7 +77,7 @@ if ($fd) {
               <tr> 
                 <td width="25%" class="vncellt">Platform</td>
                 <td width="75%" class="listr"> 
-                  <?=htmlspecialchars($g['platform']);?>
+                  <?=htmlspecialchars($g['fullplatform']);?>
                 </td>
               </tr><?php if ($hwcrypto): ?>
               <tr> 
@@ -129,29 +122,7 @@ if ($fd) {
                          <tr> 
                 <td width="25%" class="vncellt">CPU usage</td>
                 <td width="75%" class="listr">
-<?php
-$cpuTicks = explode(" ", `/sbin/sysctl -n kern.cp_time`);
-sleep(1);
-$cpuTicks2 = explode(" ", `/sbin/sysctl -n kern.cp_time`);
-
-$diff = array();
-$diff['user'] = $cpuTicks2[0] - $cpuTicks[0];
-$diff['nice'] = $cpuTicks2[1] - $cpuTicks[1];
-$diff['sys'] = $cpuTicks2[2] - $cpuTicks[2];
-$diff['intr'] = $cpuTicks2[3] - $cpuTicks[3];
-$diff['idle'] = $cpuTicks2[4] - $cpuTicks[4];
-
-$totalDiff = $diff['user'] + $diff['nice'] + $diff['sys'] + $diff['intr'] + $diff['idle'];
-
-$cpuUsage = round(100 * (1 - $diff['idle'] / $totalDiff), 0);
-                                                                       
-echo "<img src='bar_left.gif' height='15' width='4' border='0' align='absmiddle'>";
-echo "<img src='bar_blue.gif' height='15' width='" . $cpuUsage . "' border='0' align='absmiddle'>";
-echo "<img src='bar_gray.gif' height='15' width='" . (100 - $cpuUsage) . "' border='0' align='absmiddle'>";
-echo "<img src='bar_right.gif' height='15' width='5' border='0' align='absmiddle'> ";
-echo $cpuUsage . "%";
-?>
-                </td>
+                               <a href="status_graph_cpu.php">view graph</a></td>
               </tr>
                          <tr> 
                 <td width="25%" class="vncellt">Memory usage</td>
@@ -176,5 +147,3 @@ echo $memUsage . "%";
               </tr>
             </table>
             <?php include("fend.inc"); ?>
-</body>
-</html>
index 0f57d302f1e7a2307e25faa95036612a036a7791..e518ddaa44dac2e619f6c8bf78f4913ffa49bda7 100644 (file)
@@ -5,7 +5,7 @@
        part of m0n0wall (http://m0n0.ch/wall)
        Written by Jim McBeath based on existing m0n0wall files
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -30,6 +30,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Interfaces", "Assign network ports");
 require("guiconfig.inc");
 
 /*
@@ -94,7 +95,7 @@ if ($_POST) {
                                        $config['interfaces'][$ifname]['if'] = $ifport;
                                        
                                        /* check for wireless interfaces, set or clear ['wireless'] */
-                                       if (preg_match("/^(wi|awi|an)/", $ifport)) {
+                                       if (preg_match($g['wireless_regex'], $ifport)) {
                                                if (!is_array($config['interfaces'][$ifname]['wireless']))
                                                        $config['interfaces'][$ifname]['wireless'] = array();
                                        } else {
@@ -163,7 +164,7 @@ if ($_GET['act'] == "add") {
                }
                if (!$portused) {
                        $config['interfaces'][$newifname]['if'] = $portname;
-                       if (preg_match("/^(wi|awi|an)/", $portname))
+                       if (preg_match($g['wireless_regex'], $portname))
                                $config['interfaces'][$newifname]['wireless'] = array();
                        break;
                }
@@ -176,22 +177,12 @@ if ($_GET['act'] == "add") {
 }
 
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Interfaces: Assign network ports");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Interfaces: Assign network ports</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if (file_exists($d_sysrebootreqd_path)) print_info_box(get_std_save_message(0)); ?>
 <form action="interfaces_assign.php" method="post" name="iform" id="iform">
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
     <li class="tabact">Interface assignments</li>
     <li class="tabinact"><a href="interfaces_vlan.php">VLANs</a></li>
@@ -249,17 +240,15 @@ if ($_GET['act'] == "add") {
   </tr>
   <?php endif; ?>
 </table>
-                      <input name="Submit" type="submit" class="formbtn" value="Save">
-                    <p><span class="vexpl"><strong><span class="red">Warning:</span><br>
-                    </strong>After you click &quot;Save&quot;, you must reboot the firewall to make the changes take effect. You may also have to do one or more of the following steps before you can access your firewall again: </span></p>
-                    <ul>
-                      <li><span class="vexpl">change the IP address of your computer</span></li>
-                      <li><span class="vexpl">renew its DHCP lease</span></li>
-                      <li><span class="vexpl">access the webGUI with the new IP address</span></li>
-                    </ul></td>
+  <input name="Submit" type="submit" class="formbtn" value="Save"><br><br>
+<p><span class="vexpl"><strong><span class="red">Warning:</span><br>
+</strong>After you click &quot;Save&quot;, you must reboot the firewall to make the changes take effect. You may also have to do one or more of the following steps before you can access your firewall again: </span></p>
+<ul>
+  <li><span class="vexpl">change the IP address of your computer</span></li>
+  <li><span class="vexpl">renew its DHCP lease</span></li>
+  <li><span class="vexpl">access the webGUI with the new IP address</span></li>
+</ul></td>
        </tr>
 </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 66af153b3917daeb33902d3dab0c33d7560c8fc5..a65824bf52b24f333e1e841d54f14b85deee657e 100644 (file)
@@ -4,7 +4,7 @@
        interfaces_lan.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Interfaces", "LAN");
 require("guiconfig.inc");
 
 $lancfg = &$config['interfaces']['lan'];
@@ -89,12 +90,7 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Interfaces: LAN");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
+<?php include("fbegin.inc"); ?>
 <script language="JavaScript">
 <!--
 function gen_bits(ipaddr) {
@@ -120,11 +116,6 @@ function ipaddr_change() {
 }
 // -->
 </script>
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">Interfaces: LAN</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if ($savemsg) print_info_box($savemsg); ?>
             <form action="interfaces_lan.php" method="post" name="iform" id="iform">
@@ -132,7 +123,7 @@ function ipaddr_change() {
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">IP address</td>
                   <td width="78%" class="vtable"> 
-                    <input name="ipaddr" type="text" class="formfld" id="hostname" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>" onchange="ipaddr_change()">
+                    <?=$mandfldhtml;?><input name="ipaddr" type="text" class="formfld" id="hostname" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>" onchange="ipaddr_change()">
                     / 
                     <select name="subnet" class="formfld" id="subnet">
                       <?php for ($i = 31; $i > 0; $i--): ?>
@@ -169,5 +160,3 @@ function ipaddr_change() {
               </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 8eb8bfc447c05d502aacd6e06d8898543759f527..8f3322827c0e79fd3c6d244e4c93cbcb27216fc7 100644 (file)
@@ -4,7 +4,7 @@
        interfaces_opt.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -47,6 +47,8 @@ $pconfig['ipaddr'] = $optcfg['ipaddr'];
 $pconfig['subnet'] = $optcfg['subnet'];
 $pconfig['enable'] = isset($optcfg['enable']);
 
+$pgtitle = array("Interfaces", "Optional $index (" . htmlspecialchars($optcfg['descr']) . ")");
+
 /* Wireless interface? */
 if (isset($optcfg['wireless'])) {
        require("interfaces_wlan.inc");
@@ -141,12 +143,7 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Interfaces: Optional $index (" . htmlspecialchars($optcfg['descr']) . ")");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
+<?php include("fbegin.inc"); ?>
 <script language="JavaScript">
 <!--
 function enable_change(enable_over) {
@@ -178,11 +175,6 @@ function ipaddr_change() {
 }
 //-->
 </script>
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">Interfaces: Optional <?=$index;?> (<?=htmlspecialchars($optcfg['descr']);?>)</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if ($savemsg) print_info_box($savemsg); ?>
 <?php if ($optcfg['if']): ?>
@@ -210,7 +202,7 @@ function ipaddr_change() {
                                <tr> 
                   <td width="22%" valign="top" class="vncellreq">Bridge with</td>
                   <td width="78%" class="vtable">
-<select name="bridge" class="formfld" id="bridge" onChange="enable_change(false)">
+                                       <select name="bridge" class="formfld" id="bridge" onChange="enable_change(false)">
                                        <option <?php if (!$pconfig['bridge']) echo "selected";?> value="">none</option>
                       <?php $opts = array('lan' => "LAN", 'wan' => "WAN");
                                                for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
@@ -228,7 +220,7 @@ function ipaddr_change() {
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">IP address</td>
                   <td width="78%" class="vtable"> 
-                    <input name="ipaddr" type="text" class="formfld" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>" onchange="ipaddr_change()">
+                    <?=$mandfldhtml;?><input name="ipaddr" type="text" class="formfld" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>" onchange="ipaddr_change()">
                     /
                        <select name="subnet" class="formfld" id="subnet">
                                        <?php for ($i = 31; $i > 0; $i--): ?>
@@ -266,8 +258,6 @@ enable_change(false);
 //-->
 </script>
 <?php else: ?>
-<p><strong>Optional <?=$index;?> has been disabled because there is no OPT<?=$index;?> interface.</strong></p>
+<strong>Optional <?=$index;?> has been disabled because there is no OPT<?=$index;?> interface.</strong>
 <?php endif; ?>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index f724ef3f0fc3974c1779d5d4fcccec06aa1dacc8..0b6991cb4ad08b06dd097ad10b61ac8e674ac30a 100644 (file)
@@ -4,7 +4,7 @@
        interfaces_vlan.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Interfaces", "Assign network ports");
 require("guiconfig.inc");
 
 if (!is_array($config['vlans']['vlan']))
@@ -84,23 +85,13 @@ if ($_GET['act'] == "del") {
 }
 
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Interfaces: Assign network ports: VLANs");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Interfaces: Assign network ports: VLANs</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if (file_exists($d_sysrebootreqd_path)) print_info_box(get_std_save_message(0)); ?>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
-    <li class="tabinact"><a href="interfaces_assign.php">Interface assignments</a></li>
+    <li class="tabinact1"><a href="interfaces_assign.php">Interface assignments</a></li>
     <li class="tabact">VLANs</li>
   </ul>
   </td></tr>
@@ -133,10 +124,10 @@ if ($_GET['act'] == "del") {
                   <td class="list"> <a href="interfaces_vlan_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
                                </tr>
                                <tr>
-                               <td colspan="3" class="list"><p class="vexpl"><span class="red"><strong>
+                               <td colspan="3" class="list"><span class="vexpl"><span class="red"><strong>
                                  Note:<br>
                                  </strong></span>
-                                 Not all drivers/NICs support 802.1Q VLAN tagging properly. On cards that do not explicitly support it, VLAN tagging will still work, but the reduced MTU may cause problems. See the m0n0wall homepage for information on supported cards. </p>
+                                 Not all drivers/NICs support 802.1Q VLAN tagging properly. On cards that do not explicitly support it, VLAN tagging will still work, but the reduced MTU may cause problems. See the m0n0wall homepage for information on supported cards.</span>
                                  </td>
                                <td class="list">&nbsp;</td>
                                </tr>
@@ -145,5 +136,3 @@ if ($_GET['act'] == "del") {
        </tr>
 </table>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 7932e2dffb680315c7b2ed172e6183828a59324c..4d9cf4b313c1cd916162f9e5eee820a114cda8b8 100644 (file)
@@ -4,7 +4,7 @@
        interfaces_vlan_edit.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Interfaces", "Assign network ports", "Edit VLAN");
 require("guiconfig.inc");
 
 if (!is_array($config['vlans']['vlan']))
@@ -91,16 +92,7 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html><head>
-<title><?=gentitle("Interfaces: Assign network ports: VLANs: Edit");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Interfaces: Assign network ports: VLANs: Edit</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
             <form action="interfaces_vlan_edit.php" method="post" name="iform" id="iform">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
@@ -119,7 +111,7 @@ if ($_POST) {
                                <tr>
                   <td valign="top" class="vncellreq">VLAN tag </td>
                   <td class="vtable">
-                    <input name="tag" type="text" class="formfld" id="tag" size="6" value="<?=htmlspecialchars($pconfig['tag']);?>">
+                    <?=$mandfldhtml;?><input name="tag" type="text" class="formfld" id="tag" size="6" value="<?=htmlspecialchars($pconfig['tag']);?>">
                     <br>
                     <span class="vexpl">802.1Q VLAN tag (between 1 and 4094) </span></td>
                            </tr>
@@ -142,5 +134,3 @@ if ($_POST) {
               </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index b4088d647ce94ece3b1618de2bc3553d100a2423..b89b0d617e0435abc35ca7888799f9d7399df74b 100644 (file)
@@ -4,7 +4,7 @@
        interfaces_wan.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Interfaces", "WAN");
 require("guiconfig.inc");
 
 $wancfg = &$config['interfaces']['wan'];
@@ -116,6 +117,8 @@ if ($_POST) {
                do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
        }
        
+       $_POST['spoofmac'] = str_replace("-", ":", $_POST['spoofmac']);
+       
        if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) {
                $input_errors[] = "A valid IP address must be specified.";
        }
@@ -245,12 +248,7 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Interfaces: WAN");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
+<?php include("fbegin.inc"); ?>
 <script language="JavaScript">
 <!--
 function enable_change(enable_change) {
@@ -400,18 +398,13 @@ function type_change(enable_change,enable_change_pptp) {
 }
 //-->
 </script>
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">Interfaces: WAN</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if ($savemsg) print_info_box($savemsg); ?>
             <form action="interfaces_wan.php" method="post" name="iform" id="iform">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
                 <tr> 
                   <td valign="middle"><strong>Type</strong></td>
-                  <td> <select name="type" class="formfld" id="type" onchange="type_change()">
+                  <td><select name="type" class="formfld" id="type" onchange="type_change()">
                       <?php $opts = split(" ", "Static DHCP PPPoE PPTP BigPond");
                                foreach ($opts as $opt): ?>
                       <option <?php if ($opt == $pconfig['type']) echo "selected";?>> 
@@ -454,7 +447,7 @@ function type_change(enable_change,enable_change_pptp) {
                 </tr>
                 <tr> 
                   <td width="100" valign="top" class="vncellreq">IP address</td>
-                  <td class="vtable"> <input name="ipaddr" type="text" class="formfld" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>">
+                  <td class="vtable"><?=$mandfldhtml;?><input name="ipaddr" type="text" class="formfld" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>">
                     / 
                     <select name="subnet" class="formfld" id="subnet">
                     <?php
@@ -472,12 +465,12 @@ function type_change(enable_change,enable_change_pptp) {
                 <tr>
                   <td valign="top" class="vncellreq">Point-to-point IP address </td>
                   <td class="vtable">
-                    <input name="pointtopoint" type="text" class="formfld" id="pointtopoint" size="20" value="<?=htmlspecialchars($pconfig['pointtopoint']);?>">
+                    <?=$mandfldhtml;?><input name="pointtopoint" type="text" class="formfld" id="pointtopoint" size="20" value="<?=htmlspecialchars($pconfig['pointtopoint']);?>">
                   </td>
                 </tr><?php endif; ?>
                 <tr> 
                   <td valign="top" class="vncellreq">Gateway</td>
-                  <td class="vtable"> <input name="gateway" type="text" class="formfld" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>"> 
+                  <td class="vtable"><?=$mandfldhtml;?><input name="gateway" type="text" class="formfld" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>"> 
                   </td>
                 </tr>
                 <tr> 
@@ -502,12 +495,12 @@ function type_change(enable_change,enable_change_pptp) {
                 </tr>
                 <tr> 
                   <td valign="top" class="vncellreq">Username</td>
-                  <td class="vtable"><input name="username" type="text" class="formfld" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>"> 
+                  <td class="vtable"><?=$mandfldhtml;?><input name="username" type="text" class="formfld" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>"> 
                   </td>
                 </tr>
                 <tr> 
                   <td valign="top" class="vncellreq">Password</td>
-                  <td class="vtable"><input name="password" type="text" class="formfld" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>"> 
+                  <td class="vtable"><?=$mandfldhtml;?><input name="password" type="text" class="formfld" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>"> 
                   </td>
                 </tr>
                 <tr> 
@@ -537,17 +530,17 @@ function type_change(enable_change,enable_change_pptp) {
                 </tr>
                 <tr> 
                   <td valign="top" class="vncellreq">Username</td>
-                  <td class="vtable"><input name="pptp_username" type="text" class="formfld" id="pptp_username" size="20" value="<?=htmlspecialchars($pconfig['pptp_username']);?>"> 
+                  <td class="vtable"><?=$mandfldhtml;?><input name="pptp_username" type="text" class="formfld" id="pptp_username" size="20" value="<?=htmlspecialchars($pconfig['pptp_username']);?>"> 
                   </td>
                 </tr>
                 <tr> 
                   <td valign="top" class="vncellreq">Password</td>
-                  <td class="vtable"><input name="pptp_password" type="text" class="formfld" id="pptp_password" size="20" value="<?=htmlspecialchars($pconfig['pptp_password']);?>"> 
+                  <td class="vtable"><?=$mandfldhtml;?><input name="pptp_password" type="text" class="formfld" id="pptp_password" size="20" value="<?=htmlspecialchars($pconfig['pptp_password']);?>"> 
                   </td>
                 </tr>
                 <tr> 
                   <td width="100" valign="top" class="vncellreq">Local IP address</td>
-                  <td class="vtable"> <input name="pptp_local" type="text" class="formfld" id="pptp_local" size="20" value="<?=htmlspecialchars($pconfig['pptp_local']);?>">
+                  <td class="vtable"><?=$mandfldhtml;?><input name="pptp_local" type="text" class="formfld" id="pptp_local" size="20" value="<?=htmlspecialchars($pconfig['pptp_local']);?>">
                     / 
                     <select name="pptp_subnet" class="formfld" id="pptp_subnet">
                       <?php for ($i = 31; $i > 0; $i--): ?>
@@ -559,7 +552,7 @@ function type_change(enable_change,enable_change_pptp) {
                 </tr>
                 <tr> 
                   <td width="100" valign="top" class="vncellreq">Remote IP address</td>
-                  <td class="vtable"> <input name="pptp_remote" type="text" class="formfld" id="pptp_remote" size="20" value="<?=htmlspecialchars($pconfig['pptp_remote']);?>"> 
+                  <td class="vtable"><?=$mandfldhtml;?><input name="pptp_remote" type="text" class="formfld" id="pptp_remote" size="20" value="<?=htmlspecialchars($pconfig['pptp_remote']);?>"> 
                   </td>
                 </tr>
                 <tr> 
@@ -583,12 +576,12 @@ function type_change(enable_change,enable_change_pptp) {
                 </tr>
                 <tr> 
                   <td valign="top" class="vncellreq">Username</td>
-                  <td class="vtable"><input name="bigpond_username" type="text" class="formfld" id="bigpond_username" size="20" value="<?=htmlspecialchars($pconfig['bigpond_username']);?>"> 
+                  <td class="vtable"><?=$mandfldhtml;?><input name="bigpond_username" type="text" class="formfld" id="bigpond_username" size="20" value="<?=htmlspecialchars($pconfig['bigpond_username']);?>"> 
                   </td>
                 </tr>
                 <tr> 
                   <td valign="top" class="vncellreq">Password</td>
-                  <td class="vtable"><input name="bigpond_password" type="text" class="formfld" id="bigpond_password" size="20" value="<?=htmlspecialchars($pconfig['bigpond_password']);?>"> 
+                  <td class="vtable"><?=$mandfldhtml;?><input name="bigpond_password" type="text" class="formfld" id="bigpond_password" size="20" value="<?=htmlspecialchars($pconfig['bigpond_password']);?>"> 
                   </td>
                 </tr>
                 <tr> 
@@ -644,5 +637,3 @@ type_change();
 //-->
 </script>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 9b3c41c5d1acc9541e14f07c7eb53f8b7758b760..57f50dab51b4b944f427d3e9ca2316b3abd67b1f 100644 (file)
@@ -3,7 +3,7 @@
        interfaces_wlan.inc
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$wlchannels = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14);
+
 function wireless_config_init() {
        global $optcfg, $pconfig;
        
+       $pconfig['standard'] = $optcfg['wireless']['standard'];
        $pconfig['mode'] = $optcfg['wireless']['mode'];
        $pconfig['ssid'] = $optcfg['wireless']['ssid'];
        $pconfig['stationname'] = $optcfg['wireless']['stationname'];
@@ -70,6 +73,7 @@ function wireless_config_post() {
 
        if (!$input_errors) {
        
+               $optcfg['wireless']['standard'] = $_POST['standard'];
                $optcfg['wireless']['mode'] = $_POST['mode'];
                $optcfg['wireless']['ssid'] = $_POST['ssid'];
                $optcfg['wireless']['stationname'] = $_POST['stationname'];
@@ -92,7 +96,7 @@ function wireless_config_post() {
 }
 
 function wireless_config_print() {
-       global $optcfg, $pconfig;
+       global $optcfg, $pconfig, $wlchannels;
 ?>
                 <tr> 
                   <td colspan="2" valign="top" height="16"></td>
@@ -100,12 +104,26 @@ function wireless_config_print() {
                 <tr> 
                   <td colspan="2" valign="top" class="listtopic">Wireless configuration</td>
                                </tr>
+                               <?php if (strstr($optcfg['if'], "ath")): ?>
+                <tr> 
+                  <td valign="top" class="vncellreq">Standard</td>
+                  <td class="vtable"><select name="standard" class="formfld" id="standard">
+                      <?php
+                                         $standards = array("11b" => "802.11b", "11g" => "802.11g", "11a" => "802.11a");
+                                         foreach ($standards as $sn => $sv): ?>
+                      <option value="<?=$sn;?>" <?php if ($sn == $pconfig['standard']) echo "selected";?>>
+                      <?=$sv;?>
+                      </option>
+                      <?php endforeach; ?>
+                    </select></td>
+                </tr>
+                               <?php endif; ?>
                 <tr> 
                   <td valign="top" class="vncellreq">Mode</td>
-                  <td class="vtable"> <select name="mode" class="formfld" id="mode">
+                  <td class="vtable"><select name="mode" class="formfld" id="mode">
                       <?php 
                                                $opts = array();
-                                               if (strstr($optcfg['if'], "wi"))
+                                               if (strstr($optcfg['if'], "wi") || strstr($optcfg['if'], "ath"))
                                                        $opts[] = "hostap";
                                                $opts[] = "BSS";
                                                $opts[] = "IBSS";
@@ -121,19 +139,21 @@ function wireless_config_print() {
                                </tr>
                 <tr> 
                   <td valign="top" class="vncellreq">SSID</td>
-                  <td class="vtable"><input name="ssid" type="text" class="formfld" id="ssid" size="20" value="<?=htmlspecialchars($pconfig['ssid']);?>">
+                  <td class="vtable"><?=$mandfldhtml;?><input name="ssid" type="text" class="formfld" id="ssid" size="20" value="<?=htmlspecialchars($pconfig['ssid']);?>">
                   </td>
                 </tr>
                 <tr> 
                   <td valign="top" class="vncellreq">Channel</td>
                   <td class="vtable"><select name="channel" class="formfld" id="channel">
+                      <option <?php if ($pconfig['channel'] == 0) echo "selected";?> value="0">Auto</option>
                       <?php
-                                         for ($i = 0; $i <= 14; $i++): ?>
-                      <option <?php if ($i == $pconfig['channel']) echo "selected";?>>
-                      <? echo($i==0 ? "Auto" : $i) ?>
+                                         foreach ($wlchannels as $channel): ?>
+                      <option <?php if ($channel == $pconfig['channel']) echo "selected";?> value="<?=$channel;?>">
+                      <?=$channel;?>
                       </option>
-                      <?php endfor; ?>
-                    </select></td>
+                      <?php endforeach; ?>
+                    </select> <br>
+                    Note: Not all channels may be supported by your card</td>
                 </tr>
                 <tr> 
                   <td valign="top" class="vncell">Station name</td>
@@ -144,8 +164,8 @@ function wireless_config_print() {
                 <tr> 
                   <td valign="top" class="vncell">WEP</td>
                   <td class="vtable"> <input name="wep_enable" type="checkbox" id="wep_enable" value="yes" <?php if ($pconfig['wep_enable']) echo "checked"; ?>> 
-                    <strong>Enable WEP</strong><br>
-                    &nbsp; <table border="0" cellspacing="0" cellpadding="0">
+                    <strong>Enable WEP</strong>
+                    <table border="0" cellspacing="0" cellpadding="0">
                       <tr> 
                         <td>&nbsp;</td>
                         <td>&nbsp;</td>
index 720905ea20317ef107bb54c502114fbdb1ba974c..762228d5065664ead9e657a6828844a8e7cc4ff3 100644 (file)
@@ -1,18 +1,10 @@
 #!/usr/local/bin/php
-<?php require("guiconfig.inc"); 
+<?php 
+$pgtitle = array("License");
+require("guiconfig.inc"); 
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("License");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">License</p>
-            <p><strong>m0n0wall is Copyright &copy; 2002-2004 by Manuel Kasper 
+            <p><strong>m0n0wall is Copyright &copy; 2002-2005 by Manuel Kasper 
               (<a href="mailto:mk@neon1.net">mk@neon1.net</a>).<br>
               All rights reserved.</strong></p>
             <p> Redistribution and use in source and binary forms, with or without<br>
@@ -73,8 +65,8 @@
               <br>
               Jim McBeath (<a href="mailto:monowall@j.jimmc.org">monowall@j.jimmc.org</a>)<br>
               &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">Filter rule patches 
-              (ordering, block/pass, disabled); better status page;<br>
-              &nbsp;&nbsp;&nbsp;&nbsp;webGUI assign network ports page </font></em><br>
+              (ordering, block/pass, disabled); better status page;</font></em><br>
+              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">webGUI assign network ports page</font></em><br>
               <br>
               Chris Olive (<a href="mailto:chris@technologEase.com">chris@technologEase.com</a>)<br>
               &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">enhanced &quot;execute 
@@ -87,7 +79,7 @@
               &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">DHCP lease list page</font></em><br>
               <br>
               Peter Allgeyer (<a href="mailto:allgeyer@web.de">allgeyer@web.de</a>)<br>
-              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">&quot;reject&quot; type filter rules; dial-on-demand; WAN connect/disconnect</font></em><br>
+              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">&quot;reject&quot; type filter rules; dial-on-demand; WAN connect/disconnect; auto-add proxy ARP </font></em><br>
               <br>
               Thierry Lechat (<a href="mailto:dev@lechat.org">dev@lechat.org</a>)<br>
               &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">SVG-based traffic grapher</font></em><br>
               &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">NAT on optional interfaces</font></em><br>
               <br>
               Dinesh Nair (<a href="mailto:dinesh@alphaque.com">dinesh@alphaque.com</a>)<br>
-              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">captive portal: pass-through MAC/IP addresses, RADIUS authentication &amp; accounting;<br>
-              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666"></font></em>HTTP server concurrency limit</font></em><br>
+              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">captive portal: pass-through MAC/IP addresses, RADIUS authentication &amp; accounting;</font></em><br>
+              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">HTTP server concurrency limit</font></em><br>
               <br>
               Justin Ellison (<a href="mailto:justin@techadvise.com">justin@techadvise.com</a>)<br>
               &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">traffic shaper TOS matching; magic shaper; DHCP deny unknown clients;<br>
                          &nbsp;&nbsp;&nbsp;&nbsp;IPsec user FQDNs; DHCP relay</font></em><br>
                          <br>
               Fred Wright (<a href="mailto:fw@well.com">fw@well.com</a>)<br>
-              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">ipfilter window scaling fix; ipnat ICMP checksum adjustment fix; IPsec dead SA fixes</font></em><br>
+              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">ipfilter window scaling fix; ipnat ICMP checksum adjustment fix; IPsec dead SA fixes;</font></em><br>
+              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">netgraph PPP PFC fixes; kernel build improvements;</font></em><br>
+              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">updated DP83815 short cable bug workaround</font></em><br>
                          <br>
               Michael Hanselmann (<a href="mailto:m0n0@hansmi.ch">m0n0@hansmi.ch</a>)<br>
-              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">IDE hard disk standby</font></em><br>
+              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">IDE hard disk standby; exec.php arrow keys</font></em><br>
                          <br>
               Audun Larsen (<a href="mailto:larsen@xqus.com">larsen@xqus.com</a>)<br>
               &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">CPU/memory usage display</font></em><br>
                          <br>
               Peter Curran (<a href="mailto:peter@closeconsultants.com">peter@closeconsultants.com</a>)<br>
-              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">OpenVPN support</font></em></p>
+              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">OpenVPN support</font></em><br>
+                         <br>
+              Pavel A. Grodek (<a href="mailto:pg@abletools.com">pg@abletools.com</a>)<br>
+              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">Traffic shaper packet loss rate/queue size</font></em><br>
+                         <br>
+              Rob Parker, Keycom PLC (<a href="mailto:rob.parker@keycom.co.uk">rob.parker@keycom.co.uk</a>)<br>
+              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">Captive portal per-user bandwidth restrictions</font></em><br>
+                         <br>
+              Pascal Suter (<a href="mailto:d-monodev@psuter.ch">d-monodev@psuter.ch</a>)<br>
+              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">Captive portal local user database</font></em><br>
+                         <br>
+              Matt Juszczak (<a href="mailto:matt@atopia.net">matt@atopia.net</a>)<br>
+              &nbsp;&nbsp;&nbsp;&nbsp;<em><font color="#666666">Captive portal logging</font></em></p>
             <hr size="1">
             <p>m0n0wall is based upon/includes various free software packages, 
               listed below.<br>
               The author of m0n0wall would like to thank the authors of these 
               software packages for their efforts.</p>
             <p>FreeBSD (<a href="http://www.freebsd.org" target="_blank">http://www.freebsd.org</a>)<br>
-              Copyright &copy; 1994-2003 FreeBSD, Inc. All rights reserved.<br>
+              Copyright &copy; 1994-2005 FreeBSD, Inc. All rights reserved.<br>
               <br>
               This product includes PHP, freely available from <a href="http://www.php.net/" target="_blank">http://www.php.net</a>.<br>
-              Copyright &copy; 1999 - 2003 The PHP Group. All rights reserved.<br>
+              Copyright &copy; 1999 - 2005 The PHP Group. All rights reserved.<br>
               <br>
               mini_httpd (<a href="http://www.acme.com/software/mini_httpd" target="_blank">http://www.acme.com/software/mini_httpd)</a><br>
               Copyright &copy; 1999, 2000 by Jef Poskanzer &lt;jef@acme.com&gt;. 
               Copyright &copy; 1996-2003 Internet Software Consortium. All rights 
               reserved.<br>
               <br>
-              ipfilter (<a href="http://www.ipfilter.org" target="_blank">http://www.ipfilter.org</a>)<br>
+              ipfilter (<a href="http://coombs.anu.edu.au/ipfilter" target="_blank">http://coombs.anu.edu.au/ipfilter</a>)<br>
               Copyright &copy; 1993-2002 by Darren Reed.<br>
               <br>
               MPD - Multi-link PPP daemon for FreeBSD (<a href="http://www.dellroad.org/mpd" target="_blank">http://www.dellroad.org/mpd</a>)<br>
@@ -182,6 +188,4 @@ All rights reserved.<br>
                          <br>
                          wol (<a href="http://ahh.sourceforge.net/wol" target="_blank">http://ahh.sourceforge.net/wol</a>)<br>
                          Copyright &copy; 2000,2001,2002,2003,2004 Thomas Krennwallner &lt;krennwallner@aon.at&gt;
-                         <?php include("fend.inc"); ?>
-</body>
-</html>
+<?php include("fend.inc"); ?>
index 0dbd6d18caadc2c616ac1d2298f9f4eace82a9a8..9723275cf464ea7343d7b4185e8ab43cc4ee0473 100644 (file)
@@ -4,7 +4,7 @@
        reboot.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Diagnostics", "Reboot system");
 require("guiconfig.inc");
 
 if ($_POST) {
@@ -41,17 +42,7 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Reboot system");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Reboot system</p>
 <?php if ($rebootmsg): echo print_info_box($rebootmsg); else: ?>
       <form action="reboot.php" method="post">
         <p><strong>Are you sure you want to reboot the system?</strong></p>
@@ -62,5 +53,3 @@ if ($_POST) {
       </form>
 <?php endif; ?>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index f2366c401a553ca891cab783d0e081af330c3014..a25e997501662a87c8c7f7f8abafb5d9ae155b77 100644 (file)
@@ -4,7 +4,7 @@
        services_captiveportal.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Services", "Captive portal");
 require("guiconfig.inc");
 
 if (!is_array($config['captiveportal'])) {
@@ -49,6 +50,7 @@ $pconfig['cinterface'] = $config['captiveportal']['interface'];
 $pconfig['timeout'] = $config['captiveportal']['timeout'];
 $pconfig['idletimeout'] = $config['captiveportal']['idletimeout'];
 $pconfig['enable'] = isset($config['captiveportal']['enable']);
+$pconfig['auth_method'] = $config['captiveportal']['auth_method'];
 $pconfig['radacct_enable'] = isset($config['captiveportal']['radacct_enable']);
 $pconfig['httpslogin_enable'] = isset($config['captiveportal']['httpslogin']);
 $pconfig['httpsname'] = $config['captiveportal']['httpsname'];
@@ -120,6 +122,7 @@ if ($_POST) {
                $config['captiveportal']['timeout'] = $_POST['timeout'];
                $config['captiveportal']['idletimeout'] = $_POST['idletimeout'];
                $config['captiveportal']['enable'] = $_POST['enable'] ? true : false;
+               $config['captiveportal']['auth_method'] = $_POST['auth_method'];
                $config['captiveportal']['radacct_enable'] = $_POST['radacct_enable'] ? true : false;
                $config['captiveportal']['httpslogin'] = $_POST['httpslogin_enable'] ? true : false;
                $config['captiveportal']['httpsname'] = $_POST['httpsname'];
@@ -151,20 +154,9 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Services: Captive portal");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
+<?php include("fbegin.inc"); ?>
 <script language="JavaScript">
 <!--
-function radacct_change() {
-       if (document.iform.radacct_enable.checked) {
-               document.iform.logoutwin_enable.checked = 1;
-       } 
-}
-
 function enable_change(enable_change) {
        var endis;
        endis = !(document.iform.enable.checked || enable_change);
@@ -177,6 +169,10 @@ function enable_change(enable_change) {
        document.iform.radiusport.disabled = endis;
        document.iform.radiuskey.disabled = endis;
        document.iform.radacct_enable.disabled = endis;
+       document.iform.radiusacctport.disabled = endis;
+       document.iform.auth_method[0].disabled = endis;
+       document.iform.auth_method[1].disabled = endis;
+       document.iform.auth_method[2].disabled = endis;
        document.iform.httpslogin_enable.disabled = endis;
        document.iform.httpsname.disabled = endis;
        document.iform.cert.disabled = endis;
@@ -185,27 +181,19 @@ function enable_change(enable_change) {
        document.iform.nomacfilter.disabled = endis;
        document.iform.htmlfile.disabled = endis;
        document.iform.errfile.disabled = endis;
-       
-       if (enable_change && document.iform.radacct_enable.checked) {
-               document.iform.logoutwin_enable.checked = 1;
-       }
 }
 //-->
 </script>
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">Services: Captive portal</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if ($savemsg) print_info_box($savemsg); ?>
 <form action="services_captiveportal.php" method="post" enctype="multipart/form-data" name="iform" id="iform">
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
        <li class="tabact">Captive portal</li>
        <li class="tabinact"><a href="services_captiveportal_mac.php">Pass-through MAC</a></li>
        <li class="tabinact"><a href="services_captiveportal_ip.php">Allowed IP addresses</a></li>
+       <li class="tabinact"><a href="services_captiveportal_users.php">Users</a></li>
   </ul>
   </td></tr>
   <tr>
@@ -253,7 +241,7 @@ Clients will be disconnected after this amount of inactivity. They may log in ag
          <td width="78%" class="vtable"> 
                <input name="logoutwin_enable" type="checkbox" class="formfld" id="logoutwin_enable" value="yes" <?php if($pconfig['logoutwin_enable']) echo "checked"; ?>>
                <strong>Enable logout popup window</strong><br>
-         If enabled, a popup window will appear when clients are allowed through the captive portal. This allows clients to explicitly disconnect themselves before the idle or hard timeout occurs. When RADIUS accounting is  enabled, this option is implied.</td>
+         If enabled, a popup window will appear when clients are allowed through the captive portal. This allows clients to explicitly disconnect themselves before the idle or hard timeout occurs.</td>
        </tr>
        <tr>
          <td valign="top" class="vncell">Redirection URL</td>
@@ -271,9 +259,24 @@ to access after they've authenticated.</td>
     If this option is set, no attempts will be made to ensure that the MAC address of clients stays the same while they're logged in. This is required when the MAC address of cannot be determined (usually because there are routers between m0n0wall and the clients).</td>
          </tr>
        <tr> 
-         <td width="22%" valign="top" class="vncell">RADIUS server</td>
+         <td width="22%" valign="top" class="vncell">Authentication</td>
          <td width="78%" class="vtable"> 
                <table cellpadding="0" cellspacing="0">
+               <tr>
+                 <td colspan="2"><input name="auth_method" type="radio" id="auth_method" value="none" <?php if($pconfig['auth_method']!="local" && $pconfig['auth_method']!="radius") echo "checked"; ?>>
+  No authentication</td>  
+                 </tr>
+               <tr>
+                 <td colspan="2"><input name="auth_method" type="radio" id="auth_method" value="local" <?php if($pconfig['auth_method']=="local") echo "checked"; ?>>
+  Local <a href="services_captiveportal_users.php">user manager</a></td>  
+                 </tr>
+               <tr>
+                 <td colspan="2"><input name="auth_method" type="radio" id="auth_method" value="radius" <?php if($pconfig['auth_method']=="radius") echo "checked"; ?>>
+  RADIUS authentication</td>  
+                 </tr><tr>
+                 <td>&nbsp;</td>
+                 <td>&nbsp;</td>
+                 </tr>
                <tr>
                <td>IP address:</td>
                <td><input name="radiusip" type="text" class="formfld" id="radiusip" size="20" value="<?=htmlspecialchars($pconfig['radiusip']);?>"></td>
@@ -286,14 +289,14 @@ to access after they've authenticated.</td>
                </tr>
                <tr>
           <td>Accounting:&nbsp;&nbsp;</td>
-          <td><input name="radacct_enable" type="checkbox" id="radacct_enable" value="yes" <?php if($pconfig['radacct_enable']) echo "checked"; ?> onClick="radacct_change()"></td>
+          <td><input name="radacct_enable" type="checkbox" id="radacct_enable" value="yes" <?php if($pconfig['radacct_enable']) echo "checked"; ?>></td>
                  </tr>
                <tr>
           <td>Accounting port:&nbsp;&nbsp;</td>
           <td><input name="radiusacctport" type="text" class="formfld" id="radiusacctport" size="5" value="<?=htmlspecialchars($pconfig['radiusacctport']);?>"></td>
                  </tr></table>
                <br>
-       Enter the IP address and port of the RADIUS server which users of the captive portal have to authenticate against. Leave blank to disable RADIUS authentication. Leave port number blank to use the default port (1812). Leave the RADIUS shared secret blank to not use a RADIUS shared secret. RADIUS accounting packets will also be sent to the RADIUS server if  accounting is enabled (default port is 1813).
+       When using RADIUS authentication, enter the IP address and port of the RADIUS server which users of the captive portal have to authenticate against.  Leave port number blank to use the default port (1812). Leave the RADIUS shared secret blank to not use a RADIUS shared secret. RADIUS accounting packets will also be sent to the RADIUS server if  accounting is enabled (default port is 1813).
        </tr>
        <tr>
       <td valign="top" class="vncell">HTTPS login</td>
@@ -325,7 +328,7 @@ to access after they've authenticated.</td>
        <tr> 
          <td width="22%" valign="top" class="vncellreq">Portal page contents</td>
          <td width="78%" class="vtable">    
-               <input type="file" name="htmlfile" class="formfld" id="htmlfile"><br>
+               <?=$mandfldhtml;?><input type="file" name="htmlfile" class="formfld" id="htmlfile"><br>
                <?php if ($config['captiveportal']['page']['htmltext']): ?>
                <a href="?act=viewhtml" target="_blank">View current page</a>                      
                  <br>
@@ -376,5 +379,3 @@ enable_change(false);
 //-->
 </script>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index b3d406aa5dd3c1029aad842dd417aac7560bf811..37da041fb0ca9fa65fac81ed7b8b88e22752ffe5 100644 (file)
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Services", "Captive portal");
 require("guiconfig.inc");
 
 if (!is_array($config['captiveportal']['allowedip']))
@@ -67,17 +68,7 @@ if ($_GET['act'] == "del") {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Services: Captive portal");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Services: Captive portal: Allowed IP addresses</p>
 <form action="services_captiveportal_ip.php" method="post">
 <?php if ($savemsg) print_info_box($savemsg); ?>
 <?php if (file_exists($d_allowedipsdirty_path)): ?><p>
@@ -85,11 +76,12 @@ if ($_GET['act'] == "del") {
 <input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
 <?php endif; ?>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
-       <li class="tabinact"><a href="services_captiveportal.php">Captive portal</a></li>
+       <li class="tabinact1"><a href="services_captiveportal.php">Captive portal</a></li>
        <li class="tabinact"><a href="services_captiveportal_mac.php">Pass-through MAC</a></li>
        <li class="tabact">Allowed IP addresses</li>
+       <li class="tabinact"><a href="services_captiveportal_users.php">Users</a></li>
   </ul>
   </td></tr>
   <tr>
@@ -148,5 +140,3 @@ if ($_GET['act'] == "del") {
   </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 4b1cecf9803a1b84f048743bad2cc707db27f576..85911e6ac763d67cc9a4d955de87c361c1bf13f9 100644 (file)
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Services", "Captive portal", "Edit allowed IP address");
 require("guiconfig.inc");
 
 if (!is_array($config['captiveportal']['allowedip']))
@@ -92,17 +93,7 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Services: Captive portal: Edit allowed IP address");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Services: Captive portal: Edit allowed IP address</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
             <form action="services_captiveportal_ip_edit.php" method="post" name="iform" id="iform">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
@@ -125,7 +116,7 @@ if ($_POST) {
                                <tr>
                   <td width="22%" valign="top" class="vncellreq">IP address</td>
                   <td width="78%" class="vtable"> 
-                    <input name="ip" type="text" class="formfld" id="ip" size="17" value="<?=htmlspecialchars($pconfig['ip']);?>">
+                    <?=$mandfldhtml;?><input name="ip" type="text" class="formfld" id="ip" size="17" value="<?=htmlspecialchars($pconfig['ip']);?>">
                     <br> 
                     <span class="vexpl">IP address</span></td>
                 </tr>
@@ -148,5 +139,3 @@ if ($_POST) {
               </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index d38c58c641d6a1d3b8974aab78ce7923bd35d846..fec126228ad28de3dbfbb7a1f5eca29f96219f38 100644 (file)
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Services", "Captive portal");
 require("guiconfig.inc");
 
 if (!is_array($config['captiveportal']['passthrumac']))
@@ -67,17 +68,7 @@ if ($_GET['act'] == "del") {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Services: Captive portal");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Services: Captive portal: Pass-through MAC addresses</p>
 <form action="services_captiveportal_mac.php" method="post">
 <?php if ($savemsg) print_info_box($savemsg); ?>
 <?php if (file_exists($d_passthrumacsdirty_path)): ?><p>
@@ -85,11 +76,12 @@ if ($_GET['act'] == "del") {
 <input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
 <?php endif; ?>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
-       <li class="tabinact"><a href="services_captiveportal.php">Captive portal</a></li>
+       <li class="tabinact1"><a href="services_captiveportal.php">Captive portal</a></li>
        <li class="tabact">Pass-through MAC</li>
        <li class="tabinact"><a href="services_captiveportal_ip.php">Allowed IP addresses</a></li>
+       <li class="tabinact"><a href="services_captiveportal_users.php">Users</a></li>
   </ul>
   </td></tr>
   <tr>
@@ -129,5 +121,3 @@ if ($_GET['act'] == "del") {
   </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index f763bacc7de43dd8dbdccfe7dfbe7f38f1a7820b..f204d0fd60f490b19badda3f46de55ab03774d00 100644 (file)
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Services", "Captive portal", "Edit pass-through MAC address");
 require("guiconfig.inc");
 
 if (!is_array($config['captiveportal']['passthrumac']))
@@ -57,6 +58,8 @@ if ($_POST) {
        
        do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
        
+       $_POST['mac'] = str_replace("-", ":", $_POST['mac']);
+       
        if (($_POST['mac'] && !is_macaddr($_POST['mac']))) {
                $input_errors[] = "A valid MAC address must be specified. [".$_POST['mac']."]";
        }
@@ -90,24 +93,14 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Services: Captive portal: Edit pass-through MAC address");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Services: Captive portal: Edit pass-through MAC address</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
             <form action="services_captiveportal_mac_edit.php" method="post" name="iform" id="iform">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
                                <tr>
                   <td width="22%" valign="top" class="vncellreq">MAC address</td>
                   <td width="78%" class="vtable"> 
-                    <input name="mac" type="text" class="formfld" id="mac" size="17" value="<?=htmlspecialchars($pconfig['mac']);?>">
+                    <?=$mandfldhtml;?><input name="mac" type="text" class="formfld" id="mac" size="17" value="<?=htmlspecialchars($pconfig['mac']);?>">
                     <br> 
                     <span class="vexpl">MAC address (6 hex octets separated by colons)</span></td>
                 </tr>
@@ -130,5 +123,3 @@ if ($_POST) {
               </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/webgui/services_captiveportal_users.php b/webgui/services_captiveportal_users.php
new file mode 100644 (file)
index 0000000..e15c0dc
--- /dev/null
@@ -0,0 +1,243 @@
+#!/usr/local/bin/php
+<?php 
+/*
+       services_captiveportal_users.php
+       part of m0n0wall (http://m0n0.ch/wall)
+       
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
+       All rights reserved.
+       Copyright (C) 2005 Pascal Suter <d-monodev@psuter.ch>.
+       All rights reserved. 
+       (files was created by Pascal based on the source code of services_captiveportal.php from Manuel)
+       
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions are met:
+       
+       1. Redistributions of source code must retain the above copyright notice,
+          this list of conditions and the following disclaimer.
+       
+       2. Redistributions in binary form must reproduce the above copyright
+          notice, this list of conditions and the following disclaimer in the
+          documentation and/or other materials provided with the distribution.
+       
+       THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+       INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+       AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+       AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+       OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+       INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+       CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+       ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+       POSSIBILITY OF SUCH DAMAGE.
+*/
+$pgtitle = array("Services", "Captive portal");
+require("guiconfig.inc");
+if(isset($_POST['save'])){
+       //value-checking
+       if(trim($_POST['password1'])!="********" && 
+          trim($_POST['password1'])!="" && 
+          trim($_POST['password1'])!=trim($_POST['password2'])){
+               //passwords are to be changed but don't match
+               $input_errors[]="passwords don't match";
+       }
+       if((trim($_POST['password1'])=="" || trim($_POST['password1'])=="********") && 
+          (trim($_POST['password2'])=="" || trim($_POST['password2'])=="********")){
+               //assume password should be left as is if a password is set already.
+               if(!empty($config['users'][$_POST['old_username']]['password'])){
+                       $_POST['password1']="********";
+                       $_POST['password2']="********";
+               } else {
+                       $input_errors[]="password must not be empty";
+               }
+       } else {
+               if(trim($_POST['password1'])!=trim($_POST['password2'])){
+                       //passwords are to be changed or set but don't match
+                       $input_errors[]="passwords don't match";
+               } else {
+                       //check password for invalid characters
+                       if(!preg_match('/^[a-zA-Z0-9_\-\.@\~\(\)\&\*\+§?!\$£°\%;:]*$/',$_POST['username'])){
+                               $input_errors[] = "password contains illegal characters, only  letters from A-Z and a-z, _, -, .,@,~,(,),&,*,+,§,?,!,$,£,°,%,;,: and numbers are allowed";
+                               //test pw: AZaz_-.@~()&*+§?!$£°%;:
+                       }
+               }
+       }
+       if($_POST['username']==""){
+               $input_errors[] = "username must not be empty!";
+       }
+       //check for a valid expirationdate if one is set at all (valid means, strtotime() puts out a time stamp
+       //so any strtotime compatible time format may be used. to keep it simple for the enduser, we only claim 
+       //to accept MM/DD/YYYY as inputs. advanced users may use inputs like "+1 day", which will be converted to 
+       //MM/DD/YYYY based on "now" since otherwhise such an entry would lead to a never expiring expirationdate
+       if(trim($_POST['expirationdate'])!=""){
+               if(strtotime($_POST['expirationdate'])>0){
+                       if(strtotime("-1 day")>strtotime(date("m/d/Y",strtotime($_POST['expirationdate'])))){
+                               $input_errors[] = "selected expiration date lies in the past";                  
+                       } else {
+                               //convert from any strtotime compatible date to MM/DD/YYYY
+                               $expdate = strtotime($_POST['expirationdate']);
+                               $_POST['expirationdate'] = date("m/d/Y",$expdate);
+                       }
+               } else {
+                       $input_errors[] = "invalid expiration date format, use MM/DD/YYYY instead";
+               }
+       }
+       //check username: only allow letters from A-Z and a-z, _, -, . and numbers from 0-9 (note: username can
+       //not contain characters which are not allowed in an xml-token. i.e. if you'd use @ in a username, config.xml
+       //could not be parsed anymore!
+       if(!preg_match('/^[a-zA-Z0-9_\-\.]*$/',$_POST['username'])){
+               $input_errors[] = "username contains illegal characters, only  letters from A-Z and a-z, _, -, . and numbers are allowed";
+       }
+       
+       if(!empty($input_errors)){
+               //there are illegal inputs --> print out error message and show formular again (and fill in all recently entered values
+               //except passwords
+               $_GET['act']="new";
+               $_POST['old_username']=($_POST['old_username'] ? $_POST['old_username'] : $_POST['username']);
+               $_GET['username']=$_POST['old_username'];
+               foreach(Array("username","fullname","expirationdate") as $field){
+                       $config['users'][$_POST['old_username']][$field]=$_POST[$field];
+               }
+       } else {
+               //all values are okay --> saving changes
+               $_POST['username']=trim($_POST['username']);
+               if($_POST['old_username']!="" && $_POST['old_username']!=$_POST['username']){
+                       //change the username (which is used as array-index)
+                       $config['users'][$_POST['username']]=$config['users'][$_POST['old_username']];
+                       unset($config['users'][$_POST['old_username']]);
+               }
+               foreach(Array('fullname','expirationdate') as $field){
+                       $config['users'][$_POST['username']][$field]=trim($_POST[$field]);
+               }
+               if(trim($_POST['password1'])!="********" && trim($_POST['password1'])!=""){
+                       $config['users'][$_POST['username']]['password']=md5(trim($_POST['password1']));
+               }
+               write_config();
+               $savemsg=$_POST['username']." successfully saved<br>";
+       }
+} else if ($_GET['act']=="delete" && isset($_GET['username'])){
+       unset($config['users'][$_GET['username']]);
+       write_config();
+       $savemsg=$_GET['username']." successfully deleted<br>";
+}
+//erase expired accounts
+$changed=false;
+if(is_array($config['users'])){
+       foreach($config['users'] as $username => $user){
+               if(trim($user['expirationdate'])!="" && strtotime("-1 day")>strtotime($user['expirationdate']) && empty($input_errors)){
+                       unset($config['users'][$username]);
+                       $changed=true;
+                       $savemsg.="$username has expired --> $username was deleted<br>";
+               }
+       }
+       if($changed){
+               write_config();
+       }
+}
+
+?>
+<?php include("fbegin.inc"); ?>
+<script language="javascript" type="text/javascript" src="datetimepicker.js">
+//Date Time Picker script- by TengYong Ng of http://www.rainforestnet.com
+//Script featured on JavaScript Kit (http://www.javascriptkit.com)
+//For this script, visit http://www.javascriptkit.com
+</script>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+  <tr><td>
+  <ul id="tabnav">
+       <li class="tabinact1"><a href="services_captiveportal.php">Captive portal</a></li>
+       <li class="tabinact"><a href="services_captiveportal_mac.php">Pass-through MAC</a></li>
+       <li class="tabinact"><a href="services_captiveportal_ip.php">Allowed IP addresses</a></li>
+       <li class="tabact">Users</li>
+  </ul>
+  </td></tr>
+  <tr>
+  <td class="tabcont">
+<?php
+if($_GET['act']=="new" || $_GET['act']=="edit"){
+       if($_GET['act']=="edit" && isset($_GET['username'])){
+               $user=$config['users'][$_GET['username']];
+       }
+?>
+       <form action="services_captiveportal_users.php" method="post" name="iform" id="iform">
+              <table width="100%" border="0" cellpadding="6" cellspacing="0">
+                <tr> 
+                  <td width="22%" valign="top" class="vncellreq">Username</td>
+                  <td width="78%" class="vtable"> 
+                    <input name="username" type="text" class="formfld" id="username" size="20" value="<?=$_GET['username'];?>"> 
+                    </td>
+                </tr>
+                <tr> 
+                  <td width="22%" valign="top" class="vncellreq">Password</td>
+                  <td width="78%" class="vtable"> 
+                    <input name="password1" type="password" class="formfld" id="password1" size="20" value="<?php echo ($_GET['act']=='edit' ? "********" : "" ); ?>"> <br>
+                                       <input name="password2" type="password" class="formfld" id="password2" size="20" value="<?php echo ($_GET['act']=='edit' ? "********" : "" ); ?>">
+&nbsp;(confirmation)                                   </td>
+                </tr>
+                <tr> 
+                  <td width="22%" valign="top" class="vncell">Full name</td>
+                  <td width="78%" class="vtable"> 
+                    <input name="fullname" type="text" class="formfld" id="fullname" size="20" value="<?=htmlspecialchars($user['fullname']);?>">
+                    <br>
+                    User's full name, for your own information only</td>
+                </tr>
+                <tr> 
+                  <td width="22%" valign="top" class="vncell">Expiration date</td>
+                  <td width="78%" class="vtable"> 
+                    <input name="expirationdate" type="text" class="formfld" id="expirationdate" size="10" value="<?=$user['expirationdate'];?>">
+                    <a href="javascript:NewCal('expirationdate','mmddyyyy')"><img src="cal.gif" width="16" height="16" border="0" alt="Pick a date"></a> 
+                    <br> 
+                    <span class="vexpl">Leave blank if the account shouldn't expire, otherwise enter the expiration date in the following format: mm/dd/yyyy</span></td>
+                </tr>
+                <tr> 
+                  <td width="22%" valign="top">&nbsp;</td>
+                  <td width="78%"> 
+                    <input name="save" type="submit" class="formbtn" value="Save"> 
+                    <input name="old_username" type="hidden" value="<?=$_GET['username'];?>">
+                  </td>
+                </tr>
+              </table>
+     </form>
+<?php
+} else {
+?>
+     <table width="100%" border="0" cellpadding="0" cellspacing="0">
+                <tr>
+                  <td width="35%" class="listhdrr">Username</td>
+                  <td width="20%" class="listhdrr">Full name</td>
+                  <td width="35%" class="listhdr">Expires</td>
+                  <td width="10%" class="list"></td>
+               </tr>
+<?php
+       if(is_array($config['users'])){
+               foreach($config['users'] as $username => $user){
+?>
+               <tr>
+                  <td class="listlr">
+                    <?=$username; ?>&nbsp;
+                  </td>
+                  <td class="listr">
+                    <?=htmlspecialchars($user['fullname']);?>&nbsp;
+                  </td>
+                  <td class="listbg">
+                    <?=$user['expirationdate']; ?>&nbsp;
+                  </td>
+                  <td valign="middle" nowrap class="list"> <a href="services_captiveportal_users.php?act=edit&username=<?=$username; ?>"><img src="e.gif" width="17" height="17" border="0"></a>
+                     &nbsp;<a href="services_captiveportal_users.php?act=delete&username=<?=$username; ?>" onclick="return confirm('Do you really want to delete this User?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
+               </tr>
+<?php
+               }
+       } ?>
+       <tr> 
+                         <td class="list" colspan="3"></td>
+                         <td class="list"> <a href="services_captiveportal_users.php?act=new"><img src="plus.gif" width="17" height="17" border="0"></a></td>
+               </tr>
+ </table>
+<?php } ?>
+     
+  </td>
+  </tr>
+  </table>
+<?php include("fend.inc"); ?>
index 9a8614c2819e92ae4d0f5161011daa826aed971a..9d60aeb73298c6a1acdb6edd04b55d0907262a19 100644 (file)
@@ -4,7 +4,7 @@
        services_dhcp.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Services", "DHCP server");
 require("guiconfig.inc");
 
 $if = $_GET['if'];
@@ -85,11 +86,11 @@ if ($_POST) {
                if (($_POST['wins1'] && !is_ipaddr($_POST['wins1'])) || ($_POST['wins2'] && !is_ipaddr($_POST['wins2']))) {
                        $input_errors[] = "A valid IP address must be specified for the primary/secondary WINS server.";
                }
-               if ($_POST['deftime'] && (!is_numeric($_POST['deftime']) || ($_POST['deftime'] < 60))) {
-                       $input_errors[] = "The default lease time must be at least 60 seconds.";
+               if ($_POST['deftime'] && (!is_numericint($_POST['deftime']))) {
+                       $input_errors[] = "The default lease time must be an integer.";
                }
-               if ($_POST['maxtime'] && (!is_numeric($_POST['maxtime']) || ($_POST['maxtime'] < 60) || ($_POST['maxtime'] <= $_POST['deftime']))) {
-                       $input_errors[] = "The maximum lease time must be at least 60 seconds and higher than the default lease time.";
+               if ($_POST['maxtime'] && (!is_numericint($_POST['maxtime']) || ($_POST['maxtime'] <= $_POST['deftime']))) {
+                       $input_errors[] = "The maximum lease time must be higher than the default lease time.";
                }
                
                if (!$input_errors) {
@@ -152,12 +153,7 @@ if ($_GET['act'] == "del") {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Services: DHCP server");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
+<?php include("fbegin.inc"); ?>
 <script language="JavaScript">
 <!--
 function enable_change(enable_over) {
@@ -173,11 +169,6 @@ function enable_change(enable_over) {
 }
 //-->
 </script>
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">Services: DHCP server</p>
 <form action="services_dhcp.php" method="post" name="iform" id="iform">
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if ($savemsg) print_info_box($savemsg); ?>
@@ -186,15 +177,15 @@ function enable_change(enable_over) {
 <input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
 <?php endif; ?>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
-<?php foreach ($iflist as $ifent => $ifname):
+<?php $i = 0; foreach ($iflist as $ifent => $ifname):
        if ($ifent == $if): ?>
     <li class="tabact"><?=htmlspecialchars($ifname);?></li>
 <?php else: ?>
-    <li class="tabinact"><a href="services_dhcp.php?if=<?=$ifent;?>"><?=htmlspecialchars($ifname);?></a></li>
+    <li class="<?php if ($i == 0) echo "tabinact1"; else echo "tabinact";?>"><a href="services_dhcp.php?if=<?=$ifent;?>"><?=htmlspecialchars($ifname);?></a></li>
 <?php endif; ?>
-<?php endforeach; ?>
+<?php $i++; endforeach; ?>
   </ul>
   </td></tr>
   <tr> 
@@ -240,8 +231,8 @@ function enable_change(enable_over) {
                       <tr> 
                         <td width="22%" valign="top" class="vncellreq">Range</td>
                         <td width="78%" class="vtable"> 
-                          <input name="range_from" type="text" class="formfld" id="range_from" size="20" value="<?=htmlspecialchars($pconfig['range_from']);?>"> 
-                          &nbsp;to&nbsp; <input name="range_to" type="text" class="formfld" id="range_to" size="20" value="<?=htmlspecialchars($pconfig['range_to']);?>"></td>
+                          <?=$mandfldhtml;?><input name="range_from" type="text" class="formfld" id="range_from" size="20" value="<?=htmlspecialchars($pconfig['range_from']);?>"> 
+                          &nbsp;to&nbsp; <?=$mandfldhtmlspc;?><input name="range_to" type="text" class="formfld" id="range_to" size="20" value="<?=htmlspecialchars($pconfig['range_to']);?>"></td>
                       </tr>
                       <tr> 
                         <td width="22%" valign="top" class="vncell">WINS servers</td>
@@ -289,7 +280,6 @@ function enable_change(enable_over) {
                             </span></p></td>
                       </tr>
                     </table>
-                                       &nbsp;<br>
               <table width="100%" border="0" cellpadding="0" cellspacing="0">
                 <tr>
                   <td width="35%" class="listhdrr">MAC address </td>
@@ -327,5 +317,3 @@ enable_change(false);
 //-->
 </script>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 80f64a9aaf938678fbe56e7d96678ec893b05543..e531b6e67de59508d38254034079dff1f5eaf94c 100644 (file)
@@ -4,7 +4,7 @@
        services_dhcp_edit.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Services", "DHCP server", "Edit static mapping");
 require("guiconfig.inc");
 
 $if = $_GET['if'];
@@ -55,6 +56,8 @@ if (isset($id) && $a_maps[$id]) {
        $pconfig['mac'] = $a_maps[$id]['mac'];
        $pconfig['ipaddr'] = $a_maps[$id]['ipaddr'];
        $pconfig['descr'] = $a_maps[$id]['descr'];
+} else {
+       $pconfig['mac'] = $_GET['mac'];
 }
 
 if ($_POST) {
@@ -68,6 +71,8 @@ if ($_POST) {
        
        do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
        
+       $_POST['mac'] = str_replace("-", ":", $_POST['mac']);
+       
        if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) {
                $input_errors[] = "A valid IP address must be specified.";
        }
@@ -123,24 +128,14 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Services: DHCP: Edit static mapping");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Services: DHCP: Edit static mapping</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
             <form action="services_dhcp_edit.php" method="post" name="iform" id="iform">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">MAC address</td>
                   <td width="78%" class="vtable"> 
-                    <input name="mac" type="text" class="formfld" id="mac" size="30" value="<?=htmlspecialchars($pconfig['mac']);?>"> 
+                    <?=$mandfldhtml;?><input name="mac" type="text" class="formfld" id="mac" size="30" value="<?=htmlspecialchars($pconfig['mac']);?>"> 
                     <br>
                     <span class="vexpl">Enter a MAC address in the following format: 
                     xx:xx:xx:xx:xx:xx</span></td>
@@ -172,5 +167,3 @@ if ($_POST) {
               </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 674077cdfd84244fba4386449386ae698e4dcf87..337c0edfba49030734dcab7dc24178b0a9d0cbbd 100644 (file)
@@ -29,6 +29,9 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Services", "DHCP relay");
+require("guiconfig.inc");
+
 function get_wan_dhcp_server() {
        global $config, $g;
        $dhclientfn = $g['vardb_path'] . "/dhclient.leases";
@@ -50,9 +53,6 @@ function get_wan_dhcp_server() {
        return $dhcpserver[1];
 }
 
-
-require("guiconfig.inc");
-
 $if = $_GET['if'];
 if ($_POST['if'])
        $if = $_POST['if'];
@@ -99,6 +99,7 @@ if ($_POST) {
                        /* make sure that the DHCP server isn't enabled on this interface */
                        if (isset($config['dhcpd'][$if]['enable'])) 
                                $input_errors[] = "You must disable the DHCP server on the {$iflist[$if]} interface before enabling the DHCP Relay.";
+                       
                        /* make sure that the DHCP server isn't running on any of the implied interfaces */
                        foreach ($config['interfaces'] as $ifname => $ifcfg) {
                                $subnet = $ifcfg['ipaddr'] . "/" . $ifcfg['subnet'];
@@ -107,7 +108,7 @@ if ($_POST) {
                        }       
                        if (!isset($destif)) 
                                $destif = "wan";
-                       if (isset($config['dhcpd'][$destif]['enable'])
+                       if (isset($config['dhcpd'][$destif]['enable']) && !$input_errors)
                                $input_errors[] = "You must disable the DHCP server on the {$destif} interface before enabling the DHCP Relay.";
                                
                        /* if proxydhcp is selected, make sure DHCP is enabled on WAN */
@@ -136,12 +137,7 @@ if ($_POST) {
 }
 
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Services: DHCP relay");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
+<?php include("fbegin.inc"); ?>
 <script language="JavaScript">
 <!--
 function enable_change(enable_over) {
@@ -160,24 +156,19 @@ function enable_change(enable_over) {
 }
 //-->
 </script>
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">Services: DHCP relay</p>
 <form action="services_dhcp_relay.php" method="post" name="iform" id="iform">
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if ($savemsg) print_info_box($savemsg); ?>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
-<?php foreach ($iflist as $ifent => $ifname):
+<?php $i = 0; foreach ($iflist as $ifent => $ifname):
        if ($ifent == $if): ?>
     <li class="tabact"><?=htmlspecialchars($ifname);?></li>
 <?php else: ?>
-    <li class="tabinact"><a href="services_dhcp_relay.php?if=<?=$ifent;?>"><?=htmlspecialchars($ifname);?></a></li>
+    <li class="<?php if ($i == 0) echo "tabinact1"; else echo "tabinact";?>"><a href="services_dhcp_relay.php?if=<?=$ifent;?>"><?=htmlspecialchars($ifname);?></a></li>
 <?php endif; ?>
-<?php endforeach; ?>
+<?php $i++; endforeach; ?>
   </ul>
   </td></tr>
   <tr> 
@@ -225,5 +216,3 @@ enable_change(false);
 //-->
 </script>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 00cd5af52098c64bddf6e0fe5db72ad742281ebb..231310dbab25ebf125b40473f24f1356d91b75a7 100644 (file)
@@ -4,7 +4,7 @@
        services_dnsmasq.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Bob Zoller <bob@kludgebox.com> and Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Bob Zoller <bob@kludgebox.com> and Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Services", "DNS forwarder");
 require("guiconfig.inc");
 
 $pconfig['enable'] = isset($config['dnsmasq']['enable']);
@@ -73,17 +74,7 @@ if ($_GET['act'] == "del") {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Services: DNS forwarder");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Services: DNS forwarder</p>
 <form action="services_dnsmasq.php" method="post">
 <?php if ($savemsg) print_info_box($savemsg); ?>
 <?php if (file_exists($d_hostsdirty_path)): ?><p>
@@ -92,20 +83,19 @@ if ($_GET['act'] == "del") {
 <?php endif; ?>
                          <table width="100%" border="0" cellpadding="6" cellspacing="0">
                 <tr> 
-                  <td class="vtable"><p> 
+                  <td class="vtable">
                       <input name="enable" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable']) echo "checked";?>>
-                      <strong>Enable DNS forwarder<br>
-                      </strong></p></td>
+                      <strong>Enable DNS forwarder</strong></td>
                 </tr>
                 <tr> 
-                  <td class="vtable"><p> 
+                  <td class="vtable">
                       <input name="regdhcp" type="checkbox" id="regdhcp" value="yes" <?php if ($pconfig['regdhcp']) echo "checked";?>>
                       <strong>Register DHCP leases in DNS forwarder<br>
                       </strong>If this option is set, then machines that specify 
                       their hostname when requesting a DHCP lease will be registered 
                       in the DNS forwarder, so that their name can be resolved. 
                       You should also set the domain in <a href="system.php">System: 
-                      General setup</a> to the proper value.</p>
+                      General setup</a> to the proper value.
                     </td>
                 </tr>
                 <tr> 
@@ -130,7 +120,6 @@ if ($_GET['act'] == "del") {
                       forwarders below.</p></td>
                 </tr>
               </table>
-              &nbsp;<br>
               <table width="100%" border="0" cellpadding="0" cellspacing="0">
                 <tr>
                   <td width="20%" class="listhdrr">Host</td>
@@ -164,5 +153,3 @@ if ($_GET['act'] == "del") {
               </table>
             </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 810a415e901f672ed317def4fe258a11a6bd1f8b..6701555eda03da4fd3a3bc864b044e3424439040 100644 (file)
@@ -4,7 +4,7 @@
        services_dnsmasq_edit.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Bob Zoller <bob@kludgebox.com> and Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Bob Zoller <bob@kludgebox.com> and Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Services", "DNS forwarder", "Edit host");
 require("guiconfig.inc");
 
 if (!is_array($config['dnsmasq']['hosts'])) {
@@ -101,17 +102,7 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Services: DNS forwarder: Edit host");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Services: DNS forwarder: Edit host</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
             <form action="services_dnsmasq_edit.php" method="post" name="iform" id="iform">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
@@ -126,14 +117,14 @@ if ($_POST) {
                                <tr>
                   <td width="22%" valign="top" class="vncellreq">Domain</td>
                   <td width="78%" class="vtable"> 
-                    <input name="domain" type="text" class="formfld" id="domain" size="40" value="<?=htmlspecialchars($pconfig['domain']);?>">
+                    <?=$mandfldhtml;?><input name="domain" type="text" class="formfld" id="domain" size="40" value="<?=htmlspecialchars($pconfig['domain']);?>">
                     <br> <span class="vexpl">Domain of the host<br>
                     e.g. <em>blah.com</em></span></td>
                 </tr>
                                <tr>
                   <td width="22%" valign="top" class="vncellreq">IP address</td>
                   <td width="78%" class="vtable"> 
-                    <input name="ip" type="text" class="formfld" id="ip" size="40" value="<?=htmlspecialchars($pconfig['ip']);?>">
+                    <?=$mandfldhtml;?><input name="ip" type="text" class="formfld" id="ip" size="40" value="<?=htmlspecialchars($pconfig['ip']);?>">
                     <br> <span class="vexpl">IP address of the host<br>
                     e.g. <em>192.168.100.100</em></span></td>
                 </tr>
@@ -156,5 +147,3 @@ if ($_POST) {
               </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 20cdefd9ee9fd3866d0b51be403639346b41755a..0ee1af7ee4ec5bcfceb8d1348a18c0d55326f6d8 100644 (file)
@@ -4,7 +4,7 @@
        services_dyndns.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Services", "Dynamic DNS");
 require("guiconfig.inc");
 
 if (!is_array($config['dnsupdate'])) {
@@ -50,9 +51,6 @@ if (!$pconfig['dnsupdate_ttl'])
        $pconfig['dnsupdate_ttl'] = 60;
 $pconfig['dnsupdate_keydata'] = $config['dnsupdate']['keydata'];
 $pconfig['dnsupdate_keyname'] = $config['dnsupdate']['keyname'];
-$pconfig['dnsupdate_keytype'] = $config['dnsupdate']['keytype'];
-if (!$pconfig['dnsupdate_keytype'])
-       $pconfig['dnsupdate_keytype'] = "zone";
 $pconfig['dnsupdate_usetcp'] = isset($config['dnsupdate']['usetcp']);
 
 if ($_POST) {
@@ -106,7 +104,6 @@ if ($_POST) {
                $config['dnsupdate']['host'] = $_POST['dnsupdate_host'];
                $config['dnsupdate']['ttl'] = $_POST['dnsupdate_ttl'];
                $config['dnsupdate']['keyname'] = $_POST['dnsupdate_keyname'];
-               $config['dnsupdate']['keytype'] = $_POST['dnsupdate_keytype'];
                $config['dnsupdate']['keydata'] = $_POST['dnsupdate_keydata'];
                $config['dnsupdate']['usetcp'] = $_POST['dnsupdate_usetcp'] ? true : false;
                        
@@ -125,12 +122,7 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Services: Dynamic DNS client");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
+<?php include("fbegin.inc"); ?>
 <script language="JavaScript">
 <!--
 function enable_change(enable_change) {
@@ -148,19 +140,11 @@ function enable_change(enable_change) {
        document.iform.dnsupdate_host.disabled = endis;
        document.iform.dnsupdate_ttl.disabled = endis;
        document.iform.dnsupdate_keyname.disabled = endis;
-       document.iform.dnsupdate_keytype[0].disabled = endis;
-       document.iform.dnsupdate_keytype[1].disabled = endis;
-       document.iform.dnsupdate_keytype[2].disabled = endis;
        document.iform.dnsupdate_keydata.disabled = endis;
        document.iform.dnsupdate_usetcp.disabled = endis;
 }
 //-->
 </script>
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">Services: Dynamic DNS client</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if ($savemsg) print_info_box($savemsg); ?>
             <form action="services_dyndns.php" method="post" name="iform" id="iform">
@@ -175,7 +159,7 @@ function enable_change(enable_change) {
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Service type</td>
                   <td width="78%" class="vtable">
-<select name="type" class="formfld" id="type">
+                                       <select name="type" class="formfld" id="type">
                       <?php $types = explode(",", "DynDNS,DHS,ODS,DyNS,HN.ORG,ZoneEdit,GNUDip,DynDNS (static),DynDNS (custom),easyDNS,EZ-IP,TZO");
                                                $vals = explode(" ", "dyndns dhs ods dyns hn zoneedit gnudip dyndns-static dyndns-custom easydns ezip tzo");
                                          $j = 0; for ($j = 0; $j < count($vals); $j++): ?>
@@ -188,7 +172,7 @@ function enable_change(enable_change) {
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Hostname</td>
                   <td width="78%" class="vtable"> 
-                    <input name="host" type="text" class="formfld" id="host" size="30" value="<?=htmlspecialchars($pconfig['host']);?>"> 
+                    <?=$mandfldhtml;?><input name="host" type="text" class="formfld" id="host" size="30" value="<?=htmlspecialchars($pconfig['host']);?>"> 
                   </td>
                                </tr>
                 <tr> 
@@ -208,13 +192,13 @@ function enable_change(enable_change) {
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Username</td>
                   <td width="78%" class="vtable"> 
-                    <input name="username" type="text" class="formfld" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>"> 
+                    <?=$mandfldhtml;?><input name="username" type="text" class="formfld" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>"> 
                   </td>
                 </tr>
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Password</td>
                   <td width="78%" class="vtable"> 
-                    <input name="password" type="password" class="formfld" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>"> 
+                    <?=$mandfldhtml;?><input name="password" type="password" class="formfld" id="password" size="20" value="<?=htmlspecialchars($pconfig['password']);?>"> 
                   </td>
                 </tr>
                 <tr> 
@@ -223,40 +207,34 @@ function enable_change(enable_change) {
                 <tr> 
                   <td colspan="2" valign="top" class="optsect_t">
                                  <table border="0" cellspacing="0" cellpadding="0" width="100%">
-                                 <tr><td class="optsect_s"><strong>RFC 2163 Dynamic DNS updates</strong></td>
-                                 <td align="right" class="optsect_s"><input name="dnsupdate_enable" type="checkbox" value="yes" <?php if ($pconfig['dnsupdate_enable']) echo "checked"; ?> onClick="enable_change(false)"> <strong>Enable</strong></td></tr>
+                                 <tr>
+                                   <td class="optsect_s"><strong>RFC 2136 Dynamic DNS updates</strong></td>
+                                   <td align="right" class="optsect_s"><input name="dnsupdate_enable" type="checkbox" value="yes" <?php if ($pconfig['dnsupdate_enable']) echo "checked"; ?> onClick="enable_change(false)"> <strong>Enable</strong></td></tr>
                                  </table></td>
                 </tr>
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Hostname</td>
                   <td width="78%" class="vtable"> 
-                    <input name="dnsupdate_host" type="text" class="formfld" id="dnsupdate_host" size="30" value="<?=htmlspecialchars($pconfig['dnsupdate_host']);?>"> 
+                    <?=$mandfldhtml;?><input name="dnsupdate_host" type="text" class="formfld" id="dnsupdate_host" size="30" value="<?=htmlspecialchars($pconfig['dnsupdate_host']);?>"> 
                   </td>
                                </tr>
                 <tr>
                   <td valign="top" class="vncellreq">TTL</td>
                   <td class="vtable">
-                    <input name="dnsupdate_ttl" type="text" class="formfld" id="dnsupdate_ttl" size="6" value="<?=htmlspecialchars($pconfig['dnsupdate_ttl']);?>"> 
+                    <?=$mandfldhtml;?><input name="dnsupdate_ttl" type="text" class="formfld" id="dnsupdate_ttl" size="6" value="<?=htmlspecialchars($pconfig['dnsupdate_ttl']);?>"> 
                   seconds</td>
                 </tr>
                 <tr>
                   <td valign="top" class="vncellreq">Key name</td>
                   <td class="vtable">
-                    <input name="dnsupdate_keyname" type="text" class="formfld" id="dnsupdate_keyname" size="30" value="<?=htmlspecialchars($pconfig['dnsupdate_keyname']);?>">
+                    <?=$mandfldhtml;?><input name="dnsupdate_keyname" type="text" class="formfld" id="dnsupdate_keyname" size="30" value="<?=htmlspecialchars($pconfig['dnsupdate_keyname']);?>">
                     <br> 
                     This must match the setting on the DNS server.</td>
                 </tr>
-                <tr>
-                  <td valign="top" class="vncellreq">Key type </td>
-                  <td class="vtable">
-                                 <input name="dnsupdate_keytype" type="radio" value="zone" <?php if ($pconfig['dnsupdate_keytype'] == "zone") echo "checked"; ?>> Zone &nbsp;
-                  <input name="dnsupdate_keytype" type="radio" value="host" <?php if ($pconfig['dnsupdate_keytype'] == "host") echo "checked"; ?>> Host &nbsp;
-                  <input name="dnsupdate_keytype" type="radio" value="user" <?php if ($pconfig['dnsupdate_keytype'] == "user") echo "checked"; ?>> User
-                               </tr>
                 <tr>
                   <td valign="top" class="vncellreq">Key</td>
                   <td class="vtable">
-                    <input name="dnsupdate_keydata" type="text" class="formfld" id="dnsupdate_keydata" size="70" value="<?=htmlspecialchars($pconfig['dnsupdate_keydata']);?>">
+                    <?=$mandfldhtml;?><input name="dnsupdate_keydata" type="text" class="formfld" id="dnsupdate_keydata" size="70" value="<?=htmlspecialchars($pconfig['dnsupdate_keydata']);?>">
                     <br> 
                     Paste an HMAC-MD5 key here.</td>
                 </tr>
@@ -287,5 +265,3 @@ enable_change(false);
 //-->
 </script>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index d9cf8d98c37bfd07e63f30ed4b6fd42e5aaea72f..cbafef203cf888b3e079b774a1f67cd88b85de6f 100644 (file)
@@ -4,7 +4,7 @@
        services_proxyarp.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Services", "Proxy ARP");
 require("guiconfig.inc");
 
 if (!is_array($config['proxyarp']['proxyarpnet'])) {
@@ -64,17 +65,7 @@ if ($_GET['act'] == "del") {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Services: Proxy ARP");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Services: Proxy ARP</p>
 <form action="services_proxyarp.php" method="post">
 <?php if ($savemsg) print_info_box($savemsg); ?>
 <?php if (file_exists($d_proxyarpdirty_path)): ?><p>
@@ -131,5 +122,3 @@ if ($_GET['act'] == "del") {
                                          replies on an interface for other IP addresses than its own (e.g. for 1:1, advanced outbound or server NAT). It is not
                                          necessary on the WAN interface if you have a subnet routed to you or if you use PPPoE/PPTP, and it only works on the WAN interface if it's configured with a static IP address or DHCP.</p>
             <?php include("fend.inc"); ?>
-</body>
-</html>
index 7cfba557a4177ca652d0d1c8d204ee4e875414ae..09ceaeecd5aa671817b00763bf7ac06f63ae4873 100644 (file)
@@ -4,7 +4,7 @@
        services_proxyarp_edit.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Services", "Proxy ARP", "Edit");
 require("guiconfig.inc");
 
 if (!is_array($config['proxyarp']['proxyarpnet'])) {
@@ -131,12 +132,7 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Services: Proxy ARP: Edit");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
+<?php include("fbegin.inc"); ?>
 <script language="JavaScript">
 <!--
 function typesel_change() {
@@ -163,11 +159,6 @@ function typesel_change() {
 }
 //-->
 </script>
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">Services: Proxy ARP: Edit</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
             <form action="services_proxyarp_edit.php" method="post" name="iform" id="iform">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
@@ -192,6 +183,7 @@ function typesel_change() {
                     <table border="0" cellspacing="0" cellpadding="0">
                       <tr> 
                         <td>Type:&nbsp;&nbsp;</td>
+                                               <td></td>
                         <td><select name="type" class="formfld" onChange="typesel_change()">
                             <option value="single" <?php if (!$pconfig['range_from'] && $pconfig['subnet_bits'] == 32) echo "selected"; ?>> 
                             Single address</option>
@@ -203,6 +195,7 @@ function typesel_change() {
                       </tr>
                       <tr> 
                         <td>Address:&nbsp;&nbsp;</td>
+                                               <td><?=$mandfldhtmlspc;?></td>
                         <td><input name="subnet" type="text" class="formfld" id="subnet" size="20" value="<?=htmlspecialchars($pconfig['subnet']);?>">
                   / 
                           <select name="subnet_bits" class="formfld" id="select">
@@ -216,6 +209,7 @@ function typesel_change() {
                       </tr>
                       <tr> 
                         <td>Range:&nbsp;&nbsp;</td>
+                                               <td><?=$mandfldhtmlspc;?></td>
                         <td><input name="range_from" type="text" class="formfld" id="range_from" size="20" value="<?=htmlspecialchars($pconfig['range_from']);?>">
 - 
                           <input name="range_to" type="text" class="formfld" id="range_to" size="20" value="<?=htmlspecialchars($pconfig['range_to']);?>">                          
@@ -248,5 +242,3 @@ typesel_change();
 //-->
 </script>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 125187b0bcfb43f8d9a1cfab9d89918120081ceb..28e294ffb4d2fb444e85f413167583fdb1af1997 100644 (file)
@@ -4,7 +4,7 @@
        services_snmp.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Services", "SNMP");
 require("guiconfig.inc");
 
 if (!is_array($config['snmpd'])) {
@@ -72,12 +73,7 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Services: SNMP");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
+<?php include("fbegin.inc"); ?>
 <script language="JavaScript">
 <!--
 function enable_change(enable_change) {
@@ -89,11 +85,6 @@ function enable_change(enable_change) {
 }
 //-->
 </script>
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">Services: SNMP</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if ($savemsg) print_info_box($savemsg); ?>
             <form action="services_snmp.php" method="post" name="iform" id="iform">
@@ -119,7 +110,7 @@ function enable_change(enable_change) {
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Community</td>
                   <td width="78%" class="vtable"> 
-                    <input name="rocommunity" type="text" class="formfld" id="rocommunity" size="40" value="<?=htmlspecialchars($pconfig['rocommunity']);?>"> 
+                    <?=$mandfldhtml;?><input name="rocommunity" type="text" class="formfld" id="rocommunity" size="40" value="<?=htmlspecialchars($pconfig['rocommunity']);?>"> 
                     <br>
                     In most cases, &quot;public&quot; is used here</td>
                 </tr>
@@ -137,5 +128,3 @@ enable_change(false);
 //-->
 </script>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 1ee59469fb2bd78f5d0d313dc109dea75a39267a..6bd5bd9f0e20f6dd1a5af5fc048c6d465360e40d 100644 (file)
@@ -4,7 +4,7 @@
        services_wol.php
        part of m0n0wall (http://m0n0.ch/wall)
 
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
 
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Services", "Wake on LAN");
 require("guiconfig.inc");
 
 if (!is_array($config['wol']['wolentry'])) {
@@ -47,6 +48,8 @@ if ($_POST || $_GET['mac']) {
                $mac = $_POST['mac_input'];
                $if = $_POST['interface'];
        }
+       
+       $mac = str_replace("-", ":", $mac);
 
        /* input validation */
        if (!$mac || !is_macaddr($mac))
@@ -73,17 +76,7 @@ if ($_GET['act'] == "del") {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Services: Wake on LAN");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Services: Wake on LAN</font></p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if ($savemsg) print_info_box($savemsg); ?>
                        <form action="services_wol.php" method="post" name="iform" id="iform">
@@ -91,7 +84,7 @@ if ($_GET['act'] == "del") {
                          <tr> 
                   <td width="22%" valign="top" class="vncellreq">Interface</td>
                   <td width="78%" class="vtable">
-<select name="interface" class="formfld">
+                                       <select name="interface" class="formfld">
                       <?php $interfaces = array('lan' => 'LAN');
                                          for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
                                            if (isset($config['interfaces']['opt' . $i]['enable']) &&
@@ -109,7 +102,7 @@ if ($_GET['act'] == "del") {
                 <tr>
                                  <td width="22%" valign="top" class="vncellreq">MAC address</td>
                                  <td width="78%" class="vtable">
-                      <input name="mac_input" type="text" class="formfld" id="mac_input" size="20" value="<?=htmlspecialchars($mac);?>">
+                      <?=$mandfldhtml;?><input name="mac_input" type="text" class="formfld" id="mac_input" size="20" value="<?=htmlspecialchars($mac);?>">
                       <br>
                       Enter a MAC address <span class="vexpl"> in the following format: xx:xx:xx:xx:xx:xx</span></td></tr>
                                <tr>
@@ -158,5 +151,3 @@ Click the MAC address to wake up a computer. <br>
               </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 1d483f7843231c380b5e4d12129886135781cb45..3e25b04be7c6854daf39099ba3a6041602d8ce0b 100644 (file)
@@ -4,7 +4,7 @@
        services_wol_edit.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Services", "Wake on LAN", "Edit");
 require("guiconfig.inc");
 
 if (!is_array($config['wol']['wolentry'])) {
@@ -58,6 +59,8 @@ if ($_POST) {
        
        do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
        
+       $_POST['mac'] = str_replace("-", ":", $_POST['mac']);
+       
        if (($_POST['mac'] && !is_macaddr($_POST['mac']))) {
                $input_errors[] = "A valid MAC address must be specified.";
        }
@@ -80,24 +83,14 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Services: Wake on LAN: Edit entry");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Services: Wake on LAN: Edit entry</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
             <form action="services_wol_edit.php" method="post" name="iform" id="iform">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
                          <tr> 
                   <td width="22%" valign="top" class="vncellreq">Interface</td>
                   <td width="78%" class="vtable">
-<select name="interface" class="formfld">
+                                       <select name="interface" class="formfld">
                       <?php $interfaces = array('lan' => 'LAN');
                                          for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
                                            if (isset($config['interfaces']['opt' . $i]['enable']) &&
@@ -115,7 +108,7 @@ if ($_POST) {
                                <tr>
                   <td width="22%" valign="top" class="vncellreq">MAC address</td>
                   <td width="78%" class="vtable"> 
-                    <input name="mac" type="text" class="formfld" id="mac" size="20" value="<?=htmlspecialchars($pconfig['mac']);?>">
+                    <?=$mandfldhtml;?><input name="mac" type="text" class="formfld" id="mac" size="20" value="<?=htmlspecialchars($pconfig['mac']);?>">
                     <br> 
                     <span class="vexpl">Enter a MAC address  in the following format: 
                     xx:xx:xx:xx:xx:xx<em></em></span></td>
@@ -139,5 +132,3 @@ if ($_POST) {
               </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/webgui/stats.cgi b/webgui/stats.cgi
new file mode 100644 (file)
index 0000000..745b7d2
Binary files /dev/null and b/webgui/stats.cgi differ
index 80f2eff03dd590e9926b2c50f6481994084e1d92..18b5ba4d2bcb547c225126fb09a1a44ae658797e 100644 (file)
@@ -4,7 +4,7 @@
        status_captiveportal.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Status", "Captive portal");
 require("guiconfig.inc");
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Status: Captive portal");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Status: Captive portal</p>
 <?php
 
 if ($_GET['act'] == "del") {
@@ -124,5 +115,3 @@ captiveportal_unlock();
 </form>
 </p>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 15330fd323ed46914e6f7828f440e8baaace630b..dfd928db35d6c76e64e5912ab1c167fd94f6676d 100644 (file)
@@ -4,7 +4,7 @@
        status_graph.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Status", "Traffic graph");
 require("guiconfig.inc");
 
 $curif = "wan";
@@ -40,17 +41,7 @@ if ($curif == "wan")
 else
        $ifnum = $config['interfaces'][$curif]['if'];
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Status: Traffic graph");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Status: Traffic graph</p>
 <?php
 $ifdescrs = array('wan' => 'WAN', 'lan' => 'LAN');
        
@@ -74,7 +65,5 @@ foreach ($ifdescrs as $ifn => $ifd) {
 <embed src="graph.php?ifnum=<?=$ifnum;?>&ifname=<?=rawurlencode($ifdescrs[$curif]);?>" type="image/svg+xml"
                width="550" height="275" pluginspage="http://www.adobe.com/svg/viewer/install/auto" />
 </div>
-<p><span class="red"><strong>Note:</strong></span> the <a href="http://www.adobe.com/svg/viewer/install/" target="_blank">Adobe SVG viewer</a> is required to view the graph.
+<br><span class="red"><strong>Note:</strong></span> the <a href="http://www.adobe.com/svg/viewer/install/" target="_blank">Adobe SVG viewer</a> is required to view the graph.
 <?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/webgui/status_graph_cpu.php b/webgui/status_graph_cpu.php
new file mode 100644 (file)
index 0000000..b44d8a0
--- /dev/null
@@ -0,0 +1,41 @@
+#!/usr/local/bin/php
+<?php 
+/*
+       status_graph_cpu.php
+       part of m0n0wall (http://m0n0.ch/wall)
+       
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
+       All rights reserved.
+       
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions are met:
+       
+       1. Redistributions of source code must retain the above copyright notice,
+          this list of conditions and the following disclaimer.
+       
+       2. Redistributions in binary form must reproduce the above copyright
+          notice, this list of conditions and the following disclaimer in the
+          documentation and/or other materials provided with the distribution.
+       
+       THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+       INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+       AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+       AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+       OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+       INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+       CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+       ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+       POSSIBILITY OF SUCH DAMAGE.
+*/
+
+$pgtitle = array("Status", "CPU load");
+require("guiconfig.inc");
+?>
+<?php include("fbegin.inc"); ?>
+<div align="center">
+<embed src="graph_cpu.php" type="image/svg+xml"
+               width="550" height="275" pluginspage="http://www.adobe.com/svg/viewer/install/auto" />
+</div>
+<br><span class="red"><strong>Note:</strong></span> the <a href="http://www.adobe.com/svg/viewer/install/" target="_blank">Adobe SVG viewer</a> is required to view the graph.
+<?php include("fend.inc"); ?>
index 806ea262b59c60d1e1ae5e12f563f3c06d857d2a..7c8ffc9f3f3402ea6df044437b0008ba58405579 100644 (file)
@@ -4,7 +4,7 @@
        status_interfaces.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Status", "Interfaces");
 require("guiconfig.inc");
 
 $wancfg = &$config['interfaces']['wan'];
@@ -166,8 +167,11 @@ function get_interface_info($ifdescr) {
                        if (preg_match("/channel (\S*)/", $ici, $matches)) {
                                $ifinfo['channel'] = $matches[1];
                        }
-                       if (preg_match("/ssid (\S*)/", $ici, $matches)) {
-                               $ifinfo['ssid'] = $matches[1];
+                       if (preg_match("/ssid (\".*?\"|\S*)/", $ici, $matches)) {
+                               if ($matches[1][0] == '"')
+                                       $ifinfo['ssid'] = substr($matches[1], 1, -1);
+                               else
+                                       $ifinfo['ssid'] = $matches[1];
                        }
                }
                
@@ -204,17 +208,7 @@ function get_interface_info($ifdescr) {
 }
 
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Status: Interfaces");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">Status: Interfaces</p>
 <form action="" method="post">
             <table width="100%" border="0" cellspacing="0" cellpadding="0">
               <?php $i = 0; $ifdescrs = array('wan' => 'WAN', 'lan' => 'LAN');
@@ -237,13 +231,13 @@ function get_interface_info($ifdescr) {
                   interface</td>
               </tr>
               <tr> 
-                <td width="22%" class="listhdrr">Status</td>
+                <td width="22%" class="vncellt">Status</td>
                 <td width="78%" class="listr"> 
                   <?=htmlspecialchars($ifinfo['status']);?>
                 </td>
               </tr><?php if ($ifinfo['dhcplink']): ?>
                          <tr> 
-                               <td width="22%" class="listhdrr">DHCP</td>
+                               <td width="22%" class="vncellt">DHCP</td>
                                <td width="78%" class="listr"> 
                                  <?=htmlspecialchars($ifinfo['dhcplink']);?>&nbsp;&nbsp;
                                  <?php if ($ifinfo['dhcplink'] == "up"): ?>
@@ -254,7 +248,7 @@ function get_interface_info($ifdescr) {
                                </td>
                          </tr><?php endif; if ($ifinfo['pppoelink']): ?>
               <tr> 
-                <td width="22%" class="listhdrr">PPPoE</td>
+                <td width="22%" class="vncellt">PPPoE</td>
                 <td width="78%" class="listr"> 
                   <?=htmlspecialchars($ifinfo['pppoelink']);?>&nbsp;&nbsp;
                                  <?php if ($ifinfo['pppoelink'] == "up"): ?>
@@ -265,7 +259,7 @@ function get_interface_info($ifdescr) {
                 </td>
               </tr><?php  endif; if ($ifinfo['pptplink']): ?>
               <tr> 
-                <td width="22%" class="listhdrr">PPTP</td>
+                <td width="22%" class="vncellt">PPTP</td>
                 <td width="78%" class="listr"> 
                   <?=htmlspecialchars($ifinfo['pptplink']);?>&nbsp;&nbsp;
                                  <?php if ($ifinfo['pptplink'] == "up"): ?>
@@ -276,7 +270,7 @@ function get_interface_info($ifdescr) {
                 </td>
               </tr><?php  endif; if ($ifinfo['macaddr']): ?>
               <tr> 
-                <td width="22%" class="listhdrr">MAC address</td>
+                <td width="22%" class="vncellt">MAC address</td>
                 <td width="78%" class="listr"> 
                   <?=htmlspecialchars($ifinfo['macaddr']);?>
                 </td>
@@ -284,59 +278,59 @@ function get_interface_info($ifdescr) {
                          <?php if ($ifinfo['dhcplink'] != "down" && $ifinfo['pppoelink'] != "down" && $ifinfo['pptplink'] != "down"): ?>
                          <?php if ($ifinfo['ipaddr']): ?>
               <tr> 
-                <td width="22%" class="listhdrr">IP address</td>
+                <td width="22%" class="vncellt">IP address</td>
                 <td width="78%" class="listr"> 
                   <?=htmlspecialchars($ifinfo['ipaddr']);?>
                   &nbsp; </td>
               </tr><?php endif; ?><?php if ($ifinfo['subnet']): ?>
               <tr> 
-                <td width="22%" class="listhdrr">Subnet mask</td>
+                <td width="22%" class="vncellt">Subnet mask</td>
                 <td width="78%" class="listr"> 
                   <?=htmlspecialchars($ifinfo['subnet']);?>
                 </td>
               </tr><?php endif; ?><?php if ($ifinfo['gateway']): ?>
               <tr> 
-                <td width="22%" class="listhdrr">Gateway</td>
+                <td width="22%" class="vncellt">Gateway</td>
                 <td width="78%" class="listr"> 
                   <?=htmlspecialchars($ifinfo['gateway']);?>
                 </td>
               </tr><?php endif; if ($ifdescr == "wan" && file_exists("{$g['varetc_path']}/nameservers.conf")): ?>
-                <td width="22%" class="listhdrr">ISP DNS servers</td>
+                <td width="22%" class="vncellt">ISP DNS servers</td>
                 <td width="78%" class="listr"><?php echo nl2br(file_get_contents("{$g['varetc_path']}/nameservers.conf")); ?></td>
                          <?php endif; endif; if ($ifinfo['media']): ?>
               <tr> 
-                <td width="22%" class="listhdrr">Media</td>
+                <td width="22%" class="vncellt">Media</td>
                 <td width="78%" class="listr"> 
                   <?=htmlspecialchars($ifinfo['media']);?>
                 </td>
               </tr><?php endif; ?><?php if ($ifinfo['channel']): ?>
               <tr> 
-                <td width="22%" class="listhdrr">Channel</td>
+                <td width="22%" class="vncellt">Channel</td>
                 <td width="78%" class="listr"> 
                   <?=htmlspecialchars($ifinfo['channel']);?>
                 </td>
               </tr><?php endif; ?><?php if ($ifinfo['ssid']): ?>
               <tr> 
-                <td width="22%" class="listhdrr">SSID</td>
+                <td width="22%" class="vncellt">SSID</td>
                 <td width="78%" class="listr"> 
                   <?=htmlspecialchars($ifinfo['ssid']);?>
                 </td>
               </tr><?php endif; ?>
               <tr> 
-                <td width="22%" class="listhdrr">In/out packets</td>
+                <td width="22%" class="vncellt">In/out packets</td>
                 <td width="78%" class="listr"> 
                   <?=htmlspecialchars($ifinfo['inpkts'] . "/" . $ifinfo['outpkts'] . " (" . 
                                                format_bytes($ifinfo['inbytes']) . "/" . format_bytes($ifinfo['outbytes']) . ")");?>
                 </td>
               </tr><?php if (isset($ifinfo['inerrs'])): ?>
               <tr> 
-                <td width="22%" class="listhdrr">In/out errors</td>
+                <td width="22%" class="vncellt">In/out errors</td>
                 <td width="78%" class="listr"> 
                   <?=htmlspecialchars($ifinfo['inerrs'] . "/" . $ifinfo['outerrs']);?>
                 </td>
               </tr><?php endif; ?><?php if (isset($ifinfo['collisions'])): ?>
               <tr> 
-                <td width="22%" class="listhdrr">Collisions</td>
+                <td width="22%" class="vncellt">Collisions</td>
                 <td width="78%" class="listr"> 
                   <?=htmlspecialchars($ifinfo['collisions']);?>
                 </td>
@@ -345,11 +339,10 @@ function get_interface_info($ifdescr) {
               <?php $i++; endforeach; ?>
             </table>
 </form>
-<p><strong class="red">Note:<br>
+<br>
+<strong class="red">Note:<br>
 </strong>Using dial-on-demand will bring the connection up again if any packet
 triggers it. To substantiate this point: disconnecting manually 
 will <strong>not</strong> prevent dial-on-demand from making connections
 to the outside! Don't use dial-on-demand if you want to make sure that the line is kept disconnected.
 <?php include("fend.inc"); ?>
-</body>
-</html>
index c87c8d6cfe176fafb5d68ef896a3dba901c60fda..f8771bb7a9b603519722ceeec7349f674f5fd354 100644 (file)
@@ -4,7 +4,7 @@
        status_wireless.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("Status", "Wireless");
 require("guiconfig.inc");
 
 function get_wireless_info($ifdescr) {
@@ -78,35 +79,25 @@ function get_wireless_info($ifdescr) {
 }
 
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("Status: Wireless");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-      <p class="pgtitle">Status: Wireless</p>
-              <?php $i = 0; $ifdescrs = array();
-                         
-                                       if (is_array($config['interfaces']['wan']['wireless']) &&
-                                                       strstr($config['interfaces']['wan']['if'], "wi"))
-                                                       $ifdescrs['wan'] = 'WAN';
-                                                       
-                                       if (is_array($config['interfaces']['lan']['wireless']) &&
-                                                       strstr($config['interfaces']['lan']['if'], "wi"))
-                                                       $ifdescrs['lan'] = 'LAN';
-                                       
-                                       for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) {
-                                               if (is_array($config['interfaces']['opt' . $j]['wireless']) &&
-                                                       isset($config['interfaces']['opt' . $j]['enable']) &&
-                                                       strstr($config['interfaces']['opt' . $j]['if'], "wi"))
-                                                       $ifdescrs['opt' . $j] = $config['interfaces']['opt' . $j]['descr'];
-                                       }
-                                               
-                                       if (count($ifdescrs) > 0): ?>
+<?php $i = 0; $ifdescrs = array();
+
+       if (is_array($config['interfaces']['wan']['wireless']) &&
+                       (strstr($config['interfaces']['wan']['if'], "wi") || strstr($config['interfaces']['wan']['if'], "ath")))
+                       $ifdescrs['wan'] = 'WAN';
+                       
+       if (is_array($config['interfaces']['lan']['wireless']) &&
+                       (strstr($config['interfaces']['lan']['if'], "wi") || strstr($config['interfaces']['lan']['if'], "ath")))
+                       $ifdescrs['lan'] = 'LAN';
+       
+       for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) {
+               if (is_array($config['interfaces']['opt' . $j]['wireless']) &&
+                       isset($config['interfaces']['opt' . $j]['enable']) &&
+                       (strstr($config['interfaces']['opt' . $j]['if'], "wi") || strstr($config['interfaces']['opt' . $j]['if'], "ath")))
+                       $ifdescrs['opt' . $j] = $config['interfaces']['opt' . $j]['descr'];
+       }
+               
+       if (count($ifdescrs) > 0): ?>
             <table width="100%" border="0" cellspacing="0" cellpadding="0">
               <?php
                              foreach ($ifdescrs as $ifdescr => $ifname): 
@@ -122,7 +113,7 @@ function get_wireless_info($ifdescr) {
                   <?=htmlspecialchars($ifname);?> interface (SSID &quot;<?=htmlspecialchars($config['interfaces'][$ifdescr]['wireless']['ssid']);?>&quot;)</td>
               </tr>
               <tr> 
-                <td width="22%" valign="top" class="listhdrr">Signal strength 
+                <td width="22%" valign="top" class="vncellt">Signal strength 
                   cache</td>
                 <td width="78%" class="listrpad"> 
                   <table width="100%" border="0" cellpadding="0" cellspacing="0">
@@ -155,7 +146,7 @@ function get_wireless_info($ifdescr) {
                   </table></td>
               </tr><?php if ($ifinfo['aslist']): ?>
               <tr> 
-                <td width="22%" valign="top" class="listhdrr">Associated stations 
+                <td width="22%" valign="top" class="vncellt">Associated stations 
                 </td>
                 <td width="78%" class="listrpad"> 
                   <table width="100%" border="0" cellpadding="0" cellspacing="0">
@@ -182,8 +173,6 @@ function get_wireless_info($ifdescr) {
               <?php $i++; endforeach; ?>
             </table>
 <?php else: ?>
-<p><strong>No supported wireless interfaces were found for status display.</strong></p>
+<strong>No supported wireless interfaces were found for status display (only cards that use the wi[n] driver are supported).</strong>
 <?php endif; ?>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index bafb83db3c5650a1e781426cd1bab2a06c692993..a75ebf22ec54ddfb1f083662a8517c1b6fd8fc1b 100644 (file)
@@ -4,7 +4,7 @@
        system.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("System", "General setup");
 require("guiconfig.inc");
 
 $pconfig['hostname'] = $config['system']['hostname'];
@@ -154,36 +155,26 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("System: General setup");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-      <p class="pgtitle">System: General setup</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if ($savemsg) print_info_box($savemsg); ?>
-<form action="system.php" method="post">
+               <form action="system.php" method="post">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Hostname</td>
-                  <td width="78%" class="vtable"> <input name="hostname" type="text" class="formfld" id="hostname" size="40" value="<?=htmlspecialchars($pconfig['hostname']);?>"> 
+                  <td width="78%" class="vtable"><?=$mandfldhtml;?><input name="hostname" type="text" class="formfld" id="hostname" size="40" value="<?=htmlspecialchars($pconfig['hostname']);?>"> 
                     <br> <span class="vexpl">name of the firewall host, without 
                     domain part<br>
                     e.g. <em>firewall</em></span></td>
                 </tr>
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Domain</td>
-                  <td width="78%" class="vtable"> <input name="domain" type="text" class="formfld" id="domain" size="40" value="<?=htmlspecialchars($pconfig['domain']);?>"> 
+                  <td width="78%" class="vtable"><?=$mandfldhtml;?><input name="domain" type="text" class="formfld" id="domain" size="40" value="<?=htmlspecialchars($pconfig['domain']);?>"> 
                     <br> <span class="vexpl">e.g. <em>mycorp.com</em> </span></td>
                 </tr>
                 <tr> 
                   <td width="22%" valign="top" class="vncell">DNS servers</td>
-                  <td width="78%" class="vtable"> <p> 
+                  <td width="78%" class="vtable">
                       <input name="dns1" type="text" class="formfld" id="dns1" size="20" value="<?=htmlspecialchars($pconfig['dns1']);?>">
                       <br>
                       <input name="dns2" type="text" class="formfld" id="dns22" size="20" value="<?=htmlspecialchars($pconfig['dns2']);?>">
@@ -197,7 +188,7 @@ if ($_POST) {
                       If this option is set, m0n0wall will use DNS servers assigned 
                       by a DHCP/PPP server on WAN for its own purposes (including 
                       the DNS forwarder). They will not be assigned to DHCP and 
-                      PPTP VPN clients, though.</span></p></td>
+                      PPTP VPN clients, though.</span></td>
                 </tr>
                 <tr> 
                   <td valign="top" class="vncell">Username</td>
@@ -261,5 +252,3 @@ if ($_POST) {
               </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index dbc665a4f06f26573df5cea21940577167092db7..037a7dd0decfcfdee886dfaf539155056b588dfb 100644 (file)
@@ -4,7 +4,7 @@
        system_advanced.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("System", "Advanced setup");
 require("guiconfig.inc");
 
 $pconfig['filteringbridge_enable'] = isset($config['bridge']['filteringbridge']);
@@ -41,8 +42,10 @@ $pconfig['disablefirmwarecheck'] = isset($config['system']['disablefirmwarecheck
 $pconfig['expanddiags'] = isset($config['system']['webgui']['expanddiags']);
 if ($g['platform'] == "generic-pc")
        $pconfig['harddiskstandby'] = $config['system']['harddiskstandby'];
+$pconfig['bypassstaticroutes'] = isset($config['filter']['bypassstaticroutes']);
 $pconfig['noantilockout'] = isset($config['system']['webgui']['noantilockout']);
 $pconfig['tcpidletimeout'] = $config['filter']['tcpidletimeout'];
+$pconfig['preferoldsa_enable'] = isset($config['ipsec']['preferoldsa']);
 
 if ($_POST) {
 
@@ -81,7 +84,10 @@ if ($_POST) {
                        $config['system']['harddiskstandby'] = $_POST['harddiskstandby'];
                }
                $config['system']['webgui']['noantilockout'] = $_POST['noantilockout'] ? true : false;
+               $config['filter']['bypassstaticroutes'] = $_POST['bypassstaticroutes'] ? true : false;
                $config['filter']['tcpidletimeout'] = $_POST['tcpidletimeout'];
+               $oldpreferoldsa = $config['ipsec']['preferoldsa'];
+               $config['ipsec']['preferoldsa'] = $_POST['preferoldsa_enable'] ? true : false;
                        
                write_config();
                
@@ -104,18 +110,15 @@ if ($_POST) {
                        config_lock();
                        $retval = filter_configure();
                        $retval |= interfaces_optional_configure();
+                       if ($config['ipsec']['preferoldsa'] != $oldpreferoldsa)
+                               $retval |= vpn_ipsec_configure();
                        config_unlock();
                }
                $savemsg = get_std_save_message($retval);
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("System: Advanced functions");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
+<?php include("fbegin.inc"); ?>
 <script language="JavaScript">
 <!--
 function enable_change(enable_over) {
@@ -127,11 +130,6 @@ function enable_change(enable_over) {
 }
 // -->
 </script>
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-      <p class="pgtitle">System: Advanced functions</p>
             <?php if ($input_errors) print_input_errors($input_errors); ?>
             <?php if ($savemsg) print_info_box($savemsg); ?>
             <p><span class="vexpl"><span class="red"><strong>Note: </strong></span>the 
@@ -238,17 +236,10 @@ function enable_change(enable_over) {
                   <td width="22%" valign="top" class="vncell">Hard disk standby time </td>
                   <td width="78%" class="vtable"> 
                     <select name="harddiskstandby" class="formfld">
-                                       <?php
-                        /* Values from ATA-2
-                           http://www.t13.org/project/d0948r3-ATA-2.pdf
-                           Page 66 */
-                                               $sbvals = explode(" ", "0.5,6 1,12 2,24 3,36 4,48 5,60 7.5,90 10,120 15,180 20,240 30,241 60,242");
-                                       ?>
+                                       <?php $sbvals = array(1,2,3,4,5,10,15,20,30,60); ?>
                       <option value="" <?php if(!$pconfig['harddiskstandby']) echo('selected');?>>Always on</option>
-                                       <?php
-                                       foreach ($sbvals as $sbval):
-                                               list($min,$val) = explode(",", $sbval); ?>
-                      <option value="<?=$val;?>" <?php if($pconfig['harddiskstandby'] == $val) echo('selected');?>><?=$min;?> minutes</option>
+                                       <?php foreach ($sbvals as $sbval): ?>
+                      <option value="<?=$sbval;?>" <?php if($pconfig['harddiskstandby'] == $sbval) echo 'selected';?>><?=$sbval;?> minutes</option>
                                        <?php endforeach; ?>
                     </select>
                     <br>
@@ -261,6 +252,13 @@ function enable_change(enable_over) {
                   <td width="78%" class="vtable"> 
                     <input name="expanddiags" type="checkbox" id="expanddiags" value="yes" <?php if ($pconfig['expanddiags']) echo "checked"; ?>>
                     <strong>Keep diagnostics in navigation expanded </strong></td>
+                </tr>
+                               <tr> 
+                  <td width="22%" valign="top" class="vncell">Static route filtering</td>
+                  <td width="78%" class="vtable"> 
+                    <input name="bypassstaticroutes" type="checkbox" id="bypassstaticroutes" value="yes" <?php if ($pconfig['bypassstaticroutes']) echo "checked"; ?>>
+                    <strong>Bypass firewall rules for traffic on the same interface</strong><br>
+                                       This option only applies if you have defined one or more static routes. If it is enabled, traffic that enters and leaves through the same interface will not be checked by the firewall. This may be desirable in some situations where multiple subnets are connected to the same interface. </td>
                 </tr>
                                <tr> 
                   <td width="22%" valign="top" class="vncell">webGUI anti-lockout</td>
@@ -270,6 +268,15 @@ function enable_change(enable_over) {
                                        By default, access to the webGUI on the LAN interface is always permitted, regardless of the user-defined filter rule set. Enable this feature to control webGUI access (make sure to have a filter rule in place that allows you in, or you will lock yourself out!).<br>
                                        Hint: 
                                        the &quot;set LAN IP address&quot; option in the console menu  resets this setting as well.</td>
+                </tr>
+                               <tr> 
+                  <td width="22%" valign="top" class="vncell">IPsec SA preferral</td>
+                  <td width="78%" class="vtable"> 
+                    <input name="preferoldsa_enable" type="checkbox" id="preferoldsa_enable" value="yes" <?php if ($pconfig['preferoldsa_enable']) echo "checked"; ?>>
+                    <strong>Prefer old IPsec SAs</strong><br>
+                                       By default, if several SAs match, the newest one is preferred if it's at least 30 seconds old.
+                                       Select this option to always prefer old SAs over new ones.
+                                       </td>
                 </tr>
                 <tr> 
                   <td width="22%" valign="top">&nbsp;</td>
@@ -285,5 +292,3 @@ enable_change(false);
 //-->
 </script>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index e008813f3f631c6ffab7a43218bfae47e4512416..dc7edf4d3f4a842f0682c6d717648574db5bebb1 100644 (file)
@@ -4,7 +4,7 @@
        system_firmware.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        POSSIBILITY OF SUCH DAMAGE.
 */
 
-$d_isfwfile = 1; require("guiconfig.inc"); 
+$d_isfwfile = 1;
+$pgtitle = array("System", "Firmware");
+require("guiconfig.inc"); 
 
 /* checks with m0n0.ch to see if a newer firmware version is available;
    returns any HTML message it gets from the server */
 function check_firmware_version() {
        global $g;
-       $post = "platform=" . rawurlencode($g['platform']) . 
+       $post = "platform=" . rawurlencode($g['fullplatform']) . 
                "&version=" . rawurlencode(trim(file_get_contents("/etc/version")));
                
        $rfd = @fsockopen("m0n0.ch", 80, $errno, $errstr, 3);
@@ -94,8 +96,8 @@ if ($_POST && !file_exists($d_firmwarelock_path)) {
                } else if ($mode == "upgrade") {
                        if (is_uploaded_file($_FILES['ulfile']['tmp_name'])) {
                                /* verify firmware image(s) */
-                               if (!stristr($_FILES['ulfile']['name'], $g['platform']) && !$_POST['sig_override'])
-                                       $input_errors[] = "The uploaded image file is not for this platfom ({$g['platform']}).";
+                               if (!stristr($_FILES['ulfile']['name'], $g['fullplatform']) && !$_POST['sig_override'])
+                                       $input_errors[] = "The uploaded image file is not for this platform ({$g['fullplatform']}).";
                                else if (!file_exists($_FILES['ulfile']['tmp_name'])) {
                                        /* probably out of memory for the MFS */
                                        $input_errors[] = "Image upload failed (out of memory?)";
@@ -137,17 +139,7 @@ if ($_POST && !file_exists($d_firmwarelock_path)) {
                $fwinfo = check_firmware_version();
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("System: Firmware");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">System: Firmware</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if ($savemsg) print_info_box($savemsg); ?>
 <?php if ($fwinfo) echo $fwinfo; ?>
@@ -169,7 +161,7 @@ print_info_box($sig_warning);
 <?php else: ?>
             <?php if (!file_exists($d_firmwarelock_path)): ?>
             <p>Click &quot;Enable firmware 
-              upload&quot; below, then choose the image file (<?=$g['platform'];?>-*.img)
+              upload&quot; below, then choose the image file (<?=$g['fullplatform'];?>-*.img)
                          to be uploaded.<br>Click &quot;Upgrade firmware&quot; 
               to start the upgrade process.</p>
             <form action="system_firmware.php" method="post" enctype="multipart/form-data">
@@ -202,5 +194,3 @@ print_info_box($sig_warning);
 </form>
 <?php endif; endif; ?>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index c4abdff4351139c72cf181a33b44fef2b4203acd..d60a1110cadb7c2ccd4e3101d8299f1809c528f9 100644 (file)
@@ -4,7 +4,7 @@
        system_routes.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("System", "Static routes");
 require("guiconfig.inc");
 
 if (!is_array($config['staticroutes']['route']))
@@ -68,17 +69,7 @@ if ($_GET['act'] == "del") {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("System: Static routes");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">System: Static routes</p>
 <form action="system_routes.php" method="post">
 <?php if ($savemsg) print_info_box($savemsg); ?>
 <?php if (file_exists($d_staticroutesdirty_path)): ?><p>
@@ -122,5 +113,3 @@ if ($_GET['act'] == "del") {
               </table>
             </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 826a5f15ac44f378fd4c7eef2b2413191c5ceffb..76519e384af755a8af786f34c064152d5e475ae7 100644 (file)
@@ -4,7 +4,7 @@
        system_routes_edit.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("System", "Static routes", "Edit");
 require("guiconfig.inc");
 
 if (!is_array($config['staticroutes']['route']))
@@ -103,24 +104,14 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("System: Static routes: Edit route");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">System: Static routes: Edit route</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
             <form action="system_routes_edit.php" method="post" name="iform" id="iform">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Interface</td>
                   <td width="78%" class="vtable">
-<select name="interface" class="formfld">
+                                       <select name="interface" class="formfld">
                       <?php $interfaces = array('lan' => 'LAN', 'wan' => 'WAN', 'pptp' => 'PPTP');
                                          for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
                                                $interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
@@ -136,7 +127,7 @@ if ($_POST) {
                 <tr>
                   <td width="22%" valign="top" class="vncellreq">Destination network</td>
                   <td width="78%" class="vtable"> 
-                    <input name="network" type="text" class="formfld" id="network" size="20" value="<?=htmlspecialchars($pconfig['network']);?>"> 
+                    <?=$mandfldhtml;?><input name="network" type="text" class="formfld" id="network" size="20" value="<?=htmlspecialchars($pconfig['network']);?>"> 
                                  / 
                     <select name="network_subnet" class="formfld" id="network_subnet">
                       <?php for ($i = 32; $i >= 1; $i--): ?>
@@ -150,7 +141,7 @@ if ($_POST) {
                                <tr>
                   <td width="22%" valign="top" class="vncellreq">Gateway</td>
                   <td width="78%" class="vtable"> 
-                    <input name="gateway" type="text" class="formfld" id="gateway" size="40" value="<?=htmlspecialchars($pconfig['gateway']);?>">
+                    <?=$mandfldhtml;?><input name="gateway" type="text" class="formfld" id="gateway" size="40" value="<?=htmlspecialchars($pconfig['gateway']);?>">
                     <br> <span class="vexpl">Gateway to be used to reach the destination network</span></td>
                 </tr>
                                <tr>
@@ -172,5 +163,3 @@ if ($_POST) {
               </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
diff --git a/webgui/uploadconfig.php b/webgui/uploadconfig.php
new file mode 100644 (file)
index 0000000..a86b56b
--- /dev/null
@@ -0,0 +1,56 @@
+#!/usr/local/bin/php
+<?php
+/*
+       uploadconfig.php
+       part of m0n0wall (http://m0n0.ch/wall)
+
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
+       All rights reserved.
+
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions are met:
+
+       1. Redistributions of source code must retain the above copyright notice,
+       this list of conditions and the following disclaimer.
+
+       2. Redistributions in binary form must reproduce the above copyright
+       notice, this list of conditions and the following disclaimer in the
+       documentation and/or other materials provided with the distribution.
+
+       THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+       INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+       AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+       AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+       OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+       INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+       CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+       ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+       POSSIBILITY OF SUCH DAMAGE.
+*/
+
+require("guiconfig.inc");
+
+header("Content-Type: text/plain");
+
+/* get config.xml in POST variable "config" */
+if ($_POST['config']) {
+       $fd = @fopen("{$g['tmp_path']}/config.xml", "w");
+       if (!$fd) {
+               echo "ERR Could not save configuration.\n";
+               exit(0);
+       }
+       fwrite($fd, $_POST['config']);
+       fclose($fd);
+       if (config_install("{$g['tmp_path']}/config.xml") == 0) {
+               echo "OK\n";
+               system_reboot();
+       } else {
+               echo "ERR Could not install configuration.\n";
+       }
+} else {
+       echo "ERR Invalid configuration received.\n";
+}
+
+exit(0);
+?>
index 18fd5b8adf71ac730814b111de815d5955b4d54a..ee66c3acbbb47b85c1205ab431c9e86870592389 100644 (file)
@@ -4,7 +4,7 @@
        vpn_ipsec.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("VPN", "IPsec");
 require("guiconfig.inc");
 
 if (!is_array($config['ipsec']['tunnel'])) {
@@ -81,17 +82,7 @@ if ($_GET['act'] == "del") {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("VPN: IPsec");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">VPN: IPsec</p>
 <form action="vpn_ipsec.php" method="post">
 <?php if ($savemsg) print_info_box($savemsg); ?>
 <?php if (file_exists($d_ipsecconfdirty_path)): ?><p>
@@ -99,7 +90,7 @@ if ($_GET['act'] == "del") {
 <input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
 <?php endif; ?>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
     <li class="tabact">Tunnels</li>
     <li class="tabinact"><a href="vpn_ipsec_mobile.php">Mobile clients</a></li>
@@ -110,10 +101,9 @@ if ($_GET['act'] == "del") {
     <td class="tabcont">
                        <table width="100%" border="0" cellpadding="6" cellspacing="0">
                 <tr> 
-                  <td class="vtable"><p><span class="vexpl"> </span> 
+                  <td class="vtable">
                       <input name="enable" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable']) echo "checked";?>>
-                      <strong>Enable IPsec<br>
-                      </strong></p></td>
+                      <strong>Enable IPsec</strong></td>
                 </tr>
                 <tr> 
                   <td> <input name="submit" type="submit" class="formbtn" value="Save"> 
@@ -188,5 +178,3 @@ if ($_GET['act'] == "del") {
 </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index f0fafde19a7a62b2c187dbc844d8a5c1d3a89856..370c7f4ba565edb89555aac4e791b79f534c6295 100644 (file)
@@ -4,7 +4,7 @@
        vpn_ipsec_edit.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("VPN", "IPsec", "Edit tunnel");
 require("guiconfig.inc");
 
 if (!is_array($config['ipsec']['tunnel'])) {
@@ -77,7 +78,7 @@ function pconfig_to_address(&$adr, $padr, $pmask) {
 
 if (isset($id) && $a_ipsec[$id]) {
        $pconfig['disabled'] = isset($a_ipsec[$id]['disabled']);
-       $pconfig['auto'] = isset($a_ipsec[$id]['auto']);
+       //$pconfig['auto'] = isset($a_ipsec[$id]['auto']);
 
        if (!isset($a_ipsec[$id]['local-subnet']))
                $pconfig['localnet'] = "lan";
@@ -131,6 +132,7 @@ if (isset($id) && $a_ipsec[$id]) {
        $pconfig['p2ealgos'] = explode(",", "3des,blowfish,cast128,rijndael");
        $pconfig['p2halgos'] = explode(",", "hmac_sha1,hmac_md5");
        $pconfig['p2pfsgroup'] = "0";
+       $pconfig['remotebits'] = 32;
 }
 
 if ($_POST) {
@@ -164,7 +166,7 @@ if ($_POST) {
        if (($_POST['p2lifetime'] && !is_numeric($_POST['p2lifetime']))) {
                $input_errors[] = "The P2 lifetime must be an integer.";
        }
-       if ($_POST['remotebits'] && (!is_numeric($_POST['remotebits']) || ($_POST['remotebits'] <= 0) || ($_POST['remotebits'] > 32))) {
+       if ($_POST['remotebits'] && (!is_numeric($_POST['remotebits']) || ($_POST['remotebits'] < 0) || ($_POST['remotebits'] > 32))) {
                $input_errors[] = "The remote network bits are invalid.";
        }
        if (($_POST['remotenet'] && !is_ipaddr($_POST['remotenet']))) {
@@ -190,7 +192,7 @@ if ($_POST) {
 
        if (!$input_errors) {
                $ipsecent['disabled'] = $_POST['disabled'] ? true : false;
-               $ipsecent['auto'] = $_POST['auto'] ? true : false;
+               //$ipsecent['auto'] = $_POST['auto'] ? true : false;
                $ipsecent['interface'] = $pconfig['interface'];
                pconfig_to_address($ipsecent['local-subnet'], $_POST['localnet'], $_POST['localnetmask']);
                $ipsecent['remote-subnet'] = $_POST['remotenet'] . "/" . $_POST['remotebits'];
@@ -238,12 +240,7 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("VPN: IPsec: Edit tunnel");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
+<?php include("fbegin.inc"); ?>
 <script language="JavaScript">
 <!--
 function typesel_change() {
@@ -267,11 +264,6 @@ function typesel_change() {
 }
 //-->
 </script>
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">VPN: IPsec: Edit tunnel</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
             <form action="vpn_ipsec_edit.php" method="post" name="iform" id="iform">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
@@ -287,16 +279,16 @@ function typesel_change() {
                     <span class="vexpl">Set this option to disable this tunnel without
                                        removing it from the list.</span></td>
                 </tr>
-                               <tr> 
+                               <!-- <tr> 
                                  <td width="22%" valign="top" class="vncellreq">Auto-establish</td>
                                  <td width="78%" class="vtable"> 
                                        <input name="auto" type="checkbox" id="auto" value="yes" <?php if ($pconfig['auto']) echo "checked"; ?>>
                                        <strong>Automatically establish this tunnel</strong><br>
                                        <span class="vexpl">Set this option to automatically re-establish this tunnel after reboots/reconfigures. If this is not set, the tunnel is established on demand.</span></td>
-                               </tr>
+                               </tr> -->
                                <tr> 
                   <td width="22%" valign="top" class="vncellreq">Interface</td>
-                  <td width="78%" class="vtable"> <select name="interface" class="formfld">
+                  <td width="78%" class="vtable"><select name="interface" class="formfld">
                       <?php $interfaces = array('wan' => 'WAN', 'lan' => 'LAN');
                                          for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
                                                $interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
@@ -315,6 +307,7 @@ function typesel_change() {
                     <table border="0" cellspacing="0" cellpadding="0">
                       <tr> 
                         <td>Type:&nbsp;&nbsp;</td>
+                                               <td></td>
                         <td><select name="localnettype" class="formfld" onChange="typesel_change()">
                             <?php $sel = is_specialnet($pconfig['localnet']); ?>
                             <option value="single" <?php if (($pconfig['localnetmask'] == 32) && !$sel) { echo "selected"; $sel = 1; } ?>> 
@@ -327,6 +320,7 @@ function typesel_change() {
                       </tr>
                       <tr> 
                         <td>Address:&nbsp;&nbsp;</td>
+                                               <td><?=$mandfldhtmlspc;?></td>
                         <td><input name="localnet" type="text" class="formfld" id="localnet" size="20" value="<?php if (!is_specialnet($pconfig['localnet'])) echo htmlspecialchars($pconfig['localnet']);?>">
                           / 
                           <select name="localnetmask" class="formfld" id="localnetmask">
@@ -342,10 +336,10 @@ function typesel_change() {
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Remote subnet</td>
                   <td width="78%" class="vtable"> 
-                    <input name="remotenet" type="text" class="formfld" id="remotenet" size="20" value="<?=$pconfig['remotenet'];?>">
+                    <?=$mandfldhtml;?><input name="remotenet" type="text" class="formfld" id="remotenet" size="20" value="<?=$pconfig['remotenet'];?>">
                     / 
                     <select name="remotebits" class="formfld" id="remotebits">
-                      <?php for ($i = 32; $i > 0; $i--): ?>
+                      <?php for ($i = 32; $i >= 0; $i--): ?>
                       <option value="<?=$i;?>" <?php if ($i == $pconfig['remotebits']) echo "selected"; ?>> 
                       <?=$i;?>
                       </option>
@@ -355,7 +349,7 @@ function typesel_change() {
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Remote gateway</td>
                   <td width="78%" class="vtable"> 
-                    <input name="remotegw" type="text" class="formfld" id="remotegw" size="20" value="<?=$pconfig['remotegw'];?>"> 
+                    <?=$mandfldhtml;?><input name="remotegw" type="text" class="formfld" id="remotegw" size="20" value="<?=$pconfig['remotegw'];?>"> 
                     <br>
                     Enter the public IP address of the remote gateway</td>
                 </tr>
@@ -376,7 +370,7 @@ function typesel_change() {
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Negotiation mode</td>
                   <td width="78%" class="vtable">
-<select name="p1mode" class="formfld">
+                                       <select name="p1mode" class="formfld">
                       <?php $modes = explode(" ", "main aggressive"); foreach ($modes as $mode): ?>
                       <option value="<?=$mode;?>" <?php if ($mode == $pconfig['p1mode']) echo "selected"; ?>> 
                       <?=htmlspecialchars($mode);?>
@@ -388,7 +382,7 @@ function typesel_change() {
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">My identifier</td>
                   <td width="78%" class="vtable">
-<select name="p1myidentt" class="formfld">
+                                       <select name="p1myidentt" class="formfld">
                       <?php foreach ($my_identifier_list as $mode => $modename): ?>
                       <option value="<?=$mode;?>" <?php if ($mode == $pconfig['p1myidentt']) echo "selected"; ?>> 
                       <?=htmlspecialchars($modename);?>
@@ -400,7 +394,7 @@ function typesel_change() {
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Encryption algorithm</td>
                   <td width="78%" class="vtable">
-<select name="p1ealgo" class="formfld">
+                                       <select name="p1ealgo" class="formfld">
                       <?php foreach ($p1_ealgos as $algo => $algoname): ?>
                       <option value="<?=$algo;?>" <?php if ($algo == $pconfig['p1ealgo']) echo "selected"; ?>> 
                       <?=htmlspecialchars($algoname);?>
@@ -412,7 +406,7 @@ function typesel_change() {
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Hash algorithm</td>
                   <td width="78%" class="vtable">
-<select name="p1halgo" class="formfld">
+                                       <select name="p1halgo" class="formfld">
                       <?php foreach ($p1_halgos as $algo => $algoname): ?>
                       <option value="<?=$algo;?>" <?php if ($algo == $pconfig['p1halgo']) echo "selected"; ?>> 
                       <?=htmlspecialchars($algoname);?>
@@ -424,7 +418,7 @@ function typesel_change() {
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">DH key group</td>
                   <td width="78%" class="vtable">
-<select name="p1dhgroup" class="formfld">
+                                       <select name="p1dhgroup" class="formfld">
                       <?php $keygroups = explode(" ", "1 2 5"); foreach ($keygroups as $keygroup): ?>
                       <option value="<?=$keygroup;?>" <?php if ($keygroup == $pconfig['p1dhgroup']) echo "selected"; ?>> 
                       <?=htmlspecialchars($keygroup);?>
@@ -443,7 +437,7 @@ function typesel_change() {
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Pre-Shared Key</td>
                   <td width="78%" class="vtable"> 
-                    <input name="p1pskey" type="text" class="formfld" id="p1pskey" size="40" value="<?=htmlspecialchars($pconfig['p1pskey']);?>"> 
+                    <?=$mandfldhtml;?><input name="p1pskey" type="text" class="formfld" id="p1pskey" size="40" value="<?=htmlspecialchars($pconfig['p1pskey']);?>"> 
                   </td>
                 </tr>
                 <tr> 
@@ -456,7 +450,7 @@ function typesel_change() {
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Protocol</td>
                   <td width="78%" class="vtable">
-<select name="p2proto" class="formfld">
+                                       <select name="p2proto" class="formfld">
                       <?php foreach ($p2_protos as $proto => $protoname): ?>
                       <option value="<?=$proto;?>" <?php if ($proto == $pconfig['p2proto']) echo "selected"; ?>> 
                       <?=htmlspecialchars($protoname);?>
@@ -491,7 +485,7 @@ function typesel_change() {
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">PFS key group</td>
                   <td width="78%" class="vtable">
-<select name="p2pfsgroup" class="formfld">
+                                       <select name="p2pfsgroup" class="formfld">
                       <?php foreach ($p2_pfskeygroups as $keygroup => $keygroupname): ?>
                       <option value="<?=$keygroup;?>" <?php if ($keygroup == $pconfig['p2pfsgroup']) echo "selected"; ?>> 
                       <?=htmlspecialchars($keygroupname);?>
@@ -523,5 +517,3 @@ typesel_change();
 //-->
 </script>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index f0a93304ad673e2b5cdbabe18873aa6fbeea63bb..75a50fa039966fadc1f5d18e81a09af6c9158661 100644 (file)
@@ -4,7 +4,7 @@
        vpn_ipsec_keys.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("VPN", "IPsec");
 require("guiconfig.inc");
 
 if (!is_array($config['ipsec']['mobilekey'])) {
@@ -48,17 +49,7 @@ if ($_GET['act'] == "del") {
 }
 
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("VPN: IPsec");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">VPN: IPsec</p>
 <form action="vpn_ipsec.php" method="post">
 <?php if ($savemsg) print_info_box($savemsg); ?>
 <?php if (file_exists($d_ipsecconfdirty_path)): ?><p>
@@ -66,9 +57,9 @@ if ($_GET['act'] == "del") {
 <input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
 <?php endif; ?>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
-    <li class="tabinact"><a href="vpn_ipsec.php">Tunnels</a></li>
+    <li class="tabinact1"><a href="vpn_ipsec.php">Tunnels</a></li>
     <li class="tabinact"><a href="vpn_ipsec_mobile.php">Mobile clients</a></li>
     <li class="tabact">Pre-shared keys</li>
   </ul>
@@ -103,5 +94,3 @@ if ($_GET['act'] == "del") {
                </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 8fe589e1e6cd5131dc30b8bba0a101ab61b8f8a7..349158560c1b293ba6d670106d11ad8c2a7cb4af 100644 (file)
@@ -4,7 +4,7 @@
        vpn_ipsec_keys_edit.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("VPN", "IPsec", "Edit pre-shared key");
 require("guiconfig.inc");
 
 if (!is_array($config['ipsec']['mobilekey'])) {
@@ -91,24 +92,14 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("VPN: IPsec: Edit pre-shared key");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">VPN: IPsec: Edit pre-shared key</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
             <form action="vpn_ipsec_keys_edit.php" method="post" name="iform" id="iform">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
                 <tr> 
                   <td valign="top" class="vncellreq">Identifier</td>
                   <td class="vtable">
- <input name="ident" type="text" class="formfld" id="ident" size="30" value="<?=$pconfig['ident'];?>">
                                      <?=$mandfldhtml;?><input name="ident" type="text" class="formfld" id="ident" size="30" value="<?=$pconfig['ident'];?>">
                     <br>
 This can be either an IP address, fully qualified domain name or an e-mail address.       
                   </td>
@@ -116,7 +107,7 @@ This can be either an IP address, fully qualified domain name or an e-mail addre
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Pre-shared key</td>
                   <td width="78%" class="vtable"> 
-                    <input name="psk" type="text" class="formfld" id="psk" size="40" value="<?=htmlspecialchars($pconfig['psk']);?>">
+                    <?=$mandfldhtml;?><input name="psk" type="text" class="formfld" id="psk" size="40" value="<?=htmlspecialchars($pconfig['psk']);?>">
                   </td>
                 </tr>
                 <tr> 
@@ -131,5 +122,3 @@ This can be either an IP address, fully qualified domain name or an e-mail addre
               </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 3031a45e115b08e9cab91ede9b56e51556f322e5..dfd116d6b7cf1cf29249ccd92fff8cb9bac93ea4 100644 (file)
@@ -4,7 +4,7 @@
        vpn_ipsec_mobile.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("VPN", "IPsec");
 require("guiconfig.inc");
 
 if (!is_array($config['ipsec']['mobileclients'])) {
@@ -147,17 +148,7 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("VPN: IPsec");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">VPN: IPsec</p>
 <form action="vpn_ipsec.php" method="post">
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if (file_exists($d_ipsecconfdirty_path)): ?><p>
@@ -167,9 +158,9 @@ if ($_POST) {
 </form>
 <form action="vpn_ipsec_mobile.php" method="post" name="iform" id="iform">
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
-    <li class="tabinact"><a href="vpn_ipsec.php">Tunnels</a></li>
+    <li class="tabinact1"><a href="vpn_ipsec.php">Tunnels</a></li>
     <li class="tabact">Mobile clients</li>
     <li class="tabinact"><a href="vpn_ipsec_keys.php">Pre-shared keys</a></li>
   </ul>
@@ -189,8 +180,8 @@ if ($_POST) {
                 </tr>
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Negotiation mode</td>
-                        <td width="78%" bgcolor="#FFFFFF" class="vtable">
-<select name="p1mode" class="formfld">
+                        <td width="78%" class="vtable">
+                                       <select name="p1mode" class="formfld">
                       <?php $modes = explode(" ", "main aggressive"); foreach ($modes as $mode): ?>
                       <option value="<?=$mode;?>" <?php if ($mode == $pconfig['p1mode']) echo "selected"; ?>> 
                       <?=htmlspecialchars($mode);?>
@@ -201,8 +192,8 @@ if ($_POST) {
                 </tr>
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">My identifier</td>
-                        <td width="78%" bgcolor="#FFFFFF" class="vtable">
-<select name="p1myidentt" class="formfld">
+                        <td width="78%" class="vtable">
+                                       <select name="p1myidentt" class="formfld">
                       <?php foreach ($my_identifier_list as $mode => $modename): ?>
                       <option value="<?=$mode;?>" <?php if ($mode == $pconfig['p1myidentt']) echo "selected"; ?>> 
                       <?=htmlspecialchars($modename);?>
@@ -213,8 +204,8 @@ if ($_POST) {
                 </tr>
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Encryption algorithm</td>
-                        <td width="78%" bgcolor="#FFFFFF" class="vtable">
-<select name="p1ealgo" class="formfld">
+                        <td width="78%" class="vtable">
+                                       <select name="p1ealgo" class="formfld">
                       <?php foreach ($p1_ealgos as $algo => $algoname): ?>
                       <option value="<?=$algo;?>" <?php if ($algo == $pconfig['p1ealgo']) echo "selected"; ?>> 
                       <?=htmlspecialchars($algoname);?>
@@ -225,8 +216,8 @@ if ($_POST) {
                 </tr>
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Hash algorithm</td>
-                        <td width="78%" bgcolor="#FFFFFF" class="vtable">
-<select name="p1halgo" class="formfld">
+                        <td width="78%" class="vtable">
+                                       <select name="p1halgo" class="formfld">
                       <?php foreach ($p1_halgos as $algo => $algoname): ?>
                       <option value="<?=$algo;?>" <?php if ($algo == $pconfig['p1halgo']) echo "selected"; ?>> 
                       <?=htmlspecialchars($algoname);?>
@@ -237,8 +228,8 @@ if ($_POST) {
                 </tr>
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">DH key group</td>
-                        <td width="78%" bgcolor="#FFFFFF" class="vtable">
-<select name="p1dhgroup" class="formfld">
+                        <td width="78%" class="vtable">
+                                       <select name="p1dhgroup" class="formfld">
                       <?php $keygroups = explode(" ", "1 2 5"); foreach ($keygroups as $keygroup): ?>
                       <option value="<?=$keygroup;?>" <?php if ($keygroup == $pconfig['p1dhgroup']) echo "selected"; ?>> 
                       <?=htmlspecialchars($keygroup);?>
@@ -250,7 +241,7 @@ if ($_POST) {
                 </tr>
                 <tr> 
                   <td width="22%" valign="top" class="vncell">Lifetime</td>
-                        <td width="78%" bgcolor="#FFFFFF" class="vtable"> 
+                        <td width="78%" class="vtable"> 
                     <input name="p1lifetime" type="text" class="formfld" id="p1lifetime" size="20" value="<?=$pconfig['p1lifetime'];?>">
                     seconds</td>
                 </tr>
@@ -263,8 +254,8 @@ if ($_POST) {
                 </tr>
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Protocol</td>
-                        <td width="78%" bgcolor="#FFFFFF" class="vtable">
-<select name="p2proto" class="formfld">
+                        <td width="78%" class="vtable">
+                                       <select name="p2proto" class="formfld">
                       <?php foreach ($p2_protos as $proto => $protoname): ?>
                       <option value="<?=$proto;?>" <?php if ($proto == $pconfig['p2proto']) echo "selected"; ?>> 
                       <?=htmlspecialchars($protoname);?>
@@ -275,7 +266,7 @@ if ($_POST) {
                 </tr>
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Encryption algorithms</td>
-                        <td width="78%" bgcolor="#FFFFFF" class="vtable"> 
+                        <td width="78%" class="vtable"> 
                           <?php foreach ($p2_ealgos as $algo => $algoname): ?>
                     <input type="checkbox" name="p2ealgos[]" value="<?=$algo;?>" <?php if (in_array($algo, $pconfig['p2ealgos'])) echo "checked"; ?>> 
                     <?=htmlspecialchars($algoname);?>
@@ -288,7 +279,7 @@ if ($_POST) {
                 </tr>
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Hash algorithms</td>
-                        <td width="78%" bgcolor="#FFFFFF" class="vtable"> 
+                        <td width="78%" class="vtable"> 
                           <?php foreach ($p2_halgos as $algo => $algoname): ?>
                     <input type="checkbox" name="p2halgos[]" value="<?=$algo;?>" <?php if (in_array($algo, $pconfig['p2halgos'])) echo "checked"; ?>> 
                     <?=htmlspecialchars($algoname);?>
@@ -298,8 +289,8 @@ if ($_POST) {
                 </tr>
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">PFS key group</td>
-                        <td width="78%" bgcolor="#FFFFFF" class="vtable">
-<select name="p2pfsgroup" class="formfld">
+                        <td width="78%" class="vtable">
+                                       <select name="p2pfsgroup" class="formfld">
                       <?php foreach ($p2_pfskeygroups as $keygroup => $keygroupname): ?>
                       <option value="<?=$keygroup;?>" <?php if ($keygroup == $pconfig['p2pfsgroup']) echo "selected"; ?>> 
                       <?=htmlspecialchars($keygroupname);?>
@@ -310,7 +301,7 @@ if ($_POST) {
                 </tr>
                 <tr> 
                   <td width="22%" valign="top" class="vncell">Lifetime</td>
-                        <td width="78%" bgcolor="#FFFFFF" class="vtable"> 
+                        <td width="78%" class="vtable"> 
                     <input name="p2lifetime" type="text" class="formfld" id="p2lifetime" size="20" value="<?=$pconfig['p2lifetime'];?>">
                     seconds</td>
                 </tr>
@@ -326,5 +317,3 @@ if ($_POST) {
                </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 6fd3e1e2d93f3c331445179846bcfffb307b716a..46f8953b28aa7e46b6eb2041c2dea297b437d589 100644 (file)
@@ -28,6 +28,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("VPN", "OpenVPN");
 require("guiconfig.inc");
 require_once("openvpn.inc");
 
@@ -147,17 +148,7 @@ if ($_POST) {
 $pconfig = $config['ovpn']['server'];
 
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("VPN: OpenVPN");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">VPN: OpenVPN</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if (file_exists($d_sysrebootreqd_path)) print_info_box(get_std_save_message(0)); ?>
 
@@ -362,5 +353,3 @@ $pconfig = $config['ovpn']['server'];
 </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 3bd3d938650f8b476943298741200e2b685cf75e..d022630eae4dc7f048a44163a65b5ed8b6cafa56 100644 (file)
@@ -28,6 +28,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("VPN", "OpenVPN");
 require("guiconfig.inc");
 require_once("openvpn.inc");
 
@@ -67,17 +68,7 @@ if ($_GET['act'] == "del") {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("VPN: OpenVPN");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">VPN: OpenVPN</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if (file_exists($d_sysrebootreqd_path) && !file_exists($d_ovpnclidirty_path)) print_info_box(get_std_save_message(0)); ?>
 <form action="vpn_openvpn_cli.php" method="post" enctype="multipart/form-data" name="iform" id="iform">
@@ -89,7 +80,7 @@ if ($_GET['act'] == "del") {
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
   <tr><td>
   <ul id="tabnav">             
-       <li class="tabinact"><a href="vpn_openvpn.php">Server</a></li>
+       <li class="tabinact1"><a href="vpn_openvpn.php">Server</a></li>
        <li class="tabact">Client</li>
   </ul>
   </td></tr>
@@ -144,5 +135,3 @@ if ($_GET['act'] == "del") {
 </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 4c27709f84b4bb36b0c5d917859bdbb2725a82e7..a13b534f11d8698d96371b4a670205dcb112ae9b 100644 (file)
@@ -28,6 +28,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("VPN", "OpenVPN", "Edit client");
 require("guiconfig.inc");
 require_once("openvpn.inc");
 
@@ -187,17 +188,7 @@ if (isset($_POST['pull'])) {
 }
 
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("VPN: OpenVPN: Edit client");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">VPN: OpenVPN: Edit client</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 
 <form action="vpn_openvpn_cli_edit.php" method="post" enctype="multipart/form-data" name="iform" id="iform">
@@ -349,5 +340,3 @@ if (isset($_POST['pull'])) {
 </form>
 
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 6344afac39260beb2a82d3fa493867699439a370..43a19e5ef31a93888614f74392af43fe4c13d9a9 100644 (file)
@@ -4,7 +4,7 @@
        vpn_pptp.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("VPN", "PPTP");
 require("guiconfig.inc");
 
 if (!is_array($config['pptpd']['radius'])) {
@@ -121,11 +122,7 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html><head>
-<title><?=gentitle("VPN: PPTP");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
+<?php include("fbegin.inc"); ?>
 <script language="JavaScript">
 <!--
 function get_radio_value(obj)
@@ -170,16 +167,11 @@ function enable_change(enable_over) {
 }
 //-->
 </script>
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<p class="pgtitle">VPN: PPTP</p>
 <form action="vpn_pptp.php" method="post" name="iform" id="iform">
 <?php if ($input_errors) print_input_errors($input_errors); ?>
 <?php if ($savemsg) print_info_box($savemsg); ?>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
     <li class="tabact">Configuration</li>
     <li class="tabinact"><a href="vpn_pptp_users.php">Users</a></li>
@@ -202,7 +194,7 @@ function enable_change(enable_over) {
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">PPTP redirection</td>
                   <td width="78%" class="vtable"> 
-                    <input name="redir" type="text" class="formfld" id="redir" size="20" value="<?=htmlspecialchars($pconfig['redir']);?>"> 
+                    <?=$mandfldhtml;?><input name="redir" type="text" class="formfld" id="redir" size="20" value="<?=htmlspecialchars($pconfig['redir']);?>"> 
                     <br>
                     Enter the IP address of a host which will accept incoming 
                     PPTP connections.</td>
@@ -220,7 +212,7 @@ function enable_change(enable_over) {
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Server address</td>
                   <td width="78%" class="vtable"> 
-                    <input name="localip" type="text" class="formfld" id="localip" size="20" value="<?=htmlspecialchars($pconfig['localip']);?>"> 
+                    <?=$mandfldhtml;?><input name="localip" type="text" class="formfld" id="localip" size="20" value="<?=htmlspecialchars($pconfig['localip']);?>"> 
                     <br>
                     Enter the IP address the PPTP server should use on its side 
                     for all clients.</td>
@@ -229,7 +221,7 @@ function enable_change(enable_over) {
                   <td width="22%" valign="top" class="vncellreq">Remote address 
                     range</td>
                   <td width="78%" class="vtable"> 
-                    <input name="remoteip" type="text" class="formfld" id="remoteip" size="20" value="<?=htmlspecialchars($pconfig['remoteip']);?>">
+                    <?=$mandfldhtml;?><input name="remoteip" type="text" class="formfld" id="remoteip" size="20" value="<?=htmlspecialchars($pconfig['remoteip']);?>">
                     / 
                     <?=$g['pptp_subnet'];?>
                     <br>
@@ -241,7 +233,6 @@ function enable_change(enable_over) {
                 <tr> 
                   <td width="22%" valign="top" class="vncell">RADIUS</td>
                   <td width="78%" class="vtable"> 
-                    <p> 
                       <input name="radiusenable" type="checkbox" id="radiusenable" onclick="enable_change(false)" value="yes" <?php if ($pconfig['radiusenable']) echo "checked"; ?>>
                       <strong>Use a RADIUS server for authentication<br>
                       </strong>When set, all users will be authenticated using 
@@ -250,24 +241,22 @@ function enable_change(enable_over) {
                       <br>
                       <input name="radacct_enable" type="checkbox" id="radacct_enable" onclick="enable_change(false)" value="yes" <?php if ($pconfig['radacct_enable']) echo "checked"; ?>>
                       <strong>Enable RADIUS accounting <br>
-                      </strong>Sends accounting packets to the RADIUS server. </p></td>
+                      </strong>Sends accounting packets to the RADIUS server.</td>
                 </tr>
                 <tr> 
                   <td width="22%" valign="top" class="vncell">RADIUS server </td>
-                  <td width="78%" class="vtable"> 
-                    <p> 
+                  <td width="78%" class="vtable">
                       <input name="radiusserver" type="text" class="formfld" id="radiusserver" size="20" value="<?=htmlspecialchars($pconfig['radiusserver']);?>">
                       <br>
-                      Enter the IP address of the RADIUS server.</p></td>
+                      Enter the IP address of the RADIUS server.</td>
                 </tr>
                 <tr> 
                   <td width="22%" valign="top" class="vncell">RADIUS shared secret</td>
-                  <td width="78%" valign="top" class="vtable"> 
-                    <p> 
+                  <td width="78%" valign="top" class="vtable">
                       <input name="radiussecret" type="password" class="formfld" id="radiussecret" size="20" value="<?=htmlspecialchars($pconfig['radiussecret']);?>">
                       <br>
                       Enter the shared secret that will be used to authenticate 
-                      to the RADIUS server.</p></td>
+                      to the RADIUS server.</td>
                 </tr>
                 <tr> 
                   <td height="16" colspan="2" valign="top"></td>
@@ -305,5 +294,3 @@ enable_change(false);
 //-->
 </script>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 01227347c3491dcb3b5e89794dc5e9ebcd2e5461..5b6d9dacd0ce5e448a5e4cdde76a7a4ee1dcbae2 100644 (file)
@@ -4,7 +4,7 @@
        vpn_pptp_users.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("VPN", "PPTP");
 require("guiconfig.inc");
 
 if (!is_array($config['pptpd']['user'])) {
@@ -66,17 +67,7 @@ if ($_GET['act'] == "del") {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("VPN: PPTP: Users");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">VPN: PPTP: Users</p>
 <form action="vpn_pptp_users.php" method="post">
 <?php if ($savemsg) print_info_box($savemsg); ?>
 <?php if (isset($config['pptpd']['radius']['enable']))
@@ -86,9 +77,9 @@ if ($_GET['act'] == "del") {
 <input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
 <?php endif; ?>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr><td>
+  <tr><td class="tabnavtbl">
   <ul id="tabnav">
-    <li class="tabinact"><a href="vpn_pptp.php">Configuration</a></li>
+    <li class="tabinact1"><a href="vpn_pptp.php">Configuration</a></li>
     <li class="tabact">Users</li>
   </ul>
   </td></tr>
@@ -122,5 +113,3 @@ if ($_GET['act'] == "del") {
 </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>
index 1b681ee29fca1dd87f0ebfdb67ddf03e74744b48..bbeddc1385917aa586d0fee7706e03a5568d6aaa 100644 (file)
@@ -4,7 +4,7 @@
        vpn_pptp_users_edit.php
        part of m0n0wall (http://m0n0.ch/wall)
        
-       Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+       Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
        POSSIBILITY OF SUCH DAMAGE.
 */
 
+$pgtitle = array("VPN", "PPTP", "Edit user");
 require("guiconfig.inc");
 
 if (!is_array($config['pptpd']['user'])) {
@@ -109,30 +110,20 @@ if ($_POST) {
        }
 }
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<title><?=gentitle("VPN: PPTP: Users: Edit");?></title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link href="gui.css" rel="stylesheet" type="text/css">
-</head>
-
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
 <?php include("fbegin.inc"); ?>
-<p class="pgtitle">VPN: PPTP: Users: Edit</p>
 <?php if ($input_errors) print_input_errors($input_errors); ?>
             <form action="vpn_pptp_users_edit.php" method="post" name="iform" id="iform">
               <table width="100%" border="0" cellpadding="6" cellspacing="0">
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Username</td>
                   <td width="78%" class="vtable">
-<input name="username" type="text" class="formfld" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>"> 
+                                       <?=$mandfldhtml;?><input name="username" type="text" class="formfld" id="username" size="20" value="<?=htmlspecialchars($pconfig['username']);?>"> 
                   </td>
                 <tr> 
                   <td width="22%" valign="top" class="vncellreq">Password</td>
                   <td width="78%" class="vtable"> 
-                    <input name="password" type="password" class="formfld" id="password" size="20"> 
-                    <br> <input name="password2" type="password" class="formfld" id="password2" size="20"> 
+                    <?=$mandfldhtml;?><input name="password" type="password" class="formfld" id="password" size="20"> 
+                    <br><?=$mandfldhtml;?><input name="password2" type="password" class="formfld" id="password2" size="20"> 
                     &nbsp;(confirmation)<?php if (isset($id) && $a_secret[$id]): ?><br>
                     <span class="vexpl">If you want to change the users' password, 
                     enter it here twice.</span><?php endif; ?></td>
@@ -155,5 +146,3 @@ if ($_POST) {
               </table>
 </form>
 <?php include("fend.inc"); ?>
-</body>
-</html>