From 3633c2576db4f2af6e666dbbf496cacd09338050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Fri, 3 May 2013 11:20:20 +0200 Subject: [PATCH] MDL-39490 Inform the developer about incorrect order of text processing Before calling format_text(), the text must be processed with file_rewrite_pluginfile_urls(). This order is important for some text filters that look for valid pluginfile.php URLs. --- lib/weblib.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/weblib.php b/lib/weblib.php index b61f1bce46f..1218bd07064 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -1178,6 +1178,12 @@ function format_text($text, $format = FORMAT_MOODLE, $options = NULL, $courseid_ // The only potential problem is that somebody might try to format // the text before storing into database which would be itself big bug. $text = str_replace("\"$CFG->httpswwwroot/draftfile.php", "\"$CFG->httpswwwroot/brokenfile.php#", $text); + + if (debugging('', DEBUG_DEVELOPER)) { + if (strpos($text, '@@PLUGINFILE@@/') !== false) { + debugging('Before calling format_text(), the content must be processed with file_rewrite_pluginfile_urls()', DEBUG_DEVELOPER); + } + } } // Warn people that we have removed this old mechanism, just in case they