Code

Updated handling of uploaded files, thanks to bcooksley
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 17 Nov 2010 09:16:10 +0000 (09:16 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 17 Nov 2010 09:16:10 +0000 (09:16 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20257 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/mail/personal/mail/sieve/class_sieveManagement.inc

index 1c1da4e2f8b73cadc0c4c0aadad6cdc2c02d3306..0fea778601cf5f5981e43e13b1ae459a310ff390 100644 (file)
@@ -442,17 +442,19 @@ class sieveManagement extends plugin
 
           $file     = $_FILES['Script_To_Import'];
 
+          $filename = gosa_file_name($file['tmp_name']);
+
           if($file['size'] == 0){
             msg_dialog::display(_("Error"), _("Uploaded script is empty!"), ERROR_DIALOG);
-          }elseif(!file_exists($file['tmp_name'])){
-            msg_dialog::display(_("Internal error"), sprintf(_("Cannot access temporary file '%s'!"), $file['tmp_name']), ERROR_DIALOG);
-          }elseif(!is_readable ($file['tmp_name'])){
-            msg_dialog::display(_("SIEVE error"), sprintf(_("Cannot open temporary file '%s'!"), $file['tmp_name']), ERROR_DIALOG);
+          }elseif(!file_exists($filename)){
+            msg_dialog::display(_("Internal error"), sprintf(_("Cannot access temporary file '%s'!"), $filename), ERROR_DIALOG);
+          }elseif(!is_readable ($filename)){
+            msg_dialog::display(_("SIEVE error"), sprintf(_("Cannot open temporary file '%s'!"), $filename), ERROR_DIALOG);
           }else{
             
             
  
-            $contents = file_get_contents($file['tmp_name']);
+            $contents = file_get_contents($filename);
            
             $this->scripts[$this->current_script]['SCRIPT'] = $contents;
             if(!$this->current_handler->parse($contents)){