Passed
Push — 1.10.x ( 51b3f0...0b3bd8 )
by Yannick
116:33 queued 61:35
created
main/inc/lib/rights.lib.php 1 patch
Braces   +23 added lines, -15 removed lines patch added patch discarded remove patch
@@ -16,31 +16,39 @@
 block discarded – undo
16 16
 	// warning the goal of this function is to enforce rights managment in Chamilo
17 17
 	// thus default return value is always true
18 18
 	public static function hasRight($handler) {
19
-		if (array_key_exists($handler, self::$rights_cache))
20
-			return self::$rights_cache[$handler];
19
+		if (array_key_exists($handler, self::$rights_cache)) {
20
+					return self::$rights_cache[$handler];
21
+		}
21 22
 
22
-		if (!array_key_exists($handler, self::$rights))
23
-			return true; // handler does not exists
23
+		if (!array_key_exists($handler, self::$rights)) {
24
+					return true;
25
+		}
26
+		// handler does not exists
24 27
 
25 28
 		if (self::$rights[$handler]['type'] == 'sql') {
26 29
 			$result = Database::query(self::$rights[$handler]['sql']);
27
-			if (Database::num_rows($result) > 0)
28
-				$result = true;
29
-			else
30
-				$result = false;
31
-		} else if (self::$rights[$handler]['type'] == 'const')
32
-			$result = self::$rights[$handler]['const'];
33
-		else if (self::$rights[$handler]['type'] == 'func')
34
-			$result = self::$rights[$handler]['func']();
35
-		else // handler type not implemented
30
+			if (Database::num_rows($result) > 0) {
31
+							$result = true;
32
+			} else {
33
+							$result = false;
34
+			}
35
+		} else if (self::$rights[$handler]['type'] == 'const') {
36
+					$result = self::$rights[$handler]['const'];
37
+		} else if (self::$rights[$handler]['type'] == 'func') {
38
+					$result = self::$rights[$handler]['func']();
39
+		} else {
40
+		    // handler type not implemented
36 41
 			return true;
42
+		}
37 43
 		self::$rights_cache[$handler] = $result;
38 44
 		return $result;
39 45
 	}
40 46
 
41 47
 	public static function hasRightClosePageWithError($handler) {
42
-		if (hasRight($handler) == false)
43
-			die("You are not allowed here"); //FIXME
48
+		if (hasRight($handler) == false) {
49
+					die("You are not allowed here");
50
+		}
51
+		//FIXME
44 52
 	}
45 53
 
46 54
 }
