From 1df412f9c41759b90e2430768f0a0803e382f547 Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Wed, 10 Dec 2003 11:45:03 +0000 Subject: [PATCH] ereg_replace/intval update --- phpgwapi/inc/common_functions.inc.php | 39 +++++++++++++-------------- setup/config.php | 6 ++--- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/phpgwapi/inc/common_functions.inc.php b/phpgwapi/inc/common_functions.inc.php index af118cd14c..d2c942be00 100755 --- a/phpgwapi/inc/common_functions.inc.php +++ b/phpgwapi/inc/common_functions.inc.php @@ -206,7 +206,7 @@ /* start by looping thru the expected list and set params with */ /* the default values */ $num = count($expected); - for ($i = 0; $i < $num; $i++) + for ($i = 0; $i < $num; $i++) { $args[$expected[$i]['name']] = $expected[$i]['default']; if ($expected[$i]['default'] === '##REQUIRED##') @@ -214,7 +214,7 @@ $required[$expected[$i]['name']] = True; } $types[$expected[$i]['name']] = $expected[$i]['type']; - } + } /* Make sure they passed at least one param */ if(count($recieved) != 0) @@ -222,7 +222,7 @@ /* if used as standard function we loop thru and set by position */ if(!is_array($recieved[0])) { - for ($i = 0; $i < $num; $i++) + for ($i = 0; $i < $num; $i++) { if(isset($recieved[$i]) && $recieved[$i] !== '##DEFAULT##') { @@ -237,15 +237,15 @@ exit; } } - } + } } /* if used as standard function we loop thru and set by position */ else { - for ($i = 0; $i < $num; $i++) + for ($i = 0; $i < $num; $i++) { $types[$expected[$i]['name']] = $expected[$i]['type']; - } + } while(list($key,$val) = each($recieved[0])) { if($val !== '##DEFAULT##') @@ -879,13 +879,13 @@ { return $GLOBALS['phpgw']->accounts->name2id($default_id); } - return intval($default_id); + return (int)$default_id; } elseif (is_string($account_id)) { - if($GLOBALS['phpgw']->accounts->exists(intval($account_id)) == True) + if($GLOBALS['phpgw']->accounts->exists((int)$account_id) == True) { - return intval($account_id); + return (int)$account_id; } else { @@ -957,8 +957,8 @@ echo'
Input values: ' . 'A="'.$a.'", B="'.$b.'"'; } - $newa = ereg_replace('pre','.',$a); - $newb = ereg_replace('pre','.',$b); + $newa = str_replace('pre','.',$a); + $newb = str_replace('pre','.',$b); $testa = explode('.',$newa); if(@$testa[1] == '') { @@ -981,8 +981,8 @@ for ($i=0;$iChecking if '. intval($testa[$i]) . ' is less than ' . intval($testb[$i]) . ' ...'; } - if (intval($testa[$i]) < intval($testb[$i])) + if ($DEBUG) { echo'
Checking if '. (int)$testa[$i] . ' is less than ' . (int)$testb[$i] . ' ...'; } + if ((int)$testa[$i] < (int)$testb[$i]) { if ($DEBUG) { echo ' yes.'; } $less++; @@ -994,7 +994,7 @@ break; } } - elseif(intval($testa[$i]) > intval($testb[$i])) + elseif((int)$testa[$i] > (int)$testb[$i]) { if ($DEBUG) { echo ' no.'; } $less--; @@ -1046,8 +1046,8 @@ echo'
Input values: ' . 'A="'.$a.'", B="'.$b.'"'; } - $newa = ereg_replace('pre','.',$a); - $newb = ereg_replace('pre','.',$b); + $newa = str_replace('pre','.',$a); + $newb = str_replace('pre','.',$b); $testa = explode('.',$newa); if($testa[3] == '') { @@ -1062,8 +1062,8 @@ for ($i=0;$iChecking if '. intval($testa[$i]) . ' is more than ' . intval($testb[$i]) . ' ...'; } - if (intval($testa[$i]) > intval($testb[$i])) + if ($DEBUG) { echo'
Checking if '. (int)$testa[$i] . ' is more than ' . (int)$testb[$i] . ' ...'; } + if ((int)$testa[$i] > (int)$testb[$i]) { if ($DEBUG) { echo ' yes.'; } $less++; @@ -1075,7 +1075,7 @@ break; } } - elseif(intval($testa[$i]) < intval($testb[$i])) + elseif((int)$testa[$i] < (int)$testb[$i]) { if ($DEBUG) { echo ' no.'; } $less--; @@ -1153,5 +1153,4 @@ } return $_GET['menuaction'] ? $_GET['menuaction'] : str_replace(PHPGW_SERVER_ROOT,'',$_SERVER['SCRIPT_FILENAME']); } - ?> diff --git a/setup/config.php b/setup/config.php index 038edb277a..9da896c99d 100644 --- a/setup/config.php +++ b/setup/config.php @@ -87,7 +87,7 @@ if(@get_var('submit',Array('POST')) && @$newsettings && !$files_in_docroot) { $datetime = CreateObject('phpgwapi.datetime'); - switch (intval($newsettings['daytime_port'])) + switch((int)$newsettings['daytime_port']) { case 13: $newsettings['tz_offset'] = $datetime->getntpoffset(); @@ -224,7 +224,7 @@ $t->set_var($value,lang($newval)); break; case 'value': - $newval = ereg_replace(' ','_',$newval); + $newval = str_replace(' ','_',$newval); /* Don't show passwords in the form */ if(ereg('passwd',$value) || ereg('password',$value) || ereg('root_pw',$value)) { @@ -256,7 +256,7 @@ } break; case 'hook': - $newval = ereg_replace(' ','_',$newval); + $newval = str_replace(' ','_',$newval); $t->set_var($value,$newval($current_config)); break; default: