Skip to content

Commit

Permalink
MDL-61876 admin: set default forceclean=1
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaglancy committed Apr 17, 2018
1 parent b197da8 commit c182f06
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion admin/settings/security.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
new lang_string('configuserquota', 'admin', $params), $defaultuserquota, PARAM_INT, 30));

$temp->add(new admin_setting_configcheckbox('forceclean', new lang_string('forceclean', 'core_admin'),
new lang_string('forceclean_desc', 'core_admin'), 0));
new lang_string('forceclean_desc', 'core_admin'), 1));

$temp->add(new admin_setting_configcheckbox('allowobjectembed', new lang_string('allowobjectembed', 'admin'), new lang_string('configallowobjectembed', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('enabletrusttext', new lang_string('enabletrusttext', 'admin'), new lang_string('configenabletrusttext', 'admin'), 0));
Expand Down
2 changes: 2 additions & 0 deletions course/tests/externallib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,9 @@ private function prepare_get_course_contents_test() {
* Test get_course_contents
*/
public function test_get_course_contents() {
global $CFG;
$this->resetAfterTest(true);
$CFG->forceclean = 0;

list($course, $forumcm, $datacm, $pagecm, $labelcm, $urlcm) = $this->prepare_get_course_contents_test();

Expand Down
3 changes: 3 additions & 0 deletions lib/tests/weblib_format_text_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ public function test_format_text_overflowdiv() {
* @param string $expected The expected filter value
*/
public function test_format_text_blanktarget($link, $expected) {
global $CFG;
$this->resetAfterTest();
$CFG->forceclean = 0;
$actual = format_text($link, FORMAT_MOODLE, array('blanktarget' => true, 'filter' => false, 'noclean' => true));
$this->assertEquals($expected, $actual);
}
Expand Down
9 changes: 8 additions & 1 deletion media/player/swf/tests/player_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public function test_embed_url() {
*/
public function test_embed_link() {
global $CFG;
$CFG->forceclean = 0;
$url = new moodle_url('http://example.org/some_filename.swf');
$text = html_writer::link($url, 'Watch this one');
$content = format_text($text, FORMAT_HTML, ['trusted' => true]);
Expand All @@ -113,9 +114,13 @@ public function test_embed_link() {
$this->assertRegExp('~width="' . $CFG->media_default_width . '" height="' .
$CFG->media_default_height . '"~', $content);

// Not working without trust!
// Not working without trust or with $CFG->forceclean!
$content = format_text($text, FORMAT_HTML);
$this->assertNotRegExp('~mediaplugin_swf~', $content);

$CFG->forceclean = 1;
$content = format_text($text, FORMAT_HTML, ['trusted' => true]);
$this->assertNotRegExp('~mediaplugin_swf~', $content);
}

/**
Expand All @@ -125,6 +130,8 @@ public function test_embed_link() {
*/
public function test_embed_media() {
global $CFG;
$CFG->forceclean = 0;

$url = new moodle_url('http://example.org/some_filename.swf');
$trackurl = new moodle_url('http://example.org/some_filename.vtt');
$text = '<video controls="true"><source src="'.$url.'"/>' .
Expand Down

0 comments on commit c182f06

Please sign in to comment.