Created
May 3, 2013 09:10
-
-
Save mudrd8mz/5508113 to your computer and use it in GitHub Desktop.
Proposal for format_text() check in Moodle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/weblib.php b/lib/weblib.php | |
index 647504a..28aef68 100644 | |
--- a/lib/weblib.php | |
+++ b/lib/weblib.php | |
@@ -1174,6 +1174,14 @@ 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); | |
+ | |
+ // Before calling format_text(), the text must be processed with {@link file_rewrite_pluginfile_urls()} | |
+ // or its equivalent. Inform the developer. | |
+ if (debugging('', DEBUG_DEVELOPER)) { | |
+ if (strpos($text, '@@PLUGINFILE@@')) { | |
+ debugging('Attempting to format a text with non-rewritten pluginfile URL', DEBUG_DEVELOPER); | |
+ } | |
+ } | |
} | |
// Warn people that we have removed this old mechanism, just in case they |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if (strpos($text, '@@PluginFile@@') !== false) {