From 21dc9790d4f7199cf839ee07a32601a238835d6a Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Sat, 17 Feb 2007 00:10:10 +0100 Subject: [PATCH] [svn r11136] Added check for differenciation between course and no-course context while uploading images in FCKEditor --- .../plugins/ImageManager/Classes/ImageManager.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/main/inc/lib/fckeditor/editor/plugins/ImageManager/Classes/ImageManager.php b/main/inc/lib/fckeditor/editor/plugins/ImageManager/Classes/ImageManager.php index 82d838d9b7..551099379e 100644 --- a/main/inc/lib/fckeditor/editor/plugins/ImageManager/Classes/ImageManager.php +++ b/main/inc/lib/fckeditor/editor/plugins/ImageManager/Classes/ImageManager.php @@ -480,7 +480,18 @@ class ImageManager if(!is_int($result)) { Files::delFile($file['tmp_name']); - $this->_insertPictureInDatabase($relative, $_FILES['upload'],$result); + + global $_course; + //Check if we are in a course context. Otherwise it should mean that we're + //uploading a file in the generic image upload folder, not into a course, so + //we don't need to record it into the database. + //In any case, if $_course['dbName'] is not defined, the database insertion + //will fail, so we don't loose anything compared to what we have now. + if(!empty($_course['dbName'])) + { + $this->_insertPictureInDatabase($relative, $_FILES['upload'],$result); + } + Return $result; }