4888: ims_import.php: prevent "Undefined index: -1" warning
authorTJ <acontent@iam.tj>
Mon, 10 Oct 2011 14:41:41 +0000 (15:41 +0100)
committerTJ <acontent@iam.tj>
Wed, 19 Oct 2011 19:10:22 +0000 (20:10 +0100)
home/ims/ims_import.php

index 57ba69c..54f962b 100644 (file)
@@ -455,7 +455,7 @@ function removeCommonPath($items){
                global $course_primary_lang;
                
                // get language from CONTENT PACKAGE
-               if (substr($element_path[count($element_path)-1], -6) == ':title' && substr($name, -11) == ':langstring') {
+               if (count($element_path) > 0 && substr($element_path[count($element_path)-1], -6) == ':title' && substr($name, -11) == ':langstring') {
                        $course_primary_lang = trim($attrs['xml:lang']);
                }