diff options
-rw-r--r-- | etc/inc/voucher.inc | 21 | ||||
-rw-r--r-- | usr/local/www/services_captiveportal_vouchers.php | 7 |
2 files changed, 24 insertions, 4 deletions
diff --git a/etc/inc/voucher.inc b/etc/inc/voucher.inc index 5b392bb..e19e121 100644 --- a/etc/inc/voucher.inc +++ b/etc/inc/voucher.inc @@ -40,7 +40,12 @@ if(!function_exists('captiveportal_syslog')) function xmlrpc_sync_voucher_expire($vouchers, $syncip, $port, $password, $username) { global $g, $config, $cpzone; require_once("xmlrpc.inc"); - if ($port == "443") + + $protocol = "http"; + if (is_array($config['system']) && is_array($config['system']['webgui']) && !empty($config['system']['webgui']['protocol']) && + $config['system']['webgui']['protocol'] == "https") + $protocol = "https"; + if ($protocol == "https" || $port == "443") $url = "https://{$syncip}"; else $url = "http://{$syncip}"; @@ -88,7 +93,12 @@ EOF; function xmlrpc_sync_voucher_disconnect($dbent, $syncip, $port, $password, $username, $term_cause = 1, $stop_time = null) { global $g, $config, $cpzone; require_once("xmlrpc.inc"); - if ($port == "443") + + $protocol = "http"; + if (is_array($config['system']) && is_array($config['system']['webgui']) && !empty($config['system']['webgui']['protocol']) && + $config['system']['webgui']['protocol'] == "https") + $protocol = "https"; + if ($protocol == "https" || $port == "443") $url = "https://{$syncip}"; else $url = "http://{$syncip}"; @@ -140,7 +150,12 @@ EOF; function xmlrpc_sync_used_voucher($voucher_received, $syncip, $port, $password, $username) { global $g, $config, $cpzone; require_once("xmlrpc.inc"); - if ($port == "443") + + $protocol = "http"; + if (is_array($config['system']) && is_array($config['system']['webgui']) && !empty($config['system']['webgui']['protocol']) && + $config['system']['webgui']['protocol'] == "https") + $protocol = "https"; + if ($protocol == "https" || $port == "443") $url = "https://{$syncip}"; else $url = "http://{$syncip}"; diff --git a/usr/local/www/services_captiveportal_vouchers.php b/usr/local/www/services_captiveportal_vouchers.php index c2f154f..4490b1b 100644 --- a/usr/local/www/services_captiveportal_vouchers.php +++ b/usr/local/www/services_captiveportal_vouchers.php @@ -274,7 +274,12 @@ if ($_POST) { $newvoucher['vouchersyncport'] && $newvoucher['vouchersyncdbip']) { // Synchronize the voucher DB from the master node require_once("xmlrpc.inc"); - if($newvoucher['vouchersyncport'] == "443") + + $protocol = "http"; + if (is_array($config['system']) && is_array($config['system']['webgui']) && !empty($config['system']['webgui']['protocol']) && + $config['system']['webgui']['protocol'] == "https") + $protocol = "https"; + if ($protocol == "https" || $newvoucher['vouchersyncport'] == "443") $url = "https://{$newvoucher['vouchersyncdbip']}"; else $url = "http://{$newvoucher['vouchersyncdbip']}"; |