Completed
Pull Request — 1.11.x (#1622)
by José
95:13 queued 68:43
created
main/reports/reports.lib.php 1 patch
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,9 +15,10 @@  discard block
 block discarded – undo
15 15
 // load templates
16 16
 function reports_loadTemplates() {
17 17
 	global $reports_enabled_templates, $reports_template;
18
-	foreach ($reports_enabled_templates as $t)
19
-		require_once 'templates/'.$t.'.reports.php';
20
-}
18
+	foreach ($reports_enabled_templates as $t) {
19
+			require_once 'templates/'.$t.'.reports.php';
20
+	}
21
+	}
21 22
 
22 23
 
23 24
 // clear all reporting data
@@ -150,11 +151,12 @@  discard block
 block discarded – undo
150 151
 // return tools ID (parametre is a constant from main_api
151 152
 function reports_getToolId($tool) {
152 153
 	$tools = array_flip(api_get_tools_lists());
153
-	if (array_key_exists($tool, $tools))
154
-		return $tools[$tool];
155
-	else
156
-		return null;
157
-}
154
+	if (array_key_exists($tool, $tools)) {
155
+			return $tools[$tool];
156
+	} else {
157
+			return null;
158
+	}
159
+	}
158 160
 
159 161
 // return a sql clause returning triplet of (course, $session, $uid) the
160 162
 // current user is authorized to reed
Please login to merge, or discard this patch.
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.
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.
plugin/vchamilo/cli/clilib.php 1 patch
Braces   +10 added lines, -3 removed lines patch added patch discarded remove patch
@@ -133,7 +133,9 @@  discard block
 block discarded – undo
133 133
             $key = $headers[$f];
134 134
             if (preg_match('/\|/', $key)) {
135 135
                 list($plugin, $variable) = explode('|', str_replace('plugin_', '', $key));
136
-                if (empty($variable)) die("Key error in CSV : $key ");
136
+                if (empty($variable)) {
137
+                    die("Key error in CSV : $key ");
138
+                }
137 139
                 if (!isset($vnode->$plugin)) {
138 140
                     $vnode->$plugin = new StdClass();
139 141
                 }
@@ -170,8 +172,13 @@  discard block
 block discarded – undo
170 172
     static $first = true;
171 173
 
172 174
     // We may have a risk the BOM is present on first line
173
-    if ($resetfirst) $first = true;
174
-    if (!isset($textlib)) $textlib = new textlib(); // Singleton
175
+    if ($resetfirst) {
176
+        $first = true;
177
+    }
178
+    if (!isset($textlib)) {
179
+        $textlib = new textlib();
180
+    }
181
+    // Singleton
175 182
     $text = $textlib->trim_utf8_bom($text);
176 183
     $first = false;
177 184
 
Please login to merge, or discard this patch.
main/inc/lib/javascript/svgedit/extensions/imagelib/index.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,8 +65,7 @@
 block discarded – undo
65 65
 		if (strpos($filename, "svg")){
66 66
 			$new_sizes['width'] = 60;
67 67
 			$new_sizes['height'] = 60;
68
-		}
69
-		else {
68
+		} else {
70 69
 			$new_sizes = api_resize_image($image, 60, 60);
71 70
 		}
72 71
 
Please login to merge, or discard this patch.
main/inc/lib/api.lib.php 1 patch
Braces   +19 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1701,7 +1701,9 @@  discard block
 block discarded – undo
1701 1701
     }
1702 1702
 
1703 1703
     global $_course;
1704
-    if ($_course == '-1') $_course = array();
1704
+    if ($_course == '-1') {
1705
+        $_course = array();
1706
+    }
1705 1707
     return $_course;
1706 1708
 }
1707 1709
 
@@ -4154,18 +4156,21 @@  discard block
 block discarded – undo
