projects
/
fa-stable.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
GL Account in Company Defaults missing for test. Fixed
[fa-stable.git]
/
reporting
/
includes
/
tcpdf.php
diff --git
a/reporting/includes/tcpdf.php
b/reporting/includes/tcpdf.php
index 803416a89396111855d865e50df1725f1a8b1dfd..0d3d210844778657df5a846ceb3617f2b86d11b6 100644
(file)
--- a/
reporting/includes/tcpdf.php
+++ b/
reporting/includes/tcpdf.php
@@
-177,6
+177,17
@@
require_once(dirname(__FILE__)."/barcodes.php");
*/
require_once(dirname(__FILE__)."/html_entity_decode_php4.php");
*/
require_once(dirname(__FILE__)."/html_entity_decode_php4.php");
+//
+// Check image file format against specific TCPDF engine requirements.
+//
+function check_image_file($filename)
+{
+ $test = new TCPDF();
+ if ( !$test->Image($filename, 0, 0) )
+ return _('Unsupported image file format.');
+ return '';
+}
+
if (!class_exists('TCPDF')) {
/**
* define default PDF document producer
if (!class_exists('TCPDF')) {
/**
* define default PDF document producer
@@
-613,7
+624,7
@@
if (!class_exists('TCPDF')) {
* @var Header font.
* @access protected
*/
* @var Header font.
* @access protected
*/
- var $header_font;
+ var $header_font
= array('helvetica', '', 12)
;
/**
* @var Footer font.
/**
* @var Footer font.
@@
-1124,7
+1135,8
@@
if (!class_exists('TCPDF')) {
mb_internal_encoding("ASCII");
}
// set language direction
mb_internal_encoding("ASCII");
}
// set language direction
- $this->rtl = $this->l['a_meta_dir']=='rtl' ? true : false;
+
+ $this->rtl = @$this->l['a_meta_dir']=='rtl' ? true : false;
$this->tmprtl = false;
//Some checks
$this->_dochecks();
$this->tmprtl = false;
//Some checks
$this->_dochecks();
@@
-3520,6
+3532,8
@@
if (!class_exists('TCPDF')) {
function unichr($c) {
if (!$this->isunicode) {
return chr($c);
function unichr($c) {
if (!$this->isunicode) {
return chr($c);
+ } elseif ($c == '') {
+ return '';
} elseif ($c <= 0x7F) {
// one byte
return chr($c);
} elseif ($c <= 0x7F) {
// one byte
return chr($c);
@@
-3704,6
+3718,7
@@
if (!class_exists('TCPDF')) {
}
}
$this->endlinex = $this->img_rb_x;
}
}
$this->endlinex = $this->img_rb_x;
+ return $info;
}
/**
}
/**
@@
-4514,12
+4529,12
@@
if (!class_exists('TCPDF')) {
$font = file_get_contents($this->_getfontpath().strtolower($file));
$compressed = (substr($file,-2)=='.z');
if ((!$compressed) AND (isset($info['length2']))) {
$font = file_get_contents($this->_getfontpath().strtolower($file));
$compressed = (substr($file,-2)=='.z');
if ((!$compressed) AND (isset($info['length2']))) {
- $header = (ord($font
{0}
) == 128);
+ $header = (ord($font
[0]
) == 128);
if ($header) {
//Strip first binary header
$font = substr($font,6);
}
if ($header) {
//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);
}
//Strip second binary header
$font = substr($font, 0, $info['length1']).substr($font, $info['length1']+6);
}
@@
-5395,7
+5410,7
@@
if (!class_exists('TCPDF')) {
$strarr = array();
$strlen = strlen($str);
for($i=0; $i < $strlen; $i++) {
$strarr = array();
$strlen = strlen($str);
for($i=0; $i < $strlen; $i++) {
- $strarr[] = ord($str
{$i}
);
+ $strarr[] = ord($str
[$i]
);
}
return $strarr;
}
}
return $strarr;
}
@@
-5405,7
+5420,7
@@
if (!class_exists('TCPDF')) {
$str .= ""; // force $str to be a string
$length = strlen($str);
for($i = 0; $i < $length; $i++) {
$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) {
$unicode[] = $char; // use the character "as is" because is ASCII
if (count($bytes) == 0) { // get starting octect
if ($char <= 0x7F) {
$unicode[] = $char; // use the character "as is" because is ASCII
@@
-5774,7
+5789,7
@@
if (!class_exists('TCPDF')) {
$j = 0;
for ($i=0; $i < 256; $i++) {
$t = $rc4[$i];
$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;
}
$rc4[$i] = $rc4[$j];
$rc4[$j] = $t;
}
@@
-5794,7
+5809,7
@@
if (!class_exists('TCPDF')) {
$rc4[$a] = $rc4[$b];
$rc4[$b] = $t;
$k = $rc4[($rc4[$a] + $rc4[$b]) % 256];
$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;
}
}
return $out;
}
@@
-8642,7
+8657,7
@@
if (!class_exists('TCPDF')) {
$cnt = count($lines);
for ($i=0; $i < $cnt; $i++) {
$line = $lines[$i];
$cnt = count($lines);
for ($i=0; $i < $cnt; $i++) {
$line = $lines[$i];
- if (($line == '') OR ($line
{0}
== '%')) {
+ if (($line == '') OR ($line
[0]
== '%')) {
continue;
}
$len = strlen($line);
continue;
}
$len = strlen($line);
@@
-8693,7
+8708,7
@@
if (!class_exists('TCPDF')) {
case 'V':
case 'L':
case 'C': {
case 'V':
case 'L':
case 'C': {
- $line
{$len-1}
= strtolower($cmd);
+ $line
[$len-1]
= strtolower($cmd);
$this->_out($line);
break;
}
$this->_out($line);
break;
}
@@
-9191,7
+9206,7
@@
if (!class_exists('TCPDF')) {
// get tag name
preg_match('/[\/]?([a-zA-Z0-9]*)/', $element, $tag);
$dom[$key]['value'] = strtolower($tag[1]);
// get tag name
preg_match('/[\/]?([a-zA-Z0-9]*)/', $element, $tag);
$dom[$key]['value'] = strtolower($tag[1]);
- if ($element
{0}
== '/') {
+ if ($element
[0]
== '/') {
// closing html tag
$dom[$key]['opening'] = false;
$dom[$key]['parent'] = end($level);
// closing html tag
$dom[$key]['opening'] = false;
$dom[$key]['parent'] = end($level);
@@
-9300,10
+9315,10
@@
if (!class_exists('TCPDF')) {
}
// font style
$dom[$key]['fontstyle'] = "";
}
// font style
$dom[$key]['fontstyle'] = "";
- if (isset($dom[$key]['style']['font-weight']) AND (strtolower($dom[$key]['style']['font-weight']
{0}
) == "b")) {
+ if (isset($dom[$key]['style']['font-weight']) AND (strtolower($dom[$key]['style']['font-weight']
[0]
) == "b")) {
$dom[$key]['fontstyle'] .= "B";
}
$dom[$key]['fontstyle'] .= "B";
}
- if (isset($dom[$key]['style']['font-style']) AND (strtolower($dom[$key]['style']['font-style']
{0}
) == "i")) {
+ if (isset($dom[$key]['style']['font-style']) AND (strtolower($dom[$key]['style']['font-style']
[0]
) == "i")) {
$dom[$key]['fontstyle'] .= "I";
}
// font color
$dom[$key]['fontstyle'] .= "I";
}
// font color
@@
-9319,9
+9334,9
@@
if (!class_exists('TCPDF')) {
$decors = explode(" ", strtolower($dom[$key]['style']['text-decoration']));
foreach ($decors as $dec) {
$dec = trim($dec);
$decors = explode(" ", strtolower($dom[$key]['style']['text-decoration']));
foreach ($decors as $dec) {
$dec = trim($dec);
- if ($dec
{0}
== "u") {
+ if ($dec
[0]
== "u") {
$dom[$key]['fontstyle'] .= "U";
$dom[$key]['fontstyle'] .= "U";
- } elseif ($dec
{0}
== "l") {
+ } elseif ($dec
[0]
== "l") {
$dom[$key]['fontstyle'] .= "D";
}
}
$dom[$key]['fontstyle'] .= "D";
}
}
@@
-9336,7
+9351,7
@@
if (!class_exists('TCPDF')) {
}
// check for text alignment
if (isset($dom[$key]['style']['text-align'])) {
}
// check for text alignment
if (isset($dom[$key]['style']['text-align'])) {
- $dom[$key]['align'] = strtoupper($dom[$key]['style']['text-align']
{0}
);
+ $dom[$key]['align'] = strtoupper($dom[$key]['style']['text-align']
[0]
);
}
}
// check for font tag
}
}
// check for font tag
@@
-9355,9
+9370,9
@@
if (!class_exists('TCPDF')) {
// font size
if (isset($dom[$key]['attribute']['size'])) {
if ($key > 0) {
// font size
if (isset($dom[$key]['attribute']['size'])) {
if ($key > 0) {
- if ($dom[$key]['attribute']['size']
{0}
== "+") {
+ if ($dom[$key]['attribute']['size']
[0]
== "+") {
$dom[$key]['fontsize'] = $dom[($dom[$key]['parent'])]['fontsize'] + intval(substr($dom[$key]['attribute']['size'], 1));
$dom[$key]['fontsize'] = $dom[($dom[$key]['parent'])]['fontsize'] + intval(substr($dom[$key]['attribute']['size'], 1));
- } elseif ($dom[$key]['attribute']['size']
{0}
== "-") {
+ } elseif ($dom[$key]['attribute']['size']
[0]
== "-") {
$dom[$key]['fontsize'] = $dom[($dom[$key]['parent'])]['fontsize'] - intval(substr($dom[$key]['attribute']['size'], 1));
} else {
$dom[$key]['fontsize'] = intval($dom[$key]['attribute']['size']);
$dom[$key]['fontsize'] = $dom[($dom[$key]['parent'])]['fontsize'] - intval(substr($dom[$key]['attribute']['size'], 1));
} else {
$dom[$key]['fontsize'] = intval($dom[$key]['attribute']['size']);
@@
-9384,8
+9399,8
@@
if (!class_exists('TCPDF')) {
if (($dom[$key]['value'] == "em") OR ($dom[$key]['value'] == "i")) {
$dom[$key]['fontstyle'] .= "I";
}
if (($dom[$key]['value'] == "em") OR ($dom[$key]['value'] == "i")) {
$dom[$key]['fontstyle'] .= "I";
}
- if (($dom[$key]['value']
{0} == "h") AND (intval($dom[$key]['value']{1}) > 0) AND (intval($dom[$key]['value']{1}
) < 7)) {
- $headsize = (4 - intval($dom[$key]['value']
{1}
)) * 2;
+ if (($dom[$key]['value']
[0] == "h") AND (intval($dom[$key]['value'][1]) > 0) AND (intval($dom[$key]['value'][1]
) < 7)) {
+ $headsize = (4 - intval($dom[$key]['value']
[1]
)) * 2;
$dom[$key]['fontsize'] = $dom[0]['fontsize'] + $headsize;
$dom[$key]['fontstyle'] .= "B";
}
$dom[$key]['fontsize'] = $dom[0]['fontsize'] + $headsize;
$dom[$key]['fontstyle'] .= "B";
}
@@
-9427,7
+9442,7
@@
if (!class_exists('TCPDF')) {
}
// check for text alignment
if (isset($dom[$key]['attribute']['align']) AND (!empty($dom[$key]['attribute']['align'])) AND ($dom[$key]['value'] !== 'img')) {
}
// check for text alignment
if (isset($dom[$key]['attribute']['align']) AND (!empty($dom[$key]['attribute']['align'])) AND ($dom[$key]['value'] !== 'img')) {
- $dom[$key]['align'] = strtoupper($dom[$key]['attribute']['align']
{0}
);
+ $dom[$key]['align'] = strtoupper($dom[$key]['attribute']['align']
[0]
);
}
} // end opening tag
} else {
}
} // end opening tag
} else {