Completed
Pull Request — 1.11.x (#1612)
by José
28:31
created
main/exercise/question.class.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -607,10 +607,11 @@
 block discarded – undo
607 607
             $current_width = $current_image_size['width'];
608 608
             $current_height = $current_image_size['height'];
609 609
 
610
-            if ($current_width < $Max && $current_height < $Max)
611
-                return true;
612
-            elseif ($current_height == "")
613
-                return false;
610
+            if ($current_width < $Max && $current_height < $Max) {
611
+                            return true;
612
+            } elseif ($current_height == "") {
613
+                            return false;
614
+            }
614 615
 
615 616
             // Resize according to height.
616 617
             if ($Dimension == "height") {
Please login to merge, or discard this patch.
main/exercise/unique_answer_no_option.class.php 1 patch
Braces   +13 added lines, -10 removed lines patch added patch discarded remove patch
@@ -146,15 +146,17 @@  discard block
 block discarded – undo
146 146
                     $list_dest = $item_list[2];
147 147
                     $url = $item_list[3];
148 148
 
149
-                    if ($try == 0)
150
-                        $try_result = 0;
151
-                    else
152
-                        $try_result = 1;
149
+                    if ($try == 0) {
150
+                                            $try_result = 0;
151
+                    } else {
152
+                                            $try_result = 1;
153
+                    }
153 154
 
154
-                    if ($url == 0)
155
-                        $url_result = '';
156
-                    else
157
-                        $url_result = $url;
155
+                    if ($url == 0) {
156
+                                            $url_result = '';
157
+                    } else {
158
+                                            $url_result = $url;
159
+                    }
158 160
 
159 161
                     $temp_scenario['url' . $i] = $url_result;
160 162
                     $temp_scenario['try' . $i] = $try_result;
@@ -343,8 +345,9 @@  discard block
 block discarded – undo
343 345
                 }
344 346
         	}
345 347
 
346
- 			if (empty($try))
347
- 				$try=0;
348
+ 			if (empty($try)) {
349
+ 			 				$try=0;
350
+ 			}
348 351
 
