4 * Allows admin to edit all auth plugin settings.
6 * JH: copied and Hax0rd from admin/enrol.php and admin/filters.php
10 require_once('../config.php');
11 require_once($CFG->libdir
.'/adminlib.php');
12 require_once($CFG->libdir
.'/tablelib.php');
16 $returnurl = new moodle_url('/admin/settings.php', array('section'=>'manageauths'));
18 $PAGE->set_url($returnurl);
20 $action = optional_param('action', '', PARAM_ALPHANUMEXT
);
21 $auth = optional_param('auth', '', PARAM_PLUGIN
);
23 get_enabled_auth_plugins(true); // fix the list of enabled auths
24 if (empty($CFG->auth
)) {
25 $authsenabled = array();
27 $authsenabled = explode(',', $CFG->auth
);
30 if (!empty($auth) and !exists_auth_plugin($auth)) {
31 print_error('pluginnotinstalled', 'auth', $returnurl, $auth);
34 ////////////////////////////////////////////////////////////////////////////////
37 if (!confirm_sesskey()) {
43 // Remove from enabled list.
44 $class = \core_plugin_manager
::resolve_plugininfo_class('auth');
45 $class::enable_plugin($auth, false);
49 // Add to enabled list.
50 $class = \core_plugin_manager
::resolve_plugininfo_class('auth');
51 $class::enable_plugin($auth, true);
55 $key = array_search($auth, $authsenabled);
56 // check auth plugin is valid
58 print_error('pluginnotenabled', 'auth', $returnurl, $auth);
61 if ($key < (count($authsenabled) - 1)) {
62 $fsave = $authsenabled[$key];
63 $authsenabled[$key] = $authsenabled[$key +
1];
64 $authsenabled[$key +
1] = $fsave;
65 $value = implode(',', $authsenabled);
66 add_to_config_log('auth', $CFG->auth
, $value, 'core');
67 set_config('auth', $value);
72 $key = array_search($auth, $authsenabled);
73 // check auth is valid
75 print_error('pluginnotenabled', 'auth', $returnurl, $auth);
79 $fsave = $authsenabled[$key];
80 $authsenabled[$key] = $authsenabled[$key - 1];
81 $authsenabled[$key - 1] = $fsave;
82 $value = implode(',', $authsenabled);
83 add_to_config_log('auth', $CFG->auth
, $value, 'core');
84 set_config('auth', $value);