Replaced all deprecated functions so FA runs in php >= 5.3.0 as well.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Wed, 23 Dec 2009 16:05:10 +0000 (16:05 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Wed, 23 Dec 2009 16:05:10 +0000 (16:05 +0000)
17 files changed:
CHANGELOG.txt
admin/db/maintenance_db.inc
gl/gl_bank.php
includes/db_pager.inc
includes/lang/language.php
includes/page/header.inc
includes/session.inc
install/save.php
inventory/adjustments.php
inventory/transfers.php
purchasing/allocations/supplier_allocate.php
purchasing/includes/ui/po_ui.inc
purchasing/supplier_invoice.php
reporting/includes/Workbook.php
reporting/includes/class.graphic.inc
reporting/includes/tcpdf.php
sales/allocations/customer_allocate.php

index 4c43d3d1fdbd54175fdee5ede56a34cf8409a478..49ec66afd1b2f4fdab17fc87e17975db32241463 100644 (file)
@@ -24,6 +24,23 @@ $ -> Affected files
 ! Release 2.2.2
 $ /config.default.php
   /update.html
+! Replaced all deprecated functions so FA runs in php >= 5.3.0 as well.
+$ /admin/db/maintenance_db.inc
+  /gl/gl_bank.php
+  /includes/db_pager.inc
+  /includes/session.inc
+  /includes/lang/language.php
+  /includes/page/header.inc
+  /install/save.php
+  /inventory/adjustments.php
+  /inventory/transfers.php
+  /purchasing/supplier_invoice.php
+  /purchasing/allocations/supplier_allocate.php
+  /purchasing/includes/ui/po_ui.inc
+  /reporting/includes/class.graphic.inc
+  /reporting/includes/tcpdf.php
+  /reporting/includes/Workbook.php
+  /sales/allocations/customer_allocate.php
   
 22-Dec-2009 Joe Hunt
 ! Some additional changes in pdf_report.inc for supporting report extensions.
index adac0f63fe959dced38c9a796dc5ead35b98f9a3..e88c0a13e577f2a6b8f1efe681fdd3947298eb6d 100644 (file)
@@ -455,7 +455,7 @@ function db_unzip($mode, $path)
     $all = implode("", file($path));
 
     // convert path to name of ziped file
-    $filename = ereg_replace(".*/", "", $path);
+    $filename = preg_replace("/.*\//", "", $path);
     $filename = substr($filename, 0, strlen($filename) - 4);
 
     // compare filname in zip and filename from $_GET
index 3510dbd44c864e8a28d43a02170c8752063f71b3..d38252015d0b3de7474d713be9502a60f1c03ded 100644 (file)
@@ -102,7 +102,7 @@ function handle_new_order($type)
                unset ($_SESSION['pay_items']);
        }
 
-       session_register("pay_items");
+       //session_register("pay_items");
 
        $_SESSION['pay_items'] = new items_cart($type);
 
