Passed
Push — 1.10.x ( aa45ad...6deddd )
by Yannick
44:37
created
main/inc/lib/geometry.lib.php 1 patch
Braces   +49 added lines, -28 removed lines patch added patch discarded remove patch
@@ -65,8 +65,10 @@  discard block
 block discarded – undo
65 65
     $bords = array_fill(0, $bord_lenght, array()); // building this array
66 66
 
67 67
     /* adding the first point of the polygone */
68
-    if (is_array($bords[$poly[0]['y']])) //avoid warning
68
+    if (is_array($bords[$poly[0]['y']])) {
69
+        //avoid warning
69 70
     	array_push($bords[$poly[0]['y']], $poly[0]['x']);
71
+    }
70 72
 
71 73
     $i = 1; // we re-use $i and $old_pente bellow the loop
72 74
     $old_pente=0;
@@ -75,11 +77,14 @@  discard block
 block discarded – undo
75 77
 
76 78
         /* special cases */
77 79
         if ($poly[$i-1]['y'] == $poly[$i]['y']) {
78
-            if ($poly[$i-1]['x'] == $poly[$i]['x'])
79
-                continue; // twice the same point
80
+            if ($poly[$i-1]['x'] == $poly[$i]['x']) {
81
+                            continue;
82
+            }
83
+            // twice the same point
80 84
             else {    //  infinite elevation of the edge
81
-            	if (is_array($bords[$poly[$i]['y']]))
82
-                	array_push($bords[$poly[$i]['y']],$poly[$i]['x']);
85
+            	if (is_array($bords[$poly[$i]['y']])) {
86
+            	                	array_push($bords[$poly[$i]['y']],$poly[$i]['x']);
87
+            	}
83 88
                 $old_pente=0;
84 89
                 continue;
85 90
             }
@@ -87,9 +92,13 @@  discard block
 block discarded – undo
87 92
 
88 93
 		//echo 'point:'.$poly[$i]['y']; bug here
89 94
         // adding the point as a part of an edge
90
-        if (is_array($bords[$poly[$i]['y']])) //avoid warning
95
+        if (is_array($bords[$poly[$i]['y']])) {
96
+            //avoid warning
91 97
         array_push($bords[$poly[$i]['y']], $poly[$i]['x']);
92
-        if (DEBUG) echo '('.$poly[$i]['x'].';'.$poly[$i]['y'].')   ';
98
+        }
99
+        if (DEBUG) {
100
+            echo '('.$poly[$i]['x'].';'.$poly[$i]['y'].')   ';
101
+        }
93 102
 
94 103
         /* computing the elevation of the edge going */
95 104
         //        from $poly[$i-1] to $poly[$i]
@@ -99,15 +108,17 @@  discard block
 block discarded – undo
99 108
         // if the sign of the elevation change from the one of the
100 109
         // previous edge, the point must be added a second time inside
101 110
         // $bords
102
-        if ($i>1)
103
-            if (($old_pente<0 && $pente>0)
111
+        if ($i>1) {
112
+                    if (($old_pente<0 && $pente>0)
104 113
                     || ($old_pente>0 && $pente<0)) {
105 114
 				if (is_array($bords[$poly[$i]['y']])) //avoid warning
106 115
                 	array_push($bords[$poly[$i]['y']],$poly[$i]['x']);
116
+        }
107 117
 
108
-                if (DEBUG)
109
-                    echo '*('.$poly[$i]['x'].
118
+                if (DEBUG) {
119
+                                    echo '*('.$poly[$i]['x'].
110 120
                         ';'.$poly[$i]['y'].')   ';
121
+                }
111 122
         	}
112 123
 
113 124
         /* detect the direction of the elevation in Y */
@@ -136,10 +147,11 @@  discard block
 block discarded – undo
136 147
 
137 148
         // elevation between $poly[0]['x'] and $poly[1]['x'])
138 149
         $rest = $poly[0]['y']-$poly[1]['y'];
139
-        if ($rest!=0)
140
-        	$pente1 = ($poly[0]['x']-$poly[1]['x'])/($rest);
141
-        else
142
-			$pente1 = 0;
150
+        if ($rest!=0) {
151
+                	$pente1 = ($poly[0]['x']-$poly[1]['x'])/($rest);
152
+        } else {
153
+        			$pente1 = 0;
154
+        }
143 155
 
144 156
         // elevation between $poly[$i-1]['x'] and $poly[0]['x'])
145 157
         $pente = ($poly[$i-1]['x']-$poly[0]['x'])/
@@ -151,14 +163,17 @@  discard block
 block discarded – undo
151 163
 
152 164
         // doubling the first point if needed (see above)
153 165
         if (($pente1<0 && $pente>0) || ($pente1>0 && $pente<0)) {
154
-        	if (is_array($bords[$poly[$i - 1]['y']]))
155
-            	array_push($bords[$poly[$i - 1]['y']],  round($poly[$i - 1]['x']));
166
+        	if (is_array($bords[$poly[$i - 1]['y']])) {
167
+        	            	array_push($bords[$poly[$i - 1]['y']],  round($poly[$i - 1]['x']));
168
+        	}
156 169
             //if (DEBUG) echo '('.$poly[$i-1]['x'].';'.$poly[$i-1]['y'].')   ';
157 170
         }
158 171
         //  doubling the last point if neededd
159 172
         if (($old_pente<0 && $pente>0) || ($old_pente>0 && $pente<0)) {
160
-        	if (is_array($bords[$poly[$i-1]['y']])) //avoid warning
173
+        	if (is_array($bords[$poly[$i-1]['y']])) {
174
+        	    //avoid warning
161 175
             	array_push($bords[$poly[$i-1]['y']], round($poly[$i-1]['x']));
176
+        	}
162 177
             //if (DEBUG) echo '*('.$poly[$i-1]['x'].';'.$poly[$i-1]['y'].')   ';
163 178
         }
164 179
 
@@ -227,11 +242,13 @@  discard block
 block discarded – undo
227 242
         $s = "<div style='font-size: 8px; line-height:3px'><pre>\n";
228 243
     }
229 244
     for ($i=0; $i<$max['y']; $i++) {
230
-        for($j=0; $j<$max['x']; $j++)
231
-            if($poly[$j][$i] == TRUE)
245
+        for($j=0; $j<$max['x']; $j++) {
246
+                    if($poly[$j][$i] == TRUE)
232 247
                 $s .= ($format=='html'?"<b>1</b>":'1');
233
-            else
234
-                $s .= "0";
248
+        }
249
+            else {
250
+                            $s .= "0";
251
+            }
235 252
         $s .= ($format=='html'?"<br />\n":"\n");
236 253
     }
237 254
     $s .= ($format=='html'?"</pre></div>\n":"\n");
@@ -252,15 +269,19 @@  discard block
 block discarded – undo
252 269
     $surfaceOf1 = 0;
253 270
     $surfaceOf2 = 0;
254 271
 
255
-    for ($i=0; $i<$max['x']; $i++)
256
-        for($j=0; $j<$max['y']; $j++) {
272
+    for ($i=0; $i<$max['x']; $i++) {
273
+            for($j=0;
274
+    }
275
+    $j<$max['y']; $j++) {
257 276
             if (isset($poly1[$i][$j]) && ($poly1[$i][$j] == TRUE)) {
258 277
                 $surfaceOf1++;
259
-                if (isset($poly2[$i][$j]) && ($poly2[$i][$j] == FALSE))
260
-                    $onlyIn1++;
278
+                if (isset($poly2[$i][$j]) && ($poly2[$i][$j] == FALSE)) {
279
+                                    $onlyIn1++;
280
+                }
281
+            }
282
+            if (isset($poly2[$i][$j]) && ($poly2[$i][$j] == TRUE)) {
283
+                            $surfaceOf2++;
261 284
             }
262
-            if (isset($poly2[$i][$j]) && ($poly2[$i][$j] == TRUE))
263
-                $surfaceOf2++;
264 285
         }
265 286
 
266 287
     return array (
Please login to merge, or discard this patch.
main/reports/templates/exercicesMultiCourses.reports.php 1 patch
Braces   +17 added lines, -10 removed lines patch added patch discarded remove patch
@@ -41,28 +41,35 @@
 block discarded – undo
41 41
 		'where r.course_id=c.id and r.tool_id='.
42 42
 		reports_getToolId(TOOL_QUIZ).
43 43
 		' order by r.course_id, r.child_name');
44
-	if (Database::num_rows($columns) == 0)
45
-		die('<b>'.get_lang('no data found').'</b>');
44
+	if (Database::num_rows($columns) == 0) {
45
+			die('<b>'.get_lang('no data found').'</b>');
46
+	}
46 47
 	$query = 'select u.lastname Name, u.firstname Firstname';
47 48
 	$columns = Database::store_result($columns);
48
-	if ($_REQUEST['tattempt'] == 'min' || $_REQUEST['tattempt'] == 'max')
49
-		$function = $_REQUEST['tattempt'];
50
-	else
51
-		$function = 'avg';
52
-	foreach ($columns as $key => $column)
53
-		$query .= ', '.$function.'(k'.$key.'.score) as `'.
49
+	if ($_REQUEST['tattempt'] == 'min' || $_REQUEST['tattempt'] == 'max') {
50
+			$function = $_REQUEST['tattempt'];
51
+	} else {
52
+			$function = 'avg';
53
+	}
54
+	foreach ($columns as $key => $column) {
55
+			$query .= ', '.$function.'(k'.$key.'.score) as `'.
54 56
 				$column['course'].' - '.
55 57
 				$column['test'].'` ';
58
+	}
56 59
 	$query .= ' from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
57
-	foreach ($columns as $key => $column) // fixme sessions
60
+	foreach ($columns as $key => $column) {
61
+	    // fixme sessions
58 62
 		$query .= 'left outer join '.
59 63
 			Database::get_main_table(TABLE_MAIN_REPORTS_VALUES).
60 64
 			' k'.$key.
61 65
 			' on k'.$key.'.key_id = '.$column['kid'].
62 66
 				' and k'.$key.'.user_id = u.user_id ';
67
+	}
63 68
 	$query .= ' group by ';
64
-	foreach ($columns as $key => $column) // grouping attempt
69
+	foreach ($columns as $key => $column) {
70
+	    // grouping attempt
65 71
 		$query .= 'k'.$key.'.attempt, ';
72
+	}
66 73
 	$query = substr($query, 0, -2); // removing last ', ';
67 74
 
68 75
 
Please login to merge, or discard this patch.
main/inc/lib/blog.lib.php 1 patch
Braces   +26 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1009,8 +1009,9 @@  discard block
 block discarded – undo
1009 1009
             $blog_post_actions .= '</a>';
1010 1010
         }
1011 1011
 
1012
-		if (api_is_allowed('BLOG_' . $blog_id, 'article_rate'))
1013
-			$rating_select = Blog::display_rating_form('post',$blog_id,$post_id);
1012
+		if (api_is_allowed('BLOG_' . $blog_id, 'article_rate')) {
1013
+					$rating_select = Blog::display_rating_form('post',$blog_id,$post_id);
1014
+		}
1014 1015
 
1015 1016
 		$blog_post_text=stripslashes($blog_post_text);
1016 1017
 
@@ -1654,8 +1655,9 @@  discard block
 block discarded – undo
1654 1655
 
1655 1656
 						$arrPermissions = array();
1656 1657
 
1657
-						while ($row = Database::fetch_array($result))
1658
-							$arrPermissions[] = $row['action'];
1658
+						while ($row = Database::fetch_array($result)) {
1659
+													$arrPermissions[] = $row['action'];
1660
+						}
1659 1661
 
1660 1662
 						    echo '<tr>';
1661 1663
 							echo '<td style="text-align:right; vertical-align:top;">' . get_lang('TaskManager') . ':&nbsp;&nbsp;</td>';
@@ -2332,8 +2334,9 @@  discard block
 block discarded – undo
2332 2334
 		//Handle leap year
2333 2335
 		$numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
2334 2336
 
2335
-		if(($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0))
2336
-			$numberofdays[2] = 29;
2337
+		if(($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) {
2338
+					$numberofdays[2] = 29;
2339
+		}
2337 2340
 
2338 2341
 		//Get the first day of the month
2339 2342
 		$dayone = getdate(mktime(0, 0, 0, $month, 1, $year));
@@ -2363,8 +2366,9 @@  discard block
 block discarded – undo
2363 2366
 		if( Database::num_rows($result) > 0) {
2364 2367
 			while($blog_post = Database::fetch_array($result)) {
2365 2368
 				// If the day of this post is not yet in the array, add it.
2366
-				if (!in_array($blog_post['post_day'], $posts))
2367
-					$posts[] = $blog_post['post_day'];
2369
+				if (!in_array($blog_post['post_day'], $posts)) {
2370
+									$posts[] = $blog_post['post_day'];
2371
+				}
2368 2372
 			}
2369 2373
 		}
2370 2374
 
@@ -2403,8 +2407,9 @@  discard block
 block discarded – undo
2403 2407
 
2404 2408
 		echo "<tr>\n";
2405 2409
 
2406
-		for($ii = 1; $ii < 8; $ii ++)
2407
-			echo "<td class=\"weekdays\">", $DaysShort[$ii % 7], "</td>";
2410
+		for($ii = 1; $ii < 8; $ii ++) {
2411
+					echo "<td class=\"weekdays\">", $DaysShort[$ii % 7], "</td>";
2412
+		}
2408 2413
 
2409 2414
 		echo "</tr>";
2410 2415
 
@@ -2414,8 +2419,9 @@  discard block
 block discarded – undo
2414 2419
 		while ($curday <= $numberofdays[$month]) {
2415 2420
 			echo "<tr>";
2416 2421
 			for ($ii = 0; $ii < 7; $ii ++) {
2417
-				if (($curday == -1) && ($ii == $startdayofweek))
2418
-					$curday = 1;
2422
+				if (($curday == -1) && ($ii == $startdayofweek)) {
2423
+									$curday = 1;
2424
+				}
2419 2425
 
2420 2426
 			 	if (($curday > 0) && ($curday <= $numberofdays[$month])) {
2421 2427
 					$bgcolor = $ii < 5 ? $class="class=\"days_week\"" : $class="class=\"days_weekend\"";
@@ -2429,10 +2435,11 @@  discard block
 block discarded – undo
2429 2435
 					echo "<td " . $class.">";
2430 2436
 
2431 2437
 					// If there are posts on this day, create a filter link.
2432
-					if(in_array($curday, $posts))
2433
-						echo '<a href="blog.php?blog_id=' . $blog_id . '&filter=' . $year . '-' . $month . '-' . $curday . '&month=' . $month . '&year=' . $year . '" title="' . get_lang('ViewPostsOfThisDay') . '">' . $curday . '</a>';
2434
-					else
2435
-						echo $dayheader;
2438
+					if(in_array($curday, $posts)) {
2439
+											echo '<a href="blog.php?blog_id=' . $blog_id . '&filter=' . $year . '-' . $month . '-' . $curday . '&month=' . $month . '&year=' . $year . '" title="' . get_lang('ViewPostsOfThisDay') . '">' . $curday . '</a>';
2440
+					} else {
2441
+											echo $dayheader;
2442
+					}
2436 2443
 
2437 2444
 					if (count($tasks) > 0) {
2438 2445
 						if (isset($tasks[$curday]) && is_array($tasks[$curday])) {
@@ -2446,8 +2453,9 @@  discard block
 block discarded – undo
2446 2453
 
2447 2454
 					echo "</td>";
2448 2455
 					$curday ++;
2449
-				} else
2450
-					echo "<td>&nbsp;</td>";
2456
+				} else {
2457
+									echo "<td>&nbsp;</td>";
2458
+				}
2451 2459
 			}
2452 2460
 			echo "</tr>";
2453 2461
 		}
Please login to merge, or discard this patch.
main/inc/lib/browser/Browser.php 1 patch
Braces   +16 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1152,68 +1152,52 @@
 block discarded – undo
1152 1152
         if (stripos($this->_agent, 'windows') !== false)
1153 1153
         {
1154 1154
             $this->_platform = self::PLATFORM_WINDOWS;
1155
-        }
1156
-        else if (stripos($this->_agent, 'iPad') !== false)
1155
+        } else if (stripos($this->_agent, 'iPad') !== false)
1157 1156
         {
1158 1157
             $this->_platform = self::PLATFORM_IPAD;
1159
-        }
1160
-        else if (stripos($this->_agent, 'iPod') !== false)
1158
+        } else if (stripos($this->_agent, 'iPod') !== false)
1161 1159
         {
1162 1160
             $this->_platform = self::PLATFORM_IPOD;
1163
-        }
1164
-        else if (stripos($this->_agent, 'iPhone') !== false)
1161
+        } else if (stripos($this->_agent, 'iPhone') !== false)
1165 1162
         {
1166 1163
             $this->_platform = self::PLATFORM_IPHONE;
1167
-        }
1168
-        elseif (stripos($this->_agent, 'mac') !== false)
1164
+        } elseif (stripos($this->_agent, 'mac') !== false)
1169 1165
         {
1170 1166
             $this->_platform = self::PLATFORM_APPLE;
1171
-        }
1172
-        elseif (stripos($this->_agent, 'android') !== false)
1167
+        } elseif (stripos($this->_agent, 'android') !== false)
1173 1168
         {
1174 1169
             $this->_platform = self::PLATFORM_ANDROID;
1175
-        }
1176
-        elseif (stripos($this->_agent, 'linux') !== false)
1170
+        } elseif (stripos($this->_agent, 'linux') !== false)
1177 1171
         {
1178 1172
             $this->_platform = self::PLATFORM_LINUX;
1179
-        }
1180
-        else if (stripos($this->_agent, 'Nokia') !== false)
1173
+        } else if (stripos($this->_agent, 'Nokia') !== false)
1181 1174
         {
1182 1175
             $this->_platform = self::PLATFORM_NOKIA;
1183
-        }
1184
-        else if (stripos($this->_agent, 'BlackBerry') !== false)
1176
+        } else if (stripos($this->_agent, 'BlackBerry') !== false)
1185 1177
         {
1186 1178
             $this->_platform = self::PLATFORM_BLACKBERRY;
1187
-        }
1188
-        elseif (stripos($this->_agent, 'FreeBSD') !== false)
1179
+        } elseif (stripos($this->_agent, 'FreeBSD') !== false)
1189 1180
         {
1190 1181
             $this->_platform = self::PLATFORM_FREEBSD;
1191
-        }
1192
-        elseif (stripos($this->_agent, 'OpenBSD') !== false)
1182
+        } elseif (stripos($this->_agent, 'OpenBSD') !== false)
1193 1183
         {
1194 1184
             $this->_platform = self::PLATFORM_OPENBSD;
1195
-        }
1196
-        elseif (stripos($this->_agent, 'NetBSD') !== false)
1185
+        } elseif (stripos($this->_agent, 'NetBSD') !== false)
1197 1186
         {
1198 1187
             $this->_platform = self::PLATFORM_NETBSD;
1199
-        }
1200
-        elseif (stripos($this->_agent, 'OpenSolaris') !== false)
1188
+        } elseif (stripos($this->_agent, 'OpenSolaris') !== false)
1201 1189
         {
1202 1190
             $this->_platform = self::PLATFORM_OPENSOLARIS;
1203
-        }
1204
-        elseif (stripos($this->_agent, 'SunOS') !== false)
1191
+        } elseif (stripos($this->_agent, 'SunOS') !== false)
1205 1192
         {
1206 1193
             $this->_platform = self::PLATFORM_SUNOS;
1207
-        }
1208
-        elseif (stripos($this->_agent, 'OS\/2') !== false)
1194
+        } elseif (stripos($this->_agent, 'OS\/2') !== false)
1209 1195
         {
1210 1196
             $this->_platform = self::PLATFORM_OS2;
1211
-        }
1212
-        elseif (stripos($this->_agent, 'BeOS') !== false)
1197
+        } elseif (stripos($this->_agent, 'BeOS') !== false)
1213 1198
         {
1214 1199
             $this->_platform = self::PLATFORM_BEOS;
1215
-        }
1216
-        elseif (stripos($this->_agent, 'win') !== false)
1200
+        } elseif (stripos($this->_agent, 'win') !== false)
1217 1201
         {
1218 1202
             $this->_platform = self::PLATFORM_WINDOWS;
1219 1203
         }
