mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 01:13:25 +01:00
change validation of configuration to return existing validation functions, not running arbitrary ones
This commit is contained in:
parent
54e241f468
commit
df8f6b9460
@ -118,12 +118,12 @@ class uiconfig
|
|||||||
if ($config)
|
if ($config)
|
||||||
{
|
{
|
||||||
$c->config_data[$key] = $config;
|
$c->config_data[$key] = $config;
|
||||||
if($GLOBALS['egw_info']['server']['found_validation_hook'] && function_exists($key))
|
if (in_array($key, (array)$GLOBALS['egw_info']['server']['found_validation_hook'], true) && function_exists($key))
|
||||||
{
|
{
|
||||||
call_user_func($key,$config);
|
call_user_func($key,$config);
|
||||||
if($GLOBALS['config_error'])
|
if($GLOBALS['config_error'])
|
||||||
{
|
{
|
||||||
$errors .= lang($GLOBALS['config_error']) . ' ';
|
$errors .= lang($GLOBALS['config_error']) . "\n";
|
||||||
$GLOBALS['config_error'] = False;
|
$GLOBALS['config_error'] = False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -134,12 +134,13 @@ class uiconfig
|
|||||||
unset($c->config_data[$key]);
|
unset($c->config_data[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($GLOBALS['egw_info']['server']['found_validation_hook'] && function_exists('final_validation'))
|
if(in_array('final_validation', (array)$GLOBALS['egw_info']['server']['found_validation_hook']) &&
|
||||||
|
function_exists('final_validation'))
|
||||||
{
|
{
|
||||||
final_validation($_POST['newsettings']);
|
final_validation($_POST['newsettings']);
|
||||||
if($GLOBALS['config_error'])
|
if($GLOBALS['config_error'])
|
||||||
{
|
{
|
||||||
$errors .= lang($GLOBALS['config_error']) . ' ';
|
$errors .= lang($GLOBALS['config_error']) . "\n";
|
||||||
$GLOBALS['config_error'] = False;
|
$GLOBALS['config_error'] = False;
|
||||||
}
|
}
|
||||||
unset($GLOBALS['egw_info']['server']['found_validation_hook']);
|
unset($GLOBALS['egw_info']['server']['found_validation_hook']);
|
||||||
|
@ -10,10 +10,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Set a global flag to indicate this file was found by setup/config.php.
|
Set global flag to indicate for which config settings we have equally named validation methods
|
||||||
config.php will unset it after parsing the form values.
|
|
||||||
*/
|
*/
|
||||||
$GLOBALS['egw_info']['server']['found_validation_hook'] = True;
|
$GLOBALS['egw_info']['server']['found_validation_hook'] = array('vfs_image_dir');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check VFS dir exists and delete image map to recreate it, if vfs-image-dir changes
|
* Check VFS dir exists and delete image map to recreate it, if vfs-image-dir changes
|
||||||
|
@ -698,7 +698,7 @@ class calendar_hooks
|
|||||||
|
|
||||||
public static function config_validate()
|
public static function config_validate()
|
||||||
{
|
{
|
||||||
$GLOBALS['egw_info']['server']['found_validation_hook'] = True;
|
$GLOBALS['egw_info']['server']['found_validation_hook'] = array('calendar_purge_old');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,7 +70,7 @@ if(@get_var('submit',Array('POST')) && @$newsettings)
|
|||||||
$GLOBALS['egw_setup']->db->transaction_begin();
|
$GLOBALS['egw_setup']->db->transaction_begin();
|
||||||
foreach($newsettings as $setting => $value)
|
foreach($newsettings as $setting => $value)
|
||||||
{
|
{
|
||||||
if($GLOBALS['egw_info']['server']['found_validation_hook'] && @function_exists($setting))
|
if(in_array($setting, (array)$GLOBALS['egw_info']['server']['found_validation_hook']) && function_exists($setting))
|
||||||
{
|
{
|
||||||
$setting($newsettings);
|
$setting($newsettings);
|
||||||
if($GLOBALS['config_error'])
|
if($GLOBALS['config_error'])
|
||||||
|
@ -11,10 +11,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Set a global flag to indicate this file was found by setup/config.php.
|
Set global flag to indicate for which config settings we have equally named validation methods
|
||||||
config.php will unset it after parsing the form values.
|
|
||||||
*/
|
*/
|
||||||
$GLOBALS['egw_info']['server']['found_validation_hook'] = True;
|
$GLOBALS['egw_info']['server']['found_validation_hook'] = array(
|
||||||
|
'vfs_storage_mode',
|
||||||
|
'temp_dir',
|
||||||
|
'files_dir',
|
||||||
|
'backup_dir',
|
||||||
|
'mcrypt_algo',
|
||||||
|
'ldap_search_filter'
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set vfs_fstab depending from what the user selected for vfs_storage_mode
|
* Set vfs_fstab depending from what the user selected for vfs_storage_mode
|
||||||
|
Loading…
Reference in New Issue
Block a user