349 352
  			if (empty($lp)) {
350 353
  				$lp=0;
Please login to merge, or discard this patch.
main/exercise/hotspot_lang_conversion.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,10 +18,11 @@
 block discarded – undo
18 18
 	$lang = urldecode($_GET['lang']);
19 19
 	if (preg_match('/^[a-zA-Z0-9\._-]+$/', $lang)) {
20 20
 		//$lang = str_replace($search,$replace,urldecode($_GET['lang']));
21
-		if(file_exists($hotspot_lang_file . $lang . '/hotspot.inc.php'))
22
-			$hotspot_lang_file .= $lang . '/hotspot.inc.php';
23
-		else
24
-			$hotspot_lang_file .= 'english/hotspot.inc.php';
21
+		if(file_exists($hotspot_lang_file . $lang . '/hotspot.inc.php')) {
22
+					$hotspot_lang_file .= $lang . '/hotspot.inc.php';
23
+		} else {
24
+					$hotspot_lang_file .= 'english/hotspot.inc.php';
25
+		}
25 26
 	} else {
26 27
 		$hotspot_lang_file .= 'english/hotspot.inc.php';
27 28
 	}
Please login to merge, or discard this patch.
main/exercise/exercise_report.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -400,8 +400,9 @@
 block discarded – undo
400 400
 $extra .= $form->return_form();
401 401
 $extra .= '</div>';
402 402
 
403
-if ($is_allowedToEdit)
403
+if ($is_allowedToEdit) {
404 404
     echo $extra;
405
+}
405 406
 
406 407
 echo $actions;
407 408
 
Please login to merge, or discard this patch.
main/exercise/export/aiken/aiken_import.inc.php 1 patch
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,8 +10,9 @@  discard block
 block discarded – undo
10 10
 /**
11 11
  * Security check
12 12
  */
13
-if (count(get_included_files()) == 1)
13
+if (count(get_included_files()) == 1) {
14 14
     die('---');
15
+}
15 16
 
16 17
 /**
17 18
  * Creates a temporary directory
@@ -21,8 +22,9 @@  discard block
 block discarded – undo
21 22
  * @return string
22 23
  */
23 24
 function tempdir($dir, $prefix = 'tmp', $mode = 0777) {
24
-    if (substr($dir, -1) != '/')
25
-        $dir .= '/';
25
+    if (substr($dir, -1) != '/') {
26
+            $dir .= '/';
27
+    }
26 28
 
27 29
     do {
28 30
         $path = $dir . $prefix . mt_rand(0, 9999999);
Please login to merge, or discard this patch.
main/exercise/export/qti2/qti2_classes.php 1 patch
Braces   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,11 @@
 block discarded – undo
104 104
     {
105 105
 		$this->answerList = $this->getAnswersList(true);
106 106
 		$type = $this->getQuestionType();
107
-        if ($type == MCMA)  $cardinality = 'multiple'; else $cardinality = 'single';
107
+        if ($type == MCMA) {
108
+            $cardinality = 'multiple';
109
+        } else {
110
+            $cardinality = 'single';
111
+        }
108 112
 
109 113
         $out = '  <responseDeclaration identifier="' . $questionIdent . '" cardinality="' . $cardinality . '" baseType="identifier">' . "\n";
110 114
 
Please login to merge, or discard this patch.
main/exercise/exercise_submit.php 1 patch
Braces   +32 added lines, -12 removed lines patch added patch discarded remove patch
@@ -269,7 +269,9 @@  discard block
 block discarded – undo
269 269
 $clock_expired_time = null;
270 270
 
271 271
 if (empty($exercise_stat_info)) {
272
-    if ($debug)  error_log('5  $exercise_stat_info is empty ');
272
+    if ($debug) {
273
+        error_log('5  $exercise_stat_info is empty ');
274
+    }
273 275
 	$total_weight = 0;
274 276
 	$questionList = $objExercise->get_validated_question_list();
275 277
 	foreach ($questionListUncompressed as $question_id) {
@@ -280,11 +282,17 @@  discard block
 block discarded – undo
280 282
 	if ($time_control) {
281 283
 		$expected_time = $current_timestamp + $total_seconds;
282 284
 
283
-		if ($debug)  error_log('5.1. $current_timestamp '.$current_timestamp);
284
-		if ($debug)  error_log('5.2. $expected_time '.$expected_time);
285
+		if ($debug) {
286
+		    error_log('5.1. $current_timestamp '.$current_timestamp);
287
+		}
288
+		if ($debug) {
289
+		    error_log('5.2. $expected_time '.$expected_time);
290
+		}
285 291
 
286 292
 		$clock_expired_time 	= api_get_utc_datetime($expected_time);
287
-		if ($debug) error_log('5.3. $expected_time '.$clock_expired_time);
293
+		if ($debug) {
294
+		    error_log('5.3. $expected_time '.$clock_expired_time);
295
+		}
288 296
 
289 297
 		//Sessions  that contain the expired time
290 298
 		$_SESSION['expired_time'][$current_expired_time_key] 	 = $clock_expired_time;
@@ -304,8 +312,10 @@  discard block
 block discarded – undo
304 312
         $learnpath_item_id,
305 313
         $learnpath_item_view_id
306 314
     );
307
-    if ($debug)  error_log("5.5  exercise_stat_info[] exists getting exe_id $exe_id");
308
-} else {
315
+    if ($debug) {
316
+        error_log("5.5  exercise_stat_info[] exists getting exe_id $exe_id");
317
+    }
318
+    } else {
309 319
 	$exe_id = $exercise_stat_info['exe_id'];
310 320
     // Remember last question id position.
311 321
     $isFirstTime = Session::read('firstTime');
@@ -327,8 +337,10 @@  discard block
 block discarded – undo
327 337
         }
328 338
     }
329 339
 
330
-    if ($debug)  error_log("5  exercise_stat_info[] exists getting exe_id $exe_id ");
331
-}
340
+    if ($debug) {
341
+        error_log("5  exercise_stat_info[] exists getting exe_id $exe_id ");
342
+    }
343
+    }
332 344
 
333 345
 $questionListInSession = Session::read('questionList');
334 346
 
@@ -384,9 +396,15 @@  discard block
 block discarded – undo
384 396
  * If the expired time is major that zero(0) then the expired time is compute on this time.
385 397
  */
386 398
 if ($time_control) {
387
-	if ($debug) error_log('7.1. Time control is enabled');
388
-	if ($debug) error_log('7.2. $current_expired_time_key  '.$current_expired_time_key);
389
-	if ($debug) error_log('7.3. $_SESSION[expired_time][$current_expired_time_key]  '.$_SESSION['expired_time'][$current_expired_time_key]);
399
+	if ($debug) {
400
+	    error_log('7.1. Time control is enabled');
401
+	}
402
+	if ($debug) {
403
+	    error_log('7.2. $current_expired_time_key  '.$current_expired_time_key);
404
+	}
405
+	if ($debug) {
406
+	    error_log('7.3. $_SESSION[expired_time][$current_expired_time_key]  '.$_SESSION['expired_time'][$current_expired_time_key]);
407
+	}
390 408
 
391 409
     if (!isset($_SESSION['expired_time'][$current_expired_time_key])) {
392 410
         //Timer - Get expired_time for a student
@@ -473,7 +491,9 @@  discard block
 block discarded – undo
473 491
 	}
474 492
 }
475 493
 
476
-if ($debug) error_log('8. Question list loaded '.print_r($questionList, 1));
494
+if ($debug) {
495
+    error_log('8. Question list loaded '.print_r($questionList, 1));
496
+}
477 497
 
478 498
 //Real question count
479 499
 $question_count = 0;
Please login to merge, or discard this patch.
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.