Please login to merge, or discard this patch.
app/Resources/public/assets/ckeditor/samples/old/assets/posteddata.php 1 patch
Braces   +9 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,14 +29,16 @@
 block discarded – undo
29 29
 {
30 30
 	foreach ( $_POST as $key => $value )
31 31
 	{
32
-		if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) )
33
-			continue;
32
+		if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) ) {
33
+					continue;
34
+		}
34 35
 
35
-		if ( get_magic_quotes_gpc() )
36
-			$value = htmlspecialchars( stripslashes((string)$value) );
37
-		else
38
-			$value = htmlspecialchars( (string)$value );
39
-?>
36
+		if ( get_magic_quotes_gpc() ) {
37
+					$value = htmlspecialchars( stripslashes((string)$value) );
38
+		} else {
39
+					$value = htmlspecialchars( (string)$value );
40
+		}
41
+		?>
40 42
 		<tr>
41 43
 			<th style="vertical-align: top"><?php echo htmlspecialchars( (string)$key ); ?></th>
42 44
 			<td><pre class="samples"><?php echo $value; ?></pre></td>
Please login to merge, or discard this patch.
main/mySpace/myStudents.php 1 patch
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
 
867 867
                     if ($progress === null) {
868 868
                         $progress = '0%';
869
-                    }  else {
869
+                    } else {
870 870
                         $any_result = true;
871 871
                     }
