Skip to content

Commit

Permalink
Merge pull request #290 from tecnickcom/develop
Browse files Browse the repository at this point in the history
Various fixes
  • Loading branch information
nicolaasuni committed Apr 1, 2020
2 parents 204f46e + 780a7b5 commit a84d816
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 163 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.2.1
14.2.2
7 changes: 6 additions & 1 deletion shared/code/tce_functions_general.php
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,12 @@ function F_html_to_TSV($str)
$str = str_replace('→', '-', $str);
$str = str_replace('↓', '', $str);
$str = str_replace("\t", ' ', $str);
$str = preg_replace_callback('/colspan="([0-9]*)"/x', create_function('$matches', 'if ($matches[1] > 1) {return str_repeat("></td><td", ($matches[1] - 1));} return "";'), $str);
$str = preg_replace_callback('/colspan="([0-9]*)"/x', function($match) {
if ($match[1] > 1) {
return str_repeat('></td><td', ($match[1] - 1));
}
return '';
}, $str);
$str = str_replace("\r\n", "\n", $str);
$str = str_replace("\$", $dollar_replacement, $str); //replace special character
//remove newlines
Expand Down
8 changes: 4 additions & 4 deletions shared/config.default/tce_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
//============================================================+
// File name : tce_config.php
// Begin : 2002-02-24
// Last Update : 2019-04-30
// Last Update : 2020-04-01
//
// Description : Shared configuration file.
//
// Author: Nicola Asuni
//
// (c) Copyright 2004-2019:
// (c) Copyright 2004-2020:
// Nicola Asuni
// Tecnick.com LTD
// UK
// www.tecnick.com
// info@tecnick.com
//
// License:
// Copyright (C) 2004-2019 Nicola Asuni - Tecnick.com LTD
// Copyright (C) 2004-2020 Nicola Asuni - Tecnick.com LTD
// See LICENSE.TXT file for more information.
//============================================================+

Expand Down Expand Up @@ -304,7 +304,7 @@
// --- get 'post', 'get' and 'cookie' variables
foreach ($_REQUEST as $postkey => $postvalue) {
if (($postkey[0] != '_') and (!preg_match('/[A-Z]/', $postkey[0]))) {
if (!function_exists('get_magic_quotes_gpc') or !get_magic_quotes_gpc()) {
if (!function_exists('get_magic_quotes_gpc') or (PHP_VERSION_ID >= 70400) or !get_magic_quotes_gpc()) {
$postvalue = addSlashesArray($postvalue);
$_REQUEST[$postkey] = $postvalue;
if (isset($_GET[$postkey])) {
Expand Down
117 changes: 0 additions & 117 deletions shared/tcpdf/README.TXT

This file was deleted.

2 changes: 1 addition & 1 deletion shared/tcpdf/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.3.2
6.3.5
4 changes: 2 additions & 2 deletions shared/tcpdf/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tecnickcom/tcpdf",
"version": "6.3.2",
"version": "6.3.5",
"homepage": "http://www.tcpdf.org/",
"type": "library",
"description": "TCPDF is a PHP class for generating PDF documents and barcodes.",
Expand All @@ -13,7 +13,7 @@
"pdf417",
"barcodes"
],
"license": "LGPL-3.0",
"license": "LGPL-3.0-only",
"authors": [
{
"name": "Nicola Asuni",
Expand Down
2 changes: 1 addition & 1 deletion shared/tcpdf/include/barcodes/datamatrix.php
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ protected function lookAheadTest($data, $pos, $mode) {
if ($numch[ENC_C40] == $numch[ENC_X12]) {
$k = ($pos + $charscount + 1);
while ($k < $data_length) {
$tmpchr = ord($data{$k});
$tmpchr = ord($data[$k]);
if ($this->isCharMode($tmpchr, ENC_X12)) {
return ENC_X12;
} elseif (!($this->isCharMode($tmpchr, ENC_X12) OR $this->isCharMode($tmpchr, ENC_C40))) {
Expand Down
6 changes: 3 additions & 3 deletions shared/tcpdf/include/barcodes/pdf417.php
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ protected function getCompaction($mode, $code, $addmode=true) {
$txtarr = array(); // array of characters and sub-mode switching characters
$codelen = strlen($code);
for ($i = 0; $i < $codelen; ++$i) {
$chval = ord($code{$i});
$chval = ord($code[$i]);
if (($k = array_search($chval, $this->textsubmodes[$submode])) !== false) {
// we are on the same sub-mode
$txtarr[] = $k;
Expand All @@ -888,7 +888,7 @@ protected function getCompaction($mode, $code, $addmode=true) {
// search new sub-mode
if (($s != $submode) AND (($k = array_search($chval, $this->textsubmodes[$s])) !== false)) {
// $s is the new submode
if (((($i + 1) == $codelen) OR ((($i + 1) < $codelen) AND (array_search(ord($code{($i + 1)}), $this->textsubmodes[$submode]) !== false))) AND (($s == 3) OR (($s == 0) AND ($submode == 1)))) {
if (((($i + 1) == $codelen) OR ((($i + 1) < $codelen) AND (array_search(ord($code[($i + 1)]), $this->textsubmodes[$submode]) !== false))) AND (($s == 3) OR (($s == 0) AND ($submode == 1)))) {
// shift (temporary change only for this char)
if ($s == 3) {
// shift to puntuaction
Expand Down Expand Up @@ -952,7 +952,7 @@ protected function getCompaction($mode, $code, $addmode=true) {
$cw = array_merge($cw, $cw6);
} else {
for ($i = 0; $i < $sublen; ++$i) {
$cw[] = ord($code{$i});
$cw[] = ord($code[$i]);
}
}
$code = $rest;
Expand Down
28 changes: 25 additions & 3 deletions shared/tcpdf/include/tcpdf_static.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
//============================================================+
// File name : tcpdf_static.php
// Version : 1.1.3
// Version : 1.1.4
// Begin : 2002-08-03
// Last Update : 2015-04-28
// Last Update : 2019-11-01
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
Expand Down Expand Up @@ -55,7 +55,7 @@ class TCPDF_STATIC {
* Current TCPDF version.
* @private static
*/
private static $tcpdf_version = '6.3.2';
private static $tcpdf_version = '6.3.5';

/**
* String alias for total number of pages.
Expand Down Expand Up @@ -1829,6 +1829,8 @@ public static function fopenLocal($filename, $mode) {
*/
public static function url_exists($url) {
$crs = curl_init();
// encode query params in URL to get right response form the server
$url = self::encodeUrlQuery($url);
curl_setopt($crs, CURLOPT_URL, $url);
curl_setopt($crs, CURLOPT_NOBODY, true);
curl_setopt($crs, CURLOPT_FAILONERROR, true);
Expand All @@ -1846,6 +1848,26 @@ public static function url_exists($url) {
return ($code == 200);
}

/**
* Encode query params in URL
*
* @param string $url
* @return string
* @since 6.3.3 (2019-11-01)
* @public static
*/
public static function encodeUrlQuery($url) {
$urlData = parse_url($url);
if (isset($urlData['query']) && $urlData['query']) {
$urlQueryData = array();
parse_str(urldecode($urlData['query']), $urlQueryData);
$updatedUrl = $urlData['scheme'] . '://' . $urlData['host'] . $urlData['path'] . '?' . http_build_query($urlQueryData);
} else {
$updatedUrl = $url;
}
return $updatedUrl;
}

/**
* Wrapper for file_exists.
* Checks whether a file or directory exists.
Expand Down

0 comments on commit a84d816

Please sign in to comment.