From: hickert Date: Wed, 17 Nov 2010 09:16:10 +0000 (+0000) Subject: Updated handling of uploaded files, thanks to bcooksley X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=46c675b760ad61d2cd095cccf54fc9d019de3f5d;p=gosa.git Updated handling of uploaded files, thanks to bcooksley git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20257 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/mail/personal/mail/sieve/class_sieveManagement.inc b/gosa-plugins/mail/personal/mail/sieve/class_sieveManagement.inc index 1c1da4e2f..0fea77860 100644 --- a/gosa-plugins/mail/personal/mail/sieve/class_sieveManagement.inc +++ b/gosa-plugins/mail/personal/mail/sieve/class_sieveManagement.inc @@ -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)){