Vendor updates
This commit is contained in:
@ -55,7 +55,7 @@ class TCPDF_STATIC {
|
||||
* Current TCPDF version.
|
||||
* @private static
|
||||
*/
|
||||
private static $tcpdf_version = '6.2.22';
|
||||
private static $tcpdf_version = '6.2.26';
|
||||
|
||||
/**
|
||||
* String alias for total number of pages.
|
||||
@ -1821,6 +1821,31 @@ class TCPDF_STATIC {
|
||||
return fopen($filename, $mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the URL exist.
|
||||
* @param url (string) URL to check.
|
||||
* @return Returns TRUE if the URL exists; FALSE otherwise.
|
||||
* @public static
|
||||
*/
|
||||
public static function url_exists($url) {
|
||||
$crs = curl_init();
|
||||
curl_setopt($crs, CURLOPT_URL, $url);
|
||||
curl_setopt($crs, CURLOPT_NOBODY, true);
|
||||
curl_setopt($crs, CURLOPT_FAILONERROR, true);
|
||||
if ((ini_get('open_basedir') == '') && (!ini_get('safe_mode'))) {
|
||||
curl_setopt($crs, CURLOPT_FOLLOWLOCATION, true);
|
||||
}
|
||||
curl_setopt($crs, CURLOPT_CONNECTTIMEOUT, 5);
|
||||
curl_setopt($crs, CURLOPT_TIMEOUT, 30);
|
||||
curl_setopt($crs, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($crs, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($crs, CURLOPT_USERAGENT, 'tc-lib-file');
|
||||
curl_exec($crs);
|
||||
$code = curl_getinfo($crs, CURLINFO_HTTP_CODE);
|
||||
curl_close($crs);
|
||||
return ($code == 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for file_exists.
|
||||
* Checks whether a file or directory exists.
|
||||
@ -1830,20 +1855,11 @@ class TCPDF_STATIC {
|
||||
* @public static
|
||||
*/
|
||||
public static function file_exists($filename) {
|
||||
if (strpos($filename, '://') > 0) {
|
||||
$wrappers = stream_get_wrappers();
|
||||
foreach ($wrappers as $wrapper) {
|
||||
if (($wrapper === 'http') || ($wrapper === 'https')) {
|
||||
continue;
|
||||
}
|
||||
if (stripos($filename, $wrapper.'://') === 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (preg_match('|^https?://|', $filename) == 1) {
|
||||
return self::url_exists($filename);
|
||||
}
|
||||
if (!@file_exists($filename)) {
|
||||
// try to encode spaces on filename
|
||||
$filename = str_replace(' ', '%20', $filename);
|
||||
if (strpos($filename, '://')) {
|
||||
return false; // only support http and https wrappers for security reasons
|
||||
}
|
||||
return @file_exists($filename);
|
||||
}
|
||||
|
Reference in New Issue
Block a user