Completed
Push — 1.11.x ( ae642b...8fe553 )
by José
74:31 queued 35:16
created
main/inc/lib/nusoap/class.soap_transport_http.php 1 patch
Braces   +39 added lines, -29 removed lines patch added patch discarded remove patch
@@ -159,10 +159,12 @@  discard block
 block discarded – undo
159 159
 	* @access	private
160 160
 	*/
161 161
 	function io_method() {
162
-		if ($this->use_curl || ($this->scheme == 'https') || ($this->scheme == 'http' && $this->authtype == 'ntlm') || ($this->scheme == 'http' && is_array($this->proxy) && $this->proxy['authtype'] == 'ntlm'))
163
-			return 'curl';
164
-		if (($this->scheme == 'http' || $this->scheme == 'ssl') && $this->authtype != 'ntlm' && (!is_array($this->proxy) || $this->proxy['authtype'] != 'ntlm'))
165
-			return 'socket';
162
+		if ($this->use_curl || ($this->scheme == 'https') || ($this->scheme == 'http' && $this->authtype == 'ntlm') || ($this->scheme == 'http' && is_array($this->proxy) && $this->proxy['authtype'] == 'ntlm')) {
163
+					return 'curl';
164
+		}
165
+		if (($this->scheme == 'http' || $this->scheme == 'ssl') && $this->authtype != 'ntlm' && (!is_array($this->proxy) || $this->proxy['authtype'] != 'ntlm')) {
166
+					return 'socket';
167
+		}
166 168
 		return 'unknown';
167 169
 	}
168 170
 
@@ -246,30 +248,36 @@  discard block
 block discarded – undo
246 248
 			return false;
247 249
 		}
248 250
 		// Avoid warnings when PHP does not have these options
249
-		if (defined('CURLOPT_CONNECTIONTIMEOUT'))
250
-			$CURLOPT_CONNECTIONTIMEOUT = CURLOPT_CONNECTIONTIMEOUT;
251
-		else
252
-			$CURLOPT_CONNECTIONTIMEOUT = 78;
253
-		if (defined('CURLOPT_HTTPAUTH'))
254
-			$CURLOPT_HTTPAUTH = CURLOPT_HTTPAUTH;
255
-		else
256
-			$CURLOPT_HTTPAUTH = 107;
257
-		if (defined('CURLOPT_PROXYAUTH'))
258
-			$CURLOPT_PROXYAUTH = CURLOPT_PROXYAUTH;
259
-		else
260
-			$CURLOPT_PROXYAUTH = 111;
261
-		if (defined('CURLAUTH_BASIC'))
262
-			$CURLAUTH_BASIC = CURLAUTH_BASIC;
263
-		else
264
-			$CURLAUTH_BASIC = 1;
265
-		if (defined('CURLAUTH_DIGEST'))
266
-			$CURLAUTH_DIGEST = CURLAUTH_DIGEST;
267
-		else
268
-			$CURLAUTH_DIGEST = 2;
269
-		if (defined('CURLAUTH_NTLM'))
270
-			$CURLAUTH_NTLM = CURLAUTH_NTLM;
271
-		else
272
-			$CURLAUTH_NTLM = 8;
251
+		if (defined('CURLOPT_CONNECTIONTIMEOUT')) {
252
+					$CURLOPT_CONNECTIONTIMEOUT = CURLOPT_CONNECTIONTIMEOUT;
253
+		} else {
254
+					$CURLOPT_CONNECTIONTIMEOUT = 78;
255
+		}
256
+		if (defined('CURLOPT_HTTPAUTH')) {
257
+					$CURLOPT_HTTPAUTH = CURLOPT_HTTPAUTH;
258
+		} else {
259
+					$CURLOPT_HTTPAUTH = 107;
260
+		}
261
+		if (defined('CURLOPT_PROXYAUTH')) {
262
+					$CURLOPT_PROXYAUTH = CURLOPT_PROXYAUTH;
263
+		} else {
264
+					$CURLOPT_PROXYAUTH = 111;
265
+		}
266
+		if (defined('CURLAUTH_BASIC')) {
267
+					$CURLAUTH_BASIC = CURLAUTH_BASIC;
268
+		} else {
269
+					$CURLAUTH_BASIC = 1;
270
+		}
271
+		if (defined('CURLAUTH_DIGEST')) {
272
+					$CURLAUTH_DIGEST = CURLAUTH_DIGEST;
273
+		} else {
274
+					$CURLAUTH_DIGEST = 2;
275
+		}
276
+		if (defined('CURLAUTH_NTLM')) {
277
+					$CURLAUTH_NTLM = CURLAUTH_NTLM;
278
+		} else {
279
+					$CURLAUTH_NTLM = 8;
280
+		}
273 281
 
274 282
 		$this->debug('connect using cURL');
