Code

Prepared statistics to print password changes over time
[gosa.git] / gosa-core / include / class_configRegistry.inc
index 9809788ef5eb76f7d65195bf63357bb4fc45be54..f895a3dac561ef9a0c1a8c04d3c426c7beb37f3c 100644 (file)
@@ -415,6 +415,12 @@ class configRegistry{
             $this->register($cname, $data);    
             $data = array('name' => 'postmodify','type' => 'command');
             $this->register($cname, $data);    
+            $data = array('name' => 'precreate','type' => 'command');
+            $this->register($cname, $data);    
+            $data = array('name' => 'preremove','type' => 'command');
+            $this->register($cname, $data);    
+            $data = array('name' => 'premodify','type' => 'command');
+            $this->register($cname, $data);    
             $data = array('name' => 'check', 'type' => 'command');
             $this->register($cname, $data);    
 
@@ -737,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);