872 872
 
@@ -896,7 +896,9 @@  discard block
 block discarded – undo
896 896
                         $start_time =  '-';
897 897
                     }
898 898
 
899
-                    if (!empty($total_time)) $any_result = true;
899
+                    if (!empty($total_time)) {
900
+                        $any_result = true;
901
+                    }
900 902
 
901 903
                     // Quiz in lp
902 904
                     $score = Tracking::get_avg_student_score(
@@ -1089,10 +1091,11 @@  discard block
 block discarded – undo
1089 1091
                 $result_last_attempt = Database::query($sql);
1090 1092
                 if (Database :: num_rows($result_last_attempt) > 0) {
1091 1093
                     $id_last_attempt = Database :: result($result_last_attempt, 0, 0);
1092
-                    if ($count_attempts > 0)
1093
-                        echo '<a href="../exercice/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin)?'tracking':$origin).'">
1094
+                    if ($count_attempts > 0) {
1095
+                                            echo '<a href="../exercice/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin)?'tracking':$origin).'">
1094 1096
                         '.Display::return_icon('quiz.gif').'
1095 1097
                      </a>';
1098
+                    }
1096 1099
                 }
1097 1100
                 echo '</td>';
1098 1101
 
Please login to merge, or discard this patch.
main/newscorm/learnpath.class.php 1 patch
Braces   +110 added lines, -76 removed lines patch added patch discarded remove patch
@@ -3939,8 +3939,9 @@  discard block
 block discarded – undo
3939 3939
                 WHERE c_id = ".$course_id."
3940 3940
                 ORDER BY display_order";
3941 3941
         $res = Database::query($sql);
3942
-        if ($res === false)
3943
-            return false;
3942
+        if ($res === false) {
3943
+                    return false;
3944
+        }
3944 3945
         $lps = array ();
3945 3946
         $lp_order = array ();
3946 3947
         $num = Database :: num_rows($res);
@@ -4540,8 +4541,9 @@  discard block
 block discarded – undo
4540 4541
         if ($this->debug > 0) {
4541 4542
             error_log('New LP - In learnpath::set_maker()', 0);
4542 4543
         }
4543
-        if (empty ($name))
4544
-            return false;
4544
+        if (empty ($name)) {
4545
+                    return false;
4546
+        }
4545 4547
         $this->maker = $name;
4546 4548
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4547 4549
         $course_id = api_get_course_int_id();
@@ -4606,8 +4608,9 @@  discard block
 block discarded – undo
4606 4608
     public function set_terms_by_prefix($terms_string, $prefix)
4607 4609
     {
4608 4610
         $course_id = api_get_course_int_id();
4609
-        if (api_get_setting('search_enabled') !== 'true')
4610
-            return false;
4611
+        if (api_get_setting('search_enabled') !== 'true') {
4612
+                    return false;
4613
+        }
4611 4614
 
4612 4615
         if (!extension_loaded('xapian')) {
4613 4616
             return false;
@@ -4620,8 +4623,9 @@  discard block
 block discarded – undo
4620 4623
         $stored_terms = $this->get_common_index_terms_by_prefix($prefix);
4621 4624
 
4622 4625
         // Don't do anything if no change, verify only at DB, not the search engine.
4623
-        if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0))
4624
-            return false;
4626
+        if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) {
4627
+                    return false;
4628
+        }
4625 4629
 
