From 15742b2a4cd04034b57391dab473b6c2c628982a Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 31 Aug 2006 11:33:24 +0000 Subject: [PATCH] Fixed kiosk profile deletion git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4559 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../class_kioskManagementDialog.inc | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/plugins/personal/environment/class_kioskManagementDialog.inc b/plugins/personal/environment/class_kioskManagementDialog.inc index 98bcffc70..1a126d9b4 100644 --- a/plugins/personal/environment/class_kioskManagementDialog.inc +++ b/plugins/personal/environment/class_kioskManagementDialog.inc @@ -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 */ -- 2.30.2