From: moodler Date: Mon, 21 Apr 2003 07:11:29 +0000 (+0000) Subject: Make sure to change the ownership of uploaded files X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=9dd0b37817747f9f5464a6108cd3027ec63767ee;p=moodle.git Make sure to change the ownership of uploaded files --- diff --git a/mod/assignment/upload.php b/mod/assignment/upload.php index 56c5e53676..a482131e52 100644 --- a/mod/assignment/upload.php +++ b/mod/assignment/upload.php @@ -53,6 +53,7 @@ $newfile_name = clean_filename($newfile['name']); if ($newfile_name) { if (move_uploaded_file($newfile['tmp_name'], "$dir/$newfile_name")) { + chmod("$dir/$newfile_name", $CFG->directorypermissions); assignment_delete_user_files($assignment, $USER, $newfile_name); if ($submission) { $submission->timemodified = time(); diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 957182cd8a..a43288d31b 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -1178,6 +1178,8 @@ function forum_add_attachment($post, $newfile) { // $newfile is a full upload array from $_FILES // If successful, this function returns the name of the file + global $CFG; + if (empty($newfile['name'])) { return ""; } @@ -1194,6 +1196,7 @@ function forum_add_attachment($post, $newfile) { } else { if (move_uploaded_file($newfile['tmp_name'], "$dir/$newfile_name")) { + chmod("$dir/$newfile_name", $CFG->directorypermissions); forum_delete_old_attachments($post, $newfile_name); } else { notify("An error happened while saving the file on the server");