Completed
Push — 1.11.x ( ca7787...41c0f2 )
by José
31:51
created
main/wiki/wiki.inc.php 1 patch
Braces   +4 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1893,7 +1893,7 @@  discard block
 block discarded – undo
1893 1893
                 $email_body = get_lang('DearUser').' '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).',<br /><br />';
1894 1894
                 if($session_id==0){
1895 1895
                     $email_body .= $emailtext.' <strong>'.$_course['name'].' - '.$group_name.'</strong><br /><br /><br />';
1896
-                }else{
1896
+                } else{
1897 1897
                     $email_body .= $emailtext.' <strong>'.$_course['name'].' ('.api_get_session_name(api_get_session_id()).') - '.$group_name.'</strong><br /><br /><br />';
1898 1898
                 }
1899 1899
                 $email_body .= $email_user_author.' ('.$email_date_changes.')<br /><br /><br />';
@@ -2283,8 +2283,7 @@  discard block
 block discarded – undo
2283 2283
                                         s1.reflink = s2.reflink AND
2284 2284
                                         ".$groupfilter.$condition_session.")";
2285 2285
                     // warning don't use group by reflink because don't return the last version
2286
-                }
2287
-                else {
2286
+                } else {
2288 2287
                     $sql = " SELECT * FROM ".$tbl_wiki." s1
2289 2288
                             WHERE
2290 2289
                                 s1.c_id = $course_id AND
@@ -3726,8 +3725,7 @@  discard block
 block discarded – undo
3726 3725
                 '.api_htmlentities($obj->title).'</a>';
3727 3726
                 if ($userinfo !== false) {
3728 3727
                     $row[] = UserManager::getUserProfileLink($userinfo);
3729
-                }
3730
-                else {
3728
+                } else {
3731 3729
                     $row[] = get_lang('Anonymous').' ('.api_htmlentities($obj->user_ip).')';
3732 3730
                 }
3733 3731
                 $row[] = api_get_local_time($obj->dtime, null, date_default_timezone_get());
@@ -3962,8 +3960,7 @@  discard block
 block discarded – undo
3962 3960
                         api_htmlentities($obj->title).'</a>';
3963 3961
                     if ($userinfo !== false) {
3964 3962
                         $row[] = UserManager::getUserProfileLink($userinfo);
3965
-                    }
3966
-                    else {
3963
+                    } else {
3967 3964
                         $row[] = get_lang('Anonymous').' ('.$obj->user_ip.')';
3968 3965
                     }
3969 3966
                     $row[] = $year.'-'.$month.'-'.$day.' '.$hours.":".$minutes.":".$seconds;
Please login to merge, or discard this patch.
main/inc/ajax/course_home.ajax.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -123,8 +123,9 @@  discard block
 block discarded – undo
123 123
             $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id());
124 124
             $my_session_list  = array();
125 125
             foreach($new_session_list as $item) {
126
-                if (!empty($item['id_session']))
127
-                    $my_session_list[] = $item['id_session'];
126
+                if (!empty($item['id_session'])) {
127
+                                    $my_session_list[] = $item['id_session'];
128
+                }
128 129
             }
129 130
             if (!in_array($session_id, $my_session_list)) {
130 131
                 break;
@@ -255,8 +256,9 @@  discard block
 block discarded – undo
255 256
             $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id());
256 257
             $my_session_list  = array();
257 258
             foreach($new_session_list as $item) {
258
-                if (!empty($item['id_session']))
259
-                    $my_session_list[] = $item['id_session'];
259
+                if (!empty($item['id_session'])) {
260
+                                    $my_session_list[] = $item['id_session'];
261
+                }
260 262
             }
261 263
             if (!in_array($session_id, $my_session_list)) {
262 264
                 break;
@@ -399,8 +401,9 @@  discard block
 block discarded – undo
399 401
             $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id());
400 402
             $my_session_list  = array();
401 403
             foreach($new_session_list as $item) {
402
-                if (!empty($item['id_session']))
403
-                    $my_session_list[] = $item['id_session'];
404
+                if (!empty($item['id_session'])) {
405
+                                    $my_session_list[] = $item['id_session'];
406
+                }
404 407
             }
