Code

Fixed kiosk profile deletion
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 31 Aug 2006 11:33:24 +0000 (11:33 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 31 Aug 2006 11:33:24 +0000 (11:33 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4559 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/environment/class_kioskManagementDialog.inc

index 98bcffc70cc6dedd5da5771fea4b795c336389c6..1a126d9b4e030e7f3f96c966f8996706634d8e83 100644 (file)
@@ -44,29 +44,36 @@ class kioskManagementDialog extends plugin
         $this->filesToAttach[$file['name']]['contents'] = file_get_contents($file['tmp_name']);
       }
     }
-     
+
     $only_once = true;
     foreach($_POST as $name => $value){
-      
+
       if((preg_match("/^delkiosk_/",$name))&&($only_once)){
         $only_once = false;
         $id  = preg_replace("/^delkiosk_/","",$name);
         $id = preg_replace("/_.*$/","",$id);
 
-        $filename = $this->baseDir."/".preg_replace("/^.*\//i","",base64_decode($id));
+        $name = preg_replace("/^.*\//i","",base64_decode($id));
 
-        $res = unlink($filename);
-        if(!$res){
-          if(!is_writeable($filename)){
-            print_red(sprintf(_("Can't delete '%s'. Error was: permission denied."), $filename));
-          }
-          if(!file_exists($filename)){
-            print_red(sprintf(_("Can't delete '%s'. Errow was: file doesn't exist."), $filename));
+        $filename = $this->baseDir."/".$name;
+
+        if(isset($this->filesToAttach[$name])){
+          unset($this->filesToAttach[$name]);
+        }else{
+
+          $res = @unlink($filename);
+          if(!$res){
+            if(!is_writeable($filename)){
+              print_red(sprintf(_("Can't delete '%s'. Error was: permission denied."), $filename));
+            }
+            if(!file_exists($filename)){
+              print_red(sprintf(_("Can't delete '%s'. Errow was: file doesn't exist."), $filename));
+            }
           }
         }
       }
     }
-
+     
     /* Delete profile
      * Delete selected file form $this->baseDir
      */