mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-09-05 17:41:04 +00:00
add method getStreamContext()
This commit is contained in:
parent
c25f0a32be
commit
7d81f5b0f8
|
@ -462,6 +462,29 @@ function getFilenameByDocname($content) { /* {{{ */
|
|||
return mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $filename);
|
||||
} /* }}} */
|
||||
|
||||
function getStreamContext($proxyurl, $proxyuser, $proxypass) { /* {{{ */
|
||||
if(!$proxyurl)
|
||||
return null;
|
||||
$url = parse_url($proxyurl);
|
||||
$opts = [
|
||||
$url['scheme'] => [
|
||||
'proxy' => 'tcp://'.$url['host'].($url['port'] ? ':'.$url['port'] : ''),
|
||||
'request_fulluri' => true,
|
||||
]
|
||||
];
|
||||
if($proxyuser && $proxypass) {
|
||||
$auth = base64_encode($proxyurl.':'.$this->proxypass);
|
||||
$opts[$url['scheme']] = [
|
||||
'header' => [
|
||||
'Proxy-Authorization: Basic '.$auth
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
$context = stream_context_create($opts);
|
||||
return $context;
|
||||
} /* }}} */
|
||||
|
||||
function getLogger($prefix='', $mask=PEAR_LOG_INFO) { /* {{{ */
|
||||
global $settings;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user