4626 4630
         require_once 'xapian.php'; // TODO: Try catch every xapian use or make wrappers on API.
4627 4631
         require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
@@ -4813,8 +4817,9 @@  discard block
 block discarded – undo
4813 4817
         if ($this->debug > 0) {
4814 4818
             error_log('New LP - In learnpath::set_proximity()', 0);
4815 4819
         }
4816
-        if (empty ($name))
4817
-            return false;
4820
+        if (empty ($name)) {
4821
+                    return false;
4822
+        }
4818 4823
 
4819 4824
         $this->proximity = $name;
4820 4825
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
@@ -5156,8 +5161,9 @@  discard block
 block discarded – undo
5156 5161
 
5157 5162
         $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." ORDER BY display_order";
5158 5163
         $res = Database::query($sql);
5159
-        if ($res === false)
5160
-            return false;
5164
+        if ($res === false) {
5165
+                    return false;
5166
+        }
5161 5167
 
5162 5168
         $num = Database :: num_rows($res);
5163 5169
         // First check the order is correct, globally (might be wrong because
@@ -5468,8 +5474,9 @@  discard block
 block discarded – undo
5468 5474
             $position[$key] = $row['display_order'];
5469 5475
         }
5470 5476
 
5471
-        if (count($array) > 0)
5472
-            array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array);
5477
+        if (count($array) > 0) {
5478
+                    array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array);
5479
+        }
5473 5480
 
