From 8fede7cc2170d17d71eb587477996add5ccadfc6 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Wed, 23 Dec 2009 16:05:10 +0000 Subject: [PATCH] Replaced all deprecated functions so FA runs in php >= 5.3.0 as well. --- CHANGELOG.txt | 17 ++++++++ admin/db/maintenance_db.inc | 2 +- gl/gl_bank.php | 2 +- includes/db_pager.inc | 2 +- includes/lang/language.php | 2 +- includes/page/header.inc | 4 +- includes/session.inc | 2 +- install/save.php | 2 +- inventory/adjustments.php | 2 +- inventory/transfers.php | 2 +- purchasing/allocations/supplier_allocate.php | 2 +- purchasing/includes/ui/po_ui.inc | 2 +- purchasing/supplier_invoice.php | 2 +- reporting/includes/Workbook.php | 46 ++++++++++---------- reporting/includes/class.graphic.inc | 38 ++++++++-------- reporting/includes/tcpdf.php | 10 +++-- sales/allocations/customer_allocate.php | 2 +- 17 files changed, 79 insertions(+), 60 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 4c43d3d1..49ec66af 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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. diff --git a/admin/db/maintenance_db.inc b/admin/db/maintenance_db.inc index adac0f63..e88c0a13 100644 --- a/admin/db/maintenance_db.inc +++ b/admin/db/maintenance_db.inc @@ -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 diff --git a/gl/gl_bank.php b/gl/gl_bank.php index 3510dbd4..d3825201 100644 --- a/gl/gl_bank.php +++ b/gl/gl_bank.php @@ -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); diff --git a/includes/db_pager.inc b/includes/db_pager.inc index e09659a0..cf67659a 100644 --- a/includes/db_pager.inc +++ b/includes/db_pager.inc @@ -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); diff --git a/includes/lang/language.php b/includes/lang/language.php index 89609283..e983384f 100644 --- a/includes/lang/language.php +++ b/includes/lang/language.php @@ -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; } diff --git a/includes/page/header.inc b/includes/page/header.inc index 9bff3d2f..b0364cbe 100644 --- a/includes/page/header.inc +++ b/includes/page/header.inc @@ -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; diff --git a/includes/session.inc b/includes/session.inc index ea1c12a5..ba703dee 100644 --- a/includes/session.inc +++ b/includes/session.inc @@ -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(); diff --git a/install/save.php b/install/save.php index 98b1191e..1e568b65 100644 --- a/install/save.php +++ b/install/save.php @@ -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']; } diff --git a/inventory/adjustments.php b/inventory/adjustments.php index 20ac09d1..51b097be 100644 --- a/inventory/adjustments.php +++ b/inventory/adjustments.php @@ -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(); diff --git a/inventory/transfers.php b/inventory/transfers.php index 49e66e5e..9e6cbd85 100644 --- a/inventory/transfers.php +++ b/inventory/transfers.php @@ -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(); diff --git a/purchasing/allocations/supplier_allocate.php b/purchasing/allocations/supplier_allocate.php index 5f77c152..82530c76 100644 --- a/purchasing/allocations/supplier_allocate.php +++ b/purchasing/allocations/supplier_allocate.php @@ -37,7 +37,7 @@ function clear_allocations() unset($_SESSION['alloc']->allocs); unset($_SESSION['alloc']); } - session_register("alloc"); + //session_register("alloc"); } //-------------------------------------------------------------------------------- diff --git a/purchasing/includes/ui/po_ui.inc b/purchasing/includes/ui/po_ui.inc index 042c0640..830f483f 100644 --- a/purchasing/includes/ui/po_ui.inc +++ b/purchasing/includes/ui/po_ui.inc @@ -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(); diff --git a/purchasing/supplier_invoice.php b/purchasing/supplier_invoice.php index 34406781..bd8f0763 100644 --- a/purchasing/supplier_invoice.php +++ b/purchasing/supplier_invoice.php @@ -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; } diff --git a/reporting/includes/Workbook.php b/reporting/includes/Workbook.php index 1f53c2aa..56e4c483 100644 --- a/reporting/includes/Workbook.php +++ b/reporting/includes/Workbook.php @@ -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(); diff --git a/reporting/includes/class.graphic.inc b/reporting/includes/class.graphic.inc index c80f3377..20022f1b 100644 --- a/reporting/includes/class.graphic.inc +++ b/reporting/includes/class.graphic.inc @@ -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); diff --git a/reporting/includes/tcpdf.php b/reporting/includes/tcpdf.php index 06df1ad8..e30155a4 100644 --- a/reporting/includes/tcpdf.php +++ b/reporting/includes/tcpdf.php @@ -143,6 +143,8 @@ * 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)){ diff --git a/sales/allocations/customer_allocate.php b/sales/allocations/customer_allocate.php index 058605c6..63a04cdb 100644 --- a/sales/allocations/customer_allocate.php +++ b/sales/allocations/customer_allocate.php @@ -36,7 +36,7 @@ function clear_allocations() unset($_SESSION['alloc']->allocs); unset($_SESSION['alloc']); } - session_register('alloc'); + //session_register('alloc'); } -- 2.30.2