Module: nagvis Branch: master Commit: a01f99d5983fe2cacf02ee969481170c991f4c79 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis/nagvis;a=commit;h=a01f99d5983fe2cacf02ee969481170c991f4c79
Author: Lars Michelsen <[email protected]> Date: Fri Sep 25 13:49:20 2009 +0200 #122 Removed all ereg calls and replaced them with preg_match --- .../classes/validator/GlobalValidatorBoolean.php | 4 ++-- .../classes/validator/GlobalValidatorInteger.php | 4 ++-- share/frontend/wui/includes/classes/WuiMainCfg.php | 4 ++-- share/frontend/wui/includes/classes/WuiMapCfg.php | 2 +- .../wui/includes/functions/form_handler.php | 2 +- share/server/core/classes/GlobalMainCfg.php | 8 ++++---- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/share/frontend/nagvis-js/classes/validator/GlobalValidatorBoolean.php b/share/frontend/nagvis-js/classes/validator/GlobalValidatorBoolean.php index ee876f1..6eb048d 100644 --- a/share/frontend/nagvis-js/classes/validator/GlobalValidatorBoolean.php +++ b/share/frontend/nagvis-js/classes/validator/GlobalValidatorBoolean.php @@ -98,7 +98,7 @@ class GlobalValidatorBoolean extends GlobalValidatorAbstract { * @author Michael Luebben <[email protected]> */ protected function isBoolean() { - if (eregi('[0-1]',$this->parameterValue)) { + if (preg_match('/[0-1]/', $this->parameterValue)) { return TRUE; } elseif ('TRUE' == strtoupper($this->parameterValue) || 'FALSE' == strtoupper($this->parameterValue)) { return TRUE; @@ -108,4 +108,4 @@ class GlobalValidatorBoolean extends GlobalValidatorAbstract { } } } -?> \ No newline at end of file +?> diff --git a/share/frontend/nagvis-js/classes/validator/GlobalValidatorInteger.php b/share/frontend/nagvis-js/classes/validator/GlobalValidatorInteger.php index acac948..736d9ca 100644 --- a/share/frontend/nagvis-js/classes/validator/GlobalValidatorInteger.php +++ b/share/frontend/nagvis-js/classes/validator/GlobalValidatorInteger.php @@ -105,7 +105,7 @@ class GlobalValidatorInteger extends GlobalValidatorAbstract { * @author Michael Luebben <[email protected]> */ protected function isInteger() { - if (eregi('^[0-9]*$',$this->parameterValue)) { + if (preg_match('/^[0-9]*$/i', $this->parameterValue)) { return TRUE; } else { $this->setMessage('validatorNotValidInteger'); @@ -129,4 +129,4 @@ class GlobalValidatorInteger extends GlobalValidatorAbstract { } } } -?> \ No newline at end of file +?> diff --git a/share/frontend/wui/includes/classes/WuiMainCfg.php b/share/frontend/wui/includes/classes/WuiMainCfg.php index b925514..27f4e82 100644 --- a/share/frontend/wui/includes/classes/WuiMainCfg.php +++ b/share/frontend/wui/includes/classes/WuiMainCfg.php @@ -76,13 +76,13 @@ class WuiMainCfg extends GlobalMainCfg { */ function setSection($sec) { // Try to append new backends after already defined - if(ereg('^backend_', $sec)) { + if(preg_match('/^backend_/', $sec)) { $lastBackendIndex = 0; $i = 0; // Loop all sections to find the last defined backend foreach($this->config AS $type => $vars) { // If the current section is a backend - if(ereg('^backend_', $type)) { + if(preg_match('/^backend_/', $type)) { $lastBackendIndex = $i; } $i++; diff --git a/share/frontend/wui/includes/classes/WuiMapCfg.php b/share/frontend/wui/includes/classes/WuiMapCfg.php index 03edc76..e753ddd 100644 --- a/share/frontend/wui/includes/classes/WuiMapCfg.php +++ b/share/frontend/wui/includes/classes/WuiMapCfg.php @@ -166,7 +166,7 @@ class WuiMapCfg extends GlobalMapCfg { $done = FALSE; while(isset($file[$l]) && $file[$l] != '' && $done == FALSE) { // ignore comments - if(!ereg('^#',$file[$l]) && !ereg('^;',$file[$l])) { + if(!preg_match('/^#/',$file[$l]) && !preg_match('/^;/',$file[$l])) { $defineCln = explode('{', $file[$l]); $define = explode(' ',$defineCln[0]); // select only elements of the given type diff --git a/share/frontend/wui/includes/functions/form_handler.php b/share/frontend/wui/includes/functions/form_handler.php index 115b91f..c012786 100644 --- a/share/frontend/wui/includes/functions/form_handler.php +++ b/share/frontend/wui/includes/functions/form_handler.php @@ -89,7 +89,7 @@ function backup(&$MAINCFG, $mapname) { // is status for this map there? $file = file($MAINCFG->getValue('paths', 'mapcfg').'autobackup.status'); foreach($file AS $key => $val) { - if(ereg("^".$mapname."=",$val)) { + if(preg_match('/^'.$mapname.'=/',$val)) { // $arr[1] is value $arr = explode('=',$val); diff --git a/share/server/core/classes/GlobalMainCfg.php b/share/server/core/classes/GlobalMainCfg.php index bfa497f..34e3054 100644 --- a/share/server/core/classes/GlobalMainCfg.php +++ b/share/server/core/classes/GlobalMainCfg.php @@ -969,17 +969,17 @@ class GlobalMainCfg { private function checkMainConfigIsValid($printErr) { // check given objects and attributes foreach($this->config AS $type => &$vars) { - if(!ereg('^comment_',$type)) { - if(isset($this->validConfig[$type]) || ereg('^(backend|rotation)_', $type)) { + if(!preg_match('/^comment_/',$type)) { + if(isset($this->validConfig[$type]) || preg_match('/^(backend|rotation)_/', $type)) { // loop validConfig for checking: => missing "must" atributes - if(ereg('^backend_', $type)) { + if(preg_match('/^backend_/', $type)) { if(isset($this->validConfig['backend']['options'][$this->getValue($type,'backendtype')]) && is_array($this->validConfig['backend']['options'][$this->getValue($type,'backendtype')])) { $arrValidConfig = array_merge($this->validConfig['backend'], $this->validConfig['backend']['options'][$this->getValue($type,'backendtype')]); } else { $arrValidConfig = $this->validConfig['backend']; } - } elseif(ereg('^rotation_', $type)) { + } elseif(preg_match('/^rotation_/', $type)) { $arrValidConfig = $this->validConfig['rotation']; } else { $arrValidConfig = $this->validConfig[$type]; ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