5474 5481
         return $array;
5475 5482
     }
@@ -6037,8 +6044,9 @@  discard block
 block discarded – undo
6037 6044
         $tmp_filename = $filename;
6038 6045
 
6039 6046
         $i = 0;
6040
-        while (file_exists($filepath . $tmp_filename . '.'.$extension))
6041
-            $tmp_filename = $filename . '_' . ++ $i;
6047
+        while (file_exists($filepath . $tmp_filename . '.'.$extension)) {
6048
+                    $tmp_filename = $filename . '_' . ++ $i;
6049
+        }
6042 6050
 
6043 6051
         $filename = $tmp_filename . '.'.$extension;
6044 6052
         if ($extension == 'html') {
@@ -6117,10 +6125,12 @@  discard block
 block discarded – undo
6117 6125
                     if ($new_comment || $new_title) {
6118 6126
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6119 6127
                         $ct = '';
6120
-                        if ($new_comment)
6121
-                            $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6122
-                        if ($new_title)
6123
-                            $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6128
+                        if ($new_comment) {
6129
+                                                    $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6130
+                        }
6131
+                        if ($new_title) {
6132
+                                                    $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6133
+                        }
6124 6134
 
6125 6135
                         $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)."
6126 6136
                                WHERE c_id = ".$course_id." AND id = " . $document_id;
@@ -6144,17 +6154,21 @@  discard block
 block discarded – undo
6144 6154
         // Please, do not modify this dirname formatting.
6145 6155
         $dir = isset($_GET['dir']) ? $_GET['dir'] : $_POST['dir'];
6146 6156
 
6147
-        if (strstr($dir, '..'))
6148
-            $dir = '/';
6157
+        if (strstr($dir, '..')) {
6158
+                    $dir = '/';
6159
+        }
6149 6160
 
6150
-        if ($dir[0] == '.')
6151
-            $dir = substr($dir, 1);
6161
+        if ($dir[0] == '.') {
6162
+                    $dir = substr($dir, 1);
6163
+        }
6152 6164
 
6153
-        if ($dir[0] != '/')
6154
-            $dir = '/' . $dir;
6165
+        if ($dir[0] != '/') {
6166
+                    $dir = '/' . $dir;
6167
+        }
6155 6168
 
6156
-        if ($dir[strlen($dir) - 1] != '/')
6157
-            $dir .= '/';
6169
+        if ($dir[strlen($dir) - 1] != '/') {
6170
+                    $dir .= '/';
6171
+        }
6158 6172
 
6159 6173
         $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir;
6160 6174
 
@@ -6219,8 +6233,9 @@  discard block
 block discarded – undo
6219 6233
                 }
