Browse Source

Merge branch '1.10.x' of github.com:chamilo/chamilo-lms into 1.10.x

Julio Montoya 9 years ago
parent
commit
bef96525b8

+ 5 - 1
main/inc/lib/api.lib.php

@@ -6797,7 +6797,11 @@ function api_get_real_ip(){
     global $debug;
     $ip = trim($_SERVER['REMOTE_ADDR']);
     if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
-        list($ip1, $ip2) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
+        if (preg_match('/,/', $_SERVER['HTTP_X_FORWARDED_FOR'])) {
+            list($ip1, $ip2) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
+        } else {
+            $ip1 = $_SERVER['HTTP_X_FORWARDED_FOR'];
+        }
         $ip = trim($ip1);
     }
     if (!empty($debug)) error_log('Real IP: '.$ip);

+ 5 - 0
main/newscorm/learnpath.class.php

@@ -492,6 +492,11 @@ class learnpath
         if ($this->debug > 0) {
             error_log('New LP - In learnpath::add_item(' . $parent . ',' . $previous . ',' . $type . ',' . $id . ',' . $title . ')', 0);
         }
+        if (empty($course_id)) {
+            // Sometimes Oogie doesn't catch the course info but sets $this->cc
+            $this->course_info = api_get_course_info($this->cc);
+            $course_id = $this->course_info['real_id'];
+        }
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
         $_course = $this->course_info;
         $parent = intval($parent);

+ 2 - 0
main/newscorm/openoffice_document.class.php

@@ -151,6 +151,8 @@ abstract class OpenofficeDocument extends learnpath
         if (!empty($files)) {
             // Create lp
             $this->lp_id = learnpath::add_lp($_course['id'], $this->file_name, '', 'guess', 'manual');
+            // make sure we have a course code available for later
+            $this->cc = $_course['id'];
 
             // Call to the function implemented by child following action_after_conversion parameter.
             switch ($action_after_conversion) {

+ 2 - 1
main/newscorm/openoffice_presentation.class.php

@@ -37,8 +37,9 @@ class OpenofficePresentation extends OpenofficeDocument
         $previous = 0;
         $i = 0;
 
-        if (!is_dir($this->base_work_dir.$this->created_dir))
+        if (!is_dir($this->base_work_dir.$this->created_dir)) {
             return false;
+        }
 
         foreach ($files as $file) {
             /* '||' is used as separator between fields: