diff --git a/actions/admin/settings/120.system.php b/actions/admin/settings/120.system.php index b9891344..8b87656b 100644 --- a/actions/admin/settings/120.system.php +++ b/actions/admin/settings/120.system.php @@ -28,6 +28,7 @@ return array( 'varname' => 'documentroot_prefix', 'type' => 'string', 'default' => '/var/customers/webs/', + 'plausibility_check_method' => 'checkPathConflicts', 'save_method' => 'storeSettingField', ), 'system_ipaddress' => array( diff --git a/actions/admin/settings/135.fcgid.php b/actions/admin/settings/135.fcgid.php index e225dc7d..982288e8 100644 --- a/actions/admin/settings/135.fcgid.php +++ b/actions/admin/settings/135.fcgid.php @@ -36,6 +36,7 @@ return array( 'type' => 'string', 'string_type' => 'dir', 'default' => '/var/www/php-fcgi-scripts/', + 'plausibility_check_method' => 'checkPathConflicts', 'save_method' => 'storeSettingField', ), 'system_mod_fcgid_tmpdir' => array( diff --git a/lib/functions/validate/function.checkPathConflicts.php b/lib/functions/validate/function.checkPathConflicts.php new file mode 100644 index 00000000..30800bbd --- /dev/null +++ b/lib/functions/validate/function.checkPathConflicts.php @@ -0,0 +1,60 @@ + (2010-) + * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt + * @package Functions + * @version $Id$ + */ + +function checkPathConflicts($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) +{ + global $settings; + if((int)$settings['system']['mod_fcgid'] == 1) + { + /** + * fcgid-configdir has changed -> + * check against customer-doc-prefix + */ + if($fieldname == "system_mod_fcgid_configdir") + { + $newdir = makeCorrectDir($newfieldvalue); + $cdir = makeCorrectDir($settings['system']['documentroot_prefix']); + } + /** + * customer-doc-prefix has changed -> + * check against fcgid-configdir + */ + elseif($fieldname == "system_documentroot_prefix") + { + $newdir = makeCorrectDir($newfieldvalue); + $cdir = makeCorrectDir($settings['system']['mod_fcgid_configdir']); + } + + // neither dir can be within the other nor can they be equal + if(substr($newdir, 0, strlen($cdir)) == $cdir + || substr($cdir, 0, strlen($newdir)) == $newdir + || $newdir == $cdir + ) { + $returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'fcgidpathcannotbeincustomerdoc'); + } + else + { + $returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK); + } + } + else + { + $returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK); + } + + return $returnvalue; +}