index e09659a0210697dc9171dc17e335d4fe3922ca3e..cf67659a004203b8407815eac60760c47acb2b79 100644 (file)
@@ -453,7 +453,7 @@ function &new_db_pager($name, $sql, $coldef, $table = null, $key = null, $page_l
                unset($_SESSION[$name]); // kill pager if sql has changed
        }
        if (!isset($_SESSION[$name])) {
-           $_SESSION[$name] =& new db_pager($sql, $name, $table, $page_len);
+           $_SESSION[$name] = new db_pager($sql, $name, $table, $page_len);
                $_SESSION[$name]->main_tbl = $table;
                $_SESSION[$name]->key = $key;
                $_SESSION[$name]->set_sql($sql);
index 8960928377024f8071c6cf0e0b1dfaaab1eb4e29..e983384fc2b82e6d0fd2d99c6b99150b4ea267c0 100644 (file)
@@ -27,7 +27,7 @@ class language
        function language($name, $code, $encoding, $dir = 'ltr') 
        {
                $this->name = $name;
-               $this->code = $code;
+               $this->code = $code ? $code : 'en_GB';
                $this->encoding = $encoding;
                $this->dir = $dir;
        }
index 9bff3d2f391710be748f72f5b3e34a86c18eb367..b0364cbebcec0e19c6c94ae187dfe13ea768455c 100644 (file)
@@ -101,8 +101,8 @@ function page_header($title, $no_menu=false, $is_index=false, $onload="", $js=""
        {
                $no_menu = false;
        }
-       if (!isset($_SESSION["sel_app"]))
-               session_register("sel_app");
+       //if (!isset($_SESSION["sel_app"]))
+       //      session_register("sel_app");
        if (isset($_SESSION["App"]) && is_object($_SESSION["App"]) && isset($_SESSION["App"]->selected_application) &&
                $_SESSION["App"]->selected_application != "")
                $sel_app = $_SESSION["App"]->selected_application;
index ea1c12a54367e978845e0c99f4370ab7a2a571b0..ba703dee0e8432e5dbd442cfcfd78b2e66db3be8 100644 (file)
@@ -186,7 +186,7 @@ include_once($path_to_root . "/config.php");
 include_once($path_to_root . "/includes/main.inc");
 
 // Ajax communication object
-$Ajax =& new Ajax();
+$Ajax = new Ajax();
 
 // js/php validation rules container
 $Validate = array();
index 98b1191e6d59c594f82307f79a85cb73c96d78ad..1e568b653d8d6a9f4a399fccb0f899d1bb1b4712 100644 (file)
@@ -265,7 +265,7 @@ if (!isset($_POST['admin_email']) || $_POST['admin_email'] == '')
 }
 else
 {
-       if (eregi("^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$", $_POST['admin_email']))
+       if (preg_match("/^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$/i", $_POST['admin_email']))
        {
                $admin_email = $_POST['admin_email'];
        }
index 20ac09d1971bb7fcc51ec29005663fcfb0f4859b..51b097be937509ba5e71cc3b106a9b5265475737 100644 (file)
@@ -67,7 +67,7 @@ function handle_new_order()
                unset ($_SESSION['adj_items']);
        }
 
-    session_register("adj_items");
+    //session_register("adj_items");
 
     $_SESSION['adj_items'] = new items_cart(ST_INVADJUST);
        $_POST['AdjDate'] = new_doc_date();
index 49e66e5e2afa425d38f1776eb971d9c945f603be..9e6cbd8534afac56308cb2e4efc164b8dc829ba9 100644 (file)
@@ -65,7 +65,7 @@ function handle_new_order()
                unset ($_SESSION['transfer_items']);
        }
 
-    session_register("transfer_items");
+    //session_register("transfer_items");
 
        $_SESSION['transfer_items'] = new items_cart(ST_LOCTRANSFER);
        $_POST['AdjDate'] = new_doc_date();
index 5f77c152afd5e620b533bdd17e110be36e02c4a1..82530c762975bdc51e1651e806f0ceab5fd3cc75 100644 (file)
@@ -37,7 +37,7 @@ function clear_allocations()
                unset($_SESSION['alloc']->allocs);
                unset($_SESSION['alloc']);
        }
-       session_register("alloc");
+       //session_register("alloc");
 }
 //--------------------------------------------------------------------------------
 
index 042c06400547e11a1b85204a0e0301897c25b85b..830f483f3998e7e04a9ec150f4508d1f618cb8a9 100644 (file)
@@ -37,7 +37,7 @@ function create_new_po()
                unset ($_SESSION['PO']);
        }
 
-       session_register("PO");
+       //session_register("PO");
 
        $_SESSION['PO'] = new purch_order;
        $_POST['OrderDate'] = new_doc_date();
index 3440678189c5c6a8f76c1007840e1851d0f76bb6..bd8f0763562879e8a4213f0bea81ba3416ce2f91 100644 (file)
@@ -66,7 +66,7 @@ if (isset($_GET['New']))
        }
 
        //session_register("SuppInv");
-       session_register("supp_trans");
+       //session_register("supp_trans");
        $_SESSION['supp_trans'] = new supp_trans;
        $_SESSION['supp_trans']->is_invoice = true;
 }