6220 6234
                 $return .= '<div style="padding:10px;">';
6221 6235
 
6222
-                if ($msg != '')
6223
-                    $return .= $msg;
6236
+                if ($msg != '') {
6237
+                                    $return .= $msg;
6238
+                }
6224 6239
 
6225 6240
                 $return .= '<h3>'.$row['title'].'</h3>';
6226 6241
                 switch ($row['item_type']) {
@@ -6484,10 +6499,11 @@  discard block
 block discarded – undo
6484 6499
         $item_title			= Security::remove_XSS($item_title);
6485 6500
         $item_description 	= Security::remove_XSS($item_description);
6486 6501
 
6487
-        if ($id != 0 && is_array($extra_info))
6488
-            $parent = $extra_info['parent_item_id'];
6489
-        else
6490
-            $parent = 0;
6502
+        if ($id != 0 && is_array($extra_info)) {
6503
+                    $parent = $extra_info['parent_item_id'];
6504
+        } else {
6505
+                    $parent = 0;
6506
+        }
6491 6507
 
6492 6508
         $sql = "SELECT * FROM " . $tbl_lp_item . "
6493 6509
                 WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
@@ -6760,11 +6776,13 @@  discard block
 block discarded – undo
6760 6776
         }
6761 6777
 
6762 6778
         $legend = '<legend>';
