Permalink
Browse files

Merge branch 'MDL-37934_23' of git://github.com/jmvedrine/moodle into…

… MOODLE_23_STABLE
  • Loading branch information...
2 parents 15cc42f + a56ced7 commit c3724a7002afef08eba97d4564a300f7b4ada104 @danpoltawski danpoltawski committed Feb 19, 2013
Showing with 3 additions and 2 deletions.
  1. +3 −2 question/format/blackboard_six/formatbase.php
@@ -123,15 +123,16 @@ public function text_field($text) {
$data = array();
// Step one, find all file refs then add to array.
preg_match_all('|<img[^>]+src="([^"]*)"|i', $text, $out); // Find all src refs.
-
+ $filepaths = array();
foreach ($out[1] as $path) {
$fullpath = $this->filebase . '/' . $path;
- if (is_readable($fullpath)) {
+ if (is_readable($fullpath) && !in_array($path, $filepaths)) {
$dirpath = dirname($path);
$filename = basename($path);
$newfilename = $this->store_file_for_text_field($data, $this->filebase, $dirpath, $filename);
$text = preg_replace("|$path|", "@@PLUGINFILE@@/" . $newfilename, $text);
+ $filepaths[] = $path;
}
}

0 comments on commit c3724a7

Please sign in to comment.