From bb762ae965f55c0a7cec9a47cda182ee3370adab Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Fri, 8 Mar 2002 04:10:58 +0000 Subject: [PATCH] Use in_array() --- phpgwapi/inc/class.schema_proc_pgsql.inc.php | 2 +- phpgwapi/inc/class.setup_translation.inc.php | 2 +- phpgwapi/inc/class.translation_file.inc.php | 16 ++-------------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/phpgwapi/inc/class.schema_proc_pgsql.inc.php b/phpgwapi/inc/class.schema_proc_pgsql.inc.php index 37496a099d..48306afef1 100644 --- a/phpgwapi/inc/class.schema_proc_pgsql.inc.php +++ b/phpgwapi/inc/class.schema_proc_pgsql.inc.php @@ -519,7 +519,7 @@ { $indexes[] = $val['index_name']; } - if(isinarray($sOldTableName . '_pkey',$indexes)) + if(!in_array($sOldTableName . '_pkey',$indexes)) { $oProc->m_odb->query("DROP INDEX " . $sOldTableName . "_pkey",__LINE__,__FILE__); } diff --git a/phpgwapi/inc/class.setup_translation.inc.php b/phpgwapi/inc/class.setup_translation.inc.php index 238fadbe14..2df184c520 100644 --- a/phpgwapi/inc/class.setup_translation.inc.php +++ b/phpgwapi/inc/class.setup_translation.inc.php @@ -171,7 +171,7 @@ function add_langs($appname,$DEBUG=False,$force_en=False) { $langs = $this->get_langs($DEBUG); - if($force_en && !isinarray('en',$langs)) + if($force_en && !@in_array('en',$langs)) { $langs[] = 'en'; } diff --git a/phpgwapi/inc/class.translation_file.inc.php b/phpgwapi/inc/class.translation_file.inc.php index ed0c690ffb..79b9606723 100644 --- a/phpgwapi/inc/class.translation_file.inc.php +++ b/phpgwapi/inc/class.translation_file.inc.php @@ -48,23 +48,11 @@ $this->add_app($appname,$lang); } - function isin_array($needle,$haystack) - { - while (list ($k,$v) = each($haystack)) - { - if ($v == $needle) - { - return True; - } - } - return False; - } - function translate($key, $vars=False) { global $lang; - if (!$this->isin_array($GLOBALS['phpgw_info']['flags']['currentapp'],$this->loaded_apps) && + if (!@in_array($GLOBALS['phpgw_info']['flags']['currentapp'],$this->loaded_apps) && $GLOBALS['phpgw_info']['flags']['currentapp'] != 'home') { //echo '
loading app "' . $GLOBALS['phpgw_info']['flags']['currentapp'] . '" for the first time.'; @@ -79,7 +67,7 @@ @ksort($GLOBALS['phpgw_info']['apps']); while(list($x,$app) = each($GLOBALS['phpgw_info']['apps'])) { - if (!$this->isin_array($app['name'],$this->loaded_apps)) + if (!@in_array($app['name'],$this->loaded_apps)) { //echo '
loading app "' . $app['name'] . '" for the first time.'; $this->add_app($app['name'],$lang);