@@ -380,7 +380,9 @@ |
||
380 | 380 | // check if user is allowed to see the block |
381 | 381 | if (method_exists($obj_block, 'is_block_visible_for_user')) { |
382 | 382 | $is_block_visible_for_user = $obj_block->is_block_visible_for_user($user_id); |
383 | - if (!$is_block_visible_for_user) continue; |
|
383 | + if (!$is_block_visible_for_user) { |
|
384 | + continue; |
|
385 | + } |
|
384 | 386 | } |
385 | 387 | |
386 | 388 | echo '<tr>'; |
@@ -2097,7 +2097,9 @@ |
||
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); |
@@ -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 |
@@ -108,8 +108,9 @@ discard block |
||
108 | 108 | // check if the glossary term already exists |
109 | 109 | if (GlossaryManager::glossary_exists($values['glossary_title'])) { |
110 | 110 | // display the feedback message |
111 | - if ($message) |
|
112 | - Display::display_error_message(get_lang('GlossaryTermAlreadyExistsYouShouldEditIt')); |
|
111 | + if ($message) { |
|
112 | + Display::display_error_message(get_lang('GlossaryTermAlreadyExistsYouShouldEditIt')); |
|
113 | + } |
|
113 | 114 | return false; |
114 | 115 | } else { |
115 | 116 | |
@@ -165,8 +166,9 @@ discard block |
||
165 | 166 | // check if the glossary term already exists |
166 | 167 | if (GlossaryManager::glossary_exists($values['glossary_title'],$values['glossary_id'])) { |
167 | 168 | // display the feedback message |
168 | - if ($message) |
|
169 | - Display::display_error_message(get_lang('GlossaryTermAlreadyExistsYouShouldEditIt')); |
|
169 | + if ($message) { |
|
170 | + Display::display_error_message(get_lang('GlossaryTermAlreadyExistsYouShouldEditIt')); |
|
171 | + } |
|
170 | 172 | return false; |
171 | 173 | } else { |
172 | 174 | $sql = "UPDATE $t_glossary SET |
@@ -188,8 +190,9 @@ discard block |
||
188 | 190 | api_get_user_id() |
189 | 191 | ); |
190 | 192 | // display the feedback message |
191 | - if ($message) |
|
192 | - Display::display_confirmation_message(get_lang('TermUpdated')); |
|
193 | + if ($message) { |
|
194 | + Display::display_confirmation_message(get_lang('TermUpdated')); |
|
195 | + } |
|
193 | 196 | } |
194 | 197 | |
195 | 198 | return true; |
@@ -323,8 +326,9 @@ discard block |
||
323 | 326 | // reorder the remaining terms |
324 | 327 | GlossaryManager::reorder_glossary(); |
325 | 328 | $_SESSION['max_glossary_display'] = GlossaryManager::get_max_glossary_item(); |
326 | - if ($message) |
|
327 | - Display::display_confirmation_message(get_lang('TermDeleted')); |
|
329 | + if ($message) { |
|
330 | + Display::display_confirmation_message(get_lang('TermDeleted')); |
|
331 | + } |
|
328 | 332 | return true; |
329 | 333 | } |
330 | 334 | |
@@ -633,8 +637,9 @@ discard block |
||
633 | 637 | WHERE c_id = $course_id AND glossary_id = '".Database::escape_string($next_id)."'"; |
634 | 638 | Database::query($sql1); |
635 | 639 | Database::query($sql2); |
636 | - if ($message) |
|
637 | - Display::display_confirmation_message(get_lang('TermMoved')); |
|
640 | + if ($message) { |
|
641 | + Display::display_confirmation_message(get_lang('TermMoved')); |
|
642 | + } |
|
638 | 643 | } |
639 | 644 | |
640 | 645 | /** |
@@ -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 | } |