From f2ca815dbf35c1b3aa85a9bd6978a59718a8cb7a Mon Sep 17 00:00:00 2001 From: nick Date: Sat, 29 Oct 2011 12:48:32 +0100 Subject: [PATCH] 5.9.134 --- CHANGELOG.TXT | 5 ++++ README.TXT | 4 ++-- tcpdf.php | 63 +++++++++++++++++++++++++++------------------------ 3 files changed, 40 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index f4942ff..c08fedb 100755 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -1,3 +1,8 @@ +5.9.134 (2011-10-29) + - The default value for $defcol parameter on convertHTMLColorToDec() method was fixed. + - Deafult HTTP headers were changed to avoid browser caching. + - Some deprecated syntax were replaced. + 5.9.133 (2011-10-26) - Bug item #3428446 "copyPage method not working when diskcache enabled" was fixed. diff --git a/README.TXT b/README.TXT index 7a3ab8b..c764520 100755 --- a/README.TXT +++ b/README.TXT @@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076 ------------------------------------------------------------ Name: TCPDF -Version: 5.9.133 -Release date: 2011-10-26 +Version: 5.9.134 +Release date: 2011-10-29 Author: Nicola Asuni Copyright (c) 2002-2011: diff --git a/tcpdf.php b/tcpdf.php index b9a1772..40c2a3b 100755 --- a/tcpdf.php +++ b/tcpdf.php @@ -1,9 +1,9 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 5.9.133 + * @version 5.9.134 */ // Main configuration file. Define the K_TCPDF_EXTERNAL_CONFIG constant to skip this file. @@ -149,7 +149,7 @@ require_once(dirname(__FILE__).'/config/tcpdf_config.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.
* @package com.tecnick.tcpdf * @brief PHP class for generating PDF documents without requiring external extensions. - * @version 5.9.133 + * @version 5.9.134 * @author Nicola Asuni - info@tecnick.com */ class TCPDF { @@ -160,7 +160,7 @@ class TCPDF { * Current TCPDF version. * @private */ - private $tcpdf_version = '5.9.133'; + private $tcpdf_version = '5.9.134'; // Protected properties @@ -3449,7 +3449,7 @@ class TCPDF { $slen = strlen($brd); $newbrd = array(); for ($i = 0; $i < $slen; ++$i) { - $newbrd[$brd{$i}] = true; + $newbrd[$brd[$i]] = true; } $brd = $newbrd; } elseif (($brd === 1) OR ($brd === true) OR (is_numeric($brd) AND (intval($brd) > 0))) { @@ -6102,7 +6102,7 @@ class TCPDF { $slen = strlen($brd); $newbrd = array(); for ($i = 0; $i < $slen; ++$i) { - $newbrd[$brd{$i}] = array('cap' => 'square', 'join' => 'miter'); + $newbrd[$brd[$i]] = array('cap' => 'square', 'join' => 'miter'); } $brd = $newbrd; } @@ -6623,7 +6623,7 @@ class TCPDF { $slen = strlen($brd); $newbrd = array(); for ($i = 0; $i < $slen; ++$i) { - $newbrd[$brd{$i}] = array('cap' => 'square', 'join' => 'miter'); + $newbrd[$brd[$i]] = array('cap' => 'square', 'join' => 'miter'); } $brd = $newbrd; } @@ -8020,9 +8020,9 @@ class TCPDF { // get ICC sequence length $length = ($this->_getUSHORT($data, ($pos - 2)) - 16); // marker sequence number - $msn = max(1, ord($data{($pos + 12)})); + $msn = max(1, ord($data[($pos + 12)])); // number of markers (total of APP2 used) - $nom = max(1, ord($data{($pos + 13)})); + $nom = max(1, ord($data[($pos + 13)])); // get sequence segment $icc[($msn - 1)] = substr($data, ($pos + 14), $length); // move forward to next sequence @@ -8542,7 +8542,8 @@ class TCPDF { if (headers_sent()) { $this->Error('Some data has already been output to browser, can\'t send PDF file'); } - header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1 + header('Cache-Control: private, must-revalidate, post-check=0, pre-check=0, max-age=1'); + //header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1 header('Pragma: public'); header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); @@ -8562,7 +8563,8 @@ class TCPDF { if (headers_sent()) { $this->Error('Some data has already been output to browser, can\'t send PDF file'); } - header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1 + header('Cache-Control: private, must-revalidate, post-check=0, pre-check=0, max-age=1'); + //header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1 header('Pragma: public'); header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); @@ -8598,7 +8600,8 @@ class TCPDF { if ($dest == 'FI') { // send headers to browser header('Content-Type: application/pdf'); - header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1 + header('Cache-Control: private, must-revalidate, post-check=0, pre-check=0, max-age=1'); + //header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1 header('Pragma: public'); header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); @@ -8613,7 +8616,7 @@ class TCPDF { if (headers_sent()) { $this->Error('Some data has already been output to browser, can\'t send PDF file'); } - header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1 + header('Cache-Control: private, must-revalidate, post-check=0, pre-check=0, max-age=1'); header('Pragma: public'); header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); @@ -9804,8 +9807,8 @@ class TCPDF { if ($gid > 0xFFFF) { $gid -= 0x10000; } - $map{($cid * 2)} = chr($gid >> 8); - $map{(($cid * 2) + 1)} = chr($gid & 0xFF); + $map[($cid * 2)] = chr($gid >> 8); + $map[(($cid * 2) + 1)] = chr($gid & 0xFF); } return $map; } @@ -9973,7 +9976,7 @@ class TCPDF { $elen = strlen($encrypted); $eplain = ''; for ($i = 0; $i < $elen; ++$i) { - $chr = ord($encrypted{$i}); + $chr = ord($encrypted[$i]); $eplain .= chr($chr ^ ($r >> 8)); $r = ((($chr + $r) * $c1 + $c2) % 65536); } @@ -10050,7 +10053,7 @@ class TCPDF { $clen = strlen($cd); $ccom = array(); for ($i = 0; $i < $clen; ++$i) { - $chr = ord($cd{$i}); + $chr = ord($cd[$i]); $ccom[] = ($chr ^ ($r >> 8)); $r = ((($chr + $r) * $c1 + $c2) % 65536); } @@ -11253,7 +11256,7 @@ class TCPDF { // strip first binary header $font = substr($font, 6); } - if ($header AND (ord($font{$info['length1']}) == 128)) { + if ($header AND (ord($font[$info['length1']]) == 128)) { // strip second binary header $font = substr($font, 0, $info['length1']).substr($font, ($info['length1'] + 6)); } @@ -13085,7 +13088,7 @@ class TCPDF { $strarr = array(); $strlen = strlen($str); for ($i=0; $i < $strlen; ++$i) { - $strarr[] = ord($str{$i}); + $strarr[] = ord($str[$i]); } // insert new value on cache $this->cache_UTF8StringToArray[$strkey]['s'] = $strarr; @@ -13099,7 +13102,7 @@ class TCPDF { $str .= ''; // force $str to be a string $length = strlen($str); for ($i = 0; $i < $length; ++$i) { - $char = ord($str{$i}); // get one string character at time + $char = ord($str[$i]); // get one string character at time if (count($bytes) == 0) { // get starting octect if ($char <= 0x7F) { $unichar = $char; // use the character "as is" because is ASCII @@ -13425,7 +13428,7 @@ class TCPDF { * @return array RGB or CMYK color, or false in case of error. * @public */ - public function convertHTMLColorToDec($hcolor='#FFFFFF', $defcol=array(128,128,128)) { + public function convertHTMLColorToDec($hcolor='#FFFFFF', $defcol=array('R'=>128,'G'=>128,'B'=>128)) { $color = preg_replace('/[\s]*/', '', $hcolor); // remove extra spaces $color = strtolower($color); if (($dotpos = strpos($color, '.')) !== false) { @@ -13785,7 +13788,7 @@ class TCPDF { $j = 0; for ($i = 0; $i < 256; ++$i) { $t = $rc4[$i]; - $j = ($j + $t + ord($k{$i})) % 256; + $j = ($j + $t + ord($k[$i])) % 256; $rc4[$i] = $rc4[$j]; $rc4[$j] = $t; } @@ -13805,7 +13808,7 @@ class TCPDF { $rc4[$a] = $rc4[$b]; $rc4[$b] = $t; $k = $rc4[($rc4[$a] + $rc4[$b]) % 256]; - $out .= chr(ord($text{$i}) ^ $k); + $out .= chr(ord($text[$i]) ^ $k); } return $out; } @@ -13859,7 +13862,7 @@ class TCPDF { for ($i = 1; $i <= 19; ++$i) { $ek = ''; for ($j = 0; $j < $len; ++$j) { - $ek .= chr(ord($this->encryptdata['key']{$j}) ^ $i); + $ek .= chr(ord($this->encryptdata['key'][$j]) ^ $i); } $enc = $this->_RC4($ek, $enc); } @@ -13910,7 +13913,7 @@ class TCPDF { for ($i = 1; $i <= 19; ++$i) { $ek = ''; for ($j = 0; $j < $len; ++$j) { - $ek .= chr(ord($owner_key{$j}) ^ $i); + $ek .= chr(ord($owner_key[$j]) ^ $i); } $enc = $this->_RC4($ek, $enc); } @@ -14229,7 +14232,7 @@ class TCPDF { ++$bslength; } for ($i = 0; $i < $bslength; $i += 2) { - $string .= chr(hexdec($bs{$i}.$bs{($i + 1)})); + $string .= chr(hexdec($bs[$i].$bs[($i + 1)])); } return $string; } @@ -16087,7 +16090,7 @@ class TCPDF { $escname = ''; $length = strlen($name); for ($i = 0; $i < $length; ++$i) { - $chr = $name{$i}; + $chr = $name[$i]; if (preg_match('/[0-9a-zA-Z]/', $chr) == 1) { $escname .= $chr; } else { @@ -19045,7 +19048,7 @@ class TCPDF { if ($skip) { break; } - $line{$len-1} = strtolower($cmd); + $line[($len - 1)] = strtolower($cmd); $this->_out($line); break; } @@ -22026,7 +22029,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if (($stroffset !== false) AND ($stroffset <= $strpiece[2][1])) { // set offset to the end of string section $offset = strpos($pmid, ')]', $stroffset); - while (($offset !== false) AND ($pmid{($offset - 1)} == '\\')) { + while (($offset !== false) AND ($pmid[($offset - 1)] == '\\')) { $offset = strpos($pmid, ')]', ($offset + 1)); } if ($offset === false) {