275 283
 		// init CURL
@@ -612,7 +620,9 @@  discard block
 block discarded – undo
612 620
 								'HTTP/1.0 200 Connection established');
613 621
 		foreach ($skipHeaders as $hd) {
614 622
 			$prefix = substr($data, 0, strlen($hd));
615
-			if ($prefix == $hd) return true;
623
+			if ($prefix == $hd) {
624
+			    return true;
625
+			}
616 626
 		}
617 627
 
618 628
 		return false;
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.wsdl.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,8 +78,9 @@
 block discarded – undo
78 78
 		$this->proxypassword = $proxypassword;
79 79
 		$this->timeout = $timeout;
80 80
 		$this->response_timeout = $response_timeout;
81
-		if (is_array($curl_options))
82
-			$this->curl_options = $curl_options;
81
+		if (is_array($curl_options)) {
82
+					$this->curl_options = $curl_options;
83
+		}
83 84
 		$this->use_curl = $use_curl;
84 85
 		$this->fetchWSDL($wsdl);
85 86
     }
Please login to merge, or discard this patch.
main/inc/lib/events_dispatcher.class.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,9 +18,11 @@
 block discarded – undo
18 18
 
19 19
         foreach ($event_config[$event_name]["actions"] as $func) {
20 20
             $execute = true;
21
-            if (!function_exists($func)) // if the function doesn't exist, we log
21
+            if (!function_exists($func)) {
22
+                // if the function doesn't exist, we log
22 23
             {
23 24
                 error_log("EventsDispatcher warning : ".$func." does not exist.");
25
+            }
24 26
                 $execute = false;
25 27
             }
26 28
 
Please login to merge, or discard this patch.
main/inc/lib/internationalization.lib.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1710,8 +1710,7 @@
 block discarded – undo
1710 1710
             }
1711 1711
         }
1712 1712
         return false;
