Files
Chamilo/main/auth/cas/cas_var.inc.php
T
Xes 73154ae174
Behat tests 1.11.x 🐞 / PHP 7.4 Test on ubuntu-latest (push) Canceled after 0s
PHP-CS-Fixer / composer_install (7.4) (push) Canceled after 0s
Chamilo 1.11.40 (ZIP oficial v1.11.40)
Fuente: https://github.com/chamilo/chamilo-lms/releases/download/v1.11.40/chamilo-1.11.40.zip
sha256: 1cf4bf2cc7bae1ef1a1eff643235db1d552f78ddf4b6dd1e2d2dac9868679439
Snapshot independiente (rama huerfana); diffable vs 1.11.38. vendor incluido.
2026-08-06 17:59:45 +02:00

74 lines
2.3 KiB
PHP

<?php
/* This file contains all the configuration variable for the cas module
* In the future, these will be in the database
*/
if (api_is_cas_activated()) {
require_once __DIR__.'/../../../vendor/apereo/phpcas/source/CAS.php';
// Get the $cas array from app/config/auth.conf.php
global $cas;
if (is_array($cas) && array_key_exists('debug', $cas) && !empty($cas['debug'])) {
phpCAS::setDebug($cas['debug']);
}
if (is_array($cas) && array_key_exists('verbose', $cas) && $cas['verbose']) {
phpCAS::setVerbose(true);
}
if (!phpCAS::isInitialized()) {
switch (api_get_setting('cas_protocol')) {
case 'CAS1':
$version = CAS_VERSION_1_0;
break;
case 'CAS3':
$version = CAS_VERSION_3_0;
break;
case 'SAML':
$version = SAML_VERSION_1_1;
break;
case 'CAS2':
default:
$version = CAS_VERSION_2_0;
}
$port = api_get_setting('cas_port');
if (is_null($port)) {
$port = 443;
} else {
$port = intval($port) ?: 443;
}
$uri = api_get_setting('cas_server_uri') ?: '';
$hostname = api_get_setting('cas_server') ?: 'localhost';
$serviceBaseUrl = '';
if (is_array($cas)) {
if (array_key_exists('service_base_url', $cas)) {
$serviceBaseUrl = $cas['service_base_url'];
}
}
phpCAS::client($version, $hostname, $port, $uri, $serviceBaseUrl);
if (is_array($cas) && array_key_exists('noCasServerValidation', $cas) && $cas['noCasServerValidation']) {
phpCAS::setNoCasServerValidation();
}
if (is_array($cas)) {
if (array_key_exists('fixedServiceURL', $cas)) {
$fixedServiceURL = $cas['fixedServiceURL'];
if (is_string($fixedServiceURL)) {
phpCAS::setFixedServiceURL($fixedServiceURL);
} elseif (is_bool($fixedServiceURL) && $fixedServiceURL) {
phpCAS::setFixedServiceURL(api_get_configuration_value('root_web'));
}
}
if (isset($cas['saml_validate_url'])) {
phpCAS::setServerSamlValidateURL($cas['saml_validate_url']);
}
}
}
}