Use in_array()

This commit is contained in:
Miles Lott 2002-03-08 04:10:58 +00:00
parent ddfa5d9d4b
commit bb762ae965
3 changed files with 4 additions and 16 deletions

View File

@ -519,7 +519,7 @@
{ {
$indexes[] = $val['index_name']; $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__); $oProc->m_odb->query("DROP INDEX " . $sOldTableName . "_pkey",__LINE__,__FILE__);
} }

View File

@ -171,7 +171,7 @@
function add_langs($appname,$DEBUG=False,$force_en=False) function add_langs($appname,$DEBUG=False,$force_en=False)
{ {
$langs = $this->get_langs($DEBUG); $langs = $this->get_langs($DEBUG);
if($force_en && !isinarray('en',$langs)) if($force_en && !@in_array('en',$langs))
{ {
$langs[] = 'en'; $langs[] = 'en';
} }

View File

@ -48,23 +48,11 @@
$this->add_app($appname,$lang); $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) function translate($key, $vars=False)
{ {
global $lang; 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') $GLOBALS['phpgw_info']['flags']['currentapp'] != 'home')
{ {
//echo '<br>loading app "' . $GLOBALS['phpgw_info']['flags']['currentapp'] . '" for the first time.'; //echo '<br>loading app "' . $GLOBALS['phpgw_info']['flags']['currentapp'] . '" for the first time.';
@ -79,7 +67,7 @@
@ksort($GLOBALS['phpgw_info']['apps']); @ksort($GLOBALS['phpgw_info']['apps']);
while(list($x,$app) = each($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 '<br>loading app "' . $app['name'] . '" for the first time.'; //echo '<br>loading app "' . $app['name'] . '" for the first time.';
$this->add_app($app['name'],$lang); $this->add_app($app['name'],$lang);