@@ -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 | } |
@@ -545,8 +545,7 @@ |
||
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 |
@@ -1197,7 +1197,9 @@ |
||
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); |
@@ -1711,8 +1711,7 @@ discard block |
||
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 |
||
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 |
||
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. |
@@ -350,10 +350,18 @@ |
||
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; |
@@ -586,8 +586,7 @@ discard block |
||
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 |
||
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 | } |
@@ -808,8 +808,9 @@ |
||
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 .= '&'.implode('&', $param_string_parts); |
|
811 | + if (count($param_string_parts) > 0) { |
|
812 | + $result .= '&'.implode('&', $param_string_parts); |
|
813 | + } |
|
813 | 814 | } |
814 | 815 | return $result; |
815 | 816 | } |