Completed
Push — 1.11.x ( d78ca9...0f5bcf )
by José
71:55 queued 46:29
created
main/inc/lib/pdf.lib.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -536,8 +536,9 @@
 block discarded – undo
536 536
             }
537 537
         } else {
538 538
             $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png';   // course path
539
-            if (file_exists($store_path))
540
-                $web_path   = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png';
539
+            if (file_exists($store_path)) {
540
+                            $web_path   = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png';
541
+            }
541 542
         }
542 543
         return $web_path;
543 544
     }
Please login to merge, or discard this patch.
main/inc/lib/myspace.lib.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2097,7 +2097,9 @@
 block discarded – undo
2097 2097
                 FROM $tbl_course course
2098 2098
                 WHERE course.code IN (".implode(',',$courses_code).")";
2099 2099
 
2100
-        if (!in_array($direction, array('ASC','DESC'))) $direction = 'ASC';
2100
+        if (!in_array($direction, array('ASC','DESC'))) {
2101
+            $direction = 'ASC';
2102
+        }
2101 2103
 
2102 2104
         $column = intval($column);
2103 2105
         $from = intval($from);
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.soapclient.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -173,8 +173,9 @@  discard block
 block discarded – undo
173 173
 		}
174 174
 		if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) {
175 175
 			$this->loadWSDL();
176
-			if ($this->getError())
177
-				return false;
176
+			if ($this->getError()) {
177
+							return false;
178
+			}
178 179
 		}
179 180
 		// serialize parameters
180 181
 		if($this->endpointType == 'wsdl' && $opData = $this->getOperationData($operation)){
@@ -388,8 +389,9 @@  discard block
 block discarded – undo
388 389
 	function getOperationData($operation){
389 390
 		if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) {
390 391
 			$this->loadWSDL();
391
-			if ($this->getError())
392
-				return false;
392
+			if ($this->getError()) {
393
+							return false;
394
+			}
393 395
 		}
394 396
 		if(isset($this->operations[$operation])){
395 397
 			return $this->operations[$operation];
Please login to merge, or discard this patch.
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/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.