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

swf not embedded by mediaplugin filter because allowobjectembed is ineffective

    Details

    • Type: Bug
    • Status: Reopened
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.3.9, 2.4.6, 2.5.2, 2.6
    • Fix Version/s: None
    • Component/s: Filters, Media
    • Labels:
    • Testing Instructions:
      Hide

      (difficulty: easy, requires teacher access to a course)

      1. Find a URL pointing to a SWF, e.g. the first I've found is http://www.tizag.com/pics/example.swf
      2. Be sure that Multimedia plugins filter is Active, Site administration > Plugins > Filters > Manage filters
      3. Check that allowobjectembed is not set, Site administration > Security > Site policies
      4. Add a small text, e.g. "test", into e.g. the summary of a course or a post in a forum than select that text and insert your SWF link
      5. After submitting the intro/post the text will appear linked to your SWF
      6. Now set allowobjectembed, Site administration > Security > Site policies
      7. Reload (<F5>) the intro/post: now the text will disappear and the SWF will be embedded
      Show
      (difficulty: easy, requires teacher access to a course) Find a URL pointing to a SWF, e.g. the first I've found is http://www.tizag.com/pics/example.swf Be sure that Multimedia plugins filter is Active , Site administration > Plugins > Filters > Manage filters Check that allowobjectembed is not set, Site administration > Security > Site policies Add a small text, e.g. "test", into e.g. the summary of a course or a post in a forum than select that text and insert your SWF link After submitting the intro/post the text will appear linked to your SWF Now set allowobjectembed , Site administration > Security > Site policies Reload (<F5>) the intro/post: now the text will disappear and the SWF will be embedded
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      m27_MDL-43852_SWF_Not_Embedded_By_Mediaplugin_Filter

      Description

      An swf link is not converted to an embedded player by the mediaplugin filter even if $CFG->allowobjectembed = true

      This is because "filter/mediaplugin/filter.php" (line 69) uses the weak precedence "or" logical operator, instead of the strong precedence "||" operator.

      In Moodle 2.6, that line is currently:

      $this->trusted = !empty($options['noclean']) or !empty($CFG->allowobjectembed);
      

      The effect of this line is to ALWAYS simply assign

      $this->trusted = !empty($options['noclean']);
      

      In other words $CFG->allowobjectembed is ignored.

      The PHP manual on logical operators is here:

      It gives the following example:

      // The constant false is assigned to $f and then true is ignored
      // Acts like: (($f = false) or true)
      $f = false or true;
      

      Therefore, the line in "filter/mediaplugin/filter.php" should be changed to one of the following:

      (i) $this->trusted = !empty($options['noclean']) || !empty($CFG->allowobjectembed);
      (ii) $this->trusted = (!empty($options['noclean']) or !empty($CFG->allowobjectembed));
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated: