Passed
Push — 1.10.x ( 751682...677ec8 )
by Yannick
50:57
created
main/resourcelinker/resourcelinker.php 1 patch
Braces   +10 added lines, -18 removed lines patch added patch discarded remove patch
@@ -111,8 +111,7 @@  discard block
 block discarded – undo
111 111
 	if ($max_temp2 > $max_temp)
112 112
 	{
113 113
 		$order = $max_temp2 +1;
114
-	}
115
-	else
114
+	} else
116 115
 	{
117 116
 		$order = $max_temp +1;
118 117
 	}
@@ -145,8 +144,7 @@  discard block
 block discarded – undo
145 144
 		$addedresourceid[] = Database::insert_id();
146 145
 		$_SESSION['addedresource'] = $addedresource;
147 146
 		$_SESSION['addedresourceid'] = $addedresourceid;
148
-	}
149
-	else
147
+	} else
150 148
 	{
151 149
 		// do not add external link to the links table
152 150
 		$addedresource[] = "Externallink";
@@ -188,7 +186,7 @@  discard block
 block discarded – undo
188 186
 		$result = Database::query($sql);
189 187
 		if(Database::num_rows($result)==0){
190 188
 			$lastorder_item = 0;
191
-		}else{
189
+		} else{
192 190
 			$row = Database::fetch_array($result);
193 191
 			$lastorder_item = ($row[0]);
194 192
 		}
@@ -196,7 +194,7 @@  discard block
 block discarded – undo
196 194
 		$result = Database::query($sql);
197 195
 		if(Database::num_rows($result)==0){
198 196
 			$lastorder_chapter = 0;
199
-		}else{
197
+		} else{
200 198
 			$row = Database::fetch_array($result);
201 199
 			$lastorder_chapter = ($row[0]);
202 200
 		}
@@ -284,12 +282,10 @@  discard block
 block discarded – undo
284 282
 			if ($action == "edit")
285 283
 			{
286 284
 				$url = "../calendar/agenda.php?action=edit&id=49&originalresource=$originalresource";
287
-			}
288
-			elseif ($action == "add")
285
+			} elseif ($action == "add")
289 286
 		{
290 287
 				$url = "../calendar/agenda.php?action=add&originalresource=$originalresource";
291
-			}
292
-			else
288
+			} else
293 289
 			{
294 290
 				$url = "../calendar/agenda.php?action=add";
295 291
 			}
@@ -345,8 +341,7 @@  discard block
 block discarded – undo
345 341
 {
346 342
 	$nameTools = get_lang('AddResource');
347 343
 	$interbreadcrumb[] = array ("url" => $_SESSION["origintoolurl"], "name" => $_SESSION["origintoolname"]);
348
-}
349
-else
344
+} else
350 345
 {
351 346
 	$learnpath_select_query = "	SELECT * FROM $tbl_learnpath_main
352 347
 		  								WHERE learnpath_id=$learnpath_id";
@@ -458,8 +453,7 @@  discard block
 block discarded – undo
458 453
 		<?php
459 454
         }
460 455
 
461
-}
462
-else
456
+} else
463 457
 {
464 458
 ?>
465 459
 
@@ -558,8 +552,7 @@  discard block
 block discarded – undo
558 552
 if ($from_learnpath != 'yes')
559 553
 {
560 554
 	echo "<form method=\"post\" action=\"{$_SESSION['origintoolurl']}\" style=\"margin: 0px;\"><input type=\"submit\" value=\"".get_lang('Ok')."\"></form>";
561
-}
562
-else
555
+} else
563 556
 {
564 557
 	echo "<form method=\"get\" action=\"../learnpath/learnpath_handler.php\" style=\"margin: 0px;\"><input type=\"hidden\" name=\"learnpath_id\" value=\"".htmlentities($learnpath_id)."\"><input type=\"submit\" value=\"".'  '.get_lang('Ok').'  '."\"></form>";
565 558
 }
@@ -747,8 +740,7 @@  discard block
 block discarded – undo
747 740
 				showorhide_addresourcelink("Thread", $myrow["topic_id"]);
748 741
 				echo "</td></tr>";
749 742
 			}
750
-		}
751
-		else
743
+		} else
752 744
 		{
753 745
 			// displaying all the replies
754 746
 			$sql = "SELECT * FROM ".$tbl_posts." post, ".$tbl_posts_text." post_text WHERE post_text.post_id=post.post_id and post.topic_id=$thread ORDER BY post_text.post_id ASC";
Please login to merge, or discard this patch.
main/upload/upload.document.php 1 patch
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -65,12 +65,17 @@
 block discarded – undo
65 65
     	$new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : '';
66 66
     	$new_title = isset($_POST['title']) ? trim($_POST['title']) : '';
67 67
 
68
-    	if ($new_path && ($new_comment || $new_title))
69
-    	if (($docid = DocumentManager::get_document_id($_course, $new_path))) {
68
+    	if ($new_path && ($new_comment || $new_title)) {
69
+    	    	if (($docid = DocumentManager::get_document_id($_course, $new_path))) {
70 70
         	$table_document = Database::get_course_table(TABLE_DOCUMENT);
71
+    	}
71 72
         	$ct = '';
72
-        	if ($new_comment) $ct .= ", comment='$new_comment'";
73
-        	if ($new_title)   $ct .= ", title='$new_title'";
73
+        	if ($new_comment) {
74
+        	    $ct .= ", comment='$new_comment'";
75
+        	}
76
+        	if ($new_title) {
77
+        	    $ct .= ", title='$new_title'";
78
+        	}
74 79
         	Database::query("UPDATE $table_document SET" . substr($ct, 1) ." WHERE id = '$docid'");
75 80
     	}
76 81
         //check for missing images in html files
Please login to merge, or discard this patch.
main/dropbox/dropbox_class.inc.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -303,7 +303,9 @@  discard block
 block discarded – undo
303 303
 		}
304 304
 
305 305
 		foreach ($recipient_ids as $rec) {
306
-			if (empty($rec)) die(get_lang('GeneralError').' (code 210)');
306
+			if (empty($rec)) {
307
+			    die(get_lang('GeneralError').' (code 210)');
308
+			}
307 309
 			//if (!isCourseMember($rec)) die(); //cannot sent document to someone outside of course
308 310
 				//this check is done when validating submitted data
309 311
 			$this->recipients[] = array('id' => $rec, 'name' => getUserNameFromId($rec));
@@ -593,13 +595,19 @@  discard block
 block discarded – undo
593 595
 		$id = intval($id);
594 596
 		$sql = "DELETE FROM ".$dropbox_cnf['tbl_file']."
595 597
 		        WHERE c_id = $course_id AND cat_id = '".$id."' ";
596
-		if (!Database::query($sql)) return false;
598
+		if (!Database::query($sql)) {
599
+		    return false;
600
+		}
597 601
 		$sql = "DELETE FROM ".$dropbox_cnf['tbl_category']."
598 602
 		        WHERE c_id = $course_id AND cat_id = '".$id."' ";
599
-		if (!Database::query($sql)) return false;
603
+		if (!Database::query($sql)) {
604
+		    return false;
605
+		}
600 606
 		$sql = "DELETE FROM ".$dropbox_cnf['tbl_post']."
601 607
 		        WHERE c_id = $course_id AND cat_id = '".$id."' ";
602
-		if (!Database::query($sql)) return false;
608
+		if (!Database::query($sql)) {
609
+		    return false;
610
+		}
603 611
 		return true;
604 612
 	}
605 613
 
Please login to merge, or discard this patch.
main/dropbox/dropbox_submit.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -267,7 +267,9 @@
 block discarded – undo
267 267
 			   break;
268 268
 			}
269 269
 		}
270
-		if (!$found) die(get_lang('GeneralError').' (code 415)');
270
+		if (!$found) {
271
+		    die(get_lang('GeneralError').' (code 415)');
272
+		}
271 273
 
272 274
         echo '<form method="post" action="index.php">', "\n",
273 275
             '<input type="hidden" name="feedbackid" value="',
Please login to merge, or discard this patch.
main/dropbox/dropbox_functions.inc.php 1 patch
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -715,7 +715,9 @@  discard block
 block discarded – undo
715 715
     $result = Database::query($sql);
716 716
     $res = Database::fetch_array($result);
717 717
 
718
-    if (!$res) return false;
718
+    if (!$res) {
719
+        return false;
720
+    }
719 721
     return stripslashes($res['name']);
720 722
 }
721 723
 
@@ -731,7 +733,9 @@  discard block
 block discarded – undo
731 733
             WHERE user_id='$id'";
732 734
     $result = Database::query($sql);
733 735
     $res = Database::fetch_array($result);
734
-    if (!$res) return false;
736
+    if (!$res) {
737
+        return false;
738
+    }
735 739
 
736 740
     return stripslashes($res['username']);
737 741
 }
@@ -807,10 +811,15 @@  discard block
 block discarded – undo
807 811
             ";
808 812
     $result = Database::query($sql);
809 813
 
810
-    if (!($res = Database::fetch_array($result)))
811
-        die(get_lang('GeneralError').' (code 901)');
812
-    if ($owner == 0) return $res['uploader_id'];
813
-    if ($res['uploader_id'] == $owner) return true;
814
+    if (!($res = Database::fetch_array($result))) {
815
+            die(get_lang('GeneralError').' (code 901)');
816
+    }
817
+    if ($owner == 0) {
818
+        return $res['uploader_id'];
819
+    }
820
+    if ($res['uploader_id'] == $owner) {
821
+        return true;
822
+    }
814 823
     die(get_lang('GeneralError').' (code '.$or_die.')');
815 824
 }
816 825
 
Please login to merge, or discard this patch.
main/course_progress/thematic_plan.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,17 +9,19 @@
 block discarded – undo
9 9
 
10 10
 // actions menu
11 11
 $new_thematic_plan_data = array();
12
-if (!empty($thematic_plan_data))
13
-foreach($thematic_plan_data as $thematic_item) {
12
+if (!empty($thematic_plan_data)) {
13
+    foreach($thematic_plan_data as $thematic_item) {
14 14
     $thematic_simple_list[] = $thematic_item['description_type'];
15
+}
15 16
     $new_thematic_plan_data[$thematic_item['description_type']] = $thematic_item;
16 17
 }
17 18
 
18 19
 $new_id = ADD_THEMATIC_PLAN;
19
-if (!empty($thematic_simple_list))
20
-foreach($thematic_simple_list as $item) {
20
+if (!empty($thematic_simple_list)) {
21
+    foreach($thematic_simple_list as $item) {
21 22
     if ($item >= ADD_THEMATIC_PLAN) {
22 23
         $new_id = $item + 1;
24
+}
23 25
         $default_thematic_plan_title[$item] = $new_thematic_plan_data[$item]['title'];
24 26
     }
25 27
 }
Please login to merge, or discard this patch.
main/newscorm/lp_impress.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
81 81
         //just showing the src in a iframe ...
82 82
         $html .= '<h2>'.$toc['title'].'</h2>';
83 83
         $html .= '<iframe border="0" frameborder="0" style="width:100%;height:600px" src="' . $src . '"></iframe>';
84
-    }else{
84
+    } else{
85 85
         $html .= "<div class='impress-title'>";
86 86
         $html .= '<h1>'.$toc['title'].'</h1>';
87 87
         $html .= "</div>";
Please login to merge, or discard this patch.
main/newscorm/storageapi.php 1 patch
Braces   +6 added lines, -8 removed lines patch added patch discarded remove patch
@@ -45,8 +45,9 @@  discard block
 block discarded – undo
45 45
         }
46 46
         break;
47 47
     case "stackgetall":
48
-        if (storage_can_set($_REQUEST['svuser']))
49
-            print storage_stack_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
48
+        if (storage_can_set($_REQUEST['svuser'])) {
49
+                    print storage_stack_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
50
+        }
50 51
         break;
51 52
     case "getposition":
52 53
         print storage_get_position($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc']);
@@ -87,8 +88,7 @@  discard block
 block discarded – undo
87 88
         } else {
88 89
             return $row['sv_value'];
89 90
         }
90
-    }
91
-    else {
91
+    } else {
92 92
         return null;
93 93
     }
94 94
 }
@@ -144,8 +144,7 @@  discard block
 block discarded – undo
144 144
     if (Database::num_rows($res) > 0) {
145 145
         $row = Database::fetch_assoc($res);
146 146
         return $row['position'];
147
-    }
148
-    else {
147
+    } else {
149 148
         return null;
150 149
     }