6763
-        if ($action == 'add')
6764
-            $legend .= get_lang('CreateTheExercise');
6765
-        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentExercise');
6766
-        else
6767
-            $legend .= get_lang('EditCurrentExecice');
6779
+        if ($action == 'add') {
6780
+                    $legend .= get_lang('CreateTheExercise');
6781
+        } elseif ($action == 'move') {
6782
+            $legend .= get_lang('MoveTheCurrentExercise');
6783
+        } else {
6784
+                    $legend .= get_lang('EditCurrentExecice');
6785
+        }
6768 6786
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6769 6787
             $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6770 6788
         }
@@ -6791,8 +6809,9 @@  discard block
 block discarded – undo
6791 6809
                         $arrHide[] = $arrLP[$i]['id'];
6792 6810
                     }
6793 6811
                 } else {
6794
-                    if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6795
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6812
+                    if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') {
6813
+                                            $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6814
+                    }
6796 6815
                 }
6797 6816
             }
6798 6817
 
@@ -6810,11 +6829,13 @@  discard block
 block discarded – undo
6810 6829
 
6811 6830
         for ($i = 0; $i < count($arrLP); $i++) {
6812 6831
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6813
-                if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
6832
+                if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
6833
+                                    $selected = 'selected="selected" ';
6834
+                } elseif ($action == 'add') {
6814 6835
                     $selected = 'selected="selected" ';
6815
-                elseif ($action == 'add') $selected = 'selected="selected" ';
6816
-                else
6817
-                    $selected = '';
6836
+                } else {
6837
+                                    $selected = '';
6838
+                }
6818 6839
 
6819 6840
                 $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6820 6841
             }
@@ -6841,9 +6862,11 @@  discard block
 block discarded – undo
6841 6862
                 $arrHide = array ();
6842 6863
                 for ($i = 0; $i < count($arrLP); $i++) {
6843 6864
                     if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6844
-                        if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
6845
-                            $s_selected_position = $arrLP[$i]['id'];
6846
-                        elseif ($action == 'add') $s_selected_position = 0;
6865
+                        if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
6866
+                                                    $s_selected_position = $arrLP[$i]['id'];
6867
+                        } elseif ($action == 'add') {
6868
+                            $s_selected_position = 0;
6869
+                        }
6847 6870
                         $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
6848 6871
 
6849 6872
                     }
@@ -7040,9 +7063,11 @@  discard block
 block discarded – undo
7040 7063
             $arrHide = array();
7041 7064
             for ($i = 0; $i < count($arrLP); $i++) {
7042 7065
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
7043
-                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7044
-                        $s_selected_position = $arrLP[$i]['id'];
7045
-                    elseif ($action == 'add') $s_selected_position = 0;
7066
+                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7067
+                                            $s_selected_position = $arrLP[$i]['id'];
7068
+                    } elseif ($action == 'add') {
7069
+                        $s_selected_position = 0;
7070
+                    }
7046 7071
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7047 7072
                 }
7048 7073
             }
@@ -7245,9 +7270,11 @@  discard block
 block discarded – undo
7245 7270
 
7246 7271
             for ($i = 0; $i < count($arrLP); $i++) {
7247 7272
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
7248
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7249
-                        $s_selected_position = $arrLP[$i]['id'];
7250
-                    elseif ($action == 'add') $s_selected_position = 0;
7273
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7274
+                                            $s_selected_position = $arrLP[$i]['id'];
7275
+                    } elseif ($action == 'add') {
7276
+                        $s_selected_position = 0;
7277
+                    }
7251 7278
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7252 7279
 
7253 7280
                 }
@@ -7281,8 +7308,7 @@  discard block
 block discarded – undo
7281 7308
 
