Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-17152

Should be a way to control filtering on/off for individual file or resource

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 1.9.3, 2.0
    • None
    • Filters
    • None
    • MOODLE_19_STABLE, MOODLE_20_STABLE

    Description

      One of our courses is teaching HTML and they object to their HTML example files being messed with. Moodle adds stylesheet links in there because it is set to run filters on HTML files ($CFG->filteruploadedfiles=1). Unfortunately we need the setting on for other courses.

      My trivial solution is the following one-liner:

      Index: file.php
      ===================================================================
      RCS file: /home/cvs_repositories/globalcvs/ou-moodle/file.php,v
      retrieving revision 1.19.4.1
      diff -u -r1.19.4.1 file.php
      — file.php 30 Oct 2008 11:20:37 -0000 1.19.4.1
      +++ file.php 6 Nov 2008 16:18:47 -0000
      @@ -266,8 +266,14 @@
      // ========================================
      session_write_close(); // unlock session during fileserving
      $filename = $args[count($args)-1];

      • send_file($pathname, $filename, $lifetime, $CFG->filteruploadedfiles, false, $forcedownload);
        + send_file($pathname, $filename, $lifetime,
        + optional_param('preventfilter',0,PARAM_INT) ? 0 : $CFG->filteruploadedfiles,
        + false, $forcedownload);

      function not_found($courseid) {
      global $CFG;
      header('HTTP/1.0 404 not found');

      As you can see this just lets people do ?preventfilter=1 on a file.php request.

      There may well be better ways to achieve this objective, especially with regard to Petr's file handling changes for 2.0, so I am not necessarily suggesting this patch should be committed, just pointing out this (minor) issue.

      Attachments

        Issue Links

          Activity

            People

              timhunt Tim Hunt
              quen Sam Marshall
              Nobody Nobody
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: