Permalink
Browse files

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

… MOODLE_24_STABLE
  • Loading branch information...
2 parents 0e3d123 + 58a43eb commit 0141a869ebf93f089798ad03e45377e4b8f6a6bf @danpoltawski danpoltawski committed Feb 19, 2013
Showing with 3 additions and 2 deletions.
  1. +3 −2 question/format/blackboard_six/formatbase.php
View
5 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 0141a86

Please sign in to comment.