Removed: Function eregi() and eregi_replace()

Added: preg_match() and preg_replace()
This commit is contained in:
abraar
2010-12-08 15:05:47 +00:00
parent dc51b8e4d2
commit 63cb1fa5ad
9 changed files with 51 additions and 44 deletions

View File

@@ -1818,7 +1818,8 @@ function get_plugins() {
function lookup($target) { function lookup($target) {
global $ntarget; global $ntarget;
$msg = $target . ' => '; $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); $ntarget = gethostbyname($target);
else else
$ntarget = gethostbyaddr($target); $ntarget = gethostbyaddr($target);

View File

@@ -115,7 +115,8 @@ if( isset($request) ){
} catch(Exception $e){ } catch(Exception $e){
$err = $e->getMessage(); $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.'"}'; echo '{"status":1, "message":"'.$err.'"}';
} }
break; break;
@@ -138,7 +139,8 @@ if( isset($request) ){
echo '{status:0, message:"success"}'; echo '{status:0, message:"success"}';
}catch( Exception $e){ }catch( Exception $e){
$err = $e->getMessage(); $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.'"}'; echo '{result:1, message:"'.$err.'"}';
} }
break; break;

View File

@@ -524,7 +524,8 @@ class G
*/ */
function lookup($target) 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); $ntarget = gethostbyname($target);
else else
$ntarget = gethostbyaddr($target); $ntarget = gethostbyaddr($target);

View File

@@ -59,7 +59,7 @@ function node_have_class($root, $target_class) {
$classes = preg_split("/\s+/", strtolower($root->get_attribute('class'))); $classes = preg_split("/\s+/", strtolower($root->get_attribute('class')));
foreach ($classes as $class) { foreach ($classes as $class) {
if ($class == $target_class) { if (is_object($target_class) && $class == $target_class) {
return true; return true;
}; };
}; };

View File

@@ -1,42 +1,43 @@
<?php <?php
/** /**
* dbInfo.php * dbInfo.php
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23 * Copyright (C) 2004 - 2008 Colosa Inc.23
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* *
*/ */
function lookup($target) function lookup($target)
{ {
global $ntarget; global $ntarget;
$msg = $target . ' => '; $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); $ntarget = gethostbyname($target);
else else
$ntarget = gethostbyaddr($target); $ntarget = gethostbyaddr($target);
$msg .= $ntarget; $msg .= $ntarget;
return($msg); return($msg);
} }
$G_MAIN_MENU = 'rbac.login'; $G_MAIN_MENU = 'rbac.login';
$G_MENU_SELECTED = 1; $G_MENU_SELECTED = 1;
if (file_exists(PATH_METHODS . 'login/version-rbac.php')) if (file_exists(PATH_METHODS . 'login/version-rbac.php'))
{ {
include('version-rbac.php'); include('version-rbac.php');
@@ -45,8 +46,8 @@ function lookup($target)
define('RBAC_VERSION', 'Development Version'); define('RBAC_VERSION', 'Development Version');
} }
$dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME ); $dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME );
$ses = new DBSession ($dbc); $ses = new DBSession ($dbc);
$dset = $ses->execute ('SELECT VERSION() AS VERSION '); $dset = $ses->execute ('SELECT VERSION() AS VERSION ');
$row = $dset->Read(); $row = $dset->Read();
@@ -66,7 +67,7 @@ function lookup($target)
fclose( $fp ); fclose( $fp );
} }
$Fields = $dbc->db->dsn; $Fields = $dbc->db->dsn;
$Fields['SYSTEM'] = $redhat; $Fields['SYSTEM'] = $redhat;
$Fields['MYSQL'] = $row['VERSION']; $Fields['MYSQL'] = $row['VERSION'];
$Fields['PHP'] = phpversion(); $Fields['PHP'] = phpversion();
@@ -80,9 +81,9 @@ function lookup($target)
$Fields['REMOTE_HOST'] = getenv('REMOTE_HOST'); $Fields['REMOTE_HOST'] = getenv('REMOTE_HOST');
$Fields['SERVER_ADDR'] = getenv('SERVER_ADDR'); $Fields['SERVER_ADDR'] = getenv('SERVER_ADDR');
$Fields['HTTP_USER_AGENT'] = getenv('HTTP_USER_AGENT'); $Fields['HTTP_USER_AGENT'] = getenv('HTTP_USER_AGENT');
$Fields['a'] = $dbc; $Fields['a'] = $dbc;
$G_PUBLISH = new Publisher; $G_PUBLISH = new Publisher;
$G_PUBLISH->SetTo($dbc); $G_PUBLISH->SetTo($dbc);
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'rbac/dbInfo', '', $Fields, 'appNew2'); $G_PUBLISH->AddContent('xmlform', 'xmlform', 'rbac/dbInfo', '', $Fields, 'appNew2');
G::RenderPage( 'publish'); G::RenderPage( 'publish');
?> ?>

View File

@@ -37,7 +37,8 @@
function lookup($target){ function lookup($target){
global $ntarget; global $ntarget;
$msg = "$target => "; $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); $ntarget = gethostbyname($target);
else else
$ntarget = gethostbyaddr($target); $ntarget = gethostbyaddr($target);

View File

@@ -789,7 +789,8 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
* added by krlos carlos/a/colosa.com * added by krlos carlos/a/colosa.com
* in here we are validation if a xmlform has a submit action * 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; $_SESSION['submitAction']= 1;
$answer = 'noSub'; $answer = 'noSub';
} }

View File

@@ -28,7 +28,7 @@ function lookup( $target ) {
global $ntarget; global $ntarget;
$msg = $target . ' => '; $msg = $target . ' => ';
//if (eregi ( '[a-zA-Z]', $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 ); $ntarget = gethostbyname ( $target );
else else
$ntarget = gethostbyaddr ( $target ); $ntarget = gethostbyaddr ( $target );

View File

@@ -51,7 +51,7 @@ $html = '
'Internet Explorer 4' => '(MSIE 4\.[0-9]+)', 'Internet Explorer 4' => '(MSIE 4\.[0-9]+)',
); );
foreach($browsers as $browser=>$pattern){ foreach($browsers as $browser=>$pattern){
if (eregi($pattern, $user_agent)) if (preg_match($pattern, $user_agent))
return $browser; return $browser;
} }
return 'Unknown'; return 'Unknown';