7282 7309
         if (is_numeric($extra_info)) {
7283 7310
             $form->addHidden('path', $extra_info);
7284
-        }
7285
-        elseif (is_array($extra_info)) {
7311
+        } elseif (is_array($extra_info)) {
7286 7312
             $form->addHidden('path', $extra_info['path']);
7287 7313
         }
7288 7314
 
@@ -7335,8 +7361,9 @@  discard block
 block discarded – undo
7335 7361
                     lp_id = " . $this->lp_id . " AND
7336 7362
                     id != $id";
7337 7363
 
7338
-        if ($item_type == 'module')
7339
-            $sql .= " AND parent_item_id = 0";
7364
+        if ($item_type == 'module') {
7365
+                    $sql .= " AND parent_item_id = 0";
7366
+        }
7340 7367
 
7341 7368
         $result = Database::query($sql);
7342 7369
         $arrLP = array ();
@@ -7722,9 +7749,11 @@  discard block
 block discarded – undo
7722 7749
 
7723 7750
             for ($i = 0; $i < count($arrLP); $i++) {
7724 7751
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter' && $arrLP[$i]['item_type'] !== TOOL_LP_FINAL_ITEM) {
7725
-                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7752
+                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7753
+                                            $s_selected_position = $arrLP[$i]['id'];
7754
+                    } elseif ($action == 'add') {
7726 7755
                         $s_selected_position = $arrLP[$i]['id'];
7727
-                    elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id'];
7756
+                    }
7728 7757
 
7729 7758
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7730 7759
 
@@ -7735,17 +7764,18 @@  discard block
 block discarded – undo
7735 7764
                 $item_type = isset($extra_info['item_type']) ? $extra_info['item_type'] : null;
7736 7765
                 $edit = isset($_GET['edit']) ? $_GET['edit'] : null;
7737 7766
                 if (($extra_info == 'new' || $item_type == TOOL_DOCUMENT || $item_type == TOOL_LP_FINAL_ITEM || $edit == 'true')) {
7738
-                    if (isset ($_POST['content']))
7739
-                        $content = stripslashes($_POST['content']);
7740
-                    elseif (is_array($extra_info)) {
7767
+                    if (isset ($_POST['content'])) {
7768
+                                            $content = stripslashes($_POST['content']);
7769
+                    } elseif (is_array($extra_info)) {
7741 7770
                         //If it's an html document or a text file
7742 7771
                         if (!$no_display_edit_textarea) {
7743 7772
                             $content = $this->display_document($extra_info['path'], false, false);
7744 7773
                         }
7745
-                    } elseif (is_numeric($extra_info))
7746
-                        $content = $this->display_document($extra_info, false, false);
7747
-                    else
7748
-                        $content = '';
7774
+                    } elseif (is_numeric($extra_info)) {
7775
+                                            $content = $this->display_document($extra_info, false, false);
7776
+                    } else {
7777
+                                            $content = '';
7778
+                    }
7749 7779
 
7750 7780
                     if (!$no_display_edit_textarea) {
7751 7781
                         // We need to calculate here some specific settings for the online editor.
@@ -8013,9 +8043,11 @@  discard block
 block discarded – undo
8013 8043
             $arrHide = array();
8014 8044
             for ($i = 0; $i < count($arrLP); $i++) {
8015 8045
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
8016
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
8017
-                        $s_selected_position = $arrLP[$i]['id'];
8018
-                    elseif ($action == 'add') $s_selected_position = 0;
8046
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
8047
+                                            $s_selected_position = $arrLP[$i]['id'];
8048
+                    } elseif ($action == 'add') {
8049
+                        $s_selected_position = 0;
8050
+                    }
8019 8051
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
8020 8052
 
8021 8053
                 }
@@ -8218,9 +8250,11 @@  discard block
 block discarded – undo
8218 8250
             $arrHide = array ();
8219 8251
             for ($i = 0; $i < count($arrLP); $i++) {
8220 8252
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
8221
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
8222
-                        $s_selected_position = $arrLP[$i]['id'];
8223
-                    elseif ($action == 'add') $s_selected_position = 0;
8253
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
8254
+                                            $s_selected_position = $arrLP[$i]['id'];
8255
+                    } elseif ($action == 'add') {
8256
+                        $s_selected_position = 0;
8257
+                    }
8224 8258
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
8225 8259
 
8226 8260
                 }
@@ -9795,9 +9829,9 @@  discard block
 block discarded – undo
9795 9829
         $main_code_path = api_get_path(SYS_CODE_PATH).'newscorm/packaging/';
9796 9830
         $extra_files = scandir($main_code_path);
9797 9831
         foreach ($extra_files as $extra_file) {
9798
-            if (strpos($extra_file, '.') === 0)
9799
-                continue;
9800
-            else {
9832
+            if (strpos($extra_file, '.') === 0) {
9833
+                            continue;
9834
+            } else {
9801 9835
                 $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file;
9802 9836
                 $this->create_path($dest_file);
9803 9837
                 copy($main_code_path.$extra_file, $dest_file);
Please login to merge, or discard this patch.