From 63cb1fa5ad800e739611a73bc6342b100818d9c3 Mon Sep 17 00:00:00 2001 From: abraar Date: Wed, 8 Dec 2010 15:05:47 +0000 Subject: [PATCH] Removed: Function eregi() and eregi_replace() Added: preg_match() and preg_replace() --- gulliver/bin/tasks/pakeGulliver.php | 3 +- gulliver/methods/genericAjax.php | 6 +- gulliver/system/class.g.php | 3 +- .../html2ps_pdf/css.selectors.inc.php | 2 +- rbac/engine/methods/login/dbInfo.php | 71 ++++++++++--------- rbac/engine/methods/rbac/dbInfo.php | 3 +- .../engine/classes/class.dynaformEditor.php | 3 +- workflow/engine/methods/login/dbInfo.php | 2 +- .../templates/appFolder/appFolderTree.php | 2 +- 9 files changed, 51 insertions(+), 44 deletions(-) diff --git a/gulliver/bin/tasks/pakeGulliver.php b/gulliver/bin/tasks/pakeGulliver.php index d130b380d..0f3959a35 100644 --- a/gulliver/bin/tasks/pakeGulliver.php +++ b/gulliver/bin/tasks/pakeGulliver.php @@ -1818,7 +1818,8 @@ function get_plugins() { function lookup($target) { global $ntarget; $msg = $target . ' => '; - if( eregi('[a-zA-Z]', $target) ) + //if( eregi('[a-zA-Z]', $target) ) + if( preg_match('[a-zA-Z]', $target) ) //Made compatible to PHP 5.3 $ntarget = gethostbyname($target); else $ntarget = gethostbyaddr($target); diff --git a/gulliver/methods/genericAjax.php b/gulliver/methods/genericAjax.php index fd94c20a1..b1f4fb35c 100644 --- a/gulliver/methods/genericAjax.php +++ b/gulliver/methods/genericAjax.php @@ -115,7 +115,8 @@ if( isset($request) ){ } catch(Exception $e){ $err = $e->getMessage(); - $err = eregi_replace("[\n|\r|\n\r]", ' ', $err); + //$err = eregi_replace("[\n|\r|\n\r]", ' ', $err); + $err = preg_replace("[\n|\r|\n\r]", ' ', $err);//Made compatible to PHP 5.3 echo '{"status":1, "message":"'.$err.'"}'; } break; @@ -138,7 +139,8 @@ if( isset($request) ){ echo '{status:0, message:"success"}'; }catch( Exception $e){ $err = $e->getMessage(); - $err = eregi_replace("[\n|\r|\n\r]", ' ', $err); + //$err = eregi_replace("[\n|\r|\n\r]", ' ', $err); + $err = preg_replace("[\n|\r|\n\r]", ' ', $err);//Made compatible to PHP 5.3 echo '{result:1, message:"'.$err.'"}'; } break; diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 13595b63c..7663c5c3f 100644 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -524,7 +524,8 @@ class G */ function lookup($target) { - if( eregi("[a-zA-Z]", $target) ) + //if( eregi("[a-zA-Z]", $target) ) + if( preg_match("[a-zA-Z]", $target) )//Made compatible to PHP 5.3 $ntarget = gethostbyname($target); else $ntarget = gethostbyaddr($target); diff --git a/gulliver/thirdparty/html2ps_pdf/css.selectors.inc.php b/gulliver/thirdparty/html2ps_pdf/css.selectors.inc.php index 60adfdfb5..7265a7f74 100644 --- a/gulliver/thirdparty/html2ps_pdf/css.selectors.inc.php +++ b/gulliver/thirdparty/html2ps_pdf/css.selectors.inc.php @@ -59,7 +59,7 @@ function node_have_class($root, $target_class) { $classes = preg_split("/\s+/", strtolower($root->get_attribute('class'))); foreach ($classes as $class) { - if ($class == $target_class) { + if (is_object($target_class) && $class == $target_class) { return true; }; }; diff --git a/rbac/engine/methods/login/dbInfo.php b/rbac/engine/methods/login/dbInfo.php index b1e14635a..060957ca9 100644 --- a/rbac/engine/methods/login/dbInfo.php +++ b/rbac/engine/methods/login/dbInfo.php @@ -1,42 +1,43 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * +/** + * dbInfo.php + * + * ProcessMaker Open Source Edition + * Copyright (C) 2004 - 2008 Colosa Inc.23 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * */ function lookup($target) { global $ntarget; $msg = $target . ' => '; - if( eregi('[a-zA-Z]', $target) ) + //if( eregi('[a-zA-Z]', $target) ) + if( preg_match('[a-zA-Z]', $target) ) //Made compatible to PHP 5.3 $ntarget = gethostbyname($target); else $ntarget = gethostbyaddr($target); $msg .= $ntarget; return($msg); } - - $G_MAIN_MENU = 'rbac.login'; - $G_MENU_SELECTED = 1; - + + $G_MAIN_MENU = 'rbac.login'; + $G_MENU_SELECTED = 1; + if (file_exists(PATH_METHODS . 'login/version-rbac.php')) { include('version-rbac.php'); @@ -45,8 +46,8 @@ function lookup($target) define('RBAC_VERSION', 'Development Version'); } - $dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME ); - $ses = new DBSession ($dbc); + $dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME ); + $ses = new DBSession ($dbc); $dset = $ses->execute ('SELECT VERSION() AS VERSION '); $row = $dset->Read(); @@ -66,7 +67,7 @@ function lookup($target) fclose( $fp ); } - $Fields = $dbc->db->dsn; + $Fields = $dbc->db->dsn; $Fields['SYSTEM'] = $redhat; $Fields['MYSQL'] = $row['VERSION']; $Fields['PHP'] = phpversion(); @@ -80,9 +81,9 @@ function lookup($target) $Fields['REMOTE_HOST'] = getenv('REMOTE_HOST'); $Fields['SERVER_ADDR'] = getenv('SERVER_ADDR'); $Fields['HTTP_USER_AGENT'] = getenv('HTTP_USER_AGENT'); - $Fields['a'] = $dbc; - $G_PUBLISH = new Publisher; - $G_PUBLISH->SetTo($dbc); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'rbac/dbInfo', '', $Fields, 'appNew2'); - G::RenderPage( 'publish'); + $Fields['a'] = $dbc; + $G_PUBLISH = new Publisher; + $G_PUBLISH->SetTo($dbc); + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'rbac/dbInfo', '', $Fields, 'appNew2'); + G::RenderPage( 'publish'); ?> \ No newline at end of file diff --git a/rbac/engine/methods/rbac/dbInfo.php b/rbac/engine/methods/rbac/dbInfo.php index 764b314fd..cf86b1c7b 100644 --- a/rbac/engine/methods/rbac/dbInfo.php +++ b/rbac/engine/methods/rbac/dbInfo.php @@ -37,7 +37,8 @@ function lookup($target){ global $ntarget; $msg = "$target => "; - if( eregi("[a-zA-Z]", $target) ) + //if( eregi("[a-zA-Z]", $target) ) + if( preg_match("[a-zA-Z]", $target) ) //Made compatible to PHP 5.3 $ntarget = gethostbyname($target); else $ntarget = gethostbyaddr($target); diff --git a/workflow/engine/classes/class.dynaformEditor.php b/workflow/engine/classes/class.dynaformEditor.php index 55b49921d..82d39fae1 100755 --- a/workflow/engine/classes/class.dynaformEditor.php +++ b/workflow/engine/classes/class.dynaformEditor.php @@ -789,7 +789,8 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax * added by krlos carlos/a/colosa.com * in here we are validation if a xmlform has a submit action */ - if(!eregi('type="submit"',$copy) && !eregi('type="grid"',$copy) && !isset($_SESSION['submitAction']) ){ + if(!preg_match("/type=\"submit\"/",$copy) && !preg_match("/type=\"grid\"/",$copy) && !isset($_SESSION['submitAction']) ){ + $_SESSION['submitAction']= 1; $answer = 'noSub'; } diff --git a/workflow/engine/methods/login/dbInfo.php b/workflow/engine/methods/login/dbInfo.php index e4da659bd..cbe7ddab2 100644 --- a/workflow/engine/methods/login/dbInfo.php +++ b/workflow/engine/methods/login/dbInfo.php @@ -28,7 +28,7 @@ function lookup( $target ) { global $ntarget; $msg = $target . ' => '; //if (eregi ( '[a-zA-Z]', $target )) - if (preg_match( '[a-zA-Z]', $target )) + if (preg_match( '[a-zA-Z]', $target )) //Made compatible to PHP 5.3 $ntarget = gethostbyname ( $target ); else $ntarget = gethostbyaddr ( $target ); diff --git a/workflow/engine/templates/appFolder/appFolderTree.php b/workflow/engine/templates/appFolder/appFolderTree.php index 8e37a2f00..eb3b7a498 100755 --- a/workflow/engine/templates/appFolder/appFolderTree.php +++ b/workflow/engine/templates/appFolder/appFolderTree.php @@ -51,7 +51,7 @@ $html = ' 'Internet Explorer 4' => '(MSIE 4\.[0-9]+)', ); foreach($browsers as $browser=>$pattern){ - if (eregi($pattern, $user_agent)) + if (preg_match($pattern, $user_agent)) return $browser; } return 'Unknown';