Completed
Pull Request — 1.11.x (#1285)
by José
43:07
created
main/exercise/exercise_admin.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -171,10 +171,11 @@
 block discarded – undo
171 171
     }
172 172
     echo '</div>';
173 173
 
174
-    if ($objExercise->feedback_type == 1)
175
-        Display::display_normal_message(
174
+    if ($objExercise->feedback_type == 1) {
175
+            Display::display_normal_message(
176 176
             get_lang('DirectFeedbackCantModifyTypeQuestion')
177 177
         );
178
+    }
178 179
 
179 180
     if (api_get_setting('search_enabled')=='true' && !extension_loaded('xapian')) {
180 181
         Display::display_error_message(get_lang('SearchXapianModuleNotInstalled'));
Please login to merge, or discard this patch.
main/lp/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/lp/aicc.class.php 1 patch
Braces   +24 added lines, -15 removed lines patch added patch discarded remove patch
@@ -459,11 +459,12 @@  discard block
 block discarded – undo
459 459
             }
460 460
         }
461 461
 
462
-        if ($package_type == '' || !$mandatory)
463
-        // && defined('CHECK_FOR_AICC') && CHECK_FOR_AICC)
462
+        if ($package_type == '' || !$mandatory) {
463
+                // && defined('CHECK_FOR_AICC') && CHECK_FOR_AICC)
464 464
         {
465 465
             return api_failure::set_failure('not_aicc_content');
466 466
         }
467
+        }
467 468
 
468 469
         if (!enough_size($realFileSize, $course_sys_dir, $maxFilledSpace)) {
469 470
             return api_failure::set_failure('not_enough_space');
@@ -511,7 +512,9 @@  discard block
 block discarded – undo
511 512
                     if ($file != '.' && $file != '..') {
512 513
                         $filetype = 'file';
513 514
 
514
-                        if (is_dir($course_sys_dir.$new_dir.$file)) $filetype = 'folder';
515
+                        if (is_dir($course_sys_dir.$new_dir.$file)) {
516
+                            $filetype = 'folder';
517
+                        }
515 518
 
516 519
                         // TODO: RENAMING FILES CAN BE VERY DANGEROUS AICC-WISE, avoid that as much as possible!
517 520
                         //$safe_file = api_replace_dangerous_char($file, 'strict');
@@ -910,37 +913,43 @@  discard block
 block discarded – undo
910 913
                     if ($enclosed && $data{$i+1} == $enclosure) {
911 914
                         $fldval .= $chr;
912 915
                         ++$i; // Skip the next character.
913
-                    } else
914
-                        $enclosed = !$enclosed;
916
+                    } else {
917
+                                            $enclosed = !$enclosed;
918
+                    }
915 919
                     break;
916 920
                 case $delim:
917 921
                     if (!$enclosed) {
918 922
                         $ret_array[$linecount][$fldcount++] = $fldval;
919 923
                         $fldval = '';
920
-                    } else
921
-                        $fldval .= $chr;
924
+                    } else {
925
+                                            $fldval .= $chr;
926
+                    }
922 927
                     break;
923 928
                 case "\r":
924
-                    if (!$enclosed&&$data{$i+1} == "\n")
925
-                        continue;
929
+                    if (!$enclosed&&$data{$i+1} == "\n") {
930
+                                            continue;
931
+                    }
926 932
                 case "\n":
927 933
                     if (!$enclosed) {
928 934
                         $ret_array[$linecount++][$fldcount] = $fldval;
929 935
                         $fldcount = 0;
930 936
                         $fldval = '';
931
-                    } else
932
-                        $fldval .= $chr;
937
+                    } else {
938
+                                            $fldval .= $chr;
939
+                    }
933 940
                     break;
934 941
                 case "\\r":
935
-                    if (!$enclosed&&$data{$i+1} == "\\n")
936
-                        continue;
942
+                    if (!$enclosed&&$data{$i+1} == "\\n") {
943
+                                            continue;
944
+                    }
937 945
                 case "\\n":
938 946
                     if (!$enclosed) {
939 947
                         $ret_array[$linecount++][$fldcount] = $fldval;
940 948
                         $fldcount = 0;
941 949
                         $fldval = '';
942
-                    } else
943
-                        $fldval .= $chr;
950
+                    } else {
951
+                                            $fldval .= $chr;
952
+                    }
944 953
                     break;
945 954
                 default:
946 955
                     $fldval .= $chr;
Please login to merge, or discard this patch.
main/lp/openoffice_text.class.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,8 +119,9 @@
 block discarded – undo
119 119
 