index 1f53c2aad6973ca143a7a5dbec8bfb817e6925cd..56e4c483d6e37d40fdf036a088478cd4c6780b94 100644 (file)
@@ -2479,9 +2479,9 @@ class Spreadsheet_Excel_Writer_Parser
 
         // Split the range into 2 cell refs
         if (preg_match("/^([A-Ia-i]?[A-Za-z])(\d+)\:([A-Ia-i]?[A-Za-z])(\d+)$/", $range)) {
-            list($cell1, $cell2) = split(':', $range);
+            list($cell1, $cell2) = preg_split('/:/', $range);
         } elseif (preg_match("/^([A-Ia-i]?[A-Za-z])(\d+)\.\.([A-Ia-i]?[A-Za-z])(\d+)$/", $range)) {
-            list($cell1, $cell2) = split('\.\.', $range);
+            list($cell1, $cell2) = preg_split('/\.\./', $range);
 
         } else {
             // TODO: use real error codes
@@ -2521,7 +2521,7 @@ class Spreadsheet_Excel_Writer_Parser
         $class = 2; // as far as I know, this is magick.
 
         // Split the ref at the ! symbol
-        list($ext_ref, $range) = split('!', $token);
+        list($ext_ref, $range) = preg_split('/!/', $token);
 
         // Convert the external reference part (different for BIFF8)
         if ($this->_BIFF_version == 0x0500) {
@@ -2531,7 +2531,7 @@ class Spreadsheet_Excel_Writer_Parser
         }
 
         // Split the range into 2 cell refs
-        list($cell1, $cell2) = split(':', $range);
+        list($cell1, $cell2) = preg_split('/:/', $range);
 
         // Convert the cell references
         if (preg_match("/^(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)$/", $cell1)) {
@@ -2600,7 +2600,7 @@ class Spreadsheet_Excel_Writer_Parser
         $class = 2; // as far as I know, this is magick.
 
         // Split the ref at the ! symbol
-        list($ext_ref, $cell) = split('!', $cell);
+        list($ext_ref, $cell) = preg_split('/!/', $cell);
 
         // Convert the external reference part (different for BIFF8)
         if ($this->_BIFF_version == 0x0500) {
@@ -2641,7 +2641,7 @@ class Spreadsheet_Excel_Writer_Parser
 
         // Check if there is a sheet range eg., Sheet1:Sheet2.
         if (preg_match("/:/", $ext_ref)) {
-            list($sheet_name1, $sheet_name2) = split(':', $ext_ref);
+            list($sheet_name1, $sheet_name2) = preg_split('/:/', $ext_ref);
 
             $sheet1 = $this->_getSheetIndex($sheet_name1);
             if ($sheet1 == -1) {
@@ -2687,7 +2687,7 @@ class Spreadsheet_Excel_Writer_Parser
 
         // Check if there is a sheet range eg., Sheet1:Sheet2.
         if (preg_match("/:/", $ext_ref)) {
-            list($sheet_name1, $sheet_name2) = split(':', $ext_ref);
+            list($sheet_name1, $sheet_name2) = preg_split('/:/', $ext_ref);
 
             $sheet1 = $this->_getSheetIndex($sheet_name1);
             if ($sheet1 == -1) {
@@ -2986,7 +2986,7 @@ class Spreadsheet_Excel_Writer_Parser
             default:
                 // if it's a reference
                 if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/',$token) and
-                   !ereg("[0-9]",$this->_lookahead) and 
+                   !preg_match("/[0-9]/",$this->_lookahead) and 
                    ($this->_lookahead != ':') and ($this->_lookahead != '.') and
                    ($this->_lookahead != '!'))
                 {
@@ -2994,39 +2994,39 @@ class Spreadsheet_Excel_Writer_Parser
                 }
                 // If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1)
                 elseif (preg_match("/^\w+(\:\w+)?\![A-Ia-i]?[A-Za-z][0-9]+$/u",$token) and
-                       !ereg("[0-9]",$this->_lookahead) and
+                       !preg_match("/[0-9]/",$this->_lookahead) and
                        ($this->_lookahead != ':') and ($this->_lookahead != '.'))
                 {
                     return $token;
                 }
                 // If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1)
                 elseif (preg_match("/^'[\w -]+(\:[\w -]+)?'\![A-Ia-i]?[A-Za-z][0-9]+$/u",$token) and
-                       !ereg("[0-9]",$this->_lookahead) and
+                       !preg_match("/[0-9]/",$this->_lookahead) and
                        ($this->_lookahead != ':') and ($this->_lookahead != '.'))
                 {
                     return $token;
                 }
                 // if it's a range (A1:A2)
                 elseif (preg_match("/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/",$token) and 
-                       !ereg("[0-9]",$this->_lookahead))
+                       !preg_match("/[0-9]/",$this->_lookahead))
                 {
                     return $token;
                 }
                 // if it's a range (A1..A2)
                 elseif (preg_match("/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/",$token) and 
-                       !ereg("[0-9]",$this->_lookahead))
+                       !preg_match("/[0-9]/",$this->_lookahead))
                 {
                     return $token;
                 }
                 // If it's an external range like Sheet1!A1 or Sheet1:Sheet2!A1:B2
                 elseif (preg_match("/^\w+(\:\w+)?\!([A-Ia-i]?[A-Za-z])?[0-9]+:([A-Ia-i]?[A-Za-z])?[0-9]+$/u",$token) and
-                       !ereg("[0-9]",$this->_lookahead))
+                       !preg_match("/[0-9]/",$this->_lookahead))
                 {
                     return $token;
                 }
                 // If it's an external range like 'Sheet1'!A1 or 'Sheet1:Sheet2'!A1:B2
                 elseif (preg_match("/^'[\w -]+(\:[\w -]+)?'\!([A-Ia-i]?[A-Za-z])?[0-9]+:([A-Ia-i]?[A-Za-z])?[0-9]+$/u",$token) and
-                       !ereg("[0-9]",$this->_lookahead))
+                       !preg_match("/[0-9]/",$this->_lookahead))
                 {
                     return $token;
                 }
@@ -3038,12 +3038,12 @@ class Spreadsheet_Excel_Writer_Parser
                     return $token;
                 }
                 // If it's a string (of maximum 255 characters)
-                elseif (ereg("^\"[^\"]{0,255}\"$",$token))
+                elseif (preg_match("/^\"[^\"]{0,255}\"$/",$token))
                 {
                     return $token;
                 }
                 // if it's a function call
-                elseif (eregi("^[A-Z0-9\xc0-\xdc\.]+$",$token) and ($this->_lookahead == "("))
+                elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i",$token) and ($this->_lookahead == "("))
                 {
                     return $token;
                 }
@@ -3258,7 +3258,7 @@ class Spreadsheet_Excel_Writer_Parser
             return $result;
         }
         // if it's a function call
-        elseif (eregi("^[A-Z0-9\xc0-\xdc\.]+$",$this->_current_token))
+        elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i",$this->_current_token))
         {
             $result = $this->_func();
             return $result;
@@ -4683,7 +4683,7 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr
         $row     = $match[2];
 
         // Convert base26 column string to number
-        $chars = split('', $col);
+        $chars = preg_split('//', $col);
         $expn  = 0;
         $col   = 0;
 
@@ -5401,7 +5401,7 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr
         // parameters accordingly.
         // Split the dir name and sheet name (if it exists)
         /*if (preg_match("/\#/", $url)) {
-            list($dir_long, $sheet) = split("\#", $url);
+            list($dir_long, $sheet) = preg_split("/\#/", $url);
         } else {
             $dir_long = $url;
         }
@@ -5409,7 +5409,7 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr
         if (isset($sheet)) {
             $link_type |= 0x08;
             $sheet_len  = pack("V", strlen($sheet) + 0x01);
-            $sheet      = join("\0", split('', $sheet));
+            $sheet      = join("\0", preg_split('//', $sheet));
             $sheet     .= "\0\0\0";
         } else {
             $sheet_len   = '';
@@ -5433,7 +5433,7 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr
         $dir_short   = preg_replace("/\.\.\\\/", '', $dir_long) . "\0";
     
         // Store the long dir name as a wchar string (non-null terminated)
-        //$dir_long       = join("\0", split('', $dir_long));
+        //$dir_long       = join("\0", preg_split('//', $dir_long));
         $dir_long       = $dir_long . "\0";
     
         // Pack the lengths of the dir strings
@@ -7007,7 +7007,7 @@ class Spreadsheet_Excel_Writer_Workbook extends Spreadsheet_Excel_Writer_BIFFwri
         $this->Spreadsheet_Excel_Writer_BIFFwriter();
 
         $this->_filename         = $filename;
-        $this->_parser           =& new Spreadsheet_Excel_Writer_Parser($this->_byte_order, $this->_BIFF_version);
+        $this->_parser           = new Spreadsheet_Excel_Writer_Parser($this->_byte_order, $this->_BIFF_version);
         $this->_1904             = 0;
         $this->_activesheet      = 0;
         $this->_firstsheet       = 0;
@@ -7016,7 +7016,7 @@ class Spreadsheet_Excel_Writer_Workbook extends Spreadsheet_Excel_Writer_BIFFwri
         $this->_fileclosed       = 0;
         $this->_biffsize         = 0;
         $this->_sheetname        = 'Sheet';
-        $this->_tmp_format       =& new Spreadsheet_Excel_Writer_Format($this->_BIFF_version);
+        $this->_tmp_format       = new Spreadsheet_Excel_Writer_Format($this->_BIFF_version);
         $this->_worksheets       = array();
         $this->_sheetnames       = array();
         $this->_formats          = array();
index c80f33775e377f28238dfe726450d72579e0c5d8..20022f1b809145dae49d0c2e73210b95ffe40bb5 100644 (file)
@@ -164,7 +164,7 @@ class graph
 
     function display($save="", $border=false)
     {
-        $this->legend_exists        = (ereg("(5|6)", $this->type)) ? true : false;
+        $this->legend_exists        = (preg_match("/(5|6)/", $this->type)) ? true : false;
         $this->biggest_graphic_name = (strlen($this->graphic_1) > strlen($this->graphic_2)) ? $this->graphic_1 : $this->graphic_2;
         $this->height_title         = (!empty($this->title)) ? ($this->string_height($this->tsize) + 15) : 0;
         $this->space_between_bars   = ($this->type == 1) ? 40 : 30;
@@ -181,7 +181,7 @@ class graph
         $this->graphic_area_x2     = $this->graphic_area_x1 + $this->graphic_area_width;
         $this->graphic_area_y2     = $this->graphic_area_y1 + $this->graphic_area_height;
 
-               if (count($this->z) && (ereg("(1|2|3|4)", $this->type)))
+               if (count($this->z) && (preg_match("/(1|2|3|4)/", $this->type)))
             $this->graphic_2_exists = true;
         $this->total_parameters    = count($this->x);
                for ($i = 0; $i < $this->total_parameters; $i++)
@@ -234,7 +234,7 @@ class graph
 
 
         // Draw axis and background lines for "vertical bars", "dots" and "lines"
-        if (ereg("^(1|3|4)$", $this->type))
+        if (preg_match("/^(1|3|4)$/", $this->type))
         {
             if ($this->legend_exists == true)
             {
@@ -312,7 +312,7 @@ class graph
 
 
         // Draw legend box for "pie" or "donut"
-        else if (ereg("^(5|6)$", $this->type))
+        else if (preg_match("/^(5|6)$/", $this->type))
         {
             $this->draw_legend();
         }
@@ -404,7 +404,7 @@ class graph
         /**
         * Draw graphic: DOTS or LINE
         */
-        else if (ereg("^(3|4)$", $this->type))
+        else if (preg_match("/^(3|4)$/", $this->type))
         {
 
             $x[0] = $this->graphic_area_x1+1;
@@ -475,7 +475,7 @@ class graph
         /**
         * Draw graphic: PIE or DONUT
         */
-        else if (ereg("^(5|6)$", $this->type))
+        else if (preg_match("/^(5|6)$/", $this->type))
         {
             $center_x = ($this->graphic_area_x1 + $this->graphic_area_x2) / 2;
             $center_y = ($this->graphic_area_y1 + $this->graphic_area_y2) / 2;
@@ -702,10 +702,10 @@ class graph
 
 
         // Draw legend values for VERTICAL BARS, HORIZONTAL BARS, DOTS and LINES
-        if (ereg("^(1|2|3|4)$", $this->type))
+        if (preg_match("/^(1|2|3|4)$/", $this->type))
         {
-            $color_1 = (ereg("^(1|2)$", $this->type)) ? $this->color['bars']   : $this->color['line'];
-            $color_2 = (ereg("^(1|2)$", $this->type)) ? $this->color['bars_2'] : $this->color['line_2'];
+            $color_1 = (preg_match("/^(1|2)$/", $this->type)) ? $this->color['bars']   : $this->color['line'];
+            $color_2 = (preg_match("/^(1|2)$/", $this->type)) ? $this->color['bars_2'] : $this->color['line_2'];
 
             imagefilledrectangle($this->img, $x, $y, ($x+10), ($y+10), $color_1);
             imagerectangle($this->img, $x, $y, ($x+10), ($y+10), $this->color['title']);
@@ -717,7 +717,7 @@ class graph
         }
 
         // Draw legend values for PIE or DONUT
-        else if (ereg("^(5|6)$", $this->type))
+        else if (preg_match("/^(5|6)$/", $this->type))
         {
             if (!empty($this->axis_x))
             {
@@ -818,19 +818,19 @@ class graph
                 $this->color['bg_lines']    = imagecolorallocate($this->img, 220, 220, 220);
                 $this->color['bg_legend']   = imagecolorallocate($this->img, 255, 255, 255);
 
-                if (ereg("^(1|2)$", $this->type))
+                if (preg_match("/^(1|2)$/", $this->type))
                 {
                     $this->color['bars']          = imagecolorallocate($this->img, 100, 150, 200);
                     $this->color['bars_shadow']   = imagecolorallocate($this->img,  50, 100, 150);
                     $this->color['bars_2']        = imagecolorallocate($this->img, 200, 250, 150);
                     $this->color['bars_2_shadow'] = imagecolorallocate($this->img, 120, 170,  70);
                 }
-                else if (ereg("^(3|4)$", $this->type))
+                else if (preg_match("/^(3|4)$/", $this->type))
                 {
                     $this->color['line']   = imagecolorallocate($this->img, 100, 150, 200);
                     $this->color['line_2'] = imagecolorallocate($this->img, 230, 100, 100);
                 }
-                else if (ereg("^(5|6)$", $this->type))
+                else if (preg_match("/^(5|6)$/", $this->type))
                 {
                     $this->color['arc_1']        = imagecolorallocate($this->img, 255, 150,   0);
                     $this->color['arc_2']        = imagecolorallocate($this->img, 150,   0, 255);
@@ -858,19 +858,19 @@ class graph
                 $this->color['bg_lines']    = imagecolorallocate($this->img, 100, 100, 100);
                 $this->color['bg_legend']   = imagecolorallocate($this->img,  70,  70,  70);
 
-                if (ereg("^(1|2)$", $this->type))
+                if (preg_match("/^(1|2)$/", $this->type))
                 {
                     $this->color['bars']          = imagecolorallocate($this->img,  50, 200,  50);
                     $this->color['bars_shadow']   = imagecolorallocate($this->img,   0, 150,   0);
                     $this->color['bars_2']        = imagecolorallocate($this->img, 255, 255, 255);
                     $this->color['bars_2_shadow'] = imagecolorallocate($this->img, 220, 220, 220);
                 }
-                else if (ereg("^(3|4)$", $this->type))
+                else if (preg_match("/^(3|4)$/", $this->type))
                 {
                     $this->color['line']   = imagecolorallocate($this->img, 220, 220, 220);
                     $this->color['line_2'] = imagecolorallocate($this->img,   0, 180,   0);
                 }
-                else if (ereg("^(5|6)$", $this->type))
+                else if (preg_match("/^(5|6)$/", $this->type))
                 {
                     $this->color['arc_1']        = imagecolorallocate($this->img, 255, 255, 255);
                     $this->color['arc_2']        = imagecolorallocate($this->img, 200, 220, 200);
@@ -899,19 +899,19 @@ class graph
                 $this->color['bg_lines']    = imagecolorallocate($this->img, 200, 224, 180);
                 $this->color['bg_legend']   = imagecolorallocate($this->img, 230, 230, 200);
 
-                if (ereg("^(1|2)$", $this->type))
+                if (preg_match("/^(1|2)$/", $this->type))
                 {
                     $this->color['bars']          = imagecolorallocate($this->img, 255, 170,  80);
                     $this->color['bars_shadow']   = imagecolorallocate($this->img, 200, 120,  30);
                     $this->color['bars_2']        = imagecolorallocate($this->img, 250, 230,  80);
                     $this->color['bars_2_shadow'] = imagecolorallocate($this->img, 180, 150,   0);
                 }
-                else if (ereg("^(3|4)$", $this->type))
+                else if (preg_match("/^(3|4)$/", $this->type))
                 {
                     $this->color['line']   = imagecolorallocate($this->img, 230, 100,   0);
                     $this->color['line_2'] = imagecolorallocate($this->img, 220, 200,  50);
                 }
-                else if (ereg("^(5|6)$", $this->type))
+                else if (preg_match("/^(5|6)$/", $this->type))
                 {
                     $this->color['arc_1']        = imagecolorallocate($this->img, 100, 150, 200);
                     $this->color['arc_2']        = imagecolorallocate($this->img, 200, 250, 150);
index 06df1ad82f9af8ac4abe86916d0ddc202fd4e9d6..e30155a4fac3dc9f9020ae120475946341f9903b 100644 (file)
   * 4. Parameter $unicode in constructor renamed to $uni.
   * 5. Header function renamed to Header1 (due to conflict with FrontReport Header)
   * 6. Line 6190, SetLineWidth (cast of values to avoid problem in PHP 5.2.6
+  * 7. Line 6261. ereg replaced by preg_match (with start and end delimiter)
+  * 8. Lines 8642,9256 and 9348. split replaced by preg_split.
   * -------------------------------------------------------------------------------
   */
 if (!defined("K_PATH_FONTS"))
@@ -6258,7 +6260,7 @@ if (!class_exists('TCPDF')) {
                        if (isset($dash)) {
                                $dash_string = "";
                                if ($dash) {
-                                       if (ereg("^.+,", $dash)) {
+                                       if (preg_match("/^.+,/", $dash)) {
                                                $tab = explode(",", $dash);
                                        } else {
                                                $tab = array($dash);
@@ -8638,7 +8640,7 @@ if (!class_exists('TCPDF')) {
                                $this->_out(sprintf('%.3F %.3F %.3F %.3F %.3F %.3F cm', $scale_x, 0, 0, $scale_y, $x1*(1-$scale_x), $y2*(1-$scale_y)));
                        }
                        // handle pc/unix/mac line endings
-                       $lines = split("\r\n|[\r\n]", $data);
+                       $lines = preg_split("/\r\n|[\r\n]/", $data);
                        $u=0;
                        $cnt = count($lines);
                        for ($i=0; $i < $cnt; $i++) {
@@ -9252,7 +9254,7 @@ if (!class_exists('TCPDF')) {
                                                        if (isset($dom[$key]['style']['font-family'])) {
                                                                // font family
                                                                if (isset($dom[$key]['style']['font-family'])) {
-                                                                       $fontslist = split(",", strtolower($dom[$key]['style']['font-family']));
+                                                                       $fontslist = preg_split("/,/", strtolower($dom[$key]['style']['font-family']));
                                                                        foreach($fontslist as $font) {
                                                                                $font = trim(strtolower($font));
                                                                                if (in_array($font, $this->fontlist)){
@@ -9344,7 +9346,7 @@ if (!class_exists('TCPDF')) {
                                                if ($dom[$key]['value'] == "font") {
                                                        // font family
                                                        if (isset($dom[$key]['attribute']['face'])) {
-                                                               $fontslist = split(",", strtolower($dom[$key]['attribute']['face']));
+                                                               $fontslist = preg_split("/,/", strtolower($dom[$key]['attribute']['face']));
                                                                foreach($fontslist as $font) {
                                                                        $font = trim(strtolower($font));
                                                                        if (in_array($font, $this->fontlist)){
index 058605c6ff481dcee3d20eaf40998c0522056a37..63a04cdb4427abccc206d5792a3e8eeaa484d57f 100644 (file)
@@ -36,7 +36,7 @@ function clear_allocations()
                unset($_SESSION['alloc']->allocs);
                unset($_SESSION['alloc']);
        }
-       session_register('alloc');
+       //session_register('alloc');
 }