/trunk/includes/functions.inc.php |
---|
262,7 → 262,7 |
} |
} |
function url_get_contents($url) { |
function url_get_contents($url, $userAgent='ViaThinkSoft-OIDplus/2.0') { |
if (function_exists('curl_init')) { |
$ch = curl_init(); |
if (class_exists('OIDplus')) { |
269,19 → 269,22 |
if (ini_get('curl.cainfo') == '') curl_setopt($ch, CURLOPT_CAINFO, OIDplus::localpath() . 'vendor/cacert.pem'); |
} |
curl_setopt($ch, CURLOPT_URL, $url); |
curl_setopt($ch, CURLOPT_USERAGENT, 'ViaThinkSoft-OIDplus/2.0'); |
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); |
curl_setopt($ch, CURLOPT_POST, 0); |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
curl_setopt($ch, CURLOPT_AUTOREFERER, true); |
if (!($res = @curl_exec($ch))) return false; |
if (@curl_getinfo($ch, CURLINFO_HTTP_CODE) >= 400) return false; |
$error_code = @curl_getinfo($ch, CURLINFO_HTTP_CODE); |
if ($error_code >= 400) return false; |
@curl_close($ch); |
} else { |
// Attention: HTTPS only works if OpenSSL extension is enabled. |
// Our supplement does not help... |
$opts = [ |
"http" => [ |
"method" => "GET", |
"header" => "User-Agent: ViaThinkSoft-OIDplus/2.0\r\n" |
"header" => "User-Agent: $userAgent\r\n" |
] |
]; |
$context = stream_context_create($opts); |
/trunk/plugins/viathinksoft/adminPages/920_nostalgia/export_dos.php |
---|
123,8 → 123,8 |
} |
$exe_url = 'https://github.com/danielmarschall/oidplus_dos/raw/master/OIDPLUS.EXE'; |
$exe = @file_get_contents($exe_url); |
if ($exe == '') { |
$exe = url_get_contents($exe_url); |
if (!$exe) { |
throw new OIDplusException(_L("Cannot download the binary file from GitHub (%1)", $exe_url)); |
} |
$zip->addFromString('OIDPLUS.EXE', $exe); |
/trunk/plugins/viathinksoft/adminPages/920_nostalgia/export_win.php |
---|
131,15 → 131,15 |
$zip->addFromString('DB//OID.INI', $cont); |
$exe_url = 'https://github.com/danielmarschall/oidplus_win95/raw/master/OIDPLUS.exe'; |
$exe = @file_get_contents($exe_url); |
if ($exe == '') { |
$exe = url_get_contents($exe_url); |
if (!$exe) { |
throw new OIDplusException(_L("Cannot download the binary file from GitHub (%1)", $exe_url)); |
} |
$zip->addFromString('OIDPLS32.EXE', $exe); |
$exe_url = 'https://github.com/danielmarschall/oidplus_win311/raw/master/OIDPLUS.exe'; |
$exe = @file_get_contents($exe_url); |
if ($exe == '') { |
$exe = url_get_contents($exe_url); |
if (!$exe) { |
throw new OIDplusException(_L("Cannot download the binary file from GitHub (%1)", $exe_url)); |
} |
$zip->addFromString('OIDPLS16.EXE', $exe); |
/trunk/plugins/viathinksoft/objectTypes/aid/OIDplusObjectTypePluginAid.class.php |
---|
33,7 → 33,7 |
public function gridGeneratorLinks($objParent) { // Interface 1.3.6.1.4.1.37476.2.5.2.3.6 |
if ($objParent->isRoot()) { |
return '<br><a href="javascript:OIDplusObjectTypePluginAid.generateRandomAID(true)">('._L('Generate a random AID - not unique!').')</a>'. |
return '<br><a href="javascript:OIDplusObjectTypePluginAid.generateRandomAID()">('._L('Generate a random AID - not unique!').')</a>'. |
'<br><a href="https://oidplus.viathinksoft.com/oidplus/?goto=aid%3AD276000186F" target="_blank">('._L('Request a free AID from ViaThinkSoft').')</a>'; |
} else { |
return ''; |
/trunk/plugins/viathinksoft/objectTypes/aid/OIDplusObjectTypePluginAid.js |
---|
19,7 → 19,7 |
OID: "1.3.6.1.4.1.37476.2.5.2.4.8.11", |
generateRandomAID: function(absolute) { |
generateRandomAID: function() { |
var length=15; |
var result = ''; |
var characters = '0123456789ABCDEF'; |
/trunk/polyfill.min.js.php |
---|
65,14 → 65,7 |
$url = 'https://polyfill.io/v3/polyfill.js?features='.urlencode(implode(',',REQUIRED_POLYFILLS)); |
} |
$opts = [ |
"http" => [ |
"method" => "GET", |
"header" => "User-Agent: ".$ua."\r\n" |
] |
]; |
$context = stream_context_create($opts); |
$cont = @file_get_contents($url, false, $context); |
$cont = url_get_contents($url, $ua); |
if ($cont === false) { |
83,7 → 76,7 |
// Instead, try again after the next max cache age |
touch($cache_file); |
} else { |
$out = '/* ERROR: polyfill.io not available and no cache file exists! */'; |
$out = '/* ERROR: polyfill.io ('.$url.') not available and no cache file exists! */'; |
httpOutWithETag($out, 'application/javascript', 'polyfill'.(MINIFY_POLYFILL ? '.min' : '').'.js'); |
} |