|
@@ -67,7 +67,7 @@ discard block |
|
|
block discarded – undo |
|
67
|
67
|
print $nvpStr; |
|
68
|
68
|
exit;*/ |
|
69
|
69
|
curl_setopt($ch, CURLOPT_VERBOSE, 1); |
|
70
|
|
- curl_setopt($ch, CURLOPT_USERAGENT, 'Dolibarr geturl function'); // set the Dolibarr user agent name |
|
|
70
|
+ curl_setopt($ch, CURLOPT_USERAGENT, 'Dolibarr geturl function'); // set the Dolibarr user agent name |
|
71
|
71
|
|
|
72
|
72
|
// We use @ here because this may return warning if safe mode is on or open_basedir is on (following location is forbidden when safe mode is on). |
|
73
|
73
|
// We force value to false so we will manage redirection ourself later. |
|
@@ -89,7 +89,7 @@ discard block |
|
|
block discarded – undo |
|
89
|
89
|
// Turning on or off the ssl target certificate |
|
90
|
90
|
if ($ssl_verifypeer < 0) { |
|
91
|
91
|
global $dolibarr_main_prod; |
|
92
|
|
- $ssl_verifypeer = ($dolibarr_main_prod ? true : false); |
|
|
92
|
+ $ssl_verifypeer = ($dolibarr_main_prod ? true : false); |
|
93
|
93
|
} |
|
94
|
94
|
if (getDolGlobalString('MAIN_CURL_DISABLE_VERIFYPEER')) { |
|
95
|
95
|
$ssl_verifypeer = 0; |
|
@@ -131,7 +131,7 @@ discard block |
|
|
block discarded – undo |
|
131
|
131
|
// limit size of downloaded files. |
|
132
|
132
|
$maxsize = getDolGlobalInt('MAIN_SECURITY_MAXFILESIZE_DOWNLOADED'); |
|
133
|
133
|
if ($maxsize && defined('CURLOPT_MAXFILESIZE_LARGE')) { |
|
134
|
|
- curl_setopt($ch, CURLOPT_MAXFILESIZE_LARGE, $maxsize * 1024); // @phan-suppress-current-line PhanTypeMismatchArgumentNullableInternal |
|
|
134
|
+ curl_setopt($ch, CURLOPT_MAXFILESIZE_LARGE, $maxsize * 1024); // @phan-suppress-current-line PhanTypeMismatchArgumentNullableInternal |
|
135
|
135
|
} |
|
136
|
136
|
if ($maxsize && defined('CURLOPT_MAXFILESIZE')) { |
|
137
|
137
|
curl_setopt($ch, CURLOPT_MAXFILESIZE, $maxsize * 1024); |
|
@@ -149,7 +149,7 @@ discard block |
|
|
block discarded – undo |
|
149
|
149
|
$array_param = null; |
|
150
|
150
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT' |
|
151
|
151
|
if (!is_array($param)) { |
|
152
|
|
- parse_str($param, $array_param); // @phan-suppress-current-line PhanPluginConstantVariableNull |
|
|
152
|
+ parse_str($param, $array_param); // @phan-suppress-current-line PhanPluginConstantVariableNull |
|
153
|
153
|
} else { |
|
154
|
154
|
dol_syslog("parameter param must be a string", LOG_WARNING); |
|
155
|
155
|
$array_param = $param; |
|
@@ -251,7 +251,7 @@ discard block |
|
|
block discarded – undo |
|
251
|
251
|
*/ |
|
252
|
252
|
|
|
253
|
253
|
// Getting response from server |
|
254
|
|
- $response = curl_exec($ch); // return false on error, result on success |
|
|
254
|
+ $response = curl_exec($ch); // return false on error, result on success |
|
255
|
255
|
|
|
256
|
256
|
$info = curl_getinfo($ch); // Reading of request must be done after sending request |
|
257
|
257
|
$http_code = $info['http_code']; |
|
@@ -405,10 +405,10 @@ discard block |
|
|
block discarded – undo |
|
405
|
405
|
$mode++; |
|
406
|
406
|
} |
|
407
|
407
|
|
|
408
|
|
- $tmpdomain = preg_replace('/^https?:\/\/[^:]+:[^@]+@/i', '', $url); // Remove http(s)://login@pass in https://login@pass:mydomain.com/path, so we now got mydomain.com/path |
|
409
|
|
- $tmpdomain = preg_replace('/^https?:\/\//i', '', $tmpdomain); // Remove http(s):// |
|
410
|
|
- $tmpdomain = preg_replace('/\/.*$/i', '', $tmpdomain); // Remove part after / |
|
411
|
|
- $tmpdomain = preg_replace('/^[^@]+@/i', '', $tmpdomain); // Remove part1@ in part1@part2 (for emails) |
|
|
408
|
+ $tmpdomain = preg_replace('/^https?:\/\/[^:]+:[^@]+@/i', '', $url); // Remove http(s)://login@pass in https://login@pass:mydomain.com/path, so we now got mydomain.com/path |
|
|
409
|
+ $tmpdomain = preg_replace('/^https?:\/\//i', '', $tmpdomain); // Remove http(s):// |
|
|
410
|
+ $tmpdomain = preg_replace('/\/.*$/i', '', $tmpdomain); // Remove part after / |
|
|
411
|
+ $tmpdomain = preg_replace('/^[^@]+@/i', '', $tmpdomain); // Remove part1@ in part1@part2 (for emails) |
|
412
|
412
|
if ($mode == 3) { |
|
413
|
413
|
$tmpdomain = preg_replace('/^.*\.([^\.]+)\.([^\.]+)\.([^\.]+)\.([^\.]+)$/', '\1.\2.\3.\4', $tmpdomain); |
|
414
|
414
|
} elseif ($mode == 2) { |