151 150
 }
@@ -198,8 +197,7 @@  discard block
 block discarded – undo
198 197
     if ($resorder && $resinsert) {
199 198
         Database::query("commit");
200 199
         return 1;
201
-    }
202
-    else {
200
+    } else {
203 201
         Database::query("rollback");
204 202
         return 0;
205 203
     }
Please login to merge, or discard this patch.
main/newscorm/lp_controller.php 1 patch
Braces   +225 added lines, -121 removed lines patch added patch discarded remove patch
@@ -13,7 +13,9 @@  discard block
 block discarded – undo
13 13
 $use_anonymous = true;
14 14
 
15 15
 $debug = 0;
16
-if ($debug > 0) error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0);
16
+if ($debug > 0) {
17
+    error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0);
18
+}
17 19
 
18 20
 // Language files that needs to be included.
19 21
 if (isset($_GET['action'])) {
@@ -231,10 +233,14 @@  discard block
 block discarded – undo
231 233
     // If refresh is set, we regenerate the oLP object from the database (kind of flush).
232 234
     Session::erase('refresh');
233 235
     $myrefresh = 1;
234
-    if ($debug > 0) error_log('New LP - Refresh asked', 0);
235
-}
236
+    if ($debug > 0) {
237
+        error_log('New LP - Refresh asked', 0);
238
+    }
239
+    }
236 240
 
237
-if ($debug > 0) error_log('New LP - Passed refresh check', 0);
241
+if ($debug > 0) {
242
+    error_log('New LP - Passed refresh check', 0);
243
+}
238 244
 
