X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Fclass_configRegistry.inc;h=f895a3dac561ef9a0c1a8c04d3c426c7beb37f3c;hb=9566dc068208034acf0da2630a7efbb5a370f191;hp=ee68d2ed46836ec343471604dde32eb23770a94c;hpb=60bab946cd1e3436fd789f56707a5137d20a86f1;p=gosa.git diff --git a/gosa-core/include/class_configRegistry.inc b/gosa-core/include/class_configRegistry.inc index ee68d2ed4..f895a3dac 100644 --- a/gosa-core/include/class_configRegistry.inc +++ b/gosa-core/include/class_configRegistry.inc @@ -743,6 +743,31 @@ class gosaProperty return($match); } + static function isWriteableFile($message,$class,$name,$value, $type) + { + $match = (file_exists($value) && is_writeable($value)) || + (!file_exists($value) && is_writeable(dirname($value))); + + + // Display the reason for failing this check. + if($message && ! $match){ + + if(!file_exists($value) && !is_writeable(dirname($value))){ + msg_dialog::display(_("Warning"), + sprintf(_("The file '%s' specified for '%s:%s' cannot be created neither be used for writing!"), + bold($value),bold($class),bold($name)), + WARNING_DIALOG); + }elseif(file_exists($value) && !is_writeable($value)){ + msg_dialog::display(_("Warning"), + sprintf(_("The file '%s' specified for '%s:%s' cannot be used for writing!"), + bold($value),bold($class),bold($name)), + WARNING_DIALOG); + } + } + + return($match); + } + static function isWriteablePath($message,$class,$name,$value, $type) { $match = !empty($value)&&is_dir($value)&&is_writeable($value);