Items, Company Setup: additional check to ensure uploaded image compatibility with...
[fa-stable.git] / reporting / includes / tcpdf.php
index 71fb75effc11f697cbfef7883ca58747fff74373..eec95ee9509fc7c5aa662e184795e751e90facea 100644 (file)
@@ -1,4 +1,4 @@
-4527<?php
+<?php
 //============================================================+
 // File name   : tcpdf.php
 // Begin       : 2002-08-03
@@ -177,6 +177,17 @@ require_once(dirname(__FILE__)."/barcodes.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
@@ -1124,7 +1135,8 @@ if (!class_exists('TCPDF')) {
                                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();
@@ -3520,6 +3532,8 @@ if (!class_exists('TCPDF')) {
                function unichr($c) {
                        if (!$this->isunicode) {
                                return chr($c);
+                       } elseif ($c == '') {
+                               return '';
                        } elseif ($c <= 0x7F) {
                                // one byte
                                return chr($c);
@@ -3704,6 +3718,7 @@ if (!class_exists('TCPDF')) {
                                }
                        }
                        $this->endlinex = $this->img_rb_x;
+                       return $info;
                }
 
                /**