Browse Source

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

Yannick Warnier 9 years ago
parent
commit
924dfca7e6
1 changed files with 18 additions and 11 deletions
  1. 18 11
      main/newscorm/learnpath.class.php

+ 18 - 11
main/newscorm/learnpath.class.php

@@ -1894,8 +1894,13 @@ class learnpath
         if ($this->debug > 0) {
             error_log('New LP - In learnpath::get_last()', 0);
         }
-        $this->index = count($this->ordered_items) - 1;
-        return $this->ordered_items[$this->index];
+        //This is just in case the lesson doesn't cointain a valid scheme, just to avoid "Notices"
+        if ($this->index > 0) {
+            $this->index = count($this->ordered_items) - 1;
+            return $this->ordered_items[$this->index];
+        }
+        
+        return false;
     }
 
     /**
@@ -5497,7 +5502,7 @@ class learnpath
         }
 
         $this->tree_array($arrLP);
-        $arrLP = $this->arrMenu;
+        $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
         unset ($this->arrMenu);
         $default_data = null;
         $default_content = null;
@@ -6320,7 +6325,7 @@ class learnpath
         }
 
         $this->tree_array($arrLP);
-        $arrLP = $this->arrMenu;
+        $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
         unset ($this->arrMenu);
 
         if ($action == 'add') {
@@ -6738,7 +6743,7 @@ class learnpath
         }
 
         $this->tree_array($arrLP);
-        $arrLP = $this->arrMenu;
+        $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
         unset($this->arrMenu);
 
         if ($action == 'add')
@@ -6929,7 +6934,7 @@ class learnpath
         }
 
         $this->tree_array($arrLP);
-        $arrLP = $this->arrMenu;
+        $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
         unset ($this->arrMenu);
 
         $return .= '<form method="POST">';
@@ -7372,7 +7377,7 @@ class learnpath
         }
 
         $this->tree_array($arrLP);
-        $arrLP = $this->arrMenu;
+        $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
         unset ($this->arrMenu);
 
         if ($action == 'add') {
@@ -7661,7 +7666,7 @@ class learnpath
         }
 
         $this->tree_array($arrLP);
-        $arrLP = $this->arrMenu;
+        $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
         unset ($this->arrMenu);
 
         if ($action == 'add')
@@ -7854,7 +7859,7 @@ class learnpath
         }
 
         $this->tree_array($arrLP);
-        $arrLP = $this->arrMenu;
+        $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
         unset ($this->arrMenu);
 
         if ($action == 'add') {
@@ -8295,7 +8300,7 @@ class learnpath
         }
 
         $this->tree_array($arrLP);
-        $arrLP = $this->arrMenu;
+        $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
         unset($this->arrMenu);
 
         for ($i = 0; $i < count($arrLP); $i++) {
@@ -10339,7 +10344,9 @@ EOD;
         }
 
         $protocolFixApplied = false;
-        if ($platformProtocol != $urlInfo['scheme']) {
+        //Scheme validation to avoid "Notices" when the lesson doesn't contain a valid scheme
+        $scheme = isset($urlInfo['scheme']) ? $urlInfo['scheme'] : null;
+        if ($platformProtocol != $scheme) {
             $_SESSION['x_frame_source'] = $src;
             $src = 'blank.php?error=x_frames_options';
             $protocolFixApplied = true;