Please login to merge, or discard this patch.
main/inc/lib/geometry.lib.php 1 patch
Braces   +54 added lines, -30 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]['y']]))
155
-            	array_push($bords[$poly[$i]['y']],  round($poly[$i]['x']));
166
+        	if (is_array($bords[$poly[$i]['y']])) {
167
+        	            	array_push($bords[$poly[$i]['y']],  round($poly[$i]['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
 
@@ -188,8 +203,11 @@  discard block
 block discarded – undo
188 203
        		sort($bords[$i]);
189 204
         }
190 205
 
191
-        for ($j = 0; $j<sizeof($bords[$i]);$j+=2) // bords
192
-            for ($k = round($bords[$i][$j]); $k<=$bords[$i][$j+1];$k++) {
206
+        for ($j = 0; $j<sizeof($bords[$i]);$j+=2) {
207
+            // bords
208
+            for ($k = round($bords[$i][$j]);
209
+        }
210
+        $k<=$bords[$i][$j+1];$k++) {
193 211
                 $res[$k][$i] = true; //filling the array with trues
194 212
                 if ($test == 1)  {
195 213
                 	/*how to draw the polygon in a human way:
@@ -222,11 +240,13 @@  discard block
 block discarded – undo
222 240
         $s = "<div style='font-size: 8px; line-height:3px'><pre>\n";
223 241
     }
224 242
     for ($i=0; $i<$max['y']; $i++) {
225
-        for($j=0; $j<$max['x']; $j++)
226
-            if($poly[$j][$i] == TRUE)
243
+        for($j=0; $j<$max['x']; $j++) {
244
+                    if($poly[$j][$i] == TRUE)
227 245
                 $s .= ($format=='html'?"<b>1</b>":'1');
228
-            else
229
-                $s .= "0";
246
+        }
247
+            else {
248
+                            $s .= "0";
249
+            }
230 250
         $s .= ($format=='html'?"<br />\n":"\n");
231 251
     }
232 252
     $s .= ($format=='html'?"</pre></div>\n":"\n");
@@ -247,15 +267,19 @@  discard block
 block discarded – undo
247 267
     $surfaceOf1 = 0;
248 268
     $surfaceOf2 = 0;
249 269
 
250
-    for ($i=0; $i<$max['x']; $i++)
251
-        for($j=0; $j<$max['y']; $j++) {
270
+    for ($i=0; $i<$max['x']; $i++) {
271
+            for($j=0;
272
+    }
273
+    $j<$max['y']; $j++) {
252 274
             if (isset($poly1[$i][$j]) && ($poly1[$i][$j] == TRUE)) {
253 275
                 $surfaceOf1++;
254
-                if (isset($poly2[$i][$j]) && ($poly2[$i][$j] == FALSE))
255
-                    $onlyIn1++;
276
+                if (isset($poly2[$i][$j]) && ($poly2[$i][$j] == FALSE)) {
277
+                                    $onlyIn1++;
278
+                }
279
+            }
280
+            if (isset($poly2[$i][$j]) && ($poly2[$i][$j] == TRUE)) {
281
+                            $surfaceOf2++;
256 282
             }
257
-            if (isset($poly2[$i][$j]) && ($poly2[$i][$j] == TRUE))
258
-                $surfaceOf2++;
259 283
         }
260 284
 
261 285
     return array (
Please login to merge, or discard this patch.
main/inc/lib/exercise_show_functions.lib.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -252,8 +252,7 @@  discard block
 block discarded – undo
252 252
 		<td width="5%">
253 253
             <?php if (!$hide_expected_answer) { ?>
254 254
 			    <img src="../img/<?php echo (in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION))) ? 'radio':'checkbox'; echo $answerCorrect?'_on':'_off'; ?>.gif" border="0" alt=" " />
255
-            <?php }
256
-            else {
255
+            <?php } else {
257 256
                 echo "-";
258 257
             }?>
259 258
 		</td>
@@ -438,8 +437,7 @@  discard block
 block discarded – undo
438 437
             } else {
439 438
                 echo $question->options[2];
440 439
             }
441
-        }
442
-        else {
440
+        } else {
443 441
             echo '-';
444 442
         }
445 443
         ?>
Please login to merge, or discard this patch.
main/inc/lib/phpseclib/Crypt/Blowfish.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -545,8 +545,7 @@
 block discarded – undo
545 545
 
546 546
         if (!$keylength) {
547 547
             $key = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
548
-        }
549
-        elseif ($keylength > 56) {
548
+        } elseif ($keylength > 56) {
550 549
             $key = substr($key, 0, 56);
551 550
         }
552 551
 
Please login to merge, or discard this patch.
main/inc/lib/phpseclib/Crypt/Twofish.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1197,7 +1197,9 @@
 block discarded – undo
1197 1197
             $u^= 0x7fffffff & ($t >> 1);
1198 1198
 
1199 1199
             // Add the modular polynomial on underflow.
1200
-            if ($t & 0x01) $u^= 0xa6 ;
1200
+            if ($t & 0x01) {
1201
+                $u^= 0xa6 ;
1202
+            }
1201 1203
 
1202 1204
             // Remove t * (a + 1/a) * (x^3 + x).
1203 1205
             $B^= ($u << 24) | ($u << 8);
Please login to merge, or discard this patch.
main/inc/lib/phpseclib/File/X509.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1711,8 +1711,7 @@  discard block
 block discarded – undo
1711 1711
                 if ($map === false) {
1712 1712
                     user_error($id . ' is not a currently supported attribute', E_USER_NOTICE);
1713 1713
                     unset($attributes[$i]);
1714
-                }
1715
-                elseif (is_array($attributes[$i]['value'])) {
1714
+                } elseif (is_array($attributes[$i]['value'])) {
1716 1715
                     $values = &$attributes[$i]['value'];
1717 1716
                     for ($j = 0; $j < count($values); $j++) {
1718 1717
                         switch ($id) {
@@ -3345,8 +3344,7 @@  discard block
 block discarded – undo
3345 3344
 
3346 3345
         if (!empty($this->serialNumber)) {
3347 3346
             $crlNumber = $this->serialNumber;
3348
-        }
3349
-        else {
3347
+        } else {
3350 3348
             $crlNumber = $this->getExtension('id-ce-cRLNumber');
3351 3349
             $crlNumber = $crlNumber !== false ? $crlNumber->add(new Math_BigInteger(1)) : NULL;
3352 3350
         }
@@ -3359,8 +3357,7 @@  discard block
 block discarded – undo
3359 3357
         if (!$version) {
3360 3358
             if (!empty($tbsCertList['crlExtensions'])) {
3361 3359
                 $version = 1; // v2.
3362
-            }
3363
-            elseif (!empty($tbsCertList['revokedCertificates'])) {
3360
+            } elseif (!empty($tbsCertList['revokedCertificates'])) {
3364 3361
                 foreach ($tbsCertList['revokedCertificates'] as $cert) {
3365 3362
                     if (!empty($cert['crlEntryExtensions'])) {
3366 3363
                         $version = 1; // v2.
Please login to merge, or discard this patch.
main/inc/lib/phpseclib/File/ANSI.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -350,10 +350,18 @@
 block discarded – undo
350 350
                                         case 0: // Turn off character attributes
351 351
                                             $this->attrs[$this->y][$this->x] = '';
352 352
 
353
-                                            if ($this->bold) $this->attrs[$this->y][$this->x].= '</b>';
354
-                                            if ($this->underline) $this->attrs[$this->y][$this->x].= '</underline>';
355
-                                            if ($this->blink) $this->attrs[$this->y][$this->x].= '</blink>';
356
-                                            if ($this->color) $this->attrs[$this->y][$this->x].= '</span>';
353
+                                            if ($this->bold) {
354
+                                                $this->attrs[$this->y][$this->x].= '</b>';
355
+                                            }
356
+                                            if ($this->underline) {
357
+                                                $this->attrs[$this->y][$this->x].= '</underline>';
358
+                                            }
359
+                                            if ($this->blink) {
360
+                                                $this->attrs[$this->y][$this->x].= '</blink>';
361
+                                            }
362
+                                            if ($this->color) {
363
+                                                $this->attrs[$this->y][$this->x].= '</span>';
364
+                                            }
357 365
 
358 366
                                             if ($this->reverse) {
359 367
                                                 $temp = $this->background;
Please login to merge, or discard this patch.
main/inc/lib/phpseclib/File/ASN1.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -586,8 +586,7 @@  discard block
 block discarded – undo
586 586
                             if (isset($child['class'])) {
587 587
                                 $childClass = $child['class'];
588 588
                                 $constant = $child['cast'];
589
-                            }
590
-                            elseif (isset($child['constant'])) {
589
+                            } elseif (isset($child['constant'])) {
591 590
                                 $childClass = FILE_ASN1_CLASS_CONTEXT_SPECIFIC;
592 591
                                 $constant = $child['constant'];
593 592
                             }
@@ -656,8 +655,7 @@  discard block
 block discarded – undo
656 655
                             if (isset($child['class'])) {
657 656
                                 $childClass = $child['class'];
658 657
                                 $constant = $child['cast'];
659
-                            }
660
-                            elseif (isset($child['constant'])) {
658
+                            } elseif (isset($child['constant'])) {
661 659
                                 $childClass = FILE_ASN1_CLASS_CONTEXT_SPECIFIC;
662 660
                                 $constant = $child['constant'];
663 661
                             }
Please login to merge, or discard this patch.
main/inc/lib/sortable_table.class.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -808,8 +808,9 @@
 block discarded – undo
808 808
             foreach ($param as $key => & $value) {
809 809
                 $param_string_parts[] = urlencode($key).'='.urlencode($value);
810 810
             }
811
-            if (count($param_string_parts) > 0)
812
-                $result .= '&amp;'.implode('&amp;', $param_string_parts);
811
+            if (count($param_string_parts) > 0) {
812
+                            $result .= '&amp;'.implode('&amp;', $param_string_parts);
813
+            }
813 814
         }
814 815
         return $result;
815 816
     }
Please login to merge, or discard this patch.