405 408
             if (!in_array($session_id, $my_session_list)) {
406 409
                 break;
Please login to merge, or discard this patch.
main/inc/lib/tracking.lib.php 1 patch
Braces   +74 added lines, -31 removed lines patch added patch discarded remove patch
@@ -2387,7 +2387,9 @@  discard block
 block discarded – undo
2387 2387
             $debug = false;
2388 2388
         }
2389 2389
 
2390
-        if ($debug) echo '<h1>Tracking::get_avg_student_score</h1>';
2390
+        if ($debug) {
2391
+            echo '<h1>Tracking::get_avg_student_score</h1>';
2392
+        }
2391 2393
         $tbl_stats_exercices = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
2392 2394
         $tbl_stats_attempts = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
2393 2395
 
@@ -2464,7 +2466,9 @@  discard block
 block discarded – undo
2464 2466
                             $condition_user1 AND
2465 2467
                             session_id = $session_id
2466 2468
                         GROUP BY lp_id, user_id";
2467
-                if ($debug) echo $sql;
2469
+                if ($debug) {
2470
+                    echo $sql;
2471
+                }
2468 2472
 
2469 2473
                 $rs_last_lp_view_id = Database::query($sql);
2470 2474
 
@@ -2480,7 +2484,9 @@  discard block
 block discarded – undo
2480 2484
                         $lp_view_id = $row_lp_view['id'];
2481 2485
                         $lp_id      = $row_lp_view['lp_id'];
2482 2486
                         $user_id    = $row_lp_view['user_id'];
2483
-                        if ($debug) echo '<h2>LP id '.$lp_id.'</h2>';
2487
+                        if ($debug) {
2488
+                            echo '<h2>LP id '.$lp_id.'</h2>';
2489
+                        }
2484 2490
 