1713
-    }
1714
-    elseif (is_array($encoding2)) {
1713
+    } elseif (is_array($encoding2)) {
1715 1714
         foreach ($encoding2 as $encoding) {
1716 1715
             if (api_equal_encodings($encoding1, $encoding, $strict)) {
1717 1716
                 return true;
Please login to merge, or discard this patch.
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/online.inc.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -389,7 +389,9 @@
 block discarded – undo
389 389
 */
390 390
 function who_is_online_in_this_course($from, $number_of_items, $uid, $time_limit, $course_code)
391 391
 {
392
-	if (empty($course_code)) return false;
392
+	if (empty($course_code)) {
393
+	    return false;
394
+	}
393 395
 
394 396
     if (empty($time_limit)) {
395 397
         $time_limit = api_get_setting('time_limit_whosonline');
Please login to merge, or discard this patch.
main/inc/lib/fileManage.lib.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,7 +33,9 @@  discard block
 block discarded – undo
33 33
             Database::query($query);
34 34
             break;
35 35
         case 'update':
36
-            if ($new_path[0] == '.') $new_path = substr($new_path, 1);
36
+            if ($new_path[0] == '.') {
37
+                $new_path = substr($new_path, 1);
38
+            }
37 39
             $new_path = str_replace('//', '/', $new_path);
38 40
 
39 41
             // Attempt to update	- tested & working for root	dir
@@ -379,7 +381,9 @@  discard block
 block discarded – undo
379 381
 			chdir($path);
380 382
 			$handle = opendir($path);
381 383
 			while ($element = readdir($handle)) {
382
-				if ($element == '.' || $element == '..') continue;
384
+				if ($element == '.' || $element == '..') {
385
+				    continue;
386
+				}
383 387
                 // Skip the current and parent directories
384 388
 				if (is_dir($element)) {
385 389
 					$dir_array[] = $path.'/'.$element;
@@ -419,7 +423,9 @@  discard block
 block discarded – undo
419 423
 				chdir($directory);
420 424
 				$handle = opendir($directory);
421 425
 			   	while ($element = readdir($handle)) {
422
-					if ($element == '.' || $element == '..' || $element == '.htaccess') continue;
426
+					if ($element == '.' || $element == '..' || $element == '.htaccess') {
427
+					    continue;
428
+					}
423 429
                     // Skip the current and parent directories
424 430
 					if (!is_dir($element)) {
425 431
 						$element_array[] = $directory.'/'.$element;
@@ -469,7 +475,9 @@  discard block
 block discarded – undo
469 475
 	 */
470 476
 	function set_default_settings($upload_path, $filename, $filetype = 'file', $glued_table, $default_visibility = 'v')
471 477
     {
472
-		if (!$default_visibility) $default_visibility = 'v';
478
+		if (!$default_visibility) {
479
+		    $default_visibility = 'v';
480
+		}
473 481
 
474 482
 		// Make sure path is not wrongly formed
475 483
 		$upload_path = !empty($upload_path) ? "/$upload_path" : '';
Please login to merge, or discard this patch.
main/inc/lib/sessionmanager.lib.php 1 patch
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1588,8 +1588,10 @@  discard block
 block discarded – undo
1588 1588
         if (empty($session_visibility)) {
1589 1589
             $session_visibility = $session->getVisibility();
1590 1590
             //default status loaded if empty
1591
-            if (empty($session_visibility))
1592
-                $session_visibility = SESSION_VISIBLE_READ_ONLY; // by default readonly 1
1591
+            if (empty($session_visibility)) {
1592
+                            $session_visibility = SESSION_VISIBLE_READ_ONLY;
1593
+            }
1594
+            // by default readonly 1
1593 1595
         } else {
1594 1596
             if (!in_array($session_visibility, array(SESSION_VISIBLE_READ_ONLY, SESSION_VISIBLE, SESSION_INVISIBLE))) {
1595 1597
                 $session_visibility = SESSION_VISIBLE_READ_ONLY;
@@ -2792,10 +2794,11 @@  discard block
 block discarded – undo
2792 2794
                                 c_id = $courseId AND
2793 2795
                                 user_id = $user_id ";
2794 2796
                     $result = Database::query($sql);
2795
-                    if (Database::affected_rows($result) > 0)
2796
-                        return true;
2797
-                    else
2798
-                        return false;
2797
+                    if (Database::affected_rows($result) > 0) {
2798
+                                            return true;
2799
+                    } else {
2800
+                                            return false;
2801
+                    }
2799 2802
                 } else {
2800 2803
                     // The user is not subscribed to the session, so make sure
2801 2804
                     // he isn't subscribed to a course in this session either
@@ -2806,10 +2809,11 @@  discard block
 block discarded – undo
2806 2809
                                 c_id = $courseId AND
2807 2810
                                 user_id = $user_id ";
2808 2811
                     $result = Database::query($sql);
2809
-                    if (Database::affected_rows($result) > 0)
2810
-                        return true;
2811
-                    else
2812
-                        return false;
2812
+                    if (Database::affected_rows($result) > 0) {
2813
+                                            return true;
2814
+                    } else {
2815
+                                            return false;
2816
+                    }
2813 2817
                 }
2814 2818
             } else {
2815 2819
                 // Assign user as a coach to course
Please login to merge, or discard this patch.
main/inc/lib/image.lib.php 1 patch
Braces   +57 added lines, -19 removed lines patch added patch discarded remove patch
@@ -154,7 +154,9 @@  discard block
 block discarded – undo
154 154
 
155 155
     public function set_image_wrapper()
156 156
     {
157
-        if ($this->debug) error_log('Image::set_image_wrapper loaded');
157
+        if ($this->debug) {
158
+            error_log('Image::set_image_wrapper loaded');
159
+        }
158 160
         try {
159 161
             if (file_exists($this->path)) {
160 162
                 $this->image     = new Imagick($this->path);
@@ -163,10 +165,14 @@  discard block
 block discarded – undo
163 165
                     $this->fill_image_info(); //Fills height, width and type
164 166
                 }
165 167
             } else {
166
-                if ($this->debug) error_log('Image::image does not exist');
168
+                if ($this->debug) {
169
+                    error_log('Image::image does not exist');
170
+                }
167 171
             }
168 172
         } catch(ImagickException $e) {
169
-            if ($this->debug) error_log($e->getMessage());
173
+            if ($this->debug) {
174
+                error_log($e->getMessage());
175
+            }
170 176
         }
171 177
     }
172 178
 
@@ -180,7 +186,9 @@  discard block
 block discarded – undo
180 186
 
181 187
         if (in_array($this->type, $this->allowed_extensions)) {
182 188
             $this->image_validated = true;
183
-            if ($this->debug) error_log('image_validated true');
189
+            if ($this->debug) {
190
+                error_log('image_validated true');
191
+            }
184 192
         }
185 193
     }
186 194
 
@@ -196,7 +204,9 @@  discard block
 block discarded – undo
196 204
 	//@todo implement border logic case for Imagick
197 205
 	public function resize($thumbw, $thumbh, $border, $specific_size = false)
198 206
     {
199
-	    if (!$this->image_validated) return false;
207
+	    if (!$this->image_validated) {
208
+	        return false;
209
+	    }
200 210
 
201 211
         if ($specific_size) {
202 212
             $width = $thumbw;
@@ -222,7 +232,9 @@  discard block
 block discarded – undo
222 232
      */
223 233
     
224 234
     public function crop($x, $y, $width, $height, $src_width, $src_height) {
225
-        if (!$this->image_validated) return false;
235
+        if (!$this->image_validated) {
236
+            return false;
237
+        }
226 238
         $this->image->cropimage($width, $height, $x, $y);
227 239
 		$this->width  = $width;
228 240
 		$this->height = $height;
@@ -230,7 +242,9 @@  discard block
 block discarded – undo
230 242
 
231 243
     public function send_image($file = '', $compress = -1, $convert_file_to = null)
232 244
     {
233
-        if (!$this->image_validated) return false;
245
+        if (!$this->image_validated) {
246
+            return false;
247
+        }
234 248
         $type = $this->type;
235 249
         if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) {
236 250
             $type = $convert_file_to;
@@ -238,20 +252,28 @@  discard block
 block discarded – undo
238 252
 		switch ($type) {
239 253
 		    case 'jpeg':
240 254
 			case 'jpg':
241
-				if (!$file) header("Content-type: image/jpeg");
255
+				if (!$file) {
256
+				    header("Content-type: image/jpeg");
257
+				}
242 258
 				break;
243 259
 			case 'png':
244
-				if (!$file) header("Content-type: image/png");
260
+				if (!$file) {
261
+				    header("Content-type: image/png");
262
+				}
245 263
 				break;
246 264
 			case 'gif':
247
-				if (!$file) header("Content-type: image/gif");
265
+				if (!$file) {
266
+				    header("Content-type: image/gif");
267
+				}
248 268
 				break;
249 269
 		}
250 270
 		$result = false;
251 271
 		try {
252 272
 		    $result = $this->image->writeImage($file);
253 273
 		} catch(ImagickException $e) {
254
-            if ($this->debug) error_log($e->getMessage());
274
+            if ($this->debug) {
275
+                error_log($e->getMessage());
276
+            }
255 277
         }
256 278
 
257 279
 		if (!$file) {
@@ -334,7 +356,9 @@  discard block
 block discarded – undo
334 356
 
335 357
     public function resize($thumbw, $thumbh, $border, $specific_size = false)
336 358
     {
337
-        if (!$this->image_validated) return false;
359
+        if (!$this->image_validated) {
360
+            return false;
361
+        }
338 362
 		if ($border == 1) {
339 363
             if ($specific_size) {
340 364
                 $width = $thumbw;
@@ -387,7 +411,9 @@  discard block
 block discarded – undo
387 411
      * @param int $src_height the source height of the original image
388 412
      */
389 413
     public function crop($x, $y, $width, $height, $src_width, $src_height) {
390
-        if (!$this->image_validated) return false;
414
+        if (!$this->image_validated) {
415
+            return false;
416
+        }
391 417
         $this->width = $width;
392 418
 		$this->height = $height;
393 419
         $src = null;
@@ -418,7 +444,9 @@  discard block
 block discarded – undo
418 444
 
419 445
 	public function send_image($file = '', $compress = -1, $convert_file_to = null)
420 446
     {
421
-	    if (!$this->image_validated) return false;
447
+	    if (!$this->image_validated) {
448
+	        return false;
449
+	    }
422 450
         $compress = (int)$compress;
423 451
         $type = $this->type;
424 452
         if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) {
@@ -427,19 +455,27 @@  discard block
 block discarded – undo
427 455
 		switch ($type) {
428 456
 		    case 'jpeg':
429 457
 			case 'jpg':
430
-				if (!$file) header("Content-type: image/jpeg");
431
-				if ($compress == -1) $compress = 100;
458
+				if (!$file) {
459
+				    header("Content-type: image/jpeg");
460
+				}
461
+				if ($compress == -1) {
462
+				    $compress = 100;
463
+				}
432 464
 				return imagejpeg($this->bg, $file, $compress);
433 465
 				break;
434 466
 			case 'png':
435
-				if (!$file) header("Content-type: image/png");
467
+				if (!$file) {
468
+				    header("Content-type: image/png");
469
+				}
436 470
 				if ($compress != -1) {
437 471
 					@imagetruecolortopalette($this->bg, true, $compress);
438 472
 				}
439 473
 				return imagepng($this->bg, $file, $compress);
440 474
 				break;
441 475
 			case 'gif':
442
-				if (!$file) header("Content-type: image/gif");
476
+				if (!$file) {
477
+				    header("Content-type: image/gif");
478
+				}
443 479
 				if ($compress != -1) {
444 480
 					@imagetruecolortopalette($this->bg, true, $compress);
445 481
 				}
@@ -456,7 +492,9 @@  discard block
 block discarded – undo
456 492
      */
457 493
     function convert2bw()
458 494
     {
459
-        if (!$this->image_validated) return false;
495
+        if (!$this->image_validated) {
496
+            return false;
497
+        }
460 498
 
461 499
         $dest_img = imagecreatetruecolor(imagesx($this->bg), imagesy($this->bg));
462 500
         /* copy ignore the transparent color
Please login to merge, or discard this patch.