4154 4156
     switch ($lang_type) {
4155 4157
         case 'platform_lang':
4156 4158
             $temp_lang = api_get_setting('platformLanguage');
4157
-            if (!empty($temp_lang))
4158
-                $return = $temp_lang;
4159
+            if (!empty($temp_lang)) {
4160
+                            $return = $temp_lang;
4161
+            }
4159 4162
             break;
4160 4163
         case 'user_profil_lang':
4161 4164
             $_user = api_get_user_info();
4162 4165
 
4163
-            if (isset($_user['language']) && !empty($_user['language']))
4164
-                $return = $_user['language'];
4166
+            if (isset($_user['language']) && !empty($_user['language'])) {
4167
+                            $return = $_user['language'];
4168
+            }
4165 4169
             break;
4166 4170
         case 'user_selected_lang':
4167
-            if (isset($_SESSION['user_language_choice']) && !empty($_SESSION['user_language_choice']))
4168
-                $return = $_SESSION['user_language_choice'];
4171
+            if (isset($_SESSION['user_language_choice']) && !empty($_SESSION['user_language_choice'])) {
4172
+                            $return = $_SESSION['user_language_choice'];
4173
+            }
4169 4174
             break;
4170 4175
         case 'course_lang':
4171 4176
             global $_course;
@@ -5434,8 +5439,7 @@  discard block
 block discarded – undo
5434 5439
             $is_courseAdmin = false;
5435 5440
             $is_courseCoach = true;
5436 5441
             $is_sessionAdmin = false;
5437
-        }
5438
-        elseif ($row[0]['session_admin_id'] == $userid) {
5442
+        } elseif ($row[0]['session_admin_id'] == $userid) {
5439 5443
             $is_courseMember = false;
5440 5444
             $is_courseTutor = false;
5441 5445
             $is_courseAdmin = false;
@@ -5778,8 +5782,7 @@  discard block
 block discarded – undo
5778 5782
     elseif (isset($_ENV['OS'])) {
5779 5783
         // Sometimes $_ENV['OS'] may not be present (bugs?)
5780 5784
         $os = $_ENV['OS'];
5781
-    }
5782
-    elseif (defined('PHP_OS')) {
5785
+    } elseif (defined('PHP_OS')) {
5783 5786
         // PHP_OS means on which OS PHP was compiled, this is why
5784 5787
         // using PHP_OS is the last choice for detection.
5785 5788
         $os = PHP_OS;
@@ -5843,12 +5846,10 @@  discard block
 block discarded – undo
5843 5846
     if ($delta_width > $delta_height) {
5844 5847
         $result['width'] = ceil($image_width * $resize_factor_height);
5845 5848
         $result['height'] = ceil($image_height * $resize_factor_height);
5846
-    }
5847
-    elseif ($delta_width < $delta_height) {
5849
+    } elseif ($delta_width < $delta_height) {
5848 5850
         $result['width'] = ceil($image_width * $resize_factor_width);
5849 5851
         $result['height'] = ceil($image_height * $resize_factor_width);
5850
-    }
5851
-    else {
5852
+    } else {
5852 5853
         $result['width'] = ceil($target_width);
5853 5854
         $result['height'] = ceil($target_height);
5854 5855
     }
@@ -6629,7 +6630,9 @@  discard block
 block discarded – undo
6629 6630
         }
6630 6631
         $ip = trim($ip1);
6631 6632
     }
6632
-    if (!empty($debug)) error_log('Real IP: '.$ip);
6633
+    if (!empty($debug)) {
6634
+        error_log('Real IP: '.$ip);
6635
+    }
6633 6636
     return $ip;
6634 6637
 }
6635 6638
 
Please login to merge, or discard this patch.
main/ticket/report.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -289,8 +289,9 @@
 block discarded – undo
289 289
 
290 290
     if ($start_date != '' || $end_date != '') {
291 291
         $sql .= " HAVING ";
292
-        if ($start_date != '')
293
-            $sql .= "  access_date >= '$start_date'   ";
292
+        if ($start_date != '') {
293
+                    $sql .= "  access_date >= '$start_date'   ";
294
+        }
294 295
         if ($end_date != '') {
295 296
             $sql = ($start_date == '') ? $sql : ($sql . " AND ");
296 297
             $sql .= "  access_date <= '$end_date'   ";
Please login to merge, or discard this patch.
main/exercise/overview.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -250,8 +250,7 @@
 block discarded – undo
250 250
         case RESULT_DISABLE_SHOW_SCORE_ONLY:
251 251
             if ($objExercise->feedback_type != EXERCISE_FEEDBACK_TYPE_END) {
252 252
                $header_names = array(get_lang('Attempt'), get_lang('StartDate'), get_lang('IP'), get_lang('Score'));
253
-            }
254
-            else {
253
+            } else {
255 254
                 $header_names = array(get_lang('Attempt'), get_lang('StartDate'), get_lang('IP'), get_lang('Score'), get_lang('Details'));
256 255
             }
257 256
             break;
Please login to merge, or discard this patch.