2485 2491
                         if ($get_only_latest_attempt_results) {
2486 2492
                             //Getting lp_items done by the user
@@ -2537,7 +2543,9 @@  discard block
 block discarded – undo
2537 2543
                                          lp_i.c_id  = $course_id AND
2538 2544
                                          (lp_i.item_type='sco' OR lp_i.item_type='".TOOL_QUIZ."')
2539 2545
                                       WHERE lp_view_id = $lp_view_id ";
2540
-                            if ($debug) echo $sql.'<br />';
2546
+                            if ($debug) {
2547
+                                echo $sql.'<br />';
2548
+                            }
2541 2549
                             $res_max_score = Database::query($sql);
2542 2550
 
2543 2551
                             while ($row_max_score = Database::fetch_array($res_max_score,'ASSOC')) {
@@ -2556,7 +2564,9 @@  discard block
 block discarded – undo
2556 2564
                             $max_score_item_view = $row_max_score['max_score_item_view'];
2557 2565
                             $score = $row_max_score['score'];
2558 2566
 
2559
-                            if ($debug) echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>';
2567
+                            if ($debug) {
2568
+                                echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>';
2569
+                            }
2560 2570
 
2561 2571
                             if ($row_max_score['item_type'] == 'sco') {
2562 2572
                                 /* Check if it is sco (easier to get max_score)
@@ -2576,7 +2586,9 @@  discard block
 block discarded – undo
2576 2586
                                 if (!empty($max_score)) {
2577 2587
                                     $lp_partial_total += $score/$max_score;
2578 2588
                                 }
2579
-                                if ($debug) echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />';
2589
+                                if ($debug) {
2590
+                                    echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />';
2591
+                                }
2580 2592
                             } else {
2581 2593
                                 // Case of a TOOL_QUIZ element
2582 2594
                                 $item_id = $row_max_score['iid'];
@@ -2598,12 +2610,16 @@  discard block
 block discarded – undo
2598 2610
                                         ORDER BY exe_date DESC
2599 2611
                                         LIMIT 1";
2600 2612
 
2601
-                                if ($debug) echo $sql .'<br />';
2613
+                                if ($debug) {
2614
+                                    echo $sql .'<br />';
2615
+                                }
2602 2616
                                 $result_last_attempt = Database::query($sql);
2603 2617
                                 $num = Database :: num_rows($result_last_attempt);
2604 2618
                                 if ($num > 0 ) {
2605 2619
                                     $id_last_attempt = Database :: result($result_last_attempt, 0, 0);
2606
-                                    if ($debug) echo $id_last_attempt.'<br />';
2620
+                                    if ($debug) {
2621
+                                        echo $id_last_attempt.'<br />';
2622
+                                    }
2607 2623
 
2608 2624
                                     // Within the last attempt number tracking, get the sum of
2609 2625
                                     // the max_scores of all questions that it was
@@ -2622,7 +2638,9 @@  discard block
 block discarded – undo
2622 2638
                                                     q.c_id = $course_id
2623 2639
                                             )
2624 2640
                                             AS t";
2625
-                                    if ($debug) echo '$sql: '.$sql.' <br />';
2641
+                                    if ($debug) {
2642
+                                        echo '$sql: '.$sql.' <br />';
2643
+                                    }
2626 2644
                                     $res_max_score_bis = Database::query($sql);
2627 2645
                                     $row_max_score_bis = Database::fetch_array($res_max_score_bis);
2628 2646
 
@@ -2632,7 +2650,9 @@  discard block
 block discarded – undo
2632 2650
                                     if (!empty($max_score) && floatval($max_score) > 0) {
2633 2651
                                         $lp_partial_total += $score/$max_score;
2634 2652
                                     }
2635
-                                    if ($debug) echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />';
2653
+                                    if ($debug) {
2654
+                                        echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />';
2655
+                                    }
2636 2656
                                 }
2637 2657
                             }
2638 2658
 
@@ -2645,17 +2665,25 @@  discard block
 block discarded – undo
2645 2665
                                         $count_items++;
2646 2666
                                     }
2647 2667
                                 }
2648
-                                if ($debug) echo '$count_items: '.$count_items;
2668
+                                if ($debug) {
2669
+                                    echo '$count_items: '.$count_items;
2670
+                                }
2649 2671
                             }
2650 2672
                         } //end for
2651 2673
 
2652 2674
                         $score_of_scorm_calculate += $count_items ? (($lp_partial_total / $count_items) * 100) : 0;
2653 2675
 
2654
-                        if ($debug) echo '<h3>$count_items '.$count_items.'</h3>';
2655
-                        if ($debug) echo '<h3>$score_of_scorm_calculate '.$score_of_scorm_calculate.'</h3>';
2676
+                        if ($debug) {
2677
+                            echo '<h3>$count_items '.$count_items.'</h3>';
2678
+                        }
2679
+                        if ($debug) {
2680
+                            echo '<h3>$score_of_scorm_calculate '.$score_of_scorm_calculate.'</h3>';
2681
+                        }
2656 2682
 
2657 2683
                         $global_result += $score_of_scorm_calculate;
2658
-                        if ($debug) echo '<h3>$global_result '.$global_result.'</h3>';
2684
+                        if ($debug) {
2685
+                            echo '<h3>$global_result '.$global_result.'</h3>';
2686
+                        }
2659 2687
                     } // end while
2660 2688
                 }
2661 2689
 
@@ -2668,7 +2696,9 @@  discard block
 block discarded – undo
2668 2696
                                 c_id = $course_id AND
2669 2697
                                 (item_type = 'quiz' OR item_type = 'sco') AND
2670 2698
                                 lp_id = ".$lp_id;
2671
-                    if ($debug) echo $sql;
2699
+                    if ($debug) {
2700
+                        echo $sql;
2701
+                    }
2672 2702
                     $result_have_quiz = Database::query($sql);
2673 2703
 
2674 2704
                     if (Database::num_rows($result_have_quiz) > 0 ) {
@@ -2679,19 +2709,29 @@  discard block
 block discarded – undo
2679 2709
                     }
2680 2710
                 }
2681 2711
 
2682
-                if ($debug) echo '<h3>$lp_with_quiz '.$lp_with_quiz.' </h3>';
2683
-                if ($debug) echo '<h3>Final return</h3>';
2712
+                if ($debug) {
2713
+                    echo '<h3>$lp_with_quiz '.$lp_with_quiz.' </h3>';
2714
+                }
2715
+                if ($debug) {
2716
+                    echo '<h3>Final return</h3>';
2717
+                }
2684 2718
 
2685 2719
                 if ($lp_with_quiz != 0) {
2686 2720
                     if (!$return_array) {
2687 2721
                         $score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2);
2688
-                        if ($debug) var_dump($score_of_scorm_calculate);
2722
+                        if ($debug) {
2723
+                            var_dump($score_of_scorm_calculate);
2724
+                        }
2689 2725
                         if (empty($lp_ids)) {
2690
-                            if ($debug) echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>';
2726
+                            if ($debug) {
2727
+                                echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>';
2728
+                            }
2691 2729
                         }
2692 2730
                         return $score_of_scorm_calculate;
2693 2731
                     } else {
2694
-                        if ($debug) var_dump($global_result, $lp_with_quiz);
2732
+                        if ($debug) {
2733
+                            var_dump($global_result, $lp_with_quiz);
2734
+                        }
2695 2735
                         return array($global_result, $lp_with_quiz);
2696 2736
                     }
2697 2737
                 } else {
@@ -3181,11 +3221,13 @@  discard block
 block discarded – undo
3181 3221
 
3182 3222
         if (!empty ($id_session)) {
3183 3223
             $sql .= ' WHERE session_course.session_id=' . $id_session;
3184
-            if (api_is_multiple_url_enabled())
3185
-            $sql .=  ' AND access_url_id = '.$access_url_id;
3186
-        }  else {
3187
-            if (api_is_multiple_url_enabled())
3188
-            $sql .=  ' WHERE access_url_id = '.$access_url_id;
3224
+            if (api_is_multiple_url_enabled()) {
3225
+                        $sql .=  ' AND access_url_id = '.$access_url_id;
3226
+            }
3227
+        } else {
3228
+            if (api_is_multiple_url_enabled()) {
3229
+                        $sql .=  ' WHERE access_url_id = '.$access_url_id;
3230
+            }
3189 3231
         }
3190 3232
 
3191 3233
         $result = Database::query($sql);
@@ -3297,8 +3339,7 @@  discard block
 block discarded – undo
3297 3339
                 if (empty($session['access_start_date'])
3298 3340
                 ) {
3299 3341
                     $session['status'] = get_lang('SessionActive');
3300
-                }
3301
-                else {
3342
+                } else {
3302 3343
                     $time_start = api_strtotime($session['access_start_date'], 'UTC');
3303 3344
                     $time_end = api_strtotime($session['access_end_date'], 'UTC');
3304 3345
                     if ($time_start < time() && time() < $time_end) {
@@ -6917,8 +6958,9 @@  discard block
 block discarded – undo
6917 6958
     		if (is_array($hpresults)) {
6918 6959
     			for($i = 0; $i < sizeof($hpresults); $i++) {
6919 6960
     				$title = GetQuizName($hpresults[$i][0],'');
6920
-    				if ($title == '')
6921
-    				$title = basename($hpresults[$i][0]);
6961
+    				if ($title == '') {
6962
+    				    				$title = basename($hpresults[$i][0]);
6963
+    				}
6922 6964
     				$display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get());
6923 6965
     				?>
6924 6966
                     <tr>
@@ -7290,8 +7332,9 @@  discard block
 block discarded – undo
7290 7332
     			for($i = 0; $i < sizeof($hpresults); $i++) {
7291 7333
     				$title = GetQuizName($hpresults[$i][0],'');
7292 7334
 
7293
-    				if ($title == '')
7294
-    				$title = basename($hpresults[$i][0]);
7335
+    				if ($title == '') {
7336
+    				    				$title = basename($hpresults[$i][0]);
7337
+    				}
7295 7338
 
7296 7339
     				$display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get());
7297 7340
 
Please login to merge, or discard this patch.
main/inc/lib/fileUpload.lib.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1003,7 +1003,9 @@
 block discarded – undo
1003 1003
                     if ($file != '.' && $file != '..') {
1004 1004
 
1005 1005
                         $filetype = 'file';
1006
-                        if (is_dir($base_work_dir.$upload_path.'/'.$file)) $filetype = 'folder';
1006
+                        if (is_dir($base_work_dir.$upload_path.'/'.$file)) {
1007
+                            $filetype = 'folder';
1008
+                        }
1007 1009
 
1008 1010
                         $safe_file = api_replace_dangerous_char($file);
1009 1011
                         @rename($base_work_dir.$upload_path.'/'.$file,$base_work_dir.$upload_path.'/'.$safe_file);
Please login to merge, or discard this patch.
main/inc/lib/usergroup.lib.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1933,8 +1933,9 @@
 block discarded – undo
1933 1933
                 $new_relation_type[] ="'$rel'";
1934 1934
             }
1935 1935
             $relation_type = implode(',', $new_relation_type);
1936
-            if (!empty($relation_type))
1937
-                $where_relation_condition = "AND gu.relation_type IN ($relation_type) ";
1936
+            if (!empty($relation_type)) {
1937
+                            $where_relation_condition = "AND gu.relation_type IN ($relation_type) ";
1938
+            }
1938 1939
         }
1939 1940
 
1940 1941
         $sql = "SELECT picture_uri as image, u.id, CONCAT (u.firstname,' ', u.lastname) as fullname, relation_type
Please login to merge, or discard this patch.
main/inc/lib/search/search_widget.php 1 patch
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -48,7 +48,9 @@  discard block
 block discarded – undo
48 48
 
49 49
     foreach ($sf_term_array as $raw_term) {
50 50
         $term = substr($raw_term, 1);
51
-        if (empty($term)) continue;
51
+        if (empty($term)) {
52
+            continue;
53
+        }
52 54
         $html_term = htmlspecialchars($term, ENT_QUOTES, $charset);
53 55
         $selected = '';
54 56
         if (!empty($_REQUEST['sf_'.$prefix]) && is_array($_REQUEST['sf_'.$prefix]) && in_array($term,$_REQUEST['sf_'.$prefix])) {
@@ -69,7 +71,9 @@  discard block
 block discarded – undo
69 71
     $max = count($sf_terms);
70 72
     $multiple_selects ='';
71 73
     foreach ($sf_terms as $prefix => $sf_term_array) {
72
-        if ($prefix == $prefilter_prefix) continue;
74
+        if ($prefix == $prefilter_prefix) {
75
+            continue;
76
+        }
73 77
         $multiple_select = '';
74 78
         if ($i>0) {
75 79
             //print "+" image
@@ -344,9 +348,10 @@  discard block
 block discarded – undo
344 348
 
345 349
 	// Tool introduction
346 350
     // TODO: Settings for the online editor to be checked (insert an image for example). Probably this is a special case here.
347
-    if (api_get_course_id() !== -1)
348
-    if (!empty($groupId)) {
351
+    if (api_get_course_id() !== -1) {
352
+        if (!empty($groupId)) {
349 353
         Display::display_introduction_section(TOOL_SEARCH.$groupId);
354
+    }
350 355
     } else {
351 356
         Display::display_introduction_section(TOOL_SEARCH);
352 357
     }
@@ -368,7 +373,9 @@  discard block
 block discarded – undo
368 373
                     break;
369 374
                 }
370 375
             }
371
-            if ($thesaurus_decided) break;
376
+            if ($thesaurus_decided) {
377
+                break;
378
+            }
372 379
         }
373 380
     }
374 381
 
Please login to merge, or discard this patch.
main/inc/lib/template.lib.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -603,7 +603,7 @@
 block discarded – undo
603 603
 
604 604
         if (is_file(api_get_path(SYS_CSS_PATH).'themes/'.$this->theme.'/editor.css')) {
605 605
             $css[] = api_get_path(WEB_CSS_PATH).'themes/'.$this->theme.'/editor.css';
606
-        }else{
606
+        } else{
607 607
             $css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH).'editor.css');
608 608
         }
609 609
 
Please login to merge, or discard this patch.
main/auth/shibboleth/test/shibboleth_test.class.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -207,8 +207,7 @@
 block discarded – undo
207 207
             // Dump variable for debug
208 208
             error_log(print_r(debug_backtrace(),1));
209 209
             die;
210
-        }
211
-        else
210
+        } else
212 211
         {
213 212
             $message = "Assert successful $message <br/>";
214 213
             echo $message;
Please login to merge, or discard this patch.
main/webservices/user_import/import.lib.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,8 +91,9 @@
 block discarded – undo
91 91
 
92 92
 			$user_id = UserManager :: create_user($user['FirstName'], $user['LastName'], $user['Status'], $user['Email'], $user['UserName'], $user['Password'], $user['OfficialCode'], api_get_setting('PlatformLanguage'), $user['PhoneNumber'], '', $user['AuthSource']);
93 93
 			foreach ($user['Courses'] as $index => $course) {
94
-				if(CourseManager :: course_exists($course))
95
-					CourseManager :: subscribe_user($user_id, $course,$user['Status']);
94
+				if(CourseManager :: course_exists($course)) {
95
+									CourseManager :: subscribe_user($user_id, $course,$user['Status']);
96
+				}
96 97
 			}
97 98
 
98 99
 			// TODO: Hard-coded French texts.
Please login to merge, or discard this patch.