@@ -173,8 +173,9 @@ discard block |
||
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 |
||
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]; |
@@ -159,10 +159,12 @@ discard block |
||
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 |
||
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 |
||
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; |
@@ -78,8 +78,9 @@ |
||
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 | } |
@@ -18,9 +18,11 @@ |
||
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 |
@@ -1710,8 +1710,7 @@ |
||
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; |
@@ -16,31 +16,39 @@ |
||
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 | } |
@@ -389,7 +389,9 @@ |
||
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'); |
@@ -33,7 +33,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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" : ''; |
@@ -198,8 +198,7 @@ discard block |
||
198 | 198 | $tag_class = 'getid3_' . $tag_name; |
199 | 199 | $tag = new $tag_class($this); |
200 | 200 | $tag->Analyze(); |
201 | - } |
|
202 | - catch (getid3_exception $e) { |
|
201 | + } catch (getid3_exception $e) { |
|
203 | 202 | throw $e; |
204 | 203 | } |
205 | 204 | } |
@@ -243,9 +242,7 @@ discard block |
||
243 | 242 | // use assume format on these if format detection failed |
244 | 243 | if (preg_match('/\.mp[123a]$/i', $filename)) { |
245 | 244 | $determined_format = $file_format_array['mp3']; |
246 | - } |
|
247 | - |
|
248 | - else { |
|
245 | + } else { |
|
249 | 246 | fclose($this->fp); |
250 | 247 | throw new getid3_exception('Unable to determine file format'); |
251 | 248 | } |
@@ -259,8 +256,7 @@ discard block |
||
259 | 256 | if ($determined_format['fail_id3'] === 'ERROR') { |
260 | 257 | fclose($this->fp); |
261 | 258 | throw new getid3_exception('ID3 tags not allowed on this file type.'); |
262 | - } |
|
263 | - elseif ($determined_format['fail_id3'] === 'WARNING') { |
|
259 | + } elseif ($determined_format['fail_id3'] === 'WARNING') { |
|
264 | 260 | @$this->info['id3v1'] and $this->warning('ID3v1 tags not allowed on this file type.'); |
265 | 261 | @$this->info['id3v2'] and $this->warning('ID3v2 tags not allowed on this file type.'); |
266 | 262 | } |
@@ -301,11 +297,9 @@ discard block |
||
301 | 297 | |
302 | 298 | try { |
303 | 299 | $this->option_analyze and $class->Analyze(); |
304 | - } |
|
305 | - catch (getid3_exception $e) { |
|
300 | + } catch (getid3_exception $e) { |
|
306 | 301 | throw $e; |
307 | - } |
|
308 | - catch (Exception $e) { |
|
302 | + } catch (Exception $e) { |
|
309 | 303 | throw new getid3_exception('Corrupt file.'); |
310 | 304 | } |
311 | 305 | |
@@ -460,8 +454,7 @@ discard block |
||
460 | 454 | |
461 | 455 | if (is_array($message)) { |
462 | 456 | $this->warnings = array_merge($this->warnings, $message); |
463 | - } |
|
464 | - else { |
|
457 | + } else { |
|
465 | 458 | $this->warnings[] = $message; |
466 | 459 | } |
467 | 460 | } |
@@ -1101,8 +1094,7 @@ discard block |
||
1101 | 1094 | if (empty($this->info['comments'][$tag_name])) { |
1102 | 1095 | |
1103 | 1096 | // fall through and append value |
1104 | - } |
|
1105 | - elseif ($tag_type == 'id3v1') { |
|
1097 | + } elseif ($tag_type == 'id3v1') { |
|
1106 | 1098 | |
1107 | 1099 | $new_value_length = strlen(trim($value)); |
1108 | 1100 | foreach ($this->info['comments'][$tag_name] as $existing_key => $existing_value) { |
@@ -1112,8 +1104,7 @@ discard block |
||
1112 | 1104 | break 2; |
1113 | 1105 | } |
1114 | 1106 | } |
1115 | - } |
|
1116 | - else { |
|
1107 | + } else { |
|
1117 | 1108 | |
1118 | 1109 | $new_value_length = strlen(trim($value)); |
1119 | 1110 | foreach ($this->info['comments'][$tag_name] as $existing_key => $existing_value) { |