]> git.mjollnir.org Git - moodle.git/commitdiff
Integration of upload code with lesson.
authormjollnir_ <mjollnir_>
Thu, 16 Sep 2004 04:25:55 +0000 (04:25 +0000)
committermjollnir_ <mjollnir_>
Thu, 16 Sep 2004 04:25:55 +0000 (04:25 +0000)
These patches are maintained in an publicly accessible Arch repository, see: http://lists.eduforge.org/cgi-bin/archzoom.cgi/arch-eduforge@catalyst.net.nz--2004-MIRROR/moodle--eduforge--1.3.3

Index of arch patches in this commit:

arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-68
    2004-09-16 04:22:37 GMT
    Penny Leach <penny@catalyst.net.nz>
    upload class integration with lesson

Full logs:

Revision: moodle--eduforge--1.3.3--patch-68
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Thu Sep 16 16:22:37 NZST 2004
Standard-date: 2004-09-16 04:22:37 GMT
Modified-files: mod/lesson/import.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-68
Summary: upload class integration with lesson
Keywords:

mod/lesson/import.php

index 0752a765820af71f185791520e448f87af002c68..6646d312aef7d2eca9c7ed6685d3ecedff66e794 100644 (file)
                  "<A HREF=index.php?id=$course->id>$strlessons</A> -> <a href=\"view.php?id=$cm->id\">$lesson->name</a>-> $strimportquestions");
 
     if ($form = data_submitted()) {   /// Filename
-
+        
         if (isset($form->filename)) {                 // file already on server
             $newfile['tmp_name'] = $form->filename; 
             $newfile['size'] = filesize($form->filename);
 
         } else if (!empty($_FILES['newfile'])) {      // file was just uploaded
-            $newfile = $_FILES['newfile'];
+            require_once($CFG->dirroot.'/lib/uploadlib.php');
+            $um = new upload_manager('newfile',false,false,$course,false,0,false);
+            if ($um->preprocess_files()) { // validate and virus check! 
+                $newfile = $_FILES['newfile'];
+            }
         }
 
-        if (empty($newfile)) {
-            notify(get_string("uploadproblem") );
-
-        } else if (!isset($filename) and (!is_uploaded_file($newfile['tmp_name']) or $newfile['size'] == 0)) {
-            notify(get_string("uploadnofilefound") );
-
-        } else {  // Valid file is found
+        if (is_array($newfile)) { // either for file already on server or just uploaded file.
 
             if (! is_readable("../quiz/format/$form->format/format.php")) {
                 error("Format not known ($form->format)");