aboutsummaryrefslogtreecommitdiffstats
path: root/config/autoconfigbackup/autoconfigbackup.inc
diff options
context:
space:
mode:
authorManuel Silvoso <msilvoso@gmail.com>2014-07-25 23:06:43 +0200
committerManuel Silvoso <msilvoso@gmail.com>2014-07-25 23:06:43 +0200
commit2fb2c17eef49225706b2fb1d4bd522dea58ce982 (patch)
tree6ba00c95bdeb35ad76776dce5e635ba0747be244 /config/autoconfigbackup/autoconfigbackup.inc
parentc4f7014bba0bb82b21025afe02f2ec04039e0cf2 (diff)
downloadpfsense-packages-2fb2c17eef49225706b2fb1d4bd522dea58ce982.tar.gz
pfsense-packages-2fb2c17eef49225706b2fb1d4bd522dea58ce982.tar.bz2
pfsense-packages-2fb2c17eef49225706b2fb1d4bd522dea58ce982.zip
Requested changes
Diffstat (limited to 'config/autoconfigbackup/autoconfigbackup.inc')
-rw-r--r--config/autoconfigbackup/autoconfigbackup.inc29
1 files changed, 15 insertions, 14 deletions
diff --git a/config/autoconfigbackup/autoconfigbackup.inc b/config/autoconfigbackup/autoconfigbackup.inc
index 30e4bed4..2c9d18f9 100644
--- a/config/autoconfigbackup/autoconfigbackup.inc
+++ b/config/autoconfigbackup/autoconfigbackup.inc
@@ -68,18 +68,19 @@ function custom_php_validation_command($post, &$input_errors) {
unset($_POST['testconnection']);
}
-function configure_proxy($config) {
- $ret = array();
- if (!empty($config['system']['proxyurl'])) {
- $ret[CURLOPT_PROXY] = $config['system']['proxyurl'];
- if (!empty($config['system']['proxyport']))
- $ret[CURLOPT_PROXYPORT] = $config['system']['proxyport'];
- if (!empty($config['system']['proxyuser']) && !empty($config['system']['proxypass'])) {
- $ret[CURLOPT_PROXYAUTH] = CURLAUTH_ANY | CURLAUTH_ANYSAFE;
- $ret[CURLOPT_PROXYUSERPWD] = "{$config['system']['proxyuser']}:{$config['system']['proxypass']}";
- }
- }
- return $ret;
+function configure_proxy() {
+ global $config;
+ $ret = array();
+ if (!empty($config['system']['proxyurl'])) {
+ $ret[CURLOPT_PROXY] = $config['system']['proxyurl'];
+ if (!empty($config['system']['proxyport']))
+ $ret[CURLOPT_PROXYPORT] = $config['system']['proxyport'];
+ if (!empty($config['system']['proxyuser']) && !empty($config['system']['proxypass'])) {
+ $ret[CURLOPT_PROXYAUTH] = CURLAUTH_ANY | CURLAUTH_ANYSAFE;
+ $ret[CURLOPT_PROXYUSERPWD] = "{$config['system']['proxyuser']}:{$config['system']['proxypass']}";
+ }
+ }
+ return $ret;
}
function test_connection($post) {
@@ -118,7 +119,7 @@ function test_connection($post) {
curl_setopt($curl_session, CURLOPT_TIMEOUT, 30);
curl_setopt($curl_session, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/etc/version")));
// Proxy
- curl_setopt_array($curl_session, configure_proxy($config));
+ curl_setopt_array($curl_session, configure_proxy());
curl_setopt($curl_session, CURLOPT_POSTFIELDS, "action=showbackups&hostname={$hostname}");
$data = curl_exec($curl_session);
@@ -228,7 +229,7 @@ function upload_config($reasonm = "") {
curl_setopt($curl_session, CURLOPT_TIMEOUT, 30);
curl_setopt($curl_session, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/etc/version")));
// Proxy
- curl_setopt_array($curl_session, configure_proxy($config));
+ curl_setopt_array($curl_session, configure_proxy());
$data = curl_exec($curl_session);
if (curl_errno($curl_session)) {