http://atutor.ca/atutor/mantis/view.php?id=4454
authorharris wong <hwong@ocad.ca>
Thu, 12 Aug 2010 18:56:51 +0000 (18:56 -0000)
committerharris wong <hwong@ocad.ca>
Thu, 12 Aug 2010 18:56:51 +0000 (18:56 -0000)
docs/mods/_core/imscc/include/ims_template.inc.php
docs/mods/_core/imscp/ims_import.php

index 940fe52..18ef3b6 100644 (file)
@@ -170,7 +170,6 @@ function print_organizations($parent_id,
 
                                $path .= str_repeat('../', $depth);
                        }
-                       
                        $content['text'] = format_content($content['text'], $content['formatting'], $glossary, $path);
 
                        /* add HTML header and footers to the files */
@@ -347,7 +346,10 @@ function print_organizations($parent_id,
                                        if (!empty($test_zipped_files) && in_array($file_path, $test_zipped_files)){
                                                $content_files .= str_replace('{FILE}', $file, $ims_template_xml['file']);
                                        } else {
-                                               if (preg_match('/^http[s]?\:/', $file) == 1){
+                        if (strpos($file, 'mailto:')!==false){
+                            //email exists in <a href=''> links but is not a file.
+                            continue;
+                        } elseif (preg_match('/^http[s]?\:/', $file) == 1){
                                                        $content_files .= str_replace('{FILE}', $file, $ims_template_xml['xml']);
                                                } else {
                                                        $content_files .= str_replace('{FILE}', $content['content_path'] . $file, $ims_template_xml['file']);
index 245d525..3db08da 100644 (file)
@@ -1352,14 +1352,17 @@ if (is_dir(AT_CONTENT_DIR . 'import/'.$_SESSION['course_id'].'/resources')) {
        closedir($handler);
 }
 //takes care of the condition where the whole package doesn't have any contents but question banks
+//also is the case of urls
 if(is_array($all_package_base_path)){
        $all_package_base_path = implode('/', $all_package_base_path);
 }
-
-if (@rename($import_path.$all_package_base_path, AT_CONTENT_DIR .$_SESSION['course_id'].'/'.$package_base_name) === false) {
-       if (!$msg->containsErrors()) {
-               $msg->addError('IMPORT_FAILED');
-       }
+if(strpos($all_package_base_path, 'http://')===false){
+    if (@rename($import_path.$all_package_base_path, AT_CONTENT_DIR .$_SESSION['course_id'].'/'.$package_base_name) === false) {
+        if (!$msg->containsErrors()) {
+            exit;
+            $msg->addError('IMPORT_FAILED');
+        }
+    }
 }
 //check if there are still resources missing
 foreach($items as $idetails){