Пример #1
0
 public static function _getMultipleAuthModeOptions($lng)
 {
     global $ilSetting;
     // in the moment only ldap is activated as additional authentication method
     include_once 'Services/LDAP/classes/class.ilLDAPServer.php';
     $options[AUTH_LOCAL]['txt'] = $lng->txt('authenticate_ilias');
     // LDAP
     if ($ldap_id = ilLDAPServer::_getFirstActiveServer()) {
         $ldap_server = new ilLDAPServer($ldap_id);
         $options[AUTH_LDAP]['txt'] = $ldap_server->getName();
     }
     include_once 'Services/Radius/classes/class.ilRadiusSettings.php';
     $rad_settings = ilRadiusSettings::_getInstance();
     if ($rad_settings->isActive()) {
         $options[AUTH_RADIUS]['txt'] = $rad_settings->getName();
     }
     if ($ilSetting->get('apache_active')) {
         global $lng;
         $apache_settings = new ilSetting('apache_auth');
         $options[AUTH_APACHE]['txt'] = $apache_settings->get('name', $lng->txt('apache_auth'));
         $options[AUTH_APACHE]['hide_in_ui'] = true;
     }
     if ($ilSetting->get('auth_mode', AUTH_LOCAL) == AUTH_LDAP) {
         $default = AUTH_LDAP;
     } elseif ($ilSetting->get('auth_mode', AUTH_LOCAL) == AUTH_RADIUS) {
         $default = AUTH_RADIUS;
     } else {
         $default = AUTH_LOCAL;
     }
     $default = $ilSetting->get('default_auth_mode', $default);
     $default = (int) $_REQUEST['auth_mode'] ? (int) $_REQUEST['auth_mode'] : $default;
     // begin-patch auth_plugin
     $pls = ilAuthUtils::getAuthPlugins();
     foreach ($pls as $pl) {
         $auths = $pl->getAuthIds();
         foreach ($auths as $auth_id) {
             $pl_auth_option = $pl->getMultipleAuthModeOptions($auth_id);
             if ($pl_auth_option) {
                 $options = $options + $pl_auth_option;
             }
         }
     }
     // end-patch auth_plugins
     $options[$default]['checked'] = true;
     return $options ? $options : array();
 }