chamilo /
chamilo-lms
| 1 | <?php |
||
| 2 | /* For licensing terms, see /license.txt */ |
||
| 3 | |||
| 4 | $cidReset = true; |
||
| 5 | |||
| 6 | require_once __DIR__.'/main/inc/global.inc.php'; |
||
| 7 | |||
| 8 | if (api_get_setting('allow_terms_conditions') !== 'true') { |
||
| 9 | api_not_allowed(true); |
||
| 10 | } |
||
| 11 | |||
| 12 | if (api_is_anonymous() && api_get_configuration_value('gdpr_terms_public') !== true) { |
||
| 13 | api_not_allowed(true); |
||
| 14 | } |
||
| 15 | |||
| 16 | $language = api_get_interface_language(); |
||
| 17 | $language = api_get_language_id($language); |
||
| 18 | $term = LegalManager::get_last_condition($language); |
||
| 19 | |||
| 20 | if (!$term) { |
||
|
0 ignored issues
–
show
|
|||
| 21 | // look for the default language |
||
| 22 | $language = api_get_setting('platformLanguage'); |
||
| 23 | $language = api_get_language_id($language); |
||
| 24 | $term = LegalManager::get_last_condition($language); |
||
| 25 | } |
||
| 26 | |||
| 27 | $termExtraFields = new ExtraFieldValue('terms_and_condition'); |
||
| 28 | $values = $termExtraFields->getAllValuesByItem($term['id']); |
||
| 29 | foreach ($values as $value) { |
||
| 30 | if (!empty($value['value'])) { |
||
| 31 | $term['content'] .= '<h3>'.get_lang($value['display_text']).'</h3><br />'.$value['value'].'<br />'; |
||
| 32 | } |
||
| 33 | } |
||
| 34 | |||
| 35 | $term['date_text'] = get_lang('PublicationDate').': '. |
||
| 36 | api_get_local_time( |
||
| 37 | $term['date'], |
||
| 38 | null, |
||
| 39 | null, |
||
| 40 | false, |
||
| 41 | true, |
||
| 42 | true |
||
| 43 | ); |
||
| 44 | |||
| 45 | $tpl = new Template(null); |
||
| 46 | |||
| 47 | $tpl->assign('term', $term); |
||
| 48 | |||
| 49 | $socialLayout = $tpl->get_template('user_portal/terms.tpl'); |
||
| 50 | $tpl->display($socialLayout); |
||
| 51 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.