Add check to ensure the app hook was installed, if not don't dump errors about

the function not existing
This commit is contained in:
Miles Lott 2002-02-02 19:01:17 +00:00
parent ffd4bfe29c
commit 7d1f940b00

View File

@ -166,60 +166,67 @@
switch ($type) switch ($type)
{ {
case 'lang': case 'lang':
$t->set_var($value,lang($newval)); $t->set_var($value,lang($newval));
break; break;
case 'value': case 'value':
$newval = ereg_replace(' ','_',$newval); $newval = ereg_replace(' ','_',$newval);
/* Don't show passwords in the form */ /* Don't show passwords in the form */
if(ereg('passwd',$value) || ereg('password',$value) || ereg('root_pw',$value)) if(ereg('passwd',$value) || ereg('password',$value) || ereg('root_pw',$value))
{ {
$t->set_var($value,''); $t->set_var($value,'');
} }
else else
{ {
$t->set_var($value,$current_config[$newval]); $t->set_var($value,$current_config[$newval]);
} }
break; break;
/* /*
case 'checked': case 'checked':
$newval = ereg_replace(' ','_',$newval); $newval = ereg_replace(' ','_',$newval);
if ($current_config[$newval]) if ($current_config[$newval])
{ {
$t->set_var($value,' checked'); $t->set_var($value,' checked');
} }
else else
{ {
$t->set_var($value,''); $t->set_var($value,'');
} }
break; break;
*/ */
case 'selected': case 'selected':
$configs = array(); $configs = array();
$config = ''; $config = '';
$newvals = explode(' ',$newval); $newvals = explode(' ',$newval);
$setting = end($newvals); $setting = end($newvals);
for ($i=0;$i<(count($newvals) - 1); $i++) for ($i=0;$i<(count($newvals) - 1); $i++)
{ {
$configs[] = $newvals[$i]; $configs[] = $newvals[$i];
} }
$config = implode('_',$configs); $config = implode('_',$configs);
/* echo $config . '=' . $current_config[$config]; */ /* echo $config . '=' . $current_config[$config]; */
if ($current_config[$config] == $setting) if ($current_config[$config] == $setting)
{ {
$t->set_var($value,' selected'); $t->set_var($value,' selected');
} }
else else
{ {
$t->set_var($value,''); $t->set_var($value,'');
} }
break; break;
case 'hook': case 'hook':
$newval = ereg_replace(' ','_',$newval); $newval = ereg_replace(' ','_',$newval);
$t->set_var($value,$newval($current_config)); if(function_exists($newval))
break; {
$t->set_var($value,$newval($current_config));
}
else
{
$t->set_var($value,'');
}
break;
default: default:
$t->set_var($value,''); $t->set_var($value,'');
break; break;
} }
} }