239 245
 if (!empty($_REQUEST['dialog_box'])) {
240 246
     $dialog_box = stripslashes(urldecode($_REQUEST['dialog_box']));
@@ -244,17 +250,23 @@  discard block
 block discarded – undo
244 250
 $lp_found = false;
245 251
 
246 252
 if (isset($_SESSION['lpobject'])) {
247
-    if ($debug > 0) error_log('New LP - SESSION[lpobject] is defined', 0);
253
+    if ($debug > 0) {
254
+        error_log('New LP - SESSION[lpobject] is defined', 0);
255
+    }
248 256
     $oLP = unserialize($_SESSION['lpobject']);
249 257
     if (isset($oLP) && is_object($oLP)) {
250
-        if ($debug > 0) error_log('New LP - oLP is object', 0);
258
+        if ($debug > 0) {
259
+            error_log('New LP - oLP is object', 0);
260
+        }
251 261
         if ($myrefresh == 1 OR
252 262
             empty($oLP->cc) OR
253 263
             $oLP->cc != api_get_course_id() OR
254 264
             $oLP->lp_view_session_id != $session_id OR
255 265
             $oLP->scorm_debug == '1'
256 266
         ) {
257
-            if ($debug > 0) error_log('New LP - Course has changed, discard lp object', 0);
267
+            if ($debug > 0) {
268
+                error_log('New LP - Course has changed, discard lp object', 0);
269
+            }
258 270
             if ($myrefresh == 1) { $myrefresh_id = $oLP->get_id(); }
259 271
             $oLP = null;
260 272
             Session::erase('oLP');
@@ -268,13 +280,19 @@  discard block
 block discarded – undo
268 280
 
269 281
 $course_id = api_get_course_int_id();
270 282
 
271
-if ($debug>0) error_log('New LP - Passed data remains check', 0);
283
+if ($debug>0) {
284
+    error_log('New LP - Passed data remains check', 0);
285
+}
272 286
 
273 287
 if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $_REQUEST['lp_id'])) {
274
-    if ($debug > 0) error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0);
288
+    if ($debug > 0) {
289
+        error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0);
290
+    }
275 291
     // Regenerate a new lp object? Not always as some pages don't need the object (like upload?)
276 292
     if (!empty($_REQUEST['lp_id']) || !empty($myrefresh_id)) {
277
-        if ($debug > 0) error_log('New LP - lp_id is defined', 0);
293
+        if ($debug > 0) {
294
+            error_log('New LP - lp_id is defined', 0);
295
+        }
278 296
         // Select the lp in the database and check which type it is (scorm/dokeos/aicc) to generate the
279 297
         // right object.
280 298
         if (!empty($_REQUEST['lp_id'])) {
@@ -286,49 +304,67 @@  discard block
 block discarded – undo
286 304
         $lp_table = Database::get_course_table(TABLE_LP_MAIN);
287 305
         if (is_numeric($lp_id)) {
288 306
             $sel = "SELECT lp_type FROM $lp_table WHERE c_id = $course_id AND id = $lp_id";
289
-            if ($debug > 0) error_log('New LP - querying '.$sel, 0);
307
+            if ($debug > 0) {
308
+                error_log('New LP - querying '.$sel, 0);
309
+            }
290 310
             $res = Database::query($sel);
291 311
 
292 312
             if (Database::num_rows($res)) {
293 313
                 $row = Database::fetch_array($res);
294 314
                 $type = $row['lp_type'];
295
-                if ($debug > 0) error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
315
+                if ($debug > 0) {
316
+                    error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
317
+                }
296 318
                 switch ($type) {
297 319
                     case 1:
298
-                        if ($debug > 0) error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
320
+                        if ($debug > 0) {
321
+                            error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
322
+                        }
299 323
 
300 324
                         $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id());
301 325
                         if ($oLP !== false) { $lp_found = true; } else { error_log($oLP->error, 0); }
302 326
                         break;
303 327
                     case 2:
304
-                        if ($debug > 0) error_log('New LP - found row - type scorm - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
328
+                        if ($debug > 0) {
329
+                            error_log('New LP - found row - type scorm - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
330
+                        }
305 331
                         $oLP = new scorm(api_get_course_id(), $lp_id, api_get_user_id());
306 332
                         if ($oLP !== false) { $lp_found = true; } else { error_log($oLP->error, 0); }
307 333
                         break;
308 334
                     case 3:
309
-                        if ($debug > 0) error_log('New LP - found row - type aicc - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
335
+                        if ($debug > 0) {
336
+                            error_log('New LP - found row - type aicc - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
337
+                        }
310 338
                         $oLP = new aicc(api_get_course_id(), $lp_id, api_get_user_id());
311 339
                         if ($oLP !== false) { $lp_found = true; } else { error_log($oLP->error, 0); }
312 340
                         break;
313 341
                     default:
314
-                        if ($debug > 0) error_log('New LP - found row - type other - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
342
+                        if ($debug > 0) {
343
+                            error_log('New LP - found row - type other - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
344
+                        }
315 345
                         $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id());
316 346
                         if ($oLP !== false) { $lp_found = true; } else { error_log($oLP->error, 0); }
317 347
                         break;
318 348
                 }
319 349
             }
320 350
         } else {
321
-            if ($debug > 0) error_log('New LP - Request[lp_id] is not numeric', 0);
351
+            if ($debug > 0) {
352
+                error_log('New LP - Request[lp_id] is not numeric', 0);
353
+            }
322 354
         }
323 355
     } else {
324
-        if ($debug > 0) error_log('New LP - Request[lp_id] and refresh_id were empty', 0);
356
+        if ($debug > 0) {
357
+            error_log('New LP - Request[lp_id] and refresh_id were empty', 0);
358
+        }
325 359
     }
326 360
     if ($lp_found) {
327 361
         $_SESSION['oLP'] = $oLP;
328 362
     }
329 363
 }
330 364
 
331
-if ($debug > 0) error_log('New LP - Passed oLP creation check', 0);
365
+if ($debug > 0) {
366
+    error_log('New LP - Passed oLP creation check', 0);
367
+}
332 368
 
333 369
 $is_allowed_to_edit = api_is_allowed_to_edit(false, true, false, false);
334 370
 
@@ -369,11 +405,15 @@  discard block
 block discarded – undo
369 405
         if (!$is_allowed_to_edit) {
370 406
             api_not_allowed(true);
371 407
         }
372
-        if ($debug > 0) error_log('New LP - add item action triggered', 0);
408
+        if ($debug > 0) {
409
+            error_log('New LP - add item action triggered', 0);
410
+        }
373 411
 
374 412
         if (!$lp_found) {
375 413
             //check if the learnpath ID was defined, otherwise send back to list
376
-            if ($debug > 0) error_log('New LP - No learnpath given for add item', 0);
414
+            if ($debug > 0) {
415
+                error_log('New LP - No learnpath given for add item', 0);
416
+            }
377 417
             require 'lp_list.php';
378 418
         } else {
379 419
             $_SESSION['refresh'] = 1;
@@ -447,11 +487,15 @@  discard block
 block discarded – undo
447 487
         if (!$is_allowed_to_edit) {
448 488
             api_not_allowed(true);
449 489
         }
450
-        if ($debug > 0) error_log('New LP - add audio action triggered', 0);
490
+        if ($debug > 0) {
491
+            error_log('New LP - add audio action triggered', 0);
492
+        }
451 493
 
452 494
         if (!$lp_found) {
453 495
             //check if the learnpath ID was defined, otherwise send back to list
454
-            if ($debug > 0) error_log('New LP - No learnpath given for add audio', 0);
496
+            if ($debug > 0) {
497
+                error_log('New LP - No learnpath given for add audio', 0);
498
+            }
455 499
             require 'lp_list.php';
456 500
         } else {
457 501
             $_SESSION['refresh'] = 1;
@@ -525,7 +569,9 @@  discard block
 block discarded – undo
525 569
         if (!$is_allowed_to_edit) {
526 570
             api_not_allowed(true);
527 571
         }
528
-        if ($debug > 0) error_log('New LP - add_lp action triggered', 0);
572
+        if ($debug > 0) {
573
+            error_log('New LP - add_lp action triggered', 0);
574
+        }
529 575
         if (isset($_REQUEST['lp_name']) && !empty($_REQUEST['lp_name'])) {
530 576
             $_REQUEST['lp_name'] = trim($_REQUEST['lp_name']);
531 577
             $_SESSION['refresh'] = 1;
@@ -584,9 +630,10 @@  discard block
 block discarded – undo
584 630
         if (!$is_allowed_to_edit) {
585 631
             api_not_allowed(true);
586 632
         }
587
-        if ($debug > 0) error_log('New LP - admin_view action triggered', 0);
588
-        if (!$lp_found) { error_log('New LP - No learnpath given for admin_view', 0); require 'lp_list.php'; }
589
-        else {
633
+        if ($debug > 0) {
634
+            error_log('New LP - admin_view action triggered', 0);
635
+        }
636
+        if (!$lp_found) { error_log('New LP - No learnpath given for admin_view', 0); require 'lp_list.php'; } else {
590 637
             $_SESSION['refresh'] = 1;
591 638
             require 'lp_admin_view.php';
592 639
         }
@@ -596,9 +643,10 @@  discard block
 block discarded – undo
596 643
             if (!$is_allowed_to_edit) {
597 644
                 api_not_allowed(true);
598 645
             }
599
-            if ($debug > 0) error_log('New LP - auto_launch action triggered', 0);
600
-            if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; }
601
-            else {
646
+            if ($debug > 0) {
647
+                error_log('New LP - auto_launch action triggered', 0);
648
+            }
649
+            if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; } else {
602 650
                 $_SESSION['oLP']->set_autolaunch($_GET['lp_id'], $_GET['status']);
603 651
                 require 'lp_list.php';
604 652
                 exit;
@@ -609,10 +657,11 @@  discard block
 block discarded – undo
609 657
         if (!$is_allowed_to_edit) {
610 658
             api_not_allowed(true);
611 659
         }
612
-        if ($debug > 0) error_log('New LP - build action triggered', 0);
660
+        if ($debug > 0) {
661
+            error_log('New LP - build action triggered', 0);
662
+        }
613 663
 
614
-        if (!$lp_found) { error_log('New LP - No learnpath given for build', 0); require 'lp_list.php'; }
615
-        else {
664
+        if (!$lp_found) { error_log('New LP - No learnpath given for build', 0); require 'lp_list.php'; } else {
616 665
             $_SESSION['refresh'] = 1;
617 666
             //require 'lp_build.php';
618 667
             $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id);
@@ -624,10 +673,11 @@  discard block
 block discarded – undo
624 673
         if (!$is_allowed_to_edit) {
625 674
             api_not_allowed(true);
626 675
         }
627
-        if ($debug > 0) error_log('New LP - edit item action triggered', 0);
676
+        if ($debug > 0) {
677
+            error_log('New LP - edit item action triggered', 0);
678
+        }
628 679
 
629
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit item', 0); require 'lp_list.php'; }
630
-        else {
680
+        if (!$lp_found) { error_log('New LP - No learnpath given for edit item', 0); require 'lp_list.php'; } else {
631 681
             $_SESSION['refresh'] = 1;
632 682
             if (isset($_POST['submit_button']) && !empty($post_title)) {
633 683
 
@@ -677,9 +727,10 @@  discard block
 block discarded – undo
677 727
         if (!$is_allowed_to_edit) {
678 728
             api_not_allowed(true);
679 729
         }
680
-        if ($debug > 0) error_log('New LP - edit item prereq action triggered', 0);
681
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; }
682
-        else {
730
+        if ($debug > 0) {
731
+            error_log('New LP - edit item prereq action triggered', 0);
732
+        }
733
+        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; } else {
683 734
             if (isset($_POST['submit_button'])) {
684 735
                 //Updating the lp.modified_on
685 736
                 $_SESSION['oLP']->set_modified_on();
@@ -707,9 +758,10 @@  discard block
 block discarded – undo
707 758
         if (!$is_allowed_to_edit) {
708 759
             api_not_allowed(true);
709 760
         }
710
-        if ($debug > 0) error_log('New LP - move item action triggered', 0);
711
-        if (!$lp_found) { error_log('New LP - No learnpath given for move item', 0); require 'lp_list.php'; }
712
-        else {
761
+        if ($debug > 0) {
762
+            error_log('New LP - move item action triggered', 0);
763
+        }
764
+        if (!$lp_found) { error_log('New LP - No learnpath given for move item', 0); require 'lp_list.php'; } else {
713 765
             $_SESSION['refresh'] = 1;
714 766
             if (isset($_POST['submit_button'])) {
715 767
                 //Updating the lp.modified_on
@@ -742,7 +794,9 @@  discard block
 block discarded – undo
742 794
         if (!$is_allowed_to_edit) {
743 795
             api_not_allowed(true);
744 796
         }
745
-        if ($debug > 0) error_log('New LP - view_item action triggered', 0);
797
+        if ($debug > 0) {
798
+            error_log('New LP - view_item action triggered', 0);
799
+        }
746 800
         if (!$lp_found) {
747 801
             error_log('New LP - No learnpath given for view item', 0); require 'lp_list.php';
748 802
         } else {
@@ -754,7 +808,9 @@  discard block
 block discarded – undo
754 808
         if (!$is_allowed_to_edit) {
755 809
             api_not_allowed(true);
756 810
         }
757
-        if ($debug > 0) error_log('New LP - upload action triggered', 0);
811
+        if ($debug > 0) {
812
+            error_log('New LP - upload action triggered', 0);
813
+        }
758 814
         $cwdir = getcwd();
759 815
         require 'lp_upload.php';
760 816
         // Reinit current working directory as many functions in upload change it.
@@ -771,9 +827,10 @@  discard block
 block discarded – undo
771 827
             api_not_allowed(true);
772 828
         }
773 829
 
774
-        if ($debug > 0) error_log('New LP - export action triggered', 0);
775
-        if (!$lp_found) { error_log('New LP - No learnpath given for copy', 0); require 'lp_list.php'; }
776
-        else {
830
+        if ($debug > 0) {
831
+            error_log('New LP - export action triggered', 0);
832
+        }
833
+        if (!$lp_found) { error_log('New LP - No learnpath given for copy', 0); require 'lp_list.php'; } else {
777 834
             $_SESSION['oLP']->copy();
778 835
         }
779 836
         require 'lp_list.php';
@@ -786,9 +843,10 @@  discard block
 block discarded – undo
786 843
         if ($hideScormExportLink === 'true') {
787 844
             api_not_allowed(true);
788 845
         }
789
-        if ($debug > 0) error_log('New LP - export action triggered', 0);
790
-        if (!$lp_found) { error_log('New LP - No learnpath given for export', 0); require 'lp_list.php'; }
791
-        else {
846
+        if ($debug > 0) {
847
+            error_log('New LP - export action triggered', 0);
848
+        }
849
+        if (!$lp_found) { error_log('New LP - No learnpath given for export', 0); require 'lp_list.php'; } else {
792 850
             $_SESSION['oLP']->scorm_export();
793 851
             exit();
794 852
             //require 'lp_list.php';
@@ -803,7 +861,9 @@  discard block
 block discarded – undo
803 861
             api_not_allowed(true);
804 862
         }
805 863
 
806
-        if ($debug > 0) error_log('New LP - export action triggered', 0);
864
+        if ($debug > 0) {
865
+            error_log('New LP - export action triggered', 0);
866
+        }
807 867
         if (!$lp_found) { error_log('New LP - No learnpath given for export_to_pdf', 0); require 'lp_list.php';
808 868
         } else {
809 869
             $result = $_SESSION['oLP']->scorm_export_to_pdf($_GET['lp_id']);
@@ -817,9 +877,10 @@  discard block
 block discarded – undo
817 877
         if (!$is_allowed_to_edit) {
818 878
             api_not_allowed(true);
819 879
         }
820
-        if ($debug > 0) error_log('New LP - delete action triggered', 0);
821
-        if (!$lp_found) { error_log('New LP - No learnpath given for delete', 0); require 'lp_list.php'; }
822
-        else {
880
+        if ($debug > 0) {
881
+            error_log('New LP - delete action triggered', 0);
882
+        }
883
+        if (!$lp_found) { error_log('New LP - No learnpath given for delete', 0); require 'lp_list.php'; } else {
823 884
             $_SESSION['refresh'] = 1;
824 885
             $_SESSION['oLP']->delete(null, $_GET['lp_id'], 'remove');
825 886
             Session::erase('oLP');
@@ -831,9 +892,10 @@  discard block
 block discarded – undo
831 892
         if (!$is_allowed_to_edit) {
832 893
             api_not_allowed(true);
833 894
         }
834
-        if ($debug > 0) error_log('New LP - visibility action triggered', 0);
835
-        if (!$lp_found) { error_log('New LP - No learnpath given for visibility', 0); require 'lp_list.php'; }
836
-        else {
895
+        if ($debug > 0) {
896
+            error_log('New LP - visibility action triggered', 0);
897
+        }
898
+        if (!$lp_found) { error_log('New LP - No learnpath given for visibility', 0); require 'lp_list.php'; } else {
837 899
             learnpath::toggle_visibility($_REQUEST['lp_id'], $_REQUEST['new_status']);
838 900
             require 'lp_list.php';
839 901
         }
@@ -843,9 +905,10 @@  discard block
 block discarded – undo
843 905
         if (!$is_allowed_to_edit) {
844 906
             api_not_allowed(true);
845 907
         }
846
-        if ($debug > 0) error_log('New LP - publish action triggered', 0);
847
-        if (!$lp_found) { error_log('New LP - No learnpath given for publish', 0); require 'lp_list.php'; }
848
-        else {
908
+        if ($debug > 0) {
909
+            error_log('New LP - publish action triggered', 0);
910
+        }
911
+        if (!$lp_found) { error_log('New LP - No learnpath given for publish', 0); require 'lp_list.php'; } else {
849 912
             learnpath::toggle_publish($_REQUEST['lp_id'], $_REQUEST['new_status']);
850 913
             require 'lp_list.php';
851 914
         }
@@ -855,7 +918,9 @@  discard block
 block discarded – undo
855 918
         if (!$is_allowed_to_edit) {
856 919
             api_not_allowed(true);
857 920
         }
858
-        if ($debug > 0) error_log('New LP - publish action triggered', 0);
921
+        if ($debug > 0) {
922
+            error_log('New LP - publish action triggered', 0);
923
+        }
859 924
         if (!$lp_found) {
860 925
             error_log('New LP - No learnpath given for publish', 0);
861 926
             require 'lp_list.php';
@@ -869,7 +934,9 @@  discard block
 block discarded – undo
869 934
         if (!$is_allowed_to_edit) {
870 935
             api_not_allowed(true);
871 936
         }
872
-        if ($debug > 0) error_log('New LP - publish action triggered', 0);
937
+        if ($debug > 0) {
938
+            error_log('New LP - publish action triggered', 0);
939
+        }
873 940
         if (!$lp_found) {
874 941
             error_log('New LP - No learnpath given for publish', 0);
875 942
             require 'lp_list.php';
@@ -882,9 +949,10 @@  discard block
 block discarded – undo
882 949
         if (!$is_allowed_to_edit) {
883 950
             api_not_allowed(true);
884 951
         }
885
-        if ($debug > 0) error_log('New LP - edit action triggered', 0);
886
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; }
887
-        else {
952
+        if ($debug > 0) {
953
+            error_log('New LP - edit action triggered', 0);
954
+        }
955
+        if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; } else {
888 956
             $_SESSION['refresh'] = 1;
889 957
             require 'lp_edit.php';
890 958
         }
@@ -893,9 +961,10 @@  discard block
 block discarded – undo
893 961
         if (!$is_allowed_to_edit) {
894 962
             api_not_allowed(true);
895 963
         }
896
-        if ($debug > 0) error_log('New LP - update_lp action triggered', 0);
897
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; }
898
-        else {
964
+        if ($debug > 0) {
965
+            error_log('New LP - update_lp action triggered', 0);
966
+        }
967
+        if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; } else {
899 968
             $_SESSION['refresh'] = 1;
900 969
             $lp_name = Security::remove_XSS($_REQUEST['lp_name']);
901 970
             $_SESSION['oLP']->set_name($lp_name);
@@ -962,8 +1031,9 @@  discard block
 block discarded – undo
962 1031
             );
963 1032
             $extraFieldValue->saveFieldValues($_REQUEST);
964 1033
 
965
-            if ($_FILES['lp_preview_image']['size'] > 0)
966
-                $_SESSION['oLP']->upload_image($_FILES['lp_preview_image']);
1034
+            if ($_FILES['lp_preview_image']['size'] > 0) {
1035
+                            $_SESSION['oLP']->upload_image($_FILES['lp_preview_image']);
1036
+            }
967 1037
 
968 1038
             if (api_get_setting('search_enabled') === 'true') {
969 1039
                 require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
@@ -1003,9 +1073,10 @@  discard block
 block discarded – undo
1003 1073
         if (!$is_allowed_to_edit) {
1004 1074
             api_not_allowed(true);
1005 1075
         }
1006
-        if ($debug > 0) error_log('New LP - add sub item action triggered', 0);
1007
-        if (!$lp_found) { error_log('New LP - No learnpath given for add sub item', 0); require 'lp_list.php'; }
1008
-        else {
1076
+        if ($debug > 0) {
1077
+            error_log('New LP - add sub item action triggered', 0);
1078
+        }
1079
+        if (!$lp_found) { error_log('New LP - No learnpath given for add sub item', 0); require 'lp_list.php'; } else {
1009 1080
             $_SESSION['refresh'] = 1;
1010 1081
             if (!empty($_REQUEST['parent_item_id'])) {
1011 1082
                 $_SESSION['from_learnpath']='yes';
@@ -1021,9 +1092,10 @@  discard block
 block discarded – undo
1021 1092
         if (!$is_allowed_to_edit) {
1022 1093
             api_not_allowed(true);
1023 1094
         }
1024
-        if ($debug > 0) error_log('New LP - delete item action triggered', 0);
1025
-        if (!$lp_found) { error_log('New LP - No learnpath given for delete item', 0); require 'lp_list.php'; }
1026
-        else {
1095
+        if ($debug > 0) {
1096
+            error_log('New LP - delete item action triggered', 0);
1097
+        }
1098
+        if (!$lp_found) { error_log('New LP - No learnpath given for delete item', 0); require 'lp_list.php'; } else {
1027 1099
             //$_SESSION['refresh'] = 1;
1028 1100
             if (!empty($_REQUEST['id'])) {
1029 1101
                 $_SESSION['oLP']->delete_item($_REQUEST['id']);
@@ -1038,9 +1110,10 @@  discard block
 block discarded – undo
1038 1110
         if (!$is_allowed_to_edit) {
1039 1111
             api_not_allowed(true);
1040 1112
         }
1041
-        if ($debug > 0) error_log('New LP - edit item prereq action triggered', 0);
1042
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; }
1043
-        else {
1113
+        if ($debug > 0) {
1114
+            error_log('New LP - edit item prereq action triggered', 0);
1115
+        }
1116
+        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; } else {
1044 1117
             if (!empty($_REQUEST['id']) && !empty($_REQUEST['submit_item'])) {
1045 1118
                 $_SESSION['refresh'] = 1;
1046 1119
                 $_SESSION['oLP']->edit_item_prereq($_REQUEST['id'], $_REQUEST['prereq']);
@@ -1049,53 +1122,61 @@  discard block
 block discarded – undo
1049 1122
         }
1050 1123
         break;
1051 1124
     case 'restart':
1052
-        if ($debug > 0) error_log('New LP - restart action triggered', 0);
1053
-        if (!$lp_found) { error_log('New LP - No learnpath given for restart', 0); require 'lp_list.php'; }
1054
-        else {
1125
+        if ($debug > 0) {
1126
+            error_log('New LP - restart action triggered', 0);
1127
+        }
1128
+        if (!$lp_found) { error_log('New LP - No learnpath given for restart', 0); require 'lp_list.php'; } else {
1055 1129
             $_SESSION['oLP']->restart();
1056 1130
             require 'lp_view.php';
1057 1131
         }
1058 1132
         break;
1059 1133
     case 'last':
1060
-        if ($debug > 0) error_log('New LP - last action triggered', 0);
1061
-        if (!$lp_found) { error_log('New LP - No learnpath given for last', 0); require 'lp_list.php'; }
1062
-        else {
1134
+        if ($debug > 0) {
1135
+            error_log('New LP - last action triggered', 0);
1136
+        }
1137
+        if (!$lp_found) { error_log('New LP - No learnpath given for last', 0); require 'lp_list.php'; } else {
1063 1138
             $_SESSION['oLP']->last();
1064 1139
             require 'lp_view.php';
1065 1140
         }
1066 1141
         break;
1067 1142
     case 'first':
1068
-        if ($debug > 0) error_log('New LP - first action triggered', 0);
1069
-        if (!$lp_found) { error_log('New LP - No learnpath given for first', 0); require 'lp_list.php'; }
1070
-        else {
1143
+        if ($debug > 0) {
1144
+            error_log('New LP - first action triggered', 0);
1145
+        }
1146
+        if (!$lp_found) { error_log('New LP - No learnpath given for first', 0); require 'lp_list.php'; } else {
1071 1147
             $_SESSION['oLP']->first();
1072 1148
             require 'lp_view.php';
1073 1149
         }
1074 1150
         break;
1075 1151
     case 'next':
1076
-        if ($debug > 0) error_log('New LP - next action triggered', 0);
1077
-        if (!$lp_found) { error_log('New LP - No learnpath given for next', 0); require 'lp_list.php'; }
1078
-        else {
1152
+        if ($debug > 0) {
1153
+            error_log('New LP - next action triggered', 0);
1154
+        }
1155
+        if (!$lp_found) { error_log('New LP - No learnpath given for next', 0); require 'lp_list.php'; } else {
1079 1156
             $_SESSION['oLP']->next();
1080 1157
             require 'lp_view.php';
1081 1158
         }
1082 1159
         break;
1083 1160
     case 'previous':
1084
-        if ($debug > 0) error_log('New LP - previous action triggered', 0);
1085
-        if (!$lp_found) { error_log('New LP - No learnpath given for previous', 0); require 'lp_list.php'; }
1086
-        else {
1161
+        if ($debug > 0) {
1162
+            error_log('New LP - previous action triggered', 0);
1163
+        }
1164
+        if (!$lp_found) { error_log('New LP - No learnpath given for previous', 0); require 'lp_list.php'; } else {
1087 1165
             $_SESSION['oLP']->previous();
1088 1166
             require 'lp_view.php';
1089 1167
         }
1090 1168
         break;
1091 1169
     case 'content':
1092
-        if ($debug > 0) error_log('New LP - content action triggered', 0);
1093
-        if ($debug > 0) error_log('New LP - Item id is '.intval($_GET['item_id']), 0);
1170
+        if ($debug > 0) {
1171
+            error_log('New LP - content action triggered', 0);
1172
+        }
1173
+        if ($debug > 0) {
1174
+            error_log('New LP - Item id is '.intval($_GET['item_id']), 0);
1175
+        }
1094 1176
         if (!$lp_found) {
1095 1177
             error_log('New LP - No learnpath given for content', 0);
1096 1178
             require 'lp_list.php';
1097
-        }
1098
-        else {
1179
+        } else {
1099 1180
             $_SESSION['oLP']->save_last();
1100 1181
             $_SESSION['oLP']->set_current_item($_GET['item_id']);
1101 1182
             $_SESSION['oLP']->start_current_item();
@@ -1103,8 +1184,9 @@  discard block
 block discarded – undo
1103 1184
         }
1104 1185
         break;
1105 1186
     case 'view':
1106
-        if ($debug > 0)
1107
-            error_log('New LP - view action triggered', 0);
1187
+        if ($debug > 0) {
1188
+                    error_log('New LP - view action triggered', 0);
1189
+        }
1108 1190
         if (!$lp_found) {
1109 1191
             error_log('New LP - No learnpath given for view', 0);
1110 1192
             require 'lp_list.php';
@@ -1117,17 +1199,19 @@  discard block
 block discarded – undo
1117 1199
         }
1118 1200
         break;
1119 1201
     case 'save':
1120
-        if ($debug > 0) error_log('New LP - save action triggered', 0);
1121
-        if (!$lp_found) { error_log('New LP - No learnpath given for save', 0); require 'lp_list.php'; }
1122
-        else {
1202
+        if ($debug > 0) {
1203
+            error_log('New LP - save action triggered', 0);
1204
+        }
1205
+        if (!$lp_found) { error_log('New LP - No learnpath given for save', 0); require 'lp_list.php'; } else {
1123 1206
             $_SESSION['oLP']->save_item();
1124 1207
             require 'lp_save.php';
1125 1208
         }
1126 1209
         break;
1127 1210
     case 'stats':
1128
-        if ($debug > 0) error_log('New LP - stats action triggered', 0);
1129
-        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; }
1130
-        else {
1211
+        if ($debug > 0) {
1212
+            error_log('New LP - stats action triggered', 0);
1213
+        }
1214
+        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } else {
1131 1215
             $_SESSION['oLP']->save_current();
1132 1216
             $_SESSION['oLP']->save_last();
1133 1217
             $output = require 'lp_stats.php';
@@ -1135,7 +1219,9 @@  discard block
 block discarded – undo
1135 1219
         }
1136 1220
         break;
1137 1221
     case 'list':
1138
-        if ($debug > 0) error_log('New LP - list action triggered', 0);
1222
+        if ($debug > 0) {
1223
+            error_log('New LP - list action triggered', 0);
1224
+        }
1139 1225
         if ($lp_found) {
1140 1226
             $_SESSION['refresh'] = 1;
1141 1227
             $_SESSION['oLP']->save_last();
@@ -1144,7 +1230,9 @@  discard block
 block discarded – undo
1144 1230
         break;
1145 1231
     case 'mode':
1146 1232
         // Switch between fullscreen and embedded mode.
1147
-        if ($debug > 0) error_log('New LP - mode change triggered', 0);
1233
+        if ($debug > 0) {
1234
+            error_log('New LP - mode change triggered', 0);
1235
+        }
1148 1236
         $mode = $_REQUEST['mode'];
1149 1237
         if ($mode == 'fullscreen') {
1150 1238
             $_SESSION['oLP']->mode = 'fullscreen';
@@ -1158,7 +1246,9 @@  discard block
 block discarded – undo
1158 1246
         require 'lp_view.php';
1159 1247
         break;
1160 1248
     case 'switch_view_mode':
1161
-        if ($debug > 0) error_log('New LP - switch_view_mode action triggered', 0);
1249
+        if ($debug > 0) {
1250
+            error_log('New LP - switch_view_mode action triggered', 0);
1251
+        }
1162 1252
         if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
1163 1253
         if (Security::check_token('get')) {
1164 1254
             $_SESSION['refresh'] = 1;
@@ -1167,7 +1257,9 @@  discard block
 block discarded – undo
1167 1257
         require 'lp_list.php';
1168 1258
         break;
1169 1259
     case 'switch_force_commit':
1170
-        if ($debug > 0) error_log('New LP - switch_force_commit action triggered', 0);
1260
+        if ($debug > 0) {
1261
+            error_log('New LP - switch_force_commit action triggered', 0);
1262
+        }
1171 1263
         if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
1172 1264
         $_SESSION['refresh'] = 1;
1173 1265
         $_SESSION['oLP']->update_default_scorm_commit();
@@ -1190,25 +1282,33 @@  discard block
 block discarded – undo
1190 1282
 		break;
1191 1283
      */
1192 1284
 	case 'switch_attempt_mode':
1193
-		if($debug>0) error_log('New LP - switch_reinit action triggered',0);
1285
+		if($debug>0) {
1286
+		    error_log('New LP - switch_reinit action triggered',0);
1287
+		}
1194 1288
 		if(!$lp_found){ error_log('New LP - No learnpath given for switch',0); require 'lp_list.php'; }
1195 1289
 		$_SESSION['refresh'] = 1;
1196 1290
 		$_SESSION['oLP']->switch_attempt_mode();
1197 1291
         require 'lp_list.php';
1198 1292
         break;
1199 1293
     case 'switch_scorm_debug':
1200
-        if ($debug > 0) error_log('New LP - switch_scorm_debug action triggered', 0);
1294
+        if ($debug > 0) {
1295
+            error_log('New LP - switch_scorm_debug action triggered', 0);
1296
+        }
1201 1297
         if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
1202 1298
         $_SESSION['refresh'] = 1;
1203 1299
         $_SESSION['oLP']->update_scorm_debug();
1204 1300
         require 'lp_list.php';
1205 1301
         break;
1206 1302
     case 'intro_cmdAdd':
1207
-        if ($debug > 0) error_log('New LP - intro_cmdAdd action triggered', 0);
1303
+        if ($debug > 0) {
1304
+            error_log('New LP - intro_cmdAdd action triggered', 0);
1305
+        }
1208 1306
         // Add introduction section page.
1209 1307
         break;
1210 1308
     case 'js_api_refresh':
1211
-        if ($debug > 0) error_log('New LP - js_api_refresh action triggered', 0);
1309
+        if ($debug > 0) {
1310
+            error_log('New LP - js_api_refresh action triggered', 0);
1311
+        }
1212 1312
         if (!$lp_found) { error_log('New LP - No learnpath given for js_api_refresh', 0); require 'lp_message.php'; }
1213 1313
         if (isset($_REQUEST['item_id'])) {
1214 1314
             $htmlHeadXtra[] = $_SESSION['oLP']->get_js_info($_REQUEST['item_id']);
@@ -1216,8 +1316,7 @@  discard block
 block discarded – undo
1216 1316
         require 'lp_message.php';
1217 1317
         break;
1218 1318
     case 'return_to_course_homepage':
1219
-        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; }
1220
-        else {
1319
+        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } else {
1221 1320
             $_SESSION['oLP']->save_current();
1222 1321
             $_SESSION['oLP']->save_last();
1223 1322
             $url = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/index.php?id_session='.api_get_session_id();
@@ -1235,8 +1334,9 @@  discard block
 block discarded – undo
1235 1334
         require 'lp_list_search.php';
1236 1335
         break;
1237 1336
     case 'impress':
1238
-        if ($debug > 0)
1239
-            error_log('New LP - view action triggered', 0);
1337
+        if ($debug > 0) {
1338
+                    error_log('New LP - view action triggered', 0);
1339
+        }
1240 1340
         if (!$lp_found) {
1241 1341
             error_log('New LP - No learnpath given for view', 0);
1242 1342
             require 'lp_list.php';
@@ -1386,12 +1486,16 @@  discard block
 block discarded – undo
1386 1486
         ]));
1387 1487
         break;
1388 1488
     default:
1389
-        if ($debug > 0) error_log('New LP - default action triggered', 0);
1489
+        if ($debug > 0) {
1490
+            error_log('New LP - default action triggered', 0);
1491
+        }
1390 1492
         require 'lp_list.php';
1391 1493
         break;
1392 1494
 }
1393 1495
 
1394 1496
 if (!empty($_SESSION['oLP'])) {
1395 1497
     $_SESSION['lpobject'] = serialize($_SESSION['oLP']);
1396
-    if ($debug > 0) error_log('New LP - lpobject is serialized in session', 0);
1397
-}
1498
+    if ($debug > 0) {
1499
+        error_log('New LP - lpobject is serialized in session', 0);
1500
+    }
1501
+    }
Please login to merge, or discard this patch.