3 require_once(dirname(dirname(dirname(__FILE__
))) . '/config.php');
4 include_once($CFG->dirroot
.'/mnet/lib.php');
5 $stradministration = get_string('administration');
6 $strconfiguration = get_string('configuration');
7 $strmnetsettings = get_string('mnetsettings', 'mnet');
8 $strmnetservices = get_string('mnetservices', 'mnet');
9 $strmnetlog = get_string('mnetlog', 'mnet');
10 $strmnetedithost = get_string('reviewhostdetails', 'mnet');
13 $context = get_context_instance(CONTEXT_SYSTEM
);
15 require_capability('moodle/site:config', $context, $USER->id
, true, "nopermissions");
17 if (!$site = get_site()) {
18 print_error('nosite', '', '', NULL, true);
21 /// Initialize variables.
23 // Step must be one of:
24 // input Parse the details of a new host and fetch its public key
25 // commit Save our changes (to a new OR existing host)
26 $step = optional_param('step', 'verify', PARAM_ALPHA
);
27 $hostid = required_param('hostid', PARAM_INT
);
30 if ($_SERVER['REQUEST_METHOD'] != 'POST') {
31 redirect('index.php', get_string('postrequired','mnet') ,7);
34 if ('verify' == $step) {
35 $mnet_peer = new mnet_peer();
36 $mnet_peer->set_id($hostid);
37 $live_users = $mnet_peer->count_live_sessions();
38 if ($live_users > 0) {
39 $warn[] = get_string('usersareonline', 'mnet', $live_users);
41 include('delete.html');
42 } elseif ('delete' == $step) {
43 $mnet_peer = new mnet_peer();
44 $mnet_peer->set_id($hostid);
46 redirect('peers.php', get_string('hostdeleted', 'mnet'), 5);