Code

removed debug code.
[gosa.git] / gosa-core / include / class_CopyPasteHandler.inc
index 610e6a70888662ae6f41a18a086a026abd9dba1a..a7fdee4589b49899b9d8cb8fc268caf8d0c430bd 100644 (file)
@@ -84,6 +84,14 @@ class CopyPasteHandler {
     if(!is_dir(LDAP_DUMP_PATH)){
       @mkdir(LDAP_DUMP_PATH);
     }    
+  
+    /* Update folder permissions */
+    if(!@chmod(LDAP_DUMP_PATH,0700)){
+      $msg= sprintf(_("Cannot cleanup copy & paste queue: setting permissions for '%s' failed!"),LDAP_DUMP_PATH);
+      msg_dialog::display(_("Configuration error"), $msg, ERROR_DIALOG);
+      new log("copy","all/all","copy & paste, event queue.",array(), $msg);
+      return(FALSE);
+    }
     
     /* check if we are able to create a new file the given directory */
     if(!is_writeable(LDAP_DUMP_PATH)){
@@ -142,6 +150,14 @@ class CopyPasteHandler {
       return(FALSE);
     }  
 
+    /* Update folder permissions */
+    if(!@chmod(LDAP_DUMP_PATH,0700)){
+      $msg= sprintf(_("Cannot save LDAP dump: setting permissions for '%s' failed!"),LDAP_DUMP_PATH);
+      msg_dialog::display(_("Configuration error"), $msg, ERROR_DIALOG);
+      new log("copy","all/all","copy & paste, event queue.",array(), $msg);
+      return(FALSE);
+    }
+
     /* Create file handle */
     $fp = @fopen($path."/".$filename,"w+");
     if(!$fp){
@@ -230,9 +246,9 @@ class CopyPasteHandler {
       }
       return(unserialize($data));
     }else{
-      print_red(sprintf(_("Could not load dumped file '%s', from hard disk drive."),$filename));
-      new log("copy","all/all",$dn,array(), 
-          sprintf(sprintf("Could not load dumped file '%s', from hard disk drive.",$filename)));
+      $msg= sprintf(_("Cannot load dumped file '%s'!"),$filename);
+      msg_dialog::display(_("Internal error"), $msg, ERROR_DIALOG);
+      new log("copy","all/all",$dn,array(), $msg);
       return(FALSE);
     }
   }
@@ -255,10 +271,10 @@ class CopyPasteHandler {
  
           /* Check permissions */ 
           if(!preg_match("/((c|w)|(w|c))/",$acl)){
-            print_red(sprintf(_("You are not allowed to cut and paste the following object '%s'."),$this->current['dn']));
+            msg_dialog::display(_("Error"), sprintf(_("You have no permission to save object '%s'."), $this->current['dn']), ERROR_DIALOG);
           }elseif(count ($msgs) ){
             foreach( $msgs as $msg){
-              print_red($msg);
+              msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
             }
           }else{
 
@@ -296,10 +312,10 @@ class CopyPasteHandler {
  
         /* Check permissions */ 
         if(!preg_match("/((c|w)|(w|c))/",$acl)){
-          print_red(sprintf(_("You are not allowed to copy and paste the following object '%s'."),$this->current['dn']));
+          msg_dialog::display(_("Error"), sprintf(_("You have no permission to copy and paste object '%s'!"),$this->current['dn']), ERROR_DIALOG);
         }elseif(count ($msgs) ){
           foreach( $msgs as $msg){
-            print_red($msg);
+            msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
           }
         }else{
           $this->current['object']->save();