]> git.mjollnir.org Git - moodle.git/commitdiff
Make sure to change the ownership of uploaded files
authormoodler <moodler>
Mon, 21 Apr 2003 07:11:29 +0000 (07:11 +0000)
committermoodler <moodler>
Mon, 21 Apr 2003 07:11:29 +0000 (07:11 +0000)
mod/assignment/upload.php
mod/forum/lib.php

index 56c5e5367674097219a927cc0e92d172969f45b0..a482131e524dd37c1ce5446440afd61d3da25779 100644 (file)
@@ -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();
index 957182cd8a8758ee3c3e4e579e5793355ca87cfe..a43288d31bd2a55c1870e987f992a00f75dbb815 100644 (file)
@@ -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");