! 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.
$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
unset ($_SESSION['pay_items']);
}
- session_register("pay_items");
+ //session_register("pay_items");
$_SESSION['pay_items'] = new items_cart($type);
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);
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;
}
{
$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;
include_once($path_to_root . "/includes/main.inc");
// Ajax communication object
-$Ajax =& new Ajax();
+$Ajax = new Ajax();
// js/php validation rules container
$Validate = array();
}
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'];
}
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();
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();
unset($_SESSION['alloc']->allocs);
unset($_SESSION['alloc']);
}
- session_register("alloc");
+ //session_register("alloc");
}
//--------------------------------------------------------------------------------
unset ($_SESSION['PO']);
}
- session_register("PO");
+ //session_register("PO");
$_SESSION['PO'] = new purch_order;
$_POST['OrderDate'] = new_doc_date();
}
//session_register("SuppInv");
- session_register("supp_trans");
+ //session_register("supp_trans");
$_SESSION['supp_trans'] = new supp_trans;
$_SESSION['supp_trans']->is_invoice = true;
}
// 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
$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) {
}
// 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)) {
$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) {
// 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) {
// 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) {
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 != '!'))
{
}
// 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;
}
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;
}
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;
$row = $match[2];
// Convert base26 column string to number
- $chars = split('', $col);
+ $chars = preg_split('//', $col);
$expn = 0;
$col = 0;
// 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;
}
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 = '';
$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
$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;
$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();
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;
$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++)
// 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)
{
// 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();
}
/**
* 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;
/**
* 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;
// 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']);
}
// 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))
{
$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);
$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);
$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);
* 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"))
if (isset($dash)) {
$dash_string = "";
if ($dash) {
- if (ereg("^.+,", $dash)) {
+ if (preg_match("/^.+,/", $dash)) {
$tab = explode(",", $dash);
} else {
$tab = array($dash);
$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++) {
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)){
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)){
unset($_SESSION['alloc']->allocs);
unset($_SESSION['alloc']);
}
- session_register('alloc');
+ //session_register('alloc');
}