libdir.'/adminlib.php'); $adminroot = admin_get_root(); admin_externalpage_setup('userauthentication', $adminroot); $auth = optional_param('auth', '', PARAM_SAFEDIR); $focus = ''; /// If data submitted, then process and store. if ($config = data_submitted()) { if (!confirm_sesskey()) { error(get_string('confirmsesskeybad', 'error')); } $config = (array)$config; // extract and sanitize the auth key explicitly $modules = get_list_of_plugins("auth"); if (in_array($config['auth'], $modules)) { $auth = $config['auth']; } else { notify("Error defining the authentication method"); } // load the auth plugin library require_once("{$CFG->dirroot}/auth/$auth/lib.php"); $err = array(); if (function_exists('auth_validate_form')) { auth_validate_form($config, $err); } if (count($err) == 0) { foreach ($config as $name => $value) { if (preg_match('/^pluginconfig_(.+?)$/', $name, $matches)) { $plugin = "auth/$auth"; $name = $matches[1]; if (! set_config($name, $value, $plugin)) { notify("Problem saving config $name as $value for plugin $plugin"); } } else { // normal handling for if (! set_config($name, $value)) { notify("Problem saving config $name as $value"); } } } redirect("auth.php?sesskey=$USER->sesskey", get_string("changessaved"), 1); exit; } else { foreach ($err as $key => $value) { $focus = "form.$key"; } } } /// Otherwise fill and print the form. if (empty($config)) { $config = $CFG; } $modules = get_list_of_plugins("auth"); $options = array(); foreach ($modules as $module) { $options[$module] = get_string("auth_$module"."title", "auth"); } asort($options); if (!empty($auth) && in_array($auth, $modules)) { } else { $auth = $config->auth; } // changepassword link replaced by individual auth setting if (!empty($config->changepassword)) { if (empty($config->{'auth_'.$auth.'_changepasswordurl'})) { $config->{'auth_'.$auth.'_changepasswordurl'} = $config->changepassword; } set_config('changepassword',''); } $auth = clean_param($auth,PARAM_SAFEDIR); require_once("$CFG->dirroot/auth/$auth/lib.php"); //just to make sure that current authentication functions are loaded if (! isset($config->guestloginbutton)) { $config->guestloginbutton = 1; } if (! isset($config->alternateloginurl)) { $config->alternateloginurl = ''; } if (! isset($config->auth_instructions)) { $config->auth_instructions = ""; } if (! isset($config->changepassword)) { $config->changepassword = ""; } if (! isset($config->{'auth_'.$auth.'_changepasswordurl'})) { $config->{'auth_'.$auth.'_changepasswordurl'} = ''; } if (! isset($config->{'auth_'.$auth.'_changepasswordhelp'})) { $config->{'auth_'.$auth.'_changepasswordhelp'} = ''; } $user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "department", "address", "city", "country", "description", "idnumber", "lang"); $guestoptions[0] = get_string("hide"); $guestoptions[1] = get_string("show"); $createoptions[0] = get_string("no"); $createoptions[1] = get_string("yes"); $stradministration = get_string("administration"); $strauthentication = get_string("authentication"); $strauthenticationoptions = get_string("authenticationoptions","auth"); $strsettings = get_string("settings"); $strusers = get_string("users"); admin_externalpage_print_header($adminroot); echo "
'; print_heading(get_string('auth_common_settings', 'auth')); echo ' | |||
"; print_string("changepassword", "auth"); echo ": | "; echo ""; $passurl = $config->{'auth_'.$auth.'_changepasswordurl'}; echo ""; echo " | "; echo ""; print_string("auth_changepasswordurl_expl","auth",$auth); echo " | |
"; print_string("auth_changepasswordhelp", "auth"); echo ": | "; echo ""; $passhelp = $config->{'auth_'.$auth.'_changepasswordhelp'}; echo "\n"; echo " | "; echo ""; print_string("auth_changepasswordhelp_expl","auth",$auth); echo " | |
"; print_string("guestloginbutton", "auth"); echo ": | "; echo ""; choose_from_menu($guestoptions, "guestloginbutton", $config->guestloginbutton, ""); echo " | "; echo ""; print_string("showguestlogin","auth"); echo " | |
"; print_string("auth_user_create", "auth"); echo ": | "; echo ""; choose_from_menu($createoptions, "auth_user_create", $config->auth_user_create, ""); echo " | "; echo ""; print_string("auth_user_creation","auth"); echo " | |
'; print_string('alternateloginurl', 'auth'); echo ' | '; echo ''; echo ''; echo ' | '; echo ''; print_string('alternatelogin', 'auth', htmlspecialchars($CFG->wwwroot.'/login/index.php')); echo ' | '; echo '