120 120
         for ($i = 0; $i<count($matches[0]); $i++) {
121 121
 
122
-            if (empty($matches[1][$i]))
123
-                continue;
122
+            if (empty($matches[1][$i])) {
123
+                            continue;
124
+            }
124 125
 
125 126
             $content = api_strstr($content, $matches[0][$i]);
126 127
             if ($i + 1 !== count($matches[0])) {
Please login to merge, or discard this patch.
main/lp/resourcelinker.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -341,8 +341,7 @@
 block discarded – undo
341 341
         case '1': // coming from Agenda
342 342
             if ($action == 'edit') {
343 343
                 $url = "../calendar/agenda.php?action=edit&id=49&originalresource=$originalresource";
344
-            }
345
-            elseif ($action == 'add') {
344
+            } elseif ($action == 'add') {
346 345
                 $url = "../calendar/agenda.php?action=add&originalresource=$originalresource";
347 346
             } else {
348 347
                 $url = "../calendar/agenda.php?action=add";
Please login to merge, or discard this patch.
main/lp/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/lp/openoffice_text_document.class.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,8 +119,9 @@
 block discarded – undo
119 119
 
120 120
         for ($i = 0; $i<count($matches[0]); $i++) {
121 121
 
122
-            if (empty($matches[1][$i]))
123
-                continue;
122
+            if (empty($matches[1][$i])) {
123
+                            continue;
124
+            }
124 125
 
125 126
             $content = api_strstr($content, $matches[0][$i]);
126 127
             if ($i + 1 !== count($matches[0])) {
Please login to merge, or discard this patch.
main/lp/resourcelinker.inc.php 1 patch
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -337,9 +337,14 @@  discard block
 block discarded – undo
337 337
 
338 338
     $length = ((($builder == 'builder') && ($icon == 'nolink')) ? 65 : 32);
339 339
 
340
-    if ($builder != 'builder') $origin = 'learnpath'; //origin = learnpath in student view
340
+    if ($builder != 'builder') {
341
+        $origin = 'learnpath';
342
+    }
343
+    //origin = learnpath in student view
341 344
     $linktype = $type;
342
-    if (($type == 'Link _self') or ($type == 'Link _blank')) $type = 'Link';
345
+    if (($type == 'Link _self') or ($type == 'Link _blank')) {
346
+        $type = 'Link';
347
+    }
343 348
 
344 349
     // YW switched litteral tool names to use of constants declared in main_api.lib.php
345 350
     switch ($type) {
@@ -1371,11 +1376,12 @@  discard block
 block discarded – undo
1371 1376
             WHERE c_id = $course_id AND source_type='$type' and source_id='$id'";
1372 1377
     $result = Database::query($sql);
1373 1378
     $number_added = Database::num_rows($result);
1374
-    if ($number_added != 0)
1375
-        return true;
1376
-    else
1377
-        return false;
1378
-}
1379
+    if ($number_added != 0) {
1380
+            return true;
1381
+    } else {
1382
+            return false;
1383
+    }
1384
+    }
1379 1385
 
1380 1386
 /**
1381 1387
  * This function is to load the resources that were added to a specific item
@@ -1496,8 +1502,7 @@  discard block
 block discarded – undo
1496 1502
             next($addedresource);
1497 1503
         }
1498 1504
         echo '</table>';
1499
-    }
1500
-    else { // it is a string
1505
+    } else { // it is a string
1501 1506
         echo '';
1502 1507
     }
1503 1508
 } // end of the display_resources function
@@ -1533,8 +1538,7 @@  discard block
 block discarded – undo
1533 1538
                 echo "<a href='".api_get_self()."?content=".$type."&source_forum=".$_GET['source_forum']."&add=".$id."&source_id=$source_id&action=$action&lp_id=$learningPathId&parent_item_id=$chapter_id&originalresource=no&target=$target'>".$lang_add_it_or_resource."</a>";
1534 1539
             }
1535 1540
         }
1536
-    }
1537
-    else { // if it is not an array, it is a string
1541
+    } else { // if it is not an array, it is a string
1538 1542
         if ($_SESSION['addedresource'] !== $type || $_SESSION['addedresourceid'] !== $id) {
1539 1543
             if ($from_learnpath) { $lang_add_it_or_resource = get_lang('AddIt'); } else { $lang_add_it_or_resource = get_lang('AddResource'); }
1540 1544
             echo "<a href='".api_get_self()."?content=".$type."&folder=".$folder."&source_forum=".$_GET['source_forum']."&add=".$id."&source_id=$source_id&action=$action&lp_id=$learningPathId&parent_item_id=$chapter_id&originalresource=no&target=$target'>".$lang_add_it_or_resource."</a>";
@@ -1561,7 +1565,9 @@  discard block
 block discarded – undo
1561 1565
     $course_id = api_get_course_int_id();
1562 1566
 
1563 1567
     // Styling the link of the added resource
1564
-    if ($style != '') $styling = ' class="'.$style.'"';
1568
+    if ($style != '') {
1569
+        $styling = ' class="'.$style.'"';
1570
+    }
1565 1571
     if ($new_window) { $target = ' target = "_blank" '; } else { $target = ' target = "_self" '; }
1566 1572
 
1567 1573
     $output = '';
Please login to merge, or discard this patch.
main/session/add_courses_to_session.php 1 patch
Braces   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -207,7 +207,10 @@  discard block
 block discarded – undo
207 207
 
208 208
 unset($Courses);
209 209
 ?>
210
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $sessionId; ?><?php if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>>
210
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $sessionId; ?><?php if(!empty($_GET['add'])) {
211
+    echo '&add=true' ;
212
+}
213
+?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>>
211 214
     <legend><?php echo $tool_name.' ('.$session_info['name'].')'; ?></legend>
212 215
     <input type="hidden" name="formSent" value="1" />
213 216
 
@@ -230,7 +233,10 @@  discard block
 block discarded – undo
230 233
                 <div id="ajax_list_courses_multiple">
231 234
                     <select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" class="form-control">
232 235
                         <?php foreach ($nosessionCourses as $enreg) { ?>
233
-                            <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')',ENT_QUOTES).'"'; if(in_array($enreg['code'],$CourseList)) echo 'selected="selected"'; ?>>
236
+                            <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')',ENT_QUOTES).'"'; if(in_array($enreg['code'],$CourseList)) {
237
+    echo 'selected="selected"';
238
+}
239
+?>>
234 240
                                 <?php echo $enreg['title'].' ('.$enreg['visual_code'].')'; ?>
235 241
                             </option>
236 242
                         <?php } ?>
Please login to merge, or discard this patch.