Vendor updates
This commit is contained in:
11
inc/vendor/tecnickcom/tcpdf/CHANGELOG.TXT
vendored
11
inc/vendor/tecnickcom/tcpdf/CHANGELOG.TXT
vendored
@ -1,4 +1,13 @@
|
||||
6.2.20
|
||||
6.2.25
|
||||
- Fix support for image URLs.
|
||||
|
||||
6.2.24
|
||||
- Support remote urls when checking if file exists.
|
||||
|
||||
6.2.23
|
||||
- Simplify file_exists function.
|
||||
|
||||
6.2.22
|
||||
- Fix for security vulnerability: Using the phar:// wrapper it was possible to trigger the unserialization of user provided data.
|
||||
|
||||
6.2.19
|
||||
|
2
inc/vendor/tecnickcom/tcpdf/composer.json
vendored
2
inc/vendor/tecnickcom/tcpdf/composer.json
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tecnickcom/tcpdf",
|
||||
"version": "6.2.22",
|
||||
"version": "6.2.26",
|
||||
"homepage": "http://www.tcpdf.org/",
|
||||
"type": "library",
|
||||
"description": "TCPDF is a PHP class for generating PDF documents and barcodes.",
|
||||
|
BIN
inc/vendor/tecnickcom/tcpdf/include/sRGB.icc
vendored
BIN
inc/vendor/tecnickcom/tcpdf/include/sRGB.icc
vendored
Binary file not shown.
@ -2003,7 +2003,11 @@ class TCPDF_FONTS {
|
||||
$chars = str_split($str);
|
||||
$carr = array_map('ord', $chars);
|
||||
}
|
||||
$currentfont['subsetchars'] += array_fill_keys($carr, true);
|
||||
if (is_array($currentfont['subsetchars']) && is_array($carr)) {
|
||||
$currentfont['subsetchars'] += array_fill_keys($carr, true);
|
||||
} else {
|
||||
$currentfont['subsetchars'] = array_merge($currentfont['subsetchars'], $carr);
|
||||
}
|
||||
return $carr;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
220
inc/vendor/tecnickcom/tcpdf/tcpdf.php
vendored
220
inc/vendor/tecnickcom/tcpdf/tcpdf.php
vendored
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
//============================================================+
|
||||
// File name : tcpdf.php
|
||||
// Version : 6.2.22
|
||||
// Version : 6.2.26
|
||||
// Begin : 2002-08-03
|
||||
// Last Update : 2018-09-14
|
||||
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
|
||||
@ -104,7 +104,7 @@
|
||||
* Tools to encode your unicode fonts are on fonts/utils directory.</p>
|
||||
* @package com.tecnick.tcpdf
|
||||
* @author Nicola Asuni
|
||||
* @version 6.2.22
|
||||
* @version 6.2.26
|
||||
*/
|
||||
|
||||
// TCPDF configuration
|
||||
@ -128,7 +128,7 @@ require_once(dirname(__FILE__).'/include/tcpdf_static.php');
|
||||
* TCPDF project (http://www.tcpdf.org) has been originally derived in 2002 from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org), but now is almost entirely rewritten.<br>
|
||||
* @package com.tecnick.tcpdf
|
||||
* @brief PHP class for generating PDF documents without requiring external extensions.
|
||||
* @version 6.2.22
|
||||
* @version 6.2.26
|
||||
* @author Nicola Asuni - info@tecnick.com
|
||||
* @IgnoreAnnotation("protected")
|
||||
* @IgnoreAnnotation("public")
|
||||
@ -5769,10 +5769,9 @@ class TCPDF {
|
||||
$this->resetLastH();
|
||||
}
|
||||
if (!TCPDF_STATIC::empty_string($y)) {
|
||||
$this->SetY($y);
|
||||
} else {
|
||||
$y = $this->GetY();
|
||||
$this->SetY($y); // set y in order to convert negative y values to positive ones
|
||||
}
|
||||
$y = $this->GetY();
|
||||
$resth = 0;
|
||||
if (($h > 0) AND $this->inPageBody() AND (($y + $h + $mc_margin['T'] + $mc_margin['B']) > $this->PageBreakTrigger)) {
|
||||
// spit cell in more pages/columns
|
||||
@ -9648,7 +9647,7 @@ class TCPDF {
|
||||
protected function _putcatalog() {
|
||||
// put XMP
|
||||
$xmpobj = $this->_putXMP();
|
||||
// if required, add standard sRGB_IEC61966-2.1 blackscaled ICC colour profile
|
||||
// if required, add standard sRGB ICC colour profile
|
||||
if ($this->pdfa_mode OR $this->force_srgb) {
|
||||
$iccobj = $this->_newobj();
|
||||
$icc = file_get_contents(dirname(__FILE__).'/include/sRGB.icc');
|
||||
@ -18818,102 +18817,124 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
||||
break;
|
||||
}
|
||||
case 'img': {
|
||||
if (!empty($tag['attribute']['src'])) {
|
||||
if ($tag['attribute']['src'][0] === '@') {
|
||||
// data stream
|
||||
$tag['attribute']['src'] = '@'.base64_decode(substr($tag['attribute']['src'], 1));
|
||||
$type = '';
|
||||
} else {
|
||||
// get image type
|
||||
$type = TCPDF_IMAGES::getImageFileType($tag['attribute']['src']);
|
||||
}
|
||||
if (!isset($tag['width'])) {
|
||||
$tag['width'] = 0;
|
||||
}
|
||||
if (!isset($tag['height'])) {
|
||||
$tag['height'] = 0;
|
||||
}
|
||||
//if (!isset($tag['attribute']['align'])) {
|
||||
// the only alignment supported is "bottom"
|
||||
// further development is required for other modes.
|
||||
$tag['attribute']['align'] = 'bottom';
|
||||
//}
|
||||
switch($tag['attribute']['align']) {
|
||||
case 'top': {
|
||||
$align = 'T';
|
||||
break;
|
||||
}
|
||||
case 'middle': {
|
||||
$align = 'M';
|
||||
break;
|
||||
}
|
||||
case 'bottom': {
|
||||
$align = 'B';
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
$align = 'B';
|
||||
break;
|
||||
}
|
||||
}
|
||||
$prevy = $this->y;
|
||||
$xpos = $this->x;
|
||||
$imglink = '';
|
||||
if (isset($this->HREF['url']) AND !TCPDF_STATIC::empty_string($this->HREF['url'])) {
|
||||
$imglink = $this->HREF['url'];
|
||||
if ($imglink[0] == '#') {
|
||||
// convert url to internal link
|
||||
$lnkdata = explode(',', $imglink);
|
||||
if (isset($lnkdata[0])) {
|
||||
$page = intval(substr($lnkdata[0], 1));
|
||||
if (empty($page) OR ($page <= 0)) {
|
||||
$page = $this->page;
|
||||
}
|
||||
if (isset($lnkdata[1]) AND (strlen($lnkdata[1]) > 0)) {
|
||||
$lnky = floatval($lnkdata[1]);
|
||||
} else {
|
||||
$lnky = 0;
|
||||
}
|
||||
$imglink = $this->AddLink();
|
||||
$this->SetLink($imglink, $lnky, $page);
|
||||
if (empty($tag['attribute']['src'])) {
|
||||
break;
|
||||
}
|
||||
$imgsrc = $tag['attribute']['src'];
|
||||
if ($imgsrc[0] === '@') {
|
||||
// data stream
|
||||
$imgsrc = '@'.base64_decode(substr($imgsrc, 1));
|
||||
$type = '';
|
||||
} else {
|
||||
if (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) {
|
||||
// fix image path
|
||||
$findroot = strpos($imgsrc, $_SERVER['DOCUMENT_ROOT']);
|
||||
if (($findroot === false) OR ($findroot > 1)) {
|
||||
if (substr($_SERVER['DOCUMENT_ROOT'], -1) == '/') {
|
||||
$imgsrc = substr($_SERVER['DOCUMENT_ROOT'], 0, -1).$imgsrc;
|
||||
} else {
|
||||
$imgsrc = $_SERVER['DOCUMENT_ROOT'].$imgsrc;
|
||||
}
|
||||
}
|
||||
}
|
||||
$border = 0;
|
||||
if (isset($tag['border']) AND !empty($tag['border'])) {
|
||||
// currently only support 1 (frame) or a combination of 'LTRB'
|
||||
$border = $tag['border'];
|
||||
}
|
||||
$iw = '';
|
||||
if (isset($tag['width'])) {
|
||||
$iw = $this->getHTMLUnitToUnits($tag['width'], ($tag['fontsize'] / $this->k), 'px', false);
|
||||
}
|
||||
$ih = '';
|
||||
if (isset($tag['height'])) {
|
||||
$ih = $this->getHTMLUnitToUnits($tag['height'], ($tag['fontsize'] / $this->k), 'px', false);
|
||||
}
|
||||
if (($type == 'eps') OR ($type == 'ai')) {
|
||||
$this->ImageEps($tag['attribute']['src'], $xpos, $this->y, $iw, $ih, $imglink, true, $align, '', $border, true);
|
||||
} elseif ($type == 'svg') {
|
||||
$this->ImageSVG($tag['attribute']['src'], $xpos, $this->y, $iw, $ih, $imglink, $align, '', $border, true);
|
||||
} else {
|
||||
$this->Image($tag['attribute']['src'], $xpos, $this->y, $iw, $ih, '', $imglink, $align, false, 300, '', false, false, $border, false, false, true);
|
||||
}
|
||||
switch($align) {
|
||||
case 'T': {
|
||||
$this->y = $prevy;
|
||||
break;
|
||||
$imgsrc = urldecode($imgsrc);
|
||||
$testscrtype = @parse_url($imgsrc);
|
||||
if (empty($testscrtype['query'])) {
|
||||
// convert URL to server path
|
||||
$imgsrc = str_replace(K_PATH_URL, K_PATH_MAIN, $imgsrc);
|
||||
} elseif (preg_match('|^https?://|', $imgsrc) !== 1) {
|
||||
// convert URL to server path
|
||||
$imgsrc = str_replace(K_PATH_MAIN, K_PATH_URL, $imgsrc);
|
||||
}
|
||||
case 'M': {
|
||||
$this->y = (($this->img_rb_y + $prevy - ($this->getCellHeight($tag['fontsize'] / $this->k))) / 2);
|
||||
break;
|
||||
}
|
||||
case 'B': {
|
||||
$this->y = $this->img_rb_y - ($this->getCellHeight($tag['fontsize'] / $this->k) - ($this->getFontDescent($tag['fontname'], $tag['fontstyle'], $tag['fontsize']) * $this->cell_height_ratio));
|
||||
break;
|
||||
}
|
||||
// get image type
|
||||
$type = TCPDF_IMAGES::getImageFileType($imgsrc);
|
||||
}
|
||||
if (!isset($tag['width'])) {
|
||||
$tag['width'] = 0;
|
||||
}
|
||||
if (!isset($tag['height'])) {
|
||||
$tag['height'] = 0;
|
||||
}
|
||||
//if (!isset($tag['attribute']['align'])) {
|
||||
// the only alignment supported is "bottom"
|
||||
// further development is required for other modes.
|
||||
$tag['attribute']['align'] = 'bottom';
|
||||
//}
|
||||
switch($tag['attribute']['align']) {
|
||||
case 'top': {
|
||||
$align = 'T';
|
||||
break;
|
||||
}
|
||||
case 'middle': {
|
||||
$align = 'M';
|
||||
break;
|
||||
}
|
||||
case 'bottom': {
|
||||
$align = 'B';
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
$align = 'B';
|
||||
break;
|
||||
}
|
||||
}
|
||||
$prevy = $this->y;
|
||||
$xpos = $this->x;
|
||||
$imglink = '';
|
||||
if (isset($this->HREF['url']) AND !TCPDF_STATIC::empty_string($this->HREF['url'])) {
|
||||
$imglink = $this->HREF['url'];
|
||||
if ($imglink[0] == '#') {
|
||||
// convert url to internal link
|
||||
$lnkdata = explode(',', $imglink);
|
||||
if (isset($lnkdata[0])) {
|
||||
$page = intval(substr($lnkdata[0], 1));
|
||||
if (empty($page) OR ($page <= 0)) {
|
||||
$page = $this->page;
|
||||
}
|
||||
if (isset($lnkdata[1]) AND (strlen($lnkdata[1]) > 0)) {
|
||||
$lnky = floatval($lnkdata[1]);
|
||||
} else {
|
||||
$lnky = 0;
|
||||
}
|
||||
$imglink = $this->AddLink();
|
||||
$this->SetLink($imglink, $lnky, $page);
|
||||
}
|
||||
}
|
||||
}
|
||||
$border = 0;
|
||||
if (isset($tag['border']) AND !empty($tag['border'])) {
|
||||
// currently only support 1 (frame) or a combination of 'LTRB'
|
||||
$border = $tag['border'];
|
||||
}
|
||||
$iw = '';
|
||||
if (isset($tag['width'])) {
|
||||
$iw = $this->getHTMLUnitToUnits($tag['width'], ($tag['fontsize'] / $this->k), 'px', false);
|
||||
}
|
||||
$ih = '';
|
||||
if (isset($tag['height'])) {
|
||||
$ih = $this->getHTMLUnitToUnits($tag['height'], ($tag['fontsize'] / $this->k), 'px', false);
|
||||
}
|
||||
if (($type == 'eps') OR ($type == 'ai')) {
|
||||
$this->ImageEps($imgsrc, $xpos, $this->y, $iw, $ih, $imglink, true, $align, '', $border, true);
|
||||
} elseif ($type == 'svg') {
|
||||
$this->ImageSVG($imgsrc, $xpos, $this->y, $iw, $ih, $imglink, $align, '', $border, true);
|
||||
} else {
|
||||
$this->Image($imgsrc, $xpos, $this->y, $iw, $ih, '', $imglink, $align, false, 300, '', false, false, $border, false, false, true);
|
||||
}
|
||||
switch($align) {
|
||||
case 'T': {
|
||||
$this->y = $prevy;
|
||||
break;
|
||||
}
|
||||
case 'M': {
|
||||
$this->y = (($this->img_rb_y + $prevy - ($this->getCellHeight($tag['fontsize'] / $this->k))) / 2);
|
||||
break;
|
||||
}
|
||||
case 'B': {
|
||||
$this->y = $this->img_rb_y - ($this->getCellHeight($tag['fontsize'] / $this->k) - ($this->getFontDescent($tag['fontname'], $tag['fontstyle'], $tag['fontsize']) * $this->cell_height_ratio));
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'dl': {
|
||||
@ -24207,9 +24228,12 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
||||
}
|
||||
$img = urldecode($img);
|
||||
$testscrtype = @parse_url($img);
|
||||
if (!isset($testscrtype['query']) OR empty($testscrtype['query'])) {
|
||||
if (empty($testscrtype['query'])) {
|
||||
// convert URL to server path
|
||||
$img = str_replace(K_PATH_URL, K_PATH_MAIN, $img);
|
||||
} elseif (preg_match('|^https?://|', $img) !== 1) {
|
||||
// convert server path to URL
|
||||
$img = str_replace(K_PATH_MAIN, K_PATH_URL, $img);
|
||||
}
|
||||
}
|
||||
// get image type
|
||||
|
Reference in New Issue
Block a user