diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index 37f195cfe1..c4032523f3 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -50,54 +50,85 @@ require_once("filter.inc"); require_once("radius.inc"); require_once("voucher.inc"); -function captiveportal_configure() { +function get_default_captive_portal_html() { global $config, $g; - - $captiveportallck = lock('captiveportal'); - - if (isset($config['captiveportal']['enable'])) { - - if ($g['booting']) - echo gettext("Starting captive portal... "); - - /* kill any running mini_httpd */ - killbypid("{$g['varrun_path']}/lighty-CaptivePortal.pid"); - killbypid("{$g['varrun_path']}/lighty-CaptivePortal-SSL.pid"); - - /* remove old information */ - unlink_if_exists("{$g['vardb_path']}/captiveportal.db"); - unlink_if_exists("{$g['vardb_path']}/captiveportal_mac.db"); - unlink_if_exists("{$g['vardb_path']}/captiveportal_ip.db"); - unlink_if_exists("{$g['vardb_path']}/captiveportal_radius.db"); - - /* setup new database in case someone tries to access the status -> captive portal page */ - touch("{$g['vardb_path']}/captiveportal.db"); - - /* kill any running minicron */ - killbypid("{$g['varrun_path']}/minicron.pid"); - - /* init ipfw rules */ - captiveportal_init_rules(true); - - /* stop accounting on all clients */ - captiveportal_radius_stop_all(true); - - /* initialize minicron interval value */ - $croninterval = $config['captiveportal']['croninterval'] ? $config['captiveportal']['croninterval'] : 60; - - /* double check if the $croninterval is numeric and at least 10 seconds. If not we set it to 60 to avoid problems */ - if ((!is_numeric($croninterval)) || ($croninterval < 10)) { $croninterval = 60; } - - /* write portal page */ - if ($config['captiveportal']['page']['htmltext']) - $htmltext = base64_decode($config['captiveportal']['page']['htmltext']); - else { - /* example/template page */ + // Detect if vouchers are being used and default to the voucher page + if($config['voucher']) { $htmltext = << -
- + +
+ + + + + + + +
+ + + Guest Voucher code required to continue + + +
+
+
+ + + + +
+
+
+
+ + + + +
+
+
+
+ + + \$PORTAL_MESSAGE\$ + + +
+

+

+ Enter Voucher Code: + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+ + + +EOD; + return $htmltext; + } + + // Vouchers are not found, return the normal user/pass auth page + $htmltext = << + +
+
@@ -127,7 +158,7 @@ function captiveportal_configure() {
- $PORTAL_MESSAGE$ + \$PORTAL_MESSAGE\$
@@ -167,9 +198,55 @@ function captiveportal_configure() { - - EOD; + + return $htmltext; +} + +function captiveportal_configure() { + global $config, $g; + + $captiveportallck = lock('captiveportal'); + + if (isset($config['captiveportal']['enable'])) { + + if ($g['booting']) + echo "Starting captive portal... "; + + /* kill any running mini_httpd */ + killbypid("{$g['varrun_path']}/lighty-CaptivePortal.pid"); + killbypid("{$g['varrun_path']}/lighty-CaptivePortal-SSL.pid"); + + /* remove old information */ + unlink_if_exists("{$g['vardb_path']}/captiveportal.db"); + unlink_if_exists("{$g['vardb_path']}/captiveportal_mac.db"); + unlink_if_exists("{$g['vardb_path']}/captiveportal_ip.db"); + unlink_if_exists("{$g['vardb_path']}/captiveportal_radius.db"); + + /* setup new database in case someone tries to access the status -> captive portal page */ + touch("{$g['vardb_path']}/captiveportal.db"); + + /* kill any running minicron */ + killbypid("{$g['varrun_path']}/minicron.pid"); + + /* init ipfw rules */ + captiveportal_init_rules(true); + + /* stop accounting on all clients */ + captiveportal_radius_stop_all(true); + + /* initialize minicron interval value */ + $croninterval = $config['captiveportal']['croninterval'] ? $config['captiveportal']['croninterval'] : 60; + + /* double check if the $croninterval is numeric and at least 10 seconds. If not we set it to 60 to avoid problems */ + if ((!is_numeric($croninterval)) || ($croninterval < 10)) { $croninterval = 60; } + + /* write portal page */ + if ($config['captiveportal']['page']['htmltext']) + $htmltext = base64_decode($config['captiveportal']['page']['htmltext']); + else { + /* example/template page */ + $htmltext = get_default_captive_portal_html(); } $fd = @fopen("{$g['varetc_path']}/captiveportal.html", "w"); @@ -194,8 +271,8 @@ EOD; $errtext = << - - + +
@@ -225,7 +302,7 @@ EOD;
- $PORTAL_MESSAGE$ + \$PORTAL_MESSAGE\$
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 18dc18f2e1..11e83210d4 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -2313,7 +2313,7 @@ function find_dhclient_process($interface) { return $pid; } -function interface_configure($interface = "wan", $reloadall = false) { +function interface_configure($interface = "wan", $reloadall = false, $linkupevent = false) { global $config, $g; global $interface_sn_arr_cache, $interface_ip_arr_cache; @@ -2482,10 +2482,12 @@ function interface_configure($interface = "wan", $reloadall = false) { if (!empty($gif)) interface_gif_configure($gif); - unset($bridgetmp); - $bridgetmp = link_interface_to_bridge($interface); - if (!empty($bridgetmp)) - interface_bridge_add_member($bridgetmp, $realif); + if ($linkupevent == false) { + unset($bridgetmp); + $bridgetmp = link_interface_to_bridge($interface); + if (!empty($bridgetmp)) + interface_bridge_add_member($bridgetmp, $realif); + } link_interface_to_vips($interface, "update"); diff --git a/etc/inc/voucher.inc b/etc/inc/voucher.inc index 6ea0732091..978b1d2677 100644 --- a/etc/inc/voucher.inc +++ b/etc/inc/voucher.inc @@ -136,12 +136,24 @@ function voucher_auth($voucher_received, $test = 0) { // the user wouldn't know that he used at least one invalid voucher. if ($error) { - unlock($voucherlck); + unlock($voucherlck); if ($total_minutes > 0) // probably not needed, but want to make sure $total_minutes = 0; // we only report -1 (expired) or 0 (no access) return $total_minutes; // well, at least one voucher had errors. Say NO ACCESS } + // XMLRPC Call over to the master Voucher node + $a_voucher = &$config['voucher']; + if($a_voucher['vouchersyncdbip']) { + $syncip = $a_voucher['vouchersyncdbip']; + $syncport = $a_voucher['vouchersyncport']; + $syncpass = $a_voucher['vouchersyncpass']; + $syncpass = $a_voucher['vouchersyncusername']; + $remote_time_used = sync_used_voucher($voucher_received, $syncip, $syncport, $syncpass, $vouchersyncusername); + if($remote_time_used['timeleft'] < 1) + $total_minutes = $remote_time_used['timeleft']; + } + // All given vouchers were valid and this isn't simply a test. // Write back the used DB's @@ -179,6 +191,54 @@ function voucher_auth($voucher_received, $test = 0) { return $total_minutes; } +function sync_used_voucher($voucher_received, $syncip, $port, $password, $username) { + require_once("xmlrpc.inc"); + if($port == "443") + $url = "https://{$syncip}:{$port}"; + else + $url = "http://{$syncip}:{$port}"; + + /* Construct code that is run on remote machine */ + $method = 'pfsense.exec_php'; + $execcmd = <<setCredentials('admin', $password); + $resp = $cli->send($msg, "250"); + if(!$resp) { + $error = "A communications error occurred while attempting CaptivePortalVoucherSync XMLRPC sync with {$url}:{$port} (pfsense.exec_php)."; + log_error($error); + file_notice("CaptivePortalVoucherSync", $error, "Communications error occurred", ""); + return array("timeleft" => "0"); + } elseif($resp->faultCode()) { + $cli->setDebug(1); + $resp = $cli->send($msg, "250"); + $error = "An error code was received while attempting CaptivePortalVoucherSync XMLRPC sync with {$url}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString(); + log_error($error); + file_notice("CaptivePortalVoucherSync", $error, "Error code received", ""); + return array("timeleft" => "0"); + } else { + log_error("CaptivePortalVoucherSync XMLRPC reload data success with {$url}:{$port} (pfsense.exec_php)."); + } + $timeleft = XML_RPC_Decode($resp->value()); + //print_r($timeleft); + return $timeleft; +} + function voucher_configure() { global $config, $g; diff --git a/etc/inc/xmlparse.inc b/etc/inc/xmlparse.inc index cb012534c1..aa4d7e48d3 100644 --- a/etc/inc/xmlparse.inc +++ b/etc/inc/xmlparse.inc @@ -36,7 +36,7 @@ function listtags() { * I know it's a pain, but it's a pain to find stuff too if it's not */ $ret = explode(" ", - "alias aliasurl allowedip authserver bridged ca cacert cert clone config ". + "alias aliasurl allowedip authserver bridged ca cacert cert crl clone config ". "container columnitem build_port_path depends_on_package disk dnsserver dnsupdate ". "domainoverrides dyndns earlyshellcmd element encryption-algorithm-option ". "field fieldname hash-algorithm-option gateway_item gateway_group gif gre ". diff --git a/etc/inc/xmlreader.inc b/etc/inc/xmlreader.inc index a215bc9381..e53c6685aa 100644 --- a/etc/inc/xmlreader.inc +++ b/etc/inc/xmlreader.inc @@ -40,7 +40,7 @@ function listtags() { * I know it's a pain, but it's a pain to find stuff too if it's not */ $ret = explode(" ", - "alias aliasurl allowedip authserver bridged ca cacert cert clone config ". + "alias aliasurl allowedip authserver bridged ca cacert cert crl clone config ". "container columnitem depends_on_package disk dnsserver dnsupdate ". "domainoverrides dyndns earlyshellcmd element encryption-algorithm-option ". "field fieldname hash-algorithm-option gateway_item gateway_group gif gre ". diff --git a/etc/rc.linkup b/etc/rc.linkup index 682adb13d3..997228f8a0 100755 --- a/etc/rc.linkup +++ b/etc/rc.linkup @@ -40,7 +40,7 @@ function handle_argument_group($iface, $argument2) { global $config; $ipaddr = $config['interfaces'][$iface]['ipaddr']; - if (is_ipaddr($ipaddr)) { + if (is_ipaddr($ipaddr) || empty($ipaddr)) { log_error("Hotplug event detected for {$iface} but ignoring since interface is configured with static IP ({$ipaddr})"); $iface = get_real_interface($iface); exec("/usr/sbin/arp -d -i {$iface} -a"); @@ -56,7 +56,8 @@ function handle_argument_group($iface, $argument2) { $riface = get_real_interface($iface); exec("/usr/sbin/arp -d -i {$riface} -a"); log_error("HOTPLUG: Configuring interface {$iface}"); - interface_configure($iface); + // Do not try to readd to bridge otherwise em(4) has problems + interface_configure($iface, false, true); break; case "up": log_error("DEVD Ethernet attached event for {$iface}"); diff --git a/etc/rc.php_ini_setup b/etc/rc.php_ini_setup index ee26d954ce..a54b1f42cd 100755 --- a/etc/rc.php_ini_setup +++ b/etc/rc.php_ini_setup @@ -25,6 +25,13 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. +if [ -f /usr/local/etc/php.ini ]; then + rm /usr/local/etc/php.ini +fi +if [ -f /usr/local/lib/php.ini ]; then + rm /usr/local/lib/php.ini +fi + # Set our operating platform PLATFORM=`cat /etc/platform` EXTENSIONSDIR="/usr/local/lib/php/20060613/" diff --git a/usr/local/www/base64.js b/usr/local/www/base64.js new file mode 100644 index 0000000000..c3b2bf5566 --- /dev/null +++ b/usr/local/www/base64.js @@ -0,0 +1,142 @@ +/** + * + * Base64 encode / decode + * http://www.webtoolkit.info/ + * http://www.webtoolkit.info/licence + **/ + +var Base64 = { + + // private property + _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", + + // public method for encoding + encode : function (input) { + var output = ""; + var chr1, chr2, chr3, enc1, enc2, enc3, enc4; + var i = 0; + + input = Base64._utf8_encode(input); + + while (i < input.length) { + + chr1 = input.charCodeAt(i++); + chr2 = input.charCodeAt(i++); + chr3 = input.charCodeAt(i++); + + enc1 = chr1 >> 2; + enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); + enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); + enc4 = chr3 & 63; + + if (isNaN(chr2)) { + enc3 = enc4 = 64; + } else if (isNaN(chr3)) { + enc4 = 64; + } + + output = output + + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); + + } + + return output; + }, + + // public method for decoding + decode : function (input) { + var output = ""; + var chr1, chr2, chr3; + var enc1, enc2, enc3, enc4; + var i = 0; + + input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); + + while (i < input.length) { + + enc1 = this._keyStr.indexOf(input.charAt(i++)); + enc2 = this._keyStr.indexOf(input.charAt(i++)); + enc3 = this._keyStr.indexOf(input.charAt(i++)); + enc4 = this._keyStr.indexOf(input.charAt(i++)); + + chr1 = (enc1 << 2) | (enc2 >> 4); + chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); + chr3 = ((enc3 & 3) << 6) | enc4; + + output = output + String.fromCharCode(chr1); + + if (enc3 != 64) { + output = output + String.fromCharCode(chr2); + } + if (enc4 != 64) { + output = output + String.fromCharCode(chr3); + } + + } + + output = Base64._utf8_decode(output); + + return output; + + }, + + // private method for UTF-8 encoding + _utf8_encode : function (string) { + string = string.replace(/\r\n/g,"\n"); + var utftext = ""; + + for (var n = 0; n < string.length; n++) { + + var c = string.charCodeAt(n); + + if (c < 128) { + utftext += String.fromCharCode(c); + } + else if((c > 127) && (c < 2048)) { + utftext += String.fromCharCode((c >> 6) | 192); + utftext += String.fromCharCode((c & 63) | 128); + } + else { + utftext += String.fromCharCode((c >> 12) | 224); + utftext += String.fromCharCode(((c >> 6) & 63) | 128); + utftext += String.fromCharCode((c & 63) | 128); + } + + } + + return utftext; + }, + + // private method for UTF-8 decoding + _utf8_decode : function (utftext) { + var string = ""; + var i = 0; + var c = c1 = c2 = 0; + + while ( i < utftext.length ) { + + c = utftext.charCodeAt(i); + + if (c < 128) { + string += String.fromCharCode(c); + i++; + } + else if((c > 191) && (c < 224)) { + c2 = utftext.charCodeAt(i+1); + string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); + i += 2; + } + else { + c2 = utftext.charCodeAt(i+1); + c3 = utftext.charCodeAt(i+2); + string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); + i += 3; + } + + } + + return string; + } + +} \ No newline at end of file diff --git a/usr/local/www/fend.inc b/usr/local/www/fend.inc index 913771c5a9..dc4dc5b9f3 100755 --- a/usr/local/www/fend.inc +++ b/usr/local/www/fend.inc @@ -14,5 +14,5 @@ - + diff --git a/usr/local/www/firewall_rules_edit.php b/usr/local/www/firewall_rules_edit.php index 3cc5bad5ab..34cfc5d08b 100755 --- a/usr/local/www/firewall_rules_edit.php +++ b/usr/local/www/firewall_rules_edit.php @@ -854,7 +854,7 @@ include("head.inc");

- "").")."
".

+ "").
.

diff --git a/usr/local/www/interfaces_ppps.php b/usr/local/www/interfaces_ppps.php index 01dcdb5f9a..1e22bd00c9 100644 --- a/usr/local/www/interfaces_ppps.php +++ b/usr/local/www/interfaces_ppps.php @@ -52,7 +52,7 @@ function ppp_inuse($num) { global $config, $g, $a_ppps; $iflist = get_configured_interface_list(false, true); foreach ($iflist as $if) { - if (isset($config['interfaces'][$if]['ptpid']) && $config['interfaces'][$if]['ptpid'] == $a_ppps[$num]['ptpid']) + if ($config['interfaces'][$if]['if'] == $a_ppps[$num]['if']) return true; } return false; diff --git a/usr/local/www/services_captiveportal_vouchers.php b/usr/local/www/services_captiveportal_vouchers.php index 2450fd2391..c79b84d77b 100644 --- a/usr/local/www/services_captiveportal_vouchers.php +++ b/usr/local/www/services_captiveportal_vouchers.php @@ -46,98 +46,103 @@ require("shaper.inc"); require("captiveportal.inc"); require_once("voucher.inc"); +if($_REQUEST['generatekey']) { + exec("openssl genrsa 64 > /tmp/key64.private"); + exec("openssl rsa -pubout < /tmp/key64.private > /tmp/key64.public"); + $privatekey = str_replace("\n", "\\n", file_get_contents("/tmp/key64.private")); + $publickey = str_replace("\n", "\\n", file_get_contents("/tmp/key64.public")); + exec("rm /tmp/key64.private /tmp/key64.public"); + $alertmessage = gettext("You will need to recreate any existing Voucher Rolls due to the public and private key changes. Click cancel if you do not wish to recreate the vouchers."); + echo <<0)) { + if ($_POST['charset'] && (strpos($_POST['charset'],"\"")>0)) $input_errors[] = gettext("Double quotes aren't allowed."); - } - if ($_POST['charset'] && (strpos($_POST['charset'],",")>0)) { + if ($_POST['charset'] && (strpos($_POST['charset'],",")>0)) $input_errors[] = "',' " . gettext("aren't allowed."); - } - if ($_POST['rollbits'] && (!is_numeric($_POST['rollbits']) || ($_POST['rollbits'] < 1) || ($_POST['rollbits'] > 31))) { + if ($_POST['rollbits'] && (!is_numeric($_POST['rollbits']) || ($_POST['rollbits'] < 1) || ($_POST['rollbits'] > 31))) $input_errors[] = gettext("# of Bits to store Roll Id needs to be between 1..31."); - } - if ($_POST['ticketbits'] && (!is_numeric($_POST['ticketbits']) || ($_POST['ticketbits'] < 1) || ($_POST['ticketbits'] > 16))) { + if ($_POST['ticketbits'] && (!is_numeric($_POST['ticketbits']) || ($_POST['ticketbits'] < 1) || ($_POST['ticketbits'] > 16))) $input_errors[] = gettext("# of Bits to store Ticket Id needs to be between 1..16."); - } - if ($_POST['checksumbits'] && (!is_numeric($_POST['checksumbits']) || ($_POST['checksumbits'] < 1) || ($_POST['checksumbits'] > 31))) { + if ($_POST['checksumbits'] && (!is_numeric($_POST['checksumbits']) || ($_POST['checksumbits'] < 1) || ($_POST['checksumbits'] > 31))) $input_errors[] = gettext("# of Bits to store checksum needs to be between 1..31."); - } - if ($_POST['saveinterval'] && (!is_numeric($_POST['saveinterval']) || ($_POST['saveinterval'] < 1))) { + if ($_POST['saveinterval'] && (!is_numeric($_POST['saveinterval']) || ($_POST['saveinterval'] < 1))) $input_errors[] = gettext("Save interval in minutes cant be negative."); - } - if ($_POST['publickey'] && (!strstr($_POST['publickey'],"BEGIN PUBLIC KEY"))) { + if ($_POST['publickey'] && (!strstr($_POST['publickey'],"BEGIN PUBLIC KEY"))) $input_errors[] = gettext("This doesn't look like an RSA Public key."); - } - if ($_POST['privatekey'] && (!strstr($_POST['privatekey'],"BEGIN RSA PRIVATE KEY"))) { + if ($_POST['privatekey'] && (!strstr($_POST['privatekey'],"BEGIN RSA PRIVATE KEY"))) $input_errors[] = gettext("This doesn't look like an RSA Private key."); - } if (!$input_errors) { - $config['voucher']['enable'] = $_POST['enable'] ? true : false; - $config['voucher']['charset'] = $_POST['charset']; - $config['voucher']['rollbits'] = $_POST['rollbits']; - $config['voucher']['ticketbits'] = $_POST['ticketbits']; - $config['voucher']['checksumbits'] = $_POST['checksumbits']; - $config['voucher']['magic'] = $_POST['magic']; - $config['voucher']['saveinterval'] = $_POST['saveinterval']; - $config['voucher']['publickey'] = base64_encode($_POST['publickey']); - $config['voucher']['privatekey'] = base64_encode($_POST['privatekey']); - $config['voucher']['msgnoaccess'] = $_POST['msgnoaccess']; - $config['voucher']['msgexpired'] = $_POST['msgexpired']; - - write_config(); - voucher_configure(); - if (isset($config['voucher']['enable']) && !isset($config['captiveportal']['enable'])) { - $savemsg = gettext("Don't forget to configure and enable Captive Portal."); - } + $config['voucher']['enable'] = $_POST['enable'] ? true : false; + $config['voucher']['charset'] = $_POST['charset']; + $config['voucher']['rollbits'] = $_POST['rollbits']; + $config['voucher']['ticketbits'] = $_POST['ticketbits']; + $config['voucher']['checksumbits'] = $_POST['checksumbits']; + $config['voucher']['magic'] = $_POST['magic']; + $config['voucher']['saveinterval'] = $_POST['saveinterval']; + $config['voucher']['publickey'] = base64_encode($_POST['publickey']); + $config['voucher']['privatekey'] = base64_encode($_POST['privatekey']); + $config['voucher']['msgnoaccess'] = $_POST['msgnoaccess']; + $config['voucher']['msgexpired'] = $_POST['msgexpired']; + $config['voucher']['vouchersyncdbip'] = $_POST['vouchersyncdbip']; + $config['voucher']['vouchersyncport'] = $_POST['vouchersyncport']; + $config['voucher']['vouchersyncusername'] = $_POST['vouchersyncusername']; + $config['voucher']['vouchersyncpass'] = $_POST['vouchersyncpass']; + if($config['voucher']['vouchersyncpass'] && $config['voucher']['vouchersyncusername'] && + $config['voucher']['vouchersyncport'] && $config['voucher']['vouchersyncdbip']) { + // Synchronize the voucher DB from the master node + require_once("xmlrpc.inc"); + if($config['voucher']['vouchersyncport'] == "443") + $url = "https://{$config['voucher']['vouchersyncdbip']}:{$config['voucher']['vouchersyncport']}"; + else + $url = "http://{$config['voucher']['vouchersyncdbip']}:{$config['voucher']['vouchersyncport']}"; + $execcmd = <<setCredentials($config['voucher']['vouchersyncusername'], $config['voucher']['vouchersyncpass']); + $resp = $cli->send($msg, "250"); + if(!$resp) { + $error = "A communications error occurred while attempting CaptivePortalVoucherSync XMLRPC sync with {$url}:{$port} (pfsense.exec_php)."; + log_error($error); + file_notice("CaptivePortalVoucherSync", $error, "Communications error occurred", ""); + $input_errors[] = $error; + } elseif($resp->faultCode()) { + $cli->setDebug(1); + $resp = $cli->send($msg, "250"); + $error = "An error code was received while attempting CaptivePortalVoucherSync XMLRPC sync with {$url}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString(); + log_error($error); + file_notice("CaptivePortalVoucherSync", $error, "Error code received", ""); + $input_errors[] = $error; + } else { + log_error("The Captive Portal voucher database has been synchronized with {$url}:{$port} (pfsense.exec_php)."); + } + $toreturn = XML_RPC_Decode($resp->value()); + if(!is_array($toreturn)) { + if($toreturn == "Authentication failed") + $input_errors[] = "Could not synchronize the voucher database: Authentication Failed."; + } else { + // If we received back the voucher roll and other information then store it. + if($toreturn['voucher']['roll']) + $config['voucher']['roll'] = $toreturn['voucher']['roll']; + if($toreturn['voucher']['rollbits']) + $config['voucher']['rollbits'] = $toreturn['voucher']['rollbits']; + if($toreturn['voucher']['ticketbits']) + $config['voucher']['ticketbits'] = $toreturn['voucher']['ticketbits']; + if($toreturn['voucher']['saveinterval']) + $config['voucher']['saveinterval'] = $toreturn['voucher']['saveinterval']; + if($toreturn['voucher']['checksumbits']) + $config['voucher']['checksumbits'] = $toreturn['voucher']['checksumbits']; + if($toreturn['voucher']['magic']) + $config['voucher']['magic'] = $toreturn['voucher']['magic']; + if($toreturn['voucher']['publickey']) + $config['voucher']['publickey'] = $toreturn['voucher']['publickey']; + if($toreturn['voucher']['privatekey']) + $config['voucher']['privatekey'] = $toreturn['voucher']['privatekey']; + if($toreturn['voucher']['msgnoaccess']) + $config['voucher']['msgnoaccess'] = $toreturn['voucher']['msgnoaccess']; + if($toreturn['voucher']['msgexpired']) + $config['voucher']['msgexpired'] = $toreturn['voucher']['msgexpired']; + if($toreturn['voucher']['msgnoaccess']) + $config['voucher']['msgnoaccess'] = $toreturn['voucher']['msgnoaccess']; + $savemsg = gettext("Voucher database has been synchronized from {$url}"); + } + } + write_config(); + voucher_configure(); + if($savemsg && isset($config['voucher']['enable']) && !isset($config['captiveportal']['enable'])) + $savemsg .= "
"; + if (isset($config['voucher']['enable']) && !isset($config['captiveportal']['enable'])) + $savemsg .= gettext("Don't forget to configure and enable Captive Portal."); } } include("head.inc"); @@ -218,10 +301,34 @@ include("head.inc"); @@ -239,167 +369,225 @@ function enable_change(enable_change) { - + - - - -
-
    +
+
    -
-
- - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  - onClick="enable_change(false)"> -
- - - - - - - - - - - - - - - - - - - - - \"""; - } - ?> - -
##
-   - -   - -   - -   - - - " width="17" height="17" border="0" alt=""> - ')">" width="17" height="17" border="0" alt=""> - " width="11" height="15" border="0" alt=""> - -
- - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + onClick="enable_change(false)"> + +
+ + (Synchronized from {$pconfig['vouchersyncdbip']})"; + ?> + + + + + + + + + + + + + + + + + + + + +
\""
"; + ?> + +
##
+   + +   + +   + +   + + +
+ + + +
+ + + +
+ .
+ +
+ .
+ +
+ +
# + +
+ +
# + +
+ +
# + +
+ +
+ +
+ +
+ +
+ +
+ +
($PORTAL_MESSAGE$). +
+ +
($PORTAL_MESSAGE$). +
  +   +
+ +
+
+ +
+
+ +
+
+ +
+
  + " onClick="enable_change(true); before_save();"> + " onclick="history.back()"> +

+
+ +

+
+
- -
-
- -
-
- -
-
# - -
-
# - -
-
# - -
-
- -
-
- -
-
- -
($PORTAL_MESSAGE$).
- -
($PORTAL_MESSAGE$).
  - " onClick="enable_change(true)"> -

-
- -

-
-
+