~ubuntu-branches/ubuntu/hoary/moodle/hoary

« back to all changes in this revision

Viewing changes to mod/lesson/import.php

  • Committer: Bazaar Package Importer
  • Author(s): Isaac Clerencia
  • Date: 2004-12-29 00:49:52 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20041229004952-gliyqzpj2w3e7clx
Tags: 1.4.3-1
* Urgency high as upstream release fixes several security bugs
* New upstream release
* Write database creation errors and warn the user about it, 
closes: #285842, #285842

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?PHP // $Id: import.php,v 1.2 2004/03/27 04:15:29 rkingdon Exp $
 
1
<?PHP // $Id: import.php,v 1.3.2.1 2004/09/29 06:56:55 moodler Exp $
2
2
      // Import quiz questions into the given category
3
3
 
4
4
    require_once("../../config.php");
29
29
    $strimportquestions = get_string("importquestions", "lesson");
30
30
    $strlessons = get_string("modulenameplural", "lesson");
31
31
 
32
 
    print_header("$course->shortname: $strimportquestions", "$course->shortname: $strimportquestions",
33
 
                 "<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A> -> ". 
 
32
    print_header_simple("$strimportquestions", " $strimportquestions",
34
33
                 "<A HREF=index.php?id=$course->id>$strlessons</A> -> <a href=\"view.php?id=$cm->id\">$lesson->name</a>-> $strimportquestions");
35
34
 
36
35
    if ($form = data_submitted()) {   /// Filename
37
36
 
 
37
        $form->format = clean_filename($form->format); // For safety
 
38
 
38
39
        if (isset($form->filename)) {                 // file already on server
39
40
            $newfile['tmp_name'] = $form->filename; 
40
41
            $newfile['size'] = filesize($form->filename);
52
53
        } else {  // Valid file is found
53
54
 
54
55
            if (! is_readable("../quiz/format/$form->format/format.php")) {
55
 
                error("Format not known ($form->format)");
 
56
                error("Format not known (".clean_text($form->format).")");
56
57
            }
57
58
 
58
59
            require("format.php");  // Parent class
59
 
            require("../quiz/lib.php"); // for the constants used in quiz/format/<format>/format.php
60
 
            require("../quiz/format/$form->format/format.php");
 
60
            require("$CFG->dirroot/mod/quiz/lib.php"); // for the constants used in quiz/format/<format>/format.php
 
61
            require("$CFG->dirroot/mod/quiz/format/$form->format/format.php");
61
62
 
62
63
            $format = new quiz_file_format();
63
64