From c2dfaaf4e08f78aa9e3f2f2892a2e4eb329557a7 Mon Sep 17 00:00:00 2001 From: Tony Landis Date: Wed, 25 Mar 2009 22:10:40 -0600 Subject: [PATCH 1/3] deprecated php methods --- includes/pdf/pdf_invoice_overview.inc.php | 4 ++-- includes/pdf/pdf_invoice_voip-detailed.inc.php | 4 ++-- includes/pdf/pdf_invoice_voip.inc.php | 8 ++++---- install/install_db_core.inc | 4 ++-- modules/account/account.inc.php | 6 +++--- modules/core/database_view.inc.php | 2 +- modules/core/session.inc.php | 4 ++-- modules/core/trigger.inc.php | 4 ++-- modules/core/xml.inc.php | 2 +- modules/setup/setup.inc.php | 2 +- modules/setup/setup_construct.xml | 2 +- modules/setup/setup_install_data.xml | 2 +- 12 files changed, 22 insertions(+), 22 deletions(-) diff --git a/includes/pdf/pdf_invoice_overview.inc.php b/includes/pdf/pdf_invoice_overview.inc.php index 3ce65a09..9982d801 100644 --- a/includes/pdf/pdf_invoice_overview.inc.php +++ b/includes/pdf/pdf_invoice_overview.inc.php @@ -233,9 +233,9 @@ class pdf_invoice_overview extends pdf_invoice_base # Draw attributes if they are present if (strlen($line['attr'])) { - $atrs = split("\r\n", str_replace('\r\n',"\r\n",$line['attr'])); + $atrs = preg_split("/\r\n/", str_replace('\r\n',"\r\n",$line['attr'])); foreach ($atrs as $a) { - $parts = split("==", $a); + $parts = preg_split("/==/", $a); switch ($parts[0]) { default: if(strlen($parts[0])) diff --git a/includes/pdf/pdf_invoice_voip-detailed.inc.php b/includes/pdf/pdf_invoice_voip-detailed.inc.php index 625e1caa..ce3c7ac4 100644 --- a/includes/pdf/pdf_invoice_voip-detailed.inc.php +++ b/includes/pdf/pdf_invoice_voip-detailed.inc.php @@ -276,9 +276,9 @@ class pdf_invoice_overview extends pdf_invoice_base $val = $line['name']; if (strlen($line['attr'])) { $val = ""; - $atrs = split("\r\n", str_replace('\r\n',"\r\n",$line['attr'])); + $atrs = preg_split("/\r\n/", str_replace('\r\n',"\r\n",$line['attr'])); foreach ($atrs as $a) { - $parts = split("==", $a); + $parts = preg_split("/==/", $a); switch ($parts[0]) { case "Destination": $this->SetX(69); diff --git a/includes/pdf/pdf_invoice_voip.inc.php b/includes/pdf/pdf_invoice_voip.inc.php index a6d730ec..be1b90a7 100644 --- a/includes/pdf/pdf_invoice_voip.inc.php +++ b/includes/pdf/pdf_invoice_voip.inc.php @@ -204,9 +204,9 @@ class pdf_invoice_overview extends pdf_invoice_base $val = $line['name']; if (strlen($line['attr'])) { $val = ""; - $atrs = split("\r\n", str_replace('\r\n',"\r\n",$line['attr'])); + $atrs = preg_split("/\r\n/", str_replace('\r\n',"\r\n",$line['attr'])); foreach ($atrs as $a) { - $parts = split("==", $a); + $parts = preg_split("/==/", $a); switch ($parts[0]) { case "Destination": $this->SetX(75); @@ -229,9 +229,9 @@ class pdf_invoice_overview extends pdf_invoice_base case "parent_service_id": $sql = sqlSelect($db,"service","prod_attr","id=::".$parts[1]."::"); $rstmp = $db->Execute($sql); - $atrs2 = split("\r\n", $rstmp->fields['prod_attr']); + $atrs2 = preg_split("/\r\n/", $rstmp->fields['prod_attr']); foreach ($atrs2 as $a2) { - $parts2 = split("==", $a2); + $parts2 = preg_split("/==/", $a2); switch ($parts2[0]) { case "station": case "ported": diff --git a/install/install_db_core.inc b/install/install_db_core.inc index bbdde61e..9a17dac3 100644 --- a/install/install_db_core.inc +++ b/install/install_db_core.inc @@ -158,7 +158,7 @@ class install_db if(ereg('[(]',$t_s)) { - $ts = split('[(]',$t_s); + $ts = preg_split('/[(]/',$t_s); $type = $ts[0]; $size = ereg_replace('[)]', '', $ts[1]); $flds[] = Array($field, $type, $size); @@ -423,7 +423,7 @@ class install_db if(ereg('[(]',$t_s)) { - $ts = split('[(]',$t_s); + $ts = preg_split('/[(]/',$t_s); $type = $ts[0]; $size = ereg_replace('[)]', '', $ts[1]); $flds[] = Array($field, $type, $size); diff --git a/modules/account/account.inc.php b/modules/account/account.inc.php index 872defe1..6fba0079 100644 --- a/modules/account/account.inc.php +++ b/modules/account/account.inc.php @@ -212,7 +212,7 @@ class account #################################################################### $type = 'add'; - $this->method["$type"] = split(",", $this->method["$type"]); + $this->method["$type"] = preg_split("/,/", $this->method["$type"]); $arr = $this->method["$type"]; include_once(PATH_CORE . 'validate.inc.php'); $validate = new CORE_validate; @@ -644,7 +644,7 @@ class account ### Retrieve the record: $type = "view"; - $this->method["$type"] = split(",", $this->method["$type"]); + $this->method["$type"] = explode(",", $this->method["$type"]); $db = new CORE_database; $db->view($VAR, $this, $type); @@ -843,7 +843,7 @@ class account ### Update the record $this->account_construct(); $type = "update"; - $this->method["$type"] = split(",", $this->method["$type"]); + $this->method["$type"] = explode(",", $this->method["$type"]); $db = new CORE_database; $db->update($VAR, $this, $type); diff --git a/modules/core/database_view.inc.php b/modules/core/database_view.inc.php index 07cc903c..3927deeb 100644 --- a/modules/core/database_view.inc.php +++ b/modules/core/database_view.inc.php @@ -45,7 +45,7 @@ function CORE_database_view($VAR, &$construct, $type) if(isset($VAR["id"])) { - $id = split(',',$VAR["id"]); + $id = explode(',',$VAR["id"]); for($i=0; $iid,$cookie_expire,'/'); else setcookie(COOKIE_NAME,$this->id,$cookie_expire,'/', $domain); diff --git a/modules/core/trigger.inc.php b/modules/core/trigger.inc.php index 385802be..0777da2c 100644 --- a/modules/core/trigger.inc.php +++ b/modules/core/trigger.inc.php @@ -40,12 +40,12 @@ class CORE_trigger function run_triggers($trigger) { global $C_method; - $triggers = split(',', $trigger); + $triggers = explode(',', $trigger); for($i=0; $i 1) { diff --git a/modules/core/xml.inc.php b/modules/core/xml.inc.php index f3d2eb33..fe3086b1 100644 --- a/modules/core/xml.inc.php +++ b/modules/core/xml.inc.php @@ -65,7 +65,7 @@ class CORE_xml // new XML to Array for PHP5 and SimpleXML function SimpleXML2Array($xml) { - if (get_class($xml) == 'SimpleXMLElement') { + if (is_object($xml) && get_class($xml) == 'SimpleXMLElement') { $attributes = $xml->attributes(); foreach($attributes as $k=>$v) { if ($v) $a[$k] = (string) $v; diff --git a/modules/setup/setup.inc.php b/modules/setup/setup.inc.php index 9310cda0..03edd953 100644 --- a/modules/setup/setup.inc.php +++ b/modules/setup/setup.inc.php @@ -75,7 +75,7 @@ class setup function view($VAR) { $type = "view"; - $this->method["$type"] = split(",", $this->method["$type"]); + $this->method["$type"] = explode(",", $this->method["$type"]); $db = new CORE_database; $db->view($VAR, $this, $type); } diff --git a/modules/setup/setup_construct.xml b/modules/setup/setup_construct.xml index df5321f5..c0e2abc7 100644 --- a/modules/setup/setup_construct.xml +++ b/modules/setup/setup_construct.xml @@ -95,7 +95,7 @@ C(16) - 0 + 1 X diff --git a/modules/setup/setup_install_data.xml b/modules/setup/setup_install_data.xml index 439f240d..57acb83f 100644 --- a/modules/setup/setup_install_data.xml +++ b/modules/setup/setup_install_data.xml @@ -27,7 +27,7 @@ 2 - 0 + 1 10 60 60 From 3b81e696518ef50bac6527133756d58af6346045 Mon Sep 17 00:00:00 2001 From: Tony Landis Date: Wed, 25 Mar 2009 22:30:13 -0600 Subject: [PATCH 2/3] More deprecated php methods --- includes/phplayers/layersmenu-common.inc.php | 4 ++-- modules/core/auth_generate_admin_menu.inc.php | 4 ++-- modules/core/database.inc.php | 2 +- modules/core/method.inc.php | 2 +- modules/core/theme.inc.php | 2 +- modules/db_mapping/db_mapping.inc.php | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/includes/phplayers/layersmenu-common.inc.php b/includes/phplayers/layersmenu-common.inc.php index 04f7aa3e..78e4ee56 100644 --- a/includes/phplayers/layersmenu-common.inc.php +++ b/includes/phplayers/layersmenu-common.inc.php @@ -484,7 +484,7 @@ function setMenuStructureFile($tree_file) */ function setMenuStructureString($tree_string) { - $this->menuStructure = ereg_replace(chr(13), '', $tree_string); // Microsoft Stupidity Suppression + $this->menuStructure = preg_replace("/".chr(13)."/", '', $tree_string); // Microsoft Stupidity Suppression if ($this->menuStructure == '') { $this->error('setMenuStructureString: empty string.'); return false; @@ -790,7 +790,7 @@ function _postParse( for ($cnt=$this->_firstItem[$menu_name]; $cnt<=$this->_lastItem[$menu_name]; $cnt++) { // this counter scans all nodes of the new menu $this->tree[$cnt]['child_of_root_node'] = ($this->tree[$cnt]['level'] == 1); $this->tree[$cnt]['parsed_text'] = stripslashes($this->tree[$cnt]['text']); - $this->tree[$cnt]['parsed_href'] = (ereg_replace(' ', '', $this->tree[$cnt]['href']) == '') ? '#' : $this->prependedUrl . $this->tree[$cnt]['href']; + $this->tree[$cnt]['parsed_href'] = (preg_replace('/ /', '', $this->tree[$cnt]['href']) == '') ? '#' : $this->prependedUrl . $this->tree[$cnt]['href']; $this->tree[$cnt]['parsed_title'] = ($this->tree[$cnt]['title'] == '') ? '' : ' title="' . stripslashes($this->tree[$cnt]['title']) . '"'; $fooimg = $this->icondir . $this->tree[$cnt]['icon']; if ($this->tree[$cnt]['icon'] != '' && (substr($this->tree[$cnt]['icon'], 0, 7) == 'http://' || substr($this->tree[$cnt]['icon'], 0, 8) == 'https://')) { diff --git a/modules/core/auth_generate_admin_menu.inc.php b/modules/core/auth_generate_admin_menu.inc.php index 767e765b..fcd26686 100644 --- a/modules/core/auth_generate_admin_menu.inc.php +++ b/modules/core/auth_generate_admin_menu.inc.php @@ -47,7 +47,7 @@ function auth_generate_admin_menu($menu_obj) if(empty($meth_arr[2])) $page = $module.':'.$method; else - $page = eregi_replace('%%', $module, $meth_arr[2]); + $page = preg_replace('/%%/', $module, $meth_arr[2]); $module_arr[$i]["methods"][] = Array('name' => $method_name, 'page' => $page); @@ -71,7 +71,7 @@ function auth_generate_admin_menu($menu_obj) if(empty($meth_arr[2])) $page = $module.':'.$method; else - $page = eregi_replace('%%', $module, $meth_arr[2]); + $page = preg_replace('/%%/', $module, $meth_arr[2]); $module_arr[$i]["sub_methods"][$ii][] = Array('name' => $method_name, 'page' => $page); } } diff --git a/modules/core/database.inc.php b/modules/core/database.inc.php index 1cde55df..7bd5b9e4 100644 --- a/modules/core/database.inc.php +++ b/modules/core/database.inc.php @@ -159,7 +159,7 @@ function sqlConditions( &$db, $Conditions=false, $Tables=false ) $where = " WHERE "; if($Conditions) { - if(ereg('::', $Conditions) ) { + if(preg_match('/::/', $Conditions) ) { $s = explode('::', $Conditions); $ii=1; $Conditions = ''; diff --git a/modules/core/method.inc.php b/modules/core/method.inc.php index b40f6a2a..93e02d54 100644 --- a/modules/core/method.inc.php +++ b/modules/core/method.inc.php @@ -29,7 +29,7 @@ class CORE_method { if(!empty($VAR['do'][$i])) { - if(ereg(":", $VAR['do'][$i])) + if(preg_match("/:/", $VAR['do'][$i])) { $identifier = explode(':',$VAR['do'][$i]); $module = $identifier[0]; diff --git a/modules/core/theme.inc.php b/modules/core/theme.inc.php index 6124e4e9..69e46cd5 100644 --- a/modules/core/theme.inc.php +++ b/modules/core/theme.inc.php @@ -77,7 +77,7 @@ class CORE_theme $i++; } } - $url = ereg_replace('tid=default_admin', '', $url); + $url = preg_replace('/tid=default_admin/', '', $url); $smarty->assign('mainFrameUrl', $url); $this_template = 'file:'.PATH_THEMES.''.THEME_NAME.'/template.tpl'; $smarty->display($this_template); diff --git a/modules/db_mapping/db_mapping.inc.php b/modules/db_mapping/db_mapping.inc.php index 09b86e2d..b37588f0 100644 --- a/modules/db_mapping/db_mapping.inc.php +++ b/modules/db_mapping/db_mapping.inc.php @@ -356,7 +356,7 @@ class db_mapping $this->construct(); $type = "view"; - $this->method["$type"] = split(",", $this->method["$type"]); + $this->method["$type"] = explode(",", $this->method["$type"]); $db = new CORE_database; $db->view($VAR, $this, $type); @@ -624,7 +624,7 @@ class db_mapping { if($file_name != '..' && $file_name != '.') { - $result[$count]['name'] = eregi_replace('.php', '', $file_name); + $result[$count]['name'] = preg_replace('/.php/', '', $file_name); $result[$count]['id'] = $count; ### Get the status of this plugin: From 944d0e2acdc4b8c77ccf2e18cb43192825b1ffe5 Mon Sep 17 00:00:00 2001 From: Tony Landis Date: Wed, 25 Mar 2009 22:30:37 -0600 Subject: [PATCH 3/3] Bugfix [#9] --- plugins/db_mapping/PostNuke_726.php | 2 +- plugins/db_mapping/osCommerce_22.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/db_mapping/PostNuke_726.php b/plugins/db_mapping/PostNuke_726.php index 6f671b0b..b36e0dab 100644 --- a/plugins/db_mapping/PostNuke_726.php +++ b/plugins/db_mapping/PostNuke_726.php @@ -198,7 +198,7 @@ class map_POSTNUKE_726 function sync($id, $file) { $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); + $this &= $db_map->MAP_sync ($id, $file, $this); } diff --git a/plugins/db_mapping/osCommerce_22.php b/plugins/db_mapping/osCommerce_22.php index f333f8e2..2ab394d3 100644 --- a/plugins/db_mapping/osCommerce_22.php +++ b/plugins/db_mapping/osCommerce_22.php @@ -187,7 +187,7 @@ class map_OSCOMMERCE_22 function sync($id, $file) { $db_map = new db_mapping; - $this = $db_map->MAP_sync ($id, $file, $this); + $db_map->MAP_sync ($id, $file, $this); }